part 3 (nw)

This commit is contained in:
David Haywood 2013-11-08 16:04:45 +00:00
parent ec40506c6a
commit fa74638458
6 changed files with 236 additions and 228 deletions

View File

@ -94,28 +94,9 @@ void igs025_device::device_reset()
}
void igs025_device::killbld_protection_calculate_hilo()
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = m_kb_source_data[m_drgw2_protection_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1)
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);
}
}
/****************************************/
/* WRITE */
/****************************************/
WRITE16_MEMBER(igs025_device::killbld_igs025_prot_w )
{
@ -176,78 +157,6 @@ WRITE16_MEMBER(igs025_device::killbld_igs025_prot_w )
}
}
READ16_MEMBER(igs025_device::killbld_igs025_prot_r )
{
if (offset)
{
switch (m_kb_cmd)
{
case 0x00:
return BITSWAP8((m_kb_swap+1) & 0x7f, 0,1,2,3,4,5,6,7); // drgw3
case 0x01:
return m_kb_reg & 0x7f;
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
default: // >= 5
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5,2,9,7,10,13,12,15);
}
return 0;
}
case 0x40:
killbld_protection_calculate_hilo();
return 0; // Read and then discarded
// default:
// logerror("%06X: ASIC25 R CMD %X\n", space.device().safe_pc(), m_kb_cmd);
}
}
return 0;
}
/* todo, collapse this all into above */
void igs025_device::olds_protection_calculate_hilo() // calculated in routine $12dbc2 in olds
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = olds_source_data[m_drgw2_protection_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1) // $8178fa
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8); // $8178d8
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0); // $8178d8
}
}
WRITE16_MEMBER(igs025_device::olds_w )
{
if (offset == 0)
@ -296,124 +205,10 @@ WRITE16_MEMBER(igs025_device::olds_w )
}
}
READ16_MEMBER(igs025_device::olds_r )
{
if (offset)
{
switch (m_kb_cmd)
{
case 0x01:
return m_kb_reg & 0x7f;
case 0x02:
return m_olds_bs | 0x80;
case 0x03:
return m_kb_cmd3;
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
case 5:
default: // >= 5
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5,2,9,7,10,13,12,15); // $817906
}
}
case 0x40:
olds_protection_calculate_hilo();
return 0; // unused?
}
}
return 0;
}
void igs025_device::drgw2_protection_calculate_hilo()
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = m_drgw2_source_data[m_drgw2_protection_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1)
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);
}
}
READ16_MEMBER(igs025_device::drgw2_d80000_protection_r )
{
switch (m_kb_cmd)
{
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
case 5:
default:
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5,2,9,7,10,13,12,15);
}
return 0x3f00;
}
case 0x40:
drgw2_protection_calculate_hilo();
return 0;
// case 0x13: // Read to $80eeb8
// case 0x1f: // Read to $80eeb8
// case 0xf4: // Read to $80eeb8
// case 0xf6: // Read to $80eeb8
// case 0xf8: // Read to $80eeb8
// return 0;
// default:
// logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_kb_cmd);
}
return 0;
}
WRITE16_MEMBER(igs025_device::drgw2_d80000_protection_w )
{
@ -454,6 +249,155 @@ WRITE16_MEMBER(igs025_device::drgw2_d80000_protection_w )
}
}
/****************************************/
/* READ */
/****************************************/
READ16_MEMBER(igs025_device::killbld_igs025_prot_r)
{
if (offset)
{
switch (m_kb_cmd)
{
case 0x00:
return BITSWAP8((m_kb_swap + 1) & 0x7f, 0, 1, 2, 3, 4, 5, 6, 7); // drgw3
case 0x01:
return m_kb_reg & 0x7f;
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
default: // >= 5
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
}
return 0;
}
case 0x40:
killbld_protection_calculate_hilo();
return 0; // Read and then discarded
// default:
// logerror("%06X: ASIC25 R CMD %X\n", space.device().safe_pc(), m_kb_cmd);
}
}
return 0;
}
READ16_MEMBER(igs025_device::olds_r)
{
if (offset)
{
switch (m_kb_cmd)
{
case 0x01:
return m_kb_reg & 0x7f;
case 0x02:
return m_olds_bs | 0x80;
case 0x03:
return m_kb_cmd3;
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
case 5:
default: // >= 5
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15); // $817906
}
}
case 0x40:
olds_protection_calculate_hilo();
return 0; // unused?
}
}
return 0;
}
READ16_MEMBER(igs025_device::drgw2_d80000_protection_r)
{
switch (m_kb_cmd)
{
case 0x05:
{
switch (m_kb_ptr)
{
case 1:
return 0x3f00 | ((m_kb_game_id >> 0) & 0xff);
case 2:
return 0x3f00 | ((m_kb_game_id >> 8) & 0xff);
case 3:
return 0x3f00 | ((m_kb_game_id >> 16) & 0xff);
case 4:
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
case 5:
default:
return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
}
return 0x3f00;
}
case 0x40:
drgw2_protection_calculate_hilo();
return 0;
// case 0x13: // Read to $80eeb8
// case 0x1f: // Read to $80eeb8
// case 0xf4: // Read to $80eeb8
// case 0xf6: // Read to $80eeb8
// case 0xf8: // Read to $80eeb8
// return 0;
// default:
// logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_kb_cmd);
}
return 0;
}
void igs025_device::drgw2_protection_calculate_hold(int y, int z)
@ -504,5 +448,72 @@ void igs025_device::killbld_protection_calculate_hold(int y, int z)
void igs025_device::killbld_protection_calculate_hilo()
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = m_kb_source_data[m_kb_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1)
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);
}
}
void igs025_device::drgw2_protection_calculate_hilo()
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = m_kb_source_data[m_kb_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1)
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8);
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0);
}
}
void igs025_device::olds_protection_calculate_hilo() // calculated in routine $12dbc2 in olds
{
UINT8 source;
m_kb_prot_hilo_select++;
if (m_kb_prot_hilo_select > 0xeb) {
m_kb_prot_hilo_select = 0;
}
source = m_kb_source_data[m_kb_region][m_kb_prot_hilo_select];
if (m_kb_prot_hilo_select & 1) // $8178fa
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0x00ff) | (source << 8); // $8178d8
}
else
{
m_kb_prot_hilo = (m_kb_prot_hilo & 0xff00) | (source << 0); // $8178d8
}
}
const device_type IGS025 = &device_creator<igs025_device>;

