-
Notifications
You must be signed in to change notification settings - Fork 85
/
main
287 lines (287 loc) · 5.09 KB
/
main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
.PAG 'MAIN'
;
;
MAI80 LDA DATA
JSR INSER1
BCC MAI10
JMP FINI40
MAI10 JSR IEEE
BVC MAI80
JMP MAIN03
;
;
MAI81 LDA DATA
JSR TERML
BCS MAII
JMP FINI90
MAII LDA DATA
BPL MAIIK
STA NOLF
MAIIK LDA PTRRDY
BNE MAIIK
LDA POSI
STA LIMPOS
LDA POSI+1
STA LIMPOS+1
JSR IS65
JMP FINI40
;
;
;
MAI82 JSR CLRMR
JMP FINI40
MAIN85 JSR HOME
LDA PORTB
AND #$FD
STA PORTB
LDA #<CR3TIM
STA CRTM
LDA #>CR3TIM
STA CRTM+1
LDA #$FF
STA CONDM
LDA #84
STA DDATA
LDA #<CRLIM1
STA CRLIMB
LDA #>CRLIM1
STA CRLIMB+1
LDA #CHRLI1
STA FLIM
LDA #CHRLI1+1
STA CHRLIM
LDA #52
STA RLIM
LDA #240
STA LLIM
LDA #<LIM272
STA LIMPOS
STA TEMP5
LDA #>LIM272
STA LIMPOS+1
STA TEMP5+1
JMP FINI40
;
;
MAIN86 LDA PORTB
ORA #$02
STA PORTB
LDA #<CR2TIM
STA CRTM
LDA #>CR2TIM
STA CRTM+1
LDA #0
STA CONDM
STA COUNT3
STA LMODE
LDA #42
STA DDATA
LDA #<CRLIM
STA CRLIMB
LDA #>CRLIM
STA CRLIMB+1
LDA #CHRLIN
STA FLIM
LDA #CHRLIN+1
STA CHRLIM
LDA #26
STA RLIM
LDA #120
STA LLIM
LDA #<LIM136
STA LIMPOS
STA TEMP5
LDA #>LIM136
STA LIMPOS+1
STA TEMP5+1
JSR HOME
JMP FINI40
MAIN87
LDA CONDM
BNE MAP102
LDA #0
STA COUNT3
STA LMODE
JMP MAP100
MAP102 LDA #CHRLIN
STA FLIM
LDA #CHRLIN+1
STA CHRLIM
LDA ONEDIR
ORA #$80
STA ONEDIR
LDA #$FF
STA LMODE
LDA #1
STA COUNT3
MAP100 JMP FINI40
;
MAIN88
LDA #0
STA COUNT3
LDA LMODE
BEQ MAP101
MAP103 LDA CONDM
BEQ MAP101
LDA #CHRLI1
STA FLIM
LDA #CHRLI1+1
STA CHRLIM
LDA ONEDIR
AND #$7F
STA ONEDIR
LDA #0
STA LMODE
STA COUNT3
MAP101 JMP FINI40
;
;*JUMP TABLE FOR DIFFERENT SA'S
; NOTE: THE RTS REQUIRES THE ADDRESS-1
SATABL .WORD MAIN10-1 ;SA=0, NORMAL PRINTING
.WORD FORMAT-1 ;SA=1, FORMATTED PRINTING
.WORD MAIN18-1 ;SA=2, STORE FORMAT DATA
.WORD MAIN38-1 ;SA=3, SET LINES PER PAGE
.WORD MAIN45-1 ;SA=4, TURN ON ERROR DIAGNOSTICS
.WORD MAIN50-1 ;SA=5, STORE PROGRAMMABLE CHAR
.WORD MAIN55-1 ;SA=6, SET TRACTOR INCREMENT
.WORD MAIN58-1 ;SA=7, SET BUSINESS PRINTER MODE
.WORD MAIN60-1 ;SA=8, SET GRAPHICS PRINTER MODE
.WORD MAIN48-1 ;SA=9, TURN OFF ERROR DIAGNOSTICS
.WORD INIT-1 ;SA=10, RESET PRINTER
.WORD MAIN97-1 ;SA=11 TURN ON UNI-DIRECTION
.WORD MAIN98-1 ;SA=12 TURN OFF UNIDIRECTION
.WORD MAIN85-1 ;SA=13 TURN ON CONDENSE MODE
.WORD MAIN86-1 ;SA=14 TURN OFF CONDENCE MODE
.WORD MAIN87-1 ;SA=15 LETTER MODE AT CONDENCE
.WORD MAIN60-1 ;SA=16 SET GRAPHIC MODE
.WORD MAI80-1 ;SA=17 STORE IMAGE DATA INTO BUFFER
.WORD MAI81-1 ;SA=18 IMAGE PRINT START
.WORD MAI82-1 ;SA=19 BUFFER CLEARE
.WORD MAI82-1 ;SA=20 BUFFER CLEARE
.WORD MAIN88-1 ;SA=21 TURN OFF LETTER MODE
;
;*SA=3, SET LINES PER PAGE
;
MAIN38 LDA DATA ;PICK UP NUMBER
BEQ MAIN43 ;IF LPP=0, ERROR
BMI MAIN43 ;IF LPP=0, ERROR
STA LP
MAIN41 JMP FINI30 ;GET ANOTHER CHAR, AND WAIT LINE OUT
MAIN43 LDY #'L ;LPP OUT OF RANGE
JMP ERROR
;
;*SA=4, ENABLE ERROR DIAGNOSTICS
;
MAIN45 TXA ;SET DIAG NONZERO
;
;*SA=9, DISABLE ERROR DIAGNOSTICS
;
MAIN48 STA DIAG
BCS MAIN63 ;USE CURRENT CHAR
;
;*SA=6, SET TRACTOR INCREMENT
;
MAIN55 LDA DATA
STA FDINC
BCS MAIN41 ;GET ANOTHER CHAR
;
;*SA=7, TURN ON BUSINESS PRINTER
;
MAIN58 LDA #BUSI
;
;*SA=8, TURN ON GRAPHICS PRINTER
;
MAIN60 STA BUSSEL
MAIN63 JMP FINI40 ;USE CURRENT CHAR
;
;*SA=0, ORDINARY PRINTING
;
MAIN10 LDA DATA ;FETCH CHAR
JSR INSERT ;IN2 Q SHE GOES
JSR TERML ;TERMINAL?
BCC MAIN12 ;IF CC,NO
JMP FINI40 ;FINISH UP LINE
MAIN12 JSR IEEE ;GET NEXT CHAR
BVC MAIN10 ;LOOP IF STILL SA=0
JMP FINI90 ;SA CHANGED, SO ERROR
;
;*MAIN ENTRY POINT
;
MAIN00 JSR IEEE ;FETCH NEXT CHAR
MAIN03 CLV ;THIS FETCH ALWAYS GOOD
LDA SA ;NOW...
CMP #3 ;DETERMINE IF SA OUT-OF-RANGE
BCC MAIN08 ;IF SA<3, BR-NO DELAY
CMP #22
LDY #'C ;ASSUME COMMAND ERROR
BCC MAIN05 ;IF SA>22 THEN ERROR,
JMP ERROR
;
MAIN05 LDY PTRRDY ;WAIT TILL PRINTER READY
BNE MAIN05 ;FOR SA'S>2
;
MAIN08 TAX ;MOVE SA TO .X FOR SAFEKEEPING
ASL A ;FORM WORD INDEX
TAY ;MOVE TO Y TO USE AS INDEX
LDA SATABL+1,Y ;FETCH JMP ADDR HI
PHA ;STICK IN STACK FOR FOLLOWING RTS
LDA SATABL,Y ;FETCH JMP ADDR LO
PHA
LDA #0 ;SOME SA'S USE A ZERO ACCUM.
SEC ;AND SOME USE BCS'S
RTS ;GIT 2 WAR WE IZ SUPOSED 2 GO
;
;*SA=2, STORE FORMAT DATA
;
MAIN18 STA FV ;INIT LITERAL FLAG
TAX ;INIT CHAR COUNTER
BEQ MAIN23 ;GET INTO FETCH LOOP
MAIN20 JSR IEEE
BVS MAIN32 ;BREAK ON CHANGE OF SA
MAIN23 JSR TERML ;CHAR A TERMINAL?
BCS MAIN32 ;IF CS, YES
CMP #RVSON ;LITERAL NEXT?
BNE MAIN26 ;IF NE, NO
LDA #$40 ;YES, FORM TEMPLATE
STA FV ;SAVE FOR BIT SETTING LATER
BNE MAIN20 ;NEEEEEXT.....
MAIN26 CPX FLIM;BUFFER FULL?
BCS MAIN32 ;IF CS, YES
AND #$BF ;MASK OUT LITERAL POSITION
ORA FV ;OR-IN LITERAL BIT IF SET
STA F,X ;SAVE FORMAT CHAR AWAY
LDA #0 ;TURN OFF LITERAL BIT
STA FV
INX ;NEXT CHAR
BNE MAIN20 ;LOOP ALWAYS
;
MAIN32 LDA #0 ;STUFF FORMAT TERMINATOR IN BUF
STA F,X
STX FV ;SAVE FORMAT CHAR COUNT
BVS FINI90 ;IF VS, ERROR
BVC FINI40 ;WAIT FOR END OF LINE
;
;*SA=5, STORE PROGRAMMABLE CHAR
;
MAIN50 TAX ;CLEAR .X
MAIN53 LDA DATA ;FETCH DOT DATA
STA PCHAR,X ;SAVE IN PROG. CHAR
JSR IEEE
BVS FINI90 ;IF VS, ERROR
INX ;POINT AT NEXT LOC
CPX #6 ;DONE?
BNE MAIN53 ;KEEP STORING...
BEQ FINI30 ;WAIT LINE OUT
MAIN97 LDA ONEDIR
ORA #$80
STA ONEDIR
JMP FINI40
MAIN98 LDA ONEDIR
AND #$7F
STA ONEDIR
JMP FINI40
;
;
;
;
.END