33
33
; ld a, the number of the effect (0..255) ;
34
34
; ld e, the number of the channel (A=0, B=1, C=2) ;
35
35
; ld bc, the bank address + the release address offset ;
36
- ; call AFX.PlayChannel ;
36
+ ; call AFX.PlayLooped ;
37
37
; ;
38
38
; Notify AFX.Frame that the should be should be looped back to ;
39
39
; the sustain point once the release point has been reached: ;
58
58
AFX proc
59
59
60
60
SMC equ 0
61
- DebugPrintAddresses equ false ; If true, will print the address offsets
61
+ DebugPrintAddresses equ false ; If true, will print the address offsets
62
62
; of each FX frame as they are played.
63
63
; Add these to sfxBankAd when passing BC into
64
64
; AFX.PlayLooped or AFX.Sustain.
65
+ if !def sfxBankPageOffset
66
+ sfxBankPageOffset equ 0 ; Allows for ayFX to be located in a different RAM bank
67
+ endif
65
68
66
69
; Channel descriptors, 4 bytes per channel:
67
70
; +0 (2) current address (channel is free if high byte=$00)
@@ -135,9 +138,11 @@ afxInit1:
135
138
136
139
ld (afxNseMix + 1 ) , de ; Reset the player variables
137
140
138
- ret
139
-
140
-
141
+ if def AFXJumpReturns
142
+ jp AFXInit.Return
143
+ else
144
+ ret
145
+ endif
141
146
142
147
; --------------------------------------------------------------;
143
148
; Play the current frame. ;
@@ -156,10 +161,6 @@ afxFrame0:
156
161
jr nc , afxFrame7 ; The channel does not play, we skip
157
162
ld l , (ix + 0 )
158
163
159
- if DebugPrintAddresses
160
- BPAddress: zeusdatabreakpoint 3 , "zeusprinthex(1, hl-sfxBankAd)" , BPAddress
161
- endif
162
-
163
164
ld e , (hl) ; We take the value of the information byte
164
165
inc hl
165
166
@@ -261,16 +262,39 @@ afxNseMix:
261
262
out (c) , a
262
263
ld b , l
263
264
out (c) , d
264
- ret
265
+ if def AFXJumpReturns
266
+ jp AFXFrame.Return
267
+ else
268
+ ret
269
+ endif
265
270
CheckRelease:
271
+ if DebugPrintAddresses ; Prints out a list of all the frame addresses and offsets.
272
+ ; For each frame, the first value is CurrentAddrChA[N], and
273
+ ; the second value is the number you need to add to sfxBankAd
274
+ ; when passing BC into AFX.PlayLooped and AFX.Sustain.
275
+ BPAddress: zeusdatabreakpoint 3 , "zeusprinthex(1, [ix+sfxBankPageOffset]w, [ix+sfxBankPageOffset]w-sfxBankAd)" , BPAddress + sfxBankPageOffset
276
+ endif
277
+
266
278
ld a , (ix + 6 ) ; get release LSB
267
279
cp l
268
- ret nz ; Carry on if no MLB match
280
+ if def AFXJumpReturns
281
+ jp nz , AFXFrame.Return ; Carry on if no MLB match
282
+ else
283
+ ret nz ; Carry on if no MLB match
284
+ endif
269
285
ld a , (ix + 7 ) ; get release MSB
270
286
or a
271
- ret z ; Carry on if release disabled
287
+ if def AFXJumpReturns
288
+ jp z , AFXFrame.Return ; Carry on if release disabled
289
+ else
290
+ ret z ; Carry on if release disabled
291
+ endif
272
292
cp h
273
- ret nz ; Carry on if no MSB match
293
+ if def AFXJumpReturns
294
+ jp nz , AFXFrame.Return ; Carry on if no MLB match
295
+ else
296
+ ret nz ; Carry on if no MLB match
297
+ endif
274
298
push bc
275
299
ld a , (ix + 4 )
276
300
or a
@@ -284,7 +308,11 @@ CheckRelease:
284
308
ld (ix + 5 ) , a ; to require it to be resent
285
309
NoLoop:
286
310
pop bc
287
- ret
311
+ if def AFXJumpReturns
312
+ jp AFXFrame.Return
313
+ else
314
+ ret
315
+ endif
288
316
289
317
; --------------------------------------------------------------;
290
318
; Launch the effect on a specific channel. Any sound currently ;
@@ -397,7 +425,11 @@ ReleaseHiSMC equ $+3: ld (ix+4), SMC ; <SMC Release MSB
397
425
xor a
398
426
ld (ix + 1 ) , a ; Reset sustain LSB
399
427
ld (ix + 2 ) , a ; Reset sustain MSB
400
- ret
428
+ if def AFXJumpReturns
429
+ jp AFXPlay.Return
430
+ else
431
+ ret
432
+ endif
401
433
402
434
; --------------------------------------------------------------;
403
435
; Notify AFX.Frame that the sound in channel E should be looped ;
@@ -419,7 +451,11 @@ Sustain:
419
451
ld (hl) , c
420
452
inc hl
421
453
ld (hl) , b
422
- ret
454
+ if def AFXJumpReturns
455
+ jp AFXSustain.Return
456
+ else
457
+ ret
458
+ endif
423
459
pend
424
460
425
461
Add macro(XX , Y)
0 commit comments