|
|
| version 1.4, 2004/08/08 17:45:52 | version 1.7, 2004/08/11 16:09:04 |
|---|---|
| Line 9 section .text | Line 9 section .text |
| global @z80x_interrupt2@4 | global @z80x_interrupt2@4 |
| global _z80x_nonmaskedinterrupt | global _z80x_nonmaskedinterrupt |
| global _z80x_execute | global _z80x_execute |
| global _z80x_step | |
| extern _z80core | extern _z80core |
| extern memfetch | extern memfetch |
| extern memrd16_ecx_ax | extern memrd16_ecx_ax |
| extern memwr16_ecx_dx | extern memwr16_ecx_dx |
| extern _cycles_main | extern _cycles_main |
| extern opcode_main | extern opcode_main |
| extern _z80dmap | |
| extern _dma | |
| align 16 | align 16 |
| _z80x_ableinterrupt: | _z80x_ableinterrupt: |
| Line 29 _z80x_ableinterrupt: | Line 31 _z80x_ableinterrupt: |
| align 16 | align 16 |
| @z80x_interrupt@4: | @z80x_interrupt@4: |
| mov edx, _z80core | mov edx, _z80core |
| btr word [edx + R_Z80IFF], IFF_HALT | mov al, [edx + R_Z80IFF] |
| jnc short .haltclr | test al, (1 << IFF_HALT) |
| je short .setintr | |
| inc word [edx + R_Z80PC] | inc word [edx + R_Z80PC] |
| .haltclr: or byte [edx + R_Z80IFF], ((1 << IFF_IRQ) | (1 << IFF_IFLAG)) | and al, ~(1 << IFF_HALT) |
| .setintr: or al, ((1 << IFF_IRQ) | (1 << IFF_IFLAG)) | |
| cmp byte [edx + R_Z80IM], 1 | cmp byte [edx + R_Z80IM], 1 |
| je short int_im1 | mov [edx + R_Z80IFF], al |
| jc short int_im0 | je short .im1 |
| jc short .im0 | |
| int_im2: mov ch, [edx + R_Z80I] | .im2: mov ch, [edx + R_Z80I] |
| movzx ecx, cx | movzx ecx, cx |
| call memrd16_ecx_ax | call memrd16_ecx_ax |
| sub word [edx + R_Z80SP], byte 2 | sub word [edx + R_Z80SP], byte 2 |
| Line 46 int_im2: mov ch, [edx + R_Z80I] | Line 51 int_im2: mov ch, [edx + R_Z80I] |
| mov dx, ax | mov dx, ax |
| jmp memwr16_ecx_dx | jmp memwr16_ecx_dx |
| int_im1: Z80WORK byte 11 | .im1: Z80WORK byte 11 |
| mov ax, [edx + R_Z80PC] | mov ax, [edx + R_Z80PC] |
| mov word [edx + R_Z80PC], 0x38 | mov word [edx + R_Z80PC], 0x38 |
| sub word [edx + R_Z80SP], byte 2 | sub word [edx + R_Z80SP], byte 2 |
| Line 54 int_im1: Z80WORK byte 11 | Line 59 int_im1: Z80WORK byte 11 |
| mov dx, ax | mov dx, ax |
| jmp memwr16_ecx_dx | jmp memwr16_ecx_dx |
| .im0: cmp cl, 0ddh | |
| align 16 | |
| @z80x_interrupt2@4: | |
| mov edx, _z80core | |
| btr word [edx + R_Z80IFF], IFF_HALT | |
| jnc short .haltclr | |
| inc word [edx + R_Z80PC] | |
| .haltclr: or byte [edx + R_Z80IFF], (1 << IFF_IFLAG) | |
| cmp byte [edx + R_Z80IM], 1 | |
| je short int_im1 | |
| jnc short int_im2 | |
| int_im0: cmp cl, 0ddh | |
| je short .ed | je short .ed |
| cmp cl, 0edh | cmp cl, 0edh |
| je short .ed | je short .ed |
| Line 99 _z80x_nonmaskedinterrupt: | Line 92 _z80x_nonmaskedinterrupt: |
| jmp memwr16_ecx_dx | jmp memwr16_ecx_dx |
| .cantnmi: ret | .cantnmi: ret |
| align 16 | |
| _z80x_execute push ebx | |
| push edi | |
| mov edi, _z80core | |
| cmp byte [_dma], 0 | |
| jne short .dmalp | |
| .lp: inc byte [edi + R_Z80R] | |
| movzx ecx, word [edi + R_Z80PC] | |
| inc word [edi + R_Z80PC] | |
| call memfetch | |
| movzx edx, byte [_cycles_main + eax] | |
| Z80WORK edx | |
| call dword [opcode_main + eax*4] | |
| mov eax, [edi + z80core_t.remainclock] | |
| cmp eax, byte 0 | |
| jg short .lp | |
| .ed: pop edi | |
| pop ebx | |
| ret | |
| .dmalp: inc byte [edi + R_Z80R] | |
| movzx ecx, word [edi + R_Z80PC] | |
| inc word [edi + R_Z80PC] | |
| call memfetch | |
| movzx edx, byte [_cycles_main + eax] | |
| Z80WORK edx | |
| call dword [opcode_main + eax*4] | |
| call _z80dmap | |
| mov eax, [edi + z80core_t.remainclock] | |
| cmp eax, byte 0 | |
| jg short .dmalp | |
| jmp short .ed | |
| align 16 | align 16 |
| _z80x_execute: push ebx | _z80x_step: push ebx |
| push edi | push edi |
| mov edi, _z80core | mov edi, _z80core |
| inc byte [edi + R_Z80R] | inc byte [edi + R_Z80R] |
| Line 111 _z80x_execute: push ebx | Line 136 _z80x_execute: push ebx |
| movzx edx, byte [_cycles_main + eax] | movzx edx, byte [_cycles_main + eax] |
| Z80WORK edx | Z80WORK edx |
| call dword [opcode_main + eax*4] | call dword [opcode_main + eax*4] |
| %if 1 | %if 0 |
| inc byte [edi + R_Z80R] | inc byte [edi + R_Z80R] |
| movzx ecx, word [edi + R_Z80PC] | movzx ecx, word [edi + R_Z80PC] |
| inc word [edi + R_Z80PC] | inc word [edi + R_Z80PC] |
| Line 122 _z80x_execute: push ebx | Line 147 _z80x_execute: push ebx |
| %endif | %endif |
| pop edi | pop edi |
| pop ebx | pop ebx |
| ret | jmp _z80dmap |
| ends | ends |