-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplayer.ass
195 lines (173 loc) · 2.18 KB
/
replayer.ass
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
getval .macro
; then command
ldy #0
lda (inputdata),y
pha
inc inputdata
lda inputdata
bne *+4
inc inputdata+1
pla
.endmacro
omgsingle
lda #0
sta samplePlaying
sta samplePlaying+1
sta samplePlaying+2
; initial sid as per encoder
lda #15
sta $d418
lda #8
sta $d403
;sta $d403+7
;sta $d403+14
lda #<ovmusic
sta inputdata
lda #>ovmusic
sta inputdata+1
rts
omgponies
lda #0
sta samplePlaying
sta samplePlaying+1
sta samplePlaying+2
; initial sid as per encoder
lda #15
sta $d418
lda #8
sta $d403
sta $d403+7
;sta $d403+14
lda #<alldata
sta inputdata
lda #>alldata
sta inputdata+1
rts
decodeloop
; first channel - put the channel base into x
; for now
getval
sta cmdtemp
cmp #$ff
bne moreframe
rts
moreframe
cmp #$fe
beq omgponies
getval
sta valtemp
; bits 4 through 7 are channel
lda cmdtemp
lsr
lsr
lsr
lsr
and #3
tax
lda ctab,x
tax
; command is in low 4 bits
lda cmdtemp
and #$f
; set_ad
cmp #0
beq set_ad
cmp #1
beq set_sr
cmp #2
beq set_freq
cmp #3
beq set_ctrl
cmp #4
beq set_pw
cmp #5
beq set_fv
cmp #6
beq set_fb
fmlloop
inc $d020
inc $d021
jmp fmlloop
set_fv
lda valtemp
sta $d416
jmp finalise
set_fb
lda valtemp
cmp #0
beq yeszero
; only filter channel #1 for now
lda #$f1
sta $d417
and #7
asl
asl
asl
asl
ora #$f
sta $d418
yeszero
sta $d417
lda #$f
sta $d418
jmp finalise
set_ctrl
lda valtemp
;lda ctrltab,y
sta $d404,x
jmp finalise
set_ad
lda valtemp
sta $d405,x
jmp finalise
set_sr
lda valtemp
sta $d406,x
jmp finalise
set_freq
ldy valtemp
lda sflo,y
sta $d400,x
lda sfhi,y
sta $d401,x
jmp finalise
set_pw
lda valtemp
lsr
lsr
lsr
lsr
sta $d403,x
lda valtemp
asl
asl
asl
asl
sta $d402,x
jmp finalise
finalise
lda cmdtemp
and #$80
cmp #0
bne exitme
jmp decodeloop
exitme
rts
ohno
inc $d020
inc $d021
jmp ohno
cmdtemp
.byte 0
valtemp
.byte 0
ctab
.byte 0,7,14
.include "freqtable.ass"
ctrltab
.byte $10, $20, $40, $80
.byte $11, $21, $41, $81
.byte $12, $22, $42, $82
.byte $13, $23, $43, $83
.byte $14, $24, $44, $84
.byte $15, $25, $45, $85