trs80: first cut at dw_transaction
authorAlan Cox <alan@linux.intel.com>
Tue, 26 Jul 2016 10:18:41 +0000 (11:18 +0100)
committerAlan Cox <alan@linux.intel.com>
Tue, 26 Jul 2016 10:18:41 +0000 (11:18 +0100)
Kernel/platform-trs80/drivewire.s

index b0ab7cb..3604e75 100644 (file)
@@ -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