-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtitle.asm
More file actions
106 lines (94 loc) · 1.96 KB
/
title.asm
File metadata and controls
106 lines (94 loc) · 1.96 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
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
/*
** Title Screen
*/
.namespace TITLE {
// we relocate chars here
.const CHARACTERS = $f000
// after 119 custom chars, we relocate letters here
.const LETTERS = $f000 + 8 * 119
// SPACE is the first custom letter
.const SPACE = [LETTERS - CHARACTERS] / 8
ShowTitleScreen: {
.label Row = TEMP1
.label Col = TEMP2
//Initialize the screen/color ram self mod code
lda #<VIC.SCREEN
sta Screen + 1
sta Color + 1
lda #>VIC.SCREEN
sta Screen + 2
lda #>VIC.COLOR_RAM
sta Color + 2
// point map to title screen
lda #<TITLE_SCREEN
sta MapLookup + 1
lda #>TITLE_SCREEN
sta MapLookup + 2
//Reset row counter
lda #$00
sta Row
!RowLoop:
//Reset col counter
lda #$00
sta Col
!ColumnLoop:
MapLookup:
lda $BEEF
// map has index into LETTERS, but we've loaded them at an offset we have to account that for now
clc
adc #SPACE
Screen:
sta $BEEF
// now we have to lookup the color data
tax
lda CHAR_COLORS, x
Color:
sta $BEEF
//Increment position in map data
clc
lda MapLookup + 1
adc #1
sta MapLookup + 1
bcc !+
inc MapLookup + 2
!:
//Increment position in screen and color ram
clc
lda Screen + 1
adc #1
sta Screen + 1
sta Color + 1
bcc !+
inc Screen + 2
inc Color + 2
!:
//Advance 1 column
inc Col
ldx Col
cpx #40
bne !ColumnLoop-
inc Row
ldx Row
cpx #25
bne !RowLoop-
rts
}
ClearScreen: {
ldx #0
!clear:
lda #SPACE
sta VIC.SCREEN, x // fill four areas with 256 spacebar characters
sta VIC.SCREEN + $100,x
sta VIC.SCREEN + $200,x
sta VIC.SCREEN + $2e8,x
lda #BLACK // set foreground to black in Color Ram
sta VIC.COLOR_RAM,x
sta VIC.COLOR_RAM + $100,x
sta VIC.COLOR_RAM + $200,x
sta VIC.COLOR_RAM + $2e8,x
inx // increment X
bne !clear- // did X turn to zero yet?
// if not, continue with the loop
rts // return from this subroutine
}
}