-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbigfont.asm
347 lines (292 loc) · 3.25 KB
/
bigfont.asm
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
!zone BigFont
.chars !byte 112, 216, 204, 220, 202, 218, 206, 222, 201, 217, 205, 221, 203, 219, 207, 223
.posx !byte 0
.textl !byte 0
.texth !byte 0
.linesb !fill 6 * 8
.linesb = $eb00
.linesc = $eb40
.scrollGlpyhs
lda .textl
sta .st1 + 1
lda .texth
sta .st1 + 2
ldx #0
.st1 lda $ffff,x
and #$3f
tay
lda TextFontIndex, y
tay
lda Math.asl3, y
sta tmpl
lda Math.asr5, y
and #7
ora #>CharsetData
sta tmph
ldy #0
lda (tmpl), y
sta .linesb + 0 * 6, x
iny
lda (tmpl), y
sta .linesb + 1 * 6, x
iny
lda (tmpl), y
sta .linesb + 2 * 6, x
iny
lda (tmpl), y
sta .linesb + 3 * 6, x
iny
lda (tmpl), y
sta .linesb + 4 * 6, x
iny
lda (tmpl), y
sta .linesb + 5 * 6, x
iny
lda (tmpl), y
sta .linesb + 6 * 6, x
inx
cpx #6
bne .st1
lda #7
sta tmpy
lda #<.linesb
sta .sts0 + 1
sta .sts1 + 1
sec
lda CharLinesL + 7
sbc #216
sta .sts2 + 1
sta .sts3 + 1
lda CharLinesH + 7
sbc #0
sta .sts2 + 2
sta .sts3 + 2
lda .posx
eor #$07
sta .stj + 1
---
ldx #0
ldy #216
.sts0 lda .linesb, x
inx
sec
rol
.stj bne .stj1
asl
asl
asl
asl
asl
asl
asl
.stj1
sta tmpu
bcs .ston
.stoff
lda #112
.sts2 sta $ffff, y
iny
beq ++
asl tmpu
bcc .sts2
beq .sts1
.ston
lda #223
.sts3 sta $ffff, y
iny
beq ++
asl tmpu
bcc .stoff
bne .sts3
.sts1 lda .linesb, x
inx
sec
rol
bne .stj1
++
clc
lda .sts2 + 1
adc #40
sta .sts2 + 1
sta .sts3 + 1
bcc +
inc .sts2 + 2
inc .sts3 + 2
+
clc
lda .sts0 + 1
adc #6
sta .sts0 + 1
sta .sts1 + 1
dec tmpy
bne ---
rts
.putGlyph
and #$3f
tay
lda TextFontIndex, y
tay
lda Math.asl3, y
sta .t1 + 1
sta .t2 + 1
lda Math.asr5, y
and #7
ora #>CharsetData
sta .t1 + 2
sta .t2 + 2
.loop
.t1
lda $0000
inc .t1 + 1
inc .t1 + 1
sta tmps
inc .t2 + 1
.t2
lda $0000
inc .t2 + 1
sta tmpt
ldy #0
-
lda #0
asl tmps
rol
asl tmps
rol
asl tmpt
rol
asl tmpt
rol
tax
lda .chars, x
sta (tmpl), y
iny
cpy #4
bne -
clc
lda tmpl
adc #40
sta tmpl
lda tmph
adc #0
sta tmph
lda .t1 + 1
and #7
bne .loop
sec
lda tmpl
sbc #156
sta tmpl
lda tmph
sbc #0
sta tmph
rts
; set cursor to x, y
.SetCursor
txa
asl
adc #2
adc CharLinesL + 2, y
sta tmpl
sta tmpml
lda CharLinesH + 2, y
adc #0
sta tmph
eor #$90
sta tmpmh
rts
.clearxline
lda CharLinesL + 2, x
sta tmpl
sta tmpml
lda CharLinesH + 2, x
sta tmph
eor #$90
sta tmpmh
lda #112
ldy #40
- dey
sta (tmpl),y
bne -
lda Starfield.LineColors, x
ldy #40
- dey
sta (tmpml),y
bne -
inx
rts
.ClearLine
jsr .clearxline
jsr .clearxline
jsr .clearxline
jmp .clearxline
; draw a color in x
.DrawChar
stx tmpx
jsr .putGlyph
rts
ldx #0
-- ldy #0
lda tmpx
- sta (tmpml), y
iny
cpy #4
bne -
clc
lda tmpml
adc #40
sta tmpml
lda tmpmh
adc #0
sta tmpmh
inx
cpx #4
bne --
sec
lda tmpml
sbc #156
sta tmpml
lda tmpmh
sbc #0
sta tmpmh
rts
; draw ay to .tmpl, color in x
.DrawText
stx tmpx
sta .t3 + 1
sty .t3 + 2
ldy #0
.loop1
.t3
lda $0000, y
beq .ddone
sty tmpy
jsr .putGlyph
ldx #0
-- ldy #0
lda tmpx
- sta (tmpml), y
iny
cpy #4
bne -
clc
lda tmpml
adc #40
sta tmpml
lda tmpmh
adc #0
sta tmpmh
inx
cpx #4
bne --
sec
lda tmpml
sbc #156
sta tmpml
lda tmpmh
sbc #0
sta tmpmh
ldy tmpy
iny
jmp .loop1
.ddone
rts