summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox/arcade.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pacbox/arcade.c')
-rw-r--r--apps/plugins/pacbox/arcade.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index b8a0f105bb..ecf6d10af8 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -24,8 +24,10 @@
24 * 24 *
25 ****************************************************************************/ 25 ****************************************************************************/
26 26
27#include "pacbox.h"
27#include "arcade.h" 28#include "arcade.h"
28#include "hardware.h" 29#include "hardware.h"
30#include "wsg3.h"
29#include <string.h> 31#include <string.h>
30#include "plugin.h" 32#include "plugin.h"
31 33
@@ -92,6 +94,43 @@ enum {
92 FlipXY = 0x03 94 FlipXY = 0x03
93}; 95};
94 96
97// Namco 3-channel Wave Sound Generator wave data (8 waveforms with 32 4-bit entries each)
98static unsigned char default_sound_prom[] =
99{
100 0x07, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0D, 0x0E,
101 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0B, 0x0A, 0x09,
102 0x07, 0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x00,
103 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05,
104 0x07, 0x0C, 0x0E, 0x0E, 0x0D, 0x0B, 0x09, 0x0A,
105 0x0B, 0x0B, 0x0A, 0x09, 0x06, 0x04, 0x03, 0x05,
106 0x07, 0x09, 0x0B, 0x0A, 0x08, 0x05, 0x04, 0x03,
107 0x03, 0x04, 0x05, 0x03, 0x01, 0x00, 0x00, 0x02,
108 0x07, 0x0A, 0x0C, 0x0D, 0x0E, 0x0D, 0x0C, 0x0A,
109 0x07, 0x04, 0x02, 0x01, 0x00, 0x01, 0x02, 0x04,
110 0x07, 0x0B, 0x0D, 0x0E, 0x0D, 0x0B, 0x07, 0x03,
111 0x01, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x07, 0x00,
112 0x07, 0x0D, 0x0B, 0x08, 0x0B, 0x0D, 0x09, 0x06,
113 0x0B, 0x0E, 0x0C, 0x07, 0x09, 0x0A, 0x06, 0x02,
114 0x07, 0x0C, 0x08, 0x04, 0x05, 0x07, 0x02, 0x00,
115 0x03, 0x08, 0x05, 0x01, 0x03, 0x06, 0x03, 0x01,
116 0x00, 0x08, 0x0F, 0x07, 0x01, 0x08, 0x0E, 0x07,
117 0x02, 0x08, 0x0D, 0x07, 0x03, 0x08, 0x0C, 0x07,
118 0x04, 0x08, 0x0B, 0x07, 0x05, 0x08, 0x0A, 0x07,
119 0x06, 0x08, 0x09, 0x07, 0x07, 0x08, 0x08, 0x07,
120 0x07, 0x08, 0x06, 0x09, 0x05, 0x0A, 0x04, 0x0B,
121 0x03, 0x0C, 0x02, 0x0D, 0x01, 0x0E, 0x00, 0x0F,
122 0x00, 0x0F, 0x01, 0x0E, 0x02, 0x0D, 0x03, 0x0C,
123 0x04, 0x0B, 0x05, 0x0A, 0x06, 0x09, 0x07, 0x08,
124 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
125 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
126 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
127 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
128 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
129 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
130 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
131 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
132};
133
95/* Putting this in IRAM actually slows down the iPods, but is good for 134/* Putting this in IRAM actually slows down the iPods, but is good for
96 the Coldfire 135 the Coldfire
97*/ 136*/
@@ -110,6 +149,12 @@ void init_PacmanMachine(int dip)
110 z80_reset(); 149 z80_reset();
111 rb->memset( &ram_[0x4000], 0xFF, 0x1000 ); 150 rb->memset( &ram_[0x4000], 0xFF, 0x1000 );
112 151
152 /* Initialize the WSG3 */
153 wsg3_init(SoundClock);
154
155 /* Set the sound PROM to the default values for the original Namco chip */
156 wsg3_set_sound_prom(default_sound_prom);
157
113 /* Initialize parameters */ 158 /* Initialize parameters */
114 port1_ = 0xFF; 159 port1_ = 0xFF;
115 port2_ = 0xFF; 160 port2_ = 0xFF;
@@ -595,6 +640,19 @@ void renderSprites( unsigned char * buffer )
595 } 640 }
596} 641}
597 642
643void playSound( int * buf, int len )
644{
645 /* Clear the buffer */
646 memset( buf, 0, sizeof (int)*len);
647
648 /* Exit now if sound is disabled */
649 if( (output_devices_ & SoundEnabled) == 0 )
650 return;
651
652 /* Let the chip play the sound */
653 wsg3_play_sound( buf, len );
654}
655
598/* Enables/disables the speed hack. */ 656/* Enables/disables the speed hack. */
599int setSpeedHack( int enabled ) 657int setSpeedHack( int enabled )
600{ 658{