From: Alan Cox Date: Tue, 26 Jul 2016 10:18:41 +0000 (+0100) Subject: trs80: first cut at dw_transaction X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5bc0be69c02e21664560e9a834cf85e439e222c5;p=FUZIX.git trs80: first cut at dw_transaction --- diff --git a/Kernel/platform-trs80/drivewire.s b/Kernel/platform-trs80/drivewire.s index b0ab7cbd..3604e75f 100644 --- a/Kernel/platform-trs80/drivewire.s +++ b/Kernel/platform-trs80/drivewire.s @@ -1,19 +1,67 @@ .module drivewire .globl _dw_operation + .globl _dw_transaction .globl _dw_reset .globl map_process_a + .globl map_process_always .globl map_kernel .area _COMMONMEM +; +; Implement dw_transaction for the TRS80 port +; +_dw_transaction: + push ix + ld ix,#0 + add ix,sp + ld a,-10(ix) + or a + push af + call nz, map_process_always + ld h,-2(ix) + ld l,-3(ix) + ld b,-4(ix) + ld c,-5(ix) + ld de, #txbyte + call dw_op + ld h,-6(ix) + ld l,-7(ix) + ld b,-8(ix) + ld c,-9(ix) + ld de, #rxbyte + call dw_op + ld hl, #0 + jr nc, read_good + ; We don't distinguish framing and short frames FIXME + dec hl +read_good: + pop af + call nz, map_kernel + pop ix + ret + ; dw_reset(driveptr) _dw_reset: ret +dw_op: + ld (op + 1),de +dw_op_loop: + ld a,b + or c + ret z +op: call rxbyte ; self modifies + ret c + ld (hl),a + inc hl + dec bc + jr dw_op_loop + ; dw_operation(cmdblock) _dw_operation: pop bc ; return