-
Notifications
You must be signed in to change notification settings - Fork 82
/
lccbingcr.src
258 lines (258 loc) · 4.71 KB
/
lccbingcr.src
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
.page
.subttl 'lccbingcr.src'
;
; fast binary to gcr
;
;
put4bg lda #0 ; clear table
sta gtab+1
sta gtab+4
;
ldy gcrpnt
;
lda btab
and #$f0
lsr a
lsr a
lsr a
lsr a
tax
lda bgtab,x
;
asl a
asl a
asl a
sta gtab
;
lda btab
and #$0f
tax
lda bgtab,x
;
ror a
ror gtab+1
ror a
ror gtab+1
;
and #$07
ora gtab
sta (bufpnt),y
;
iny
;
lda btab+1
and #$f0
lsr a
lsr a
lsr a
lsr a
tax
lda bgtab,x
;
asl a
ora gtab+1
sta gtab+1
;
;
lda btab+1
and #$0f
tax
lda bgtab,x
;
rol a
rol a
rol a
rol a
sta gtab+2
;
rol a
and #1
ora gtab+1
sta (bufpnt),y
;
iny
;
lda btab+2
and #$f0
lsr a
lsr a
lsr a
lsr a
tax
lda bgtab,x
;
clc
ror a
ora gtab+2
sta (bufpnt),y
iny
;
ror a
and #$80
sta gtab+3
;
lda btab+2
and #$0f
tax
lda bgtab,x
asl a
asl a
and #$7c
ora gtab+3
sta gtab+3
;
lda btab+3
and #$f0
lsr a
lsr a
lsr a
lsr a
tax
lda bgtab,x
;
ror a
ror gtab+4
ror a
ror gtab+4
ror a
ror gtab+4
;
and #$03
ora gtab+3
sta (bufpnt),y
iny
bne bing35
;
lda savpnt+1
sta bufpnt+1
;
;
bing35 lda btab+3
and #$0f
tax
lda bgtab,x
ora gtab+4
sta (bufpnt),y
iny
sty gcrpnt
rts
;
;
;
bgtab .byte $0a
.byte $0b
.byte $12
.byte $13
.byte $0e
.byte $0f
.byte $16
.byte $17
.byte $09
.byte $19
.byte $1a
.byte $1b
.byte $0d
.byte $1d
.byte $1e
.byte $15
;
;
;
;******************************
;*
;*
;* binary to gcr conversion
;*
;*
;* does inplace conversion of
;* buffer to gcr using overflow
;* block
;*
;*
;* creates write image
;*
;* 1 block id char
;* 256 data bytes
;* 1 check sum
;* 2 off bytes
;* ---
;* 260 binary bytes
;*
;* 260 binary bytes >> 325 gcr
;*
;* 325 = 256 + 69 overflow
;*
;*
;********************************
;*
bingcr lda #0 ; init pointers
sta bufpnt
sta savpnt
sta bytcnt
;
lda #256-topwrt
sta gcrpnt ; start saving gcr here
;
sta gcrflg ; buffer converted flag
;
lda bufpnt+1 ; save buffer pointer
sta savpnt+1
;
lda #>ovrbuf ; point at overflow
sta bufpnt+1
;
lda dbid ; store data block id
sta btab ; and next 3 data bytes
;
ldy bytcnt
;
lda (savpnt),y
sta btab+1
iny
;
lda (savpnt),y
sta btab+2
iny
;
lda (savpnt),y
sta btab+3
iny
;
bing07 sty bytcnt ; next byte to get
;
jsr put4bg ; convert and store
;
ldy bytcnt
;
lda (savpnt),y
sta btab
iny
beq bing20
;
lda (savpnt),y
sta btab+1
iny
;
lda (savpnt),y
sta btab+2
iny
;
lda (savpnt),y
sta btab+3
iny
;
bne bing07 ; jmp
;
;
bing20 lda chksum ; store chksum
sta btab+1
;
lda #0 ; store 0 off byte
sta btab+2
sta btab+3
;
jmp put4bg ; convert and store and return
;
;
;
;.end