summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/i386/i386op32.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu/i386/i386op32.inc')
-rw-r--r--src/emu/cpu/i386/i386op32.inc136
1 files changed, 102 insertions, 34 deletions
diff --git a/src/emu/cpu/i386/i386op32.inc b/src/emu/cpu/i386/i386op32.inc
index bca0ffa301a..18b4ab46f20 100644
--- a/src/emu/cpu/i386/i386op32.inc
+++ b/src/emu/cpu/i386/i386op32.inc
@@ -1599,8 +1599,12 @@ void i386_device::i386_popfd() // Opcode 0x9d
void i386_device::i386_push_eax() // Opcode 0x50
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(EAX) );
else
FAULT(FAULT_SS,0)
@@ -1609,8 +1613,12 @@ void i386_device::i386_push_eax() // Opcode 0x50
void i386_device::i386_push_ecx() // Opcode 0x51
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(ECX) );
else
FAULT(FAULT_SS,0)
@@ -1619,8 +1627,12 @@ void i386_device::i386_push_ecx() // Opcode 0x51
void i386_device::i386_push_edx() // Opcode 0x52
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(EDX) );
else
FAULT(FAULT_SS,0)
@@ -1629,8 +1641,12 @@ void i386_device::i386_push_edx() // Opcode 0x52
void i386_device::i386_push_ebx() // Opcode 0x53
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(EBX) );
else
FAULT(FAULT_SS,0)
@@ -1639,8 +1655,12 @@ void i386_device::i386_push_ebx() // Opcode 0x53
void i386_device::i386_push_esp() // Opcode 0x54
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(ESP) );
else
FAULT(FAULT_SS,0)
@@ -1649,8 +1669,12 @@ void i386_device::i386_push_esp() // Opcode 0x54
void i386_device::i386_push_ebp() // Opcode 0x55
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(EBP) );
else
FAULT(FAULT_SS,0)
@@ -1659,8 +1683,12 @@ void i386_device::i386_push_ebp() // Opcode 0x55
void i386_device::i386_push_esi() // Opcode 0x56
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(ESI) );
else
FAULT(FAULT_SS,0)
@@ -1669,8 +1697,12 @@ void i386_device::i386_push_esi() // Opcode 0x56
void i386_device::i386_push_edi() // Opcode 0x57
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(REG32(EDI) );
else
FAULT(FAULT_SS,0)
@@ -1679,8 +1711,12 @@ void i386_device::i386_push_edi() // Opcode 0x57
void i386_device::i386_push_cs32() // Opcode 0x0e
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[CS].selector );
else
FAULT(FAULT_SS,0)
@@ -1689,8 +1725,12 @@ void i386_device::i386_push_cs32() // Opcode 0x0e
void i386_device::i386_push_ds32() // Opcode 0x1e
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[DS].selector );
else
FAULT(FAULT_SS,0)
@@ -1699,8 +1739,12 @@ void i386_device::i386_push_ds32() // Opcode 0x1e
void i386_device::i386_push_es32() // Opcode 0x06
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[ES].selector );
else
FAULT(FAULT_SS,0)
@@ -1709,8 +1753,12 @@ void i386_device::i386_push_es32() // Opcode 0x06
void i386_device::i386_push_fs32() // Opcode 0x0f a0
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[FS].selector );
else
FAULT(FAULT_SS,0)
@@ -1719,8 +1767,12 @@ void i386_device::i386_push_fs32() // Opcode 0x0f a0
void i386_device::i386_push_gs32() // Opcode 0x0f a8
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[GS].selector );
else
FAULT(FAULT_SS,0)
@@ -1729,8 +1781,12 @@ void i386_device::i386_push_gs32() // Opcode 0x0f a8
void i386_device::i386_push_ss32() // Opcode 0x16
{
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(m_sreg[SS].selector );
else
FAULT(FAULT_SS,0)
@@ -1740,8 +1796,12 @@ void i386_device::i386_push_ss32() // Opcode 0x16
void i386_device::i386_push_i32() // Opcode 0x68
{
UINT32 value = FETCH32();
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(value);
else
FAULT(FAULT_SS,0)
@@ -1751,8 +1811,12 @@ void i386_device::i386_push_i32() // Opcode 0x68
void i386_device::i386_pushad() // Opcode 0x60
{
UINT32 temp = REG32(ESP);
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-32) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 32;
+ else
+ offset = (REG16(SP) - 32) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
{
PUSH32(REG32(EAX) );
PUSH32(REG32(ECX) );
@@ -1772,8 +1836,12 @@ void i386_device::i386_pushfd() // Opcode 0x9c
{
if(!m_IOP1 && !m_IOP2 && V8086_MODE)
FAULT(FAULT_GP,0)
- UINT32 offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
- if(i386_limit_check(SS,offset-4) == 0)
+ UINT32 offset;
+ if(STACK_32BIT)
+ offset = REG32(ESP) - 4;
+ else
+ offset = (REG16(SP) - 4) & 0xffff;
+ if(i386_limit_check(SS,offset) == 0)
PUSH32(get_flags() & 0x00fcffff );
else
FAULT(FAULT_SS,0)