0
|
1 ********************************************************************
|
|
2 * MODPAK - DC Modem Pak device driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
201
|
8 * 10 From Tandy OS-9 Level One VR 02.00.00
|
0
|
9
|
|
10 nam MODPAK
|
|
11 ttl DC Modem Pak device driver
|
|
12
|
|
13 * Disassembled 98/08/23 17:41:18 by Disasm v1.6 (C) 1988 by RML
|
|
14
|
|
15 ifp1
|
|
16 use defsfile
|
|
17 use scfdefs
|
|
18 endc
|
|
19
|
|
20 tylg set Drivr+Objct
|
|
21 atrv set ReEnt+rev
|
|
22 rev set $01
|
|
23 edition set $0A
|
|
24
|
|
25 mod eom,name,tylg,atrv,start,size
|
|
26
|
|
27 rmb V.SCF SCF storage requirements
|
|
28 u001D rmb 1
|
|
29 u001E rmb 1
|
|
30 u001F rmb 1
|
|
31 u0020 rmb 1
|
|
32 u0021 rmb 1
|
|
33 u0022 rmb 1
|
|
34 u0023 rmb 1
|
|
35 u0024 rmb 1
|
|
36 u0025 rmb 2
|
|
37 u0027 rmb 1
|
|
38 u0028 rmb 1
|
|
39 u0029 rmb 1
|
|
40 u002A rmb 1
|
|
41 u002B rmb 1
|
|
42 u002C rmb 5
|
|
43 u0031 rmb 26
|
|
44 u004B rmb 53
|
|
45 u0080 rmb 1
|
|
46 u0081 rmb 45
|
|
47 u00AE rmb 82
|
|
48 size equ .
|
256
|
49
|
|
50 fcb UPDAT.
|
0
|
51
|
|
52 name fcs /MODPAK/
|
|
53 fcb edition
|
|
54
|
|
55 start lbra Init
|
|
56 lbra Read
|
|
57 lbra Write
|
|
58 lbra GetStat
|
|
59 lbra SetStat
|
|
60 lbra Term
|
|
61
|
|
62 IRQPckt fcb $00,$80,$0a
|
|
63
|
|
64 * Init
|
|
65 *
|
|
66 * Entry:
|
|
67 * Y = address of device descriptor
|
|
68 * U = address of device memory area
|
|
69 *
|
|
70 * Exit:
|
|
71 * CC = carry set on error
|
|
72 * B = error code
|
|
73 *
|
|
74 Init ldx V.PORT,u
|
|
75 stb $01,x
|
|
76 ldd <IT.COL,y get column size
|
|
77 std <u002A,u
|
|
78 ldd <IT.PAR,y get parity/baud
|
|
79 lbsr L01A9
|
|
80 ldd V.PORT,u
|
|
81 addd #$0001
|
|
82 leax >IRQPckt,pcr
|
|
83 leay >L022C,pcr
|
|
84 os9 F$IRQ
|
|
85 bcs L0061
|
|
86 leay <u002C,u
|
|
87 lda #$80
|
|
88 sta $04,y
|
|
89 ldd #$0001
|
|
90 std $02,y
|
|
91 ldx #$0001
|
|
92 os9 F$VIRQ
|
|
93 bcs L0061
|
|
94 clrb
|
|
95 L0061 rts
|
|
96 L0062 orcc #IntMasks
|
|
97 lda ,x
|
|
98 lda ,x
|
|
99 lda $01,x
|
|
100 ldb $01,x
|
|
101 ldb $01,x
|
|
102 bmi L00D4
|
|
103 lda #$02
|
|
104 sta <u0022,u
|
|
105 clra
|
|
106 andb #$60
|
|
107 std <u0023,u
|
|
108 clrb
|
|
109 std <u001D,u
|
|
110 std <u0020,u
|
|
111 sta <u001F,u
|
|
112 std <u0025,u
|
|
113 andcc #^IntMasks
|
|
114 rts
|
|
115
|
|
116 * Read
|
|
117 *
|
|
118 * Entry:
|
|
119 * Y = address of path descriptor
|
|
120 * U = address of device memory area
|
|
121 *
|
|
122 * Exit:
|
|
123 * A = character read
|
|
124 * CC = carry set on error
|
|
125 * B = error code
|
|
126 *
|
|
127 L008B bsr L00D8
|
|
128 Read lda <u0023,u
|
|
129 ble L00A5
|
|
130 ldb <u001F,u
|
|
131 cmpb #$0A
|
|
132 bhi L00A5
|
|
133 ldb V.XON,u
|
|
134 orb #$80
|
|
135 stb <u0023,u
|
|
136 ldb #$05
|
|
137 lbsr L0359
|
|
138 L00A5 tst <u0025,u
|
|
139 bne L00D4
|
|
140 ldb <u001E,u
|
|
141 leax <u0031,u
|
|
142 orcc #IntMasks
|
|
143 cmpb <u001D,u
|
|
144 beq L008B
|
|
145 abx
|
|
146 lda ,x
|
|
147 dec <u001F,u
|
|
148 incb
|
|
149 cmpb #$4F
|
|
150 bls L00C3
|
|
151 clrb
|
|
152 L00C3 stb <u001E,u
|
|
153 ldb V.ERR,u
|
|
154 beq L0138
|
|
155 stb <$3A,y
|
|
156 clr V.ERR,u
|
|
157 comb
|
|
158 ldb #E$Read
|
|
159 bra L0139
|
|
160 L00D4 comb
|
|
161 ldb #E$NotRdy
|
|
162 rts
|
|
163 L00D8 pshs x,b,a
|
|
164 lda V.BUSY,u
|
|
165 sta V.WAKE,u
|
|
166 andcc #^IntMasks
|
|
167 ldx #$0000
|
|
168 os9 F$Sleep
|
|
169 ldx <D.Proc
|
|
170 ldb <P$Signal,x
|
|
171 beq L00F1
|
|
172 cmpb #S$Intrpt
|
|
173 bls L0107
|
|
174 L00F1 clra
|
|
175 lda P$State,x
|
|
176 bita #Condem
|
|
177 bne L0107
|
|
178 ldb #$DC
|
|
179 lda V.ERR,u
|
|
180 bita #TimOut
|
|
181 bne L0102
|
|
182 puls pc,x,b,a
|
|
183 L0102 inc <$3F,y
|
|
184 clr V.ERR,u
|
|
185 L0107 leas $06,s
|
|
186 coma
|
|
187 rts
|
|
188
|
|
189 * Write
|
|
190 *
|
|
191 * Entry:
|
|
192 * A = character to write
|
|
193 * Y = address of path descriptor
|
|
194 * U = address of device memory area
|
|
195 *
|
|
196 * Exit:
|
|
197 * CC = carry set on error
|
|
198 * B = error code
|
|
199 *
|
|
200 L010B bsr L00D8
|
|
201 Write leax >u0081,u
|
|
202 ldb <u0020,u
|
|
203 abx
|
|
204 sta ,x
|
|
205 incb
|
|
206 cmpb #$7E
|
|
207 bls L011D
|
|
208 clrb
|
|
209 L011D orcc #IntMasks
|
|
210 cmpb <u0021,u
|
|
211 beq L010B
|
|
212 stb <u0020,u
|
|
213 lda <u0022,u
|
|
214 beq L0138
|
|
215 anda #$FD
|
|
216 sta <u0022,u
|
|
217 bne L0138
|
|
218 ldb #$05
|
|
219 lbsr L0359
|
|
220 L0138 clrb
|
|
221 L0139 andcc #^IntMasks
|
|
222 rts
|
|
223
|
|
224 * GetStat
|
|
225 *
|
|
226 * Entry:
|
|
227 * A = function code
|
|
228 * Y = address of path descriptor
|
|
229 * U = address of device memory area
|
|
230 *
|
|
231 * Exit:
|
|
232 * CC = carry set on error
|
|
233 * B = error code
|
|
234 *
|
|
235 GetStat ldx $06,y
|
|
236 cmpa #$01
|
|
237 bne L014B
|
|
238 ldb <u001F,u
|
|
239 beq L00D4
|
|
240 stb $02,x
|
|
241 L0149 clrb
|
|
242 rts
|
|
243 L014B cmpa #$06
|
|
244 beq L0149
|
|
245 cmpa #$26
|
|
246 beq L015E
|
|
247 cmpa #$28
|
|
248 bne L016B
|
|
249 ldd <u0028,u
|
|
250 std $06,x
|
|
251 bra L0149
|
|
252 L015E clra
|
|
253 ldb <u002A,u
|
|
254 std $04,x
|
|
255 ldb <u002B,u
|
|
256 std $06,x
|
|
257 bra L0149
|
|
258 L016B comb
|
|
259 ldb #E$UnkSvc
|
|
260 rts
|
|
261
|
|
262 * SetStat
|
|
263 *
|
|
264 * Entry:
|
|
265 * A = function code
|
|
266 * Y = address of path descriptor
|
|
267 * U = address of device memory area
|
|
268 *
|
|
269 * Exit:
|
|
270 * CC = carry set on error
|
|
271 * B = error code
|
|
272 *
|
|
273 SetStat ldx $06,y
|
|
274 cmpa #$1A
|
|
275 bne L018C
|
|
276 lda $05,y
|
|
277 ldb $05,x
|
|
278 orcc #IntMasks
|
|
279 tst <u001F,u
|
|
280 bne L0185
|
|
281 std <u0025,u
|
|
282 bra L0138
|
|
283 L0185 andcc #^IntMasks
|
|
284 os9 F$Send
|
|
285 clrb
|
|
286 rts
|
|
287 L018C cmpa #$29
|
|
288 beq L01D4
|
|
289 cmpa #$2A
|
|
290 beq L01E4
|
|
291 cmpa #$1B
|
|
292 bne L01A3
|
|
293 lda $05,y
|
|
294 cmpa <u0025,u
|
|
295 bne L0149
|
|
296 clr <u0025,u
|
|
297 rts
|
|
298 L01A3 cmpa #$28
|
|
299 bne L016B
|
|
300 ldd $06,x
|
|
301 L01A9 std <u0028,u
|
|
302 andb #$E0
|
|
303 pshs b
|
|
304 ldb <u0029,u
|
|
305 andb #$07
|
|
306 leax <L01CC,pcr
|
|
307 ldb b,x
|
|
308 orb ,s+
|
|
309 anda #$E0
|
|
310 sta V.TYPE,u
|
|
311 ldx V.PORT,u
|
|
312 lda $02,x
|
|
313 anda #$1F
|
|
314 ora V.TYPE,u
|
|
315 std $02,x
|
|
316 bra L0201
|
|
317 L01CC fcb $13,$16,$17,$18,$1a,$1c,$1e,$1f
|
|
318 L01D4 ldb #$09
|
|
319 lda $07,x
|
|
320 cmpa #$01
|
|
321 bne L0201
|
|
322 orcc #IntMasks
|
|
323 lbsr L0359
|
|
324 lbra L0062
|
|
325 L01E4 lda $07,x
|
|
326 bne L0201
|
|
327 ldb #$0B
|
|
328 lda <u0028,u
|
|
329 bita #$10
|
|
330 beq L01F2
|
|
331 L01F1 clrb
|
|
332 L01F2 pshs b
|
|
333 bsr L0206
|
|
334 bcs L01F1
|
|
335 puls b
|
|
336 orcc #IntMasks
|
|
337 lbsr L0359
|
|
338 andcc #^IntMasks
|
|
339 L0201 clrb
|
|
340 rts
|
|
341 L0203 lbsr L00D8
|
|
342 L0206 ldb <u0020,u
|
|
343 orcc #IntMasks
|
|
344 cmpb <u0021,u
|
|
345 bne L0203
|
|
346 rts
|
|
347
|
|
348 * Term
|
|
349 *
|
|
350 * Entry:
|
|
351 * U = address of device memory area
|
|
352 *
|
|
353 * Exit:
|
|
354 * CC = carry set on error
|
|
355 * B = error code
|
|
356 *
|
|
357 Term ldx <D.Proc
|
|
358 lda P$ID,x
|
|
359 sta V.BUSY,u
|
|
360 sta V.LPRC,u
|
|
361 bsr L01F1
|
|
362 ldx #$0000
|
|
363 leay <u002C,u
|
|
364 os9 F$VIRQ
|
|
365 ldx #$0000
|
|
366 os9 F$IRQ
|
|
367 clrb
|
|
368 rts
|
|
369 L022C ldx V.PORT,u
|
|
370 sta <u0027,u
|
|
371 tfr a,b
|
|
372 andb #$60
|
|
373 cmpb <u0024,u
|
|
374 beq L0274
|
|
375 tfr b,a
|
|
376 eorb <u0024,u
|
|
377 sta <u0024,u
|
|
378 lda <u0027,u
|
|
379 bitb #$20
|
|
380 beq L0267
|
|
381 bita #$20
|
|
382 beq L0267
|
|
383 lda <u0028,u
|
|
384 bita #$10
|
|
385 beq L02C8
|
|
386 ldx <V.PDLHd,u
|
|
387 beq L0261
|
|
388 L0259 inc <$3F,x
|
|
389 ldx <$3D,x
|
|
390 bne L0259
|
|
391 L0261 lda #$20
|
|
392 bsr L02D2
|
|
393 bra L02BD
|
|
394 L0267 bitb #$40
|
|
395 beq L02C8
|
|
396 bita #$40
|
|
397 lbne L038B
|
|
398 lbra L037A
|
|
399 L0274 bita #$08
|
|
400 bne L02D7
|
|
401 bita #$10
|
|
402 beq L02C8
|
|
403 lda <u0023,u
|
|
404 bpl L0291
|
|
405 anda #$7F
|
|
406 sta ,x
|
|
407 eora V.XON,u
|
|
408 sta <u0023,u
|
|
409 lda <u0022,u
|
|
410 bne L02B8
|
|
411 bra L02C8
|
|
412 L0291 leay >u0081,u
|
|
413 ldb <u0021,u
|
|
414 cmpb <u0020,u
|
|
415 beq L02B0
|
|
416 clra
|
|
417 lda d,y
|
|
418 incb
|
|
419 cmpb #$7E
|
|
420 bls L02A6
|
|
421 clrb
|
|
422 L02A6 stb <u0021,u
|
|
423 sta ,x
|
|
424 cmpb <u0020,u
|
|
425 bne L02BD
|
|
426 L02B0 lda <u0022,u
|
|
427 ora #$02
|
|
428 sta <u0022,u
|
|
429 L02B8 ldb #$09
|
|
430 lbsr L035B
|
|
431 L02BD ldb #$01
|
|
432 lda V.WAKE,u
|
|
433 L02C1 beq L02C8
|
|
434 clr V.WAKE,u
|
|
435 L02C5 os9 F$Send
|
|
436 L02C8 ldx V.PORT,u
|
|
437 lda $01,x
|
|
438 lbmi L022C
|
|
439 clrb
|
|
440 rts
|
|
441 L02D2 ora V.ERR,u
|
|
442 sta V.ERR,u
|
|
443 rts
|
|
444 L02D7 bita #$07
|
|
445 beq L02EB
|
|
446 tfr a,b
|
|
447 tst ,x
|
|
448 anda #$07
|
|
449 bsr L02D2
|
|
450 lda $02,x
|
|
451 sta $01,x
|
|
452 sta $02,x
|
|
453 bra L02C8
|
|
454 L02EB lda ,x
|
|
455 beq L0306
|
|
456 cmpa V.INTR,u
|
|
457 beq L0369
|
|
458 cmpa V.QUIT,u
|
|
459 beq L036D
|
|
460 cmpa V.PCHR,u
|
|
461 beq L0361
|
|
462 cmpa V.XON,u
|
|
463 beq L037A
|
|
464 cmpa <V.XOFF,u
|
|
465 lbeq L038B
|
|
466 L0306 leax <u0031,u
|
|
467 ldb <u001D,u
|
|
468 abx
|
|
469 sta ,x
|
|
470 incb
|
|
471 cmpb #$4F
|
|
472 bls L0315
|
|
473 clrb
|
|
474 L0315 cmpb <u001E,u
|
|
475 bne L0320
|
|
476 lda #$04
|
|
477 bsr L02D2
|
|
478 bra L02BD
|
|
479 L0320 stb <u001D,u
|
|
480 inc <u001F,u
|
|
481 tst <u0025,u
|
|
482 beq L0333
|
|
483 ldd <u0025,u
|
|
484 clr <u0025,u
|
|
485 bra L02C5
|
|
486 L0333 lda <V.XOFF,u
|
|
487 beq L02BD
|
|
488 ldb <u001F,u
|
|
489 cmpb #$46
|
|
490 lbcs L02BD
|
|
491 ldb <u0023,u
|
|
492 lbne L02BD
|
|
493 anda #$7F
|
|
494 sta <V.XOFF,u
|
|
495 ora #$80
|
|
496 sta <u0023,u
|
|
497 ldb #$05
|
|
498 bsr L0359
|
|
499 lbra L02BD
|
|
500 L0359 ldx V.PORT,u
|
|
501 L035B orb V.TYPE,u
|
|
502 stb $02,x
|
|
503 clrb
|
|
504 rts
|
|
505 L0361 ldx V.DEV2,u
|
|
506 beq L0306
|
|
507 sta $08,x
|
|
508 bra L0306
|
|
509 L0369 ldb #$03
|
|
510 bra L036F
|
|
511 L036D ldb #$02
|
|
512 L036F pshs a
|
|
513 lda V.LPRC,u
|
|
514 lbsr L02C1
|
|
515 puls a
|
|
516 bra L0306
|
|
517 L037A lda <u0022,u
|
|
518 anda #$FE
|
|
519 sta <u0022,u
|
|
520 bne L0388
|
|
521 ldb #$05
|
|
522 bsr L035B
|
|
523 L0388 lbra L02C8
|
|
524 L038B lda <u0022,u
|
|
525 bne L0394
|
|
526 ldb #$09
|
|
527 bsr L035B
|
|
528 L0394 ora #$01
|
|
529 sta <u0022,u
|
|
530 bra L0388
|
|
531
|
|
532 emod
|
|
533 eom equ *
|
|
534 end
|
|
535
|