--- np2/i286x/i286x.cpp 2004/02/18 20:11:36 1.21 +++ np2/i286x/i286x.cpp 2005/03/24 02:21:21 1.26 @@ -11,12 +11,16 @@ #include "i286xea.mcr" #include "v30patch.h" #include "bios.h" -#include "dmap.h" +#include "dmax86.h" +#if defined(ENABLE_TRAP) +#include "steptrap.h" +#include "inttrap.h" +#endif I286CORE i286core; -const BYTE iflags[256] = { // Z_FLAG, S_FLAG, P_FLAG +const UINT8 iflags[256] = { // Z_FLAG, S_FLAG, P_FLAG 0x44, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04, @@ -95,7 +99,7 @@ void i286x_setextsize(UINT32 size) { CPU_EXTMEM = NULL; } if (size) { - CPU_EXTMEM = (BYTE *)_MALLOC(size + 16, "EXTMEM"); + CPU_EXTMEM = (UINT8 *)_MALLOC(size + 16, "EXTMEM"); if (CPU_EXTMEM == NULL) { size = 0; } @@ -110,7 +114,7 @@ void i286x_setextsize(UINT32 size) { void i286x_setemm(UINT frame, UINT32 addr) { - BYTE *ptr; + UINT8 *ptr; frame &= 3; if (addr < USE_HIMEM) { @@ -138,7 +142,7 @@ LABEL void i286x_resetprefetch(void) { } } -LABEL void __fastcall i286x_interrupt(BYTE vect) { +LABEL void __fastcall i286x_interrupt(UINT8 vect) { __asm { pushad @@ -264,7 +268,13 @@ LABEL void i286x(void) { cmp dmac.working, 0 jne short i286_dma_mnlp -i286_mnlp: movzx eax, bl +i286_mnlp: +#if defined(ENABLE_TRAP) + mov edx, esi + movzx ecx, I286_CS + call steptrap +#endif + movzx eax, bl call i286op[eax*4] cmp I286_REMCLOCK, 0 jg i286_mnlp @@ -274,9 +284,15 @@ i286_mnlp: movzx eax, bl ret align 16 -i286_dma_mnlp: movzx eax, bl +i286_dma_mnlp: +#if defined(ENABLE_TRAP) + mov edx, esi + movzx ecx, I286_CS + call steptrap +#endif + movzx eax, bl call i286op[eax*4] - call dmap_i286 + call dmax86 cmp I286_REMCLOCK, 0 jg i286_dma_mnlp mov dword ptr (i286core.s.prefetchque), ebx @@ -285,7 +301,13 @@ i286_dma_mnlp: movzx eax, bl ret align 16 -i286_trapping: movzx eax, bl +i286_trapping: +#if defined(ENABLE_TRAP) + mov edx, esi + movzx ecx, I286_CS + call steptrap +#endif + movzx eax, bl call i286op[eax*4] cmp I286_TRAP, 0 je i286notrap @@ -318,7 +340,7 @@ nexts: mov dword ptr (i286core.s.prefetchque), ebx mov I286_IP, si - call dmap_i286 + call dmax86 popad ret } @@ -343,7 +365,7 @@ LABEL void removeprefix(void) { I286 _reserved(void) { __asm { - inc si // 01/08/31 +// inc si // 01/08/31 INT_NUM(6) } } @@ -1695,7 +1717,7 @@ I286 _arpl(void) { xor eax, eax cmp bh, 0c0h setc al - add si, ax + // add si, ax add eax, 10 I286CLOCK(eax) INT_NUM(6) @@ -2385,7 +2407,7 @@ I286 mov_ea_r8(void) { // 88: mov __asm { PREPART_EA_REG8(2) mov I286_REG[eax], dl - GET_NEXTPRE2 // ea_regの regregだけ + GET_NEXTPRE1 // ea_regの regregだけ ret align 16 memory_eareg8: @@ -3487,7 +3509,7 @@ I286 _enter(void) { // C8: enter je enter0 dec eax je enter1 - lea ecx, [eax*4 + 12] + lea ecx, [eax*4 + 12 + 4] I286CLOCK(ecx) push ebx movzx ebx, I286_BP @@ -3635,6 +3657,13 @@ I286 int_data8(void) { // CD: int lea ecx, [edi + ebp] mov dx, I286_CS call i286_memorywrite_w +#if defined(ENABLE_TRAP) + movzx eax, bh + push eax + lea edx, [esi - 1] + movzx ecx, I286_CS + call softinttrap +#endif movzx eax, bh sub bp, 2 mov I286_SP, bp @@ -3660,7 +3689,8 @@ I286 _into(void) { // CE: into GET_NEXTPRE1 ret - intovf: INT_NUM(4) + intovf: inc si // ver0.80 + INT_NUM(4) } } @@ -4348,7 +4378,7 @@ I286 _ope0xff(void) { // FF: // ------------------------------------------------------------------------- -void (*i286op[])(void) = { +const I286TBL i286op[256] = { add_ea_r8, // 00: add EA, REG8 add_ea_r16, // 01: add EA, REG16 add_r8_ea, // 02: add REG8, EA @@ -4672,7 +4702,7 @@ I286 repe_segprefix_ds(void) { } } -void (*i286op_repe[])(void) = { +const I286TBL i286op_repe[256] = { add_ea_r8, // 00: add EA, REG8 add_ea_r16, // 01: add EA, REG16 add_r8_ea, // 02: add REG8, EA @@ -4996,7 +5026,7 @@ I286 repne_segprefix_ds(void) { } } -void (*i286op_repne[])(void) = { +const I286TBL i286op_repne[256] = { add_ea_r8, // 00: add EA, REG8 add_ea_r16, // 01: add EA, REG16 add_r8_ea, // 02: add REG8, EA