]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/commitdiff
ff_put/ff_puth: preserve hl, don't return output char
authorLeo C <erbl259-lmu@yahoo.de>
Fri, 3 May 2019 06:03:48 +0000 (08:03 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Fri, 3 May 2019 19:20:39 +0000 (21:20 +0200)
cbios/ascii.180
cbios/fifo.180

index 2353ae00b093e3437b6dbd6d771489f385f8b117..90545497e238e955bb8493228e80b2b0b5f9a0fa 100644 (file)
@@ -622,7 +622,6 @@ asci1_osta:
 ;--------------------------------------------------------------\r
 ; put character in c in buffer\r
 ; destroys hl, bc\r
-; returns output char in a\r
 \r
 asci0_out:\r
        push    ix                      ;\r
@@ -630,16 +629,15 @@ asci0_out:
        call    ff_puth\r
        pop     ix                      ;\r
        di                              ;\r
-       in0     c,(stat0)               ;\r
-       set     TIE,c                   ;\r
-       out0    (stat0),c               ;\r
+       in0     a,(stat0)               ;\r
+       or      M_TIE                   ;\r
+       out0    (stat0),a               ;\r
        ei                              ;\r
        ret\r
 \r
 ;--------------------------------------------------------------\r
 ; put character in c in buffer\r
 ; destroys hl, bc\r
-; returns output char in a\r
 \r
 asci1_out:\r
        push    ix                      ;\r
@@ -647,9 +645,9 @@ asci1_out:
        call    ff_puth\r
        pop     ix                      ;\r
        di                              ;\r
-       in0     c,(stat1)               ;\r
-       set     TIE,c                   ;\r
-       out0    (stat1),c               ;\r
+       in0     a,(stat1)               ;\r
+       or      M_TIE                   ;\r
+       out0    (stat1),a               ;\r
        ei                              ;\r
        ret\r
 \r
index e818c5a7cfa39814297018cc80d0cf4dbf278173..e1bda54bd4ab69d9ce55e005a78795e164dfacee 100644 (file)
@@ -159,19 +159,18 @@ ff_full:
 \r
 ;--------------------------------------------------------------\r
 ; put character in c in buffer\r
-; destroys hl, bc\r
-; returns output char in a\r
+; destroys bc\r
 \r
 ff_put:\r
        push    ix                      ;\r
-       pop     hl                      ; get buffer start address\r
+       ex      (sp),hl                 ; get buffer start address\r
 \r
        ld      a,c                     ;\r
        ld      c,(ix+o.in_idx)         ; add input index\r
        ld      b,0                     ;\r
        add     hl,bc                   ;\r
        ld      (hl),a                  ; one place is allways free\r
-       ld      b,a                     ;\r
+       pop     hl                      ; restore hl\r
 \r
        ld      a,c                     ; bump input index\r
        inc     a                       ;\r
@@ -180,25 +179,23 @@ bp.wait:                          ; do
        cp      (ix+o.out_idx)          ;\r
        jr      z,bp.wait               ; while new input idx == ouput idx\r
        ld      (ix+o.in_idx),a         ;\r
-       ld      a,b                     ;\r
        ret                             ;\r
 \r
 ;--------------------------------------------------------------\r
 ; put character in c in buffer\r
 ; halt cpu, while buffer is is full\r
-; destroys hl, bc\r
-; returns output char in a\r
+; destroys bc\r
 \r
 ff_puth:\r
        push    ix                      ;\r
-       pop     hl                      ; get buffer start address\r
+       ex      (sp),hl                 ; get buffer start address\r
 \r
        ld      a,c                     ;\r
        ld      c,(ix+o.in_idx)         ; add input index\r
        ld      b,0                     ;\r
        add     hl,bc                   ;\r
        ld      (hl),a                  ; one place is allways free\r
-       ld      b,a                     ;\r
+       pop     hl                      ; restore hl\r
 \r
        ld      a,c                     ; bump input index\r
        inc     a                       ;\r
@@ -209,7 +206,6 @@ bph.wait:                           ; do
        cp      (ix+o.out_idx)          ;\r
        jr      z,bph.wait              ; while new input idx == ouput idx\r
        ld      (ix+o.in_idx),a         ;\r
-       ld      a,b                     ;\r
        ret                             ;\r
 \r
 ;--------------------------------------------------------------\r