-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_buffer.s
More file actions
65 lines (56 loc) · 1.42 KB
/
draw_buffer.s
File metadata and controls
65 lines (56 loc) · 1.42 KB
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
; Render text buffer to the screen
.macro _drawChar
clr r0
bisb (r1)+, r0
cmpb r0, (r2)
bne drawChar.draw\@
inc r2
inc r5
inc r5
br drawChar.skip\@
drawChar.draw\@:
movb r0, (r2)+
asl r0
mov PET_FONT_LUT(r0), r0
.rept 8
mov (r0)+, (r5)
add r3, r5
.endr
sub #LINE_WIDTHB * 8 - 2, r5
drawChar.skip\@:
.endm
.equiv DRAW_CHAR_REPS, 2 ; 2 is max number, `sob` will be out of range otherwise
drawBuffer:
.ifdef COLOR_TILES
tstb @#CCH1OS
bpl .-4
movb #TRUE, @#CCH1OD
.else
mov #TEXT_BUFFER, r1
mov #TEXT_BUFFER_PREV, r2
mov #FB, r5
mov #25, LINES_COUNT
mov #LINE_WIDTHB, r3
mov #LINE_WIDTHW / DRAW_CHAR_REPS, r4
drawBuffer.loop:
.rept DRAW_CHAR_REPS
_drawChar
.endr
sob r4, drawBuffer.loop
add #LINE_WIDTHB * 7, r5
.equiv LINES_COUNT, .+2
dec #25
bze 1237$
mov #LINE_WIDTHW / DRAW_CHAR_REPS, r4
jmp drawBuffer.loop
.endif
1237$: return
.ifndef COLOR_TILES
PET_FONT: .incbin "build/c64tileset.gfx"
PET_FONT_LUT:
current_char = 0
.rept 256
.word PET_FONT + current_char * 16
current_char = current_char + 1
.endr
.endif