page 255\r
.z80\r
- \r
+\r
;\r
; FIFO channels for communication with avr\r
;\r
global ff.init,ff.in,ff.out,ff.i.st,ff.o.st\r
\r
- extrn buf.init\r
+ extrn bufinit\r
\r
include config.inc\r
+ if CPU_Z180\r
include z180reg.inc\r
+ endif\r
\r
\r
;--------------------------------------------------------------\r
\r
dseg\r
- \r
\r
- mkbuf co.fifo,co.fifo_len\r
- mkbuf ci.fifo,ci.fifo_len\r
+\r
+ mkbuf ci.fifo_id, ci.fifo, ci.fifo_len\r
+ mkbuf co.fifo_id, co.fifo, co.fifo_len\r
\r
\r
;--------------------------------------------------------------\r
\r
ff.init:\r
ld ix,ci.fifo\r
- ld a,ci.fifo.mask\r
- call buf.init\r
+ call bufinit\r
ld ix,co.fifo\r
- ld a,co.fifo.mask\r
- jp buf.init\r
+ jp bufinit\r
\r
\r
ff.i.st:\r
ret z\r
or 0ffh\r
ret\r
- \r
+\r
\r
ff.in:\r
push ix\r
inc h\r
bg.nc:\r
ld l,(hl)\r
- \r
+\r
ld a,(ix+o.out_idx) ;\r
inc a\r
and (ix+o.mask)\r
ld (ix+o.out_idx),a\r
- \r
+\r
ld a,l\r
pop hl\r
pop ix\r
ret\r
\r
\r
+ if 1\r
ff.out:\r
- push ix\r
- ld ix,co.fifo ;\r
+ push ix ;15\r
+ ld ix,co.fifo ;14\r
\r
buf.put:\r
- push hl ;\r
- push bc\r
- push ix\r
- pop hl\r
- ld a,c\r
- ld c,(ix+o.in_idx) ;\r
- ld b,0\r
- add hl,bc\r
- ld b,a\r
+ push hl ;11\r
+ push bc ;11\r
+ push ix ;15\r
+ pop hl ;10\r
+ ld a,c ;4\r
+ ld c,(ix+o.in_idx) ;19\r
+ ld b,0 ;7\r
+ add hl,bc ;11\r
+ ld (hl),a ;7\r
+ ld b,a ;4\r
+\r
+ ld a,c ;4\r
+ inc a ;4\r
+ and (ix+o.mask) ;19\r
+bp.wait:\r
+ cp (ix+o.out_idx) ;19\r
+ jr z,bp.wait ;12/7\r
+ ld (ix+o.in_idx),a ;19\r
\r
- ld a,c ;\r
- inc a\r
- and (ix+o.mask)\r
+ out (AVRINT6),a ;11\r
+ ld a,b ;4\r
+ pop bc ;10\r
+ pop hl ;10\r
+ pop ix ;14\r
+ ret ;10\r
+\r
+ else\r
+\r
+ff.out:\r
+ push ix ;15\r
+ ld ix,co.fifo ;14\r
+\r
+buf.put:\r
+ push hl ;11\r
+ push ix ;15\r
+ pop hl ;10\r
+ ld a,(ix+o.in_idx) ;19\r
+ add a,l ;4\r
+ ld l,a ;4\r
+ jr nc,bp.1 ;12/7\r
+ inc l ;4\r
+ ld (hl),c ;7\r
+ ld a,(ix+o.in_idx) ;19\r
+ inc a ;4\r
+ and (ix+o.mask) ;19\r
bp.wait:\r
- cp (ix+o.out_idx) ;\r
- jr z,bp.wait\r
- ld (hl),b\r
- ld (ix+o.in_idx),a\r
- \r
- out (AVRINT6),a\r
- ld a,b\r
- pop bc\r
- pop hl\r
- pop ix\r
- ret\r
+ cp (ix+o.out_idx) ;19\r
+ jr z,bp.wait ;12/7\r
+ ld (ix+o.in_idx),a ;19\r
\r
- end\r
+ out (AVRINT6),a ;11\r
+ ld a,c ;4\r
+ pop hl ;10\r
+ pop ix ;14\r
+ ret ;10 |\r
+\r
+ endif\r
\r
+ end\r