]> cloudbase.mooo.com Git - z180-stamp.git/blob - z180/chario.180
merge do_fat_read() and do_fat_write() to do_fat_rw()
[z180-stamp.git] / z180 / chario.180
1 page 255
2 .z80
3
4
5 ; CP/M 3 compatible character i/o
6
7 public ?cinit,?ci,?co,?cist,?cost
8 public @ctbl
9
10 extrn ff.init,ff.i.st,ff.in,ff.o.st,ff.out
11 extrn ser.init,ser.ist,ser.in,ser.ost,ser.out
12
13 include config.inc
14 include z180reg.inc
15 include modebaud.inc ; define mode bits and baud eqautes
16
17
18 max$device equ 2
19
20 cseg
21
22 ; c = device
23
24 ?cinit: ; init devices
25 ld b,c
26 call vector$io
27 dw ff.init
28 dw ser.init
29 dw rret
30
31 ; b = device, c = output char, a = input char
32
33 ?ci: ; character input
34 call vector$io
35 dw ff.in
36 dw ser.in
37 dw null$input
38
39 ?cist: ; character input status
40 call vector$io
41 dw ff.i.st
42 dw ser.ist
43 dw null$status
44
45 ?co: ; character output
46 call vector$io
47 dw ff.out
48 dw ser.out
49 dw rret
50
51 ?cost: ; character output status
52 call vector$io
53 dw ff.o.st
54 dw ser.ost
55 dw ret$true
56
57 vector$io:
58 ld a,max$device
59 ld e,b
60 vector:
61 pop hl
62 ld d,0
63 cp e
64 jr nc,exist
65 ld e,a ; use null device if a >= max$device
66 exist: add hl,de
67 add hl,de
68 ld a,(hl)
69 inc hl
70 ld h,(hl)
71 ld l,a
72 jp (hl)
73
74
75 null$input:
76 ld a,1Ah
77 rret:
78 ret
79 ret$true:
80 or 0FFh
81 ret
82
83 null$status:
84 xor a
85 ret
86
87 ;--------------------------------------------------------------
88
89
90 @ctbl:
91 db 'HOST ' ; device 0
92 db mb$output
93 db baud$none
94
95 db 'ASCI1 ' ; device 0
96 db mb$in$out+mb$serial+mb$soft$baud
97 ser1$baud:
98 db baud$19200
99
100 db 0 ; table terminator
101
102 end
103