-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_app.s
222 lines (192 loc) · 2.9 KB
/
test_app.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
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
DEBUG = 0
SONG_SPEED = $05
.include "player_defs.s"
.include "player_macros.s"
; Zero Page allocations
*=$10
.include "player_zeropage.s"
; basic start
*=$0801
.word ss,2020
.null $9e,format("%d", initialize)
ss .word 0
initialize:
sei
lda #$00
sta $d020
sta $d021
; reset the player
lda #$00 ; song ID
jsr Player_Reset
; clear screen
ldx #$00
lda #$20
_clear
sta $0400,x
sta $0500,x
dex
bne _clear
; simple wait for raster
; call update
mainloop:
lda $d012
cmp #$80
bne mainloop
inc $d020
inc $d021
jsr Player_Update
dec $d021
dec $d020
.if DEBUG==1
ldx #$00
_dloop
lda TRACK0,x
sta $0400,x
; lda PATTERN0,x
; sta $0428,x
inx
cpx #3*7
bne _dloop
.fi
jmp mainloop
*=$0880
Player_Reset:
jmp player_Reset_func
Player_Update:
jmp player_Update_func
; NOTE aligned to 256 bytes
; simple tune from X Men 1st class
Voice0:
P0:
.byte BEGIN_REPT,4
.byte G4
.byte C5
.byte G4
.byte F4
.byte END_REPT
P1:
.byte BEGIN_REPT,4
.byte G4
.byte As4
.byte G4
.byte F4
.byte END_REPT
P2:
.byte BEGIN_REPT,4
.byte G4
.byte A4
.byte G4
.byte F4
.byte END_REPT
P3:
.byte BEGIN_REPT,4
.byte G4
.byte Gs4
.byte G4
.byte F4
.byte END_REPT
; loop back
.byte JUMP_TRACK
.word Voice0
; wait for a bit then do some base
WaitV1:
.byte INSTRUMENT,1
.byte BEGIN_REPT,4
.byte BLANK_NOTE,BLANK_NOTE
.byte END_REPT
;loop point
Voice1:
.byte INSTRUMENT,2
.byte C3
.byte Ds3
.byte F3
.byte Gs3
.byte JUMP_TRACK
.word Voice1
; wait for a bit then do some notes
WaitV2:
.byte INSTRUMENT,1
.byte BEGIN_REPT,8
.byte BLANK_NOTE,BLANK_NOTE
.byte END_REPT
V2Loop:
.byte INSTRUMENT,2
.byte C5
.byte C4
.byte C5
.byte C4
.byte C5
.byte JUMP_TRACK
.word V2Loop
; blank track
Voice2:
.byte BLANK_NOTE,BLANK_NOTE
.byte JUMP_TRACK
.word Voice2
; drums lol
Kitt0:
.byte INSTRUMENT,$6
.byte C4
.byte BLANK_NOTE
.byte C4
.byte BLANK_NOTE
.byte C4
.byte C4
.byte C4
.byte BLANK_NOTE
.byte JUMP_TRACK
.word Kitt0
; riff from Micro Mages
Mages:
.byte INSTRUMENT,4
.byte B4
.byte As4
.byte Fs4
.byte Cs4
.byte BEGIN_REPT,3
.byte B3
.byte As4
.byte Fs4
.byte Cs4
.byte END_REPT
.byte As4
.byte Fs4
.byte Cs4
.byte B3
.byte JUMP_TRACK
.word Mages
Song0:
.word Voice0,WaitV1,WaitV2
Song1:
.word Mages,Voice2,Kitt0
Songs:
.word Song0,Song1
; 0 1 2 3 4 5 6
AttackDelayTable: .byte $1b, $1b, $cd, $2b, $1a, $00, $16
ControlTable: .byte PULSE, TRIANGLE, SAWTOOTH, SAWTOOTH, SAWTOOTH, $00, NOISE
DurationTable: .byte SONG_SPEED*2, SONG_SPEED*16, SONG_SPEED*32, SONG_SPEED*2, SONG_SPEED*1, SONG_SPEED*8, SONG_SPEED*1
.include "player.s"
.if DEBUG == 1
OUTHEX:
sty $fb
stx $fc
ldy #$00
pha
lsr
lsr
lsr
lsr
tax
lda tab,x
sta ($fb),y
iny
pla
and #$0f
tax
lda tab,x
sta ($fb),y
rts
tab:
.text "0123456789"
.byte 1,2,3,4,5,6,7,8
.fi