Skip to content

Commit b6549e6

Browse files
Changes to zeusexample to allow debug printing of the sample address offsets when they are stored in a paged bank. The zeusdatabreakpoint expression needs to be aware of the virtual address offset in order to set the bp on the correct line, and to deference (ix+0) correctly.
build.bat does not work! Assemble with zeus.exe from http://www.desdes.com/products/oldfiles/zeus.htm.
1 parent dee31a6 commit b6549e6

File tree

7 files changed

+84
-32
lines changed

7 files changed

+84
-32
lines changed

zeusexample/ayfxplay.asm

+52-16
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
; ld a, the number of the effect (0..255) ;
3434
; ld e, the number of the channel (A=0, B=1, C=2) ;
3535
; ld bc, the bank address + the release address offset ;
36-
; call AFX.PlayChannel ;
36+
; call AFX.PlayLooped ;
3737
; ;
3838
; Notify AFX.Frame that the should be should be looped back to ;
3939
; the sustain point once the release point has been reached: ;
@@ -58,10 +58,13 @@
5858
AFX proc
5959

6060
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
6262
; of each FX frame as they are played.
6363
; Add these to sfxBankAd when passing BC into
6464
; 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
6568

6669
; Channel descriptors, 4 bytes per channel:
6770
; +0 (2) current address (channel is free if high byte=$00)
@@ -135,9 +138,11 @@ afxInit1:
135138

136139
ld (afxNseMix+1), de ; Reset the player variables
137140

138-
ret
139-
140-
141+
if def AFXJumpReturns
142+
jp AFXInit.Return
143+
else
144+
ret
145+
endif
141146

142147
; --------------------------------------------------------------;
143148
; Play the current frame. ;
@@ -156,10 +161,6 @@ afxFrame0:
156161
jr nc, afxFrame7 ; The channel does not play, we skip
157162
ld l, (ix+0)
158163

159-
if DebugPrintAddresses
160-
BPAddress: zeusdatabreakpoint 3, "zeusprinthex(1, hl-sfxBankAd)", BPAddress
161-
endif
162-
163164
ld e, (hl) ; We take the value of the information byte
164165
inc hl
165166

@@ -261,16 +262,39 @@ afxNseMix:
261262
out (c), a
262263
ld b, l
263264
out (c), d
264-
ret
265+
if def AFXJumpReturns
266+
jp AFXFrame.Return
267+
else
268+
ret
269+
endif
265270
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+
266278
ld a, (ix+6) ; get release LSB
267279
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
269285
ld a, (ix+7) ; get release MSB
270286
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
272292
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
274298
push bc
275299
ld a, (ix+4)
276300
or a
@@ -284,7 +308,11 @@ CheckRelease:
284308
ld (ix+5), a ; to require it to be resent
285309
NoLoop:
286310
pop bc
287-
ret
311+
if def AFXJumpReturns
312+
jp AFXFrame.Return
313+
else
314+
ret
315+
endif
288316

289317
; --------------------------------------------------------------;
290318
; Launch the effect on a specific channel. Any sound currently ;
@@ -397,7 +425,11 @@ ReleaseHiSMC equ $+3: ld (ix+4), SMC ; <SMC Release MSB
397425
xor a
398426
ld (ix+1), a ; Reset sustain LSB
399427
ld (ix+2), a ; Reset sustain MSB
400-
ret
428+
if def AFXJumpReturns
429+
jp AFXPlay.Return
430+
else
431+
ret
432+
endif
401433

402434
; --------------------------------------------------------------;
403435
; Notify AFX.Frame that the sound in channel E should be looped ;
@@ -419,7 +451,11 @@ Sustain:
419451
ld (hl), c
420452
inc hl
421453
ld (hl), b
422-
ret
454+
if def AFXJumpReturns
455+
jp AFXSustain.Return
456+
else
457+
ret
458+
endif
423459
pend
424460

425461
Add macro(XX, Y)

zeusexample/ayfxtest.szx

31 Bytes
Binary file not shown.

zeusexample/ayfxtest.tap

229 Bytes
Binary file not shown.

zeusexample/ayfxtest.tzx

229 Bytes
Binary file not shown.

zeusexample/ayfxtest.z80

-4 Bytes
Binary file not shown.

