From: Atari Ace [mailto:atari_ace@verizon.net]

Subject: [patch] Fix i386 bsr implementation

Hi mamedev,

The i386 cpu emulator will return the wrong result for bsr when the
highest bit is set (0 instead of 15 or 31).  The attached patch fixes
this.

~aa
This commit is contained in:
Aaron Giles 2008-08-14 06:21:31 +00:00
parent 5ad309b60f
commit 0921968934
2 changed files with 2 additions and 2 deletions

View File

@ -315,7 +315,7 @@ static void I386OP(bsr_r16_rm16)(void) // Opcode 0x0f bd
I.ZF = 1;
} else {
I.ZF = 0;
temp = 15;
dst = temp = 15;
while( (src & (1 << temp)) == 0 ) {
temp--;
dst = temp;

View File

@ -317,7 +317,7 @@ static void I386OP(bsr_r32_rm32)(void) // Opcode 0x0f bd
I.ZF = 1;
} else {
I.ZF = 0;
temp = 31;
dst = temp = 31;
while( (src & (1 << temp)) == 0 ) {
temp--;
dst = temp;