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/chario.180 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 z180/chario.180 (limited to 'z180/chario.180') diff --git a/z180/chario.180 b/z180/chario.180 new file mode 100644 index 0000000..6632690 --- /dev/null +++ b/z180/chario.180 @@ -0,0 +1,103 @@ + page 255 + .z80 + + +; CP/M 3 compatible character i/o + + public ?cinit,?ci,?co,?cist,?cost + public @ctbl + + extrn ff.init,ff.i.st,ff.in,ff.o.st,ff.out + extrn ser.init,ser.ist,ser.in,ser.ost,ser.out + + include config.inc + include z180reg.inc + include modebaud.inc ; define mode bits and baud eqautes + + +max$device equ 2 + + cseg + +; c = device + +?cinit: ; init devices + ld b,c + call vector$io + dw ff.init + dw ser.init + dw rret + +; b = device, c = output char, a = input char + +?ci: ; character input + call vector$io + dw ff.in + dw ser.in + dw null$input + +?cist: ; character input status + call vector$io + dw ff.i.st + dw ser.ist + dw null$status + +?co: ; character output + call vector$io + dw ff.out + dw ser.out + dw rret + +?cost: ; character output status + call vector$io + dw ff.o.st + dw ser.ost + dw ret$true + +vector$io: + ld a,max$device + ld e,b +vector: + pop hl + ld d,0 + cp e + jr nc,exist + ld e,a ; use null device if a >= max$device +exist: add hl,de + add hl,de + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + jp (hl) + + +null$input: + ld a,1Ah +rret: + ret +ret$true: + or 0FFh + ret + +null$status: + xor a + ret + +;-------------------------------------------------------------- + + +@ctbl: + db 'HOST ' ; device 0 + db mb$output + db baud$none + + db 'ASCI1 ' ; device 0 + db mb$in$out+mb$serial+mb$soft$baud +ser1$baud: + db baud$19200 + + db 0 ; table terminator + + end + -- cgit v1.2.3