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