]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - z180/conbuf-a.180
switch fifos conin,conout
[z180-stamp.git] / z180 / conbuf-a.180
index 8534f7300441c0af2d99e4cac4bac3447c31d9cf..0a351954225ef17d1c36d392799cd80a94150e97 100644 (file)
@@ -1,6 +1,6 @@
        page    255\r
        .z80\r
-       \r
+\r
 ;\r
 ; FIFO channels for communication with avr\r
 ;\r
@@ -9,16 +9,18 @@
        extrn   buf.init\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
@@ -48,7 +50,7 @@ buf.empty:
        ret     z\r
        or      0ffh\r
        ret\r
-       \r
+\r
 \r
 ff.in:\r
        push    ix\r
@@ -69,12 +71,12 @@ bg.wait:
        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
@@ -96,36 +98,68 @@ buf.full:
        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