]> cloudbase.mooo.com Git - kermit-80.git/commitdiff
Bugfix in outmdm (output buffer flush) master
authorLeo C <erbl259-lmu@yahoo.de>
Fri, 11 Dec 2015 14:09:23 +0000 (15:09 +0100)
committerLeo C <erbl259-lmu@yahoo.de>
Fri, 11 Dec 2015 14:09:23 +0000 (15:09 +0100)
cpxac.asm

index f8763c8c3c4db6b33e4d57d865d66e7b78c7cd6f..0b15d21a874623aaec83169bf492b10d09c77a0e 100644 (file)
--- a/cpxac.asm
+++ b/cpxac.asm
@@ -707,7 +707,7 @@ outcon:
 outmdm:\r
        push    hl\r
        ld      hl,(outptr)\r
-       ld      (hl),e                  ;return buffered char\r
+       ld      (hl),e                  ;save char in buffer\r
        inc     hl\r
        ld      (outptr),hl\r
        ld      a,(outcnt)\r
@@ -750,22 +750,23 @@ omf_2:
        ld      a,2                     ;start write transaction\r
        out     (VI2C_CTRL),a\r
 \r
-       ld      hl,outbuf+2\r
-       ld      (outptr),hl\r
+       ld      hl,outbuf+2             ;buffer start\r
        ld      a,(outcnt)\r
-       sub     c\r
+       sub     c                       ;buffer now empty?\r
        ld      (outcnt),a\r
        jr      z,omfex\r
 \r
-       push    de\r
-       ld      d,h\r
+       push    de                      ;no, shift remaining chars down\r
+       ld      d,h                     ;dest = buffer start\r
        ld      e,l\r
        ld      b,0\r
-       add     hl,bc\r
+       add     hl,bc                   ;src = buffer start + num chars last transmitted\r
        ld      c,a\r
        ldir\r
+       ex      de,hl\r
        pop     de\r
 omfex:\r
+       ld      (outptr),hl\r
        pop     bc\r
        pop     hl\r
        ret\r