forked from Pigu-A/nobankskank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmptplfox.asm
executable file
·406 lines (390 loc) · 4.83 KB
/
mptplfox.asm
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
; Player MPT 2.4
; by Fox/Infinity
; 07,19,25,30/07/96
; original version by Jaskier/Taquart
zp = $e4
freq = zp
slup = zp+4
ad = zp+8
aud = zp+10
tp = zp+11
ldx freq
ldy freq+1
lda aud
sta rAUDCTL
sta rAUDCTL+$10 ; make stereo mod owners love both ears
stx rAUDF1
stx rAUDF1+$10
sty rAUDF2
sty rAUDF2+$10
lda freq+2
sta rAUDF3
sta rAUDF3+$10
lda freq+3
sta rAUDF4
sta rAUDF4+$10
lda volume
sta rAUDC1
sta rAUDC1+$10
lda volume+1
sta rAUDC2
sta rAUDC2+$10
lda volume+2
sta rAUDC3
sta rAUDC3+$10
lda volume+3
sta rAUDC4
sta rAUDC4+$10
mvx #0, aud
inc licz
lda #-1
pozptr = *-1
cmp #$40
lenpat = *-1
dec zegar
bcc r1
bne r5
stx pozptr
p2 lda #$ff
sta ptrwsk,x
sta licspc,x
lda msx+$1c0,x
sta ad
lda msx+$1c4,x
sta ad+1
ldy #0
pozsng = *-1
tya
lsr a
sta zCurMsxOrd
p3 lda (ad),y
iny
cmp #$fe
bcc p6
beq p4
lda (ad),y
bmi p4
asl a
tay
sta pozsng
bcc p3
p6 asl a
sta numptr,x
lda (ad),y
sta poddzw,x
p7 inx
cpx #4
bcc p2
iny
sty pozsng
bcs r5
p4 ldx #3
lda #0
fin sta volume,x
dex
bpl fin
dec pozptr
inc zegar
ret rts
r1 bpl r5
ldx #3
r2 dec licspc,x
bpl r4
ldy numptr,x
lda msx+$41,y
beq r4
sta ad+1
lda msx+$40,y
sta ad
ldy ptrwsk,x
jmp newdzw
r3 lda ilespc,x
sta licspc,x
r4 dex
bpl r2
lda #5
tempo = *-1
sta zegar
mva pozptr, zCurMsxRow
inc pozptr
r5 ldx #3
bne r6
d0 sta volume,x
jmp r9
r8 ldy #$23
lda (ad),y
ora aud
sta aud
lda (ad),y
and filtry,x
beq r9
ldy #$28
lda (ad),y
add numdzw,x
jsr czest
sec
adc p1pom,x
sta freq+2,x
r9 dex
bmi ret
r6 lda adrinh,x
beq d0
sta ad+1
lda adrinl,x
sta ad
ldy slup,x
cpy #$20
bcs d3
lda (ad),y
adc adcvol,x
bit v10
beq d1
and #$f0
d1 sta volume,x
iny
lda (ad),y
iny
sty slup,x
sta tp
and #7
beq d4
tay
lda akce-1,y
sta akbr+1
lda tp
.rept 5
lsr a
.next
ora #$28
tay
lda (ad),y
clc
akbr bcc *
ak
a0 adc freq,x
a1 sta freq,x
jmp r9
a2 jsr aczest
sta freq,x
jmp r9
a4 sta freq,x
lda ndziel,x
bpl a7
a5 sta freq,x
lda #$80
bne a7
a6 sta freq,x
lda #1
a7 ora aud
sta aud
jmp r9
a8 and rRANDOM
sta freq,x
jmp r9
d3 iny
iny
bne *+4
ldy #$20
sty slup,x
lda volume,x
and #$0f
beq d4
ldy #$22
lda (ad),y
beq d4
dec p3lic,x
bne d4
sta p3lic,x
dec volume,x
d4 lda slup,x
and #6
lsr a
adc #$24
tay
lda (ad),y
jsr aczest
sta freq,x
ldy branch,x
sty typbr+1
ldy p2lic,x
typbr beq *
so
dec p2lic,x
jmp r8
s0 lda #2
and #0
licz = *-1
beq t2
asl a
and licz
bne t0
lda p1lsb,x
t1 sta p1pom,x
adc freq,x
sta freq,x
jmp r8
t0 lda freq,x
s1 sub p1lsb,x
sta freq,x
tya
sub p1lsb,x
t2 sta p1pom,x
jmp r8
s2 lda p1lic,x
t9 sta p1pom,x
add freq,x
t3 sta freq,x
lda p1lic,x
add p1lsb,x
sta p1lic,x
jmp r8
s3 lda numdzw,x
sub p1lic,x
t4 jsr nczest
jmp t3
s4 tya
sub p1lic,x
jmp t9
s5 lda numdzw,x
add p1lic,x
jmp t4
s6 jsr t5
jmp t1
s7 jsr t5
adc numdzw,x
jsr nczest
sta freq,x
jmp r8
t5 ldy p1lic,x
lda p1lsb,x
bmi *+4
iny
iny
dey
tya
sta p1lic,x
cmp p1lsb,x
bne t7
eor #$ff
sta p1lsb,x
lda p1lic,x
t7 clc
rts
aczest adc adcdzw,x
nczest sta numdzw,x
czest and #$3f
ora frqwsk,x
tay
lda msx+$c0,y
rts
nins sty tp
and #$1f
asl a
tay
lda msx,y
sta adrinl,x
lda msx+1,y
sta adrinh,x
ldy tp
newdzw lda #0
newavo sta adcvol,x
new iny
lda (ad),y
bpl q4
cmp #$fe
bne q0
tya
sta ptrwsk,x
jmp r3
q0 cmp #$c0
bcc q3
cmp #$e0
bcc q1
mva lenpat, pozptr
bcs new
q1 cmp #$d0
bcc q2
and #$0f
sta tempo
bpl new
q2 adc #$31
bvc newavo
q3 and #$3f
sta ilespc,x
bpl new
q4 cmp #$40
bcs nins
adc poddzw,x
sta adcdzw,x
tya
sta ptrwsk,x
lda adrinh,x
beq qret
sta ad+1
lda adrinl,x
sta ad
ldy #$20
lda (ad),y
and #$0f
sta p1lsb,x
lda (ad),y
.rept 4
lsr a
.next
and #7
tay
lda typy,y
sta branch,x
ldy #$21
lda (ad),y
asl a
asl a
sta tp
and #$3f
sta p2lic,x
eor tp
sta frqwsk,x
iny
lda (ad),y
sta p3lic,x
lda #0
sta slup,x
sta p1lic,x
sta p1pom,x
lda adcdzw,x
; (nczest)
sta numdzw,x
and #$3f
ora frqwsk,x
tay
lda msx+$c0,y
sta freq,x
qret jmp r3
v10 .byte $10
akce
.byte a1-ak,a0-ak,a2-ak
.byte a4-ak,a5-ak,a6-ak,a8-ak
typy
.byte s0-so,s1-so,s2-so,s3-so
.byte s4-so,s5-so,s6-so,s7-so
ndziel .byte $40,0,$20,0
filtry .byte 4,2,0,0
branch .dword 0
volume .dword 0
adcvol .dword 0
frqwsk .dword 0
adcdzw .dword 0
poddzw .dword 0
adrinl .dword 0
adrinh .dword 0
numdzw .dword 0
numptr .dword 0
ptrwsk .dword 0
ilespc .dword 0
licspc .dword 0
p1lsb .dword 0
p1lic .dword 0
p1pom .dword 0
p2lic .dword 0
p3lic .dword 0
zegar .byte 1