@@ -327,31 +327,44 @@ void zaxxon_state::int_enable_w(int state)
327327
328328void zaxxon_state::machine_start ()
329329{
330- /* register for save states */
330+ // register for save states
331331 save_item (NAME (m_int_enabled));
332332 save_item (NAME (m_coin_status));
333333}
334334
335335
336+ void razmataz_state::machine_start ()
337+ {
338+ zaxxon_state::machine_start ();
339+
340+ // additional state saving
341+ save_item (NAME (m_razmataz_dial_pos));
342+ save_item (NAME (m_razmataz_counter));
343+ }
344+
345+
336346
337347/* ************************************
338348 *
339349 * Input handlers
340350 *
341351 *************************************/
342352
343- uint8_t zaxxon_state ::razmataz_counter_r ()
353+ uint8_t razmataz_state ::razmataz_counter_r ()
344354{
345355 /* this behavior is really unknown; however, the code is using this */
346356 /* counter as a sort of timeout when talking to the sound board */
347357 /* it needs to be increasing at a reasonable rate but not too fast */
348358 /* or else the sound will mess up */
349- return m_razmataz_counter++ >> 8 ;
359+ uint8_t const result = m_razmataz_counter >> 8 ;
360+ if (!machine ().side_effects_disabled ())
361+ ++m_razmataz_counter;
362+ return result;
350363}
351364
352365
353366template <int Num>
354- ioport_value zaxxon_state ::razmataz_dial_r ()
367+ ioport_value razmataz_state ::razmataz_dial_r ()
355368{
356369 int res;
357370
@@ -459,11 +472,11 @@ void zaxxon_state::decrypted_opcodes_map(address_map &map)
459472}
460473
461474/* derived from Zaxxon, different sound hardware */
462- void zaxxon_state ::ixion_map (address_map &map)
475+ void razmataz_state ::ixion_map (address_map &map)
463476{
464477 map (0x0000 , 0x5fff ).rom ();
465478 map (0x6000 , 0x6fff ).ram ();
466- map (0x8000 , 0x83ff ).mirror (0x1c00 ).ram ().w (FUNC (zaxxon_state ::zaxxon_videoram_w)).share (" videoram" );
479+ map (0x8000 , 0x83ff ).mirror (0x1c00 ).ram ().w (FUNC (razmataz_state ::zaxxon_videoram_w)).share (" videoram" );
467480 map (0xa000 , 0xa0ff ).mirror (0x1f00 ).ram ().share (" spriteram" );
468481 map (0xc000 , 0xc000 ).mirror (0x18fc ).portr (" SW00" );
469482 map (0xc001 , 0xc001 ).mirror (0x18fc ).portr (" SW01" );
@@ -472,7 +485,20 @@ void zaxxon_state::ixion_map(address_map &map)
472485 map (0xc100 , 0xc100 ).mirror (0x18ff ).portr (" SW100" );
473486 map (0xc000 , 0xc007 ).mirror (0x18f8 ).w (" mainlatch1" , FUNC (ls259_device::write_d0));
474487 map (0xe03c , 0xe03c ).mirror (0x1f00 ).rw (" usbsnd" , FUNC (usb_sound_device::status_r), FUNC (usb_sound_device::data_w));
475- map (0xe0f0 , 0xe0f3 ).mirror (0x1f00 ).select (0x0008 ).w (FUNC (zaxxon_state::zaxxon_control_w));
488+ map (0xe0f0 , 0xe0f3 ).mirror (0x1f00 ).select (0x0008 ).w (FUNC (razmataz_state::zaxxon_control_w));
489+ }
490+
491+ void razmataz_state::razmataz_map (address_map &map)
492+ {
493+ ixion_map (map);
494+
495+ // additional input ports are wired
496+ map (0xc004 , 0xc004 ).mirror (0x18f3 ).portr (" SW04" );
497+ map (0xc008 , 0xc008 ).mirror (0x18f3 ).portr (" SW08" );
498+ map (0xc00c , 0xc00c ).mirror (0x18f3 ).portr (" SW0C" );
499+
500+ // unknown behavior expected here
501+ map (0xc80a , 0xc80a ).r (FUNC (razmataz_state::razmataz_counter_r));
476502}
477503
478504
@@ -697,7 +723,7 @@ INPUT_PORTS_END
697723
698724static INPUT_PORTS_START( razmataz )
699725 PORT_START(" SW00" )
700- PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (zaxxon_state ::razmataz_dial_r<0 >))
726+ PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (razmataz_state ::razmataz_dial_r<0 >))
701727
702728 PORT_START(" DIAL.0" )
703729 PORT_BIT( 0xff , 0x00 , IPT_DIAL ) PORT_SENSITIVITY(30 ) PORT_KEYDELTA(15 ) PORT_RESET PORT_PLAYER(1 )
@@ -712,7 +738,7 @@ static INPUT_PORTS_START( razmataz )
712738 PORT_BIT( 0xc0 , IP_ACTIVE_HIGH , IPT_UNUSED )
713739
714740 PORT_START(" SW08" )
715- PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (zaxxon_state ::razmataz_dial_r<1 >))
741+ PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (razmataz_state ::razmataz_dial_r<1 >))
716742
717743 PORT_START(" DIAL.1" )
718744 PORT_BIT( 0xff , 0x00 , IPT_DIAL ) PORT_SENSITIVITY(30 ) PORT_KEYDELTA(15 ) PORT_RESET PORT_PLAYER(2 )
@@ -790,7 +816,7 @@ static INPUT_PORTS_START( ixion )
790816 PORT_INCLUDE(zaxxon)
791817
792818 PORT_MODIFY(" SW00" )
793- PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (zaxxon_state ::razmataz_dial_r<0 >))
819+ PORT_BIT( 0xff , 0x00 , IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC (razmataz_state ::razmataz_dial_r<0 >))
794820
795821 PORT_START(" DIAL.0" )
796822 PORT_BIT( 0xff , 0x00 , IPT_DIAL ) PORT_SENSITIVITY(30 ) PORT_KEYDELTA(15 ) PORT_CODE_DEC(KEYCODE_Z ) PORT_CODE_INC(KEYCODE_X ) PORT_RESET
@@ -1002,33 +1028,35 @@ void zaxxon_state::futspye(machine_config &config)
10021028}
10031029
10041030
1005- void zaxxon_state ::razmataze (machine_config &config)
1031+ void razmataz_state ::razmataze (machine_config &config)
10061032{
10071033 root (config);
1034+
10081035 sega_315_5098_device &maincpu (SEGA_315_5098 (config.replace (), m_maincpu, MASTER_CLOCK /16 ));
1009- maincpu.set_addrmap (AS_PROGRAM , &zaxxon_state::ixion_map );
1010- maincpu.set_addrmap (AS_OPCODES , &zaxxon_state ::decrypted_opcodes_map);
1036+ maincpu.set_addrmap (AS_PROGRAM , &razmataz_state::razmataz_map );
1037+ maincpu.set_addrmap (AS_OPCODES , &razmataz_state ::decrypted_opcodes_map);
10111038 maincpu.set_decrypted_tag (" :decrypted_opcodes" );
10121039 maincpu.set_size (0x6000 );
10131040
10141041 config.device_remove (" ppi8255" );
10151042
10161043 /* video hardware */
1017- MCFG_VIDEO_START_OVERRIDE (zaxxon_state ,razmataz)
1018- subdevice<screen_device>(" screen" )->set_screen_update (FUNC (zaxxon_state ::screen_update_razmataz));
1044+ MCFG_VIDEO_START_OVERRIDE (razmataz_state ,razmataz)
1045+ subdevice<screen_device>(" screen" )->set_screen_update (FUNC (razmataz_state ::screen_update_razmataz));
10191046
10201047 /* sound hardware */
10211048 SPEAKER (config, " speaker" ).front_center ();
10221049 SEGAUSBROM (config, " usbsnd" , 0 , m_maincpu).add_route (ALL_OUTPUTS , " speaker" , 1.0 );
10231050}
10241051
10251052
1026- void zaxxon_state ::ixion (machine_config &config)
1053+ void razmataz_state ::ixion (machine_config &config)
10271054{
10281055 root (config);
1056+
10291057 sega_315_5013_device &maincpu (SEGA_315_5013 (config.replace (), m_maincpu, MASTER_CLOCK /16 ));
1030- maincpu.set_addrmap (AS_PROGRAM , &zaxxon_state ::ixion_map);
1031- maincpu.set_addrmap (AS_OPCODES , &zaxxon_state ::decrypted_opcodes_map);
1058+ maincpu.set_addrmap (AS_PROGRAM , &razmataz_state ::ixion_map);
1059+ maincpu.set_addrmap (AS_OPCODES , &razmataz_state ::decrypted_opcodes_map);
10321060 maincpu.set_decrypted_tag (" :decrypted_opcodes" );
10331061 maincpu.set_size (0x6000 );
10341062
@@ -1037,7 +1065,7 @@ void zaxxon_state::ixion(machine_config &config)
10371065 m_mainlatch[0 ]->q_out_cb <6 >().set_nop (); // flip screen not used
10381066
10391067 /* video hardware */
1040- subdevice<screen_device>(" screen" )->set_screen_update (FUNC (zaxxon_state ::screen_update_ixion));
1068+ subdevice<screen_device>(" screen" )->set_screen_update (FUNC (razmataz_state ::screen_update_ixion));
10411069
10421070 /* sound hardware */
10431071 SPEAKER (config, " speaker" ).front_center ();
@@ -1566,73 +1594,51 @@ void zaxxon_state::init_zaxxonj()
15661594
15671595 for (int A = 0x0000 ; A < 0x6000 ; A++)
15681596 {
1569- uint8_t src = rom[A];
1597+ const uint8_t src = rom[A];
15701598
1571- /* pick the translation table from bit 0 of the address */
1572- int i = A & 1 ;
1599+ // pick the translation table from bit 0 of the address
1600+ const int i = A & 1 ;
15731601
1574- /* pick the offset in the table from bits 1, 3 and 5 of the source data */
1575- int j = ((src >> 1 ) & 1 ) + (((src >> 3 ) & 1 ) << 1 ) + (((src >> 5 ) & 1 ) << 2 );
1576- /* the bottom half of the translation table is the mirror image of the top */
1577- if (src & 0x80 ) j = 7 - j;
1602+ // pick the offset in the table from bits 1, 3 and 5 of the source data
1603+ // the bottom half of the translation table is the mirror image of the top
1604+ const int j = bitswap<3 >(BIT (src, 7 ) ? ~src : src, 5 , 3 , 1 );
15781605
1579- /* decode the ROM data */
1606+ // decode the ROM data
15801607 rom[A] = src ^ data_xortable[i][j];
15811608
1582- /* now decode the opcodes */
1583- /* pick the translation table from bits 0, 4, and 8 of the address */
1584- i = ((A >> 0 ) & 1 ) + (((A >> 4 ) & 1 ) << 1 ) + (((A >> 8 ) & 1 ) << 2 );
1585- m_decrypted_opcodes[A] = src ^ opcode_xortable[i ][j];
1609+ // now decode the opcodes
1610+ // pick the translation table from bits 0, 4, and 8 of the address
1611+ const int ii = bitswap< 3 >(A, 8 , 4 , 0 );
1612+ m_decrypted_opcodes[A] = src ^ opcode_xortable[ii ][j];
15861613 }
15871614}
15881615
15891616
15901617
1591- void zaxxon_state::init_razmataz ()
1592- {
1593- address_space &pgmspace = m_maincpu->space (AS_PROGRAM );
1594-
1595- /* additional input ports are wired */
1596- pgmspace.install_read_port (0xc004 , 0xc004 , 0x18f3 , " SW04" );
1597- pgmspace.install_read_port (0xc008 , 0xc008 , 0x18f3 , " SW08" );
1598- pgmspace.install_read_port (0xc00c , 0xc00c , 0x18f3 , " SW0C" );
1599-
1600- /* unknown behavior expected here */
1601- pgmspace.install_read_handler (0xc80a , 0xc80a , read8smo_delegate (*this , FUNC (zaxxon_state::razmataz_counter_r)));
1602-
1603- /* additional state saving */
1604- save_item (NAME (m_razmataz_dial_pos));
1605- save_item (NAME (m_razmataz_counter));
1606- }
1607-
1608-
1609-
16101618/* ************************************
16111619 *
16121620 * Game drivers
16131621 *
16141622 *************************************/
16151623
1616- /* these games run on standard Zaxxon hardware */
1624+ // these games run on standard Zaxxon hardware
16171625GAME ( 1982 , zaxxon, 0 , zaxxon, zaxxon, zaxxon_state, empty_init, ROT90 , " Sega" , " Zaxxon (set 1, rev D)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16181626GAME ( 1982 , zaxxon2, zaxxon, zaxxon, zaxxon, zaxxon_state, empty_init, ROT90 , " Sega" , " Zaxxon (set 2, unknown rev)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16191627GAME ( 1982 , zaxxon3, zaxxon, zaxxon, zaxxon, zaxxon_state, empty_init, ROT90 , " Sega" , " Zaxxon (set 3, unknown rev)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16201628GAME ( 1982 , zaxxonj, zaxxon, szaxxon, zaxxon, zaxxon_state, init_zaxxonj, ROT90 , " Sega" , " Zaxxon (Japan)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16211629GAME ( 1982 , zaxxonb, zaxxon, szaxxon, zaxxon, zaxxon_state, init_zaxxonj, ROT90 , " bootleg" , " Jackson" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16221630
1623- /* standard Zaxxon hardware but extra sound board plugged into 8255 PPI socket and encrypted cpu */
1631+ // standard Zaxxon hardware but extra sound board plugged into 8255 PPI socket and encrypted CPU
16241632GAME ( 1982 , szaxxon, 0 , szaxxone, szaxxon, zaxxon_state, empty_init, ROT90 , " Sega" , " Super Zaxxon (315-5013)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16251633
1626- /* standard Zaxxon hardware? but encrypted cpu */
1634+ // standard Zaxxon hardware? but encrypted CPU
16271635GAME ( 1984 , futspy, 0 , futspye, futspy, zaxxon_state, empty_init, ROT90 , " Sega" , " Future Spy (315-5061)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16281636
1629- /* these games run on modified Zaxxon hardware with no skewing, extra inputs, and a */
1630- /* G-80 Universal Sound Board */
1631- GAME ( 1983 , razmataz, 0 , razmataze, razmataz, zaxxon_state, init_razmataz, ROT90 , " Sega" , " Razzmatazz" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1632- GAME ( 1983 , ixion, 0 , ixion, ixion, zaxxon_state, empty_init, ROT270 , " Sega" , " Ixion (prototype)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1637+ // these games run on modified Zaxxon hardware with no skewing, extra inputs, and a G-80 Universal Sound Board
1638+ GAME ( 1983 , razmataz, 0 , razmataze, razmataz, razmataz_state, empty_init, ROT90 , " Sega" , " Razzmatazz" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1639+ GAME ( 1983 , ixion, 0 , ixion, ixion, razmataz_state, empty_init, ROT270 , " Sega" , " Ixion (prototype)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
16331640
1634- /* these games run on a slightly newer Zaxxon hardware with more ROM space and a */
1635- /* custom sprite DMA chip */
1636- GAME ( 1983 , congo, 0 , congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Congo Bongo (Rev C, 2 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1637- GAME ( 1983 , congoa, congo, congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Congo Bongo (Rev C, 3 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1638- GAME ( 1983 , tiptop, congo, congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Tip Top (3 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1641+ // these games run on slightly newer Zaxxon hardware with more ROM space and a custom sprite DMA chip
1642+ GAME ( 1983 , congo, 0 , congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Congo Bongo (Rev C, 2 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1643+ GAME ( 1983 , congoa, congo, congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Congo Bongo (Rev C, 3 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1644+ GAME ( 1983 , tiptop, congo, congo, congo, zaxxon_state, empty_init, ROT90 , " Sega" , " Tip Top (3 board stack)" , MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
0 commit comments