File: Play() function.h - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off


;-------------------------'sound.h'
// 5 ADPCM Sample commands (BYTE CommandNo) - (Fake Sounds: Only 5 SFX used (in many Phoenix Emulator) for the moment->Original Sounds: May be 13 SFX & 2 BGM used for the Future.)

#define hitSFX  (0x04)

#define shield  (0x05)

#define Blow  (0x06)
#define laser (0x07)

#define explosion (0x08)




;-------------------------Original Sounds
; http://www.powerstrike.net/Phoenix/wav.html    A collection of sounds from the game Phoenix!
;
; 13 SFX:
; 1. The Emperor's Spaceship Sound.
; 2. The Emperor'
s Spaceship Sound
; 3. Eagle Sound 1.
; 4. Eagle Sound 2.
; 5. Eagle Flying Sound.
; 6. Eagle Flying Sound.
; 7. Eagle Dying Sound.
; 8. Small Bird Sound 1.
; 9. Small Bird Dying Sound 1.
; 10. Small Bird Dying Sound 2.
; 11. Red Spaceship Destruction Sound.
; 12. Red Spaceship Shield Sound.
; 13. Red Spaceship Shot Sound.

; 2 BGM:
;14. Intro Theme 1.
;15. Intro Theme 2.

 
;5 Fake SFX:
;IMPORTANT: to find Audio Files go there, for example... -> Https://github.com/mangini/phoenix-dart  Phoenix Arcade Emulator for Dart => Download ZIP : audio in '.ogg' format

;-------------------BEY's Routine to Translate an Orginal Sound Command Into an Neo-Geo's sound CommandNo (ADPCM-Type A Format)
;if ( newByte==2 ) Play(hitSFX)      ;  Hexa (0x02)/Original Phoenix sound code  ->Translate into-> (0x04)/Neo-Geo ADPCM sound!
;if ( newByte==12 ) Play(shield)     ;  Hexa (0x0C) ->  (0x05)
;if ( newByte==80 ) Play(blow)       ;  Hexa (0x50) ->  (0x06)
;if ( (newByte>101)&&(newByte<107) ) Play(laser) ;  sound between (0x66) and (0x6A) ->  (0x07)
;if ( newByte==143 ) Play(explosion)     ;  hexa (0x8F) ->  (0x08)


;==================================================================================================================================

;-------------------------'Routines.s'       [(Play() function]  FOR YOU BEY!  Becareful, I'm not a programmer (for sure!) ...May Be, many Bugs to fix !!!!            :)
; I'
ve found inspiration here:    BarfHappy (a French Homebrewer) made all the Job, in 2004! thanks to him
; Thread: Neo CastleVania gameplay-test
; http://www.neo-geo.com/forums/showthread.php?102930-Neo-CastleVania-gameplay-test&s=0684a46e497041f527fe9930466b619f  a BarfHappy's sound Routine example

* Simple Neo Geo ASM Sound Routine ... (very simple, cause miss 'Stop audio' fonction ...)

; .include "Includes/Defines.inc"

; .globl  init_sound
; .globl  Play

;* void init_sound();

init_sound:
 lea 0x320000,a0  ; or lea REG_SOUND,a0
 move.b #7,(a0)   ; sent byte SoundID 0x07, Sound Code Ouput: 320000H(write,byte)-> ex: 320000H(07H,04H) will play(hitSFX)
 rts

 .align 4

;* void Play(BYTE CommandNo);

Play:
 .set _ARGS, 4
 lea 0x320000,a0  ; or lea REG_SOUND,a0
 move.l _ARGS(a7),d0
 move.b d0,(a0)   ; sent Byte CommandNo (0x04, 0x05, 0x06 ...)
 rts

 .align 4


;RQ - >Barf:
;start_sound taking as parameter the sound program track.

:IMPORTANT:
;allow one or two vblank between sound init and sound start, so that the z80 can synch properly


Problem ->Fred/FRONT!: I don't know, if it's necessary to InitSound (by send SoundID) at eatch time, before to sent a Sound CommandNo...for me, the Sound Code Ouput (SoundID=0x07 /Write), is Set by default...Must be confirme !

;possibility I've seen in FrogFeast code :
; send_sound_command(SoundID + SOUND_ADPCM_FROG);
; or
; send_sound_command(SOUND_ADPCM_OFF);

;==================================================================================================================================

;----------------------'
sound.c'   -> Question: is It necessary to creat this file ?
#include "Defines.h"
#include "Routines.h"
#include "Sound.h"       -> pour dire par ex que hitSFX=0x04 !

void init_sound()
{
; send_sound_command(3);  fonction not used here
}

void Play(BYTE CommandNo)
{
; send_sound_command(SoundID + SOUND_ADPCM_FROG);    fonction not used here
; send_sound_command(SOUND_ADPCM_OFF);    fonction not used here


;==================================================================================================================================

;----------------------'
Routines.h'   (for CD version)           ds un '.H' !!!!! ca c est sur !!!

;extern void PlayAudio(DWORD Track);  fonction not used here! -> See NeoGeoCDSrc (Routines.s)/C.Doty sources Code : http://frogfeast.rastersoft.net/Source.html
;  // Play audio

;extern void StopAudio();  fonction not used here! -> See NeoGeoCDSrc (Routines.s)/C.Doty sources Code
;  // Stop audio

extern void init_sound();
  // Init sound

extern void Play(BYTE CommandNo);
  // Play sound

#endif


;==================================================================================================================================

;----------------------'
Defines.h'
#ifndef __DEFINES_H
#define __DEFINES_H


#define BYTE    unsigned char
#define WORD    unsigned short
#define DWORD   unsigned int
#define BOOL    unsigned int
#define PBYTE   BYTE *


#endif

;-----------------------Includes\Defines.inc

* VRAM read/write address
REG_SOUND   = 0x320000    // In/Out Z80