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

001: 
002: ;-------------------------'sound.h'
003: // 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.)
004: 
005: #define hitSFX  (0x04)
006: 
007: #define shield  (0x05)
008: 
009: #define Blow    (0x06)
010: #define laser   (0x07)
011: 
012: #define explosion (0x08)
013: 
014: 
015: 
016: 
017: ;-------------------------Original Sounds
018: ; http://www.powerstrike.net/Phoenix/wav.html    A collection of sounds from the game Phoenix!
019: ;
020: ; 13 SFX:
021: ; 1. The Emperor's Spaceship Sound.
022: ; 2. The Emperor's Spaceship Sound
023: ; 3. Eagle Sound 1.
024: ; 4. Eagle Sound 2.
025: ; 5. Eagle Flying Sound.
026: ; 6. Eagle Flying Sound.
027: ; 7. Eagle Dying Sound.
028: ; 8. Small Bird Sound 1.
029: ; 9. Small Bird Dying Sound 1.
030: ; 10. Small Bird Dying Sound 2.
031: ; 11. Red Spaceship Destruction Sound.
032: ; 12. Red Spaceship Shield Sound.
033: ; 13. Red Spaceship Shot Sound.
034: 
035: ; 2 BGM:
036: ;14. Intro Theme 1.
037: ;15. Intro Theme 2.
038: 
039:  
040: ;5 Fake SFX:
041: ;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
042: 
043: ;-------------------BEY's Routine to Translate an Orginal Sound Command Into an Neo-Geo's sound CommandNo (ADPCM-Type A Format)
044: ;if ( newByte==2 ) Play(hitSFX)          ;  Hexa (0x02)/Original Phoenix sound code  ->Translate into-> (0x04)/Neo-Geo ADPCM sound!
045: ;if ( newByte==12 ) Play(shield)         ;  Hexa (0x0C) ->  (0x05)
046: ;if ( newByte==80 ) Play(blow)           ;  Hexa (0x50) ->  (0x06)
047: ;if ( (newByte>101)&&(newByte<107) ) Play(laser) ;  sound between (0x66) and (0x6A) ->  (0x07)
048: ;if ( newByte==143 ) Play(explosion)         ;  hexa (0x8F) ->  (0x08)
049: 
050: 
051: ;==================================================================================================================================
052: 
053: ;-------------------------'Routines.s'       [(Play() function]  FOR YOU BEY!  Becareful, I'm not a programmer (for sure!) ...May Be, many Bugs to fix !!!!            :)
054: ; I've found inspiration here:    BarfHappy (a French Homebrewer) made all the Job, in 2004! thanks to him
055: ; Thread: Neo CastleVania gameplay-test
056: ; http://www.neo-geo.com/forums/showthread.php?102930-Neo-CastleVania-gameplay-test&s=0684a46e497041f527fe9930466b619f  a BarfHappy's sound Routine example
057: 
058: * Simple Neo Geo ASM Sound Routine ... (very simple, cause miss 'Stop audio' fonction ...)
059: 
060: ;   .include "Includes/Defines.inc"
061: 
062: ;   .globl  init_sound
063: ;   .globl  Play
064: 
065: ;* void init_sound();
066: 
067: init_sound:
068:  lea 0x320000,a0    ; or lea REG_SOUND,a0
069:  move.b #7,(a0)     ; sent byte SoundID 0x07, Sound Code Ouput: 320000H(write,byte)-> ex: 320000H(07H,04H) will play(hitSFX)
070:  rts
071: 
072:  .align 4
073: 
074: ;* void Play(BYTE CommandNo);
075: 
076: Play:
077:  .set _ARGS, 4
078:  lea 0x320000,a0    ; or lea REG_SOUND,a0
079:  move.l _ARGS(a7),d0
080:  move.b d0,(a0)     ; sent Byte CommandNo (0x04, 0x05, 0x06 ...)
081:  rts
082: 
083:  .align 4
084: 
085: 
086: ;RQ - >Barf:
087: ;start_sound taking as parameter the sound program track.
088: 
089: :IMPORTANT:
090: ;allow one or two vblank between sound init and sound start, so that the z80 can synch properly
091: 
092: 
093: 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 !
094: 
095: ;possibility I've seen in FrogFeast code :
096: ;   send_sound_command(SoundID + SOUND_ADPCM_FROG);
097: ; or
098: ;   send_sound_command(SOUND_ADPCM_OFF);
099: 
100: ;==================================================================================================================================
101: 
102: ;----------------------'sound.c'   -> Question: is It necessary to creat this file ?
103: #include "Defines.h"
104: #include "Routines.h"
105: #include "Sound.h"       -> pour dire par ex que hitSFX=0x04 !
106: 
107: void init_sound()
108: {
109: ;   send_sound_command(3);  fonction not used here
110: }
111: 
112: void Play(BYTE CommandNo)
113: {  
114: ;   send_sound_command(SoundID + SOUND_ADPCM_FROG);    fonction not used here
115: ;   send_sound_command(SOUND_ADPCM_OFF);    fonction not used here
116: 
117: 
118: ;==================================================================================================================================
119: 
120: ;----------------------'Routines.h'   (for CD version)           ds un '.H' !!!!! ca c est sur !!!
121: 
122: ;extern void PlayAudio(DWORD Track);  fonction not used here! -> See NeoGeoCDSrc (Routines.s)/C.Doty sources Code : http://frogfeast.rastersoft.net/Source.html
123: ;  // Play audio
124: 
125: ;extern void StopAudio();  fonction not used here! -> See NeoGeoCDSrc (Routines.s)/C.Doty sources Code
126: ;  // Stop audio
127: 
128: extern void init_sound();
129:   // Init sound
130: 
131: extern void Play(BYTE CommandNo);
132:   // Play sound
133: 
134: #endif
135: 
136: 
137: ;==================================================================================================================================
138: 
139: ;----------------------'Defines.h'
140: #ifndef __DEFINES_H
141: #define __DEFINES_H
142: 
143: 
144: #define BYTE        unsigned char
145: #define WORD        unsigned short
146: #define DWORD       unsigned int
147: #define BOOL        unsigned int
148: #define PBYTE       BYTE *
149: 
150: 
151: #endif
152: 
153: ;-----------------------Includes\Defines.inc
154: 
155: * VRAM read/write address
156: REG_SOUND       = 0x320000      // In/Out Z80