| version 1.4, 2003/12/01 10:45:46 | version 1.8, 2003/12/09 15:49:14 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
| #include        "i286.h" | #include        "cpucore.h" | 
 | #include        "i286x.h" | #include        "i286x.h" | 
 | #include        "i286xadr.h" | #include        "i286xadr.h" | 
 | #include        "i286xs.h" | #include        "i286xs.h" | 
| Line 52  const BYTE iflags[256] = {     // Z_FLAG | Line 52  const BYTE iflags[256] = {     // Z_FLAG | 
 | 0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84}; | 0x80, 0x84, 0x84, 0x80, 0x84, 0x80, 0x80, 0x84}; | 
 |  |  | 
 |  |  | 
| void i286_reset(void) { | void i286x_initialize(void) { | 
|  |  | 
|  | i286xadr_init(); | 
|  | v30xinit(); | 
|  | } | 
|  |  | 
|  | void i286x_reset(void) { | 
 |  |  | 
 | i286xadr_init();                                                        // 毎回通すのはどうか… |  | 
 | v30init();                                                                      // 毎回通すのはどうか… |  | 
 | ZeroMemory(&i286core.s, sizeof(i286core.s)); | ZeroMemory(&i286core.s, sizeof(i286core.s)); | 
 | I286_CS = 0x1fc0; | I286_CS = 0x1fc0; | 
 | CS_BASE = 0x1fc00; | CS_BASE = 0x1fc00; | 
| Line 63  void i286_reset(void) { | Line 67  void i286_reset(void) { | 
 | } | } | 
 |  |  | 
 |  |  | 
| LABEL void i286_resetprefetch(void) { | LABEL void i286x_resetprefetch(void) { | 
 |  |  | 
 | __asm { | __asm { | 
 | pushad | pushad | 
| Line 75  LABEL void i286_resetprefetch(void) { | Line 79  LABEL void i286_resetprefetch(void) { | 
 | } | } | 
 | } | } | 
 |  |  | 
| LABEL void __fastcall i286_interrupt(BYTE vect) { | LABEL void __fastcall i286x_interrupt(BYTE vect) { | 
 |  |  | 
 | __asm { | __asm { | 
 | pushad | pushad | 
| Line 165  LABEL void __fastcall i286x_localint(voi | Line 169  LABEL void __fastcall i286x_localint(voi | 
 |  |  | 
 |  |  | 
 |  |  | 
| LABEL void i286(void) { | LABEL void i286x(void) { | 
 |  |  | 
 | __asm { | __asm { | 
 | pushad | pushad | 
| Line 213  i286notrap:  mov  dword ptr (i286core.s. | Line 217  i286notrap:  mov  dword ptr (i286core.s. | 
 |  |  | 
 |  |  | 
 |  |  | 
| LABEL void i286_step(void) { | LABEL void i286x_step(void) { | 
 |  |  | 
 | __asm { | __asm { | 
 | pushad | pushad | 
| Line 573  I286 pop_ss(void) {        // 17: pop ss | Line 577  I286 pop_ss(void) {        // 17: pop ss | 
 | mov             SS_BASE, eax | mov             SS_BASE, eax | 
 | mov             SS_FIX, eax | mov             SS_FIX, eax | 
 | cmp             i286core.s.prefix, 0            // 00/06/24 | cmp             i286core.s.prefix, 0            // 00/06/24 | 
| je              noprefix | jne             prefix_exist | 
| call    removeprefix |  | 
| pop             eax |  | 
 | noprefix: | noprefix: | 
 | movzx   ebp, bh | movzx   ebp, bh | 
 | GET_NEXTPRE1 | GET_NEXTPRE1 | 
 | jmp             i286op[ebp*4] | jmp             i286op[ebp*4] | 
 |  |  | 
 |  | prefix_exist:   pop             eax                                             // eax<-offset removeprefix | 
 |  | call    eax | 
 |  | jmp             noprefix | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 2661  I286 _popf(void) {        // 9D: popf | Line 2667  I286 _popf(void) {        // 9D: popf | 
 | and             ah, 3 | and             ah, 3 | 
 | cmp             ah, 3 | cmp             ah, 3 | 
 | sete    I286_TRAP | sete    I286_TRAP | 
| I286IRQCHECKTERM |  | 
|  | je              irqcheck                                // fast_intr | 
|  | test    ah, 2 | 
|  | je              nextop | 
|  | cmp             pic.ext_irq, 0 | 
|  | jne             nextop | 
|  | mov             al, pic.pi[0].imr | 
|  | mov             ah, pic.pi[1].imr | 
|  | not             ax | 
|  | test    al, pic.pi[0].irr | 
|  | jne             irqcheck | 
|  | test    al, pic.pi[1].irr | 
|  | jne             irqcheck | 
|  | nextop:                 ret | 
|  |  | 
|  | irqcheck:               I286IRQCHECKTERM | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 3575  I286 _iret(void) {        // CF: iret | Line 3596  I286 _iret(void) {        // CF: iret | 
 | cmp             ah, 3 | cmp             ah, 3 | 
 | sete    I286_TRAP | sete    I286_TRAP | 
 | RESET_XPREFETCH | RESET_XPREFETCH | 
| I286IRQCHECKTERM |  | 
|  | cmp             I286_TRAP, 0                    // fast_intr | 
|  | jne             irqcheck | 
|  | test    I286_FLAG, I_FLAG | 
|  | je              nextop | 
|  | cmp             pic.ext_irq, 0 | 
|  | jne             nextop | 
|  | mov             al, pic.pi[0].imr | 
|  | mov             ah, pic.pi[1].imr | 
|  | not             ax | 
|  | test    al, pic.pi[0].irr | 
|  | jne             irqcheck | 
|  | test    al, pic.pi[1].irr | 
|  | jne             irqcheck | 
|  | nextop:                 ret | 
|  |  | 
|  | irqcheck:               I286IRQCHECKTERM | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 4158  I286 _sti(void) {        // FB: sti | Line 4195  I286 _sti(void) {        // FB: sti | 
 | __asm { | __asm { | 
 | GET_NEXTPRE1 | GET_NEXTPRE1 | 
 | I286CLOCK(2) | I286CLOCK(2) | 
| or              I286_FLAG, I_FLAG | cmp             i286core.s.prefix, 0    // ver0.26 00/10/08 | 
|  | jne             prefix_exist                    // 前方分岐ジャンプなので。 | 
|  | noprefix: | 
|  | movzx   ebp, bl | 
|  | bts             I286_FLAG, 9 | 
|  | jne             jmp_nextop | 
 | test    I286_FLAG, T_FLAG | test    I286_FLAG, T_FLAG | 
 | setne   I286_TRAP | setne   I286_TRAP | 
 |  |  | 
| cmp             i286core.s.prefix, 0    // ver0.26 00/10/08 | jne             nextopandexit                   // fast_intr | 
| jne             prefix_exist                    // 前方分岐ジャンプなので。 | cmp             pic.ext_irq, 0 | 
| noprefix:               movzx   eax, bl | jne             jmp_nextop | 
| call    i286op[eax*4] | mov             al, pic.pi[0].imr | 
|  | mov             ah, pic.pi[1].imr | 
|  | not             ax | 
|  | test    al, pic.pi[0].irr | 
|  | jne             nextopandexit | 
|  | test    al, pic.pi[1].irr | 
|  | jne             nextopandexit | 
|  | jmp_nextop:             jmp             i286op[ebp*4] | 
|  |  | 
|  | nextopandexit:  call    i286op[ebp*4] | 
 | I286IRQCHECKTERM | I286IRQCHECKTERM | 
 |  |  | 
 | prefix_exist:   pop             eax                                             // eax<-offset removeprefix | prefix_exist:   pop             eax                                             // eax<-offset removeprefix |