2040
|
1 * Parallel Printer device for Dragon 32/64/Alpha.
|
1839
|
2 *
|
|
3 * Disassembled from the Alpha OS-9 2005-06-14, P.Harvey-Smith.
|
|
4 *
|
|
5
|
2040
|
6 nam scdpp
|
|
7 ttl Dragon Parallel Printer Driver
|
1839
|
8
|
|
9 * Disassembled 1900/00/00 00:08:11 by Disasm v1.5 (C) 1988 by RML
|
|
10
|
|
11 ifp1
|
2037
|
12 use defsfile
|
1839
|
13 endc
|
|
14
|
|
15 tylg set Drivr+Objct
|
|
16 atrv set ReEnt+rev
|
|
17 rev set $01
|
|
18 edition set 3
|
|
19 mod eom,name,tylg,atrv,start,size
|
|
20
|
|
21 u0000 rmb 29
|
|
22 size equ .
|
|
23
|
|
24 fcb $03
|
|
25 name equ *
|
2040
|
26 fcs /scdpp/
|
1839
|
27 fcb edition
|
|
28
|
|
29 start equ *
|
|
30 lbra Init
|
|
31 lbra Read
|
|
32 lbra Write
|
|
33 lbra GetStat
|
|
34 lbra SetStat
|
|
35 lbra Term
|
|
36
|
|
37 * Init
|
|
38 *
|
|
39 * Entry:
|
|
40 * Y = address of device descriptor
|
|
41 * U = address of device memory area
|
|
42 *
|
|
43 * Exit:
|
|
44 * CC = carry set on error
|
|
45 * B = error code
|
|
46 *
|
|
47 Init pshs cc
|
|
48 orcc #$50 ; Disable Inturrupts
|
|
49 ldx #PIA1DA ; Point to PIA1DA
|
|
50 ldb 1,x ; Get CRA
|
|
51 clr 1,x ; Zero CR and select DDRA
|
|
52 lda #$FE ; Set bit 0 as input (cassette in), all others as input
|
|
53 sta ,x
|
|
54 stb 1,x ; Restore CRA
|
|
55 ldx #PIA1DB ; Point at PIA1DB
|
|
56 ldb 1,x ; Save CRB
|
|
57 clr 1,x ; Zero CR and select DDRB
|
|
58 lda ,x ; get DDRB
|
|
59 anda #$FE ; Set bit 0 as input (printer busy), all others leave alone
|
|
60 sta ,x
|
|
61 stb 1,x ; restore CRB
|
|
62 puls cc
|
|
63 clrb ; Flag no error
|
|
64 rts
|
|
65
|
|
66 * Read
|
|
67 *
|
|
68 * Entry:
|
|
69 * B = MSB of the disk's LSN
|
|
70 * X = LSB of the disk's LSN
|
|
71 * Y = address of path descriptor
|
|
72 * U = address of device memory area
|
|
73 *
|
|
74 * Exit:
|
|
75 * CC = carry set on error
|
|
76 * B = error code
|
|
77 *
|
|
78
|
|
79 Read ldb #$CB ; Ilegal mode, cannot read from printer !
|
|
80 orcc #$01
|
|
81 rts
|
|
82
|
|
83 * Write
|
|
84 *
|
|
85 * Entry:
|
|
86 * B = MSB of the disk's LSN
|
|
87 * X = LSB of the disk's LSN
|
|
88 * Y = address of path descriptor
|
|
89 * U = address of device memory area
|
|
90 *
|
|
91 * Exit:
|
|
92 * CC = carry set on error
|
|
93 * B = error code
|
|
94 *
|
|
95
|
|
96 Write pshs a
|
|
97 L0053 ldb #$08 ; retry count
|
|
98 L0055 lda >PIA1DB ; Get printer busy flag
|
|
99 lsra ; Get busy bit into carry
|
|
100 bcc WriteNotBusy ; Not busy : continue
|
|
101 nop ; wait a little while
|
|
102 nop
|
|
103 decb ; decrement retry counter
|
|
104 bne L0055 ; Non zero : check flag again
|
|
105
|
|
106 pshs x ; Still busy: send calling process to sleep
|
|
107 ldx #$0001
|
|
108 os9 F$Sleep
|
|
109 puls x
|
|
110 bra L0053 ; When we wake, poll busy again
|
|
111
|
|
112 WriteNotBusy
|
|
113 puls a
|
|
114 pshs cc
|
|
115 orcc #$50 ; disable inturrupts
|
|
116 sta >PIA0DB ; Send character to printer
|
|
117 lda >PIA1DA ; Toggle printer strobe line
|
|
118 ora #$02 ; high
|
|
119 sta >PIA1DA
|
|
120 anda #$FD ; and low again
|
|
121 sta >PIA1DA
|
|
122 puls pc,cc ; restore and return
|
|
123
|
|
124 * GetStat
|
|
125 *
|
|
126 * Entry:
|
|
127 * A = function code
|
|
128 * Y = address of path descriptor
|
|
129 * U = address of device memory area
|
|
130 *
|
|
131 * Exit:
|
|
132 * CC = carry set on error
|
|
133 * B = error code
|
|
134 *
|
|
135 GetStat
|
|
136 cmpa #$01
|
|
137 bne L008A
|
|
138 L0088 clrb
|
|
139 rts
|
|
140
|
|
141 L008A cmpa #$06
|
|
142 beq L0088
|
|
143 *
|
|
144 * SetStat
|
|
145 *
|
|
146 * Entry:
|
|
147 * A = function code
|
|
148 * Y = address of path descriptor
|
|
149 * U = address of device memory area
|
|
150 *
|
|
151 * Exit:
|
|
152 * CC = carry set on error
|
|
153 * B = error code
|
|
154 *
|
|
155 SetStat
|
|
156 comb
|
|
157 ldb #$D0
|
|
158 rts
|
|
159 *
|
|
160 * Term
|
|
161 *
|
|
162 * Entry:
|
|
163 * U = address of device memory area
|
|
164 *
|
|
165 * Exit:
|
|
166 * CC = carry set on error
|
|
167 * B = error code
|
|
168 *
|
|
169
|
|
170 Term rts
|
|
171
|
|
172 emod
|
|
173 eom equ *
|
|
174 end
|