View File

@ -17,8 +17,9 @@ public:
DECLARE_READ16_MEMBER( killbld_igs025_prot_r );
// use setters instead of making public?
const UINT8 (*m_kb_source_data)[0xec];
INT32 m_kb_source_data_offset;
UINT32 m_kb_game_id;
UINT32 m_kb_region;
igs025_execute_external m_execute_external;
static void set_external_cb(device_t &device,igs025_execute_external newcb);
@ -27,12 +28,10 @@ public:
DECLARE_READ16_MEMBER( olds_r );
DECLARE_WRITE16_MEMBER( olds_w );
//const UINT8 *m_kb_prot_hilo_source2;
const UINT8 (*olds_source_data)[0xec];
DECLARE_READ16_MEMBER( drgw2_d80000_protection_r );
DECLARE_WRITE16_MEMBER( drgw2_d80000_protection_w );
UINT32 m_drgw2_protection_region;
const UINT8 (*m_drgw2_source_data)[0xec];
protected:
virtual void device_config_complete();

View File

@ -115,7 +115,7 @@ void pgm_012_025_state::drgw2_common_init()
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd80000, 0xd80003, read16_delegate(FUNC(igs025_device::drgw2_d80000_protection_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::drgw2_d80000_protection_w), (igs025_device*)m_igs025));
m_igs025->m_drgw2_source_data = drgw2_source_data;
m_igs025->m_kb_source_data = drgw2_source_data;
pgm_basic_init();
pgm_drgw2_decrypt();
@ -150,7 +150,7 @@ DRIVER_INIT_MEMBER(pgm_012_025_state,drgw2)
drgw2_common_init();
int region = 0x06;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = region | (region << 8) | (region << 16) | (region << 24);
mem16[0x131098 / 2] = 0x4e93;
@ -165,7 +165,7 @@ DRIVER_INIT_MEMBER(pgm_012_025_state,dw2v100x)
drgw2_common_init();
int region = 0x06;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = region | (region << 8) | (region << 16) | (region << 24);
mem16[0x131084 / 2] = 0x4e93;
@ -180,7 +180,7 @@ DRIVER_INIT_MEMBER(pgm_012_025_state,drgw2c)
drgw2_common_init();
int region = 0x05;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = region | (region << 8) | (region << 16) | (region << 24);
mem16[0x1303bc / 2] = 0x4e93;
@ -195,7 +195,7 @@ DRIVER_INIT_MEMBER(pgm_012_025_state,drgw2j)
drgw2_common_init();
int region = 0x01;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = region | (region << 8) | (region << 16) | (region << 24);
mem16[0x1302c0 / 2] = 0x4e93;

