--- xmil/z80x/z80x_mn.x86 2004/08/08 17:45:52 1.2 +++ xmil/z80x/z80x_mn.x86 2004/08/14 12:16:18 1.4 @@ -144,18 +144,22 @@ _di: or byte [edi + R_Z80IFF], (1 << ret align 16 -_ei: and byte [edi + R_Z80IFF], ~(1 << IFF_IFLAG) - movzx ecx, word [edi + R_Z80PC] - call memfetch - cmp al, 0fbh - je short .eiret - inc byte [edi + R_Z80R] - inc word [edi + R_Z80PC] - movzx edx, byte [_cycles_main + eax] - Z80WORK edx - jmp [opcode_main + eax*4] -.eiret: ret - +_ei: mov al, [edi + R_Z80IFF] + test al, (1 << IFF_IFLAG) + je short .ed + and al, ~(1 << IFF_IFLAG) + mov edx, [edi + z80core_t.remainclock] + mov [edi + R_Z80IFF], al + test al, (1 << IFF_NMI) + jne short .nextop + cmp dword [edi + R_Z80REQIRQ], byte 0 + jne short .eventexit +.nextop: cmp edx, byte 1 + jge short .ed +.eventexit: dec edx + mov dword [edi + z80core_t.remainclock], 1 + sub [edi + z80core_t.baseclock], edx +.ed: ret align 16 ld_nop: ret