--- np2/i286c/i286c.c 2003/12/25 20:30:22 1.17 +++ np2/i286c/i286c.c 2004/01/05 05:04:53 1.20 @@ -145,33 +145,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; + i286core.s.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(&I286_STAT, sizeof(I286_STAT)); + 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) { @@ -262,6 +253,22 @@ void i286c_step(void) { } +UINT32 i286c_selector(UINT sel) { + + I286DTR *dtr; + UINT32 addr; + UINT32 ret; + + dtr = (sel & 4)?&I286_LDTRC:&I286_GDTR; + addr = (dtr->base24 << 16) + dtr->base + (sel & (~7)); + ret = i286_memoryread_w(addr+2); + ret += i286_memoryread(addr+4) << 16; + TRACEOUT(("selector idx=%x %s rpl=%d - real addr = %.6x", + (sel >> 3), (sel & 4)?"LDT":"GDT", sel & 3, ret)); + return(ret); +} + + // ---- test #if defined(I286C_TEST)