|
|
| version 1.3, 2003/10/19 14:56:15 | version 1.4, 2003/12/01 10:45:46 |
|---|---|
| Line 15 | Line 15 |
| #include "dmap.h" | #include "dmap.h" |
| 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 56 void i286_reset(void) { | Line 56 void i286_reset(void) { |
| i286xadr_init(); // 毎回通すのはどうか… | i286xadr_init(); // 毎回通すのはどうか… |
| v30init(); // 毎回通すのはどうか… | v30init(); // 毎回通すのはどうか… |
| 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; | |
| } | } |
| Line 68 LABEL void i286_resetprefetch(void) { | Line 69 LABEL void i286_resetprefetch(void) { |
| pushad | pushad |
| movzx esi, I286_IP | movzx esi, I286_IP |
| RESET_XPREFETCH | RESET_XPREFETCH |
| mov dword ptr (i286reg.prefetchque), ebx | mov dword ptr (i286core.s.prefetchque), ebx |
| popad | popad |
| ret | ret |
| } | } |
| Line 84 LABEL void __fastcall i286_interrupt(BYT | Line 85 LABEL void __fastcall i286_interrupt(BYT |
| sub bx, 2 | sub bx, 2 |
| // hlt.. | // hlt.. |
| cmp byte ptr (i286reg.prefetchque), 0f4h // hlt | cmp byte ptr (i286core.s.prefetchque), 0f4h // hlt |
| jne short nonhlt | jne short nonhlt |
| inc I286_IP | inc I286_IP |
| nonhlt: mov edi, SS_BASE | nonhlt: mov edi, SS_BASE |
| Line 116 nonhlt: mov edi, SS_BASE | Line 117 nonhlt: mov edi, SS_BASE |
| shl eax, 4 // make segreg | shl eax, 4 // make segreg |
| mov CS_BASE, eax | mov CS_BASE, eax |
| RESET_XPREFETCH | RESET_XPREFETCH |
| mov dword ptr (i286reg.prefetchque), ebx | mov dword ptr (i286core.s.prefetchque), ebx |
| popad | popad |
| ret | ret |
| Line 168 LABEL void i286(void) { | Line 169 LABEL void i286(void) { |
| __asm { | __asm { |
| pushad | pushad |
| mov ebx, dword ptr (i286reg.prefetchque) | mov ebx, dword ptr (i286core.s.prefetchque) |
| movzx esi, I286_IP | movzx esi, I286_IP |
| cmp I286_TRAP, 0 | cmp I286_TRAP, 0 |
| Line 180 i286_mnlp: movzx eax, bl | Line 181 i286_mnlp: movzx eax, bl |
| call i286op[eax*4] | call i286op[eax*4] |
| cmp I286_REMCLOCK, 0 | cmp I286_REMCLOCK, 0 |
| jg i286_mnlp | jg i286_mnlp |
| mov dword ptr (i286reg.prefetchque), ebx | mov dword ptr (i286core.s.prefetchque), ebx |
| mov I286_IP, si | mov I286_IP, si |
| popad | popad |
| ret | ret |
| Line 191 i286_dma_mnlp: movzx eax, bl | Line 192 i286_dma_mnlp: movzx eax, bl |
| call dmap_i286 | call dmap_i286 |
| cmp I286_REMCLOCK, 0 | cmp I286_REMCLOCK, 0 |
| jg i286_dma_mnlp | jg i286_dma_mnlp |
| mov dword ptr (i286reg.prefetchque), ebx | mov dword ptr (i286core.s.prefetchque), ebx |
| mov I286_IP, si | mov I286_IP, si |
| popad | popad |
| ret | ret |
| Line 203 i286_trapping: movzx eax, bl | Line 204 i286_trapping: movzx eax, bl |
| je i286notrap | je i286notrap |
| mov ecx, 1 | mov ecx, 1 |
| call i286x_localint | call i286x_localint |
| i286notrap: mov dword ptr (i286reg.prefetchque), ebx | i286notrap: mov dword ptr (i286core.s.prefetchque), ebx |
| mov I286_IP, si | mov I286_IP, si |
| popad | popad |
| ret | ret |
| Line 216 LABEL void i286_step(void) { | Line 217 LABEL void i286_step(void) { |
| __asm { | __asm { |
| pushad | pushad |
| mov ebx, dword ptr (i286reg.prefetchque) | mov ebx, dword ptr (i286core.s.prefetchque) |
| movzx esi, I286_IP | movzx esi, I286_IP |
| movzx eax, bl | movzx eax, bl |
| Line 227 LABEL void i286_step(void) { | Line 228 LABEL void i286_step(void) { |
| mov ecx, 1 | mov ecx, 1 |
| call i286x_localint | call i286x_localint |
| nexts: | nexts: |
| mov dword ptr (i286reg.prefetchque), ebx | mov dword ptr (i286core.s.prefetchque), ebx |
| mov I286_IP, si | mov I286_IP, si |
| call dmap_i286 | call dmap_i286 |
| Line 242 nexts: | Line 243 nexts: |
| LABEL void removeprefix(void) { | LABEL void removeprefix(void) { |
| __asm { | __asm { |
| mov i286reg.prefix, 0 | mov i286core.s.prefix, 0 |
| mov eax, DS_BASE | mov eax, DS_BASE |
| mov DS_FIX, eax | mov DS_FIX, eax |
| mov eax, SS_BASE | mov eax, SS_BASE |
| Line 571 I286 pop_ss(void) { // 17: pop ss | Line 572 I286 pop_ss(void) { // 17: pop ss |
| shl eax, 4 // make segreg | shl eax, 4 // make segreg |
| mov SS_BASE, eax | mov SS_BASE, eax |
| mov SS_FIX, eax | mov SS_FIX, eax |
| cmp i286reg.prefix, 0 // 00/06/24 | cmp i286core.s.prefix, 0 // 00/06/24 |
| je noprefix | je noprefix |
| call removeprefix | call removeprefix |
| pop eax | pop eax |
| Line 2412 I286 mov_seg_ea(void) { // 8E: mov | Line 2413 I286 mov_seg_ea(void) { // 8E: mov |
| segsetr:ret | segsetr:ret |
| align 16 | align 16 |
| setss: cmp i286reg.prefix, 0 // 00/05/13 | setss: cmp i286core.s.prefix, 0 // 00/05/13 |
| je noprefix | je noprefix |
| pop eax | pop eax |
| call eax // eax<-offset removeprefix | call eax // eax<-offset removeprefix |
| Line 3889 I286 in_al_data8(void) { // E4: in | Line 3890 I286 in_al_data8(void) { // E4: in |
| I286CLOCK(5) | I286CLOCK(5) |
| lea eax, [esi + 2] | lea eax, [esi + 2] |
| add eax, CS_BASE | add eax, CS_BASE |
| mov i286reg.inport, eax | mov i286core.s.inport, eax |
| movzx ecx, bh | movzx ecx, bh |
| #if 1 | #if 1 |
| call iocore_inp8 | call iocore_inp8 |
| Line 3897 I286 in_al_data8(void) { // E4: in | Line 3898 I286 in_al_data8(void) { // E4: in |
| call i286_in | call i286_in |
| #endif | #endif |
| mov I286_AL, al | mov I286_AL, al |
| mov i286reg.inport, 0 | mov i286core.s.inport, 0 |
| GET_NEXTPRE2 | GET_NEXTPRE2 |
| ret | ret |
| } | } |
| Line 4161 I286 _sti(void) { // FB: sti | Line 4162 I286 _sti(void) { // FB: sti |
| test I286_FLAG, T_FLAG | test I286_FLAG, T_FLAG |
| setne I286_TRAP | setne I286_TRAP |
| cmp i286reg.prefix, 0 // ver0.26 00/10/08 | cmp i286core.s.prefix, 0 // ver0.26 00/10/08 |
| jne prefix_exist // 前方分岐ジャンプなので。 | jne prefix_exist // 前方分岐ジャンプなので。 |
| noprefix: movzx eax, bl | noprefix: movzx eax, bl |
| call i286op[eax*4] | call i286op[eax*4] |