Fixed issues with latest change by adding safety 16bit handling (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-04-26 13:01:09 +00:00
parent fbbbaa20ae
commit a1d618b9da
2 changed files with 4 additions and 4 deletions

View File

@ -837,7 +837,7 @@ INLINE UINT8 POP8(i386_state *cpustate)
value = READ8(cpustate, ea );
} else {
REG16(SP) += 1;
ea = i386_translate(cpustate, SS, REG16(SP) - 1);
ea = i386_translate(cpustate, SS, (REG16(SP) - 1) & 0xffff);
value = READ8(cpustate, ea );
}
return value;
@ -852,7 +852,7 @@ INLINE UINT16 POP16(i386_state *cpustate)
value = READ16(cpustate, ea );
} else {
REG16(SP) += 2;
ea = i386_translate(cpustate, SS, REG16(SP) - 2);
ea = i386_translate(cpustate, SS, (REG16(SP) - 2) & 0xffff);
value = READ16(cpustate, ea );
}
return value;
@ -867,7 +867,7 @@ INLINE UINT32 POP32(i386_state *cpustate)
value = READ32(cpustate, ea );
} else {
REG16(SP) += 4;
ea = i386_translate(cpustate, SS, REG16(SP) - 4);
ea = i386_translate(cpustate, SS, (REG16(SP) - 4) & 0xffff);
value = READ32(cpustate, ea );
}
return value;

View File

@ -118,7 +118,7 @@ typedef enum {
#define FETCHWORD(var) { var = cpustate->direct->read_raw_byte(cpustate->pc, cpustate->fetch_xor); var += (cpustate->direct->read_raw_byte(cpustate->pc + 1, cpustate->fetch_xor) << 8); cpustate->pc += 2; }
#define CHANGE_PC(addr)
#define PUSH(val) { cpustate->regs.w[SP] -= 2; WriteWord(((cpustate->base[SS] + cpustate->regs.w[SP]) & AMASK), val); }
#define POP(var) { cpustate->regs.w[SP] += 2; var = ReadWord(((cpustate->base[SS] + (cpustate->regs.w[SP]-2)) & AMASK)); }
#define POP(var) { cpustate->regs.w[SP] += 2; var = ReadWord(((cpustate->base[SS] + ((cpustate->regs.w[SP]-2) & 0xffff)) & AMASK)); }
/************************************************************************/