i386: fix enter insn (nw)

This commit is contained in:
cracyc 2019-05-25 21:55:53 -05:00
parent 4187ef61d0
commit 85c7144e0d
2 changed files with 26 additions and 6 deletions

View File

@ -1185,10 +1185,20 @@ void i386_device::i386_enter16() // Opcode 0xc8
if(level > 0)
{
for(x=1;x<level-1;x++)
for(x=1;x<=level-1;x++)
{
REG16(BP) -= 2;
PUSH16(READ16(REG16(BP)));
uint32_t addr;
if(!STACK_32BIT)
{
REG16(BP) -= 2;
addr = REG16(BP);
}
else
{
REG32(EBP) -= 2;
addr = REG32(EBP);
}
PUSH16(READ16(i386_translate(SS, addr, 0)));
}
PUSH16(frameptr);
}

View File

@ -1030,10 +1030,20 @@ void i386_device::i386_enter32() // Opcode 0xc8
if(level > 0)
{
for(x=1;x<level-1;x++)
for(x=1;x<=level-1;x++)
{
REG32(EBP) -= 4;
PUSH32(READ32(REG32(EBP)));
uint32_t addr;
if(!STACK_32BIT)
{
REG16(BP) -= 4;
addr = REG16(BP);
}
else
{
REG32(EBP) -= 4;
addr = REG32(EBP);
}
PUSH32(READ32(i386_translate(SS, addr, 0)));
}
PUSH32(frameptr);
}