Fixed use of selector override with POP r/m - GTA now works again.
This commit is contained in:
parent
a514d2fe4b
commit
f478ed3b96
2 changed files with 46 additions and 10 deletions
|
|
@ -63,6 +63,38 @@ static inline uint32_t POP_L()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint16_t POP_W_seg(uint32_t seg)
|
||||||
|
{
|
||||||
|
uint16_t ret;
|
||||||
|
if (stack32)
|
||||||
|
{
|
||||||
|
ret = readmemw(seg, ESP); if (abrt) return 0;
|
||||||
|
ESP += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = readmemw(seg, SP); if (abrt) return 0;
|
||||||
|
SP += 2;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t POP_L_seg(uint32_t seg)
|
||||||
|
{
|
||||||
|
uint32_t ret;
|
||||||
|
if (stack32)
|
||||||
|
{
|
||||||
|
ret = readmeml(seg, ESP); if (abrt) return 0;
|
||||||
|
ESP += 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = readmeml(seg, SP); if (abrt) return 0;
|
||||||
|
SP += 4;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#include "x86_ops_arith.h"
|
#include "x86_ops_arith.h"
|
||||||
#include "x86_ops_atomic.h"
|
#include "x86_ops_atomic.h"
|
||||||
#include "x86_ops_bcd.h"
|
#include "x86_ops_bcd.h"
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,10 @@ static int opPUSH_imm_bl(uint32_t fetchdat)
|
||||||
static int opPOPW_a16(uint32_t fetchdat)
|
static int opPOPW_a16(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
|
uint32_t tempseg = ssegs ? oldss : ss;
|
||||||
|
|
||||||
if (ssegs) ss=oldss;
|
temp = POP_W_seg(tempseg); if (abrt) return 0;
|
||||||
temp = POP_W(); if (abrt) return 0;
|
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
seteaw(temp);
|
seteaw(temp);
|
||||||
if (abrt)
|
if (abrt)
|
||||||
|
|
@ -244,9 +245,10 @@ static int opPOPW_a16(uint32_t fetchdat)
|
||||||
static int opPOPW_a32(uint32_t fetchdat)
|
static int opPOPW_a32(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint16_t temp;
|
uint16_t temp;
|
||||||
|
uint32_t tempseg = ssegs ? oldss : ss;
|
||||||
|
|
||||||
|
temp = POP_W_seg(tempseg); if (abrt) return 0;
|
||||||
|
|
||||||
if (ssegs) ss=oldss;
|
|
||||||
temp = POP_W(); if (abrt) return 0;
|
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
seteaw(temp);
|
seteaw(temp);
|
||||||
if (abrt)
|
if (abrt)
|
||||||
|
|
@ -263,10 +265,11 @@ static int opPOPW_a32(uint32_t fetchdat)
|
||||||
static int opPOPL_a16(uint32_t fetchdat)
|
static int opPOPL_a16(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
|
uint32_t tempseg = ssegs ? oldss : ss;
|
||||||
|
|
||||||
if (ssegs) ss=oldss;
|
temp = POP_L_seg(tempseg); if (abrt) return 0;
|
||||||
temp = POP_L(); if (abrt) return 0;
|
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
seteal(temp);
|
seteal(temp);
|
||||||
if (abrt)
|
if (abrt)
|
||||||
{
|
{
|
||||||
|
|
@ -281,9 +284,10 @@ static int opPOPL_a16(uint32_t fetchdat)
|
||||||
static int opPOPL_a32(uint32_t fetchdat)
|
static int opPOPL_a32(uint32_t fetchdat)
|
||||||
{
|
{
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
|
uint32_t tempseg = ssegs ? oldss : ss;
|
||||||
|
|
||||||
|
temp = POP_L_seg(tempseg); if (abrt) return 0;
|
||||||
|
|
||||||
if (ssegs) ss=oldss;
|
|
||||||
temp = POP_L(); if (abrt) return 0;
|
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
seteal(temp);
|
seteal(temp);
|
||||||
if (abrt)
|
if (abrt)
|
||||||
|
|
@ -291,7 +295,7 @@ static int opPOPL_a32(uint32_t fetchdat)
|
||||||
if (stack32) ESP -= 4;
|
if (stack32) ESP -= 4;
|
||||||
else SP -= 4;
|
else SP -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is486) cycles -= ((mod == 3) ? 1 : 6);
|
if (is486) cycles -= ((mod == 3) ? 1 : 6);
|
||||||
else cycles -= ((mod == 3) ? 4 : 5);
|
else cycles -= ((mod == 3) ? 4 : 5);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue