summaryrefslogtreecommitdiff
path: root/ddt180.z80
diff options
context:
space:
mode:
Diffstat (limited to 'ddt180.z80')
-rw-r--r--ddt180.z8070
1 files changed, 56 insertions, 14 deletions
diff --git a/ddt180.z80 b/ddt180.z80
index ef1dd6c..20d7a14 100644
--- a/ddt180.z80
+++ b/ddt180.z80
@@ -395,29 +395,71 @@ as1out:
;-------------------------------------------------------------------------------
+
+csio_rx_tmp: db 0ffh
+
csio_ista:
+ ld hl,csio_rx_tmp
+ ld a,(hl)
+ cp 0ffh
+ jr nz,csist_1
+ ld a,01
+ call csio_wr
+ call csio_rd
+ call csio_rd
+ ld (hl),a
+ sub a,0ffh
+ ret z
+csist_1:
+ or 0ffh
+ ret
+
csio_inp:
-csio_out:
- xor a
+ ld hl,csio_rx_tmp
+ ld a,(hl)
+ ld (hl),0ffh
+ cp 0ffh
+ ret nz
+csin_1:
+ ld a,01
+ call csio_wr
+ call csio_rd
+ call csio_rd
+ cp 0ffh
+ jr z,csin_1
+ ret
+
+csio_rd:
+ ld a,M_CSIO_RE
+ call csio_cmd_wait
+ in0 a,(trdr)
ret
+csio_out:
+ ld a,02
+ call csio_wr
+ call csio_rd
+ call csio_rd
+ or a
+ jr z,csio_out
- ld a,0ffh
-do_csio:
- push af
- call csio_wait_te
- pop af
+ ld a,c
+ inc a ;ff..02 --> 00..03
+ cp 04h
+ jr nc,csout_1
+ ld a,00h
+ call csio_wr
+csout_1:
+ ld a,c
+csio_wr:
out0 (trdr),a
ld a,M_CSIO_TE
+csio_cmd_wait:
out0 (cntr),a
- call csio_wait_te
- in0 a,(trdr)
- ret
-
-csio_wait_te:
+cswr_wait:
in0 a,(cntr)
- and M_CSIO_TE
- jr nz,csio_wait_te
+ and M_CSIO_TE+M_CSIO_RE
+ jr nz,cswr_wait
ret
endif ; CPM