]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blob - cbios/chario.180
sdio errormessages
[z180-stamp-cpm3.git] / cbios / chario.180
1 title 'Character I/O Module for the Modular CP/M 3 BIOS'
2 page 255
3 .z80
4
5
6
7 public ?cinit,?ci,?co,?cist,?cost
8 public @ctbl
9
10
11 extrn ff.init,ff.ist,ff.in,ff.ost,ff.out
12 extrn as0init,as0ista,as0inp,as0osta,as0out
13 extrn as1init,as1ista,as1inp,as1osta,as1out
14
15
16 include config.inc
17 include z180reg.inc
18
19 include modebaud.inc ; define mode bits and baud equates
20
21 max$devices equ 3
22
23 cseg
24
25 ;--------------------------------------------------------------
26 ; Init character device
27 ; c: device
28
29 ?cinit: ; init devices
30 ld b,c
31 call vector$io
32 dw ff.init
33 dw as0init
34 dw as1init
35 dw rret
36
37 ;--------------------------------------------------------------
38 ; Character input
39 ; b: device
40 ; return:
41 ; a: input char
42
43 ?ci: ; character input
44 call vector$io
45 dw ff.in
46 dw as0inp
47 dw as1inp
48 dw null$input
49
50 ;--------------------------------------------------------------
51 ; Input status
52 ; b: device
53 ; return:
54 ; a: 0ffh if char available, else 0
55
56 ?cist: ; character input status
57 call vector$io
58 dw ff.ist
59 dw as0ista
60 dw as1ista
61 dw null$status
62
63 ;--------------------------------------------------------------
64 ; Character output
65 ; b: device
66 ; c: output char
67 ; return:
68 ; a: output char
69
70 ?co: ; character output
71 call vector$io
72 dw ff.out
73 dw as0out
74 dw as1out
75 dw rret
76
77
78 ;--------------------------------------------------------------
79 ; Output status
80 ; b: device
81 ; return:
82 ; a: 0ffh if device ready for next output char, else 0
83
84
85 ?cost: ; character output status
86 call vector$io
87 dw ff.ost
88 dw as0osta
89 dw as1osta
90 dw ret$true
91
92 ;--------------------------------------------------------------
93
94 vector$io:
95 ld a,max$devices
96 ld e,b
97 vector:
98 pop hl
99 ld d,0
100 cp e
101 jr nc,exist
102 ld e,a ; use null device if a >= max$devices
103 exist: add hl,de
104 add hl,de
105 ld a,(hl)
106 inc hl
107 ld h,(hl)
108 ld l,a
109 jp (hl)
110
111
112 null$input:
113 ld a,1Ah
114 rret:
115 ret
116 ret$true:
117 or 0FFh
118 ret
119
120 null$status:
121 xor a
122 ret
123
124 ;--------------------------------------------------------------
125
126 @ctbl:
127 db 'AVRCON' ; device 0
128 db mb$in$out
129 db baud$none
130
131 db 'ASCI0 ' ; device 1
132 db mb$in$out+mb$serial+mb$soft$baud
133 ser0$baud:
134 db baud$19200
135
136 db 'ASCI1 ' ; device 2
137 db mb$in$out+mb$serial+mb$soft$baud
138 ser1$baud:
139 db baud$19200
140
141 db 0 ; table terminator
142
143 ;--------------------------------------------------------------
144
145
146
147
148
149 end