BSR and BSF correctly set zero flag now and 0 source for scan
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1176
This commit is contained in:
parent
76ec14475b
commit
f97b4bb800
1 changed files with 40 additions and 28 deletions
|
@ -479,53 +479,65 @@ switch (inst.code.op) {
|
|||
case O_BSFw:
|
||||
{
|
||||
FILLFLAGS;
|
||||
if (!inst.op1.w) SETFLAGBIT(ZF,true);
|
||||
Bitu count=0;
|
||||
while (count<16) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count++;
|
||||
if (!inst.op1.w) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bitu count=0;
|
||||
while (count<16) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count++;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
break;
|
||||
case O_BSFd:
|
||||
{
|
||||
FILLFLAGS;
|
||||
if (!inst.op1.d) SETFLAGBIT(ZF,true);
|
||||
Bitu count=0;
|
||||
while (count<32) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count++;
|
||||
if (!inst.op1.d) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bitu count=0;
|
||||
while (count<32) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count++;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
break;
|
||||
case O_BSRw:
|
||||
{
|
||||
FILLFLAGS;
|
||||
if (!inst.op1.w) SETFLAGBIT(ZF,true);
|
||||
Bits count=15;
|
||||
while (count>0) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count--;
|
||||
if (!inst.op1.w) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bits count=15;
|
||||
while (count>0) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count--;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
break;
|
||||
case O_BSRd:
|
||||
{
|
||||
FILLFLAGS;
|
||||
if (!inst.op1.d) SETFLAGBIT(ZF,true);
|
||||
Bits count=31;
|
||||
while (count>0) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count--;
|
||||
if (!inst.op1.d) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bits count=31;
|
||||
while (count>0) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count--;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
break;
|
||||
case O_BTw:
|
||||
|
|
Loading…
Add table
Reference in a new issue