--- xmil/z80x/z80x_mn.x86 2004/08/01 05:31:32 1.1 +++ xmil/z80x/z80x_mn.x86 2004/08/11 12:08:17 1.3 @@ -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 dx - 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_IRQ) | (1 << IFF_NMI)) + jne short .nextop + cmp dword [edi + z80core_t.reqirq], 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 @@ -745,21 +749,21 @@ in_a_byte: GETPCAL _dd: inc byte [edi + R_Z80R] FETCH movzx edx, byte [_cycles_xx + eax] - Z80WORK dx + Z80WORK edx jmp [opcode_dd + eax*4] align 16 _ed: inc byte [edi + R_Z80R] FETCH movzx edx, byte [_cycles_ed + eax] - Z80WORK dx + Z80WORK edx jmp [opcode_ed + eax*4] align 16 _fd: inc byte [edi + R_Z80R] FETCH movzx edx, byte [_cycles_xx + eax] - Z80WORK dx + Z80WORK edx jmp [opcode_fd + eax*4]