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