As per the AGD instructions, the BEEP command expects a single parameter for the sound duration. Values above 127 produce white noise effects.
The higher the value, the longer the effects will be.
If you wish to add an external sound effect you must do the same that has to be done for every routine external to the AGD game code: call it from there through an ASM 205 instruction followed by the least significant byte and the most significant byte of the routine start address (as usual since the Z80 uses the little endian byte order).
I.e. if your custom sound effect routine must be executed at address 60000, you must add the following whenever you want to invoke it: ASM 205 ASM 96 ASM 234 205 is a CALL instruction in Z80 Assembly. 234 * 256 + 96 = 60000. So it is the equivalent of CALL 60000.
Here is a simple sound effect routine you can use to test it. Remember to assemble and put it in memory after the end of your AGD game code (and 300 bytes more if you are using the Effects specialization). Refer to the Unused value in the Miscellaneous screen: that is the address of the first free byte after your current AGD game code.
; Generic sound 2 ; ----------------
; Enable commented lines to repeat the sound. ; The number of repetitions is determined by the value of B at the start
; LD B,5 ;loop: PUSH BC LD HL,768 anotherLoop: LD DE,1 PUSH HL CALL 949 POP HL LD DE,16 AND A SBC HL,DE JR NZ, anotherLoop POP BC ; DJNZ loop RET
Last Edit: Sept 14, 2019 12:00:11 GMT by alessandro