zeusexample/build.bat

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
@echo This does not work! Assemble with zeus.exe from:
2+
@echo http://www.desdes.com/products/oldfiles/zeus.htm
13
@echo off
24
C:
35
CD %~dp0
46

5-
zcl.exe playtest.asm
7+
REM zcl.exe playtest.asm
68
REM start "%PROGRAMFILES(X86)%\Spectaculator\Spectaculator.exe" ayfxtest.tap
79

8-
REM pause
10+
rem pause

zeusexample/playtest.asm

+28-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ zeusemulate "128K"
1717
sfxBankAd equ $a000 ; Effects Bank Address
1818
im2Ad equ $bdbd
1919
im2Table equ $be00
20-
Start equ $6200
20+
Start equ $8000
2121
Stack equ Start-1
2222
Zeus_PC equ Start
2323
zoSupportStringEscapes = false
@@ -219,9 +219,6 @@ tblRowNum:
219219
DB $f7, $00, $ef, $09, $fb, $0a, $df, $13
220220
DB $fd, $14, $bf, $1d, $fe, $1e, $7f, $27
221221

222-
CodeSize equ $-Start
223-
224-
225222
Cls proc
226223
ld a, $38
227224
ld (23693), a
@@ -280,6 +277,8 @@ mend
280277
Channel: db 3 ; 0=A, 1=B, 2=C, 3=Any
281278
LastSustain: db 0
282279

280+
CodeSize equ $-Start
281+
283282
org sfxBankAd
284283
import_bin "playtest.afb"
285284
sfxBankSize = $-sfxBankAd
@@ -314,16 +313,31 @@ End:
314313
Size = $-intProc
315314
pend
316315

317-
if (StartSpectaculator)
318-
zeusinvoke "spectaculator.bat"
316+
MemorySize equ $-Start
317+
318+
if zeusver < 65
319+
zeuserror "Upgrade to Zeus v3.70 or above, available at http://www.desdes.com/products/oldfiles/zeus.htm."
319320
endif
320321

321-
output_z80 "ayfxtest.z80", Stack, Start
322-
output_szx "ayfxtest.szx", $0000, Start
323-
output_tzx "ayfxtest.tzx", "ayfxtest", "(c) Shiru 2006-2017", Start, CodeSize, 3
324-
output_tzx_block "ayfxtest.tzx", sfxBankAd, sfxBankSize
325-
output_tzx_block "ayfxtest.tzx", intProc, intProc.Size
326-
output_tap "ayfxtest.tap", "ayfxtest", "(c) Shiru 2006-2017", Start, CodeSize, 3
327-
output_tap_block "ayfxtest.tap", sfxBankAd, sfxBankSize
328-
output_tap_block "ayfxtest.tap", intProc, intProc.Size
322+
if enabled zeusz80
323+
if zeuside
324+
output_tzx "ayfxtest.tzx", "ayfxtest", "(c) Shiru 2006-2017", Start, CodeSize, 3
325+
output_tzx_block "ayfxtest.tzx", sfxBankAd, sfxBankSize
326+
output_tzx_block "ayfxtest.tzx", intProc, intProc.Size
327+
output_tap "ayfxtest.tap", "ayfxtest", "(c) Shiru 2006-2017", Start, CodeSize, 3
328+
output_tap_block "ayfxtest.tap", sfxBankAd, sfxBankSize
329+
output_tap_block "ayfxtest.tap", intProc, intProc.Size
330+
output_z80 "ayfxtest.z80", Stack, Start
331+
output_szx "ayfxtest.szx", $0000, Start
332+
if (StartSpectaculator)
333+
zeusinvoke "spectaculator.bat"
334+
endif
335+
else
336+
output_tzx "ayfxtest.tzx", "ayfxtest", "(c) Shiru 2006-2017", Start, MemorySize, 2
337+
output_tap "ayfxtest.tap", "ayfxtest", "(c) Shiru 2006-2017", Start, MemorySize, 2
338+
zeusprint "Use the IDE version of Zeus to generate .z80 and .szx files, available at http://www.desdes.com/products/oldfiles/zeus.htm."
339+
endif
340+
else
341+
zeuserror "Download the z80 version of Zeus, available at http://www.desdes.com/products/oldfiles/zeus.htm."
342+
endif
329343

0 commit comments

Comments
 (0)