--- np2/mem/x86/dmax86.x86 2005/02/08 09:57:27 1.1 +++ np2/mem/x86/dmax86.x86 2011/02/02 13:50:29 1.5 @@ -1,38 +1,5 @@ - struc dmach_t -.adrs resd 1 ; 00 -.leng resw 1 ; 04 -.adrsorg resw 1 ; 06 -.lengorg resw 1 ; 08 -.action resw 1 ; 0a -.outproc resd 1 ; 0c -.inproc resd 1 ; 10 -.extproc resd 1 ; 14 -.mode resb 1 ; 18 -.sreq resb 1 ; 19 -.ready resb 1 ; 1a -.mask resb 1 ; 1b -.size ; 1c - endstruc - - struc dmac_t -.dmach resb (dmach_t.size * 4) -.lh resd 1 -.work resb 1 -.working resb 1 -.mask resb 1 -.stat resb 1 - endstruc - -DMAEXT_START equ 0 -DMAEXT_END equ 1 -DMAEXT_BREAK equ 2 -DMA_INITSIGNALONLY equ 1 - - -section .bss - - extern _dmac +%include 'iocore.inc' section .text @@ -40,53 +7,50 @@ section .text extern @i286_memoryread@4 extern @i286_memorywrite@8 - align 16 _dmax86: cmp byte [_dmac + dmac_t.working], byte 0 - je short dmap_nowork - mov eax, _dmac + dmac_t.dmach + je short .nowork mov cl, 1 -dmap_sea: test [_dmac + dmac_t.working], cl - jne short dmap_hit + mov eax, _dmac + dmac_t.dmach +.sea: test [_dmac + dmac_t.working], cl + jne short .hit add cl, cl - add eax, dmach_t.size - and cl, 15 - jne short dmap_sea -dmap_nowork: ret + add eax, byte dmach_t_size + test cl, 15 + jne short .sea +.nowork: ret -dmap_hit: push edi +.hit: push edi sub word [eax + dmach_t.leng], byte 1 mov edi, eax - jnc short dmap_exec + jnc short .exec or [_dmac + dmac_t.stat], cl not cl and [_dmac + dmac_t.working], cl mov ecx, DMAEXT_END call dword [edi + dmach_t.extproc] -dmap_exec: mov al, [edi + dmach_t.mode] - and al, 0ch - je short dmap_verify - cmp al, 04h - je short dmap_port2mem +.exec: mov al, [edi + dmach_t.mode] + and al, 0x0c + je short .verify + cmp al, 0x04 + je short .port2mem mov ecx, [edi + dmach_t.adrs] call @i286_memoryread@4 mov cl, al call dword [edi + dmach_t.outproc] - jmp short dmap_inccnt -dmap_verify: call dword [edi + dmach_t.inproc] - jmp short dmap_inccnt -dmap_port2mem: call dword [edi + dmach_t.inproc] + jmp short .inccnt +.verify: call dword [edi + dmach_t.inproc] + jmp short .inccnt +.port2mem: call dword [edi + dmach_t.inproc] mov ecx, [edi + dmach_t.adrs] mov dl, al call @i286_memorywrite@8 -dmap_inccnt: test byte [edi + dmach_t.mode], 20h - jne short dmap_adrsdec +.inccnt: test byte [edi + dmach_t.mode], 0x20 + jne short .adrsdec inc dword [edi + dmach_t.adrs] pop edi ret -dmap_adrsdec: dec dword [edi + dmach_t.adrs] +.adrsdec: dec dword [edi + dmach_t.adrs] pop edi ret - ends -