|
|
| version 1.7, 2003/11/21 06:51:11 | version 1.11, 2003/12/01 10:45:46 |
|---|---|
| Line 9 | Line 9 |
| #include "i286c.mcr" | #include "i286c.mcr" |
| I286REG i286reg; | I286CORE i286core; |
| const BYTE iflags[256] = { // Z_FLAG, S_FLAG, P_FLAG | const BYTE iflags[256] = { // Z_FLAG, S_FLAG, P_FLAG |
| 0x44, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00, | 0x44, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00, |
| Line 48 const BYTE iflags[256] = { // Z_FLAG | Line 48 const BYTE iflags[256] = { // Z_FLAG |
| // ---- | // ---- |
| UINT32 EA_FIX; | BYTE _szpcflag8[0x200]; |
| BYTE szpcflag[0x200]; | |
| CALCEA c_calc_ea_dst[256]; | |
| CALCLEA c_calc_lea[192]; | |
| GETLEA c_get_ea[192]; | |
| #if !defined(MEMOPTIMIZE) | #if !defined(MEMOPTIMIZE) |
| BYTE szpflag_w[0x10000]; | BYTE _szpflag16[0x10000]; |
| #endif | #endif |
| #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) | #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) |
| Line 67 const BYTE iflags[256] = { // Z_FLAG | Line 63 const BYTE iflags[256] = { // Z_FLAG |
| UINT16 *_reg16_b20[256]; | UINT16 *_reg16_b20[256]; |
| #endif | #endif |
| static UINT32 ea_nop(void) { | |
| return(0); | |
| } | |
| void i286_initialize(void) { | void i286_initialize(void) { |
| UINT i; | UINT i; |
| UINT bit; | UINT bit; |
| BYTE f; | BYTE f; |
| int pos; | |
| for (i=0; i<0x100; i++) { | for (i=0; i<0x100; i++) { |
| f = P_FLAG; | f = P_FLAG; |
| Line 92 void i286_initialize(void) { | Line 82 void i286_initialize(void) { |
| if (i & 0x80) { | if (i & 0x80) { |
| f |= S_FLAG; | f |= S_FLAG; |
| } | } |
| szpcflag[i+0x000] = f; | _szpcflag8[i+0x000] = f; |
| szpcflag[i+0x100] = f | C_FLAG; | _szpcflag8[i+0x100] = f | C_FLAG; |
| } | } |
| #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) | #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) |
| for (i=0; i<0x100; i++) { | for (i=0; i<0x100; i++) { |
| int pos; | |
| #if defined(BYTESEX_LITTLE) | #if defined(BYTESEX_LITTLE) |
| pos = ((i & 0x20)?1:0); | pos = ((i & 0x20)?1:0); |
| #else | #else |
| Line 118 void i286_initialize(void) { | Line 109 void i286_initialize(void) { |
| #endif | #endif |
| } | } |
| #endif | #endif |
| for (i=0; i<0xc0; i++) { | |
| pos = ((i >> 3) & 0x18) + (i & 0x07); | |
| c_calc_ea_dst[i] = i286c_ea_dst_tbl[pos]; | |
| c_calc_lea[i] = i286c_lea_tbl[pos]; | |
| c_get_ea[i] = i286c_ea_tbl[pos]; | |
| } | |
| for (; i<0x100; i++) { | |
| c_calc_ea_dst[i] = ea_nop; | |
| } | |
| #if !defined(MEMOPTIMIZE) | #if !defined(MEMOPTIMIZE) |
| for (i=0; i<0x10000; i++) { | for (i=0; i<0x10000; i++) { |
| Line 142 void i286_initialize(void) { | Line 124 void i286_initialize(void) { |
| if (i & 0x8000) { | if (i & 0x8000) { |
| f |= S_FLAG; | f |= S_FLAG; |
| } | } |
| szpflag_w[i] = f; | _szpflag16[i] = f; |
| } | } |
| #endif | #endif |
| #if !defined(MEMOPTIMIZE) || (MEMOPTIMIZE < 2) | |
| i286cea_initialize(); | |
| #endif | |
| v30init(); | v30init(); |
| } | } |
| void i286_reset(void) { | void i286_reset(void) { |
| i286_initialize(); | i286_initialize(); |
| ZeroMemory(&i286reg, sizeof(i286reg)); | ZeroMemory(&i286core.s, sizeof(i286core.s)); |
| I286_CS = 0x1fc0; | I286_CS = 0x1fc0; |
| CS_BASE = 0x1fc00; | CS_BASE = 0x1fc00; |
| i286core.s.adrsmask = 0xfffff; | |
| } | } |
| void i286_resetprefetch(void) { | void i286_resetprefetch(void) { |
| } | } |
| void CPUCALL i286_intnum(UINT vect, UINT16 IP) { | void CPUCALL i286_intnum(UINT vect, REG16 IP) { |
| const BYTE *ptr; | const BYTE *ptr; |
| Line 246 void i286_step(void) { | Line 232 void i286_step(void) { |
| dmap_i286(); | dmap_i286(); |
| } | } |
| // ---- test | |
| #if defined(I286C_TEST) | |
| BYTE BYTESZPF(UINT r) { | |
| if (r & (~0xff)) { | |
| TRACEOUT(("BYTESZPF bound error: %x", r)); | |
| } | |
| return(_szpcflag8[r & 0xff]); | |
| } | |
| BYTE BYTESZPCF(UINT r) { | |
| if (r & (~0x1ff)) { | |
| TRACEOUT(("BYTESZPCF bound error: %x", r)); | |
| } | |
| return(_szpcflag8[r & 0x1ff]); | |
| } | |
| BYTE WORDSZPF(UINT32 r) { | |
| BYTE f1; | |
| BYTE f2; | |
| if (r & (~0xffff)) { | |
| TRACEOUT(("WORDSZPF bound error: %x", r)); | |
| } | |
| f1 = _szpflag16[r & 0xffff]; | |
| f2 = _szpcflag8[r & 0xff] & P_FLAG; | |
| f2 += (r)?0:Z_FLAG; | |
| f2 += (r >> 8) & S_FLAG; | |
| if (f1 != f2) { | |
| TRACEOUT(("word flag error: %.2x %.2x", f1, f2)); | |
| } | |
| return(f1); | |
| } | |
| BYTE WORDSZPCF(UINT32 r) { | |
| BYTE f1; | |
| BYTE f2; | |
| if ((r & 0xffff0000) && (!(r & 0x00010000))) { | |
| TRACEOUT(("WORDSZPCF bound error: %x", r)); | |
| } | |
| f1 = (r >> 16) & 1; | |
| f1 += _szpflag16[LOW16(r)]; | |
| f2 = _szpcflag8[r & 0xff] & P_FLAG; | |
| f2 += (LOW16(r))?0:Z_FLAG; | |
| f2 += (r >> 8) & S_FLAG; | |
| f2 += (r >> 16) & 1; | |
| if (f1 != f2) { | |
| TRACEOUT(("word flag error: %.2x %.2x", f1, f2)); | |
| } | |
| return(f1); | |
| } | |
| #endif | |