tweak zsound examples

This commit is contained in:
Irmen de Jong 2022-06-12 14:51:24 +02:00
parent 43c7b935df
commit 93008ff605
4 changed files with 23 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
%import textio %import textio
%import cx16diskio %import cx16diskio
%import palette
%zeropage basicsafe %zeropage basicsafe
%zpreserved $22,$26 ; zsound lib uses this region %zpreserved $22,$26 ; zsound lib uses this region
@ -29,10 +30,12 @@ zsound_lib:
sub start() { sub start() {
txt.print("zsound pcm digi demo program!\n") txt.print("zsound pcm digi demo program!\n")
if not cx16diskio.load_raw(8, "shoryuken.zcm", digi_bank, digi_address) { c64.SETMSG(%10000000) ; enable kernal status messages for load
txt.print("?can't load digi\n") if not cx16diskio.load_raw(8, "terminator2.zcm", digi_bank, digi_address) {
txt.print("?can't load\n")
return return
} }
c64.SETMSG(0)
cx16.rambank(digi_bank) cx16.rambank(digi_bank)
; initialize header pointer of the zcm to point to actual sample data ; initialize header pointer of the zcm to point to actual sample data
@ -40,11 +43,19 @@ zsound_lib:
pokew(digi_address, digi_address+zcm_DIGITAB_size) pokew(digi_address, digi_address+zcm_DIGITAB_size)
pcm_init() pcm_init()
txt.print("playing digi! hit enter to stop.\n") txt.print("\nplaying digi! hit enter to stop.\n")
pcm_trigger_digi(digi_bank, digi_address) pcm_trigger_digi(digi_bank, digi_address)
while cx16.joystick_get2(0)==$ffff { while cx16.joystick_get2(0)==$ffff {
sys.waitvsync() sys.waitvsync()
repeat 1000 {
; artificially delay calling the play routine so we can see its raster time
%asm {{
nop
}}
}
palette.set_color(0, $0c5)
pcm_play() pcm_play()
palette.set_color(0, $000)
} }
pcm_stop() pcm_stop()
} }

View File

@ -1,5 +1,6 @@
%import textio %import textio
%import cx16diskio %import cx16diskio
%import palette
%zeropage basicsafe %zeropage basicsafe
%zpreserved $22,$28 ; zsound lib uses this region %zpreserved $22,$28 ; zsound lib uses this region
@ -58,7 +59,15 @@ zsound_lib:
; for IRQ based playback instead: cx16.set_irq(&zsm_playIRQ, true) ; for IRQ based playback instead: cx16.set_irq(&zsm_playIRQ, true)
while cx16.joystick_get2(0)==$ffff { while cx16.joystick_get2(0)==$ffff {
sys.waitvsync() sys.waitvsync()
repeat 800 {
; artificially delay calling the play routine so we can see its raster time
%asm {{
nop
}}
}
palette.set_color(0, $0c5)
zsm_play() zsm_play()
palette.set_color(0, $000)
} }
zsm_stop() zsm_stop()
} else { } else {