View File

@ -314,7 +314,7 @@ MACHINE_RESET_MEMBER(pgm_022_025_state,killbld)
{
int region = (ioport(":Region")->read()) & 0xff;
m_igs025->m_drgw2_protection_region = region - 0x16;
m_igs025->m_kb_region = region - 0x16;
m_igs025->m_kb_game_id = 0x89911400 | region;
MACHINE_RESET_CALL_MEMBER(pgm);
@ -324,7 +324,7 @@ MACHINE_RESET_MEMBER(pgm_022_025_state, dw3)
{
int region = (ioport(":Region")->read()) & 0xff;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = 0x00060000 | region;
MACHINE_RESET_CALL_MEMBER(pgm);
@ -350,7 +350,6 @@ DRIVER_INIT_MEMBER(pgm_022_025_state,killbld)
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd40000, 0xd40003, read16_delegate(FUNC(igs025_device::killbld_igs025_prot_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::killbld_igs025_prot_w), (igs025_device*)m_igs025));
m_igs022->m_sharedprotram = m_sharedprotram;
m_igs025->m_kb_source_data = killbld_source_data;
m_igs025->m_kb_source_data_offset = 0x16;
}
DRIVER_INIT_MEMBER(pgm_022_025_state,drgw3)
@ -362,7 +361,6 @@ DRIVER_INIT_MEMBER(pgm_022_025_state,drgw3)
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xda5610, 0xda5613, read16_delegate(FUNC(igs025_device::killbld_igs025_prot_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::killbld_igs025_prot_w), (igs025_device*)m_igs025));
m_igs022->m_sharedprotram = m_sharedprotram;
m_igs025->m_kb_source_data = dw3_source_data;
m_igs025->m_kb_source_data_offset = 0;
}

View File

@ -23,7 +23,7 @@
// tables are xored by table at $1998dc
// tables are the same as drgw3 and drgw2
static const UINT8 olds_source_data[8][0xec] = // table addresses $2951CA
static const UINT8 m_olds_source_data[8][0xec] = // table addresses $2951CA
{
{ // region 0, unused...
0,
@ -153,7 +153,7 @@ MACHINE_RESET_MEMBER(pgm_028_025_state,olds)
{
int region = (ioport(":Region")->read()) & 0xff;
m_igs025->m_drgw2_protection_region = region;
m_igs025->m_kb_region = region;
m_igs025->m_kb_game_id = 0x00900000 | region;
MACHINE_RESET_CALL_MEMBER(pgm);
@ -165,7 +165,7 @@ DRIVER_INIT_MEMBER(pgm_028_025_state,olds)
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xdcb400, 0xdcb403, read16_delegate(FUNC(igs025_device::olds_r), (igs025_device*)m_igs025), write16_delegate(FUNC(igs025_device::olds_w), (igs025_device*)m_igs025));
m_igs028->m_sharedprotram = m_sharedprotram;
m_igs025->olds_source_data = olds_source_data;
m_igs025->m_kb_source_data = m_olds_source_data;
}

View File

@ -169,12 +169,12 @@ MACHINE_CONFIG_END
void pgm_arm_type3_state::svg_basic_init()
{
pgm_basic_init();
m_svg_shareram[0] = auto_alloc_array(machine(), UINT32, 0x10000 / 4);
m_svg_shareram[1] = auto_alloc_array(machine(), UINT32, 0x10000 / 4);
m_svg_shareram[0] = auto_alloc_array(machine(), UINT32, 0x20000 / 4);
m_svg_shareram[1] = auto_alloc_array(machine(), UINT32, 0x20000 / 4);
m_svg_ram_sel = 0;
save_pointer(NAME(m_svg_shareram[0]), 0x10000 / 4);
save_pointer(NAME(m_svg_shareram[1]), 0x10000 / 4);
save_pointer(NAME(m_svg_shareram[0]), 0x20000 / 4);
save_pointer(NAME(m_svg_shareram[1]), 0x20000 / 4);
save_item(NAME(m_svg_ram_sel));
}