--- np2/i286c/i286c.c 2003/12/26 02:02:09 1.18 +++ np2/i286c/i286c.c 2004/01/05 15:47:18 1.21 @@ -94,9 +94,9 @@ const UINT8 iflags[512] = { // Z_FLA void i286c_initialize(void) { +#if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) UINT i; - UINT bit; - REG8 f; +#endif #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) for (i=0; i<0x100; i++) { @@ -124,6 +124,8 @@ void i286c_initialize(void) { #if !defined(MEMOPTIMIZE) for (i=0; i<0x10000; i++) { + REG8 f; + UINT bit; f = P_FLAG; for (bit=0x80; bit; bit>>=1) { if (i & bit) { @@ -145,33 +147,24 @@ void i286c_initialize(void) { v30cinit(); } -void i286c_reset(void) { +static void i286c_initreg(void) { - ZeroMemory(&I286_STAT, sizeof(I286_STAT)); I286_CS = 0xf000; CS_BASE = 0xf0000; I286_IP = 0xfff0; I286_ADRSMASK = 0xfffff; } -void i286c_shut(void) { - - I286_MSW = 0; +void i286c_reset(void) { - I286_ES = 0; - I286_CS = 0xf000; - I286_SS = 0; - I286_DS = 0; + ZeroMemory(&i286core.s, sizeof(i286core.s)); + i286c_initreg(); +} - ES_BASE = 0; - CS_BASE = 0xf0000; - SS_BASE = 0; - DS_BASE = 0; - SS_FIX = 0; - DS_FIX = 0; +void i286c_shut(void) { - I286_IP = 0xfff0; - I286_ADRSMASK = 0xfffff; + ZeroMemory(&i286core.s, offsetof(I286STAT, cpu_type)); + i286c_initreg(); } void CPUCALL i286c_intnum(UINT vect, REG16 IP) { @@ -272,7 +265,8 @@ UINT32 i286c_selector(UINT sel) { addr = (dtr->base24 << 16) + dtr->base + (sel & (~7)); ret = i286_memoryread_w(addr+2); ret += i286_memoryread(addr+4) << 16; - TRACEOUT(("PE - select %.4x %.8x", sel, ret)); + TRACEOUT(("selector idx=%x %s rpl=%d - real addr = %.6x", + (sel >> 3), (sel & 4)?"LDT":"GDT", sel & 3, ret)); return(ret); }