summaryrefslogtreecommitdiff
path: root/z180/conbuf-a.180
diff options
context:
space:
mode:
Diffstat (limited to 'z180/conbuf-a.180')
-rw-r--r--z180/conbuf-a.180100
1 files changed, 67 insertions, 33 deletions
diff --git a/z180/conbuf-a.180 b/z180/conbuf-a.180
index 8534f73..e86b8b2 100644
--- a/z180/conbuf-a.180
+++ b/z180/conbuf-a.180
@@ -1,6 +1,6 @@
page 255
.z80
-
+
;
; FIFO channels for communication with avr
;
@@ -9,16 +9,18 @@
extrn buf.init
include config.inc
+ if CPU_Z180
include z180reg.inc
+ endif
;--------------------------------------------------------------
dseg
-
- mkbuf co.fifo,co.fifo_len
- mkbuf ci.fifo,ci.fifo_len
+
+ mkbuf co.fifo_id, co.fifo, co.fifo_len
+ mkbuf ci.fifo_id, ci.fifo, ci.fifo_len
;--------------------------------------------------------------
@@ -48,7 +50,7 @@ buf.empty:
ret z
or 0ffh
ret
-
+
ff.in:
push ix
@@ -69,12 +71,12 @@ bg.wait:
inc h
bg.nc:
ld l,(hl)
-
+
ld a,(ix+o.out_idx) ;
inc a
and (ix+o.mask)
ld (ix+o.out_idx),a
-
+
ld a,l
pop hl
pop ix
@@ -96,36 +98,68 @@ buf.full:
ret
+ if 1
ff.out:
- push ix
- ld ix,co.fifo ;
+ push ix ;15
+ ld ix,co.fifo ;14
buf.put:
- push hl ;
- push bc
- push ix
- pop hl
- ld a,c
- ld c,(ix+o.in_idx) ;
- ld b,0
- add hl,bc
- ld b,a
+ push hl ;11
+ push bc ;11
+ push ix ;15
+ pop hl ;10
+ ld a,c ;4
+ ld c,(ix+o.in_idx) ;19
+ ld b,0 ;7
+ add hl,bc ;11
+ ld (hl),a ;7
+ ld b,a ;4
+
+ ld a,c ;4
+ inc a ;4
+ and (ix+o.mask) ;19
+bp.wait:
+ cp (ix+o.out_idx) ;19
+ jr z,bp.wait ;12/7
+ ld (ix+o.in_idx),a ;19
- ld a,c ;
- inc a
- and (ix+o.mask)
+ out (AVRINT6),a ;11
+ ld a,b ;4
+ pop bc ;10
+ pop hl ;10
+ pop ix ;14
+ ret ;10
+
+ else
+
+ff.out:
+ push ix ;15
+ ld ix,co.fifo ;14
+
+buf.put:
+ push hl ;11
+ push ix ;15
+ pop hl ;10
+ ld a,(ix+o.in_idx) ;19
+ add a,l ;4
+ ld l,a ;4
+ jr nc,bp.1 ;12/7
+ inc l ;4
+ ld (hl),c ;7
+ ld a,(ix+o.in_idx) ;19
+ inc a ;4
+ and (ix+o.mask) ;19
bp.wait:
- cp (ix+o.out_idx) ;
- jr z,bp.wait
- ld (hl),b
- ld (ix+o.in_idx),a
-
- out (AVRINT6),a
- ld a,b
- pop bc
- pop hl
- pop ix
- ret
+ cp (ix+o.out_idx) ;19
+ jr z,bp.wait ;12/7
+ ld (ix+o.in_idx),a ;19
- end
+ out (AVRINT6),a ;11
+ ld a,c ;4
+ pop hl ;10
+ pop ix ;14
+ ret ;10 |
+
+ endif
+ end