summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Nicola Salmoria <nicola@mamedev.org>2010-07-05 21:08:18 +0000
committer Nicola Salmoria <nicola@mamedev.org>2010-07-05 21:08:18 +0000
commitdf7626380520189ecc6a2a2cd22ba8181d47a15a (patch)
tree0edfd32eafb00e36045e9eda172d8f84b5e7b86e /src
parentde67a76a60b854010b9397a3e396eb001aed4297 (diff)
317-5000 decryption (same as 315-5177). Reorganised decryption code.
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/segas16a.c11
-rw-r--r--src/mame/machine/segacrp2.c361
2 files changed, 147 insertions, 225 deletions
diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c
index 112005df5fd..26a56c6c416 100644
--- a/src/mame/drivers/segas16a.c
+++ b/src/mame/drivers/segas16a.c
@@ -149,6 +149,7 @@ Tetris - - - - EPR12169 EPR12170 -
#include "cpu/mcs51/mcs51.h"
#include "includes/segas16.h"
#include "machine/8255ppi.h"
+#include "machine/segacrp2.h"
#include "machine/fd1089.h"
#include "machine/i8243.h"
#include "cpu/mcs48/mcs48.h"
@@ -3453,6 +3454,14 @@ static DRIVER_INIT( quartet )
}
+static DRIVER_INIT( fantzonep )
+{
+ system16a_generic_init(machine);
+
+ sega_315_5177_decode(machine, "soundcpu");
+}
+
+
static DRIVER_INIT( sdi )
{
segas1x_state *state = (segas1x_state *)machine->driver_data;
@@ -3500,7 +3509,7 @@ GAME( 1986, alexkidd, 0, system16a, alexkidd, generic_16a, ROT
GAME( 1986, alexkidd1, alexkidd, system16a, alexkidd, fd1089a_16a, ROT0, "Sega", "Alex Kidd: The Lost Stars (set 1, FD1089A 317-0021)", GAME_SUPPORTS_SAVE )
GAME( 1986, fantzone, 0, system16a_no7751, fantzone, generic_16a, ROT0, "Sega", "Fantasy Zone (Rev A, unprotected)", GAME_SUPPORTS_SAVE )
GAME( 1986, fantzone1, fantzone, system16a_no7751, fantzone, generic_16a, ROT0, "Sega", "Fantasy Zone (unprotected)", GAME_SUPPORTS_SAVE )
-GAME( 1986, fantzonep, fantzone, system16a_no7751, fantzone, generic_16a, ROT0, "Sega", "Fantasy Zone (317-5000)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND )
+GAME( 1986, fantzonep, fantzone, system16a_no7751, fantzone, fantzonep, ROT0, "Sega", "Fantasy Zone (317-5000)", GAME_SUPPORTS_SAVE )
GAME( 1988, passsht16a, passsht, system16a, passsht16a, passsht16a, ROT270, "Sega", "Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071)", GAME_SUPPORTS_SAVE )
GAME( 1987, sdi, 0, system16a_no7751, sdi, sdi, ROT0, "Sega", "SDI - Strategic Defense Initiative (Japan, old, System 16A, FD1089B 317-0027)", GAME_SUPPORTS_SAVE )
GAME( 1987, shinobi, 0, system16a, shinobi, generic_16a, ROT0, "Sega", "Shinobi (set 6, System 16A, unprotected)", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/machine/segacrp2.c b/src/mame/machine/segacrp2.c
index 0fc35c5eff6..82aa0e0607a 100644
--- a/src/mame/machine/segacrp2.c
+++ b/src/mame/machine/segacrp2.c
@@ -29,7 +29,7 @@
Wonder Boy (set 1)
315-5178 Wonder Boy (set 2) unencrypted version available
315-5179 Robo-Wrestle 2001
-
+ 317-5000 Fantasy Zone (Sound CPU) same key as 315-5177
The following games seem to use the same algorithm as the above ones, but
using a key which almost doesn't change
@@ -45,20 +45,8 @@
#include "segacrp2.h"
-/******************************************************************************
-
- New encryption
-
- This encryption is quite different from the older one. It permutates bits
- D0, D2, D4 and D6, then inverts some of them.
-
- The permutation and inversion depend on A0, A3, A6, A9, A12, and A14.
-
-******************************************************************************/
-
static void sega_decode_2(running_machine *machine,const char *cputag,
- const UINT8 opcode_xor[64],const int opcode_swap_select[64],
- const UINT8 data_xor[64],const int data_swap_select[64])
+ const UINT8 xor_table[128],const int swap_table[128])
{
int A;
static const UINT8 swaptable[24][4] =
@@ -93,12 +81,12 @@ static void sega_decode_2(running_machine *machine,const char *cputag,
+ (((A >> 9) & 1) << 3) + (((A >> 12) & 1) << 4) + (((A >> 14) & 1) << 5);
/* decode the opcodes */
- tbl = swaptable[opcode_swap_select[row]];
- decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row];
+ tbl = swaptable[swap_table[2*row]];
+ decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row];
/* decode the data */
- tbl = swaptable[data_swap_select[row]];
- rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row];
+ tbl = swaptable[swap_table[2*row+1]];
+ rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1];
}
}
@@ -106,212 +94,160 @@ static void sega_decode_2(running_machine *machine,const char *cputag,
void sega_315_5162_decode(running_machine *machine, const char *cputag)
{
- static const UINT8 opcode_xor[64] =
- {
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- 0x40,0x50,0x44,0x54,0x41,0x51,0x45,0x55,
- };
-
- static const UINT8 data_xor[64] =
+ static const UINT8 xor_table[128] =
{
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
- 0x10,0x04,0x14,0x01,0x11,0x05,0x15,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
+ 0x40,0x10,0x50,0x04,0x44,0x14,0x54,0x01,0x41,0x11,0x51,0x05,0x45,0x15,0x55,0x00,
};
- static const int opcode_swap_select[64] =
+ static const int swap_table[128] =
{
- 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,
- 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,
- };
-
- static const int data_swap_select[64] =
- {
- 4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,
- 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
12,
};
- sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,xor_table,swap_table);
}
void sega_315_5177_decode(running_machine *machine, const char *cputag)
{
- static const UINT8 opcode_xor[64] =
- {
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45,
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45,
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45,
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,0x41,0x00,0x54,0x45,
- 0x04,0x51,0x40,0x01,0x55,0x44,0x05,0x50,
- };
-
- static const UINT8 data_xor[64] =
+ static const UINT8 xor_table[128] =
{
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40,
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40,
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40,
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,0x45,0x50,0x11,0x40,
- 0x54,0x15,0x44,0x51,0x10,0x41,0x55,0x14,
- };
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,
- static const int opcode_swap_select[64] =
- {
- 0,0,1,1,1,2,2,3,3,4,4,4,5,5,6,6,
- 6,7,7,8,8,9,9,9,10,10,11,11,11,12,12,13,
-
- 8,8,9,9,9,10,10,11,11,12,12,12,13,13,14,14,
- 14,15,15,16,16,17,17,17,18,18,19,19,19,20,20,21,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,0x41,0x45,0x00,0x50,0x54,0x11,0x45,0x40,
+ 0x04,0x54,0x51,0x15,0x40,0x44,0x01,0x51,0x55,0x10,0x44,0x41,0x05,0x55,0x50,0x14,
};
- static const int data_swap_select[64] =
+ static const int swap_table[128] =
{
- 0,0,1,1,2,2,2,3,3,4,4,5,5,5,6,6,
- 7,7,7,8,8,9,9,10,10,10,11,11,12,12,12,13,
-
- 8,8,9,9,10,10,10,11,11,12,12,13,13,13,14,14,
- 15,15,15,16,16,17,17,18,18,18,19,19,20,20,20,21,
+ 0,0,0,0,
+ 1,1,1,1,1,
+ 2,2,2,2,2,
+ 3,3,3,3,
+ 4,4,4,4,4,
+ 5,5,5,5,5,
+ 6,6,6,6,6,
+ 7,7,7,7,7,
+ 8,8,8,8,
+ 9,9,9,9,9,
+ 10,10,10,10,10,
+ 11,11,11,11,11,
+ 12,12,12,12,12,
+ 13,13,
+
+ 8,8,8,8,
+ 9,9,9,9,9,
+ 10,10,10,10,10,
+ 11,11,11,11,
+ 12,12,12,12,12,
+ 13,13,13,13,13,
+ 14,14,14,14,14,
+ 15,15,15,15,15,
+ 16,16,16,16,
+ 17,17,17,17,17,
+ 18,18,18,18,18,
+ 19,19,19,19,19,
+ 20,20,20,20,20,
+ 21,21,
};
- sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,xor_table,swap_table);
}
void sega_315_5178_decode(running_machine *machine, const char *cputag)
{
- static const UINT8 opcode_xor[64] =
+ static const UINT8 xor_table[128] =
{
- 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51,
- 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50,
- 0x00,0x45,0x11,0x01,
- 0x00,0x45,0x11,0x01,0x44,0x10,0x55,0x05,0x41,0x14,0x04,0x40,0x15,0x51,
- 0x01,0x44,0x10,0x00,0x45,0x11,0x54,0x04,0x40,0x15,0x05,0x41,0x14,0x50,
- 0x00,0x45,0x11,0x01,
- };
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,0x40,0x55,0x15,0x05,0x51,0x11,
+ 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,0x41,0x54,0x14,0x04,0x50,0x10,
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
- static const UINT8 data_xor[64] =
- {
- 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11,
- 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10,
- 0x55,0x05,0x41,0x14,
- 0x55,0x05,0x41,0x14,0x50,0x00,0x15,0x51,0x01,0x44,0x10,0x55,0x05,0x11,
- 0x54,0x04,0x40,0x15,0x51,0x01,0x14,0x50,0x00,0x45,0x11,0x54,0x04,0x10,
- 0x55,0x05,0x41,0x14,
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,0x44,0x50,0x10,0x00,0x55,0x15,0x05,0x51,0x41,0x01,0x14,0x44,0x04,0x10,0x40,0x55,0x15,0x05,0x51,0x11,
+ 0x01,0x54,0x44,0x04,0x10,0x40,0x00,0x15,0x45,0x51,0x11,0x01,0x54,0x14,0x04,0x50,0x40,0x00,0x15,0x45,0x05,0x11,0x41,0x54,0x14,0x04,0x50,0x10,
+ 0x00,0x55,0x45,0x05,0x11,0x41,0x01,0x14,
};
- static const int opcode_swap_select[64] =
+ static const int swap_table[128] =
{
- 2,
- 5,1,5,1,5,
- 0,4,0,4,0,4,
- 7,3,7,3,7,3,
- 6,2,6,2,6,
- 1,5,1,5,1,5,
- 0,4,0,
+ 2,
+ 3, 5, 7, 1, 3, 5, 7, 1, 3, 5, 7,
+ 0, 2, 4, 6, 0, 2, 4, 6, 0, 2, 4,
+ 5, 7, 1, 3, 5, 7, 1, 3, 5, 7, 1, 3,
+ 4, 6, 0, 2, 4, 6, 0, 2, 4, 6,
+ 8,
+ 1, 3, 5, 7, 1, 3, 5, 7, 1, 3, 5,
+ 6, 0, 2, 4, 6, 0, 2,
10,
- 13,9,13,9,13,
- 8,12,8,12,8,12,
- 15,11,15,11,15,11,
- 14,10,14,10,14,
- 9,13,9,13,9,13,
- 8,12,8,
- };
-
- static const int data_swap_select[64] =
- {
- 3,7,3,7,3,7,
- 2,6,2,6,2,
- 5,1,5,1,5,1,
- 4,0,4,0,4,
- 8,
- 3,7,3,7,3,
- 6,2,6,2,
-
- 11,15,11,15,11,15,
- 10,14,10,14,10,
- 13,9,13,9,13,9,
- 12,8,12,8,12,
+ 11,13,15, 9,11,13,15, 9,11,13,15,
+ 8,10,12,14, 8,10,12,14, 8,10,12,
+ 13,15, 9,11,13,15, 9,11,13,15, 9,11,
+ 12,14, 8,10,12,14, 8,10,12,14,
16,
- 11,15,11,15,11,
- 14,10,14,10,
+ 9,11,13,15, 9,11,13,15, 9,11,13,
+ 14, 8,10,12,14, 8,10,
};
- sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,xor_table,swap_table);
}
void sega_315_5179_decode(running_machine *machine, const char *cputag)
{
- static const UINT8 opcode_xor[64] =
- {
- 0x00,0x41,0x10,0x51,0x04,0x45,0x14, 0x00,0x41,0x10,0x51,0x04,0x45,0x14, 0x55,
- 0x01,0x40,0x11,0x50,0x05,0x44,0x15, 0x01,0x40,0x11,0x50,0x05,0x44,0x15, 0x54,
- 0x00,0x41,
- 0x50,0x05,0x44,0x15,0x54,0x00,0x41, 0x50,0x05,0x44,0x15,0x54,0x00,0x41, 0x10,
- 0x51,0x04,0x45,0x14,0x55,0x01,0x40, 0x51,0x04,0x45,0x14,0x55,0x01,0x40, 0x11,
- 0x50,0x05
- };
-
- static const UINT8 data_xor[64] =
- {
- 0x45,0x14,0x55,0x01,0x40,0x11,0x50, 0x05,0x44,0x15,0x54,0x00,0x41,0x10, 0x05,
- 0x44,0x15,0x54,0x00,0x41,0x10,0x51, 0x04,0x45,0x14,0x55,0x01,0x40,0x11, 0x04,
- 0x45,0x14,
- 0x00,0x41,0x10,0x51,0x04,0x45,0x14, 0x55,0x01,0x40,0x11,0x50,0x05,0x44, 0x55,
- 0x01,0x40,0x11,0x50,0x05,0x44,0x15, 0x54,0x00,0x41,0x10,0x51,0x04,0x45, 0x54,
- 0x00,0x41
- };
-
- static const int opcode_swap_select[64] =
+ static const UINT8 xor_table[128] =
{
- 8,11,15,2,6,
- 9,13,1,4,8,11,15,2,6,
- 9,13,1,4,8,11,15,2,6,
- 10,13,1,4,8,11,15,3,6,
-
- 7,2,6,1,5,
- 1,4,0,3,7,2,6,2,5,
- 1,4,0,3,7,2,6,2,5,
- 1,4,0,3,7,3,6,2,5,
+ 0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50,0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,
+ 0x00,0x45,0x41,0x14,0x10,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x50,0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x01,0x04,
+ 0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,0x04,0x00,0x45,0x41,0x14,
+ 0x50,0x00,0x05,0x41,0x44,0x10,0x15,0x51,0x54,0x04,0x00,0x45,0x41,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x11,0x54,
+ 0x50,0x00,0x05,0x41,0x44,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x14,0x50,0x55,0x05,0x01,0x44,0x40,0x15,0x51,0x54,
+ 0x04,0x00,0x45,0x41,0x14,0x10,0x55,0x51,0x01,0x04,0x40,0x45,0x11,0x54,0x50,0x00,0x05,0x41,
};
- static const int data_swap_select[64] =
+ static const int swap_table[128] =
{
- 9,13,0,4,8,11,15,2,6,
- 9,13,1,4,8,11,15,2,6,
- 10,13,1,4,8,11,15,2,6,
- 10,13,1,4,8,
-
- 1,4,0,3,7,2,6,1,5,
- 1,4,0,3,7,2,6,2,5,
- 1,4,0,3,7,3,6,2,5,
- 1,4,0,4,7,
+ 8, 9,11,13,15, 0, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8, 9,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 2, 4, 6,
+ 8,10,11,13,15, 1, 3, 4, 6,
+ 8,
+ 7, 1, 2, 4, 6, 0, 1, 3, 5,
+ 7, 1, 2, 4, 6, 0, 1, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 2, 4, 6, 0, 2, 3, 5,
+ 7, 1, 3, 4, 6, 0, 2, 3, 5,
+ 7, 1, 3, 4, 6, 0, 2, 4, 5,
+ 7,
};
- sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,xor_table,swap_table);
}
@@ -322,61 +258,38 @@ void sega_315_5179_decode(running_machine *machine, const char *cputag)
******************************************************************************/
-static void sega_decode_317(running_machine *machine, const char *cputag, int order, int opcode_shift, int data_shift)
+static void sega_decode_317(running_machine *machine, const char *cputag, int shift)
{
- static const UINT8 xor1_317[1+64] =
- {
- 0x54,
- 0x14,0x15,0x41,0x14,0x50,0x55,0x05,0x41,0x01,0x10,0x51,0x05,0x11,0x05,0x14,0x55,
- 0x41,0x05,0x04,0x41,0x14,0x10,0x45,0x50,0x00,0x45,0x00,0x00,0x00,0x45,0x00,0x00,
- 0x54,0x04,0x15,0x10,0x04,0x05,0x11,0x44,0x04,0x01,0x05,0x00,0x44,0x15,0x40,0x45,
- 0x10,0x15,0x51,0x50,0x00,0x15,0x51,0x44,0x15,0x04,0x44,0x44,0x50,0x10,0x04,0x04,
- };
-
- static const UINT8 xor2_317[2+64] =
- {
- 0x04,
- 0x44,
- 0x15,0x51,0x41,0x10,0x15,0x54,0x04,0x51,0x05,0x55,0x05,0x54,0x45,0x04,0x10,0x01,
- 0x51,0x55,0x45,0x55,0x45,0x04,0x55,0x40,0x11,0x15,0x01,0x40,0x01,0x11,0x45,0x44,
- 0x40,0x05,0x15,0x15,0x01,0x50,0x00,0x44,0x04,0x50,0x51,0x45,0x50,0x54,0x41,0x40,
- 0x14,0x40,0x50,0x45,0x10,0x05,0x50,0x01,0x40,0x01,0x50,0x50,0x50,0x44,0x40,0x10,
- };
-
- static const int swap1_317[1+64] =
+ static const UINT8 xor_table[128+3] =
{
- 7,
- 1,11,23,17,23, 0,15,19,
- 20,12,10, 0,18,18, 5,20,
- 13, 0,18,14, 5, 6,10,21,
- 1,11, 9, 3,21, 4, 1,17,
- 5, 7,16,13,19,23,20, 2,
- 10,23,23,15,10,12, 0,22,
- 14, 6,15,11,17,15,21, 0,
- 6, 1, 1,18, 5,15,15,20,
+ 0x04,0x54,0x44,0x14,0x15,0x15,0x51,0x41,0x41,0x14,0x10,0x50,0x15,0x55,0x54,0x05,
+ 0x04,0x41,0x51,0x01,0x05,0x10,0x55,0x51,0x05,0x05,0x54,0x11,0x45,0x05,0x04,0x14,
+ 0x10,0x55,0x01,0x41,0x51,0x05,0x55,0x04,0x45,0x41,0x55,0x14,0x45,0x10,0x04,0x45,
+ 0x55,0x50,0x40,0x00,0x11,0x45,0x15,0x00,0x01,0x00,0x40,0x00,0x01,0x45,0x11,0x00,
+ 0x45,0x00,0x44,0x54,0x40,0x04,0x05,0x15,0x15,0x10,0x15,0x04,0x01,0x05,0x50,0x11,
+ 0x00,0x44,0x44,0x04,0x04,0x01,0x50,0x05,0x51,0x00,0x45,0x44,0x50,0x15,0x54,0x40,
+ 0x41,0x45,0x40,0x10,0x14,0x15,0x40,0x51,0x50,0x50,0x45,0x00,0x10,0x15,0x05,0x51,
+ 0x50,0x44,0x01,0x15,0x40,0x04,0x01,0x44,0x50,0x44,0x50,0x50,0x50,0x10,0x44,0x04,
+ 0x40,0x04,0x10,
};
- static const int swap2_317[2+64] =
+ static const int swap_table[128+3] =
{
- 7,
- 12,
- 18, 8,21, 0,22,21,13,21,
- 20,13,20,14, 6, 3, 5,20,
- 8,20, 4, 8,17,22, 0, 0,
- 6,17,17, 9, 0,16,13,21,
- 3, 2,18, 6,11, 3, 3,18,
- 18,19, 3, 0, 5, 0,11, 8,
- 8, 1, 7, 2,10, 8,10, 2,
- 1, 3,12,16, 0,17,10, 1,
+ 7, 7,12, 1,18,11, 8,23,21,17, 0,23,22, 0,21,15,
+ 13,19,21,20,20,12,13,10,20, 0,14,18, 6,18, 3, 5,
+ 5,20,20,13, 8, 0,20,18, 4,14, 8, 5,17, 6,22,10,
+ 0,21, 0, 1, 6,11,17, 9,17, 3, 9,21, 0, 4,16, 1,
+ 13,17,21, 5, 3, 7, 2,16,18,13, 6,19,11,23, 3,20,
+ 3, 2,18,10,18,23,19,23, 3,15, 0,10, 5,12, 0, 0,
+ 11,22, 8,14, 8, 6, 1,15, 7,11, 2,17,10,15, 8,21,
+ 10, 0, 2, 6, 1, 1, 3, 1,12,18,16, 5, 0,15,17,15,
+ 10,20, 1,
};
- if (order)
- sega_decode_2( machine, cputag, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift );
- else
- sega_decode_2( machine, cputag, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift );
+ sega_decode_2( machine, cputag, xor_table + shift, swap_table + shift );
}
-void sega_317_0004_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 1, 0, 0 ); }
-void sega_317_0005_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 0, 0, 1 ); }
-void sega_317_0006_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 1, 1, 1 ); }
-void sega_317_0007_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 0, 1, 2 ); }
+void sega_317_0004_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 0 ); }
+void sega_317_0005_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 1 ); }
+void sega_317_0006_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 2 ); }
+void sega_317_0007_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 3 ); }