-
Notifications
You must be signed in to change notification settings - Fork 84
/
lcc.gcrbin
291 lines (291 loc) · 3.3 KB
/
lcc.gcrbin
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
288
289
290
291
.PAGE 'GCRBIN.FAST'
MASK1=$F8
MASK2=$07
MASK2X=$C0
MASK3=$3E
MASK4=$01
MASK4X=$F0
MASK5=$0F
MASK5X=$80
MASK6=$7C
MASK7=$03
MASK7X=$E0
MASK8=$1F
;
;
;
;
;
; FAST GCR TO BINARY CONVERSION
;
;
GET4GB LDY GCRPNT
;
LDA (BUFPNT),Y
AND #MASK1
LSR A
LSR A
LSR A
STA GTAB ; HI NIBBLE
;
LDA (BUFPNT),Y
AND #MASK2
ASL A
ASL A
STA GTAB+1
;
INY ; NEXT BYTE
BNE XX05 ; TEST FOR NEXT BUFFER
LDA NXTBF
STA BUFPNT+1
LDY NXTPNT
;
XX05 LDA (BUFPNT),Y
AND #MASK2X
ROL A
ROL A
ROL A
ORA GTAB+1
STA GTAB+1
;
LDA (BUFPNT),Y
AND #MASK3
LSR A
STA GTAB+2
;
LDA (BUFPNT),Y
AND #MASK4
ASL A
ASL A
ASL A
ASL A
STA GTAB+3
;
INY ; NEXT
;
LDA (BUFPNT),Y
AND #MASK4X
LSR A
LSR A
LSR A
LSR A
ORA GTAB+3
STA GTAB+3
;
LDA (BUFPNT),Y
AND #MASK5
ASL A
STA GTAB+4
;
INY ; NEXT BYTE
;
LDA (BUFPNT),Y
AND #MASK5X
CLC
ROL A
ROL A
AND #1
ORA GTAB+4
STA GTAB+4
;
LDA (BUFPNT),Y
AND #MASK6
LSR A
LSR A
STA GTAB+5
;
LDA (BUFPNT),Y
AND #MASK7
ASL A
ASL A
ASL A
STA GTAB+6
;
INY ; TEST FOR OVERFLOW DURING WRITE TO BINARY CONVERSION
BNE XX06
LDA NXTBF
STA BUFPNT+1
LDY NXTPNT
;
XX06 LDA (BUFPNT),Y
AND #MASK7X
ROL A
ROL A
ROL A
ROL A
ORA GTAB+6
STA GTAB+6
;
LDA (BUFPNT),Y
AND #MASK8
STA GTAB+7
INY
;
STY GCRPNT
;
;
LDX GTAB
LDA GCRHI,X
LDX GTAB+1
ORA GCRLO,X
STA BTAB
;
LDX GTAB+2
LDA GCRHI,X
LDX GTAB+3
ORA GCRLO,X
STA BTAB+1
;
LDX GTAB+4
LDA GCRHI,X
LDX GTAB+5
ORA GCRLO,X
STA BTAB+2
;
LDX GTAB+6
LDA GCRHI,X
LDX GTAB+7
ORA GCRLO,X
STA BTAB+3
;
RTS
;
;
;
GCRHI .BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $80
.BYTE $00
.BYTE $10
.BYTE $FF ;ERROR
.BYTE $C0
.BYTE $40
.BYTE $50
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $20
.BYTE $30
.BYTE $FF ;ERROR
.BYTE $F0
.BYTE $60
.BYTE $70
.BYTE $FF ;ERROR
.BYTE $90
.BYTE $A0
.BYTE $B0
.BYTE $FF ;ERROR
.BYTE $D0
.BYTE $E0
.BYTE $FF ;ERROR
;
;
;
GCRLO .BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE 8
.BYTE $00
.BYTE 1
.BYTE $FF ;ERROR
.BYTE $C
.BYTE 4
.BYTE 5
.BYTE $FF ;ERROR
.BYTE $FF ;ERROR
.BYTE 2
.BYTE 3
.BYTE $FF ;ERROR
.BYTE $F
.BYTE 6
.BYTE 7
.BYTE $FF ;ERROR
.BYTE 9
.BYTE $A
.BYTE $B
.BYTE $FF ;ERROR
.BYTE $D
.BYTE $E
.BYTE $FF ;ERROR
;
;
GCRBIN LDA #0 ; SETUP POINTERS
STA GCRPNT
STA SAVPNT
STA BYTCNT
;
LDA #>OVRBUF
STA NXTBF
;
LDA #255-TOPRD
STA NXTPNT
;
LDA BUFPNT+1
STA SAVPNT+1
;
JSR GET4GB
;
LDA BTAB
STA BID ; GET HEADER ID
;
LDY BYTCNT
LDA BTAB+1
STA (SAVPNT),Y
INY
;
LDA BTAB+2
STA (SAVPNT),Y
INY
;
LDA BTAB+3
STA (SAVPNT),Y
INY
;
GCRB10 STY BYTCNT
;
JSR GET4GB
;
LDY BYTCNT
;
LDA BTAB
STA (SAVPNT),Y
INY
BEQ GCRB20 ; TEST IF DONE YET
;
LDA BTAB+1
STA (SAVPNT),Y
INY
;
LDA BTAB+2
STA (SAVPNT),Y
INY
;
LDA BTAB+3
STA (SAVPNT),Y
INY
;
BNE GCRB10 ; JMP
;
GCRB20
LDA BTAB+1
STA CHKSUM
LDA SAVPNT+1 ;RESTORE BUFFER POINTER
STA BUFPNT+1
;
RTS
;
;
;
.END