Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/scdwt.asm @ 2313:9e3038c39b01
clock2_dw3 now gets seconds (6 byte time packet)
dw3.asm uses hard coded date instead of dtb so CRC won't go wild
scdwt.asm no longer has date in since it's not needed
author | boisy |
---|---|
date | Sun, 03 Jan 2010 20:29:41 +0000 |
parents | 7820a7317242 |
children | bf6708acbda6 |
rev | line source |
---|---|
2242 | 1 ******************************************************************** |
2275 | 2 * scdwt - CoCo DriveWire Virtual Serial Driver |
2242 | 3 * |
2275 | 4 * $Id$ |
2242 | 5 * |
2275 | 6 * Edt/Rev YYYY/MM/DD Modified by |
7 * Comment | |
8 * ------------------------------------------------------------------ | |
9 * 1 2009/11/30 Aaron Wolfe | |
10 * Started | |
2242 | 11 * |
2275 | 12 * 2009/12/28 Boisy G. Pitre |
13 * Modified so that F$STime is called if we get an error on calling | |
14 * F$VIRQ (which means the clock module has not be initialized) | |
2299 | 15 * |
16 * 2009/12/31 Boisy G. Pitre | |
2305 | 17 * Fixed crash in Init where F$Link failure would not clean up stack |
2313 | 18 * |
19 * 2010/01/03 Boisy G. Pitre | |
20 * Moved IRQ stuff into DW3 subroutine module | |
2242 | 21 |
22 nam scdwt | |
23 ttl CoCo DriveWire Virtual Serial Driver | |
24 | |
25 ifp1 | |
26 use defsfile | |
27 use dwdefs.d | |
28 endc | |
29 | |
30 | |
31 tylg set Drivr+Objct | |
32 atrv set ReEnt+Rev | |
33 rev set $00 | |
34 edition set 1 | |
35 | |
2308 | 36 * Note: driver memory defined in dwdefs.d |
37 mod eom,name,tylg,atrv,start,SCFDrvMemSz | |
2242 | 38 |
39 * module info | |
40 fcb READ.+WRITE. ;driver access modes | |
41 name fcs /scdwt/ ;driver name | |
42 fcb edition ;driver edition | |
43 | |
44 * dispatch calls | |
45 start equ * | |
46 lbra Init | |
47 lbra Read | |
48 lbra Write | |
2291
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
49 lbra GetStat |
2290
c0961e667550
Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents:
2288
diff
changeset
|
50 lbra SetStat |
2242 | 51 |
52 *********************************************************************** | |
53 * Term | |
54 * | |
55 * shut down the driver. | |
56 * should close only the correct port, tell server to close the port, | |
57 * and remove irq handler when no ports are left | |
58 * | |
59 * Entry: | |
60 * U = address of device memory area | |
61 * | |
62 * Exit: | |
63 * CC = carry set on error | |
64 * B = error code | |
65 Term equ * | |
2249 | 66 |
2242 | 67 lda <V.PORT+1,u ;get our port # |
2249 | 68 |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
69 pshs a ;port # on stack |
2249 | 70 * clear statics table entry |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
71 IFGT Level-1 |
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
72 ldx <D.DWStat |
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
73 ELSE |
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
74 ldx >D.DWStat |
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
75 ENDC |
2299 | 76 beq tell |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
77 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
78 ; leax DW.StatTbl,x |
2249 | 79 clr a,x ;clear out |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
80 |
2242 | 81 * tell server |
2299 | 82 tell |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
83 lda #OP_SERTERM ; load command |
2242 | 84 pshs a ; command store on stack |
85 leax ,s ; point X to stack | |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
86 ldy #2 ; 2 bytes to send |
2242 | 87 |
2249 | 88 pshs u |
89 | |
2305 | 90 IFGT Level-1 |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
91 ldu <D.DWSubAddr |
2242 | 92 ELSE |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
93 ldu >D.DWSubAddr |
2242 | 94 ENDC |
2305 | 95 beq nosub |
2242 | 96 jsr 6,u ; call DWrite |
2249 | 97 |
2308 | 98 nosub |
2249 | 99 puls u |
100 | |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
101 leas 2,s ; clean 3 DWsub args from stack |
2242 | 102 |
103 clrb | |
104 rts | |
2299 | 105 |
2305 | 106 puls u |
107 leas 2,s | |
108 rts | |
2299 | 109 |
2242 | 110 *********************************************************************** |
111 * Init | |
112 * | |
113 * Entry: | |
114 * Y = address of device descriptor | |
115 * U = address of device memory area | |
116 * | |
117 * Exit: | |
118 * CC = carry set on error | |
119 * B = error code | |
120 * | |
121 | |
122 Init equ * | |
2273
db65aeb5c335
Driver now calls F$STime to insure F$VIRQ call is installed by Clock
boisy
parents:
2271
diff
changeset
|
123 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
124 lda IT.PAR,y |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
125 pshs a ; save parity byte for later |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
126 |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
127 ; link to subroutine module |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
128 ; has the link already been done? |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
129 IFGT Level-1 |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
130 ldx <D.DWSubAddr |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
131 ELSE |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
132 ldx >D.DWSubAddr |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
133 ENDC |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
134 bne already ; if so, do not bother |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
135 |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
136 pshs u ; preserve u since os9 link is coming up |
2242 | 137 |
138 IFGT Level-1 | |
139 ldx <D.Proc | |
140 pshs x | |
141 ldx <D.SysPrc | |
142 stx <D.Proc | |
143 ENDC | |
144 clra | |
145 | |
146 leax dw3name,pcr | |
147 os9 F$Link | |
148 IFGT Level-1 | |
149 puls x | |
150 stx <D.Proc | |
151 ENDC | |
2308 | 152 bcs InitEx2 |
2242 | 153 IFGT Level-1 |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
154 sty <D.DWSubAddr |
2242 | 155 ELSE |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
156 sty >D.DWSubAddr |
2242 | 157 ENDC |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
158 jsr ,y ; call DW init routine |
2242 | 159 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
160 puls u ; restore u |
2242 | 161 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
162 already |
2309 | 163 ; tell DW we have a new port opening (port mode already on stack) |
164 ldb <V.PORT+1,u ; get our port # | |
165 lda #OP_SERINIT ; command | |
166 pshs d ; command + port # on stack | |
167 leax ,s ; point X to stack | |
168 ldy #3 ; # of bytes to send | |
169 | |
170 pshs u | |
171 IFGT Level-1 | |
172 ldu <D.DWSubAddr | |
173 ELSE | |
174 ldu >D.DWSubAddr | |
175 ENDC | |
176 jsr 6,u ; call DWrite | |
177 puls u | |
178 | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
179 ; set up local buffer |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
180 ldb #RxBufDSz ; default Rx buffer size |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
181 leax RxBuff,u ; default Rx buffer address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
182 stb RxBufSiz,u ; save Rx buffer size |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
183 stx RxBufPtr,u ; save Rx buffer address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
184 stx RxBufGet,u ; set initial Rx buffer input address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
185 stx RxBufPut,u ; set initial Rx buffer output address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
186 abx ; add buffer size to buffer start.. |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
187 stx RxBufEnd,u ; save Rx buffer end address |
2242 | 188 |
2309 | 189 tfr u,d (A = high page of statics) |
190 puls b | |
191 puls b (B = port number) | |
192 IFGT Level-1 | |
193 ldx <D.DWStat | |
194 ELSE | |
195 ldx >D.DWStat | |
196 ENDC | |
197 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax | |
198 ; leax DW.StatTbl,x | |
199 sta b,x | |
2242 | 200 InitEx equ * |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
201 puls a,pc |
2299 | 202 InitEx2 |
2305 | 203 puls u |
2299 | 204 puls a,pc |
2242 | 205 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
206 ; drivewire info |
2242 | 207 dw3name fcs /dw3/ |
208 | |
209 | |
210 ***************************************************************************** | |
211 * Write | |
212 * | |
213 * Entry: | |
214 * A = character to write | |
215 * Y = address of path descriptor | |
216 * U = address of device memory area | |
217 * | |
218 * Exit: | |
219 * CC = carry set on error | |
220 * B = error code | |
221 * | |
222 Write equ * | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
223 pshs a ; character to send on stack |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
224 ldb V.PORT+1,u ; port number into B |
2242 | 225 lda #OP_SERWRITE ; put command into A |
226 pshs d | |
227 leax ,s | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
228 ldy #$0003 ; 3 bytes to send.. ugh. need WRITEM (data mode) |
2242 | 229 IFGT Level-1 |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
230 ldu <D.DWSubAddr |
2242 | 231 ELSE |
2270
07b2433f0c65
moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents:
2261
diff
changeset
|
232 ldu >D.DWSubAddr |
2242 | 233 ENDC |
234 jsr 6,u | |
235 WriteOK clrb | |
236 WriteExit puls a,x,pc ; clean stack, return | |
237 | |
238 | |
239 ************************************************************************************* | |
2305 | 240 * Read |
241 * | |
242 * Entry: | |
243 * Y = address of path descriptor | |
244 * U = address of device memory area | |
245 * | |
246 * Exit: | |
247 * A = character read | |
248 * CC = carry set on error | |
249 * B = error code | |
250 * | |
2242 | 251 Read equ * |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
252 pshs cc,dp ; save IRQ/Carry status, system DP |
2242 | 253 |
2305 | 254 ReadChr orcc #IntMasks ; mask interrupts |
2242 | 255 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
256 lda RxDatLen,u ; get our Rx buffer count |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
257 beq ReadSlp ; no data, go sleep while waiting for new Rx data... |
2242 | 258 |
2305 | 259 ; we have data waiting |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
260 deca ; one less byte in buffer |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
261 sta RxDatLen,u ; save new Rx data count |
2242 | 262 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
263 ldx RxBufGet,u ; current Rx buffer pickup position |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
264 lda ,x+ ; get Rx character, set up next pickup position |
2242 | 265 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
266 cmpx RxBufEnd,u ; end of Rx buffer? |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
267 blo ReadChr1 ; no, keep pickup pointer |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
268 ldx RxBufPtr,u ; get Rx buffer start address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
269 ReadChr1 stx RxBufGet,u ; set new Rx data pickup pointer |
2242 | 270 |
2305 | 271 ; return to caller |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
272 puls cc,dp,pc ; recover IRQ/Carry status, system DP, return with character in A |
2242 | 273 |
274 ReadSlp equ * | |
275 | |
276 IFEQ Level-1 | |
2249 | 277 ReadSlp2 lda <V.BUSY,u |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
278 sta <V.WAKE,u ; store process id in this port's entry in the waiter table |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
279 lbsr Sleep0 ; sleep level 1 style |
2242 | 280 ELSE |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
281 ReadSlp2 lda >D.Proc ; process descriptor address MSB |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
282 sta <V.WAKE,u ; save MSB in V.WAKE |
2242 | 283 clrb |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
284 tfr d,x ; process descriptor address |
2242 | 285 IFNE H6309 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
286 oim #Suspend,P$State,x ; suspend |
2242 | 287 ELSE |
288 ldb P$State,x | |
289 orb #Suspend | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
290 stb P$State,x ; suspend |
2242 | 291 ENDC |
2305 | 292 bsr Sleep1 ; sleep level 2 style |
2242 | 293 ENDC |
294 | |
2305 | 295 ; we have been awakened.. |
2242 | 296 |
2305 | 297 ; check for signals |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
298 ldx >D.Proc ; process descriptor address |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
299 ldb P$Signal,x ; pending signal for this process? |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
300 beq ChkState ; no, go check process state... |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
301 cmpb #S$Intrpt ; (interrupt only) |
2305 | 302 bls ErrExit ; yes, go do it... |
2242 | 303 |
304 ChkState equ * | |
2305 | 305 ; have we been condemned to die? |
2242 | 306 IFNE H6309 |
307 tim #Condem,P$State,x | |
308 ELSE | |
309 ldb P$State,x | |
310 bitb #Condem | |
311 ENDC | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
312 bne PrAbtErr ; yes, go do it... |
2242 | 313 |
2305 | 314 ; check that our waiter byte was cleared by ISR instance |
315 tst <V.WAKE,u ; our waiter byte | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
316 beq ReadChr ; 0 = its our turn, go get a character |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
317 bra ReadSlp ; false alarm, go back to sleep |
2242 | 318 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
319 PrAbtErr ldb #E$PrcAbt ; set error code |
2242 | 320 |
321 ErrExit equ * | |
322 IFNE H6309 | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
323 oim #Carry,,s ; set carry |
2242 | 324 ELSE |
325 lda ,s | |
326 ora #Carry | |
327 sta ,s | |
328 ENDC | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
329 puls cc,dp,pc ; restore CC, system DP, return |
2242 | 330 |
331 IFEQ Level-1 | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
332 Sleep0 ldx #$0 ; sleep till ISR wakes us |
2242 | 333 bra TimedSlp |
334 ENDC | |
335 | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
336 Sleep1 ldx #$1 ; just sleep till end of slice, we are suspended (level 2) |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
337 TimedSlp andcc #^Intmasks ; enable IRQs |
2242 | 338 os9 F$Sleep |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
339 rts ; return |
2242 | 340 |
341 | |
342 ********************************************************************** | |
343 * GetStat - heavily borrowed from sc6551 | |
344 * | |
345 * Entry: | |
346 * A = function code | |
347 * Y = address of path descriptor | |
348 * U = address of device memory area | |
349 * | |
350 * Exit: | |
351 * CC = carry set on error | |
352 * B = error code | |
353 * | |
2291
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
354 GetStat |
2305 | 355 clrb ; default to no error... |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
356 pshs cc,dp ; save IRQ/Carry status,system DP |
2242 | 357 |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
358 ldx PD.RGS,y ; caller's register stack pointer |
2242 | 359 cmpa #SS.EOF |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
360 beq GSExitOK ; SCF devices never return EOF |
2242 | 361 |
362 cmpa #SS.Ready | |
2304
02a0a5544e93
We no longer advertise SS.Ready GetStat to the server
boisy
parents:
2299
diff
changeset
|
363 bne Advertise ; next check |
2242 | 364 |
2305 | 365 ; SS.Ready |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
366 lda RxDatLen,u ; get Rx data length |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
367 beq NRdyErr ; none, go report error |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
368 sta R$B,x ; set Rx data available in caller's [B] |
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
369 GSExitOK puls cc,dp,pc ; restore Carry status, system DP, return |
2242 | 370 |
371 NRdyErr ldb #E$NotRdy | |
372 bra ErrExit ; return error code | |
373 | |
374 UnSvcErr ldb #E$UnkSvc | |
375 bra ErrExit ; return error code | |
376 | |
2305 | 377 ; We advertise all of our SERGETSTAT calls (except SS.Ready) to the server |
2304
02a0a5544e93
We no longer advertise SS.Ready GetStat to the server
boisy
parents:
2299
diff
changeset
|
378 Advertise |
2305 | 379 ldb #OP_SERGETSTAT |
380 bsr SendStat | |
2304
02a0a5544e93
We no longer advertise SS.Ready GetStat to the server
boisy
parents:
2299
diff
changeset
|
381 |
2305 | 382 ; Note: Here we could somehow obtain the size of the terminal window from the server |
2242 | 383 GetScSiz cmpa #SS.ScSiz |
384 bne GetComSt ; next check | |
385 ldu PD.DEV,y | |
386 ldu V$DESC,u ; device descriptor | |
387 clra | |
388 ldb IT.COL,u ; return screen size | |
389 std R$X,x | |
390 ldb IT.ROW,u | |
391 std R$Y,x | |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
392 puls cc,dp,pc ; restore Carry status, system DP, return |
2242 | 393 |
394 GetComSt cmpa #SS.ComSt | |
2305 | 395 bne UnSvcErr ; no, we have no more answers, report error |
396 ldd #$0000 ; not used, return $0000 | |
2242 | 397 std R$Y,x |
2305 | 398 sta R$B,x |
2287
e49532f2c754
Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents:
2282
diff
changeset
|
399 puls cc,dp,pc ; restore Carry status, system DP, return |
2242 | 400 |
2305 | 401 * Advertise Stat Code to server |
2291
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
402 * A = Function Code |
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
403 * B = OP_SERGETSTAT or OP_SERSETSTAT |
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
404 SendStat |
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
405 * advertise our GetStt code to the server |
2310 | 406 pshs a,y,x,u |
2305 | 407 leas -3,s |
408 leax ,s | |
409 stb ,x | |
410 sta 2,x | |
411 ldb V.PORT+1,u | |
412 stb 1,x | |
413 ldy #$0003 | |
414 IFGT LEVEL-1 | |
415 ldu <D.DWSubAddr | |
416 ELSE | |
417 ldu >D.DWSubAddr | |
418 ENDC | |
419 jsr 6,u | |
420 leas 3,s | |
2310 | 421 puls a,y,x,u,pc |
2291
c4aa9c53261a
DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents:
2290
diff
changeset
|
422 |
2242 | 423 ************************************************************************* |
424 * SetStat | |
425 * | |
426 * Entry: | |
427 * A = function code | |
428 * Y = address of path descriptor | |
429 * U = address of device memory area | |
430 * | |
431 * Exit: | |
432 * CC = carry set on error | |
433 * B = error code | |
2305 | 434 * |
2290
c0961e667550
Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents:
2288
diff
changeset
|
435 SetStat |
2308 | 436 ldb #OP_SERSETSTAT |
437 bsr SendStat | |
438 cmpa #SS.ComSt | |
439 bne donebad | |
440 leax PD.OPT,y | |
441 ldy #OPTCNT | |
442 IFGT LEVEL-1 | |
443 ldu <D.DWSubAddr | |
444 ELSE | |
445 ldu >D.DWSubAddr | |
446 ENDC | |
447 jsr 6,u | |
448 clrb | |
449 rts | |
450 | |
2309 | 451 IFEQ 1 |
2308 | 452 SetPortSig cmpa #SS.PortSig |
453 bne SetPortRel | |
454 lda PD.CPR,y current process ID | |
455 ldb R$X+1,x LSB of [X] is signal code | |
456 std <PortSigPID | |
457 clrb | |
458 rts | |
459 SetPortRel cmpa #SS.PortRel | |
460 bne donebad | |
461 leax PortSigPID,u | |
462 bsr ReleaSig | |
463 clrb | |
464 rts | |
2309 | 465 ENDC |
2305 | 466 donebad comb |
2308 | 467 ldb #E$UnkSVc |
468 rts | |
2290
c0961e667550
Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents:
2288
diff
changeset
|
469 |
2308 | 470 ReleaSig pshs cc save IRQ enable status |
471 orcc #IntMasks disable IRQs while releasing signal | |
472 lda PD.CPR,y get current process ID | |
473 suba ,x same as signal process ID? | |
474 bne NoReleas no, go return... | |
475 sta ,x clear this signal's process ID | |
476 NoReleas puls cc,pc restore IRQ enable status, return | |
477 | |
478 emod | |
479 eom equ * | |
480 end |