-
Notifications
You must be signed in to change notification settings - Fork 10
/
intro.s
153 lines (136 loc) · 4.72 KB
/
intro.s
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
include macros.s
include mainsym.s
org introStart
ds.b 1024,$72 ;Blank char
org $f000
incbin covert.chr
ds.b 8,$ff
org introCodeStart
LOGO_FADE_FRAMES = 4
jsr WaitBottom
lda #$bc
sta $d018
lda #$18
sta $d016
lda #$08
ldx #$00
stx $d415 ;Set filter lowbyte for all subsequent music
stx $d020
stx $d021
stx $d022
stx $d023
SetColors: sta $d800,x
sta $d900,x
sta $da00,x
sta $db00,x
inx
bne SetColors
ldx #29
DrawLogo: lda covertLogoData,x
sta introStart+10*40+5,x
lda covertLogoData+30,x
sta introStart+11*40+5,x
lda covertLogoData+60,x
sta introStart+12*40+5,x
lda covertLogoData+90,x
sta introStart+13*40+5,x
dex
bpl DrawLogo
jsr WaitBottom
lda #$1b
sta $d011 ;Show logo
lda fastLoadMode
beq NoMusic ;If not using Kernal slow loading, play music now
sei
lda #$00
jsr musicData
lda #<MusicIrq
sta $fffe
lda #>MusicIrq
sta $ffff
lda #$fc
sta $d012
lda #$01
sta $d01a
cli
NoMusic: ldx #$00
FadeInLoop: inx
jsr SetLogoColors
cpx #LOGO_FADE_FRAMES
bcc FadeInLoop
lda fastLoadMode
beq NoPause
ldx #85 ;If using fastloading, pause for roughly 1.5 seconds
PauseLoop: jsr WaitBottom ;to show the logo a little longer
dex
bne PauseLoop
NoPause: lda #<$2000
ldx #>$2000
jsr LoadFile ;Load bitmap data attached to this file
lda #$34 ;Copy bitmap to proper videobank
sta $01 ;(loader does not support loading under I/O)
ldx #$00
CopyPicture: lda $2000,x
CopyPictureSta: sta $c000,x
inx
bne CopyPicture
inc CopyPicture+2
inc CopyPictureSta+2
lda CopyPictureSta+2
cmp #$e0
bcc CopyPicture
inc $01
ldx #LOGO_FADE_FRAMES
FadeOutLoop: jsr SetLogoColors
dex
bpl FadeOutLoop
lda #$a0
sta $d018
ldx #$00
stx $d011 ;Blank screen now until ready to show
lda #<$e800
ldx #>$e800
jsr LoadFile ;Load screen & color data
lda #<$d800
ldx #>$d800
jsr LoadFile
jsr WaitBottom
lda #$3b
sta $d011 ;Show loading picture
lda #>(InitAll-1) ;Store mainpart entrypoint to stack
pha
lda #<(InitAll-1)
pha
lda #<loaderCodeEnd
ldx #>loaderCodeEnd
jmp LoadFile ;Load mainpart
SetLogoColors: ldy #$03
SetLogoDelay: jsr WaitBottom
dey
bne SetLogoDelay
lda logoColors,x
sta $d021
lda logoColors+1,x
sta $d022
lda logoColors+2,x
sta $d023
rts
MusicIrq: sta irqSaveA
stx irqSaveX
sty irqSaveY
lda $01
sta irqSave01
lda #$35
sta $01
jsr musicData+3
dec $d019
lda irqSave01
sta $01
lda irqSaveA
ldx irqSaveX
ldy irqSaveY
rti
logoColors: dc.b 0,0,0,0,11,12,13
covertLogoData: incbin covertscr.dat
org musicData
incbin loadermusic.bin