summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2007-12-18 08:09:03 +0000
committer Aaron Giles <aaron@aarongiles.com>2007-12-18 08:09:03 +0000
commit75265e5e230644374d5525ccacb729c13cc70ab5 (patch)
tree5a50921a8a20546a13ca2ca4a8494c6dd35d98f3 /src/emu
parent8a9ea25d7403de5d64ebc6265c00c971f632226f (diff)
Changes for MAME 0.122.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/cpu/m68000/m68k.h4
-rw-r--r--src/emu/cpu/m68000/m68k_in.c8
-rw-r--r--src/emu/cpu/m68000/m68kconf.h4
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c18
-rw-r--r--src/emu/cpu/m68000/m68kcpu.h20
-rw-r--r--src/emu/cpu/m68000/m68kdasm.c12
-rw-r--r--src/emu/cpu/m68000/m68kmake.c38
-rw-r--r--src/emu/cpu/m68000/m68kmame.c8
-rw-r--r--src/emu/cpu/mips/mdrc64.c4
-rw-r--r--src/emu/sndintrf.c4
-rw-r--r--src/emu/sndintrf.h1
-rw-r--r--src/emu/sound/m58817.c365
-rw-r--r--src/emu/sound/m58817.h24
-rw-r--r--src/emu/sound/scsp.c219
-rw-r--r--src/emu/sound/sound.mak12
15 files changed, 582 insertions, 159 deletions
diff --git a/src/emu/cpu/m68000/m68k.h b/src/emu/cpu/m68000/m68k.h
index b04bc518351..369adb5cc49 100644
--- a/src/emu/cpu/m68000/m68k.h
+++ b/src/emu/cpu/m68000/m68k.h
@@ -6,7 +6,7 @@
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -15,7 +15,7 @@
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
diff --git a/src/emu/cpu/m68000/m68k_in.c b/src/emu/cpu/m68000/m68k_in.c
index 79c957f4067..1ad3a4492e8 100644
--- a/src/emu/cpu/m68000/m68k_in.c
+++ b/src/emu/cpu/m68000/m68k_in.c
@@ -8,7 +8,7 @@ must fix:
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -17,7 +17,7 @@ must fix:
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
@@ -141,7 +141,7 @@ typedef struct
/* Opcode handler table */
-static opcode_handler_struct m68k_opcode_handler_table[] =
+static const opcode_handler_struct m68k_opcode_handler_table[] =
{
/* function mask match 000 010 020 040 */
@@ -157,7 +157,7 @@ M68KMAKE_TABLE_FOOTER
/* Build the opcode handler jump table */
void m68ki_build_opcode_table(void)
{
- opcode_handler_struct *ostruct;
+ const opcode_handler_struct *ostruct;
int instr;
int i;
int j;
diff --git a/src/emu/cpu/m68000/m68kconf.h b/src/emu/cpu/m68000/m68kconf.h
index 0ad15013557..d10f5872932 100644
--- a/src/emu/cpu/m68000/m68kconf.h
+++ b/src/emu/cpu/m68000/m68kconf.h
@@ -3,7 +3,7 @@
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -12,7 +12,7 @@
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index d8b278c772b..01fb35f1fbd 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -3,9 +3,9 @@
/* ======================================================================== */
#if 0
-static const char* copyright_notice =
+static const char copyright_notice[] =
"MUSASHI\n"
-"Version 3.31 (2007-07-09)\n"
+"Version 3.32 (2007-12-15)\n"
"A portable Motorola M680x0 processor emulation engine.\n"
"Copyright 1998-2007 Karl Stenerud. All rights reserved.\n"
"\n"
@@ -13,7 +13,7 @@ static const char* copyright_notice =
"copyright notice remains unaltered in the source code and any binary files\n"
"containing this code in compiled form.\n"
"\n"
-"All other lisencing terms must be negotiated with the author\n"
+"All other licensing terms must be negotiated with the author\n"
"(Karl Stenerud).\n"
"\n"
"The latest version of this code can be obtained at:\n"
@@ -49,7 +49,7 @@ uint m68ki_tracing = 0;
uint m68ki_address_space;
#ifdef M68K_LOG_ENABLE
-const char* m68ki_cpu_names[] =
+const char *const m68ki_cpu_names[] =
{
"Invalid CPU",
"M68000",
@@ -83,7 +83,7 @@ uint m68ki_aerr_write_mode;
uint m68ki_aerr_fc;
/* Used by shift & rotate instructions */
-uint8 m68ki_shift_8_table[65] =
+const uint8 m68ki_shift_8_table[65] =
{
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -92,7 +92,7 @@ uint8 m68ki_shift_8_table[65] =
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff
};
-uint16 m68ki_shift_16_table[65] =
+const uint16 m68ki_shift_16_table[65] =
{
0x0000, 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00,
0xff80, 0xffc0, 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff, 0xffff,
@@ -103,7 +103,7 @@ uint16 m68ki_shift_16_table[65] =
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff
};
-uint m68ki_shift_32_table[65] =
+const uint m68ki_shift_32_table[65] =
{
0x00000000, 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 0xf8000000,
0xfc000000, 0xfe000000, 0xff000000, 0xff800000, 0xffc00000, 0xffe00000,
@@ -122,7 +122,7 @@ uint m68ki_shift_32_table[65] =
/* Number of clock cycles to use for exception processing.
* I used 4 for any vectors that are undocumented for processing times.
*/
-uint8 m68ki_exception_cycle_table[4][256] =
+const uint8 m68ki_exception_cycle_table[4][256] =
{
{ /* 000 */
4, /* 0: Reset - Initial Stack Pointer */
@@ -418,7 +418,7 @@ uint8 m68ki_exception_cycle_table[4][256] =
}
};
-uint8 m68ki_ea_idx_cycle_table[64] =
+const uint8 m68ki_ea_idx_cycle_table[64] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, /* ..01.000 no memory indirect, base NULL */
diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h
index fe0a6ebfc5f..1af336a3407 100644
--- a/src/emu/cpu/m68000/m68kcpu.h
+++ b/src/emu/cpu/m68000/m68kcpu.h
@@ -4,7 +4,7 @@
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -13,7 +13,7 @@
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
@@ -591,7 +591,7 @@
#if M68K_LOG_ENABLE
#include <stdio.h>
extern FILE* M68K_LOG_FILEHANDLE
- extern char* m68ki_cpu_names[];
+ extern const char *const m68ki_cpu_names[];
#define M68K_DO_LOG(A) if(M68K_LOG_FILEHANDLE) fprintf A
#if M68K_LOG_1010_1111
@@ -893,8 +893,8 @@ typedef struct
uint cyc_movem_l;
uint cyc_shift;
uint cyc_reset;
- uint8* cyc_instruction;
- uint8* cyc_exception;
+ const uint8* cyc_instruction;
+ const uint8* cyc_exception;
/* Callbacks to host */
int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */
@@ -913,12 +913,12 @@ typedef struct
extern m68ki_cpu_core m68ki_cpu;
extern sint m68ki_remaining_cycles;
extern uint m68ki_tracing;
-extern uint8 m68ki_shift_8_table[];
-extern uint16 m68ki_shift_16_table[];
-extern uint m68ki_shift_32_table[];
-extern uint8 m68ki_exception_cycle_table[][256];
+extern const uint8 m68ki_shift_8_table[];
+extern const uint16 m68ki_shift_16_table[];
+extern const uint m68ki_shift_32_table[];
+extern const uint8 m68ki_exception_cycle_table[][256];
extern uint m68ki_address_space;
-extern uint8 m68ki_ea_idx_cycle_table[];
+extern const uint8 m68ki_ea_idx_cycle_table[];
extern uint m68ki_aerr_address;
extern uint m68ki_aerr_write_mode;
diff --git a/src/emu/cpu/m68000/m68kdasm.c b/src/emu/cpu/m68000/m68kdasm.c
index 148e11f6707..2c794c1c0d0 100644
--- a/src/emu/cpu/m68000/m68kdasm.c
+++ b/src/emu/cpu/m68000/m68kdasm.c
@@ -3,7 +3,7 @@
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -12,7 +12,7 @@
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
@@ -208,18 +208,18 @@ static const unsigned char* g_rawop;
static uint g_rawbasepc;
/* used by ops like asr, ror, addq, etc */
-static uint g_3bit_qdata_table[8] = {8, 1, 2, 3, 4, 5, 6, 7};
+static const uint g_3bit_qdata_table[8] = {8, 1, 2, 3, 4, 5, 6, 7};
-static uint g_5bit_data_table[32] =
+static const uint g_5bit_data_table[32] =
{
32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
};
-static const char* g_cc[16] =
+static const char *const g_cc[16] =
{"t", "f", "hi", "ls", "cc", "cs", "ne", "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le"};
-static const char* g_cpcc[64] =
+static const char *const g_cpcc[64] =
{/* 000 001 010 011 100 101 110 111 */
"f", "eq", "ogt", "oge", "olt", "ole", "ogl", "or", /* 000 */
"un", "ueq", "ugt", "uge", "ult", "ule", "ne", "t", /* 001 */
diff --git a/src/emu/cpu/m68000/m68kmake.c b/src/emu/cpu/m68000/m68kmake.c
index bf4fc741748..31b06daeedf 100644
--- a/src/emu/cpu/m68000/m68kmake.c
+++ b/src/emu/cpu/m68000/m68kmake.c
@@ -3,7 +3,7 @@
/* ======================================================================== */
/*
* MUSASHI
- * Version 3.31
+ * Version 3.32
*
* A portable Motorola M680x0 processor emulation engine.
* Copyright 1998-2007 Karl Stenerud. All rights reserved.
@@ -12,7 +12,7 @@
* copyright notice remains unaltered in the source code and any binary files
* containing this code in compiled form.
*
- * All other lisencing terms must be negotiated with the author
+ * All other licensing terms must be negotiated with the author
* (Karl Stenerud).
*
* The latest version of this code can be obtained at:
@@ -52,7 +52,7 @@
*/
-static const char* g_version = "3.31";
+static const char g_version[] = "3.32";
/* ======================================================================== */
/* =============================== INCLUDES =============================== */
@@ -227,7 +227,6 @@ int extract_opcode_info(char* src, char* name, int* size, char* spec_proc, char*
void add_replace_string(replace_struct* replace, const char* search_str, const char* replace_str);
void write_body(FILE* filep, body_struct* body, replace_struct* replace);
void get_base_name(char* base_name, opcode_struct* op);
-void write_prototype(FILE* filep, char* base_name);
void write_function_name(FILE* filep, char* base_name);
void add_opcode_output_table_entry(opcode_struct* op, char* name);
static int DECL_SPEC compare_nof_true_bits(const void* aptr, const void* bptr);
@@ -265,7 +264,7 @@ opcode_struct g_opcode_input_table[MAX_OPCODE_INPUT_TABLE_LENGTH];
opcode_struct g_opcode_output_table[MAX_OPCODE_OUTPUT_TABLE_LENGTH];
int g_opcode_output_table_length = 0;
-ea_info_struct g_ea_info_table[13] =
+const ea_info_struct g_ea_info_table[13] =
{/* fname ea mask match */
{"", "", 0x00, 0x00}, /* EA_MODE_NONE */
{"ai", "AY_AI", 0x38, 0x10}, /* EA_MODE_AI */
@@ -283,7 +282,7 @@ ea_info_struct g_ea_info_table[13] =
};
-const char* g_cc_table[16][2] =
+const char *const g_cc_table[16][2] =
{
{ "t", "T"}, /* 0000 */
{ "f", "F"}, /* 0001 */
@@ -304,7 +303,7 @@ const char* g_cc_table[16][2] =
};
/* size to index translator (0 -> 0, 8 and 16 -> 1, 32 -> 2) */
-int g_size_select_table[33] =
+const int g_size_select_table[33] =
{
0, /* unsized */
0, 0, 0, 0, 0, 0, 0, 1, /* 8 */
@@ -314,7 +313,7 @@ int g_size_select_table[33] =
/* Extra cycles required for certain EA modes */
/* TODO: correct timings for 040 */
-int g_ea_cycle_table[13][NUM_CPUS][3] =
+const int g_ea_cycle_table[13][NUM_CPUS][3] =
{/* 000 010 020 040 */
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}}, /* EA_MODE_NONE */
{{ 0, 4, 8}, { 0, 4, 8}, { 0, 4, 4}, { 0, 4, 4}}, /* EA_MODE_AI */
@@ -332,7 +331,7 @@ int g_ea_cycle_table[13][NUM_CPUS][3] =
};
/* Extra cycles for JMP instruction (000, 010) */
-int g_jmp_cycle_table[13] =
+const int g_jmp_cycle_table[13] =
{
0, /* EA_MODE_NONE */
4, /* EA_MODE_AI */
@@ -350,7 +349,7 @@ int g_jmp_cycle_table[13] =
};
/* Extra cycles for JSR instruction (000, 010) */
-int g_jsr_cycle_table[13] =
+const int g_jsr_cycle_table[13] =
{
0, /* EA_MODE_NONE */
4, /* EA_MODE_AI */
@@ -368,7 +367,7 @@ int g_jsr_cycle_table[13] =
};
/* Extra cycles for LEA instruction (000, 010) */
-int g_lea_cycle_table[13] =
+const int g_lea_cycle_table[13] =
{
0, /* EA_MODE_NONE */
4, /* EA_MODE_AI */
@@ -386,7 +385,7 @@ int g_lea_cycle_table[13] =
};
/* Extra cycles for PEA instruction (000, 010) */
-int g_pea_cycle_table[13] =
+const int g_pea_cycle_table[13] =
{
0, /* EA_MODE_NONE */
6, /* EA_MODE_AI */
@@ -404,7 +403,7 @@ int g_pea_cycle_table[13] =
};
/* Extra cycles for MOVEM instruction (000, 010) */
-int g_movem_cycle_table[13] =
+const int g_movem_cycle_table[13] =
{
0, /* EA_MODE_NONE */
0, /* EA_MODE_AI */
@@ -422,7 +421,7 @@ int g_movem_cycle_table[13] =
};
/* Extra cycles for MOVES instruction (010) */
-int g_moves_cycle_table[13][3] =
+const int g_moves_cycle_table[13][3] =
{
{ 0, 0, 0}, /* EA_MODE_NONE */
{ 0, 4, 6}, /* EA_MODE_AI */
@@ -440,7 +439,7 @@ int g_moves_cycle_table[13][3] =
};
/* Extra cycles for CLR instruction (010) */
-int g_clr_cycle_table[13][3] =
+const int g_clr_cycle_table[13][3] =
{
{ 0, 0, 0}, /* EA_MODE_NONE */
{ 0, 4, 6}, /* EA_MODE_AI */
@@ -778,16 +777,10 @@ void get_base_name(char* base_name, opcode_struct* op)
sprintf(base_name+strlen(base_name), "_%s", op->spec_ea);
}
-/* Write the prototype of an opcode handler function */
-void write_prototype(FILE* filep, char* base_name)
-{
- fprintf(filep, "void %s(void);\n", base_name);
-}
-
/* Write the name of an opcode handler function */
void write_function_name(FILE* filep, char* base_name)
{
- fprintf(filep, "void %s(void)\n", base_name);
+ fprintf(filep, "static void %s(void)\n", base_name);
}
void add_opcode_output_table_entry(opcode_struct* op, char* name)
@@ -870,7 +863,6 @@ void generate_opcode_handler(FILE* filep, body_struct* body, replace_struct* rep
/* Set the opcode structure and write the tables, prototypes, etc */
set_opcode_struct(opinfo, op, ea_mode);
get_base_name(str, op);
- write_prototype(g_prototype_file, str);
add_opcode_output_table_entry(op, str);
write_function_name(filep, str);
diff --git a/src/emu/cpu/m68000/m68kmame.c b/src/emu/cpu/m68000/m68kmame.c
index 84969ed6a88..d182b2c5ebd 100644
--- a/src/emu/cpu/m68000/m68kmame.c
+++ b/src/emu/cpu/m68000/m68kmame.c
@@ -580,7 +580,7 @@ void m68000_get_info(UINT32 state, cpuinfo *info)
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "68000"); break;
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Motorola 68K"); break;
- case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.31"); break;
+ case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.32"); break;
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright 1998-2007 Karl Stenerud. All rights reserved. (2.1 fixes HJB)"); break;
@@ -759,7 +759,7 @@ void m68008_get_info(UINT32 state, cpuinfo *info)
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "68008"); break;
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Motorola 68K"); break;
- case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.31"); break;
+ case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.32"); break;
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright 1998-2007 Karl Stenerud. All rights reserved. (2.1 fixes HJB)"); break;
@@ -999,7 +999,7 @@ void m68020_get_info(UINT32 state, cpuinfo *info)
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "68020"); break;
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Motorola 68K"); break;
- case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.31"); break;
+ case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.32"); break;
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright 1998-2007 Karl Stenerud. All rights reserved. (2.1 fixes HJB)"); break;
@@ -1240,7 +1240,7 @@ void m68040_get_info(UINT32 state, cpuinfo *info)
/* --- the following bits of info are returned as NULL-terminated strings --- */
case CPUINFO_STR_NAME: strcpy(info->s, "68040"); break;
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Motorola 68K"); break;
- case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.31"); break;
+ case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.32"); break;
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright 1998-2007 Karl Stenerud. All rights reserved. (2.1 fixes HJB)"); break;
diff --git a/src/emu/cpu/mips/mdrc64.c b/src/emu/cpu/mips/mdrc64.c
index 8d2d42ea1ee..81f304a20be 100644
--- a/src/emu/cpu/mips/mdrc64.c
+++ b/src/emu/cpu/mips/mdrc64.c
@@ -1165,7 +1165,7 @@ static void probe_printf(void)
static void exception_trap(void)
{
if ((mips3.core->cpr[0][COP0_Cause] & 0xff) != 0)
- printf("Exception: EPC=%08X Cause=%08X BadVAddr=%08X Jmp=%08X\n", mips3.core->cpr[0][COP0_EPC], mips3.core->cpr[0][COP0_Cause], mips3.core->cpr[0][COP0_BadVAddr], mips3.core->pc);
+ printf("Exception: EPC=%08X Cause=%08X BadVAddr=%08X Jmp=%08X\n", (UINT32)mips3.core->cpr[0][COP0_EPC], (UINT32)mips3.core->cpr[0][COP0_Cause], (UINT32)mips3.core->cpr[0][COP0_BadVAddr], mips3.core->pc);
}
@@ -2710,7 +2710,7 @@ static int compile_special(drc_core *drc, compiler_state *compiler, const opcode
{
UINT32 op = *desc->opptr.l;
UINT8 opswitch = op & 63;
- emit_link link1;
+ emit_link link1 = { 0 };
switch (opswitch)
{
diff --git a/src/emu/sndintrf.c b/src/emu/sndintrf.c
index 52f426c64a6..7532aacfd81 100644
--- a/src/emu/sndintrf.c
+++ b/src/emu/sndintrf.c
@@ -164,6 +164,7 @@ void sid6581_get_info(void *token, UINT32 state, sndinfo *info);
void sid8580_get_info(void *token, UINT32 state, sndinfo *info);
void sp0256_get_info(void *token, UINT32 state, sndinfo *info);
void s14001a_get_info(void *token, UINT32 state, sndinfo *info);
+void m58817_get_info(void *token, UINT32 state, sndinfo *info);
void filter_volume_get_info(void *token, UINT32 state, sndinfo *info);
void filter_rc_get_info(void *token, UINT32 state, sndinfo *info);
@@ -444,6 +445,9 @@ static const struct
#if (HAS_SP0256)
{ SOUND_SP0256, sp0256_get_info },
#endif
+#if (HAS_M58817)
+ { SOUND_M58817, m58817_get_info },
+#endif
{ SOUND_FILTER_VOLUME, filter_volume_get_info },
{ SOUND_FILTER_RC, filter_rc_get_info },
diff --git a/src/emu/sndintrf.h b/src/emu/sndintrf.h
index 746fa65ee57..67b5271642b 100644
--- a/src/emu/sndintrf.h
+++ b/src/emu/sndintrf.h
@@ -125,6 +125,7 @@ enum _sound_type
SOUND_SID8580,
SOUND_SP0256,
SOUND_S14001A,
+ SOUND_M58817,
/* filters start here */
SOUND_FILTER_VOLUME,
diff --git a/src/emu/sound/m58817.c b/src/emu/sound/m58817.c
new file mode 100644
index 00000000000..15b15f852e4
--- /dev/null
+++ b/src/emu/sound/m58817.c
@@ -0,0 +1,365 @@
+/******************************************************************************
+
+ M58817 interface
+
+ Written for MAME by couriersud
+
+ - structure from TMS5110 interface
+ - this is a wrapper around the TMS5110 interface
+ - M58817 & TMS5110 seem to be similar, however it is very probable
+ that they use different "coding" tables for energy, pitch
+ - Speech is understandable, but off
+ - This driver supports to use a "sample" interface instead as well
+
+******************************************************************************/
+
+#include <math.h>
+
+#include "sndintrf.h"
+#include "streams.h"
+#include "tms5110.h"
+#include "m58817.h"
+#include "sound/samples.h"
+
+
+#define MAX_SAMPLE_CHUNK 10000
+
+enum {
+ WAIT_CMD,
+ WAIT_WRITE,
+ WAIT_DONE1,
+ WAIT_DONE2
+} m58817_states;
+
+/* the state of the streamed output */
+struct m58817_info
+{
+ const struct M58817interface *intf;
+ sound_stream *stream;
+ void *chip;
+ UINT8 state;
+ UINT8 drq;
+ UINT8 nibbles[4];
+ UINT8 command_latch;
+ INT32 count;
+ INT32 address;
+ INT32 speech_rom_bitnum;
+};
+
+
+/* static function prototypes */
+static void m58817_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
+
+static int speech_rom_read_bit(void)
+{
+ struct m58817_info *info = sndti_token(SOUND_M58817, 0);
+ const UINT8 *table = memory_region(info->intf->rom_region);
+
+ int r;
+
+ if (info->speech_rom_bitnum<0)
+ r = 0;
+ else
+ r = (table[info->speech_rom_bitnum >> 3] >> (0x07 - (info->speech_rom_bitnum & 0x07))) & 1;
+ //r = (table[speech_rom_bitnum >> 3] >> ((speech_rom_bitnum & 0x07))) & 1;
+ info->speech_rom_bitnum++;
+ //printf("Byte: 0x%02x\n", speech_rom_bitnum>>3);
+ return r;
+}
+
+/******************************************************************************
+
+ m58817_state_loop -- process commands
+
+******************************************************************************/
+
+static void m58817_state_loop(void *chip, int data)
+{
+ struct m58817_info *info = chip;
+ int i;
+ switch (info->state)
+ {
+ case WAIT_CMD:
+ switch (data)
+ {
+ case 0x00: // reset ????
+ info->count=0;
+ /*To be extremely accurate there should be a delays between each of
+ the function calls below. In real they happen with the frequency of 160 kHz.
+ */
+
+ if (info->intf->rom_region != -1)
+ {
+ tms5110_CTL_set(info->chip, TMS5110_CMD_RESET);
+ tms5110_PDC_set(info->chip, 0);
+ tms5110_PDC_set(info->chip, 1);
+ tms5110_PDC_set(info->chip, 0);
+
+ tms5110_PDC_set(info->chip, 0);
+ tms5110_PDC_set(info->chip, 1);
+ tms5110_PDC_set(info->chip, 0);
+
+ tms5110_PDC_set(info->chip, 0);
+ tms5110_PDC_set(info->chip, 1);
+ tms5110_PDC_set(info->chip, 0);
+
+ info->speech_rom_bitnum = 0x0;
+ }
+ break;
+ case 0x02: // latch next nibbel
+ info->state=WAIT_WRITE;
+ break;
+ case 0x08: // play ????
+ info->state=WAIT_DONE1;
+ break;
+ default:
+ logerror("m58817: unknown cmd : 0x%02x\n", data);
+ }
+ break;
+ case WAIT_WRITE:
+ info->nibbles[info->count++] = data & 0x0f;
+ info->state=WAIT_CMD;
+ break;
+ case WAIT_DONE1:
+ if (data != 0x0A)
+ logerror("m58817: expected 0x0A got 0x%02x\n", data);
+ info->address = 0;
+ for (i=0;i<info->count;i++)
+ {
+ info->address |= (info->nibbles[i] << (i*4));
+ }
+ logerror("m58817: address: 0x%04x\n", info->address);
+
+
+ if (info->intf->rom_region != -1)
+ {
+ info->speech_rom_bitnum = info->address * 8 - 1;
+ tms5110_CTL_set(info->chip, TMS5110_CMD_SPEAK);
+ tms5110_PDC_set(info->chip, 0);
+ tms5110_PDC_set(info->chip, 1);
+ tms5110_PDC_set(info->chip, 0);
+ }
+ else
+ {
+ for (i=0;i<M58817_MAX_SAMPLES;i++)
+ if (info->intf->sample_addr[i] == info->address)
+ {
+ sample_start(0,i,0);
+ break;
+ }
+ }
+
+ info->state=WAIT_CMD;
+ break;
+ }
+}
+
+
+/******************************************************************************
+
+ m58817_start -- allocate buffers and reset the 5110
+
+******************************************************************************/
+
+static void *m58817_start(int sndindex, int clock, const void *config)
+{
+ static const struct M58817interface dummy = { 0 };
+ struct m58817_info *info;
+
+ info = auto_malloc(sizeof(*info));
+ memset(info, 0, sizeof(*info));
+ info->intf = config ? config : &dummy;
+
+ if (info->intf->rom_region != -1)
+ {
+ info->chip = tms5110_create(sndindex);
+ if (!info->chip)
+ return NULL;
+ }
+ sndintrf_register_token(info);
+
+ /* initialize a stream */
+ if (info->intf->rom_region != -1)
+ {
+ info->stream = stream_create(0, 1, clock / 80, info, m58817_update);
+ tms5110_set_M0_callback(info->chip, speech_rom_read_bit );
+ /* reset the 58817 */
+ tms5110_reset_chip(info->chip);
+ }
+
+ state_save_register_item("m58817", sndindex, info->state);
+ state_save_register_item("m58817", sndindex, info->drq);
+ state_save_register_item_array("m58817", sndindex, info->nibbles);
+ state_save_register_item("m58817", sndindex, info->count);
+ state_save_register_item("m58817", sndindex, info->address);
+ state_save_register_item("m58817", sndindex, info->speech_rom_bitnum);
+
+ /* request a sound channel */
+ return info;
+}
+
+
+
+/******************************************************************************
+
+ m58817_stop -- free buffers
+
+******************************************************************************/
+
+static void m58817_stop(void *chip)
+{
+ struct m58817_info *info = chip;
+ if (info->intf->rom_region != -1)
+ tms5110_destroy(info->chip);
+}
+
+
+static void m58817_reset(void *chip)
+{
+ struct m58817_info *info = chip;
+ if (info->intf->rom_region != -1)
+ tms5110_reset_chip(info->chip);
+ info->state = WAIT_CMD;
+ info->drq = 0;
+ info->command_latch = 0;
+ info->count=0;
+}
+
+
+
+/******************************************************************************
+
+ m58817_CTL_w -- write Control Command to the sound chip
+ commands like Speech, Reset, etc., are loaded into the chip via the CTL pins
+
+******************************************************************************/
+
+WRITE8_HANDLER( m58817_CTL_w )
+{
+ struct m58817_info *info = sndti_token(SOUND_M58817, 0);
+
+ /* bring up to date first */
+ //stream_update(info->stream);
+ info->command_latch = data & 0x0f;
+}
+
+/******************************************************************************
+
+ m58817_DRQ_w -- write to DRQ pin on the sound chip
+
+******************************************************************************/
+
+WRITE8_HANDLER( m58817_DRQ_w )
+{
+ struct m58817_info *info = sndti_token(SOUND_M58817, 0);
+
+ /* bring up to date first */
+ if (info->intf->rom_region != -1)
+ stream_update(info->stream);
+ if (!data & info->drq)
+ m58817_state_loop(info, info->command_latch);
+ info->drq = data;
+}
+
+
+
+/******************************************************************************
+
+ m58817_status_r -- read status from the sound chip
+
+******************************************************************************/
+
+READ8_HANDLER( m58817_status_r )
+{
+ struct m58817_info *info = sndti_token(SOUND_M58817, 0);
+
+ /* bring up to date first */
+ if (info->intf->rom_region != -1)
+ stream_update(info->stream);
+ if (info->intf->rom_region != -1)
+ return tms5110_status_read(info->chip);
+ else
+ return sample_playing(0);
+}
+
+
+
+/******************************************************************************
+
+ m58817_update -- update the sound chip so that it is in sync with CPU execution
+
+******************************************************************************/
+
+static void m58817_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
+{
+ struct m58817_info *info = param;
+ INT16 sample_data[MAX_SAMPLE_CHUNK];
+ stream_sample_t *buffer = _buffer[0];
+
+ /* loop while we still have samples to generate */
+ while (length)
+ {
+ int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
+ int index;
+
+ /* generate the samples and copy to the target buffer */
+ tms5110_process(info->chip, sample_data, samples);
+ for (index = 0; index < samples; index++)
+ *buffer++ = sample_data[index];
+
+ /* account for the samples */
+ length -= samples;
+ }
+}
+
+
+
+/******************************************************************************
+
+ m58817_set_frequency -- adjusts the playback frequency
+
+******************************************************************************/
+
+void m58817_set_frequency(int frequency)
+{
+ struct m58817_info *info = sndti_token(SOUND_M58817, 0);
+ stream_set_sample_rate(info->stream, frequency / 80);
+}
+
+
+
+
+/**************************************************************************
+ * Generic get_info
+ **************************************************************************/
+
+static void m58817_set_info(void *token, UINT32 state, sndinfo *info)
+{
+ switch (state)
+ {
+ /* no parameters to set */
+ }
+}
+
+
+void m58817_get_info(void *token, UINT32 state, sndinfo *info)
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case SNDINFO_PTR_SET_INFO: info->set_info = m58817_set_info; break;
+ case SNDINFO_PTR_START: info->start = m58817_start; break;
+ case SNDINFO_PTR_STOP: info->stop = m58817_stop; break;
+ case SNDINFO_PTR_RESET: info->reset = m58817_reset; break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case SNDINFO_STR_NAME: info->s = "M58817"; break;
+ case SNDINFO_STR_CORE_FAMILY: info->s = "Mitsubishi Speech"; break;
+ case SNDINFO_STR_CORE_VERSION: info->s = "1.0"; break;
+ case SNDINFO_STR_CORE_FILE: info->s = __FILE__; break;
+ case SNDINFO_STR_CORE_CREDITS: info->s = "Copyright (c) 2007, The MAME Team"; break;
+ }
+}
+
diff --git a/src/emu/sound/m58817.h b/src/emu/sound/m58817.h
new file mode 100644
index 00000000000..7374f2d03ef
--- /dev/null
+++ b/src/emu/sound/m58817.h
@@ -0,0 +1,24 @@
+#ifndef m58817_h
+#define m58817_h
+
+/* clock rate = 80 * output sample rate, */
+/* usually 640000 for 8000 Hz sample rate or */
+/* usually 800000 for 10000 Hz sample rate. */
+
+#define M58817_MAX_SAMPLES 20
+
+struct M58817interface
+{
+ int rom_region; /* set to -1 to use samples */
+ int sample_addr[M58817_MAX_SAMPLES];
+};
+
+WRITE8_HANDLER( m58817_CTL_w );
+WRITE8_HANDLER( m58817_DRQ_w );
+
+READ8_HANDLER( m58817_status_r );
+
+void m58817_set_frequency(int frequency);
+
+#endif
+
diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c
index 542c53a448a..ed26a1b7217 100644
--- a/src/emu/sound/scsp.c
+++ b/src/emu/sound/scsp.c
@@ -2,14 +2,12 @@
Sega/Yamaha YMF292-F (SCSP = Saturn Custom Sound Processor) emulation
By ElSemi
MAME/M1 conversion and cleanup by R. Belmont
+ Additional code and bugfixes by kingshriek
This chip has 32 voices. Each voice can play a sample or be part of
an FM construct. Unlike traditional Yamaha FM chips, the base waveform
for the FM still comes from the wavetable RAM.
- Unsupported:
- - FM mode (VF3 uses it, Hanagumi might late in the title song...)
-
ChangeLog:
* November 25, 2003 (ES) Fixed buggy timers and envelope overflows.
(RB) Improved sample rates other than 44100, multiple
@@ -20,8 +18,10 @@
* January 8, 2005 (RB) Added ability to specify region offset for RAM.
* January 26, 2007 (ES) Added on-board DSP capability
* September 24, 2007 (RB+ES) Removed fake reverb. Rewrote timers and IRQ handling.
- Fixed case where voice frequency is updated while looping.
- Enabled DSP again.
+ Fixed case where voice frequency is updated while looping.
+ Enabled DSP again.
+ * December 16, 2007 (kingshriek) Many EG bug fixes, implemented effects mixer,
+ implemented FM.
*/
#include <math.h>
@@ -76,7 +76,7 @@
#define SDIR(slot) ((slot->udata.data[0x6]>>0x0)&0x0100)
#define TL(slot) ((slot->udata.data[0x6]>>0x0)&0x00FF)
-#define MDL(slot) ((slot->udata.data[0x7]>>0xB)&0x0007)
+#define MDL(slot) ((slot->udata.data[0x7]>>0xC)&0x000F)
#define MDXSL(slot) ((slot->udata.data[0x7]>>0x6)&0x003F)
#define MDYSL(slot) ((slot->udata.data[0x7]>>0x0)&0x003F)
@@ -138,6 +138,7 @@ struct _SLOT
UINT8 active; //this slot is currently playing
UINT8 *base; //samples base address
UINT32 cur_addr; //current play address (24.8)
+ UINT32 nxt_addr; //next play address
UINT32 step; //pitch step (24.8)
struct _EG EG; //Envelope
struct _LFO PLFO; //Phase LFO
@@ -375,7 +376,7 @@ static void Compute_EG(struct _SCSP *SCSP,struct _SLOT *slot)
int rate;
if(octave&8) octave=octave-16;
if(KRS(slot)!=0xf)
- rate=2*(octave+KRS(slot))+((FNS(slot)>>9)&1);
+ rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
else
rate=0; //rate=((FNS(slot)>>9)&1);
@@ -443,7 +444,7 @@ static int EG_Update(struct _SLOT *slot)
static UINT32 SCSP_Step(struct _SLOT *slot)
{
int octave=OCT(slot);
- int Fn;
+ UINT64 Fn;
Fn=(FNS_Table[FNS(slot)]); //24.8
if(octave&8)
@@ -470,7 +471,8 @@ static void SCSP_StartSlot(struct _SCSP *SCSP, struct _SLOT *slot)
slot->active=1;
start_offset = PCM8B(slot) ? SA(slot) : SA(slot) & 0x7FFFE;
slot->base=SCSP->SCSPRAM + start_offset;
- slot->cur_addr=0;
+ slot->cur_addr=0;
+ slot->nxt_addr=1<<SHIFT;
slot->step=SCSP_Step(slot);
Compute_EG(SCSP,slot);
slot->EG.state=ATTACK;
@@ -1158,7 +1160,9 @@ INLINE INT32 SCSP_UpdateSlot(struct _SCSP *SCSP, struct _SLOT *slot)
{
INT32 sample;
int step=slot->step;
- UINT32 addr;
+ UINT32 addr1,addr2,addr_select; // current and next sample addresses
+ UINT32 *addr[2] = {&addr1, &addr2}; // used for linear interpolation
+ UINT32 *slot_addr[2] = {&(slot->cur_addr), &(slot->nxt_addr)}; //
if(SSCTL(slot)!=0) //no FM or noise yet
return 0;
@@ -1169,50 +1173,58 @@ INLINE INT32 SCSP_UpdateSlot(struct _SCSP *SCSP, struct _SLOT *slot)
step>>=SHIFT;
}
- if(PCM8B(slot))
- addr=slot->cur_addr>>SHIFT;
- else
- addr=(slot->cur_addr>>(SHIFT-1)) & 0x7fffe;
-/*
- if(MDL(slot)!=0 || MDXSL(slot)!=0 || MDYSL(slot)!=0)
- {
- INT32 smp;
- smp=(SCSP->RINGBUF[(SCSP->BUFPTR+MDXSL(slot))&63]+SCSP->RINGBUF[(SCSP->BUFPTR+MDYSL(slot))&63])/2;
-
- smp>>=11;
- addr+=smp;
- if(!PCM8B(slot))
- addr&=0x7fffe;
- else
- addr&=0x7ffff;
- }
-*/
- if(addr==LSA(slot))
+ if(PCM8B(slot))
{
- if(LPSLNK(slot) && slot->EG.state==ATTACK)
- slot->EG.state = DECAY1;
+ addr1=slot->cur_addr>>SHIFT;
+ addr2=slot->nxt_addr>>SHIFT;
}
-
- if(PCM8B(slot)) //8 bit signed
- {
- INT8 *p=(INT8 *) (slot->base+BYTE_XOR_BE((slot->cur_addr>>SHIFT)));
- INT32 s;
- INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
- s=(int) (p[0]<<8)*((1<<SHIFT)-fpart)+(int) slot->Prev*fpart;
- sample=(s>>SHIFT);
- slot->Prev=p[0]<<8;
-
- }
- else //16 bit signed
+ else
+ {
+ addr1=(slot->cur_addr>>(SHIFT-1))&0x7fffe;
+ addr2=(slot->nxt_addr>>(SHIFT-1))&0x7fffe;
+ }
+
+ /*if(MDL(slot)!=0 || MDXSL(slot)!=0 || MDYSL(slot)!=0)
{
- INT16 *p=(INT16 *) (slot->base+addr);
- INT32 s;
- INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
- s=(int) (p[0])*((1<<SHIFT)-fpart)+(int) slot->Prev*fpart;
- sample=(s>>SHIFT);
- slot->Prev=p[0];
-
- }
+ INT32 smp=(SCSP->RINGBUF[(SCSP->BUFPTR+MDXSL(slot))&63]+SCSP->RINGBUF[(SCSP->BUFPTR+MDYSL(slot))&63])/2;
+ INT32 cycle=LEA(slot)-LSA(slot); // cycle corresponds to 2 pi
+
+ smp*=cycle; // associate cycle with full 16-bit sample range
+ smp>>=0x1A-MDL(slot); // ex. for MDL=0xF, sample range corresponds to +/- 64 pi (32=2^5 cycles) so shift by 11 (16-5 == 0x1A-0xF)
+ while(smp<0) smp+=cycle; smp%=cycle; // keep modulation sampler within a single cycle
+ if(!PCM8B(slot)) smp<<=1;
+
+ addr1+=smp; addr2+=smp;
+ if(!PCM8B(slot))
+ {
+ addr1&=0x7fffe; addr2&=0x7fffe;
+ }
+ else
+ {
+ addr1&=0x7ffff; addr2&=0x7ffff;
+ }
+ }*/
+
+ if(PCM8B(slot)) //8 bit signed
+ {
+ INT8 *p1=(signed char *) (SCSP->SCSPRAM+((SA(slot)+addr1)^1));
+ INT8 *p2=(signed char *) (SCSP->SCSPRAM+((SA(slot)+addr2)^1));
+ //sample=(p[0])<<8;
+ INT32 s;
+ INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
+ s=(int) (p1[0]<<8)*((1<<SHIFT)-fpart)+(int) (p2[0]<<8)*fpart;
+ sample=(s>>SHIFT);
+ }
+ else //16 bit signed (endianness?)
+ {
+ INT16 *p1=(signed short *) (slot->base+addr1);
+ INT16 *p2=(signed short *) (slot->base+addr2);
+ //sample=LE16(p[0]);
+ INT32 s;
+ INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
+ s=(int) (p1[0])*((1<<SHIFT)-fpart)+(int) (p2[0])*fpart;
+ sample=(s>>SHIFT);
+ }
if(SBCTL(slot)&0x1)
sample ^= 0x7FFF;
@@ -1222,58 +1234,71 @@ INLINE INT32 SCSP_UpdateSlot(struct _SCSP *SCSP, struct _SLOT *slot)
if(slot->Backwards)
slot->cur_addr-=step;
else
- slot->cur_addr+=step;
- addr=slot->cur_addr>>SHIFT;
- switch(LPCTL(slot))
+ slot->cur_addr+=step;
+ slot->nxt_addr=slot->cur_addr+(1<<SHIFT);
+
+ addr1=slot->cur_addr>>SHIFT;
+ addr2=slot->nxt_addr>>SHIFT;
+
+ if(addr1>=LSA(slot) && !(slot->Backwards))
{
- case 0: //no loop
- if(addr>=LEA(slot))
- {
- //slot->active=0;
- SCSP_StopSlot(slot,0);
- }
- break;
- case 1: //normal loop
- if(addr>=LEA(slot))
- slot->cur_addr=LSA(slot)<<SHIFT;
- break;
- case 2: //reverse loop
- if(addr>=LEA(slot))
- {
- slot->cur_addr=LEA(slot)<<SHIFT;
- slot->Backwards=1;
- }
- if(addr<LSA(slot) || (addr&0x80000000))
- slot->cur_addr=LEA(slot)<<SHIFT;
- break;
- case 3: //ping-pong
- if(addr>=LEA(slot)) //reached end, reverse till start
- {
- slot->cur_addr=LEA(slot)<<SHIFT;
- slot->Backwards=1;
- }
- if((addr<LSA(slot) || (addr&0x80000000)) && (slot->Backwards))//reached start or negative
- {
- slot->cur_addr=LSA(slot)<<SHIFT;
- slot->Backwards=0;
- }
- break;
+ if(LPSLNK(slot) && slot->EG.state==ATTACK)
+ slot->EG.state = DECAY1;
}
+ for (addr_select=0;addr_select<2;addr_select++)
+ {
+ switch(LPCTL(slot))
+ {
+ case 0: //no loop
+ if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=LEA(slot))
+ {
+ //slot->active=0;
+ SCSP_StopSlot(slot,0);
+ }
+ break;
+ case 1: //normal loop
+ if(*addr[addr_select]>=LEA(slot))
+ *slot_addr[addr_select]=LSA(slot)<<SHIFT;
+ break;
+ case 2: //reverse loop
+ if((*addr[addr_select]>=LSA(slot)) && !(slot->Backwards))
+ {
+ *slot_addr[addr_select]=LEA(slot)<<SHIFT;
+ slot->Backwards=1;
+ }
+ if((*addr[addr_select]<=LSA(slot) || (*slot_addr[addr_select]&0x80000000)) && slot->Backwards)
+ *slot_addr[addr_select]=LEA(slot)<<SHIFT;
+ break;
+ case 3: //ping-pong
+ if(*addr[addr_select]>=LEA(slot)) //reached end, reverse till start
+ {
+ *slot_addr[addr_select]=LEA(slot)<<SHIFT;
+ slot->Backwards=1;
+ }
+ if((*addr[addr_select]<=LSA(slot) || (*slot_addr[addr_select]&0x80000000)) && slot->Backwards)//reached start or negative
+ {
+ *slot_addr[addr_select]=LSA(slot)<<SHIFT;
+ slot->Backwards=0;
+ }
+ break;
+ }
+ }
+
if(ALFOS(slot)!=0)
{
sample=sample*ALFO_Step(&(slot->ALFO));
sample>>=SHIFT;
}
- if(!STWINH(slot))
- *RBUFDST=sample;
-
if(slot->EG.state==ATTACK)
sample=(sample*EG_Update(slot))>>SHIFT;
else
sample=(sample*EG_TABLE[EG_Update(slot)>>(SHIFT-10)])>>SHIFT;
+ if(!STWINH(slot))
+ *RBUFDST=sample;
+
return sample;
}
@@ -1293,27 +1318,27 @@ static void SCSP_DoMasterSamples(struct _SCSP *SCSP, int nsamples)
for(sl=0;sl<32;++sl)
{
+ RBUFDST=SCSP->RINGBUF+SCSP->BUFPTR;
if(SCSP->Slots[sl].active)
{
struct _SLOT *slot=SCSP->Slots+sl;
unsigned short Enc;
signed int sample;
- RBUFDST=SCSP->RINGBUF+SCSP->BUFPTR;
sample=SCSP_UpdateSlot(SCSP, slot);
- ++SCSP->BUFPTR;
- SCSP->BUFPTR&=63;
+
#ifdef USEDSP
- Enc=((TL(slot))<<0x0)|((IMXL(slot))<<0xd);
- SCSPDSP_SetSample(&SCSP->DSP,(sample*SCSP->LPANTABLE[Enc])>>SHIFT,ISEL(slot),IMXL(slot));
+ Enc=((TL(slot))<<0x0)|((IMXL(slot))<<0xd);
+ SCSPDSP_SetSample(&SCSP->DSP,(sample*SCSP->LPANTABLE[Enc])>>(SHIFT-2),ISEL(slot),IMXL(slot));
#endif
Enc=((TL(slot))<<0x0)|((DIPAN(slot))<<0x8)|((DISDL(slot))<<0xd);
{
- smpl+=(sample*SCSP->LPANTABLE[Enc])>>SHIFT;
- smpr+=(sample*SCSP->RPANTABLE[Enc])>>SHIFT;
+ smpl+=(sample*SCSP->LPANTABLE[Enc])>>SHIFT;
+ smpr+=(sample*SCSP->RPANTABLE[Enc])>>SHIFT;
}
}
-
+ --SCSP->BUFPTR;
+ SCSP->BUFPTR&=63;
}
SCSPDSP_Step(&SCSP->DSP);
diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak
index 34b8a47b642..28928e7e702 100644
--- a/src/emu/sound/sound.mak
+++ b/src/emu/sound/sound.mak
@@ -594,6 +594,18 @@ endif
#-------------------------------------------------
+# Mitsubishi M58817 speech synthesizer
+#-------------------------------------------------
+
+SOUNDDEFS += -DHAS_M58817=$(if $(filter M58817,$(SOUNDS)),1,0)
+
+ifneq ($(filter M58817,$(SOUNDS)),)
+SOUNDOBJS += $(SOUNDOBJ)/m58817.o
+endif
+
+
+
+#-------------------------------------------------
# VLM5030 speech synthesizer
#-------------------------------------------------