]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - z180/ddtz.180
CP/M 3 compatible character i/o handling
[z180-stamp.git] / z180 / ddtz.180
index 77da910a372e5b79a29863217ef54ed742167752..e544b08650a41de71727d27196b6ca4ddd4c6761 100644 (file)
@@ -1,7 +1,7 @@
        page    255\r
        .z80\r
 \r
-       external $ci, $co, $cists\r
+       extrn   ?const,?conin,?cono\r
 \r
        global  ddtz,bpent\r
        global  $stack\r
@@ -27,7 +27,7 @@ BP_CNT                equ     12              ;number of breakbpoints
 \r
 \r
 ;--------------------------------------------------\r
-; \r
+;\r
 \r
 ; copy code to common memory and execute it there\r
 comst  macro\r
@@ -103,17 +103,17 @@ ddtz:
        ld      hl,sysramc\r
        ld      de,topcodbeg\r
        ld      bc,topcodend-topcodbeg\r
-       ldir                    \r
-       \r
+       ldir\r
+\r
        ld      hl,vartab\r
        ld      de,ddtram\r
        ld      bc,vartabe-vartab\r
-       ldir            \r
+       ldir\r
        exx\r
 \r
        ld      a,e\r
        ld      (ubbr),a\r
-       \r
+\r
 ddtz_w:\r
        ld hl,MSG               ;073c\r
        call PSTR               ;073f\r
@@ -203,29 +203,53 @@ CMD.?:
        call    PSTR\r
        ret\r
 \r
+$ci:\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       call    ?conin\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
+       ret\r
+\r
+$co:\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       ld      c,a\r
+       call    ?cono\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
+       ret\r
+\r
 DELC:\r
-       ld a,b                  ;07f2\r
-       or a                    ;07f3\r
-       ret z                   ;07f4\r
-       ld a,BS                 ;07f5\r
-       call $co                ;07f7\r
-       ld a,' '                ;07fa\r
-       call $co                ;07fc\r
-       ld a,BS                 ;07ff\r
-       call $co                ;0801\r
-       dec hl                  ;0804\r
-       dec b                   ;0805\r
-       inc c                   ;0806\r
-       ld a,(hl)               ;0807\r
-       cp ' '                  ;0808\r
-       ret nc                  ;080a\r
-       ld a,BS                 ;080b\r
-       call $co                ;080d\r
-       ld a,' '                ;0810\r
-       call $co                ;0812\r
-       ld a,BS                 ;0815\r
-       call $co                ;0817\r
-       ret                     ;081a\r
+       ld      a,b\r
+       or      a\r
+       ret     z\r
+       call    DELC1\r
+       dec     hl\r
+       dec     b\r
+       inc     c\r
+       ld      a,(hl)\r
+       cp      ' '\r
+       ret     nc\r
+DELC1:\r
+       push    de\r
+       push    hl\r
+       push    bc\r
+       ld      c,BS\r
+       call    ?cono\r
+       ld      c,' '\r
+       call    ?cono\r
+       ld      c,BS\r
+       call    ?cono\r
+       pop     bc\r
+       pop     hl\r
+       pop     de\r
+       ret\r
+\r
 DELL:\r
        ld a,b                  ;081b\r
        or a                    ;081c\r
@@ -472,22 +496,34 @@ l0960h:
 outquote:\r
        ld a,''''               ;0979\r
 OUTCHAR:\r
-       push hl                 ;097b\r
-       push af                 ;097c\r
-       and 07fh                ;097d\r
-       call $co                ;097f\r
-       ld hl,CON.COL           ;0982\r
-       inc (hl)                ;0985\r
-       pop af                  ;0986\r
-       pop hl                  ;0987\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       push    af\r
+       and     07fh\r
+       ld      c,a\r
+       call    ?cono\r
+       ld      hl,CON.COL\r
+       inc     (hl)\r
+       pop     af\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
        ret                     ;0988\r
 \r
 inchar:\r
-       call $cists             ;0989\r
-       and a                   ;098c\r
-       ret z                   ;098d\r
-       call $ci                ;098e\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       call    ?const\r
+       and     a\r
+       jr      z,inch1\r
+       call    ?conin\r
        scf                     ;0991\r
+inch1:\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
        ret                     ;0992\r
 \r
 PSTR:\r
@@ -1816,7 +1852,7 @@ l1144h:
        inc hl                  ;1176\r
        ld a,d                  ;1177\r
        comrep                  ;1178\r
-       \r
+\r
        else\r
 \r
        ld a,(ddtrst)           ;115c\r
@@ -4649,7 +4685,7 @@ b_0x2108_start:                   ;       1 byte opcodes
        defb 08bh               ;2137\r
        defw l2561h             ;2138\r
 \r
-       defb 0c7h               ;213a   rst \r
+       defb 0c7h               ;213a   rst\r
        defb 0c7h               ;213b\r
        defb 0b4h               ;213c\r
        defw l231eh             ;213d\r