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