From 22397e0c5d1377f13dc5028aaea75ca3e540f139 Mon Sep 17 00:00:00 2001 From: Brad Hughes Date: Tue, 6 Dec 2016 08:55:45 -0500 Subject: [PATCH 01/82] Double-check key state before UI autorepeat. Fixes #1169 --- src/emu/uiinput.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index 952a5b371b3..9123a6af526 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -263,7 +263,14 @@ g_profiler.start(PROFILER_INPUT); /* if this is an autorepeat case, set a 1x delay and leave pressed = 1 */ else if (speed > 0 && (osd_ticks() + tps - m_next_repeat[code]) >= tps) - m_next_repeat[code] += 1 * speed * tps / 60; + { + // In the autorepeatcase, we need to double check the key is still pressed + // as there can be a delay between the key polling and our processing of the event + m_seqpressed[code] = machine().ioport().type_pressed(ioport_type(code)); + pressed = (m_seqpressed[code] == SEQ_PRESSED_TRUE); + if (pressed) + m_next_repeat[code] += 1 * speed * tps / 60; + } /* otherwise, reset pressed = 0 */ else From d73825f393bdfabc507dac8012f4563e8191d082 Mon Sep 17 00:00:00 2001 From: darq Date: Thu, 8 Dec 2016 23:02:45 +0100 Subject: [PATCH 02/82] Fixed missing title screen music (parent set), normalized YM volumes --- src/mame/drivers/shootout.cpp | 19 ++++++++++++++----- src/mame/includes/shootout.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 13c31bd4079..03459f7948c 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -49,10 +49,19 @@ WRITE8_MEMBER(shootout_state::bankswitch_w) membank("bank1")->set_entry(data & 0x0f); } +READ8_MEMBER(shootout_state::sound_cpu_command_r) +{ + m_audiocpu->set_input_line (INPUT_LINE_NMI, CLEAR_LINE); + return (m_soundlatch->read (space, 0)); +} + WRITE8_MEMBER(shootout_state::sound_cpu_command_w) { m_soundlatch->write( space, offset, data ); - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + + // Allow the other CPU to reply. This fix the missing music on the title screen (parent set). + space.device ().execute ().spin_until_time (attotime :: from_usec (200)); } WRITE8_MEMBER(shootout_state::flipscreen_w) @@ -102,9 +111,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( shootout_sound_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) - AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) + AM_RANGE(0xa000, 0xa000) AM_READ(sound_cpu_command_r) AM_RANGE(0xc000, 0xffff) AM_ROM - AM_RANGE(0xd000, 0xd000) AM_WRITENOP // unknown, NOT irq/nmi mask + AM_RANGE(0xd000, 0xd000) AM_WRITENOP // Unknown, NOT irq/nmi mask (Always 0x80 ???) ADDRESS_MAP_END /*******************************************************************************/ @@ -262,7 +271,7 @@ static MACHINE_CONFIG_START( shootout, shootout_state ) MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END @@ -294,7 +303,7 @@ static MACHINE_CONFIG_START( shootouj, shootout_state ) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(shootout_state, bankswitch_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(shootout_state, flipscreen_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( shootouk, shootouj ) diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h index fc1486b03fb..4fd5d8c9c47 100644 --- a/src/mame/includes/shootout.h +++ b/src/mame/includes/shootout.h @@ -32,6 +32,7 @@ public: int m_bFlicker; DECLARE_WRITE8_MEMBER(bankswitch_w); + DECLARE_READ8_MEMBER(sound_cpu_command_r); DECLARE_WRITE8_MEMBER(sound_cpu_command_w); DECLARE_WRITE8_MEMBER(flipscreen_w); DECLARE_WRITE8_MEMBER(coincounter_w); From cc1b8a5fb0f83a502e73b1b7d99eccbb5e09f383 Mon Sep 17 00:00:00 2001 From: darq Date: Thu, 8 Dec 2016 23:59:51 +0100 Subject: [PATCH 03/82] Fixed the coin counter; added a note about it, corrected bit 6 of DSW2 (this allows both coins to be recognized), also vblank is active low --- src/mame/drivers/shootout.cpp | 27 ++++++++++++++++++++++----- src/mame/includes/shootout.h | 5 +++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 03459f7948c..28f5487aa2b 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -23,7 +23,6 @@ TODO: - - Fix coin counter - Lots of unmapped memory reads *******************************************************************************/ @@ -69,9 +68,24 @@ WRITE8_MEMBER(shootout_state::flipscreen_w) flip_screen_set(data & 0x01); } +/* + This is actually a 'real' counter... the first write is always 0x40, then when a coin is inserted the game starts to count from 0x01, + then it counts from 0x02 to 0x09 but strangely it skips the 'hexadecimal letters'... so from 0x09 it goes to + 0x10, 0x11, 0x12, ...0x19, 0x20, and so on... + The game counts up to 0x99, after that, 0x99 is always written... + + On the shootoutj and shootoutb sets, it works as above but it counts up to 0x09 instead of 0x99. +*/ WRITE8_MEMBER(shootout_state::coincounter_w) { - machine().bookkeeping().coin_counter_w(0, data); + if (data != m_ccnt_old_val) + { + // Do a coin pulse + machine().bookkeeping().coin_counter_w(0, 0); + machine().bookkeeping().coin_counter_w(0, 1); + + m_ccnt_old_val = data; + } } /*******************************************************************************/ @@ -182,8 +196,8 @@ static INPUT_PORTS_START( shootout ) PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) /* this is set when either coin is inserted */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) // This needs to be low to allows both coins to be accepted... + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") INPUT_PORTS_END static INPUT_PORTS_START( shootouj ) @@ -240,7 +254,10 @@ static GFXDECODE_START( shootout ) GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 0, 16 ) /* tiles */ GFXDECODE_END - +void shootout_state::machine_reset () +{ + m_ccnt_old_val = 0x40; +} static MACHINE_CONFIG_START( shootout, shootout_state ) diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h index 4fd5d8c9c47..c05aeddff24 100644 --- a/src/mame/includes/shootout.h +++ b/src/mame/includes/shootout.h @@ -29,7 +29,9 @@ public: tilemap_t *m_background; tilemap_t *m_foreground; + int m_bFlicker; + int m_ccnt_old_val; DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_READ8_MEMBER(sound_cpu_command_r); @@ -42,7 +44,10 @@ public: DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); DECLARE_DRIVER_INIT(shootout); + + virtual void machine_reset() override; virtual void video_start() override; + DECLARE_PALETTE_INIT(shootout); TILE_GET_INFO_MEMBER(get_bg_tile_info); From 09a411be8612df571f18794e503e32087c6eccfd Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 00:51:37 +0100 Subject: [PATCH 04/82] Save state: Forgot save_item for m_ccnt_old_val, also initialized m_bFlicker variable --- src/mame/drivers/shootout.cpp | 7 ++++--- src/mame/video/shootout.cpp | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 28f5487aa2b..b9c539f78cc 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -256,6 +256,7 @@ GFXDECODE_END void shootout_state::machine_reset () { + m_bFlicker = 0; m_ccnt_old_val = 0x40; } @@ -422,6 +423,6 @@ DRIVER_INIT_MEMBER(shootout_state,shootout) } -GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/video/shootout.cpp b/src/mame/video/shootout.cpp index ecc52ee6bcf..784221acbe4 100644 --- a/src/mame/video/shootout.cpp +++ b/src/mame/video/shootout.cpp @@ -84,6 +84,7 @@ void shootout_state::video_start() m_foreground->set_transparent_pen(0 ); save_item(NAME(m_bFlicker)); + save_item(NAME(m_ccnt_old_val)); } void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ) From aa2f62ceb7a70f4bc67463de6d91b3419dd4e9bd Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 01:40:49 +0100 Subject: [PATCH 05/82] Simplified rom loading; added a note about bootleg decryption --- src/mame/drivers/shootout.cpp | 41 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index b9c539f78cc..5684f5f0956 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -13,7 +13,7 @@ arm? Shoot Out (Korean bootleg) is based on the earlier DE-0203 board but - strangely features the same encryption as used on the DE-0219 board. It + strangely features the same encryption as used on the DE-0219 board. It also has some edited graphics. Driver by: @@ -24,6 +24,8 @@ TODO: - Lots of unmapped memory reads + - Does the korean bootleg really have the DECO 222 CPU? I think it should use the shootclr.003 prom to decrypt the opcodes. + Something like -> rom [addr] = (rom [addr] & 0x0F) | proms [rom [addr] >> 4]]); *******************************************************************************/ @@ -101,7 +103,7 @@ static ADDRESS_MAP_START( shootout_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram") AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) ADDRESS_MAP_END static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state ) @@ -116,7 +118,7 @@ static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram") AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) ADDRESS_MAP_END /*******************************************************************************/ @@ -126,7 +128,7 @@ static ADDRESS_MAP_START( shootout_sound_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) AM_RANGE(0xa000, 0xa000) AM_READ(sound_cpu_command_r) - AM_RANGE(0xc000, 0xffff) AM_ROM + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x0000) AM_RANGE(0xd000, 0xd000) AM_WRITENOP // Unknown, NOT irq/nmi mask (Always 0x80 ???) ADDRESS_MAP_END @@ -334,14 +336,13 @@ MACHINE_CONFIG_END ROM_START( shootout ) - ROM_REGION( 2*0x20000, "maincpu", 0 ) /* 128k for code + 128k for decrypted opcodes */ - ROM_LOAD( "cu00.b1", 0x08000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) /* opcodes encrypted */ - /* banked at 0x4000-0x8000 */ - ROM_LOAD( "cu02.c3", 0x10000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) /* opcodes encrypted */ - ROM_LOAD( "cu01.c1", 0x18000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) /* opcodes encrypted */ + ROM_REGION( 2 * 0x14000, "maincpu", 0 ) // 80k for code + 80k for decrypted opcodes + ROM_LOAD( "cu00.b1", 0x00000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) /* opcodes encrypted */ + ROM_LOAD( "cu02.c3", 0x08000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) /* opcodes encrypted */ + ROM_LOAD( "cu01.c1", 0x10000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) /* opcodes encrypted */ - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "cu09.j1", 0x0c000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) /* Sound CPU */ + ROM_REGION( 0x4000, "audiocpu", 0 ) + ROM_LOAD( "cu09.j1", 0x00000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) /* Sound CPU */ ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -366,10 +367,10 @@ ROM_START( shootout ) ROM_END ROM_START( shootoutj ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 128k for code */ - ROM_LOAD( "cg02.bin", 0x08000, 0x8000, CRC(8fc5d632) SHA1(809ac4eba09972229fe741c96fa8036d7139b6a8) ) - ROM_LOAD( "cg00.bin", 0x10000, 0x8000, CRC(ef6ced1e) SHA1(feea508c7a60fc6cde1efee52cba628accd26028) ) - ROM_LOAD( "cg01.bin", 0x18000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) + ROM_REGION( 0x14000, "maincpu", 0 ) // 80k for code + ROM_LOAD( "cg02.bin", 0x00000, 0x8000, CRC(8fc5d632) SHA1(809ac4eba09972229fe741c96fa8036d7139b6a8) ) + ROM_LOAD( "cg00.bin", 0x08000, 0x8000, CRC(ef6ced1e) SHA1(feea508c7a60fc6cde1efee52cba628accd26028) ) + ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -391,10 +392,10 @@ ROM_START( shootoutj ) ROM_END ROM_START( shootoutb ) - ROM_REGION( 2*0x20000, "maincpu", 0 ) /* 128k for code + 128k for decrypted opcodes */ - ROM_LOAD( "shootout.006", 0x08000, 0x8000, CRC(2c054888) SHA1(cb0de2f7d743506789626304e6bcbbc292fbe8bc) ) - ROM_LOAD( "shootout.008", 0x10000, 0x8000, CRC(9651b656) SHA1(e90eddf2833ef36fa73b7b8d81d28443d2f60220) ) - ROM_LOAD( "cg01.bin", 0x18000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) + ROM_REGION( 2 * 0x14000, "maincpu", 0 ) // 80k for code + 80k for decrypted opcodes + ROM_LOAD( "shootout.006", 0x00000, 0x8000, CRC(2c054888) SHA1(cb0de2f7d743506789626304e6bcbbc292fbe8bc) ) + ROM_LOAD( "shootout.008", 0x08000, 0x8000, CRC(9651b656) SHA1(e90eddf2833ef36fa73b7b8d81d28443d2f60220) ) + ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -419,7 +420,7 @@ ROM_END DRIVER_INIT_MEMBER(shootout_state,shootout) { - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x8000, 0x4000); } From 9911222efce0b348c8473a2c1e653b3cf78bd74a Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 03:19:35 +0100 Subject: [PATCH 06/82] shootouj and shootoutb, like the parent set, also have ram mapped at 0x1004-0x17FF, added a note about unmapped r/w --- src/mame/drivers/shootout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 5684f5f0956..6edbfb153f7 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -23,7 +23,7 @@ TODO: - - Lots of unmapped memory reads + - Lots of unmapped memory reads and writes (sprram or vram mirrors, perhaps...), bg_vram is also read. - Does the korean bootleg really have the DECO 222 CPU? I think it should use the shootclr.003 prom to decrypt the opcodes. Something like -> rom [addr] = (rom [addr] & 0x0F) | proms [rom [addr] >> 4]]); @@ -112,6 +112,7 @@ static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1") AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2") AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2") + AM_RANGE(0x1004, 0x17ff) AM_RAM AM_RANGE(0x1800, 0x1800) AM_WRITE(coincounter_w) AM_RANGE(0x2000, 0x21ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) From 12cea7b7e37befd6d449d94eb56e77b54a4cc865 Mon Sep 17 00:00:00 2001 From: briantro Date: Thu, 8 Dec 2016 21:53:46 -0600 Subject: [PATCH 07/82] minor doc updates / corrections - NW --- src/mame/drivers/gcpinbal.cpp | 2 +- src/mame/drivers/itech32.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/gcpinbal.cpp b/src/mame/drivers/gcpinbal.cpp index 0b7072b4b31..a495ec75730 100644 --- a/src/mame/drivers/gcpinbal.cpp +++ b/src/mame/drivers/gcpinbal.cpp @@ -77,7 +77,7 @@ Custom: EXCELLENT SYSTEM ES-9208 347102 (QFP160) * Denotes unpopulated components -NOTE: Mask roms from Power Flipper Shooting Pinball have not been dumped, but assumed to +NOTE: Mask roms from Power Flipper Pinball Shooting have not been dumped, but assumed to be the same data. ***************************************************************************/ diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp index 06317dc0b72..ad5e10a3241 100644 --- a/src/mame/drivers/itech32.cpp +++ b/src/mame/drivers/itech32.cpp @@ -2139,8 +2139,8 @@ ROM_END ROM_START( pairs ) /* Version 1.2 (3-tier board set: P/N 1059 Rev 3, P/N 1061 Rev 1 & P/N 1060 Rev 0) */ ROM_REGION16_BE( 0x80000, "user1", 0 ) - ROM_LOAD16_BYTE( "pair0_u83_v1.2.u83", 0x00000, 0x20000, CRC(a9c761d8) SHA1(2618c9c3f336cf30f760fd88f12c09985cfd4ee7) ) - ROM_LOAD16_BYTE( "pair1_u88_v1.2.u88", 0x00001, 0x20000, CRC(5141eb86) SHA1(3bb10d588e6334a33e5c2c468651699e84f46cdc) ) + ROM_LOAD16_BYTE( "pair0_u83_x_v1.2.u83", 0x00000, 0x20000, CRC(a9c761d8) SHA1(2618c9c3f336cf30f760fd88f12c09985cfd4ee7) ) + ROM_LOAD16_BYTE( "pair1_u88_x_v1.2.u88", 0x00001, 0x20000, CRC(5141eb86) SHA1(3bb10d588e6334a33e5c2c468651699e84f46cdc) ) ROM_REGION( 0x28000, "soundcpu", 0 ) ROM_LOAD( "pairsnd_u17_v1.u17", 0x10000, 0x18000, CRC(7a514cfd) SHA1(ef5bc74c9560d2c058298051070fa748e58f07e1) ) From 5ed3d6756d0cfb5646ba7094ae38b79c01ace28d Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 9 Dec 2016 17:08:41 +1100 Subject: [PATCH 08/82] pulsarlb: changed drive to HD confirmed on real hardware.(nw) --- src/mame/drivers/pulsar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp index 9a012508c90..79a6aa8e266 100644 --- a/src/mame/drivers/pulsar.cpp +++ b/src/mame/drivers/pulsar.cpp @@ -185,7 +185,7 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS_END static SLOT_INTERFACE_START( pulsar_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "525dd", FLOPPY_525_HD ) SLOT_INTERFACE_END /* Input ports */ From 33aa3d1a62c267ab86eee267d545ee3410e9c54b Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Fri, 9 Dec 2016 11:15:00 +0100 Subject: [PATCH 09/82] mmodular.cpp, s7.cpp: Removed double MNW flag (nw) --- src/mame/drivers/mmodular.cpp | 20 ++++++++++---------- src/mame/drivers/s7.cpp | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mame/drivers/mmodular.cpp b/src/mame/drivers/mmodular.cpp index 1a950119055..10ccbc01801 100644 --- a/src/mame/drivers/mmodular.cpp +++ b/src/mame/drivers/mmodular.cpp @@ -1796,22 +1796,22 @@ DRIVER_INIT_MEMBER(polgar_state,polgar) /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ CONS( 1986, polgar, 0, 0, polgar, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Polgar Schachcomputer", MACHINE_NOT_WORKING | MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK) - CONS( 1987, sfortea, 0, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version A)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1987, sfortea, 0, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version A)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1988, alm16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Almeria 68000", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1988, alm32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Alimera 68020", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sforteb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sforteba, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B, alt)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sexpertb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert B Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sforteb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sforteba, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B, alt)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sexpertb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert B Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1989, academy, 0, 0, academy, academy, driver_device, 0, "Hegener & Glaser", "Mephisto Academy Schachcomputer", MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, megaiv, 0, 0, megaiv, megaiv, driver_device, 0, "Hegener & Glaser", "Mephisto Mega IV Schachcomputer", MACHINE_NOT_WORKING|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, megaiv, 0, 0, megaiv, megaiv, driver_device, 0, "Hegener & Glaser", "Mephisto Mega IV Schachcomputer", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1989, milano, polgar, 0, milano, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Milano Schachcomputer", MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -//CONS( 1989, montec4, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV", MACHINE_NOT_WORKING|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, sfortec, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version C)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, sexpertc, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert C Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) +//CONS( 1989, montec4, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, sfortec, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version C)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, sexpertc, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert C Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1990, lyon16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68000", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1990, lyon32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68020", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1990, monteciv, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV LE Schachcomputer", MACHINE_NOT_WORKING|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1991, diablo68, 0, 0, diablo68, sfortea, driver_device, 0, "Novag", "Novag Diablo 68000 Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1990, monteciv, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV LE Schachcomputer", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1991, diablo68, 0, 0, diablo68, sfortea, driver_device, 0, "Novag", "Novag Diablo 68000 Chess Computer", MACHINE_NO_SOUND|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1991, van16, 0, 0, van16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68000", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1991, van32, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68020", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) CONS( 1993, gen32, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.00", MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/s7.cpp b/src/mame/drivers/s7.cpp index 3f981999d7b..66a9fb4ee06 100644 --- a/src/mame/drivers/s7.cpp +++ b/src/mame/drivers/s7.cpp @@ -880,8 +880,8 @@ GAME( 1982, vrkon_l1, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Varkon GAME( 1982, tmfnt_l5, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Time Fantasy (L-5)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1982, wrlok_l3, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Warlok (L-3)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1982, dfndr_l4, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Defender (L-4)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) -GAME( 1983, jst_l2, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Joust (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NOT_WORKING ) -GAME( 1983, jst_l1, jst_l2, s7, s7, s7_state, s7, ROT0, "Williams", "Joust (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NOT_WORKING ) +GAME( 1983, jst_l2, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Joust (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) +GAME( 1983, jst_l1, jst_l2, s7, s7, s7_state, s7, ROT0, "Williams", "Joust (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1983, lsrcu_l2, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Laser Cue (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1983, fpwr2_l2, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Firepower II (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1984, strlt_l1, 0, s7, s7, s7_state, s7, ROT0, "Williams", "Star Light (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) From ae95c1e30732e8417c32f860ea5ac0a0a19d0966 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 9 Dec 2016 10:30:44 +0000 Subject: [PATCH 10/82] new skeleton driver 'pgm3.cpp' [XingXing] --- scripts/target/mame/arcade.lua | 1 + src/mame/arcade.flt | 1 + src/mame/drivers/pgm3.cpp | 174 +++++++++++++++++++++++++++++++++ src/mame/mame.lst | 7 ++ 4 files changed, 183 insertions(+) create mode 100644 src/mame/drivers/pgm3.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index b6e86ef7357..0aa2d3af4f0 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1884,6 +1884,7 @@ files { MAME_DIR .. "src/mame/machine/pgmprot_orlegend.cpp", MAME_DIR .. "src/mame/machine/pgmprot_orlegend.h", MAME_DIR .. "src/mame/drivers/pgm2.cpp", + MAME_DIR .. "src/mame/drivers/pgm3.cpp", MAME_DIR .. "src/mame/drivers/spoker.cpp", MAME_DIR .. "src/mame/machine/igs036crypt.cpp", MAME_DIR .. "src/mame/machine/igs036crypt.h", diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt index fe6ed0cf3f7..24317bf6c26 100644 --- a/src/mame/arcade.flt +++ b/src/mame/arcade.flt @@ -850,6 +850,7 @@ peplus.cpp peyper.cpp pgm.cpp pgm2.cpp +pgm3.cpp phoenix.cpp photon.cpp photon2.cpp diff --git a/src/mame/drivers/pgm3.cpp b/src/mame/drivers/pgm3.cpp new file mode 100644 index 00000000000..bf7adba35c5 --- /dev/null +++ b/src/mame/drivers/pgm3.cpp @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Xing Xing + +/* PGM 3 hardware. + + Games on this platform + + Knights of Valour 3 HD + + according to Xing Xing + "The main cpu of PGM3 whiched coded as 'SOC38' is an ARM1176@800M designed by SOCLE(http://www.socle-tech.com/). Not much infomation is available on this asic" + + there is likely a 512KBytes encrypted bootloader(u-boot?) inside the cpu which load the kernel&initrd from the external SD card. + + however, according to + http://www.arcadebelgium.net/t4958-knights-of-valour-3-hd-sangoku-senki-3-hd + the CPU is an Intel Atom D525 CPU with 2GB of RAM (but based on hardware images this is incorrect, they clearly show the CPU Xing Xing states is used) + + + the card images (except v105) seem to have encrypted data up to the C2000000 mark, then + some text string about a non-bootable disk followed by mostly blank data + + Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + +0C2000000 EB 3C 90 6D 6B 64 6F 73 66 73 00 00 02 04 04 00 ë<.mkdosfs...... +0C2000010 02 00 02 00 00 F8 00 01 3F 00 FF 00 00 00 00 00 .....ø..?.ÿ..... +0C2000020 00 00 04 00 00 00 29 4C 88 BA 7C 20 20 20 20 20 ......)Lˆº| +0C2000030 20 20 20 20 20 20 46 41 54 31 36 20 20 20 0E 1F FAT16 .. +0C2000040 BE 5B 7C AC 22 C0 74 0B 56 B4 0E BB 07 00 CD 10 ¾[|¬"Àt.V´.»..Í. +0C2000050 5E EB F0 32 E4 CD 16 CD 19 EB FE 54 68 69 73 20 ^ëð2äÍ.Í.ëþThis +0C2000060 69 73 20 6E 6F 74 20 61 20 62 6F 6F 74 61 62 6C is not a bootabl +0C2000070 65 20 64 69 73 6B 2E 20 20 50 6C 65 61 73 65 20 e disk. Please +0C2000080 69 6E 73 65 72 74 20 61 20 62 6F 6F 74 61 62 6C insert a bootabl +0C2000090 65 20 66 6C 6F 70 70 79 20 61 6E 64 0D 0A 70 72 e floppy and..pr +0C20000A0 65 73 73 20 61 6E 79 20 6B 65 79 20 74 6F 20 74 ess any key to t +0C20000B0 72 79 20 61 67 61 69 6E 20 2E 2E 2E 20 0D 0A 00 ry again ... ... + + the v105 image has the encrypted data starting at 400000 and the above at C2400000 + and is overall slightly shorter. it was probably dumped using a different method? + assuming one is the correct method the others will need adjusting. + + + DSW: + 1: OFF = Game mode / ON = Test mode + 2: OFF = JAMMA / ON = JVS + 3: OFF = 16/9 (1280x720) / ON = 4/3 (800x600) + 4: NO USE + + todo: add other hardware details? + +*/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" + + +class pgm3_state : public driver_device +{ +public: + pgm3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } + + DECLARE_DRIVER_INIT(kov3hd); + + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + uint32_t screen_update_pgm3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_pgm3(screen_device &screen, bool state); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( pgm3_map, AS_PROGRAM, 32, pgm3_state ) + AM_RANGE(0x00000000, 0x00003fff) AM_ROM +ADDRESS_MAP_END + +static INPUT_PORTS_START( pgm3 ) +INPUT_PORTS_END + +uint32_t pgm3_state::screen_update_pgm3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +void pgm3_state::screen_eof_pgm3(screen_device &screen, bool state) +{ +} + +void pgm3_state::video_start() +{ +} + +void pgm3_state::machine_start() +{ +} + +void pgm3_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( pgm3, pgm3_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ARM9, 800000000) // wrong, see notes at top of driver + MCFG_CPU_PROGRAM_MAP(pgm3_map) + MCFG_DEVICE_DISABLE() + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(1280, 720) + MCFG_SCREEN_VISIBLE_AREA(0, 1280-1, 0, 720-1) + MCFG_SCREEN_UPDATE_DRIVER(pgm3_state, screen_update_pgm3) + MCFG_SCREEN_VBLANK_DRIVER(pgm3_state, screen_eof_pgm3) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x1000) +MACHINE_CONFIG_END + +ROM_START( kov3hd ) + ROM_REGION( 0x04000, "maincpu", ROMREGION_ERASE00 ) + // does it boot from the card, or is there an internal rom? + + DISK_REGION( "card" ) + DISK_IMAGE( "kov3hd_v105", 0, SHA1(c185888c59880805bb76b5c0a42b05c614dcff37) ) +ROM_END + +ROM_START( kov3hd104 ) + ROM_REGION( 0x04000, "maincpu", ROMREGION_ERASE00 ) + // does it boot from the card, or is there an internal rom? + + DISK_REGION( "card" ) + DISK_IMAGE( "kov3hd_m104", 0, SHA1(899b3b81825e6f23ae8f39aa67ad5b019f387cf9) ) +ROM_END + +ROM_START( kov3hd103 ) + ROM_REGION( 0x04000, "maincpu", ROMREGION_ERASE00 ) + // does it boot from the card, or is there an internal rom? + + DISK_REGION( "card" ) + DISK_IMAGE( "kov3hd_m103", 0, SHA1(0d4fd981f477cd5ed62609b875f4ddec939a2bb0) ) +ROM_END + +ROM_START( kov3hd102 ) + ROM_REGION( 0x04000, "maincpu", ROMREGION_ERASE00 ) + // does it boot from the card, or is there an internal rom? + + DISK_REGION( "card" ) + DISK_IMAGE( "kov3hd_m102", 0, SHA1(a5a872f9add5527b94019ec77ff1cd0f167f040f) ) +ROM_END + +ROM_START( kov3hd101 ) + ROM_REGION( 0x04000, "maincpu", ROMREGION_ERASE00 ) + // does it boot from the card, or is there an internal rom? + + DISK_REGION( "card" ) + DISK_IMAGE( "kov3hd_m101", 0, SHA1(086d6f1b8b2c01a8670fd6480da44b9c507f6e08) ) +ROM_END + + +DRIVER_INIT_MEMBER(pgm3_state,kov3hd) +{ +} + + +// all dumped sets might be China region, unless region info comes from elsewhere +GAME( 2011, kov3hd, 0, pgm3, pgm3, pgm3_state, kov3hd, ROT0, "IGS", "Knights of Valour 3 HD (V105)", MACHINE_IS_SKELETON ) +GAME( 2011, kov3hd104, kov3hd, pgm3, pgm3, pgm3_state, kov3hd, ROT0, "IGS", "Knights of Valour 3 HD (V104)", MACHINE_IS_SKELETON ) +GAME( 2011, kov3hd103, kov3hd, pgm3, pgm3, pgm3_state, kov3hd, ROT0, "IGS", "Knights of Valour 3 HD (V103)", MACHINE_IS_SKELETON ) +GAME( 2011, kov3hd102, kov3hd, pgm3, pgm3, pgm3_state, kov3hd, ROT0, "IGS", "Knights of Valour 3 HD (V102)", MACHINE_IS_SKELETON ) +GAME( 2011, kov3hd101, kov3hd, pgm3, pgm3, pgm3_state, kov3hd, ROT0, "IGS", "Knights of Valour 3 HD (V101)", MACHINE_IS_SKELETON ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 7d72a0252e3..8e7f9d3a6fc 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -30515,6 +30515,13 @@ orleg2 // (c) 2007 orleg2o // orleg2oa // +@source:pgm3.cpp +kov3hd +kov3hd104 +kov3hd103 +kov3hd102 +kov3hd101 + @source:phantom.cpp fphantom // From a877c987fb45ed3efac5ff50b426933f5ca59cbb Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 9 Dec 2016 13:00:51 +0100 Subject: [PATCH 11/82] detect if SOURCES file do not exist (nw) --- scripts/genie.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/genie.lua b/scripts/genie.lua index 653c8b69e37..e905e3b6aef 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1317,6 +1317,13 @@ configuration { "Debug", "gmake" } configuration { } if (_OPTIONS["SOURCES"] ~= nil) then + local str = _OPTIONS["SOURCES"] + for word in string.gmatch(str, '([^,]+)') do + if (not os.isfile(path.join(MAME_DIR ,word))) then + print("File " .. word.. " does not exist") + os.exit() + end + end OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " target " .. _OPTIONS["subtarget"]) load(OUT_STR)() os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"]..".flt") From c1a77cedcbf9a901c4f6d83a0b798876dd9ccdac Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sat, 10 Dec 2016 00:46:49 +1100 Subject: [PATCH 12/82] pulsarlb: fixed a few more mistakes (nw) --- src/mame/drivers/pulsar.cpp | 39 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp index 79a6aa8e266..88af384dc52 100644 --- a/src/mame/drivers/pulsar.cpp +++ b/src/mame/drivers/pulsar.cpp @@ -55,6 +55,7 @@ public: m_brg(*this, "brg"), m_fdc (*this, "fdc"), m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), m_rtc(*this, "rtc") { } @@ -77,6 +78,7 @@ private: required_device m_brg; required_device m_fdc; required_device m_floppy0; + required_device m_floppy1; required_device m_rtc; }; @@ -138,41 +140,46 @@ d7 XMEMEX line (for external memory, not emulated) WRITE8_MEMBER( pulsar_state::ppi_pa_w ) { m_floppy = nullptr; - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); + if (BIT(data, 0)) + m_floppy = m_floppy0->get_device(); + else + if (BIT(data, 1)) + m_floppy = m_floppy1->get_device(); m_fdc->set_floppy(m_floppy); m_fdc->dden_w(BIT(data, 5)); + if (m_floppy) + m_floppy->mon_w(0); } /* d0..d3 RTC address -d4 RTC read line (inverted in emulation) -d5 RTC write line (inverted in emulation) +d4 RTC read line +d5 RTC write line d6 RTC hold line d7 Allow 64k of ram */ WRITE8_MEMBER( pulsar_state::ppi_pb_w ) { m_rtc->address_w(data & 0x0f); - m_rtc->read_w(!BIT(data, 4)); - m_rtc->write_w(!BIT(data, 5)); + m_rtc->read_w(BIT(data, 4)); + m_rtc->write_w(BIT(data, 5)); m_rtc->hold_w(BIT(data, 6)); membank("bankr1")->set_entry(BIT(data, 7)); } -/* -d0..d3 Data lines to rtc -d7 /2 SIDES (assumed to be side select) -*/ +// d0..d3 Data lines to rtc WRITE8_MEMBER( pulsar_state::ppi_pc_w ) { m_rtc->data_w(space, 0, data & 15); - if (m_floppy) - m_floppy->ss_w(BIT(data, 7)); } +// d7 /2 SIDES READ8_MEMBER( pulsar_state::ppi_pc_r ) { - return m_rtc->data_r(space, 0); + uint8_t data = 0; + if (m_floppy) + data = m_floppy->twosid_r() << 7; + return m_rtc->data_r(space, 0) | data; } static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -185,7 +192,8 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS_END static SLOT_INTERFACE_START( pulsar_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_HD ) + SLOT_INTERFACE( "drive0", FLOPPY_525_HD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_HD ) SLOT_INTERFACE_END /* Input ports */ @@ -248,7 +256,10 @@ static MACHINE_CONFIG_START( pulsar, pulsar_state ) MCFG_COM8116_FT_HANDLER(WRITELINE(pulsar_state, ft_w)) MCFG_FD1797_ADD("fdc", XTAL_4MHz / 2) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "drive0", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pulsar_floppies, "drive1", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END /* ROM definition */ From 962fda50bcb0ecb874ddd8bb274926d59cdd1250 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 9 Dec 2016 17:22:01 +0100 Subject: [PATCH 13/82] delegates: Don't crash on late binding if no object is actually needed [O. Galibert] pci9050: Fix the mappings [O. Galibert] --- src/devices/machine/pci.cpp | 5 +++-- src/devices/machine/pci.h | 4 ++-- src/devices/machine/pci9050.cpp | 16 +++------------- src/devices/machine/pci9050.h | 12 ++++-------- src/lib/util/delegate.h | 2 +- 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index dd8e767f5a8..97b9e7bccf3 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -284,7 +284,7 @@ void pci_device::map_device(uint64_t memory_window_start, uint64_t memory_window case 5: space->install_readwrite_handler(start, end, read32_delegate(FUNC(pci_device::unmapped5_r), this), write32_delegate(FUNC(pci_device::unmapped5_w), this)); break; } - space->install_device_delegate(start, end, *this, bi.map); + space->install_device_delegate(start, end, *bi.device, bi.map); logerror("map %s at %0*x-%0*x\n", bi.map.name(), bi.flags & M_IO ? 4 : 8, uint32_t(start), bi.flags & M_IO ? 4 : 8, uint32_t(end)); } @@ -317,11 +317,12 @@ void pci_device::skip_map_regs(int count) assert(bank_reg_count <= 6); } -void pci_device::add_map(uint64_t size, int flags, address_map_delegate &map) +void pci_device::add_map(uint64_t size, int flags, address_map_delegate &map, device_t *relative_to) { assert(bank_count < 6); int bid = bank_count++; bank_infos[bid].map = map; + bank_infos[bid].device = relative_to ? relative_to : this; bank_infos[bid].adr = 0; bank_infos[bid].size = size; bank_infos[bid].flags = flags; diff --git a/src/devices/machine/pci.h b/src/devices/machine/pci.h index 6b94f4abd82..a67e17a96e0 100644 --- a/src/devices/machine/pci.h +++ b/src/devices/machine/pci.h @@ -94,8 +94,8 @@ protected: }; struct bank_info { - // One of the two address_map_delegate map; + device_t *device; uint64_t adr; uint32_t size; @@ -123,7 +123,7 @@ protected: virtual void device_reset() override; void skip_map_regs(int count); - void add_map(uint64_t size, int flags, address_map_delegate &map); + void add_map(uint64_t size, int flags, address_map_delegate &map, device_t *relative_to = nullptr); template void add_map(uint64_t size, int flags, void (T::*map)(address_map &map), const char *name) { address_map_delegate delegate(map, name, static_cast(this)); add_map(size, flags, delegate); diff --git a/src/devices/machine/pci9050.cpp b/src/devices/machine/pci9050.cpp index 8f5e36b3550..dad36181af5 100644 --- a/src/devices/machine/pci9050.cpp +++ b/src/devices/machine/pci9050.cpp @@ -50,32 +50,22 @@ pci9050_device::pci9050_device(const machine_config &mconfig, const char *tag, d } } -void pci9050_device::set_map(int id, address_map_constructor map, const char *name, device_t *device) +void pci9050_device::set_map(int id, const address_map_delegate &map, device_t *device) { m_maps[id] = map; - m_names[id] = name; m_devices[id] = device; } void pci9050_device::device_start() { - typedef void (pci9050_device::*tramp_t)(address_map &); - static const tramp_t trampolines[4] = { - &pci9050_device::map_trampoline<0>, - &pci9050_device::map_trampoline<1>, - &pci9050_device::map_trampoline<2>, - &pci9050_device::map_trampoline<3> - }; - pci_device::device_start(); add_map(0x80, M_MEM, FUNC(pci9050_device::map)); // map 0 is our config registers, mem space add_map(0x80, M_IO, FUNC(pci9050_device::map)); // map 1 is our config registers, i/o space for(int i=0; i<4; i++) - if(m_names[i]) - // add_map(0, M_MEM | M_DISABLED, m_maps[i], m_names[i], m_devices[i]); - add_map(0, M_MEM | M_DISABLED, trampolines[i], m_names[i]); + if(!m_maps[i].isnull()) + add_map(0, M_MEM | M_DISABLED, m_maps[i], m_devices[i]); else add_map(0, M_MEM | M_DISABLED, FUNC(pci9050_device::empty)); diff --git a/src/devices/machine/pci9050.h b/src/devices/machine/pci9050.h index f8ba2880d58..ce33f35159a 100644 --- a/src/devices/machine/pci9050.h +++ b/src/devices/machine/pci9050.h @@ -17,7 +17,7 @@ MCFG_PCI_DEVICE_ADD(_tag, PCI9050, 0x10b59050, 0x01, 0x06800000, 0x10b59050) #define MCFG_PCI9050_SET_MAP(id, map) \ - downcast(device)->set_map(id, ADDRESS_MAP_NAME(map), #map, owner); + downcast(device)->set_map(id, address_map_delegate(ADDRESS_MAP_NAME(map), #map), owner); #define MCFG_PCI9050_USER_INPUT_CALLBACK(_write) \ devcb = &pci9050_device::set_user_input_callback(*device, DEVCB_##_write); @@ -29,7 +29,7 @@ class pci9050_device : public pci_device { public: - pci9050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + pci9050_device(const machine_config &mconfig, const char *tag, device_t *device, uint32_t clock); // PCI9050 I/O register space handlers DECLARE_READ32_MEMBER( lasrr_r ); @@ -54,7 +54,7 @@ public: template static devcb_base &set_user_input_callback(device_t &device, _Object object) { return downcast(device).m_user_input_handler.set_callback(object); } template static devcb_base &set_user_output_callback(device_t &device, _Object object) { return downcast(device).m_user_output_handler.set_callback(object); } - void set_map(int id, address_map_constructor map, const char *name, device_t *device); + void set_map(int id, const address_map_delegate &map, device_t *device); protected: virtual void device_start() override; @@ -67,7 +67,7 @@ private: const char *m_names[4]; device_t *m_devices[4]; - address_map_constructor m_maps[4]; + address_map_delegate m_maps[4]; uint32_t m_lasrr[4], m_lasba[4], m_lasbrd[4], m_csbase[4]; uint32_t m_eromrr, m_eromba, m_erombrd, m_intcsr, m_cntrl; @@ -75,10 +75,6 @@ private: void remap_local(int id); void remap_rom(); - template void map_trampoline(address_map &map) { - m_maps[id](map); - } - devcb_read32 m_user_input_handler; devcb_write32 m_user_output_handler; diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h index 5e8f395776f..f8e23faf57d 100644 --- a/src/lib/util/delegate.h +++ b/src/lib/util/delegate.h @@ -552,7 +552,7 @@ public: bool is_mfp() const { return !m_raw_mfp.isnull(); } // late binding - void late_bind(delegate_late_bind &object) { bind((*m_latebinder)(object)); } + void late_bind(delegate_late_bind &object) { if(m_latebinder) bind((*m_latebinder)(object)); } protected: // return the actual object (not the one we use for calling) From 3640db6ad4ee845ab76570efc68b9dbcb72dc67f Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 19:00:37 +0100 Subject: [PATCH 14/82] Added a note that the PCB has only one 12 MHz XTAL, derived all clocks by this value; replaced 'old style' screen parameters with MCFG_SCREEN_RAW_PARAMS --- src/mame/drivers/shootout.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 6edbfb153f7..87fd3db511e 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -16,6 +16,11 @@ strangely features the same encryption as used on the DE-0219 board. It also has some edited graphics. + The DE-0219 PCB seems to have only one 12 MHz XTAL, some images with recognizable XTAL value can be found here: + - http://www.jammarcade.net/images/2016/04/Shootout.jpg + - http://thumbs.picclick.com/00/s/MTIwMFgxNjAw/z/7iIAAOSw5ClXxbrB/$/Data-East-Shootout-Arcade-Video-Game-Pcb-Circuit-_57.jpg + + Driver by: Ernesto Corvi (ernesto@imagina.com) Phil Stroffolino @@ -266,18 +271,18 @@ void shootout_state::machine_reset () static MACHINE_CONFIG_START( shootout, shootout_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", DECO_222, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", DECO_222, XTAL_12MHz / 6) // 2 MHz? MCFG_CPU_PROGRAM_MAP(shootout_map) - MCFG_CPU_ADD("audiocpu", M6502, 1500000) + MCFG_CPU_ADD("audiocpu", M6502, XTAL_12MHz / 8) // 1.5 MHz MCFG_CPU_PROGRAM_MAP(shootout_sound_map) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + + // Guessed parameters based on the 12 MHz XTAL, but they seem resonable (TODO: Real PCB measurements) + MCFG_SCREEN_RAW_PARAMS (XTAL_12MHz / 2, 384, 0, 256, 262, 8, 248) + MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootout) MCFG_SCREEN_PALETTE("palette") @@ -290,7 +295,7 @@ static MACHINE_CONFIG_START( shootout, shootout_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) + MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz / 8) // 1.5 MHz MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END @@ -299,15 +304,15 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( shootouj, shootout_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz / 6) // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) MCFG_CPU_PROGRAM_MAP(shootouj_map) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + + // Guessed parameters based on the 12 MHz XTAL, but they seem resonable (TODO: Real PCB measurements) + MCFG_SCREEN_RAW_PARAMS (XTAL_12MHz / 2, 384, 0, 256, 262, 8, 248) + MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootouj) MCFG_SCREEN_PALETTE("palette") @@ -320,7 +325,7 @@ static MACHINE_CONFIG_START( shootouj, shootout_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) + MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz / 8) // 1.5 MHz (Assuming the same XTAL as DE-0219 pcb) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(shootout_state, bankswitch_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(shootout_state, flipscreen_w)) @@ -330,7 +335,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( shootouk, shootouj ) /* the Korean 'bootleg' has the usual DECO222 style encryption */ MCFG_DEVICE_REMOVE("maincpu") - MCFG_CPU_ADD("maincpu", DECO_222, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", DECO_222, XTAL_12MHz / 6) // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) MCFG_CPU_PROGRAM_MAP(shootouj_map) MACHINE_CONFIG_END From de1b4f51a7182a9bbb0c3e595ba1bca2b633d636 Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 19:05:50 +0100 Subject: [PATCH 15/82] Corrected an engRish comment (nw) --- src/mame/drivers/shootout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 87fd3db511e..5a40b4de8a5 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -66,7 +66,7 @@ WRITE8_MEMBER(shootout_state::sound_cpu_command_w) m_soundlatch->write( space, offset, data ); m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - // Allow the other CPU to reply. This fix the missing music on the title screen (parent set). + // Allow the other CPU to reply. This fixes the missing music on the title screen (parent set). space.device ().execute ().spin_until_time (attotime :: from_usec (200)); } From 98ab24199df63f846b938c81c7aebee3aa7ed489 Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 19:28:17 +0100 Subject: [PATCH 16/82] Removed m_bFlicker variable and used screen.frame_number instead --- src/mame/drivers/shootout.cpp | 1 - src/mame/includes/shootout.h | 1 - src/mame/video/shootout.cpp | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 5a40b4de8a5..a012485d690 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -264,7 +264,6 @@ GFXDECODE_END void shootout_state::machine_reset () { - m_bFlicker = 0; m_ccnt_old_val = 0x40; } diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h index c05aeddff24..4a0965797eb 100644 --- a/src/mame/includes/shootout.h +++ b/src/mame/includes/shootout.h @@ -30,7 +30,6 @@ public: tilemap_t *m_background; tilemap_t *m_foreground; - int m_bFlicker; int m_ccnt_old_val; DECLARE_WRITE8_MEMBER(bankswitch_w); diff --git a/src/mame/video/shootout.cpp b/src/mame/video/shootout.cpp index 784221acbe4..a8eaf925ff7 100644 --- a/src/mame/video/shootout.cpp +++ b/src/mame/video/shootout.cpp @@ -83,7 +83,6 @@ void shootout_state::video_start() m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(shootout_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_foreground->set_transparent_pen(0 ); - save_item(NAME(m_bFlicker)); save_item(NAME(m_ccnt_old_val)); } @@ -93,7 +92,7 @@ void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c const uint8_t *source = m_spriteram+127*4; int count; - m_bFlicker = !m_bFlicker; + bool m_bFlicker = (screen.frame_number () & 1) != 0; for( count=0; count<128; count++ ) { From 00f449c0abf8f52d7e1a826423884b46e2275291 Mon Sep 17 00:00:00 2001 From: darq Date: Fri, 9 Dec 2016 19:57:47 +0100 Subject: [PATCH 17/82] Skipping hex values is not so strange for a BCD counter (that would be invalid for a decoder IC); clarified the coincounter_w comment --- src/mame/drivers/shootout.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index a012485d690..ec1565abaec 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -76,12 +76,15 @@ WRITE8_MEMBER(shootout_state::flipscreen_w) } /* - This is actually a 'real' counter... the first write is always 0x40, then when a coin is inserted the game starts to count from 0x01, - then it counts from 0x02 to 0x09 but strangely it skips the 'hexadecimal letters'... so from 0x09 it goes to - 0x10, 0x11, 0x12, ...0x19, 0x20, and so on... - The game counts up to 0x99, after that, 0x99 is always written... + This is actually a double BCD counter (2 BCD digits packet in a byte)... + The first write is always 0x40, then when a coin is inserted it starts to count from 0x01 up to 0x99. + When it reaches 99 credits, 0x99 is always written... - On the shootoutj and shootoutb sets, it works as above but it counts up to 0x09 instead of 0x99. + On the shootoutj and shootoutb sets, it works as above but it counts up to 0x09 instead of 0x99 (Single BCD digit). + + Note: + This should be an input for a BCD to 7-segment decoder (e.g. a 74LS47), but all the PCBs I've seen don't have 'onboard' + display(s), so this was implemented as normal "coin counter" (after all, they both have the same goal: count credits ;)) */ WRITE8_MEMBER(shootout_state::coincounter_w) { From 7f0ba30ec5abcfea8768d9157cc784050760b721 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 9 Dec 2016 17:23:47 +0100 Subject: [PATCH 18/82] sharc: Use standard memory maps [O. Galibert] --- src/devices/cpu/sharc/sharc.cpp | 243 +++++++++++---------- src/devices/cpu/sharc/sharc.h | 24 +- src/devices/cpu/sharc/sharcdrc.cpp | 338 ++--------------------------- src/devices/cpu/sharc/sharcmem.hxx | 179 +-------------- src/emu/debug/debugcpu.cpp | 4 + 5 files changed, 164 insertions(+), 624 deletions(-) diff --git a/src/devices/cpu/sharc/sharc.cpp b/src/devices/cpu/sharc/sharc.cpp index 2555d25d7ee..bfca22096c2 100644 --- a/src/devices/cpu/sharc/sharc.cpp +++ b/src/devices/cpu/sharc/sharc.cpp @@ -52,29 +52,37 @@ enum SHARC_B12, SHARC_B13, SHARC_B14, SHARC_B15 }; - -#define ROPCODE(pc) ((uint64_t)(m_internal_ram[((pc-0x20000) * 3) + 0]) << 32) | \ - ((uint64_t)(m_internal_ram[((pc-0x20000) * 3) + 1]) << 16) | \ - ((uint64_t)(m_internal_ram[((pc-0x20000) * 3) + 2]) << 0) - - const device_type ADSP21062 = &device_creator; - -// This is just used to stop the debugger from complaining about executing from I/O space static ADDRESS_MAP_START( internal_pgm, AS_PROGRAM, 64, adsp21062_device ) - AM_RANGE(0x20000, 0x7ffff) AM_RAM AM_SHARE("x") + AM_RANGE(0x20000, 0x24fff) AM_READWRITE(pm0_r, pm0_w) + AM_RANGE(0x28000, 0x2cfff) AM_READWRITE(pm1_r, pm1_w) + AM_RANGE(0x30000, 0x34fff) AM_READWRITE(pm1_r, pm1_w) + AM_RANGE(0x38000, 0x3cfff) AM_READWRITE(pm1_r, pm1_w) ADDRESS_MAP_END +static ADDRESS_MAP_START( internal_data, AS_DATA, 32, adsp21062_device ) + AM_RANGE(0x00000, 0x000ff) AM_READWRITE(iop_r, iop_w) + AM_RANGE(0x20000, 0x27fff) AM_RAM AM_SHARE("block0") + AM_RANGE(0x28000, 0x2ffff) AM_RAM AM_SHARE("block1") + AM_RANGE(0x30000, 0x37fff) AM_RAM AM_SHARE("block1") + AM_RANGE(0x38000, 0x3ffff) AM_RAM AM_SHARE("block1") + AM_RANGE(0x40000, 0x4ffff) AM_READWRITE(dmw0_r, dmw0_w) + AM_RANGE(0x50000, 0x5ffff) AM_READWRITE(dmw1_r, dmw1_w) + AM_RANGE(0x60000, 0x6ffff) AM_READWRITE(dmw1_r, dmw1_w) + AM_RANGE(0x70000, 0x7ffff) AM_READWRITE(dmw1_r, dmw1_w) +ADDRESS_MAP_END adsp21062_device::adsp21062_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : cpu_device(mconfig, ADSP21062, "ADSP21062", tag, owner, clock, "adsp21062", __FILE__) , m_program_config("program", ENDIANNESS_LITTLE, 64, 24, -3, ADDRESS_MAP_NAME(internal_pgm)) - , m_data_config("data", ENDIANNESS_LITTLE, 32, 32, -2) + , m_data_config("data", ENDIANNESS_LITTLE, 32, 32, -2, ADDRESS_MAP_NAME(internal_data)) , m_boot_mode(BOOT_MODE_HOST) , m_cache(CACHE_SIZE + sizeof(sharc_internal_state)) , m_drcuml(nullptr) , m_drcfe(nullptr) + , m_block0(*this, "block0") + , m_block1(*this, "block1") , m_enable_drc(false) { } @@ -88,7 +96,7 @@ offs_t adsp21062_device::disasm_disassemble(std::ostream &stream, offs_t pc, con void adsp21062_device::enable_recompiler() { - m_enable_drc = true; + m_enable_drc = allow_drc(); } @@ -144,11 +152,98 @@ void adsp21062_device::sharc_iop_delayed_w(uint32_t reg, uint32_t data, int cycl m_core->delayed_iop_timer->adjust(cycles_to_attotime(cycles), 0); } +// 0 012 0h 0l 1h +// 1 453 2h 2l 1l +// 2 678 3h 3l 4h +// 3 ab9 5h 5l 4l +// 4 cde 6h 6l 7h + +READ64_MEMBER( adsp21062_device::pm0_r) +{ + offs_t slot = offset >> 12; + offs_t base = (offset & 0xfff) + (slot >> 1) * (3<<12); + if(slot & 1) + return (uint64_t(m_block0[base + 0x2000]) << 16) | (m_block0[base + 0x1000] & 0xffff); + else + return (uint64_t(m_block0[base ]) << 16) | (m_block0[base + 0x1000] >> 16); +} + +WRITE64_MEMBER(adsp21062_device::pm0_w) +{ + offs_t slot = offset >> 12; + offs_t base = (offset & 0xfff) + (slot >> 1) * (3<<12); + if(slot & 1) { + if(ACCESSING_BITS_0_15) + m_block0[base + 0x1000] = (m_block0[base + 0x1000] & 0xffff0000) | (data & 0xffff); + m_block0[base + 0x2000] = (m_block0[base + 0x2000] & ~(mem_mask >> 16)) | ((data & mem_mask) >> 16); + } else { + m_block0[base + 0x0000] = (m_block0[base + 0x0000] & ~(mem_mask >> 16)) | ((data & mem_mask) >> 16); + if(ACCESSING_BITS_0_15) + m_block0[base + 0x1000] = (m_block0[base + 0x1000] & 0xffff) | ((data & 0xffff) << 16); + } +} + +READ64_MEMBER( adsp21062_device::pm1_r) +{ + offs_t slot = offset >> 12; + offs_t base = (offset & 0xfff) + (slot >> 1) * (3<<12); + if(slot & 1) + return (uint64_t(m_block1[base + 0x2000]) << 16) | (m_block1[base + 0x1000] & 0xffff); + else + return (uint64_t(m_block1[base ]) << 16) | (m_block1[base + 0x1000] >> 16); +} + +WRITE64_MEMBER(adsp21062_device::pm1_w) +{ + offs_t slot = offset >> 12; + offs_t base = (offset & 0xfff) + (slot >> 1) * (3<<12); + if(slot & 1) { + if(ACCESSING_BITS_0_15) + m_block1[base + 0x1000] = (m_block1[base + 0x1000] & 0xffff0000) | (data & 0xffff); + m_block1[base + 0x2000] = (m_block1[base + 0x2000] & ~(mem_mask >> 16)) | ((data & mem_mask) >> 16); + } else { + m_block1[base + 0x0000] = (m_block1[base + 0x0000] & ~(mem_mask >> 16)) | ((data & mem_mask) >> 16); + if(ACCESSING_BITS_0_15) + m_block1[base + 0x1000] = (m_block1[base + 0x1000] & 0xffff) | ((data & 0xffff) << 16); + } +} + +READ32_MEMBER( adsp21062_device::dmw0_r) +{ + if(offset & 1) + return m_block0[offset >> 1] >> 16; + else + return m_block0[offset >> 1] & 0xffff; +} + +WRITE32_MEMBER(adsp21062_device::dmw0_w) +{ + if(offset & 1) + m_block0[offset >> 1] = (m_block0[offset >> 1] & 0xffff) | (data << 16); + else + m_block0[offset >> 1] = (m_block0[offset >> 1] & 0xffff0000) | (data & 0xffff); +} + +READ32_MEMBER( adsp21062_device::dmw1_r) +{ + if(offset & 1) + return m_block1[offset >> 1] >> 16; + else + return m_block1[offset >> 1] & 0xffff; +} + +WRITE32_MEMBER(adsp21062_device::dmw1_w) +{ + if(offset & 1) + m_block1[offset >> 1] = (m_block1[offset >> 1] & 0xffff) | (data << 16); + else + m_block1[offset >> 1] = (m_block1[offset >> 1] & 0xffff0000) | (data & 0xffff); +} /* IOP registers */ -uint32_t adsp21062_device::sharc_iop_r(uint32_t address) +READ32_MEMBER( adsp21062_device::iop_r) { - switch (address) + switch (offset) { case 0x00: return 0; // System configuration @@ -156,13 +251,13 @@ uint32_t adsp21062_device::sharc_iop_r(uint32_t address) { return m_core->dma_status; } - default: fatalerror("sharc_iop_r: Unimplemented IOP reg %02X at %08X\n", address, m_core->pc); + default: fatalerror("sharc_iop_r: Unimplemented IOP reg %02X at %08X\n", offset, m_core->pc); } } -void adsp21062_device::sharc_iop_w(uint32_t address, uint32_t data) +WRITE32_MEMBER(adsp21062_device::iop_w) { - switch (address) + switch (offset) { case 0x00: break; // System configuration case 0x02: break; // External Memory Wait State Configuration @@ -240,7 +335,7 @@ void adsp21062_device::sharc_iop_w(uint32_t address, uint32_t data) case 0x4e: m_core->dma[7].ext_modifier = data; return; case 0x4f: m_core->dma[7].ext_count = data; return; - default: fatalerror("sharc_iop_w: Unimplemented IOP reg %02X, %08X at %08X\n", address, data, m_core->pc); + default: fatalerror("sharc_iop_w: Unimplemented IOP reg %02X, %08X at %08X\n", offset, data, m_core->pc); } } @@ -297,7 +392,7 @@ void adsp21062_device::external_iop_write(uint32_t address, uint32_t data) else { osd_printf_debug("SHARC IOP write %08X, %08X\n", address, data); - sharc_iop_w(address, data); + m_data->write_dword(address << 2, data); } } @@ -341,14 +436,10 @@ void adsp21062_device::device_start() memset(m_core, 0, sizeof(sharc_internal_state)); m_program = &space(AS_PROGRAM); - m_direct = &m_program->direct(); m_data = &space(AS_DATA); build_opcode_table(); - m_internal_ram_block0 = &m_internal_ram[0]; - m_internal_ram_block1 = &m_internal_ram[0x20000/2]; - // init UML generator uint32_t umlflags = 0; m_drcuml = std::make_unique(*this, m_cache, umlflags, 1, 24, 0); @@ -615,8 +706,6 @@ void adsp21062_device::device_start() save_item(NAME(m_core->px)); - save_pointer(NAME(m_internal_ram), 2 * 0x10000); - save_item(NAME(m_core->opcode)); save_item(NAME(m_core->nfaddr)); @@ -767,7 +856,8 @@ void adsp21062_device::device_start() void adsp21062_device::device_reset() { - memset(m_internal_ram, 0, 2 * 0x10000 * sizeof(uint16_t)); + memset(m_block0, 0, 0x8000 * sizeof(uint32_t)); + memset(m_block1, 0, 0x8000 * sizeof(uint32_t)); switch(m_boot_mode) { @@ -898,6 +988,12 @@ void adsp21062_device::check_interrupts() void adsp21062_device::execute_run() { + static bool first = true; + if(first) { + first = false; + machine().debug_break(); + } + if (m_enable_drc) { if (m_core->irq_pending != 0) @@ -931,9 +1027,15 @@ void adsp21062_device::execute_run() m_core->astat_old_old = m_core->astat_old; m_core->astat_old = m_core->astat; + static bool first = true; + if(first) { + first = false; + machine().debug_break(); + } + debugger_instruction_hook(this, m_core->pc); - m_core->opcode = ROPCODE(m_core->pc); + m_core->opcode = m_program->read_qword(m_core->pc << 3); // handle looping if (m_core->pc == m_core->laddr.addr) @@ -1011,92 +1113,3 @@ void adsp21062_device::execute_run() }; } } - -bool adsp21062_device::memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) -{ - if (spacenum == AS_PROGRAM) - { - int address = offset >> 3; - - if (address >= 0x20000 && address < 0x30000) - { - switch (size) - { - case 1: - { - int frac = offset & 7; - value = (pm_read48(offset >> 3) >> ((frac^7) * 8)) & 0xff; - break; - } - case 8: - { - value = pm_read48(offset >> 3); - break; - } - } - } - else - { - value = 0; - } - } - else if (spacenum == AS_DATA) - { - int address = offset >> 2; - - if (address >= 0x20000) - { - switch (size) - { - case 1: - { - int frac = offset & 3; - value = (dm_read32(offset >> 2) >> ((frac^3) * 8)) & 0xff; - break; - } - case 2: - { - int frac = (offset >> 1) & 1; - value = (dm_read32(offset >> 2) >> ((frac^1) * 16)) & 0xffff; - break; - } - case 4: - { - value = dm_read32(offset >> 2); - break; - } - } - } - else - { - value = 0; - } - } - return true; -} - -bool adsp21062_device::memory_readop(offs_t offset, int size, uint64_t &value) -{ - uint64_t mask = (size < 8) ? (((uint64_t)1 << (8 * size)) - 1) : ~(uint64_t)0; - int shift = 8 * (offset & 7); - offset >>= 3; - - if (offset >= 0x20000 && offset < 0x28000) - { - uint64_t op = ((uint64_t)(m_internal_ram_block0[((offset-0x20000) * 3) + 0]) << 32) | - ((uint64_t)(m_internal_ram_block0[((offset-0x20000) * 3) + 1]) << 16) | - ((uint64_t)(m_internal_ram_block0[((offset-0x20000) * 3) + 2]) << 0); - value = (op >> shift) & mask; - return true; - } - else if (offset >= 0x28000 && offset < 0x30000) - { - uint64_t op = ((uint64_t)(m_internal_ram_block1[((offset-0x28000) * 3) + 0]) << 32) | - ((uint64_t)(m_internal_ram_block1[((offset-0x28000) * 3) + 1]) << 16) | - ((uint64_t)(m_internal_ram_block1[((offset-0x28000) * 3) + 2]) << 0); - value = (op >> shift) & mask; - return true; - } - - return false; -} diff --git a/src/devices/cpu/sharc/sharc.h b/src/devices/cpu/sharc/sharc.h index 7d36321364b..51625c74a15 100644 --- a/src/devices/cpu/sharc/sharc.h +++ b/src/devices/cpu/sharc/sharc.h @@ -171,6 +171,17 @@ public: void enable_recompiler(); + DECLARE_READ64_MEMBER( pm0_r); + DECLARE_WRITE64_MEMBER(pm0_w); + DECLARE_READ64_MEMBER( pm1_r); + DECLARE_WRITE64_MEMBER(pm1_w); + DECLARE_READ32_MEMBER( dmw0_r); + DECLARE_WRITE32_MEMBER(dmw0_w); + DECLARE_READ32_MEMBER( dmw1_r); + DECLARE_WRITE32_MEMBER(dmw1_w); + DECLARE_READ32_MEMBER( iop_r); + DECLARE_WRITE32_MEMBER(iop_w); + enum ASTAT_FLAGS { // ASTAT flags @@ -257,16 +268,12 @@ protected: // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ); } - virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) override; - virtual bool memory_readop(offs_t offset, int size, uint64_t &value) override; // device_disasm_interface overrides virtual uint32_t disasm_min_opcode_bytes() const override { return 6; } virtual uint32_t disasm_max_opcode_bytes() const override { return 6; } virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; - direct_read_data *m_direct; - private: address_space_config m_program_config; address_space_config m_data_config; @@ -448,21 +455,18 @@ private: uml::code_handle *m_swap_r0_7; uml::code_handle *m_swap_r8_15; - uint16_t *m_internal_ram_block0, *m_internal_ram_block1; - address_space *m_program; address_space *m_data; - opcode_func m_sharc_op[512]; - uint16_t m_internal_ram[2 * 0x10000]; // 2x 128KB + required_shared_ptr m_block0, m_block1; + + opcode_func m_sharc_op[512]; bool m_enable_drc; inline void CHANGE_PC(uint32_t newpc); inline void CHANGE_PC_DELAYED(uint32_t newpc); void sharc_iop_delayed_w(uint32_t reg, uint32_t data, int cycles); - uint32_t sharc_iop_r(uint32_t address); - void sharc_iop_w(uint32_t address, uint32_t data); uint32_t pm_read32(uint32_t address); void pm_write32(uint32_t address, uint32_t data); uint64_t pm_read48(uint32_t address); diff --git a/src/devices/cpu/sharc/sharcdrc.cpp b/src/devices/cpu/sharc/sharcdrc.cpp index 5eaacd58b54..beefa289a6c 100644 --- a/src/devices/cpu/sharc/sharcdrc.cpp +++ b/src/devices/cpu/sharc/sharcdrc.cpp @@ -18,7 +18,6 @@ using namespace uml; #define USE_SWAPDQ 0 -#define WRITE_SNOOP 0 // map variables @@ -114,24 +113,13 @@ inline void adsp21062_device::alloc_handle(drcuml_state *drcuml, code_handle **h + static void cfunc_unimplemented(void *param) { adsp21062_device *sharc = (adsp21062_device *)param; sharc->sharc_cfunc_unimplemented(); } -static void cfunc_read_iop(void *param) -{ - adsp21062_device *sharc = (adsp21062_device *)param; - sharc->sharc_cfunc_read_iop(); -} - -static void cfunc_write_iop(void *param) -{ - adsp21062_device *sharc = (adsp21062_device *)param; - sharc->sharc_cfunc_write_iop(); -} - static void cfunc_pcstack_overflow(void *param) { adsp21062_device *sharc = (adsp21062_device *)param; @@ -180,21 +168,6 @@ static void cfunc_unimplemented_shiftimm(void *param) sharc->sharc_cfunc_unimplemented_shiftimm(); } - -#if WRITE_SNOOP -void adsp21062_device::sharc_cfunc_write_snoop() -{ - printf("Write %08X to %08X at %08X\n", m_core->arg0, m_core->arg1, m_core->arg2); -} - -static void cfunc_write_snoop(void *param) -{ - adsp21062_device *sharc = (adsp21062_device *)param; - sharc->sharc_cfunc_write_snoop(); -} -#endif - - void adsp21062_device::sharc_cfunc_unimplemented() { uint64_t op = m_core->arg64; @@ -213,16 +186,6 @@ void adsp21062_device::sharc_cfunc_unimplemented_shiftimm() fatalerror("PC=%08X: Unimplemented shiftimm %04X%08X\n", m_core->pc, (uint32_t)(op >> 32), (uint32_t)(op)); } -void adsp21062_device::sharc_cfunc_read_iop() -{ - m_core->arg1 = sharc_iop_r(m_core->arg0); -} - -void adsp21062_device::sharc_cfunc_write_iop() -{ - sharc_iop_w(m_core->arg0, m_core->arg1); -} - void adsp21062_device::sharc_cfunc_pcstack_overflow() { fatalerror("SHARC: PCStack overflow"); @@ -334,16 +297,6 @@ void adsp21062_device::static_generate_memory_accessor(MEM_ACCESSOR_TYPE type, c { // I0 = read/write data // I1 = address - // I2 is trashed - - void* block0 = &m_internal_ram_block0[0]; - void* block0_1 = &m_internal_ram_block0[1]; - void* block0_2 = &m_internal_ram_block0[2]; - void* block1 = &m_internal_ram_block1[0]; - void* block1_1 = &m_internal_ram_block1[1]; - void* block1_2 = &m_internal_ram_block1[2]; - - code_label label = 1; drcuml_block *block = m_drcuml->begin_block(1024); @@ -354,298 +307,35 @@ void adsp21062_device::static_generate_memory_accessor(MEM_ACCESSOR_TYPE type, c switch (type) { case MEM_ACCESSOR_PM_READ48: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label1 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label1 - - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_DLOAD(block, I0, block0, I1, SIZE_WORD, SCALE_x2); // dload i0,[block0],i1,word,scale_x2 - UML_DSHL(block, I0, I0, 32); // dshl i0,i0,32 - UML_DLOAD(block, I2, block0_1, I1, SIZE_WORD, SCALE_x2); // dload i2,[block0_1],i1,word,scale_x2 - UML_DSHL(block, I2, I2, 16); // dshl i2,i2,16 - UML_DOR(block, I0, I0, I2); // dor i0,i0,i2 - UML_DLOAD(block, I2, block0_2, I1, SIZE_WORD, SCALE_x2); // dload i2,[block0_2],i1,word,scale_x2 - UML_DOR(block, I0, I0, I2); // dor i0,i0,i2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label2 - - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff (block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff) - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_DLOAD(block, I0, block1, I1, SIZE_WORD, SCALE_x2); // dload i0,[block1],i1,word,scale_x2 - UML_DSHL(block, I0, I0, 32); // dshl i0,i0,32 - UML_DLOAD(block, I2, block1_1, I1, SIZE_WORD, SCALE_x2); // dload i2,[block1_1],i1,word,scale_x2 - UML_DSHL(block, I2, I2, 16); // dshl i2,i2,16 - UML_DOR(block, I0, I0, I2); // dor i0,i0,i2 - UML_DLOAD(block, I2, block1_2, I1, SIZE_WORD, SCALE_x2); // dload i2,[block1_2],i1,word,scale_x2 - UML_DOR(block, I0, I0, I2); // dor i0,i0,i2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label2: + UML_SHL(block, I1, I1, 3); + UML_READ(block, I0, I1, SIZE_QWORD, SPACE_PROGRAM); break; case MEM_ACCESSOR_PM_WRITE48: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label1 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label1 - - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_DSTORE(block, block0_2, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block0_2],i1,i0,word,scale_x2 - UML_DSHR(block, I0, I0, 16); // dshr i0,i0,16 - UML_DSTORE(block, block0_1, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block0_1],i1,i0,word,scale_x2 - UML_DSHR(block, I0, I0, 16); // dshr i0,i0,16 - UML_DSTORE(block, block0, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block0],i1,i0,word,scale_x2 + UML_SHL(block, I1, I1, 3); + UML_WRITE(block, I1, I0, SIZE_QWORD, SPACE_PROGRAM); UML_MOV(block, mem(&m_core->force_recompile), 1); - UML_RET(block); // ret - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label2 - - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff (block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff) - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_DSTORE(block, block1_2, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block1_2],i1,i0,word,scale_x2 - UML_DSHR(block, I0, I0, 16); // dshr i0,i0,16 - UML_DSTORE(block, block1_1, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block1_1],i1,i0,word,scale_x2 - UML_DSHR(block, I0, I0, 16); // dshr i0,i0,16 - UML_DSTORE(block, block1, I1, I0, SIZE_WORD, SCALE_x2); // dstore [block1],i1,i0,word,scale_x2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label2: break; case MEM_ACCESSOR_PM_READ32: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label1 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label1 - - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_LOAD(block, I0, block0, I1, SIZE_WORD, SCALE_x2); // load i0,[block0],i1,word,scale_x2 - UML_SHL(block, I0, I0, 16); // shl i0,i0,16 - UML_LOAD(block, I2, block0_1, I1, SIZE_WORD, SCALE_x2); // load i2,[block0_1],i1,word,scale_x2 - UML_OR(block, I0, I0, I2); // or i0,i0,i2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label2 - - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff (block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff) - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_LOAD(block, I0, block1, I1, SIZE_WORD, SCALE_x2); // load i0,[block1],i1,word,scale_x2 - UML_SHL(block, I0, I0, 16); // shl i0,i0,16 - UML_LOAD(block, I2, block1_1, I1, SIZE_WORD, SCALE_x2); // load i2,[block1_1],i1,word,scale_x2 - UML_OR(block, I0, I0, I2); // or i0,i0,i2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label2: + UML_SHL(block, I1, I1, 3); + UML_READ(block, I0, I1, SIZE_DWORD, SPACE_PROGRAM); break; case MEM_ACCESSOR_PM_WRITE32: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label1 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label1 - - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_STORE(block, block0_1, I1, I0, SIZE_WORD, SCALE_x2); // store [block0_1],i1,i0,word,scale_x2 - UML_SHR(block, I0, I0, 16); // shr i0,i0,16 - UML_STORE(block, block0, I1, I0, SIZE_WORD, SCALE_x2); // store [block0],i1,i0,word,scale_x2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label2 - - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff (block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff) - UML_MULS(block, I1, I1, I1, 3); // muls i1,3 - UML_STORE(block, block1_1, I1, I0, SIZE_WORD, SCALE_x2); // store [block1_1],i1,i0,word,scale_x2 - UML_SHR(block, I0, I0, 16); // shr i0,i0,16 - UML_STORE(block, block1, I1, I0, SIZE_WORD, SCALE_x2); // store [block1],i1,i0,word,scale_x2 - UML_RET(block); // ret - - UML_LABEL(block, label++); // label2: + UML_SHL(block, I1, I1, 3); + UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_PROGRAM); + UML_MOV(block, mem(&m_core->force_recompile), 1); break; case MEM_ACCESSOR_DM_READ32: - UML_CMP(block, I1, IRAM_END); // cmp i1,IRAM_END - UML_JMPc(block, COND_BE, label); // jbe label1 - // 0x80000 ... - UML_SHL(block, I1, I1, 2); // shl i1,i1,2 - UML_READ(block, I0, I1, SIZE_DWORD, SPACE_DATA); // read i0,i1,dword,SPACE_DATA - UML_RET(block); - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label2 - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_LOAD(block, I0, block0, I1, SIZE_WORD, SCALE_x4); // load i0,[block0],i1,word,scale_x4 - UML_SHL(block, I0, I0, 16); // shl i0,i0,16 - UML_LOAD(block, I2, block0_1, I1, SIZE_WORD, SCALE_x4); // load i2,[block0_1],i1,word,scale_x4 - UML_OR(block, I0, I0, I2); // or i0,i0,i2 - UML_RET(block); - - UML_LABEL(block, label++); // label2: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label3 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label3 - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_LOAD(block, I0, block1, I1, SIZE_WORD, SCALE_x4); // load i0,[block1],i1,word,scale_x4 - UML_SHL(block, I0, I0, 16); // shl i0,i0,16 - UML_LOAD(block, I2, block1_1, I1, SIZE_WORD, SCALE_x4); // load i2,[block1_1],i1,word,scale_x4 - UML_OR(block, I0, I0, I2); // or i0,i0,i2 - UML_RET(block); - - UML_LABEL(block, label++); // Label3: - UML_CMP(block, I1, IOP_REGISTER_END); // cmp i1,IOP_REGISTER_END - UML_JMPc(block, COND_A, label); // ja label4 - // IOP registers - UML_MOV(block, mem(&m_core->arg0), I1); // mov [m_core->arg0],i1 - UML_CALLC(block, cfunc_read_iop, this); // callc cfunc_read_iop - UML_MOV(block, I0, mem(&m_core->arg1)); // mov i0,[m_core->arg1] - UML_RET(block); - - UML_LABEL(block, label++); // label4: - UML_CMP(block, I1, IRAM_SHORT_BLOCK0_START); // cmp i1,IRAM_SHORT_BLOCK0_START - UML_JMPc(block, COND_B, label+1); // jb label6 - UML_CMP(block, I1, IRAM_SHORT_BLOCK0_END); // cmp i1,IRAM_SHORT_BLOCK0_END - UML_JMPc(block, COND_A, label+1); // ja label6 - // 0x40000 ... 0x4ffff - UML_AND(block, I1, I1, 0xffff); // and i1,i1,0xffff - UML_XOR(block, I1, I1, 1); // xor i1,i1,1 - UML_TEST(block, mem(&m_core->mode1), 0x4000); // test [m_core->mode1],0x4000 - UML_JMPc(block, COND_Z, label); // jz label5 - UML_LOADS(block, I0, block0, I1, SIZE_WORD, SCALE_x2); // loads i0,[block0],i1,word,scale_x2 - UML_RET(block); - UML_LABEL(block, label++); // label5: - UML_LOAD(block, I0, block0, I1, SIZE_WORD, SCALE_x2); // load i0,[block0],i1,word,scale_x2 - UML_RET(block); - - UML_LABEL(block, label++); // label6: - UML_CMP(block, I1, IRAM_SHORT_BLOCK1_START); // cmp i1,IRAM_SHORT_BLOCK1_START - UML_JMPc(block, COND_B, label+1); // jb label8 - UML_CMP(block, I1, IRAM_SHORT_BLOCK1_END); // cmp i1,IRAM_SHORT_BLOCK1_END - UML_JMPc(block, COND_A, label+1); // ja label8 - // 0x50000 ... 0x7ffff - UML_AND(block, I1, I1, 0xffff); // and i1,i1,0xffff - UML_XOR(block, I1, I1, 1); // xor i1,i1,1 - UML_TEST(block, mem(&m_core->mode1), 0x4000); // test [m_core->mode1],0x4000 - UML_JMPc(block, COND_Z, label); // jz label7 - UML_LOADS(block, I0, block1, I1, SIZE_WORD, SCALE_x2); // loads i0,[block1],i1,word,scale_x2 - UML_RET(block); - UML_LABEL(block, label++); // label7: - UML_LOAD(block, I0, block1, I1, SIZE_WORD, SCALE_x2); // load i0,[block1],i1,word,scale_x2 - UML_RET(block); - - UML_LABEL(block, label++); // label8: + UML_SHL(block, I1, I1, 2); + UML_READ(block, I0, I1, SIZE_DWORD, SPACE_DATA); break; case MEM_ACCESSOR_DM_WRITE32: -#if WRITE_SNOOP - //UML_CMP(block, I1, 0x283eb); - UML_CMP(block, I1, 0x2400047); - UML_JMPc(block, COND_NE, label); - UML_MOV(block, mem(&m_core->arg0), I0); - UML_MOV(block, mem(&m_core->arg1), I1); - UML_MOV(block, mem(&m_core->arg2), mem(&m_core->pc)); - UML_CALLC(block, cfunc_write_snoop, this); - UML_LABEL(block, label++); -#endif - - - UML_CMP(block, I1, IRAM_END); // cmp i1,IRAM_END - UML_JMPc(block, COND_BE, label); // jbe label1 - // 0x80000 ... - UML_SHL(block, I1, I1, 2); // shl i1,i1,2 - UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_DATA); // write i1,i0,dword,SPACE_DATA - UML_RET(block); - - UML_LABEL(block, label++); // label1: - UML_CMP(block, I1, IRAM_BLOCK0_START); // cmp i1,IRAM_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label2 - UML_CMP(block, I1, IRAM_BLOCK0_END); // cmp i1,IRAM_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label2 - // 0x20000 ... 0x27fff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_STORE(block, block0_1, I1, I0, SIZE_WORD, SCALE_x4); // store [block0_1],i1,i0,word,scale_x4 - UML_SHR(block, I0, I0, 16); // shr i0,i0,16 - UML_STORE(block, block0, I1, I0, SIZE_WORD, SCALE_x4); // store [block0],i1,i0,word,scale_x4 - UML_RET(block); - - UML_LABEL(block, label++); // label2: - UML_CMP(block, I1, IRAM_BLOCK1_START); // cmp i1,IRAM_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label3 - UML_CMP(block, I1, IRAM_BLOCK1_END); // cmp i1,IRAM_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label3 - // 0x28000 ... 0x3ffff - UML_AND(block, I1, I1, 0x7fff); // and i1,i1,0x7fff - UML_STORE(block, block1_1, I1, I0, SIZE_WORD, SCALE_x4); // store [block1_1],i1,i0,word,scale_x4 - UML_SHR(block, I0, I0, 16); // shr i0,i0,16 - UML_STORE(block, block1, I1, I0, SIZE_WORD, SCALE_x4); // store [block1],i1,i0,word,scale_x4 - UML_RET(block); - - UML_LABEL(block, label++); // Label3: - UML_CMP(block, I1, IOP_REGISTER_END); // cmp i1,IOP_REGISTER_END - UML_JMPc(block, COND_A, label); // ja label4 - // IOP registers - UML_MOV(block, mem(&m_core->arg0), I1); // mov [m_core->arg0],i1 - UML_MOV(block, mem(&m_core->arg1), I0); // mov [m_core->arg1],i0 - UML_CALLC(block, cfunc_write_iop, this); // callc cfunc_write_iop - UML_RET(block); - - UML_LABEL(block, label++); // label4: - UML_CMP(block, I1, IRAM_SHORT_BLOCK0_START); // cmp i1,IRAM_SHORT_BLOCK0_START - UML_JMPc(block, COND_B, label); // jb label5 - UML_CMP(block, I1, IRAM_SHORT_BLOCK0_END); // cmp i1,IRAM_SHORT_BLOCK0_END - UML_JMPc(block, COND_A, label); // ja label5 - // 0x40000 ... 0x4ffff - UML_AND(block, I1, I1, 0xffff); // and i1,i1,0xffff - UML_XOR(block, I1, I1, 1); // xor i1,i1,1 - UML_STORE(block, block0, I1, I0, SIZE_WORD, SCALE_x2); // store [block0],i1,i0,word,scale_x2 - UML_RET(block); - - UML_LABEL(block, label++); // label5: - UML_CMP(block, I1, IRAM_SHORT_BLOCK1_START); // cmp i1,IRAM_SHORT_BLOCK1_START - UML_JMPc(block, COND_B, label); // jb label6 - UML_CMP(block, I1, IRAM_SHORT_BLOCK1_END); // cmp i1,IRAM_SHORT_BLOCK1_END - UML_JMPc(block, COND_A, label); // ja label6 - // 0x50000 ... 0x7ffff - UML_AND(block, I1, I1, 0xffff); // and i1,i1,0xffff - UML_XOR(block, I1, I1, 1); // xor i1,i1,1 - UML_STORE(block, block1, I1, I0, SIZE_WORD, SCALE_x2); // store [block1],i1,i0,word,scale_x2 - UML_RET(block); - - UML_LABEL(block, label++); // label6: + UML_SHL(block, I1, I1, 2); + UML_WRITE(block, I1, I0, SIZE_DWORD, SPACE_DATA); break; } diff --git a/src/devices/cpu/sharc/sharcmem.hxx b/src/devices/cpu/sharc/sharcmem.hxx index d415fe0b04b..b297799c036 100644 --- a/src/devices/cpu/sharc/sharcmem.hxx +++ b/src/devices/cpu/sharc/sharcmem.hxx @@ -4,201 +4,30 @@ uint32_t adsp21062_device::pm_read32(uint32_t address) { - if (address >= 0x20000 && address < 0x28000) - { - uint32_t addr = (address & 0x7fff) * 3; - - return (uint32_t)(m_internal_ram_block0[addr + 0] << 16) | - (m_internal_ram_block0[addr + 1]); - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 3; - - return (uint32_t)(m_internal_ram_block1[addr + 0] << 16) | - (m_internal_ram_block1[addr + 1]); - } - else { - fatalerror("SHARC: PM Bus Read32 %08X at %08X\n", address, m_core->pc); - } + return m_program->read_dword(address << 3); } void adsp21062_device::pm_write32(uint32_t address, uint32_t data) { - if (address >= 0x20000 && address < 0x28000) - { - uint32_t addr = (address & 0x7fff) * 3; - - m_internal_ram_block0[addr + 0] = (uint16_t)(data >> 16); - m_internal_ram_block0[addr + 1] = (uint16_t)(data); - return; - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 3; - - m_internal_ram_block1[addr + 0] = (uint16_t)(data >> 16); - m_internal_ram_block1[addr + 1] = (uint16_t)(data); - return; - } - else { - fatalerror("SHARC: PM Bus Write32 %08X, %08X at %08X\n", address, data, m_core->pc); - } + m_program->write_dword(address << 3, data); } uint64_t adsp21062_device::pm_read48(uint32_t address) { - if ((address >= 0x20000 && address < 0x28000)) - { - uint32_t addr = (address & 0x7fff) * 3; - - return ((uint64_t)(m_internal_ram_block0[addr + 0]) << 32) | - ((uint64_t)(m_internal_ram_block0[addr + 1]) << 16) | - ((uint64_t)(m_internal_ram_block0[addr + 2]) << 0); - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 3; - - return ((uint64_t)(m_internal_ram_block1[addr + 0]) << 32) | - ((uint64_t)(m_internal_ram_block1[addr + 1]) << 16) | - ((uint64_t)(m_internal_ram_block1[addr + 2]) << 0); - } - else { - fatalerror("SHARC: PM Bus Read48 %08X at %08X\n", address, m_core->pc); - } - - return 0; + return m_program->read_qword(address << 3); } void adsp21062_device::pm_write48(uint32_t address, uint64_t data) { - if ((address >= 0x20000 && address < 0x28000)) - { - uint32_t addr = (address & 0x7fff) * 3; - - m_internal_ram_block0[addr + 0] = (uint16_t)(data >> 32); - m_internal_ram_block0[addr + 1] = (uint16_t)(data >> 16); - m_internal_ram_block0[addr + 2] = (uint16_t)(data); - return; - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 3; - - m_internal_ram_block1[addr + 0] = (uint16_t)(data >> 32); - m_internal_ram_block1[addr + 1] = (uint16_t)(data >> 16); - m_internal_ram_block1[addr + 2] = (uint16_t)(data); - return; - } - else { - fatalerror("SHARC: PM Bus Write48 %08X, %04X%08X at %08X\n", address, (uint16_t)(data >> 32),(uint32_t)data, m_core->pc); - } + m_program->write_qword(address << 3, data); } uint32_t adsp21062_device::dm_read32(uint32_t address) { - if (address < 0x100) - { - return sharc_iop_r(address); - } - else if (address >= 0x20000 && address < 0x28000) - { - uint32_t addr = (address & 0x7fff) * 2; - - return (uint32_t)(m_internal_ram_block0[addr + 0] << 16) | - (m_internal_ram_block0[addr + 1]); - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 2; - - return (uint32_t)(m_internal_ram_block1[addr + 0] << 16) | - (m_internal_ram_block1[addr + 1]); - } - - // short word addressing - else if (address >= 0x40000 && address < 0x50000) - { - uint32_t addr = address & 0xffff; - - uint16_t r = m_internal_ram_block0[addr ^ 1]; - if (m_core->mode1 & 0x4000) - { - // sign-extend - return (int32_t)(int16_t)(r); - } - else - { - return (uint32_t)(r); - } - } - else if (address >= 0x50000 && address < 0x80000) - { - // block 1 is mirrored in 0x50000...5ffff, 0x60000...0x6ffff and 0x70000...7ffff - uint32_t addr = address & 0xffff; - - uint16_t r = m_internal_ram_block1[addr ^ 1]; - if (m_core->mode1 & 0x4000) - { - // sign-extend - return (int32_t)(int16_t)(r); - } - else - { - return (uint32_t)(r); - } - } - return m_data->read_dword(address << 2); } void adsp21062_device::dm_write32(uint32_t address, uint32_t data) { - if (address < 0x100) - { - sharc_iop_w(address, data); - return; - } - else if (address >= 0x20000 && address < 0x28000) - { - uint32_t addr = (address & 0x7fff) * 2; - - m_internal_ram_block0[addr + 0] = (uint16_t)(data >> 16); - m_internal_ram_block0[addr + 1] = (uint16_t)(data); - return; - } - else if (address >= 0x28000 && address < 0x40000) - { - // block 1 is mirrored in 0x28000...2ffff, 0x30000...0x37fff and 0x38000...3ffff - uint32_t addr = (address & 0x7fff) * 2; - - m_internal_ram_block1[addr + 0] = (uint16_t)(data >> 16); - m_internal_ram_block1[addr + 1] = (uint16_t)(data); - return; - } - - // short word addressing - else if (address >= 0x40000 && address < 0x50000) - { - uint32_t addr = address & 0xffff; - - m_internal_ram_block0[addr ^ 1] = data; - return; - } - else if (address >= 0x50000 && address < 0x80000) - { - // block 1 is mirrored in 0x50000...5ffff, 0x60000...0x6ffff and 0x70000...7ffff - uint32_t addr = address & 0xffff; - - m_internal_ram_block1[addr ^ 1] = data; - return; - } - m_data->write_dword(address << 2, data); } diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 9f2418869d4..e344e2cf5ff 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -878,6 +878,7 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) /* dump opcodes in qwords from a qword-sized bus */ case 88: + case 86: // sharc case, 48-bits opcodes break; default: @@ -925,6 +926,7 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) break; case 8: + case 6: result = space.direct().read_qword(address & ~7, addrxor); if (!QWORD_ALIGNED(address)) { @@ -3426,6 +3428,7 @@ void device_debug::tracer::update(offs_t pc) // log this PC m_nextdex = (m_nextdex + 1) % TRACE_LOOPS; m_history[m_nextdex] = pc; + fflush(&m_file); } @@ -3437,6 +3440,7 @@ void device_debug::tracer::vprintf(const char *format, va_list va) { // pass through to the file vfprintf(&m_file, format, va); + fflush(&m_file); } From dcca025d277792977f8164f14a4d1603ed5daae5 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 9 Dec 2016 23:54:22 +0100 Subject: [PATCH 19/82] notes (nw) --- src/mame/drivers/fidel6502.cpp | 6 +++--- src/mame/drivers/hh_amis2k.cpp | 2 +- src/mame/drivers/neodriv.hxx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 58cb5c1d220..311f796abce 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -2129,7 +2129,7 @@ ROM_START( fscc12 ) ROM_END -ROM_START( fexcel ) // PCB label 510.1117A02 +ROM_START( fexcel ) // model 6080(B), PCB label 510.1117A02 ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-1080a01.ic5", 0x8000, 0x8000, CRC(846f8e40) SHA1(4e1d5b08d5ff3422192b54fa82cb3f505a69a971) ) // same as fexcelv ROM_END @@ -2144,12 +2144,12 @@ ROM_START( fexcelv ) // model 6092, PCB label 510.1117A02, sound PCB 510.1117A01 ROM_LOAD("101-1081a01.ic2", 0x0000, 0x8000, CRC(c8ae1607) SHA1(6491ce6be60ed77f3dd931c0ca17616f13af943e) ) // PCB2, M27256 ROM_END -ROM_START( fexcela ) // PCB label 510-1099A01 +ROM_START( fexcela ) // model 6080, PCB label 510-1099A01(manuf.1985) or 510-1099B01(manuf.1986) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-1072a01.ic5", 0xc000, 0x4000, CRC(212b006d) SHA1(242ff851b0841cbec66bbada6a730da021010e2c) ) ROM_END -ROM_START( fexcelb ) // PCB label 510-1099A01 +ROM_START( fexcelb ) // model EP12, PCB label 510-1099A01 ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD("101-1072b01.ic5", 0xc000, 0x4000, CRC(fd2f6064) SHA1(f84bb98bdb9565a04891eb6820597d7aecc90c21) ) // RCA ROM_END diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp index 1e206747b24..92ddc8343df 100644 --- a/src/mame/drivers/hh_amis2k.cpp +++ b/src/mame/drivers/hh_amis2k.cpp @@ -337,7 +337,7 @@ MACHINE_CONFIG_END ROM_START( wildfire ) ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums) + ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums). 1st half was dumped/verfied too. ROM_CONTINUE( 0x0600, 0x0200 ) ROM_END diff --git a/src/mame/drivers/neodriv.hxx b/src/mame/drivers/neodriv.hxx index 0bac5419773..9f73e5e211e 100644 --- a/src/mame/drivers/neodriv.hxx +++ b/src/mame/drivers/neodriv.hxx @@ -8730,7 +8730,7 @@ GAME( 1998, rbff2, neogeo, neobase, neogeo, neogeo_state, neogeo, R GAME( 1998, rbff2h, rbff2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers / Real Bout Garou Densetsu 2 - The Newcomers (NGH-2400)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2k, rbff2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers (Korean release)", MACHINE_SUPPORTS_SAVE ) // no Japanese title / mode GAME( 1998, mslug2, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Metal Slug 2 - Super Vehicle-001/II (NGM-2410 ~ NGH-2410)", MACHINE_SUPPORTS_SAVE ) -GAME( 2015, mslug2t, mslug2, neobase, neogeo, neogeo_state, neogeo, ROT0, "Hack", "Metal Slug 2 Turbo (NGM-9410)", MACHINE_SUPPORTS_SAVE ) +GAME( 2015, mslug2t, mslug2, neobase, neogeo, neogeo_state, neogeo, ROT0, "hack (trap15)", "Metal Slug 2 Turbo (NGM-9410) (hack)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, kof98, neogeo, kof98, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '98 - The Slugfest / King of Fighters '98 - Dream Match Never Ends (NGM-2420)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, kof98a, kof98, kof98, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '98 - The Slugfest / King of Fighters '98 - Dream Match Never Ends (NGM-2420, alt board)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, kof98k, kof98, kof98, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '98 - The Slugfest / King of Fighters '98 - Dream Match Never Ends (Korean board)", MACHINE_SUPPORTS_SAVE ) From 091b93238defe4a900c6cde5c7230b9720db7437 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sat, 10 Dec 2016 10:13:49 +1100 Subject: [PATCH 20/82] MT 06449 --- src/mame/audio/8080bw.cpp | 1 + src/mame/drivers/8080bw.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mame/audio/8080bw.cpp b/src/mame/audio/8080bw.cpp index 6b13793cd97..8928b1468bf 100644 --- a/src/mame/audio/8080bw.cpp +++ b/src/mame/audio/8080bw.cpp @@ -66,6 +66,7 @@ WRITE8_MEMBER(_8080bw_state::invadpt2_sh_port_2_w) if (rising_bits & 0x10) m_samples->start(3, 7); /* SAUCER HIT */ m_flip_screen = BIT(data, 5) & ioport(CABINET_PORT_TAG)->read(); + m_color_map = BIT(data, 5); m_port_2_last_extra = data; } diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp index 06c59042977..eaf560cd476 100644 --- a/src/mame/drivers/8080bw.cpp +++ b/src/mame/drivers/8080bw.cpp @@ -3815,8 +3815,8 @@ ROM_START( moonbase ) ROM_LOAD( "ze3-10.f5", 0x4400, 0x0400, CRC(1e7c22a4) SHA1(b34173375494ffbf5400dd4014a683a9807f4f08) ) ROM_REGION( 0x0800, "proms", 0 ) /* color maps player 1/player 2 */ - ROM_LOAD( "cv02.h7", 0x0000, 0x0400, CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) /* NEC B406 or compatible BPROM, like the 82S137 */ - ROM_LOAD( "cv01.g7", 0x0400, 0x0400, CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) /* NEC B406 or compatible BPROM, like the 82S137 */ + ROM_LOAD( "cv02.h7", 0x0400, 0x0400, CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) /* NEC B406 or compatible BPROM, like the 82S137 */ + ROM_LOAD( "cv01.g7", 0x0000, 0x0400, CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) /* NEC B406 or compatible BPROM, like the 82S137 */ ROM_END ROM_START( moonbasea ) @@ -3833,8 +3833,8 @@ ROM_START( moonbasea ) ROM_LOAD( "ze3-10.f5", 0x4400, 0x0400, CRC(1e7c22a4) SHA1(b34173375494ffbf5400dd4014a683a9807f4f08) ) ROM_REGION( 0x0800, "proms", 0 ) /* color maps player 1/player 2 */ - ROM_LOAD( "cv02.h7", 0x0000, 0x0400, CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) /* NEC B406 or compatible BPROM, like the 82S137 */ - ROM_LOAD( "cv01.g7", 0x0400, 0x0400, CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) /* NEC B406 or compatible BPROM, like the 82S137 */ + ROM_LOAD( "cv02.h7", 0x0400, 0x0400, CRC(2bdf83a0) SHA1(01ffbd43964c41987e7d44816271308f9a70802b) ) /* NEC B406 or compatible BPROM, like the 82S137 */ + ROM_LOAD( "cv01.g7", 0x0000, 0x0400, CRC(aac24f34) SHA1(ad110e776547fb48baac568bb50d61854537ca34) ) /* NEC B406 or compatible BPROM, like the 82S137 */ ROM_END From b043dc7a182eb1ee11b85e8f6046f63f85f9b0c0 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Sat, 10 Dec 2016 00:58:50 +0100 Subject: [PATCH 21/82] -tnzs: Added Taito M-Chip M-001 dump for extrmatn. Also works for drtoppel and plumppop. [Caps0ff] --- src/mame/drivers/tnzs.cpp | 215 ++++++----------- src/mame/includes/tnzs.h | 38 +-- src/mame/machine/tnzs.cpp | 495 +++++++++++--------------------------- 3 files changed, 235 insertions(+), 513 deletions(-) diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp index c24812c04da..aab52b46744 100644 --- a/src/mame/drivers/tnzs.cpp +++ b/src/mame/drivers/tnzs.cpp @@ -413,7 +413,7 @@ TODO: - Find out how the hardware credit-counter works (MPU) - Fix MCU simulation errors : * avoid credits to be increased when in "test mode" to avoid coin lockout - (needed to complete special test mode in 'extermatn' and 'arknoid2') + (needed to complete special test mode in 'extrmatn' and 'arknoid2') * why are credits limited to 9 in some games ? pressing SERVICE1 allows to go up to 100 and cause this : . 'plumppop' : freeze @@ -770,12 +770,23 @@ static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w) AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) - AM_RANGE(0xc000, 0xc001) AM_READWRITE(tnzs_mcu_r, tnzs_mcu_w) /* not present in insectx */ + AM_RANGE(0xc000, 0xc001) AM_READWRITE(mcu_r, mcu_w) /* not present in insectx */ + AM_RANGE(0xd000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") + AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) /* paddles in arkanoid2/plumppop. The ports are */ + /* read but not used by the other games, and are not read at */ + /* all by insectx. */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( arknoid2_sub_map, AS_PROGRAM, 8, tnzs_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") + AM_RANGE(0xa000, 0xa000) AM_WRITE(arknoid2_mcu_reset_w) + AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) + AM_RANGE(0xc000, 0xc001) AM_READWRITE(arknoid2_mcu_r, arknoid2_mcu_w) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) /* paddles in arkanoid2/plumppop. The ports are */ - /* read but not used by the other games, and are not read at */ - /* all by insectx. */ ADDRESS_MAP_END static ADDRESS_MAP_START( kageki_sub_map, AS_PROGRAM, 8, tnzs_state ) @@ -846,14 +857,13 @@ static ADDRESS_MAP_START( tnzsb_io_map, AS_IO, 8, tnzs_state ) AM_RANGE(0x02, 0x02) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END -static ADDRESS_MAP_START( i8742_io_map, AS_IO, 8, tnzs_state ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(tnzs_port1_r) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(tnzs_port2_r, tnzs_port2_w) +static ADDRESS_MAP_START( i8742_map, AS_IO, 8, tnzs_state ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(mcu_port1_r) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_port2_r, mcu_port2_w) AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_PORT("COIN1") AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_PORT("COIN2") ADDRESS_MAP_END - static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8) @@ -1538,101 +1548,7 @@ WRITE_LINE_MEMBER(tnzs_state::irqhandler) m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); } -static MACHINE_CONFIG_START( arknoid2, tnzs_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, arknoid2_interrupt) - - MCFG_CPU_ADD("sub", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - - MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - - MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) /* verified on pcb */ - MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( drtoppel, tnzs_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz */ - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, arknoid2_interrupt) - - MCFG_CPU_ADD("sub", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz */ - MCFG_CPU_PROGRAM_MAP(sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - - MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) -MACHINE_CONFIG_END - - static MACHINE_CONFIG_START( tnzs, tnzs_state ) - /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz */ MCFG_CPU_PROGRAM_MAP(main_map) @@ -1643,7 +1559,7 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state ) MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) MCFG_CPU_ADD("mcu", I8742, 12000000/2) /* 400KHz ??? - Main board Crystal is 12MHz */ - MCFG_CPU_IO_MAP(i8742_io_map) + MCFG_CPU_IO_MAP(i8742_map) MCFG_FRAGMENT_ADD(tnzs_mainbank) @@ -1678,6 +1594,25 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( extrmatn, tnzs ) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( arknoid2, tnzs ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, arknoid2_interrupt) + + MCFG_CPU_MODIFY("sub") + MCFG_CPU_PROGRAM_MAP(arknoid2_sub_map) + + MCFG_CPU_MODIFY("mcu") + MCFG_DEVICE_DISABLE() + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) +MACHINE_CONFIG_END static MACHINE_CONFIG_START( insectx, tnzs_state ) @@ -1907,8 +1842,8 @@ ROM_START( plumppop ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "a98-11.bin", 0x00000, 0x10000, CRC(bc56775c) SHA1(0c22c22c0e9d7ec0e34f8ab4bfe61068f65e8759) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "plmp8742.bin", 0x0000, 0x0800, NO_DUMP ) + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Chip label is a guess, also unknown if it actually uses the same MCU as drtoppel/extrmatn, but it appears to work fine */ ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "a98-01.bin", 0x00000, 0x10000, CRC(f3033dca) SHA1(130744998f0531a82de2814231dddea3ad710f60) ) @@ -1959,8 +1894,8 @@ ROM_START( extrmatn ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b06-19.4e", 0x00000, 0x10000, CRC(8de43ed9) SHA1(53e6d8fa93889c38733d169e983f2caf1da71f43) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) ) @@ -1981,8 +1916,8 @@ ROM_START( extrmatnu ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b06-22.4e", 0x00000, 0x10000, CRC(744f2c84) SHA1(7565c1594c2a3bae1ae45afcbf93363fe2b12d58) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) ) @@ -2004,8 +1939,8 @@ ROM_START( extrmatnur ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b06_17", 0x00000, 0x10000, CRC(744f2c84) SHA1(7565c1594c2a3bae1ae45afcbf93363fe2b12d58) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) ) @@ -2026,8 +1961,8 @@ ROM_START( extrmatnj ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b06-07.4e", 0x00000, 0x10000, CRC(b37fb8b3) SHA1(10696914b9e39d34d56069a69b9d641339ea2309) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) ) @@ -2048,7 +1983,7 @@ ROM_START( arknoid2 ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b08_13.3e", 0x00000, 0x10000, CRC(e8035ef1) SHA1(9a54e952cff0036c4b6affd9ffb1097cdccbe255) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x80000, "gfx1", 0 ) @@ -2070,7 +2005,7 @@ ROM_START( arknoid2u ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b08_12.3e", 0x00000, 0x10000, CRC(dc84e27d) SHA1(d549d8c9fbec0521517f0c5f5cee763e27d48633) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x80000, "gfx1", 0 ) @@ -2092,7 +2027,7 @@ ROM_START( arknoid2j ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b08_06.3e", 0x00000, 0x10000, CRC(adfcd40c) SHA1(f91299407ed21e2dd244c9b1a315b27ed32f5514) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x80000, "gfx1", 0 ) @@ -2114,7 +2049,7 @@ ROM_START( arknoid2b ) ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */ ROM_LOAD( "b08_13.3e", 0x00000, 0x10000, CRC(e8035ef1) SHA1(9a54e952cff0036c4b6affd9ffb1097cdccbe255) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP ) ROM_REGION( 0x80000, "gfx1", 0 ) @@ -2136,8 +2071,8 @@ ROM_START( drtoppel ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b19-15.3e", 0x00000, 0x10000, CRC(37a0d3fb) SHA1(f65fb9382af5f5b09725c39b660c5138b3912f53) ) /* Hacked??, need correct Taito rom number */ - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "drt8742.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14, reused from Extermination, under printed label "Taito M-001, 128P, 720100" */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) ) @@ -2162,8 +2097,8 @@ ROM_START( drtoppelu ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b19-14.3e", 0x00000, 0x10000, CRC(05565b22) SHA1(d1aa47b438d3b44c5177337809e38b50f6445c36) ) /* Hacked??, need correct Taito rom number */ - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "drt8742.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14, reused from Extermination, under printed label "Taito M-001, 128P, 720100" */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) ) @@ -2188,8 +2123,8 @@ ROM_START( drtoppelj ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b19-11.3e", 0x00000, 0x10000, CRC(524dc249) SHA1(158b2de0fcd17ad16ba72bb24888122bf704e216) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* M-Chip (i8742 internal ROM) */ - ROM_LOAD( "drt8742.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14, reused from Extermination, under printed label "Taito M-001, 128P, 720100" */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ + ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */ ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) ) @@ -2326,7 +2261,7 @@ ROM_START( chukatai ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b44-12w", 0x00000, 0x10000, CRC(e80ecdca) SHA1(cd96403ca97f18f630118dcb3dc2179c01147213) ) /* Hacked??, need correct Taito rom number */ - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2348,7 +2283,7 @@ ROM_START( chukataiu ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b44-12u", 0x00000, 0x10000, CRC(9f09fd5c) SHA1(ae92f2e893e1e666dcabbd793f1a778c5e3d7bab) ) /* Hacked??, need correct Taito rom number */ - ROM_REGION( 0x1000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x1000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2370,7 +2305,7 @@ ROM_START( chukataij ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b44-12", 0x00000, 0x10000, CRC(0600ace6) SHA1(3d5767b91ea63128bfbff3527ddcf90fcf43af2e) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2517,7 +2452,7 @@ Taito ID: K1100356A Seta ID: P0-041A */ /* This pcb is similar but not identical to the Chuka Taisen pcb; - There is an M-chip i8742 (with Taito silkscreen) and no 3rd z80. + There is an M-chip i8x42 (with Taito silkscreen) and no 3rd z80. There is no daughter-pcb like the later TNZS pcb has. */ ROM_START( tnzsjo ) ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */ @@ -2526,7 +2461,7 @@ ROM_START( tnzsjo ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b53-11.27c512.u38", 0x00000, 0x10000, CRC(9784d443) SHA1(bc3647aac9974031dbe4898417fbaa99841f9548) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b53-09.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2554,7 +2489,7 @@ ROM_START( tnzsuo ) ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b53-13.27c512.u38", 0x00000, 0x10000, CRC(c09f4d28) SHA1(f1fd3202869738e17abcbb757f9ce7260707dd3d) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b53-09.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2574,14 +2509,14 @@ ROM_START( tnzsuo ) ROM_LOAD( "b06-101.pal16l8a.u36.jed", 0x03000, 0x01000, NO_DUMP) ROM_END - ROM_START( tnzso ) +ROM_START( tnzso ) ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */ ROM_LOAD( "b53-unknown.27c1001d.u32", 0x00000, 0x20000, CRC(edf3b39e) SHA1(be221c99e50795d569611dba454c3954a259a859) ) // ROM LABEL FOR THIS SET IS UNKNOWN ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "b53-unknown.27c512.u38", 0x00000, 0x10000, CRC(60340d63) SHA1(12a26d19dc8e407e502f25617a5a4c9cea131ce2) ) // ROM LABEL FOR THIS SET IS UNKNOWN - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b53-09.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2610,7 +2545,7 @@ ROM_START( tnzsop ) // prototype/location test version? ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ ROM_LOAD( "ns_e-3.27c512.u38", 0x00000, 0x10000, CRC(c7662e96) SHA1(be28298bfde4e3867cfe75633ffb0f8611dbbd8b) ) - ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8742 internal ROM) */ + ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */ ROM_LOAD( "b53-09.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) ) ROM_REGION( 0x100000, "gfx1", 0 ) @@ -2737,22 +2672,22 @@ ROM_END // YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1987, plumppop, 0, drtoppel, plumppop, tnzs_state, plumpop, ROT0, "Taito Corporation", "Plump Pop (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, plumppop, 0, extrmatn, plumppop, tnzs_state, plumpop, ROT0, "Taito Corporation", "Plump Pop (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1992, jpopnics, 0, jpopnics, jpopnics, driver_device, 0, ROT0, "Nics", "Jumping Pop (Nics, Korean hack of Plump Pop)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatn, 0, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation Japan", "Extermination (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnu, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito (World Games license)", "Extermination (US, World Games)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnur,extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito America Corporation (Romstar license)", "Extermination (US, Romstar)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnj, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatn, 0, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation Japan", "Extermination (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnu, extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito (World Games license)", "Extermination (US, World Games)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnur,extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito America Corporation (Romstar license)", "Extermination (US, Romstar)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnj, extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, arknoid2, 0, arknoid2, arknoid2, tnzs_state, arknoid2, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, arknoid2u, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, arknoid2j, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, arknoid2b, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "bootleg", "Arkanoid - Revenge of DOH (Japan bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, drtoppel, 0, drtoppel, drtoppel, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1987, drtoppelu, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1987, drtoppelj, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, drtoppel, 0, extrmatn, drtoppel, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1987, drtoppelu, drtoppel, extrmatn, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1987, drtoppelj, drtoppel, extrmatn, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, kageki, 0, kageki, kageki, tnzs_state, kageki, ROT90, "Kaneko / Taito America Corporation (Romstar license)", "Kageki (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, kagekij, kageki, kageki, kagekij, tnzs_state, kageki, ROT90, "Kaneko / Taito Corporation", "Kageki (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index 6e57dc0ff6c..1a7ff1d9052 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -12,16 +12,12 @@ enum { - MCU_NONE_INSECTX = 0, + MCU_ARKANOID_SIM = 0, + MCU_MCHIP_LLE, + MCU_NONE_INSECTX, MCU_NONE_KAGEKI, MCU_NONE_TNZSB, - MCU_NONE_KABUKIZ, - MCU_EXTRMATN, - MCU_ARKANOID, - MCU_PLUMPOP, - MCU_DRTOPPEL, - MCU_CHUKATAI, - MCU_TNZS + MCU_NONE_KABUKIZ }; class tnzs_state : public driver_device @@ -48,8 +44,9 @@ public: m_coin1(*this, "COIN1"), m_coin2(*this, "COIN2"), m_an1(*this, "AN1"), - m_an2(*this, "AN2") - { } + m_an2(*this, "AN2"), + m_lockout_level(false) + { } /* devices */ required_device m_maincpu; @@ -92,23 +89,26 @@ public: uint8_t m_mcu_coins_b; uint8_t m_mcu_credits; int m_bank2; + bool m_lockout_level; + + DECLARE_READ8_MEMBER(mcu_port1_r); + DECLARE_READ8_MEMBER(mcu_port2_r); + DECLARE_WRITE8_MEMBER(mcu_port2_w ); + DECLARE_READ8_MEMBER(mcu_r); + DECLARE_WRITE8_MEMBER(mcu_w); DECLARE_WRITE8_MEMBER(tnzsb_sound_command_w); DECLARE_WRITE8_MEMBER(jpopnics_subbankswitch_w); DECLARE_READ8_MEMBER(tnzs_port1_r); DECLARE_READ8_MEMBER(tnzs_port2_r); DECLARE_WRITE8_MEMBER(tnzs_port2_w); + DECLARE_WRITE8_MEMBER(extrmatn_port2_w); DECLARE_READ8_MEMBER(arknoid2_sh_f000_r); - DECLARE_READ8_MEMBER(tnzs_mcu_r); - DECLARE_WRITE8_MEMBER(tnzs_mcu_w); DECLARE_WRITE8_MEMBER(tnzs_ramrom_bankswitch_w); DECLARE_WRITE8_MEMBER(tnzs_bankswitch1_w); - DECLARE_READ8_MEMBER(mcu_tnzs_r); - DECLARE_WRITE8_MEMBER(mcu_tnzs_w); - DECLARE_READ8_MEMBER(mcu_arknoid2_r); - DECLARE_WRITE8_MEMBER(mcu_arknoid2_w); - DECLARE_READ8_MEMBER(mcu_extrmatn_r); - DECLARE_WRITE8_MEMBER(mcu_extrmatn_w); + DECLARE_READ8_MEMBER(arknoid2_mcu_r); + DECLARE_WRITE8_MEMBER(arknoid2_mcu_w); + DECLARE_WRITE8_MEMBER(arknoid2_mcu_reset_w); DECLARE_READ8_MEMBER(kageki_csport_r); DECLARE_WRITE8_MEMBER(kageki_csport_w); DECLARE_WRITE8_MEMBER(kabukiz_sound_bank_w); @@ -137,6 +137,6 @@ public: INTERRUPT_GEN_MEMBER(arknoid2_interrupt); - void mcu_reset(); + void arknoid2_mcu_reset(); void mcu_handle_coins(int coin); }; diff --git a/src/mame/machine/tnzs.cpp b/src/mame/machine/tnzs.cpp index 5359a4d0458..2119cfe2771 100644 --- a/src/mame/machine/tnzs.cpp +++ b/src/mame/machine/tnzs.cpp @@ -18,13 +18,9 @@ #include "cpu/mcs48/mcs48.h" #include "includes/tnzs.h" - - -READ8_MEMBER(tnzs_state::mcu_tnzs_r) +READ8_MEMBER(tnzs_state::mcu_r) { - uint8_t data; - - data = m_mcu->upi41_master_r(space, offset & 1); + uint8_t data = m_mcu->upi41_master_r(space, offset & 1); space.device().execute().yield(); // logerror("PC %04x: read %02x from mcu $c00%01x\n", space.device().safe_pcbase(), data, offset); @@ -32,19 +28,18 @@ READ8_MEMBER(tnzs_state::mcu_tnzs_r) return data; } -WRITE8_MEMBER(tnzs_state::mcu_tnzs_w) +WRITE8_MEMBER(tnzs_state::mcu_w) { // logerror("PC %04x: write %02x to mcu $c00%01x\n", space.device().safe_pcbase(), data, offset); m_mcu->upi41_master_w(space, offset & 1, data); } - -READ8_MEMBER(tnzs_state::tnzs_port1_r) +READ8_MEMBER(tnzs_state::mcu_port1_r) { int data = 0; - switch (m_input_select & 0x0f) + switch (m_input_select) { case 0x0a: data = m_in2->read(); break; case 0x0c: data = m_in0->read(); break; @@ -57,29 +52,21 @@ READ8_MEMBER(tnzs_state::tnzs_port1_r) return data; } -READ8_MEMBER(tnzs_state::tnzs_port2_r) +READ8_MEMBER(tnzs_state::mcu_port2_r) { - int data = m_in2->read(); - -// logerror("I8742:%04x Read %02x from port 2\n", space.device().safe_pcbase(), data); - - return data; + return m_in2->read(); } -WRITE8_MEMBER(tnzs_state::tnzs_port2_w) +WRITE8_MEMBER(tnzs_state::mcu_port2_w) { -// logerror("I8742:%04x Write %02x to port 2\n", space.device().safe_pcbase(), data); - - machine().bookkeeping().coin_lockout_w(0, (data & 0x40)); - machine().bookkeeping().coin_lockout_w(1, (data & 0x80)); + machine().bookkeeping().coin_lockout_w(0, (data & 0x40) != 0 ? m_lockout_level : !m_lockout_level); + machine().bookkeeping().coin_lockout_w(1, (data & 0x80) != 0 ? m_lockout_level : !m_lockout_level); machine().bookkeeping().coin_counter_w(0, (~data & 0x10)); machine().bookkeeping().coin_counter_w(1, (~data & 0x20)); - m_input_select = data; + m_input_select = data & 0xf; } - - READ8_MEMBER(tnzs_state::arknoid2_sh_f000_r) { // logerror("PC %04x: read input %04x\n", space.device().safe_pc(), 0xf000 + offset); @@ -93,7 +80,7 @@ READ8_MEMBER(tnzs_state::arknoid2_sh_f000_r) } -void tnzs_state::mcu_reset( ) +void tnzs_state::arknoid2_mcu_reset() { m_mcu_initializing = 3; m_mcu_coinage_init = 0; @@ -179,248 +166,6 @@ void tnzs_state::mcu_handle_coins( int coin ) m_insertcoin = coin; } - -READ8_MEMBER(tnzs_state::mcu_arknoid2_r) -{ - static const char mcu_startup[] = "\x55\xaa\x5a"; - -// logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset); - - if (offset == 0) - { - /* if the mcu has just been reset, return startup code */ - if (m_mcu_initializing) - { - m_mcu_initializing--; - return mcu_startup[2 - m_mcu_initializing]; - } - - switch (m_mcu_command) - { - case 0x41: - return m_mcu_credits; - - case 0xc1: - /* Read the credit counter or the inputs */ - if (m_mcu_readcredits == 0) - { - m_mcu_readcredits = 1; - if (m_mcu_reportcoin & 0x08) - { - m_mcu_initializing = 3; - return 0xee; /* tilt */ - } - else return m_mcu_credits; - } - else return m_in0->read(); /* buttons */ - - default: - logerror("error, unknown mcu command\n"); - /* should not happen */ - return 0xff; - } - } - else - { - /* - status bits: - 0 = mcu is ready to send data (read from c000) - 1 = mcu has read data (from c000) - 2 = unused - 3 = unused - 4-7 = coin code - 0 = nothing - 1,2,3 = coin switch pressed - e = tilt - */ - if (m_mcu_reportcoin & 0x08) return 0xe1; /* tilt */ - if (m_mcu_reportcoin & 0x01) return 0x11; /* coin 1 (will trigger "coin inserted" sound) */ - if (m_mcu_reportcoin & 0x02) return 0x21; /* coin 2 (will trigger "coin inserted" sound) */ - if (m_mcu_reportcoin & 0x04) return 0x31; /* coin 3 (will trigger "coin inserted" sound) */ - return 0x01; - } -} - -WRITE8_MEMBER(tnzs_state::mcu_arknoid2_w) -{ - if (offset == 0) - { -// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); - if (m_mcu_command == 0x41) - { - m_mcu_credits = (m_mcu_credits + data) & 0xff; - } - } - else - { - /* - 0xc1: read number of credits, then buttons - 0x54+0x41: add value to number of credits - 0x15: sub 1 credit (when "Continue Play" only) - 0x84: coin 1 lockout (issued only in test mode) - 0x88: coin 2 lockout (issued only in test mode) - 0x80: release coin lockout (issued only in test mode) - during initialization, a sequence of 4 bytes sets coin/credit settings - */ -// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); - - if (m_mcu_initializing) - { - /* set up coin/credit settings */ - m_mcu_coinage[m_mcu_coinage_init++] = data; - if (m_mcu_coinage_init == 4) - m_mcu_coinage_init = 0; /* must not happen */ - } - - if (data == 0xc1) - m_mcu_readcredits = 0; /* reset input port number */ - - if (data == 0x15) - { - m_mcu_credits = (m_mcu_credits - 1) & 0xff; - if (m_mcu_credits == 0xff) - m_mcu_credits = 0; - } - m_mcu_command = data; - } -} - - -READ8_MEMBER(tnzs_state::mcu_extrmatn_r) -{ - static const char mcu_startup[] = "\x5a\xa5\x55"; - -// logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset); - - if (offset == 0) - { - /* if the mcu has just been reset, return startup code */ - if (m_mcu_initializing) - { - m_mcu_initializing--; - return mcu_startup[2 - m_mcu_initializing]; - } - - switch (m_mcu_command) - { - case 0x01: - return m_in0->read() ^ 0xff; /* player 1 joystick + buttons */ - - case 0x02: - return m_in1->read() ^ 0xff; /* player 2 joystick + buttons */ - - case 0x1a: - return (m_coin1->read() | (m_coin2->read() << 1)); - - case 0x21: - return m_in2->read() & 0x0f; - - case 0x41: - return m_mcu_credits; - - case 0xa0: - /* Read the credit counter */ - if (m_mcu_reportcoin & 0x08) - { - m_mcu_initializing = 3; - return 0xee; /* tilt */ - } - else return m_mcu_credits; - - case 0xa1: - /* Read the credit counter or the inputs */ - if (m_mcu_readcredits == 0) - { - m_mcu_readcredits = 1; - if (m_mcu_reportcoin & 0x08) - { - m_mcu_initializing = 3; - return 0xee; /* tilt */ -// return 0x64; /* theres a reset input somewhere */ - } - else return m_mcu_credits; - } - /* buttons */ - else return ((m_in0->read() & 0xf0) | (m_in1->read() >> 4)) ^ 0xff; - - default: - logerror("error, unknown mcu command\n"); - /* should not happen */ - return 0xff; - } - } - else - { - /* - status bits: - 0 = mcu is ready to send data (read from c000) - 1 = mcu has read data (from c000) - 2 = unused - 3 = unused - 4-7 = coin code - 0 = nothing - 1,2,3 = coin switch pressed - e = tilt - */ - if (m_mcu_reportcoin & 0x08) return 0xe1; /* tilt */ - if (m_mcu_reportcoin & 0x01) return 0x11; /* coin 1 (will trigger "coin inserted" sound) */ - if (m_mcu_reportcoin & 0x02) return 0x21; /* coin 2 (will trigger "coin inserted" sound) */ - if (m_mcu_reportcoin & 0x04) return 0x31; /* coin 3 (will trigger "coin inserted" sound) */ - return 0x01; - } -} - -WRITE8_MEMBER(tnzs_state::mcu_extrmatn_w) -{ - if (offset == 0) - { -// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); - if (m_mcu_command == 0x41) - { - m_mcu_credits = (m_mcu_credits + data) & 0xff; - } - } - else - { - /* - 0xa0: read number of credits - 0xa1: read number of credits, then buttons - 0x01: read player 1 joystick + buttons - 0x02: read player 2 joystick + buttons - 0x1a: read coin switches - 0x21: read service & tilt switches - 0x4a+0x41: add value to number of credits - 0x84: coin 1 lockout (issued only in test mode) - 0x88: coin 2 lockout (issued only in test mode) - 0x80: release coin lockout (issued only in test mode) - during initialization, a sequence of 4 bytes sets coin/credit settings - */ - -// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); - - if (m_mcu_initializing) - { - /* set up coin/credit settings */ - m_mcu_coinage[m_mcu_coinage_init++] = data; - if (m_mcu_coinage_init == 4) - m_mcu_coinage_init = 0; /* must not happen */ - } - - if (data == 0xa1) - m_mcu_readcredits = 0; /* reset input port number */ - - /* Dr Toppel decrements credits differently. So handle it */ - if ((data == 0x09) && (m_mcu_type == MCU_DRTOPPEL || m_mcu_type == MCU_PLUMPOP)) - m_mcu_credits = (m_mcu_credits - 1) & 0xff; /* Player 1 start */ - if ((data == 0x18) && (m_mcu_type == MCU_DRTOPPEL || m_mcu_type == MCU_PLUMPOP)) - m_mcu_credits = (m_mcu_credits - 2) & 0xff; /* Player 2 start */ - - m_mcu_command = data; - } -} - - - /********************************* TNZS sync bug kludge @@ -482,37 +227,41 @@ WRITE8_MEMBER(tnzs_state::tnzs_sync_kludge_w) DRIVER_INIT_MEMBER(tnzs_state,plumpop) { - m_mcu_type = MCU_PLUMPOP; + m_mcu_type = MCU_MCHIP_LLE; + m_lockout_level = false; } DRIVER_INIT_MEMBER(tnzs_state,extrmatn) { - m_mcu_type = MCU_EXTRMATN; + m_mcu_type = MCU_MCHIP_LLE; + m_lockout_level = false; } DRIVER_INIT_MEMBER(tnzs_state,arknoid2) { - m_mcu_type = MCU_ARKANOID; + m_mcu_type = MCU_ARKANOID_SIM; } DRIVER_INIT_MEMBER(tnzs_state,drtoppel) { - m_mcu_type = MCU_DRTOPPEL; - /* drtoppel writes to the palette RAM area even if it has PROMs! We have to patch it out. */ m_maincpu->space(AS_PROGRAM).nop_write(0xf800, 0xfbff); + m_lockout_level = false; + m_mcu_type = MCU_MCHIP_LLE; } DRIVER_INIT_MEMBER(tnzs_state,chukatai) { - m_mcu_type = MCU_CHUKATAI; + m_lockout_level = true; + m_mcu_type = MCU_MCHIP_LLE; } DRIVER_INIT_MEMBER(tnzs_state,tnzs) { - m_mcu_type = MCU_TNZS; /* we need to install a kludge to avoid problems with a bug in the original code */ // m_maincpu->space(AS_PROGRAM).install_write_handler(0xef10, 0xef10, write8_delegate(FUNC(tnzs_state::tnzs_sync_kludge_w), this)); + m_lockout_level = true; + m_mcu_type = MCU_MCHIP_LLE; } DRIVER_INIT_MEMBER(tnzs_state,tnzsb) @@ -547,65 +296,118 @@ DRIVER_INIT_MEMBER(tnzs_state,kageki) } -READ8_MEMBER(tnzs_state::tnzs_mcu_r) +READ8_MEMBER(tnzs_state::arknoid2_mcu_r) { - switch (m_mcu_type) + static const char mcu_startup[] = "\x55\xaa\x5a"; + + //logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset); + + if (offset == 0) { - case MCU_TNZS: - case MCU_CHUKATAI: - return mcu_tnzs_r(space, offset); - case MCU_ARKANOID: - return mcu_arknoid2_r(space, offset); - case MCU_EXTRMATN: - case MCU_DRTOPPEL: - case MCU_PLUMPOP: - return mcu_extrmatn_r(space, offset); - default: - return 0xff; + /* if the mcu has just been reset, return startup code */ + if (m_mcu_initializing) + { + m_mcu_initializing--; + return mcu_startup[2 - m_mcu_initializing]; + } + + switch (m_mcu_command) + { + case 0x41: + return m_mcu_credits; + + case 0xc1: + /* Read the credit counter or the inputs */ + if (m_mcu_readcredits == 0) + { + m_mcu_readcredits = 1; + if (m_mcu_reportcoin & 0x08) + { + m_mcu_initializing = 3; + return 0xee; /* tilt */ + } + else return m_mcu_credits; + } + else return m_in0->read(); /* buttons */ + + default: + logerror("error, unknown mcu command\n"); + /* should not happen */ + return 0xff; + } + } + else + { + /* + status bits: + 0 = mcu is ready to send data (read from c000) + 1 = mcu has read data (from c000) + 2 = unused + 3 = unused + 4-7 = coin code + 0 = nothing + 1,2,3 = coin switch pressed + e = tilt + */ + if (m_mcu_reportcoin & 0x08) return 0xe1; /* tilt */ + if (m_mcu_reportcoin & 0x01) return 0x11; /* coin 1 (will trigger "coin inserted" sound) */ + if (m_mcu_reportcoin & 0x02) return 0x21; /* coin 2 (will trigger "coin inserted" sound) */ + if (m_mcu_reportcoin & 0x04) return 0x31; /* coin 3 (will trigger "coin inserted" sound) */ + return 0x01; } } -WRITE8_MEMBER(tnzs_state::tnzs_mcu_w) +WRITE8_MEMBER(tnzs_state::arknoid2_mcu_w) { - switch (m_mcu_type) + if (offset == 0) { - case MCU_TNZS: - case MCU_CHUKATAI: - mcu_tnzs_w(space, offset, data); - break; - case MCU_ARKANOID: - mcu_arknoid2_w(space, offset, data); - break; - case MCU_EXTRMATN: - case MCU_DRTOPPEL: - case MCU_PLUMPOP: - mcu_extrmatn_w(space, offset, data); - break; - default: - break; + //logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); + if (m_mcu_command == 0x41) + { + m_mcu_credits = (m_mcu_credits + data) & 0xff; + } + } + else + { + /* + 0xc1: read number of credits, then buttons + 0x54+0x41: add value to number of credits + 0x15: sub 1 credit (when "Continue Play" only) + 0x84: coin 1 lockout (issued only in test mode) + 0x88: coin 2 lockout (issued only in test mode) + 0x80: release coin lockout (issued only in test mode) + during initialization, a sequence of 4 bytes sets coin/credit settings + */ + //logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); + + if (m_mcu_initializing) + { + /* set up coin/credit settings */ + m_mcu_coinage[m_mcu_coinage_init++] = data; + if (m_mcu_coinage_init == 4) + m_mcu_coinage_init = 0; /* must not happen */ + } + + if (data == 0xc1) + m_mcu_readcredits = 0; /* reset input port number */ + + if (data == 0x15) + { + m_mcu_credits = (m_mcu_credits - 1) & 0xff; + if (m_mcu_credits == 0xff) + m_mcu_credits = 0; + } + m_mcu_command = data; } } INTERRUPT_GEN_MEMBER(tnzs_state::arknoid2_interrupt) { - int coin; - - switch (m_mcu_type) - { - case MCU_ARKANOID: - case MCU_EXTRMATN: - case MCU_DRTOPPEL: - case MCU_PLUMPOP: - coin = 0; - coin |= ((m_coin1->read() & 1) << 0); - coin |= ((m_coin2->read() & 1) << 1); - coin |= ((m_in2->read() & 3) << 2); - coin ^= 0x0c; - mcu_handle_coins(coin); - break; - default: - break; - } + int coin = ((m_coin1->read() & 1) << 0); + coin |= ((m_coin2->read() & 1) << 1); + coin |= ((m_in2->read() & 3) << 2); + coin ^= 0x0c; + mcu_handle_coins(coin); device.execute().set_input_line(0, HOLD_LINE); } @@ -613,22 +415,12 @@ INTERRUPT_GEN_MEMBER(tnzs_state::arknoid2_interrupt) MACHINE_RESET_MEMBER(tnzs_state,tnzs) { /* initialize the mcu simulation */ - switch (m_mcu_type) - { - case MCU_ARKANOID: - case MCU_EXTRMATN: - case MCU_DRTOPPEL: - case MCU_PLUMPOP: - mcu_reset(); - break; - default: - break; - } + if (m_mcu_type == MCU_ARKANOID_SIM) + arknoid2_mcu_reset(); m_kageki_csport_sel = 0; - m_input_select = 0; - m_mcu_readcredits = 0; // this might belong to mcu_reset - m_insertcoin = 0; // this might belong to mcu_reset + m_mcu_readcredits = 0; // this might belong to arknoid2_mcu_reset + m_insertcoin = 0; // this might belong to arknoid2_mcu_reset } MACHINE_RESET_MEMBER(tnzs_state,jpopnics) @@ -655,7 +447,6 @@ MACHINE_START_MEMBER(tnzs_state,tnzs) MACHINE_START_CALL_MEMBER( tnzs_common ); save_item(NAME(m_kageki_csport_sel)); - save_item(NAME(m_input_select)); save_item(NAME(m_mcu_readcredits)); save_item(NAME(m_insertcoin)); save_item(NAME(m_mcu_initializing)); @@ -684,22 +475,26 @@ WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w) m_mainbank->set_bank(data & 0x07); } +WRITE8_MEMBER(tnzs_state::arknoid2_mcu_reset_w) +{ + if (data & 0x04) + arknoid2_mcu_reset(); + + /* bits 0-1 select ROM bank */ + m_bank2 = data & 0x03; + m_subbank->set_entry(m_bank2); +} + WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w) { // logerror("PC %04x: writing %02x to bankswitch 1\n", space.device().safe_pc(),data); switch (m_mcu_type) { - case MCU_TNZS: - case MCU_CHUKATAI: - /* bit 2 resets the mcu */ - if (data & 0x04) - { - if (m_mcu != nullptr && m_mcu->type() == I8742) - m_mcu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - } - /* Coin count and lockout is handled by the i8742 */ - break; + case MCU_MCHIP_LLE: + if ((data & 0x04) != 0 && m_mcu != nullptr) + m_mcu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + break; case MCU_NONE_INSECTX: machine().bookkeeping().coin_lockout_w(0, (~data & 0x04)); machine().bookkeeping().coin_lockout_w(1, (~data & 0x08)); @@ -718,14 +513,6 @@ WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w) machine().bookkeeping().coin_counter_w(0, (data & 0x04)); machine().bookkeeping().coin_counter_w(1, (data & 0x08)); break; - case MCU_ARKANOID: - case MCU_EXTRMATN: - case MCU_DRTOPPEL: - case MCU_PLUMPOP: - /* bit 2 resets the mcu */ - if (data & 0x04) - mcu_reset(); - break; default: break; } From ecad2559f8b7a91158268df5b251a446599e8e67 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Fri, 9 Dec 2016 18:46:20 -0800 Subject: [PATCH 22/82] magnum: Fix aspect ratio. (nw) --- src/mame/drivers/magnum.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mame/drivers/magnum.cpp b/src/mame/drivers/magnum.cpp index 5a7ef2600b5..b59e9926586 100644 --- a/src/mame/drivers/magnum.cpp +++ b/src/mame/drivers/magnum.cpp @@ -6,6 +6,7 @@ // http://www.eevblog.com/forum/blog/eevblog-949-vintage-australian-made-laptop-teardown/msg1080508/#msg1080508 #include "emu.h" +#include "rendlay.h" #include "cpu/i86/i186.h" #include "machine/cdp1879.h" #include "sound/beep.h" @@ -151,6 +152,8 @@ static MACHINE_CONFIG_START( magnum, magnum_state ) MCFG_SCREEN_SIZE(6*80, 9*16) MCFG_SCREEN_VISIBLE_AREA(0, 6*80-1, 0, 9*16-1) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD_MONOCHROME("palette") MCFG_SPEAKER_STANDARD_MONO("speaker") From 4bc2d06c64dbf17ed13927f5d7586cc36805ef76 Mon Sep 17 00:00:00 2001 From: einstein95 Date: Wed, 7 Dec 2016 11:18:05 +1300 Subject: [PATCH 23/82] captckoo is cracked ("THE DRAGON LORD CRACKED THIS!") (nw) --- hash/apple2.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/apple2.xml b/hash/apple2.xml index f067f59f5be..84b09938aed 100644 --- a/hash/apple2.xml +++ b/hash/apple2.xml @@ -3082,7 +3082,7 @@ - Captain Cuckoo + Captain Cuckoo (cracked) 1984 Kurt and Yan Software From 61de6b4f6ff5f4123315ca19584449a0290ca825 Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 9 Dec 2016 22:10:57 -0500 Subject: [PATCH 24/82] aristmk5: added default NVRAM to cuckoou, dolphntru, incasunu, magimask, magimaska, partygrs, qnileu, and wcougaru so the games come up in a playable state. [Heihachi_73, R. Belmont] --- src/mame/drivers/aristmk5.cpp | 157 +++++++++++++++++++++++++++++++--- 1 file changed, 147 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp index 23ada61dc27..b864ad98ef3 100644 --- a/src/mame/drivers/aristmk5.cpp +++ b/src/mame/drivers/aristmk5.cpp @@ -991,7 +991,23 @@ MACHINE_CONFIG_END ROM_REGION16_BE( 0x100, "eeprom0", ROMREGION_ERASEFF ) \ ROM_REGION16_BE( 0x100, "eeprom1", ROMREGION_ERASEFF ) \ +#define ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS \ + ROM_REGION( 0x400000, "set_4.04.09", ROMREGION_ERASEFF ) /* setchip v4.04.08 4meg */ \ + ROM_LOAD32_WORD( "setchip v4.04.09.u7", 0x000000, 0x80000, CRC(e8e8dc75) SHA1(201fe95256459ce34fdb6f7498135ab5016d07f3) ) \ + ROM_LOAD32_WORD( "setchip v4.04.09.u11", 0x000002, 0x80000, CRC(ff7a9035) SHA1(4352c4336e61947c555fdc80c61f944076f64b64) ) \ + ROM_REGION( 0x400000, "set_4.04.00", ROMREGION_ERASEFF ) /* setchip v4.04.00 4meg 42pin */ \ + ROM_LOAD32_WORD( "setchip v4.04.00.u7", 0x000000, 0x80000, CRC(2453137e) SHA1(b59998e75ae3924da16faf47b9cfe9afd60d810c) ) \ + ROM_LOAD32_WORD( "setchip v4.04.00.u11", 0x000002, 0x80000, CRC(82dfa12a) SHA1(86fd0f0ad8d5d1bc503392a40bbcdadb055b2765) ) \ + ROM_REGION( 0x400000, "set_4.02.04", ROMREGION_ERASEFF ) /* setchip v4.02.04 */ \ + ROM_LOAD32_WORD( "setchip v4.02.04.u7", 0x000000, 0x80000, CRC(5a254b22) SHA1(8444f237b392df2a3cb42ea349e7af32f47dd544) ) \ + ROM_LOAD32_WORD( "setchip v4.02.04.u11", 0x000002, 0x80000, CRC(def36617) SHA1(c7ba5b08e884a8fb36c9fb51c08e243e32c81f89) ) \ + /* GALs */ \ + ROM_REGION( 0x600, "gals", 0 ) \ + ROM_LOAD( "a562837.u36", 0x000000, 0x000157, CRC(1f269234) SHA1(29940dd50fb55c632935f62ff44ca724379c7a43) ) \ + ROM_LOAD( "a562838.u65", 0x000200, 0x000157, CRC(f2f3c40a) SHA1(b795dfa5cc4e8127c3f3a0906664910d1325ec92) ) \ + ROM_LOAD( "a562840.u22", 0x000400, 0x000157, CRC(941d4cdb) SHA1(1ca091fba69e92f262dbb3d40f515703c8981793) ) \ + ROM_START( aristmk5 ) ARISTOCRAT_MK5_BIOS @@ -1642,7 +1658,7 @@ ROM_END // CUCKOO - Export C - 02/02/00. // All devices are 27c4002 instead of 27c4096. ROM_START( cuckoou ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d18 0x000000-0x0a588b is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -1660,6 +1676,19 @@ ROM_START( cuckoou ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(415b9c77) SHA1(86a3b3aabd81f5fcf767dd53f7034f7d58f2020e) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(64c895fe) SHA1(12c75338dd1b2260d0581744cef1b705c718727f) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) + ROM_END @@ -1808,7 +1837,7 @@ ROM_END // Dolphin Treasure - Export B - 06/12/96. // All devices are 27c4002 instead of 27c4096. ROM_START( dolphntru ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d08 0x000000-0x08ec8b is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -1826,6 +1855,18 @@ ROM_START( dolphntru ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(1fc27753) SHA1(7e5008faaf115dc506481430272285117c989d8e) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(0063e5ca) SHA1(a3d7b636bc9d792e93d11cb2babf24fbdd6d7776) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -2127,7 +2168,7 @@ ROM_START( incasun ) ROM_END ROM_START( incasunu ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) ROM_LOAD32_WORD("chg1458.u7", 0x0000000, 0x0080000, CRC(20c78b79) SHA1(d7402ff89160f25c9f4f67bbf688621d4ce22205) ) @@ -2140,6 +2181,18 @@ ROM_START( incasunu ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(b3efdb60) SHA1(f219175019b7237f1e2d132f36803097f2a1d174) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(a68e890e) SHA1(8ab087a09cfee8d3e2d84b1003b6798c7223be03) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END ROM_START( incasunsp ) @@ -2385,7 +2438,7 @@ ROM_END // MV4115 - 5,10,20 Credit Multiplier / 9 Line Multiline. // Magic Mask [Reel Game] - Export A - 09/05/2000. ROM_START( magimask ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d18 0x000000-0x0e8527 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -2403,6 +2456,18 @@ ROM_START( magimask ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(6e485bbc) SHA1(3d6c8d120c69ed2804f267c50681974f73e1ee51) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(538c7523) SHA1(1e6516b77daf855e397c1ec590e73637ce3b8406) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -2418,7 +2483,7 @@ ROM_END // dhg1309.u11 ahg1548.u11 17.786026% // dhg1309.u7 ahg1548.u7 16.893578% ROM_START( magimaska ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d18 0x000000-0x0e9597 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -2436,6 +2501,18 @@ ROM_START( magimaska ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(a10501f9) SHA1(34fdcd16bd7dc474baadc0836e2083abaf589549) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(5365446b) SHA1(9ae7a72d0ed3e7f7523a2e0a8f0dc014c6490438) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -2514,7 +2591,7 @@ ROM_END // Mine, Mine, Mine - Export E - 14/02/96. // All devices are 27c4002 instead of 27c4096. ROM_START( minemine ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d10 0x000000-0x0a7203 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -2532,6 +2609,18 @@ ROM_START( minemine ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(8421e7c2) SHA1(fc1b07d5b7aadafc4a0f2e4dfa698e7c72340717) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(883f5023) SHA1(e526e337b5b0fc77091b4946b503b56307c390e9) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -2704,7 +2793,7 @@ ROM_END // Party Gras [Reel Game] - Export A - 10/11/2001. // All devices are 27c4002 instead of 27c4096. ROM_START( partygrs ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d18 0x000000-0x0e9b47 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -2722,6 +2811,18 @@ ROM_START( partygrs ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(a10501f9) SHA1(34fdcd16bd7dc474baadc0836e2083abaf589549) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(fec1b1df) SHA1(5981e2961692d4c8633afea4ecb4828eabba65bd) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -2843,7 +2944,7 @@ ROM_END // Penguin Pays - Export B - 14/07/97. // All devices are 27c4002 instead of 27c4096. ROM_START( pengpayu ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d08 0x000000-0x0cd21b is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -2861,6 +2962,18 @@ ROM_START( pengpayu ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(8421e7c2) SHA1(fc1b07d5b7aadafc4a0f2e4dfa698e7c72340717) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(4e5b9702) SHA1(b2b645db80c4ece24fae8ce6fb660e77ac8e5810) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -3020,7 +3133,7 @@ ROM_END // All devices are 27c4002 instead of 27c4096. // Even when it's a NSW/ACT, the program seems to be for US-Export platforms... ROM_START( qnileu ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d08 0x000000-0x08ec87 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -3038,6 +3151,18 @@ ROM_START( qnileu ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(1fc27753) SHA1(7e5008faaf115dc506481430272285117c989d8e) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(5a7bb53a) SHA1(cdac900925d0ee8f98209a377b9f8760de0c2883) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END @@ -3561,7 +3686,7 @@ ROM_END // Wild Cougar - Export D - 19/05/97. // All devices are 27c4002 instead of 27c4096. ROM_START( wcougaru ) - ARISTOCRAT_MK5_BIOS + ARISTOCRAT_MK5_BIOS_HAVE_EEPROMS /* Checksum code found at 0x000d08 0x000000-0x0b0d5b is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) @@ -3579,6 +3704,18 @@ ROM_START( wcougaru ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x100, "eeprom0", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom0", 0x000000, 0x000100, CRC(fea8a821) SHA1(c744cac6af7621524fc3a2b0a9a135a32b33c81b) ) + + ROM_REGION16_BE( 0x100, "eeprom1", 0 ) + ROM_LOAD16_WORD_SWAP( "eeprom1", 0x000000, 0x000100, CRC(8421e7c2) SHA1(fc1b07d5b7aadafc4a0f2e4dfa698e7c72340717) ) + + ROM_REGION( 0x80000, "nvram", 0 ) + ROM_LOAD( "nvram", 0x000000, 0x080000, CRC(dfe52286) SHA1(db31fb64e2fff8aa5ba0cc6d3d73860e8019406c) ) + + ROM_REGION( 0x20, "rtc", 0 ) + ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END From 8e8ddfee98ea8e155c64361aec11b381fb03dc69 Mon Sep 17 00:00:00 2001 From: cracyc Date: Fri, 9 Dec 2016 21:22:19 -0600 Subject: [PATCH 25/82] hiscore.dat: Updates [Leezer] --- plugins/hiscore/hiscore.dat | 54 +++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/plugins/hiscore/hiscore.dat b/plugins/hiscore/hiscore.dat index 5a55b8b119e..2d9b50d50bb 100644 --- a/plugins/hiscore/hiscore.dat +++ b/plugins/hiscore/hiscore.dat @@ -70,6 +70,11 @@ ;@s:1945kiii.cpp +1945kiiin: +1945kiiio: +@:maincpu,program,100a2d,63,03,88 + + ;*******1945k III 1945kiii: @:maincpu,program,100a2d,63,03,88 @@ -97,6 +102,15 @@ undoukai: ;@s:8080bw.cpp +cosmicin: +@:maincpu,program,20f4,02,00,00 + + +ozmawarsmr: +@:maincpu,program,2043,02,00,00 +@:maincpu,program,2023,01,01,01 + + ;updated when start a game escmars: @:maincpu,program,20db,1,0a,0a @@ -2413,6 +2427,10 @@ circusce: ;@s:cischeat.cpp +f1gpstaro: +@:cpu1,program,f2803,5e3,04,4d + + ;(big run (11th rallye version)) bigrun: @:cpu1,program,f61da,2bc,50,05 @@ -3045,11 +3063,12 @@ rockmanj: forgottn: forgottnu: -forgottnu1: forgottnua: forgottnuaa: lostwrld: lostwrldo: +forgottnuc: +forgottnue: @:maincpu,program,ffe142,50,00,20 @:maincpu,program,ffb2a0,04,00,00 @@ -3932,9 +3951,9 @@ stoffyu: ;wwfwfestb:******www wrestlefest (us bootleg) ;wwfwfesta:******www wrestlefest (us tecmo) wwfwfest: -wwfwfesta: wwfwfestb: wwfwfestj: +wwfwfestu: @:maincpu,program,1c00c2,84,08,01 @@ -6707,6 +6726,11 @@ hvyunitu: ;@s:hyperspt.cpp +roadf3: +@:maincpu,program,3bd0,10a,01,01 +@:maincpu,program,3066,3,01,00 + + roadf: roadf2: @:maincpu,program,3bd0,10a,01,01 @@ -8873,6 +8897,10 @@ mnchmobl: ;@s:mustache.cpp +mustachei: +@:maincpu,program,f000,50,00,47 + + ;*******mustache boy mustache: @:maincpu,program,f000,50,00,47 @@ -8880,6 +8908,10 @@ mustache: ;@s:mw8080bw.cpp +blueshrkmr: +@:maincpu,program,200a,05,00,00 + + lagunar: @:maincpu,program,2011,9,00,00 @:maincpu,program,2005,3,00,00 @@ -10972,6 +11004,12 @@ btlkroadk: ;@s:psikyosh.cpp +;(sol divide) (by Paul Priest) +soldividk: +@:maincpu,program,600bb50,18,00,50 +@:maincpu,program,600bb68,1e,24,02 + + ;gunbarich (by tamphax) gnbarich: @:maincpu,program,6076864,a5,00,01 @@ -14425,6 +14463,14 @@ tail2nos: ;@s:taito_b.cpp +;** you must wait untill the hiscore table has displayed in attract mode before ** +;** starting a game, for the save to work ** +hiticej: +hiticerb: +@:maincpu,program,802830,27,00,4b +@:maincpu,program,802852,1,56,56 + + crimec: crimecj: crimecu: @@ -16606,6 +16652,10 @@ vastar4: ;@s:vendetta.cpp +vendetta2pun: +@:maincpu,program,2980,28,00,48 + + vendetta: vendetta2p: vendetta2pd: From ecf0ca14979fa42abb0db1393a9d30f9e285f3fc Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 9 Dec 2016 22:25:47 -0500 Subject: [PATCH 26/82] aristmk5: redumped chickna5u, now passes checksum. [Heihachi_73] --- src/mame/drivers/aristmk5.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp index b864ad98ef3..c7c72299160 100644 --- a/src/mame/drivers/aristmk5.cpp +++ b/src/mame/drivers/aristmk5.cpp @@ -1561,23 +1561,16 @@ ROM_END // All devices are 27c4002 instead of 27c4096. ROM_START( chickna5u ) ARISTOCRAT_MK5_BIOS - /* - Checksum code found at 0x000d08 - 0x000000-0x0a6917 is the Checksummed Range (excluding 0x000020-0x000027 where Checksum is stored) - Expected Checksum 0x0d44c6b0 - Calculated Checksum 0xc47bc6b0 (BAD) - 0x0a6918-0x35040b is the non-Checksummed range (unusual endpoint) - */ + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) - // the checksum only covers part of the first 2 roms, marked all as BAD_DUMP because it can't be trusted without a full redump. - ROM_LOAD32_WORD( "rhg073003.u7", 0x000000, 0x80000, BAD_DUMP CRC(ca196b37) SHA1(6b204204c1574439ccea1b6145d867a73bad304f) ) // 92.588% - ROM_LOAD32_WORD( "rhg073003.u11", 0x000002, 0x80000, BAD_DUMP CRC(b0d7be28) SHA1(6998dce808bf7970500b9e1ce6efed3940ee2d63) ) // 92.588% - ROM_LOAD32_WORD( "rhg073003.u8", 0x100000, 0x80000, BAD_DUMP CRC(80e3e34c) SHA1(3ad73c5fc21c4d9647ea514bf367073bbeb981a9) ) // base - ROM_LOAD32_WORD( "rhg073003.u12", 0x100002, 0x80000, BAD_DUMP CRC(63d5ec8e) SHA1(dca76342ecee6843e6fc656aafc8ee2e4d19fd65) ) // base - ROM_LOAD32_WORD( "rhg073003.u9", 0x200000, 0x80000, BAD_DUMP CRC(662ff210) SHA1(bbd2410fa2cd67e327981c3b2e16342fb9393401) ) // base - ROM_LOAD32_WORD( "rhg073003.u13", 0x200002, 0x80000, BAD_DUMP CRC(c3cef8ae) SHA1(4e65787d61387b511972e514047528495e1de11c) ) // base - ROM_LOAD32_WORD( "rhg073003.u10", 0x300000, 0x80000, BAD_DUMP CRC(8b3f7d6b) SHA1(7f1a04556c448976145652b05b690142376764d4) ) // base - ROM_LOAD32_WORD( "rhg073003.u14", 0x300002, 0x80000, BAD_DUMP CRC(240f7759) SHA1(1fa5ba0185b027101dae207ec5d28b07d3d73fc2) ) // base + ROM_LOAD32_WORD( "rhg073003.u7", 0x000000, 0x080000, CRC(06558129) SHA1(be726c0d35776faf1ecd20eb0a193e68a1fb1a84) ) + ROM_LOAD32_WORD( "rhg073003.u11", 0x000002, 0x080000, CRC(0eadf5d4) SHA1(b783f6e1911fc098d1b4d1d8c75862e031078e5b) ) + ROM_LOAD32_WORD( "rhg073003.u8", 0x100000, 0x080000, CRC(683e96bc) SHA1(bca8e87bea9f7044fa29dc4518e2ac5b429e3313) ) + ROM_LOAD32_WORD( "rhg073003.u12", 0x100002, 0x080000, CRC(8313b03b) SHA1(d2a91bae8063d89ec9a1edab6df3e6711719d2c2) ) + ROM_LOAD32_WORD( "rhg073003.u9", 0x200000, 0x080000, CRC(9c08aefa) SHA1(fe3ffa8eb308ab216cc08dd2ce51113b4ef74c4a) ) + ROM_LOAD32_WORD( "rhg073003.u13", 0x200002, 0x080000, CRC(69fd4f89) SHA1(4e0469caecf9293197a4a5de960eb9dcfee39ca3) ) + ROM_LOAD32_WORD( "rhg073003.u10", 0x300000, 0x080000, CRC(9aae49d7) SHA1(5cf87b747ea7561766fe0ffc15967fea657b252b) ) + ROM_LOAD32_WORD( "rhg073003.u14", 0x300002, 0x080000, CRC(240f7759) SHA1(1fa5ba0185b027101dae207ec5d28b07d3d73fc2) ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) From da6f3e37228b385694ca11c749a9e097b421b47a Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 9 Dec 2016 22:31:25 -0500 Subject: [PATCH 27/82] aristmk5: redumped topbana, passes checksum [Heihachi_73] --- src/mame/drivers/aristmk5.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp index c7c72299160..dc519cf1897 100644 --- a/src/mame/drivers/aristmk5.cpp +++ b/src/mame/drivers/aristmk5.cpp @@ -3427,10 +3427,9 @@ ROM_END ROM_START( topbana ) ARISTOCRAT_MK5_BIOS - // checksum code not found (due to bad rom) ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) - ROM_LOAD32_WORD("0100550v.u7", 0x0000000, 0x0080000, CRC(1f60241c) SHA1(3a6207d9c919319fc10b6de63bc030f8d335588e) ) - ROM_LOAD32_WORD("0100550v.u11", 0x0000002, 0x007fffa, BAD_DUMP CRC(140a73bc) SHA1(3fd88797b6310f5849e901d032fbeb8a2d8604fb) ) // This is a bad .u8 from Indian Dream, not proper Top Banana .u11!! + ROM_LOAD32_WORD( "0100550v.u11", 0x000002, 0x080000, CRC(1c64b3b6) SHA1(80bbc6e3f47ab932e9c07e0c6063197a2d8e81f7) ) + ROM_LOAD32_WORD( "0100550v.u7", 0x000000, 0x080000, CRC(9c5e2d66) SHA1(658143706c0e1f3b43b3ec301da1052363fe5244) ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) From aa93055456ff362bfd977409913180e3f79609a1 Mon Sep 17 00:00:00 2001 From: darq Date: Sat, 10 Dec 2016 03:44:59 +0100 Subject: [PATCH 28/82] Fixed cocktail mode, added a note about the 'cooperative mode', implemented y scroll, added vram and cram mirrors --- src/mame/drivers/sidepckt.cpp | 34 ++++++++++++++++++++-------------- src/mame/includes/sidepckt.h | 4 +++- src/mame/video/sidepckt.cpp | 17 ++++++++++++++--- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/mame/drivers/sidepckt.cpp b/src/mame/drivers/sidepckt.cpp index 03d362faae9..f968f5540b7 100644 --- a/src/mame/drivers/sidepckt.cpp +++ b/src/mame/drivers/sidepckt.cpp @@ -15,7 +15,7 @@ i8751 protection simulation and other fixes by Bryan McPhail, 15/10/00. ToDo: - support screen flipping for sprites +- Stephh's notes (based on the games M6809 code and some tests) : @@ -123,6 +123,12 @@ Stephh's notes (based on the games M6809 code and some tests) : * Lives settings (table at 0x4696) : 06 03 02 instead of 06 03 09 * Timer settings (table at 0x9d99) : 30 20 18 instead of 40 30 20, so the timer is faster +Additional notes: +---------------- +- sidepckt and sidepcktb don't have cocktail mode at all, while sidepcktj has a 'cooperative' cocktail mode; when it's the p2 turn, + the screen scrolls and a 'flipped score area' is shown on the other side, so the 2nd player just continues the same game. + Note that the screen never flips in any case. + ***************************************************************************/ #include "emu.h" @@ -195,18 +201,16 @@ WRITE8_MEMBER(sidepckt_state::i8751_w) static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state ) AM_RANGE(0x0000, 0x0fff) AM_RAM - AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") - AM_RANGE(0x1400, 0x17ff) AM_RAM // ??? - AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") - AM_RANGE(0x1c00, 0x1fff) AM_RAM // ??? + AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x400) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") + AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x400) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x2100, 0x24ff) AM_RAM // ??? + AM_RANGE(0x2100, 0x24ff) AM_WRITENOP // ??? (Unused spriteram? The game writes some values at boot, but never read) AM_RANGE(0x3000, 0x3000) AM_READ_PORT("P1") AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2") AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1") AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2") AM_RANGE(0x3004, 0x3004) AM_WRITE(sound_cpu_command_w) - AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE(flipscreen_w) + AM_RANGE(0x300c, 0x300c) AM_READWRITE(scroll_y_r, scroll_y_w) AM_RANGE(0x3014, 0x3014) AM_READ(i8751_r) AM_RANGE(0x3018, 0x3018) AM_WRITE(i8751_w) AM_RANGE(0x4000, 0xffff) AM_ROM @@ -356,11 +360,12 @@ GFXDECODE_END void sidepckt_state::machine_reset() { - m_i8751_return = 0; - m_current_ptr = 0; + m_i8751_return = 0; + m_current_ptr = 0; m_current_table = 0; - m_in_math = 0; - m_math_param = 0; + m_in_math = 0; + m_math_param = 0; + m_scroll_y = 0; } static MACHINE_CONFIG_START( sidepckt, sidepckt_state ) @@ -498,6 +503,7 @@ DRIVER_INIT_MEMBER(sidepckt_state,sidepckt) save_item(NAME(m_current_table)); save_item(NAME(m_in_math)); save_item(NAME(m_math_param)); + save_item(NAME(m_scroll_y)); } DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj) @@ -514,6 +520,6 @@ DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj) } -GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device, 0, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device, 0, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/sidepckt.h b/src/mame/includes/sidepckt.h index ec6cb6d5229..97751301697 100644 --- a/src/mame/includes/sidepckt.h +++ b/src/mame/includes/sidepckt.h @@ -40,13 +40,15 @@ public: uint8_t m_current_table; uint8_t m_in_math; uint8_t m_math_param; + uint8_t m_scroll_y; DECLARE_WRITE8_MEMBER(sound_cpu_command_w); DECLARE_READ8_MEMBER(i8751_r); DECLARE_WRITE8_MEMBER(i8751_w); DECLARE_WRITE8_MEMBER(videoram_w); DECLARE_WRITE8_MEMBER(colorram_w); - DECLARE_WRITE8_MEMBER(flipscreen_w); + DECLARE_READ8_MEMBER(scroll_y_r); + DECLARE_WRITE8_MEMBER(scroll_y_w); DECLARE_DRIVER_INIT(sidepckt); DECLARE_DRIVER_INIT(sidepcktj); diff --git a/src/mame/video/sidepckt.cpp b/src/mame/video/sidepckt.cpp index d694900b1bc..0767c654b01 100644 --- a/src/mame/video/sidepckt.cpp +++ b/src/mame/video/sidepckt.cpp @@ -100,10 +100,19 @@ WRITE8_MEMBER(sidepckt_state::colorram_w) m_bg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(sidepckt_state::flipscreen_w) +READ8_MEMBER(sidepckt_state::scroll_y_r) { - int flipscreen = data; - machine().tilemap().set_flip_all(flipscreen ? TILEMAP_FLIPY : TILEMAP_FLIPX); + return (m_scroll_y); +} + +WRITE8_MEMBER(sidepckt_state::scroll_y_w) +{ + // Bits 0-5: Scroll y + m_scroll_y = data & 0x3F; + + // Other bits: Unknown, but they seem never written + if (data > 0x3F) + logerror ("scroll_y_w: Unknown write -> data = 0x%02X\n", data); } @@ -145,6 +154,8 @@ void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect uint32_t sidepckt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + m_bg_tilemap->set_scrolly (0, m_scroll_y); + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); draw_sprites(bitmap,cliprect); m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); From eddf8e3a9145d841a8120514a398389a801a91fa Mon Sep 17 00:00:00 2001 From: darq Date: Sat, 10 Dec 2016 03:58:54 +0100 Subject: [PATCH 29/82] draw_sprites: small clean-up --- src/mame/video/sidepckt.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mame/video/sidepckt.cpp b/src/mame/video/sidepckt.cpp index 0767c654b01..cafe257dbe3 100644 --- a/src/mame/video/sidepckt.cpp +++ b/src/mame/video/sidepckt.cpp @@ -15,9 +15,8 @@ PALETTE_INIT_MEMBER(sidepckt_state, sidepckt) { const uint8_t *color_prom = memregion("proms")->base(); - int i; - for (i = 0;i < palette.entries();i++) + for (int i = 0;i < palette.entries();i++) { int bit0,bit1,bit2,bit3,r,g,b; @@ -126,22 +125,22 @@ void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect { for (int offs = 0;offs < m_spriteram.bytes(); offs += 4) { - int sx,sy,code,color,flipx,flipy; + int attr = m_spriteram[offs | 1]; + int code = ((attr & 0x03) << 8) | m_spriteram[offs | 3]; + int color = (attr & 0xf0) >> 4; - code = m_spriteram[offs+3] + ((m_spriteram[offs+1] & 0x03) << 8); - color = (m_spriteram[offs+1] & 0xf0) >> 4; + int sx = m_spriteram[offs | 2] - 2; + int sy = m_spriteram[offs]; - sx = m_spriteram[offs+2]-2; - sy = m_spriteram[offs]; - - flipx = m_spriteram[offs+1] & 0x08; - flipy = m_spriteram[offs+1] & 0x04; + int flipx = attr & 0x08; + int flipy = attr & 0x04; m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, color, flipx,flipy, sx,sy,0); + /* wraparound */ m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, code, From bbfd052dd862863b0a1e31f2949b54c51170896f Mon Sep 17 00:00:00 2001 From: darq Date: Sat, 10 Dec 2016 04:13:17 +0100 Subject: [PATCH 30/82] sidepcktj: Added a TODO node about possible unimplemented MCU simulation for "cocktail mode" --- src/mame/drivers/sidepckt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/sidepckt.cpp b/src/mame/drivers/sidepckt.cpp index f968f5540b7..0b8c144ac0b 100644 --- a/src/mame/drivers/sidepckt.cpp +++ b/src/mame/drivers/sidepckt.cpp @@ -15,7 +15,7 @@ i8751 protection simulation and other fixes by Bryan McPhail, 15/10/00. ToDo: -- +- sidepcktj: Intermission screen's background for player 2 is completely screwed (Maybe wrong/missing I8751 simulation for "cocktail mode" ?) Stephh's notes (based on the games M6809 code and some tests) : From 29fa1c19f2aecb0ee2cb51ff9d3df5b41de74086 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 9 Dec 2016 23:27:30 -0500 Subject: [PATCH 31/82] mustache.cpp: Flip screen improvements - Fix Y positions of flipped sprites - Add and implement flip screen "Hard SW" as in Irem games - Correct polarity of all DIP switches --- src/mame/drivers/mustache.cpp | 20 +++++++++++--------- src/mame/includes/mustache.h | 5 ++++- src/mame/video/mustache.cpp | 12 +++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/mame/drivers/mustache.cpp b/src/mame/drivers/mustache.cpp index 748963e7317..0080e6dcf29 100644 --- a/src/mame/drivers/mustache.cpp +++ b/src/mame/drivers/mustache.cpp @@ -92,25 +92,25 @@ static INPUT_PORTS_START( mustache ) PORT_BIT( 0xf9, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW 2:!1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW 2:1") PORT_DIPSETTING( 0x01, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x06, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW 2:!2,!3") + PORT_DIPNAME( 0x06, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW 2:2,3") PORT_DIPSETTING( 0x06, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x04, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW 2:!4,!5") + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW 2:4,5") PORT_DIPSETTING( 0x10, "1" ) PORT_DIPSETTING( 0x18, "3" ) PORT_DIPSETTING( 0x08, "4" ) PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW 2:!6") + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW 2:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW 1:!1,!2,!3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW 1:1,2,3") PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) @@ -119,16 +119,18 @@ static INPUT_PORTS_START( mustache ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) ) - PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW 1:!4,!5") + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW 1:4,5") PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) - PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW 1:!6") - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW 1:!7") + PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW 1:6") + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW 1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -// There is an 8th dipswitch here, which controls screen flip, but the operator sheet implies it does it via hardware, i.e. not readable by cpu. May need further investigation. + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW 1:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END diff --git a/src/mame/includes/mustache.h b/src/mame/includes/mustache.h index 0840ce2c9e3..f0f13bd64c1 100644 --- a/src/mame/includes/mustache.h +++ b/src/mame/includes/mustache.h @@ -12,7 +12,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram"), + m_dswb(*this, "DSWB") { } required_device m_maincpu; required_device m_gfxdecode; @@ -22,6 +23,8 @@ public: required_shared_ptr m_videoram; required_shared_ptr m_spriteram; + required_ioport m_dswb; + tilemap_t *m_bg_tilemap; int m_control_byte; diff --git a/src/mame/video/mustache.cpp b/src/mame/video/mustache.cpp index 0cf8abb819f..8e11878c571 100644 --- a/src/mame/video/mustache.cpp +++ b/src/mame/video/mustache.cpp @@ -54,14 +54,12 @@ WRITE8_MEMBER(mustache_state::videoram_w) WRITE8_MEMBER(mustache_state::video_control_w) { - if (flip_screen() != (data & 0x01)) - { - flip_screen_set(data & 0x01); - machine().tilemap().mark_all_dirty(); - } + /* It is assumed that screen flipping is controlled by both + hardware (via a DIP switch, labeled "Hard SW" on the + operator's sheet) and software, as in some Irem games */ + flip_screen_set((data & 0x01) ^ BIT(~m_dswb->read(), 7)); /* tile bank */ - if ((m_control_byte ^ data) & 0x08) { m_control_byte = data; @@ -128,7 +126,7 @@ void mustache_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec if (flip_screen()) { sx = 240 - sx; - sy = 240 - sy; + sy = 232 - sy; } gfx->transpen(bitmap,clip, From 3bee09d53481889759785779d71882089659f9fe Mon Sep 17 00:00:00 2001 From: darq Date: Sat, 10 Dec 2016 10:20:08 +0100 Subject: [PATCH 32/82] sidepcktj: Forgot save_item for m_scroll_y (nw) --- src/mame/drivers/sidepckt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mame/drivers/sidepckt.cpp b/src/mame/drivers/sidepckt.cpp index 0b8c144ac0b..1530e0ba7af 100644 --- a/src/mame/drivers/sidepckt.cpp +++ b/src/mame/drivers/sidepckt.cpp @@ -517,6 +517,7 @@ DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj) save_item(NAME(m_current_table)); save_item(NAME(m_in_math)); save_item(NAME(m_math_param)); + save_item(NAME(m_scroll_y)); } From ab27807d72adf1d43b846dc5dd09d4aff9860a83 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 10 Dec 2016 12:19:24 +0100 Subject: [PATCH 33/82] tms32025: Use the standard memory interfaces [O. Galibert] --- src/devices/cpu/tms32025/tms32025.cpp | 732 +++++++++----------------- src/devices/cpu/tms32025/tms32025.h | 59 ++- 2 files changed, 291 insertions(+), 500 deletions(-) diff --git a/src/devices/cpu/tms32025/tms32025.cpp b/src/devices/cpu/tms32025/tms32025.cpp index dc0e69eb7aa..7b8e2352d33 100644 --- a/src/devices/cpu/tms32025/tms32025.cpp +++ b/src/devices/cpu/tms32025/tms32025.cpp @@ -126,25 +126,6 @@ Table 3-2. TMS32025/26 Memory Blocks #define CLK 4 /* 1 cycle equals 4 clock ticks */ /* PE/DI */ - -#define SET_PC(x) do { m_PC = (x); } while (0) - -#define P_IN(A) (m_io->read_word((A)<<1)) -#define P_OUT(A,V) (m_io->write_word(((A)<<1),(V))) - -#define M_RDOP(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_word((A)<<1)) -#define M_RDOP_ARG(A) ((m_pgmmap[(A) >> 7]) ? (m_pgmmap[(A) >> 7][(A) & 0x7f]) : m_direct->read_word((A)<<1)) - - -/************************** Memory mapped registers ****************/ -#define DRR m_intRAM[0] -#define DXR m_intRAM[1] -#define TIM m_intRAM[2] -#define PRD m_intRAM[3] -#define IMR m_intRAM[4] -#define GREG m_intRAM[5] - - /**************************************************************************** ******* The following is the Status (Flag) register 0 definition. ******** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | @@ -205,12 +186,41 @@ Table 3-2. TMS32025/26 Memory Blocks const device_type TMS32025 = &device_creator; const device_type TMS32026 = &device_creator; +static ADDRESS_MAP_START( tms32025_data, AS_PROGRAM, 16, tms32025_device ) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(drr_r, drr_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(dxr_r, dxr_w) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(tim_r, tim_w) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(prd_r, prd_w) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(imr_r, imr_w) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(greg_r, greg_w) + AM_RANGE(0x0060, 0x007f) AM_RAM AM_SHARE("b2") + AM_RANGE(0x0200, 0x02ff) AM_RAM AM_SHARE("b0") + AM_RANGE(0x0300, 0x03ff) AM_RAM AM_SHARE("b1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tms32026_data, AS_PROGRAM, 16, tms32025_device ) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(drr_r, drr_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(dxr_r, dxr_w) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(tim_r, tim_w) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(prd_r, prd_w) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(imr_r, imr_w) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(greg_r, greg_w) + AM_RANGE(0x0060, 0x007f) AM_RAM AM_SHARE("b2") + AM_RANGE(0x0200, 0x03ff) AM_RAM AM_SHARE("b0") + AM_RANGE(0x0400, 0x05ff) AM_RAM AM_SHARE("b1") + AM_RANGE(0x0600, 0x07ff) AM_RAM AM_SHARE("b3") +ADDRESS_MAP_END + tms32025_device::tms32025_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : cpu_device(mconfig, TMS32025, "TMS32025", tag, owner, clock, "tms32025", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 16, 16, -1) - , m_data_config("data", ENDIANNESS_BIG, 16, 16, -1) + , m_data_config("data", ENDIANNESS_BIG, 16, 16, -1, ADDRESS_MAP_NAME(tms32025_data)) , m_io_config("io", ENDIANNESS_BIG, 16, 16, -1) + , m_b0(*this, "b0") + , m_b1(*this, "b1") + , m_b2(*this, "b2") + , m_b3(*this, "b3") , m_bio_in(*this) , m_hold_in(*this) , m_hold_ack_out(*this) @@ -221,11 +231,15 @@ tms32025_device::tms32025_device(const machine_config &mconfig, const char *tag, } -tms32025_device::tms32025_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) +tms32025_device::tms32025_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor map) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 16, 16, -1) - , m_data_config("data", ENDIANNESS_BIG, 16, 16, -1) + , m_data_config("data", ENDIANNESS_BIG, 16, 16, -1, map) , m_io_config("io", ENDIANNESS_BIG, 16, 16, -1) + , m_b0(*this, "b0") + , m_b1(*this, "b1") + , m_b2(*this, "b2") + , m_b3(*this, "b3") , m_bio_in(*this) , m_hold_in(*this) , m_hold_ack_out(*this) @@ -237,7 +251,7 @@ tms32025_device::tms32025_device(const machine_config &mconfig, device_type type tms32026_device::tms32026_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tms32025_device(mconfig, TMS32026, "TMS32026", tag, owner, clock, "tms32026", __FILE__) + : tms32025_device(mconfig, TMS32026, "TMS32026", tag, owner, clock, "tms32026", __FILE__, ADDRESS_MAP_NAME(tms32026_data)) { } @@ -248,6 +262,73 @@ offs_t tms32025_device::disasm_disassemble(std::ostream &stream, offs_t pc, cons return CPU_DISASSEMBLE_NAME(tms32025)(this, stream, pc, oprom, opram, options); } +READ16_MEMBER( tms32025_device::drr_r) +{ + return m_drr; +} + +WRITE16_MEMBER(tms32025_device::drr_w) +{ + m_drr = data; +} + +READ16_MEMBER( tms32025_device::dxr_r) +{ + return m_dxr; +} + +WRITE16_MEMBER(tms32025_device::dxr_w) +{ + m_dxr = data; + + if(TXM) { + if(FSM) + m_waiting_for_serial_frame = 1; + else + m_IFR |= 0x20; + } +} + +READ16_MEMBER( tms32025_device::tim_r) +{ + return m_tim; +} + +WRITE16_MEMBER(tms32025_device::tim_w) +{ + m_tim = data; +} + +READ16_MEMBER( tms32025_device::prd_r) +{ + return m_prd; +} + +WRITE16_MEMBER(tms32025_device::prd_w) +{ + m_prd = data; +} + +READ16_MEMBER( tms32025_device::imr_r) +{ + return m_imr; +} + +WRITE16_MEMBER(tms32025_device::imr_w) +{ + m_imr = data; +} + +READ16_MEMBER( tms32025_device::greg_r) +{ + return m_greg; +} + +WRITE16_MEMBER(tms32025_device::greg_w) +{ + m_greg = data; +} + void tms32025_device::CLR0(uint16_t flag) { m_STR0 &= ~flag; m_STR0 |= 0x0400; } void tms32025_device::SET0(uint16_t flag) { m_STR0 |= flag; m_STR0 |= 0x0400; } @@ -276,51 +357,6 @@ void tms32025_device::MODIFY_ARP(int data) m_STR0 |= 0x0400; } -uint16_t tms32025_device::M_RDROM(offs_t addr) -{ - uint16_t *ram; - addr &= 0xffff; - ram = m_pgmmap[addr >> 7]; - if (ram) return ram[addr & 0x7f]; - return m_program->read_word(addr << 1); -} - -void tms32025_device::M_WRTROM(offs_t addr, uint16_t data) -{ - uint16_t *ram; - addr &= 0xffff; - ram = m_pgmmap[addr >> 7]; - if (ram) { ram[addr & 0x7f] = data; } - else m_program->write_word(addr << 1, data); -} - -uint16_t tms32025_device::M_RDRAM(offs_t addr) -{ - uint16_t *ram; - addr &= 0xffff; - ram = m_datamap[addr >> 7]; - if (ram) return ram[addr & 0x7f]; - return m_data->read_word(addr << 1); -} - -void tms32025_device::M_WRTRAM(offs_t addr, uint16_t data) -{ - uint16_t *ram; - addr &= 0xffff; - ram = m_datamap[addr >> 7]; - if (ram) { - ram[addr & 0x7f] = data; - if(addr == 1 && ram == m_intRAM && TXM) { - if(FSM) - m_waiting_for_serial_frame = 1; - else - m_IFR |= 0x20; - } - } - else m_data->write_word(addr << 1, data); -} - - uint16_t tms32025_device::reverse_carry_add(uint16_t arg0, uint16_t arg1 ) { uint16_t result = 0; @@ -480,7 +516,7 @@ void tms32025_device::GETDATA(int shift,int signext) m_external_mem_access = 0; } - m_ALU.d = (uint16_t)M_RDRAM(m_memaccess); + m_ALU.d = (uint16_t)m_data->read_word(m_memaccess << 1); if (signext) m_ALU.d = (int16_t)m_ALU.d; m_ALU.d <<= shift; @@ -494,14 +530,14 @@ void tms32025_device::PUTDATA(uint16_t data) if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */ else m_external_mem_access = 0; - M_WRTRAM(IND, data); + m_data->write_word(IND << 1, data); MODIFY_AR_ARP(); } else { if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */ else m_external_mem_access = 0; - M_WRTRAM(DMA, data); + m_data->write_word(DMA << 1, data); } } void tms32025_device::PUTDATA_SST(uint16_t data) @@ -516,7 +552,7 @@ void tms32025_device::PUTDATA_SST(uint16_t data) m_opcode.b.l &= 0xf7; /* Stop ARP changes */ MODIFY_AR_ARP(); } - M_WRTRAM(m_memaccess, data); + m_data->write_word(m_memaccess << 1, data); } @@ -604,8 +640,8 @@ void tms32025_device::addt() void tms32025_device::adlk() { m_oldacc.d = m_ACC.d; - if (SXM) m_ALU.d = (int16_t)M_RDOP_ARG(m_PC); - else m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1); + else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d += m_ALU.d; @@ -624,7 +660,7 @@ void tms32025_device::and_() void tms32025_device::andk() { m_oldacc.d = m_ACC.d; - m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d &= m_ALU.d; @@ -639,52 +675,52 @@ void tms32025_device::apac() } void tms32025_device::br() { - SET_PC(M_RDOP_ARG(m_PC)); + m_PC = m_direct->read_word(m_PC << 1); MODIFY_AR_ARP(); } void tms32025_device::bacc() { - SET_PC(m_ACC.w.l); + m_PC = m_ACC.w.l; } void tms32025_device::banz() { - if (m_AR[ARP]) SET_PC(M_RDOP_ARG(m_PC)); + if (m_AR[ARP]) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bbnz() { - if (TC) SET_PC(M_RDOP_ARG(m_PC)); + if (TC) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bbz() { - if (TC == 0) SET_PC(M_RDOP_ARG(m_PC)); + if (TC == 0) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bc() { - if (CARRY) SET_PC(M_RDOP_ARG(m_PC)); + if (CARRY) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bgez() { - if ( (int32_t)(m_ACC.d) >= 0 ) SET_PC(M_RDOP_ARG(m_PC)); + if ( (int32_t)(m_ACC.d) >= 0 ) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bgz() { - if ( (int32_t)(m_ACC.d) > 0 ) SET_PC(M_RDOP_ARG(m_PC)); + if ( (int32_t)(m_ACC.d) > 0 ) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bioz() { - if (m_bio_in() != CLEAR_LINE) SET_PC(M_RDOP_ARG(m_PC)); + if (m_bio_in() != CLEAR_LINE) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } @@ -702,17 +738,17 @@ void tms32025_device::bitt() } void tms32025_device::blez() { - if ( (int32_t)(m_ACC.d) <= 0 ) SET_PC(M_RDOP_ARG(m_PC)); + if ( (int32_t)(m_ACC.d) <= 0 ) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::blkd() { /** Fix cycle timing **/ if (m_init_load_addr) { - m_PFC = M_RDOP_ARG(m_PC); + m_PFC = m_direct->read_word(m_PC << 1); m_PC++; } - m_ALU.d = M_RDRAM(m_PFC); + m_ALU.d = m_data->read_word(m_PFC << 1); PUTDATA(m_ALU.d); m_PFC++; m_tms32025_dec_cycles += (1*CLK); @@ -720,29 +756,29 @@ void tms32025_device::blkd() void tms32025_device::blkp() { /** Fix cycle timing **/ if (m_init_load_addr) { - m_PFC = M_RDOP_ARG(m_PC); + m_PFC = m_direct->read_word(m_PC << 1); m_PC++; } - m_ALU.d = M_RDROM(m_PFC); + m_ALU.d = m_direct->read_word(m_PFC << 1); PUTDATA(m_ALU.d); m_PFC++; m_tms32025_dec_cycles += (2*CLK); } void tms32025_device::blz() { - if ( (int32_t)(m_ACC.d) < 0 ) SET_PC(M_RDOP_ARG(m_PC)); + if ( (int32_t)(m_ACC.d) < 0 ) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bnc() { - if (CARRY == 0) SET_PC(M_RDOP_ARG(m_PC)); + if (CARRY == 0) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bnv() { - if (OV == 0) SET_PC(M_RDOP_ARG(m_PC)); + if (OV == 0) m_PC = m_direct->read_word(m_PC << 1); else { m_PC++ ; CLR0(OV_FLAG); @@ -751,14 +787,14 @@ void tms32025_device::bnv() } void tms32025_device::bnz() { - if (m_ACC.d != 0) SET_PC(M_RDOP_ARG(m_PC)); + if (m_ACC.d != 0) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::bv() { if (OV) { - SET_PC(M_RDOP_ARG(m_PC)); + m_PC = m_direct->read_word(m_PC << 1); CLR0(OV_FLAG); } else m_PC++ ; @@ -766,20 +802,20 @@ void tms32025_device::bv() } void tms32025_device::bz() { - if (m_ACC.d == 0) SET_PC(M_RDOP_ARG(m_PC)); + if (m_ACC.d == 0) m_PC = m_direct->read_word(m_PC << 1); else m_PC++ ; MODIFY_AR_ARP(); } void tms32025_device::cala() { PUSH_STACK(m_PC); - SET_PC(m_ACC.w.l); + m_PC = m_ACC.w.l; } void tms32025_device::call() { m_PC++ ; PUSH_STACK(m_PC); - SET_PC(M_RDOP_ARG((m_PC - 1))); + m_PC = m_direct->read_word((m_PC - 1) << 1); MODIFY_AR_ARP(); } void tms32025_device::cmpl() @@ -806,131 +842,73 @@ void tms32025_device::cmpr() } void tms32025_device::cnfd() /** next two fetches need to use previous CNF value ! **/ { - CLR1(CNF0_REG); - m_datamap[4] = &m_intRAM[0x200]; /* B0 */ - m_datamap[5] = &m_intRAM[0x280]; /* B0 */ - m_pgmmap[510] = nullptr; - m_pgmmap[511] = nullptr; + if(m_STR1 & CNF0_REG) { + m_program->unmap_readwrite(0xff00, 0xffff); + m_data->install_ram(0x0200, 0x02ff, m_b0); + CLR1(CNF0_REG); + } } void tms32025_device::cnfp() /** next two fetches need to use previous CNF value ! **/ { - SET1(CNF0_REG); - m_datamap[4] = nullptr; /* B0 */ - m_datamap[5] = nullptr; /* B0 */ - m_pgmmap[510] = &m_intRAM[0x200]; - m_pgmmap[511] = &m_intRAM[0x280]; + if(!(m_STR1 & CNF0_REG)) { + m_program->install_ram(0xff00, 0xffff, m_b0); + m_data->unmap_readwrite(0x0200, 0x02ff); + SET1(CNF0_REG); + } } -void tms32025_device::conf() /** Need to reconfigure the memory blocks */ + +void tms32025_device::conf() { - switch (m_opcode.b.l & 3) - { - case 00: CLR1(CNF1_REG); CLR1(CNF0_REG); - m_datamap[4] = &m_intRAM[0x200]; /* B0 */ - m_datamap[5] = &m_intRAM[0x280]; /* B0 */ - m_datamap[6] = &m_intRAM[0x300]; /* B0 */ - m_datamap[7] = &m_intRAM[0x380]; /* B0 */ - m_datamap[8] = &m_intRAM[0x400]; /* B1 */ - m_datamap[9] = &m_intRAM[0x480]; /* B1 */ - m_datamap[10] = &m_intRAM[0x500]; /* B1 */ - m_datamap[11] = &m_intRAM[0x580]; /* B1 */ - m_datamap[12] = &m_intRAM[0x600]; /* B3 */ - m_datamap[13] = &m_intRAM[0x680]; /* B3 */ - m_datamap[14] = &m_intRAM[0x700]; /* B3 */ - m_datamap[15] = &m_intRAM[0x780]; /* B3 */ - m_pgmmap[500] = nullptr; - m_pgmmap[501] = nullptr; - m_pgmmap[502] = nullptr; - m_pgmmap[503] = nullptr; - m_pgmmap[504] = nullptr; - m_pgmmap[505] = nullptr; - m_pgmmap[506] = nullptr; - m_pgmmap[507] = nullptr; - m_pgmmap[508] = nullptr; - m_pgmmap[509] = nullptr; - m_pgmmap[510] = nullptr; - m_pgmmap[511] = nullptr; - break; + // Disabled on tms32025 +} - case 01: CLR1(CNF1_REG); SET1(CNF0_REG); - m_datamap[4] = nullptr; - m_datamap[5] = nullptr; - m_datamap[6] = nullptr; - m_datamap[7] = nullptr; - m_datamap[8] = &m_intRAM[0x400]; /* B1 */ - m_datamap[9] = &m_intRAM[0x480]; /* B1 */ - m_datamap[10] = &m_intRAM[0x500]; /* B1 */ - m_datamap[11] = &m_intRAM[0x580]; /* B1 */ - m_datamap[12] = &m_intRAM[0x600]; /* B3 */ - m_datamap[13] = &m_intRAM[0x680]; /* B3 */ - m_datamap[14] = &m_intRAM[0x700]; /* B3 */ - m_datamap[15] = &m_intRAM[0x780]; /* B3 */ - m_pgmmap[500] = &m_intRAM[0x200]; /* B0 */ - m_pgmmap[501] = &m_intRAM[0x280]; /* B0 */ - m_pgmmap[502] = &m_intRAM[0x300]; /* B0 */ - m_pgmmap[503] = &m_intRAM[0x380]; /* B0 */ - m_pgmmap[504] = nullptr; - m_pgmmap[505] = nullptr; - m_pgmmap[506] = nullptr; - m_pgmmap[507] = nullptr; - m_pgmmap[508] = nullptr; - m_pgmmap[509] = nullptr; - m_pgmmap[510] = nullptr; - m_pgmmap[511] = nullptr; - break; +void tms32026_device::cnfd() +{ + // Disabled on tms32026 +} - case 02: SET1(CNF1_REG); CLR1(CNF0_REG); - m_datamap[4] = nullptr; - m_datamap[5] = nullptr; - m_datamap[6] = nullptr; - m_datamap[7] = nullptr; - m_datamap[8] = nullptr; - m_datamap[9] = nullptr; - m_datamap[10] = nullptr; - m_datamap[11] = nullptr; - m_datamap[12] = &m_intRAM[0x600]; /* B3 */ - m_datamap[13] = &m_intRAM[0x680]; /* B3 */ - m_datamap[14] = &m_intRAM[0x700]; /* B3 */ - m_datamap[15] = &m_intRAM[0x780]; /* B3 */ - m_pgmmap[500] = &m_intRAM[0x200]; /* B0 */ - m_pgmmap[501] = &m_intRAM[0x280]; /* B0 */ - m_pgmmap[502] = &m_intRAM[0x300]; /* B0 */ - m_pgmmap[503] = &m_intRAM[0x380]; /* B0 */ - m_pgmmap[504] = &m_intRAM[0x400]; /* B1 */ - m_pgmmap[505] = &m_intRAM[0x480]; /* B1 */ - m_pgmmap[506] = &m_intRAM[0x500]; /* B1 */ - m_pgmmap[507] = &m_intRAM[0x580]; /* B1 */ - m_pgmmap[508] = nullptr; - m_pgmmap[509] = nullptr; - m_pgmmap[510] = nullptr; - m_pgmmap[511] = nullptr; - break; +void tms32026_device::cnfp() +{ + // Disabled on tms32026 +} - case 03: SET1(CNF1_REG); SET1(CNF0_REG); - m_datamap[4] = nullptr; - m_datamap[5] = nullptr; - m_datamap[6] = nullptr; - m_datamap[7] = nullptr; - m_datamap[8] = nullptr; - m_datamap[9] = nullptr; - m_datamap[10] = nullptr; - m_datamap[11] = nullptr; - m_datamap[12] = nullptr; - m_datamap[13] = nullptr; - m_datamap[14] = nullptr; - m_datamap[15] = nullptr; - m_pgmmap[500] = &m_intRAM[0x200]; /* B0 */ - m_pgmmap[501] = &m_intRAM[0x280]; /* B0 */ - m_pgmmap[502] = &m_intRAM[0x300]; /* B0 */ - m_pgmmap[503] = &m_intRAM[0x380]; /* B0 */ - m_pgmmap[504] = &m_intRAM[0x400]; /* B1 */ - m_pgmmap[505] = &m_intRAM[0x480]; /* B1 */ - m_pgmmap[506] = &m_intRAM[0x500]; /* B1 */ - m_pgmmap[507] = &m_intRAM[0x580]; /* B1 */ - m_pgmmap[508] = &m_intRAM[0x600]; /* B3 */ - m_pgmmap[509] = &m_intRAM[0x680]; /* B3 */ - m_pgmmap[510] = &m_intRAM[0x700]; /* B3 */ - m_pgmmap[511] = &m_intRAM[0x780]; /* B3 */ - break; +void tms32026_device::conf() /** Need to reconfigure the memory blocks */ +{ + int prev = ((m_STR1 & CNF1_REG) ? 2 : 0) | ((m_STR1 & CNF0_REG) ? 1 : 0); + int next = m_opcode.b.l & 3; + + if(next & 1) + SET1(CNF0_REG); + else + CLR1(CNF0_REG); + + if(next & 2) + SET1(CNF1_REG); + else + CLR1(CNF1_REG); + + if(next < 1 && prev >= 1) { + m_program->unmap_readwrite(0xfa00, 0xfbff); + m_data->install_ram(0x0200, 0x03ff, m_b0); + } else if(next < 1 && prev >= 1) { + m_program->install_ram(0xfa00, 0xfbff, m_b0); + m_data->unmap_readwrite(0x0200, 0x03ff); + } + + if(next < 2 && prev >= 2) { + m_program->unmap_readwrite(0xfc00, 0xfdff); + m_data->install_ram(0x0400, 0x05ff, m_b1); + } else if(next < 2 && prev >= 2) { + m_program->install_ram(0xfc00, 0xfdff, m_b1); + m_data->unmap_readwrite(0x0400, 0x05ff); + } + + if(next < 3 && prev >= 3) { + m_program->unmap_readwrite(0xfe00, 0xffff); + m_data->install_ram(0x0600, 0x07ff, m_b3); + } else if(next < 3 && prev >= 3) { + m_program->install_ram(0xfe00, 0xffff, m_b3); + m_data->unmap_readwrite(0x0600, 0x07ff); } } void tms32025_device::dint() @@ -940,7 +918,7 @@ void tms32025_device::dint() void tms32025_device::dmov() /** Careful with how memory is configured !! */ { GETDATA(0, 0); - M_WRTRAM((m_memaccess + 1), m_ALU.w.l); + m_data->write_word((m_memaccess + 1) << 1, m_ALU.w.l); } void tms32025_device::eint() { @@ -958,7 +936,7 @@ void tms32025_device::idle() } void tms32025_device::in() { - m_ALU.w.l = P_IN( (m_opcode.b.h & 0xf) ); + m_ALU.w.l = m_io->read_word( (m_opcode.b.h & 0xf) << 1 ); PUTDATA(m_ALU.w.l); } void tms32025_device::lac() @@ -977,8 +955,8 @@ void tms32025_device::lact() } void tms32025_device::lalk() { - if (SXM) m_ALU.d = (int16_t)M_RDOP_ARG(m_PC); - else m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1); + else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d = m_ALU.d; @@ -1015,7 +993,7 @@ void tms32025_device::lph() } void tms32025_device::lrlk() { - m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_AR[m_opcode.b.h & 7] = m_ALU.w.l; } @@ -1061,7 +1039,7 @@ void tms32025_device::ltd() /** Careful with how memory is configured !! */ m_oldacc.d = m_ACC.d; GETDATA(0, 0); m_Treg = m_ALU.w.l; - M_WRTRAM((m_memaccess+1), m_ALU.w.l); + m_data->write_word((m_memaccess+1) << 1, m_ALU.w.l); SHIFT_Preg_TO_ALU(); m_ACC.d += m_ALU.d; CALCULATE_ADD_OVERFLOW(m_ALU.d); @@ -1089,7 +1067,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important ! { /** Fix cycle timing **/ m_oldacc.d = m_ACC.d; if (m_init_load_addr) { - m_PFC = M_RDOP_ARG(m_PC); + m_PFC = m_direct->read_word(m_PC << 1); m_PC++; } SHIFT_Preg_TO_ALU(); @@ -1098,7 +1076,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important ! CALCULATE_ADD_CARRY(); GETDATA(0, 0); m_Treg = m_ALU.w.l; - m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)M_RDROM(m_PFC) ); + m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC << 1) ); m_PFC++; m_tms32025_dec_cycles += (2*CLK); } @@ -1106,7 +1084,7 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important ! { /** Fix cycle timing **/ m_oldacc.d = m_ACC.d; if (m_init_load_addr) { - m_PFC = M_RDOP_ARG(m_PC); + m_PFC = m_direct->read_word(m_PC << 1); m_PC++; } SHIFT_Preg_TO_ALU(); @@ -1115,10 +1093,10 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important ! CALCULATE_ADD_CARRY(); GETDATA(0, 0); if ( (m_opcode.b.l & 0x80) || m_init_load_addr ) { /* No writing during repetition, or DMA mode */ - M_WRTRAM((m_memaccess+1), m_ALU.w.l); + m_data->write_word((m_memaccess+1) << 1, m_ALU.w.l); } m_Treg = m_ALU.w.l; - m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)M_RDROM(m_PFC) ); + m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_direct->read_word(m_PFC << 1) ); m_PFC++; m_tms32025_dec_cycles += (2*CLK); } @@ -1191,7 +1169,7 @@ void tms32025_device::or_() } void tms32025_device::ork() { - m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d |= (m_ALU.d); @@ -1199,7 +1177,7 @@ void tms32025_device::ork() void tms32025_device::out() { GETDATA(0, 0); - P_OUT( (m_opcode.b.h & 0xf), m_ALU.w.l ); + m_io->write_word( (m_opcode.b.h & 0xf) << 1, m_ALU.w.l ); } void tms32025_device::pac() { @@ -1230,7 +1208,7 @@ void tms32025_device::rc() } void tms32025_device::ret() { - SET_PC(POP_STACK()); + m_PC = POP_STACK(); } void tms32025_device::rfsm() /** serial port mode */ { @@ -1310,8 +1288,8 @@ void tms32025_device::sar_ar7() { PUTDATA(m_AR[7]); } void tms32025_device::sblk() { m_oldacc.d = m_ACC.d; - if (SXM) m_ALU.d = (int16_t)M_RDOP_ARG(m_PC); - else m_ALU.d = (uint16_t)M_RDOP_ARG(m_PC); + if (SXM) m_ALU.d = (int16_t)m_direct->read_word(m_PC << 1); + else m_ALU.d = (uint16_t)m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d -= m_ALU.d; @@ -1502,7 +1480,7 @@ void tms32025_device::tblr() if (m_init_load_addr) { m_PFC = m_ACC.w.l; } - m_ALU.w.l = M_RDROM(m_PFC); + m_ALU.w.l = m_direct->read_word(m_PFC << 1); if ( (CNF0) && ( (uint16_t)(m_PFC) >= 0xff00 ) ) {} /** TMS32025 only */ else m_tms32025_dec_cycles += (1*CLK); PUTDATA(m_ALU.w.l); @@ -1516,13 +1494,13 @@ void tms32025_device::tblw() m_tms32025_dec_cycles += (1*CLK); GETDATA(0, 0); if (m_external_mem_access) m_tms32025_dec_cycles += (1*CLK); - M_WRTROM(m_PFC, m_ALU.w.l); + m_program->write_word(m_PFC << 1, m_ALU.w.l); m_PFC++; } void tms32025_device::trap() { PUSH_STACK(m_PC); - SET_PC(0x001E); /* Trap vector */ + m_PC = 0x001E; /* Trap vector */ } void tms32025_device::xor_() { @@ -1531,7 +1509,7 @@ void tms32025_device::xor_() } void tms32025_device::xork() { - m_ALU.d = M_RDOP_ARG(m_PC); + m_ALU.d = m_direct->read_word(m_PC << 1); m_PC++; m_ALU.d <<= (m_opcode.b.h & 0xf); m_ACC.d ^= m_ALU.d; @@ -1666,7 +1644,8 @@ void tms32025_device::device_start() m_AR[0] = m_AR[1] = m_AR[2] = m_AR[3] = m_AR[4] = m_AR[5] = m_AR[6] = m_AR[7] = 0; m_STACK[0] = m_STACK[1] = m_STACK[2] = m_STACK[3] = m_STACK[4] = m_STACK[5] = m_STACK[6] = m_STACK[7] = 0; m_ALU.d = 0; - memset(m_intRAM, 0, sizeof(m_intRAM)); + m_drr = 0; + m_dxr = 0; m_timerover = 0; m_opcode.d = 0; m_external_mem_access = 0; @@ -1713,8 +1692,6 @@ void tms32025_device::device_start() save_item(NAME(m_init_load_addr)); save_item(NAME(m_PREVPC)); - save_item(NAME(m_intRAM)); - state_add( TMS32025_PC, "PC", m_PC).formatstr("%04X"); state_add( TMS32025_STR0, "STR0", m_STR0).formatstr("%04X"); state_add( TMS32025_STR1, "STR1", m_STR1).formatstr("%04X"); @@ -1739,12 +1716,12 @@ void tms32025_device::device_start() state_add( TMS32025_AR5, "AR5", m_AR[5]).formatstr("%04X"); state_add( TMS32025_AR6, "AR6", m_AR[6]).formatstr("%04X"); state_add( TMS32025_AR7, "AR7", m_AR[7]).formatstr("%04X"); - state_add( TMS32025_DRR, "DRR", m_debugger_temp).callimport().callexport().formatstr("%04X"); - state_add( TMS32025_DXR, "DXR", m_debugger_temp).callimport().callexport().formatstr("%04X"); - state_add( TMS32025_TIM, "TIM", m_debugger_temp).callimport().callexport().formatstr("%04X"); - state_add( TMS32025_PRD, "PRD", m_debugger_temp).callimport().callexport().formatstr("%04X"); - state_add( TMS32025_IMR, "IMR", m_debugger_temp).callimport().callexport().formatstr("%04X"); - state_add( TMS32025_GREG, "GREG", m_debugger_temp).callimport().callexport().formatstr("%04X"); + state_add( TMS32025_DRR, "DRR", m_drr).formatstr("%04X"); + state_add( TMS32025_DXR, "DXR", m_dxr).formatstr("%04X"); + state_add( TMS32025_TIM, "TIM", m_tim).formatstr("%04X"); + state_add( TMS32025_PRD, "PRD", m_prd).formatstr("%04X"); + state_add( TMS32025_IMR, "IMR", m_imr).formatstr("%04X"); + state_add( TMS32025_GREG, "GREG", m_greg).formatstr("%04X"); state_add(STATE_GENPC, "GENPC", m_PC).formatstr("%04X").noshow(); state_add(STATE_GENPCBASE, "CURPC", m_PREVPC).formatstr("%04X").noshow(); @@ -1756,68 +1733,6 @@ void tms32025_device::device_start() } -void tms32025_device::state_import(const device_state_entry &entry) -{ - switch (entry.index()) - { - case TMS32025_DRR: - M_WRTRAM(0, m_debugger_temp); - break; - - case TMS32025_DXR: - M_WRTRAM(1, m_debugger_temp); - break; - - case TMS32025_TIM: - M_WRTRAM(2, m_debugger_temp); - break; - - case TMS32025_PRD: - M_WRTRAM(3, m_debugger_temp); - break; - - case TMS32025_IMR: - M_WRTRAM(4,m_debugger_temp); - break; - - case TMS32025_GREG: - M_WRTRAM(5, m_debugger_temp); - break; - } -} - - -void tms32025_device::state_export(const device_state_entry &entry) -{ - switch (entry.index()) - { - case TMS32025_DRR: - m_debugger_temp = M_RDRAM(0); - break; - - case TMS32025_DXR: - m_debugger_temp = M_RDRAM(1); - break; - - case TMS32025_TIM: - m_debugger_temp = M_RDRAM(2); - break; - - case TMS32025_PRD: - m_debugger_temp = M_RDRAM(3); - break; - - case TMS32025_IMR: - m_debugger_temp = M_RDRAM(4); - break; - - case TMS32025_GREG: - m_debugger_temp = M_RDRAM(5); - break; - } -} - - void tms32025_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) @@ -1853,9 +1768,9 @@ void tms32025_device::state_string_export(const device_state_entry &entry, std:: /**************************************************************************** * Reset registers to their initial values ****************************************************************************/ -void tms32025_device::device_reset() +void tms32025_device::common_reset() { - SET_PC(0); /* Starting address on a reset */ + m_PC = 0; /* Starting address on a reset */ m_STR0 |= 0x0600; /* INTM and unused bit set to 1 */ m_STR0 &= 0xefff; /* OV cleared to 0. Remaining bits undefined */ m_STR1 |= 0x07f0; /* SXM, C, HM, FSM, XF and unused bits set to 1 */ @@ -1865,40 +1780,30 @@ void tms32025_device::device_reset() m_xf_out(ASSERT_LINE); /* XF flag is high. Must set the pin */ - /* Set the internal memory mapped registers */ - GREG = 0; - TIM = 0xffff; - PRD = 0xffff; - IMR = 0xffc0; + m_greg = 0; + m_tim = 0xffff; + m_prd = 0xffff; + m_imr = 0xffc0; m_idle = 0; m_hold = 0; m_tms32025_dec_cycles = 0; m_init_load_addr = 1; +} - /* Reset the Data/Program address banks */ - memset(m_pgmmap, 0, sizeof(m_pgmmap)); - memset(m_datamap, 0, sizeof(m_datamap)); - - m_datamap[0] = &m_intRAM[0x000]; /* B2 */ - m_datamap[4] = &m_intRAM[0x200]; /* B0 */ - m_datamap[5] = &m_intRAM[0x280]; /* B0 */ - m_datamap[6] = &m_intRAM[0x300]; /* B1 */ - m_datamap[7] = &m_intRAM[0x380]; /* B1 */ +void tms32025_device::device_reset() +{ + if(m_STR1 & CNF0_REG) { + m_program->unmap_readwrite(0xff00, 0xffff); + m_data->install_ram(0x0200, 0x02ff, m_b0); + } + common_reset(); + } void tms32026_device::device_reset() { - tms32025_device::device_reset(); - - m_datamap[8] = &m_intRAM[0x400]; /* B1 */ - m_datamap[9] = &m_intRAM[0x480]; /* B1 */ - m_datamap[10] = &m_intRAM[0x500]; /* B1 */ - m_datamap[11] = &m_intRAM[0x580]; /* B1 */ - m_datamap[12] = &m_intRAM[0x600]; /* B3 */ - m_datamap[13] = &m_intRAM[0x680]; /* B3 */ - m_datamap[14] = &m_intRAM[0x700]; /* B3 */ - m_datamap[15] = &m_intRAM[0x780]; /* B3 */ + common_reset(); } @@ -1916,59 +1821,59 @@ int tms32025_device::process_IRQs() /* Dont service Interrupts if masked, or prev instruction was EINT ! */ - if ( (INTM == 0) && (m_opcode.w.l != 0xce00) && (m_IFR & IMR) ) + if ( (INTM == 0) && (m_opcode.w.l != 0xce00) && (m_IFR & m_imr) ) { m_tms32025_irq_cycles = (3*CLK); /* 3 clock cycles used due to PUSH and DINT operation ? */ PUSH_STACK(m_PC); - if ((m_IFR & 0x01) && (IMR & 0x01)) { /* IRQ line 0 */ + if ((m_IFR & 0x01) && (m_imr & 0x01)) { /* IRQ line 0 */ //logerror("TMS32025: Active INT0\n"); - SET_PC(0x0002); + m_PC = 0x0002; standard_irq_callback(0); m_idle = 0; m_IFR &= (~0x01); SET0(INTM_FLAG); return m_tms32025_irq_cycles; } - if ((m_IFR & 0x02) && (IMR & 0x02)) { /* IRQ line 1 */ + if ((m_IFR & 0x02) && (m_imr & 0x02)) { /* IRQ line 1 */ //logerror("TMS32025: Active INT1\n"); - SET_PC(0x0004); + m_PC = 0x0004; standard_irq_callback(1); m_idle = 0; m_IFR &= (~0x02); SET0(INTM_FLAG); return m_tms32025_irq_cycles; } - if ((m_IFR & 0x04) && (IMR & 0x04)) { /* IRQ line 2 */ + if ((m_IFR & 0x04) && (m_imr & 0x04)) { /* IRQ line 2 */ //logerror("TMS32025: Active INT2\n"); - SET_PC(0x0006); + m_PC = 0x0006; standard_irq_callback(2); m_idle = 0; m_IFR &= (~0x04); SET0(INTM_FLAG); return m_tms32025_irq_cycles; } - if ((m_IFR & 0x08) && (IMR & 0x08)) { /* Timer IRQ (internal) */ + if ((m_IFR & 0x08) && (m_imr & 0x08)) { /* Timer IRQ (internal) */ // logerror("TMS32025: Active TINT (Timer)\n"); - SET_PC(0x0018); + m_PC = 0x0018; m_idle = 0; m_IFR &= (~0x08); SET0(INTM_FLAG); return m_tms32025_irq_cycles; } - if ((m_IFR & 0x10) && (IMR & 0x10)) { /* Serial port receive IRQ (internal) */ + if ((m_IFR & 0x10) && (m_imr & 0x10)) { /* Serial port receive IRQ (internal) */ // logerror("TMS32025: Active RINT (Serial receive)\n"); - DRR = m_dr_in(); - SET_PC(0x001A); + m_drr = m_dr_in(); + m_PC = 0x001A; m_idle = 0; m_IFR &= (~0x10); SET0(INTM_FLAG); return m_tms32025_irq_cycles; } - if ((m_IFR & 0x20) && (IMR & 0x20)) { /* Serial port transmit IRQ (internal) */ + if ((m_IFR & 0x20) && (m_imr & 0x20)) { /* Serial port transmit IRQ (internal) */ // logerror("TMS32025: Active XINT (Serial transmit)\n"); - m_dx_out(DXR); - SET_PC(0x001C); + m_dx_out(m_dxr); + m_PC = 0x001C; m_idle = 0; m_IFR &= (~0x20); SET0(INTM_FLAG); @@ -1995,19 +1900,19 @@ again: /* if we're not going to overflow the timer, just count the clocks */ ticks = 1 + (clocks - preclocks) / CLK; - if (ticks <= TIM) + if (ticks <= m_tim) { m_icount -= clocks; m_timerover = clocks - (ticks - 1) * CLK - preclocks; - TIM -= ticks; + m_tim -= ticks; } /* otherwise, overflow the timer and signal an interrupt */ else { - m_icount -= preclocks + CLK * TIM; + m_icount -= preclocks + CLK * m_tim; m_timerover = 0; - TIM = PRD; + m_tim = m_prd; m_IFR |= 0x08; clocks = process_IRQs(); /* Handle Timer IRQ */ @@ -2066,7 +1971,7 @@ void tms32025_device::execute_run() debugger_instruction_hook(this, m_PC); - m_opcode.d = M_RDOP(m_PC); + m_opcode.d = m_direct->read_word(m_PC << 1); m_PC++; if (m_opcode.b.h == 0xCE) /* Opcode 0xCExx has many sub-opcodes in its minor byte */ @@ -2100,7 +2005,7 @@ void tms32025_device::execute_run() debugger_instruction_hook(this, m_PC); - m_opcode.d = M_RDOP(m_PC); + m_opcode.d = m_direct->read_word(m_PC << 1); m_PC++; m_tms32025_dec_cycles += (1*CLK); @@ -2174,126 +2079,3 @@ void tms32025_device::execute_set_input(int irqline, int state) } } } - - -/**************************************************************************** - * Opcode fetcher - ****************************************************************************/ -bool tms32025_device::memory_readop(offs_t offset, int size, uint64_t &value) -{ - void *ptr; - - /* skip if not custom */ - if (!m_pgmmap[offset >> 8]) - return 0; - - ptr = &((uint8_t *)&m_pgmmap[offset >> 8])[offset & 0xff]; - switch (size) - { - case 1: value = *((uint8_t *) ptr); - case 2: value = *((uint16_t *) ptr); - case 4: value = *((uint32_t *) ptr); - case 8: value = *((uint64_t *) ptr); - } - return 1; -} - - -/**************************************************************************** - * Memory reader - ****************************************************************************/ -bool tms32025_device::memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) -{ - void *ptr; - uint64_t temp = 0; - - switch (spacenum) - { - case AS_PROGRAM: - ptr = m_pgmmap[offset >> 8]; - if (!ptr) - return 0; - break; - - case AS_DATA: - ptr = m_datamap[offset >> 8]; - if (!ptr) - return 0; - break; - - default: - case AS_IO: - return 0; - } - - switch (size) - { - case 1: - value = ((uint8_t *)ptr)[BYTE_XOR_BE(offset & 0xff)]; - break; - case 2: - value = ((uint16_t *)ptr)[(offset & 0xff) / 2]; - break; - case 4: - memory_read(spacenum, offset + 0, 2, temp); - value = temp << 16; - memory_read(spacenum, offset + 2, 2, temp); - value |= temp & 0xffff; - break; - case 8: - memory_read(spacenum, offset + 0, 4, temp); - value = temp << 32; - memory_read(spacenum, offset + 4, 4, temp); - value |= temp & 0xffffffff; - break; - } - return 1; -} - - -/**************************************************************************** - * Memory writer - ****************************************************************************/ -bool tms32025_device::memory_write(address_spacenum spacenum, offs_t offset, int size, uint64_t value) -{ - void *ptr; - - switch (spacenum) - { - case AS_PROGRAM: - ptr = m_pgmmap[offset >> 8]; - if (!ptr) - return 0; - break; - - case AS_DATA: - ptr = m_datamap[offset >> 8]; - if (!ptr) - return 0; - break; - - default: - case AS_IO: - return 0; - } - - switch (size) - { - case 1: - ((uint8_t *)ptr)[BYTE_XOR_BE(offset & 0xff)] = value; - break; - case 2: - ((uint16_t *)ptr)[(offset & 0xff) / 2] = value; - break; - case 4: - memory_write(spacenum, offset + 0, 2, value >> 16); - memory_write(spacenum, offset + 2, 2, value); - break; - case 8: - memory_write(spacenum, offset + 0, 4, value >> 32); - memory_write(spacenum, offset + 4, 4, value); - break; - } - - return 1; -} diff --git a/src/devices/cpu/tms32025/tms32025.h b/src/devices/cpu/tms32025/tms32025.h index bd752d5885e..61acec97dc5 100644 --- a/src/devices/cpu/tms32025/tms32025.h +++ b/src/devices/cpu/tms32025/tms32025.h @@ -82,7 +82,7 @@ class tms32025_device : public cpu_device public: // construction/destruction tms32025_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms32025_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source); + tms32025_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor map); // static configuration helpers template static devcb_base & set_bio_in_cb(device_t &device, _Object object) { return downcast(device).m_bio_in.set_callback(object); } @@ -92,6 +92,19 @@ public: template static devcb_base & set_dr_in_cb(device_t &device, _Object object) { return downcast(device).m_dr_in.set_callback(object); } template static devcb_base & set_dx_out_cb(device_t &device, _Object object) { return downcast(device).m_dx_out.set_callback(object); } + DECLARE_READ16_MEMBER( drr_r); + DECLARE_WRITE16_MEMBER(drr_w); + DECLARE_READ16_MEMBER( dxr_r); + DECLARE_WRITE16_MEMBER(dxr_w); + DECLARE_READ16_MEMBER( tim_r); + DECLARE_WRITE16_MEMBER(tim_w); + DECLARE_READ16_MEMBER( prd_r); + DECLARE_WRITE16_MEMBER(prd_w); + DECLARE_READ16_MEMBER( imr_r); + DECLARE_WRITE16_MEMBER(imr_w); + DECLARE_READ16_MEMBER( greg_r); + DECLARE_WRITE16_MEMBER(greg_w); + protected: // device-level overrides virtual void device_start() override; @@ -106,13 +119,8 @@ protected: // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ) ); } - virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) override; - virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, uint64_t value) override; - virtual bool memory_readop(offs_t offset, int size, uint64_t &value) override; // device_state_interface overrides - virtual void state_import(const device_state_entry &entry) override; - virtual void state_export(const device_state_entry &entry) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides @@ -120,11 +128,22 @@ protected: virtual uint32_t disasm_max_opcode_bytes() const override { return 4; } virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; -private: + void common_reset(); + address_space_config m_program_config; address_space_config m_data_config; address_space_config m_io_config; + required_shared_ptr m_b0; + required_shared_ptr m_b1; + required_shared_ptr m_b2; + optional_shared_ptr m_b3; + + address_space *m_program; + direct_read_data *m_direct; + address_space *m_data; + address_space *m_io; + typedef void ( tms32025_device::*opcode_func ) (); struct tms32025_opcode { @@ -156,9 +175,8 @@ private: uint16_t m_AR[8]; uint16_t m_STACK[8]; PAIR m_ALU; -protected: - uint16_t m_intRAM[0x800]; -private: + uint16_t m_drr, m_dxr, m_tim, m_prd, m_imr, m_greg; + uint8_t m_timerover; /********************** Status data ****************************/ @@ -176,18 +194,6 @@ private: int m_mHackIgnoreARP; /* special handling for lst, lst1 instructions */ int m_waiting_for_serial_frame; - address_space *m_program; - direct_read_data *m_direct; - address_space *m_data; - address_space *m_io; - - uint16_t *m_pgmmap[0x200]; -protected: - uint16_t *m_datamap[0x200]; - -private: - uint32_t m_debugger_temp; - inline void CLR0(uint16_t flag); inline void SET0(uint16_t flag); inline void CLR1(uint16_t flag); @@ -250,9 +256,9 @@ private: void call(); void cmpl(); void cmpr(); - void cnfd(); - void cnfp(); - void conf(); + virtual void cnfd(); + virtual void cnfp(); + virtual void conf(); void dint(); void dmov(); void eint(); @@ -380,6 +386,9 @@ public: protected: virtual void device_reset() override; + virtual void cnfd() override; + virtual void cnfp() override; + virtual void conf() override; }; From 898090ffe90ab3185238f3682132f6182c46ec64 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 10 Dec 2016 12:27:19 +0100 Subject: [PATCH 34/82] tms32051: That's an elaborate way to do a nop (nw) --- src/devices/cpu/tms32051/tms32051.cpp | 20 -------------------- src/devices/cpu/tms32051/tms32051.h | 1 - 2 files changed, 21 deletions(-) diff --git a/src/devices/cpu/tms32051/tms32051.cpp b/src/devices/cpu/tms32051/tms32051.cpp index 816af6dd2e2..5b001568574 100644 --- a/src/devices/cpu/tms32051/tms32051.cpp +++ b/src/devices/cpu/tms32051/tms32051.cpp @@ -631,26 +631,6 @@ WRITE16_MEMBER( tms32051_device::cpuregs_w ) } -bool tms32051_device::memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) -{ - /* TODO: alignment if offset is odd */ - if (spacenum == AS_PROGRAM) - { - value = (PM_READ16(offset>>1)); - } - else if (spacenum == AS_DATA) - { - value = (DM_READ16(offset>>1)); - } - else if (spacenum == AS_IO) - { - value = m_io->read_word(offset); - } - return 1; -} - - - void tms32053_device::device_reset() { // reset registers diff --git a/src/devices/cpu/tms32051/tms32051.h b/src/devices/cpu/tms32051/tms32051.h index d276ca79101..de3d33e3dc4 100644 --- a/src/devices/cpu/tms32051/tms32051.h +++ b/src/devices/cpu/tms32051/tms32051.h @@ -77,7 +77,6 @@ protected: // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ) ); } - virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) override; // device_disasm_interface overrides virtual uint32_t disasm_min_opcode_bytes() const override { return 2; } From 998e196d55198c9550e67a93e0dad1e96b0b29ae Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 10 Dec 2016 13:11:40 +0100 Subject: [PATCH 35/82] dimemory: Remove the magic bypass [O. Galibert] --- src/emu/debug/debugcpu.cpp | 43 ----------------------------------- src/emu/dimemory.cpp | 46 -------------------------------------- src/emu/dimemory.h | 8 ------- 3 files changed, 97 deletions(-) diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index e344e2cf5ff..2c5885954de 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -369,16 +369,11 @@ u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_tran space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xff */ - u64 custom; u8 result; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xff; } - else if (memory.read(space.spacenum(), address, 1, custom)) - { /* if there is a custom read handler, and it returns true, use that value */ - result = custom; - } else { /* otherwise, call the byte reading function for the translated address */ result = space.read_byte(address); @@ -422,15 +417,10 @@ u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_tra space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffff */ - u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xffff; } - else if (memory.read(space.spacenum(), address, 2, custom)) - { /* if there is a custom read handler, and it returns true, use that value */ - result = custom; - } else { /* otherwise, call the byte reading function for the translated address */ result = space.read_word(address); @@ -475,15 +465,10 @@ u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_tr m_debugger_access = true; space.set_debugger_access(true); - u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { /* translate if necessary; if not mapped, return 0xffffffff */ result = 0xffffffff; } - else if (memory.read(space.spacenum(), address, 4, custom)) - { /* if there is a custom read handler, and it returns true, use that value */ - result = custom; - } else { /* otherwise, call the byte reading function for the translated address */ result = space.read_dword(address); @@ -529,15 +514,10 @@ u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_tr space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffffffffffffffff */ - u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = ~u64(0); } - else if (memory.read(space.spacenum(), address, 8, custom)) - { /* if there is a custom read handler, and it returns true, use that value */ - result = custom; - } else { /* otherwise, call the byte reading function for the translated address */ result = space.read_qword(address); @@ -591,10 +571,6 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, boo if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; - /* if there is a custom write handler, and it returns true, use that */ - else if (memory.write(space.spacenum(), address, 1, data)) - ; - /* otherwise, call the byte reading function for the translated address */ else space.write_byte(address, data); @@ -645,10 +621,6 @@ void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bo if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; - /* if there is a custom write handler, and it returns true, use that */ - else if (memory.write(space.spacenum(), address, 2, data)) - ; - /* otherwise, call the byte reading function for the translated address */ else space.write_word(address, data); @@ -699,10 +671,6 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, b if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; - /* if there is a custom write handler, and it returns true, use that */ - else if (memory.write(space.spacenum(), address, 4, data)) - ; - /* otherwise, call the byte reading function for the translated address */ else space.write_dword(address, data); @@ -754,10 +722,6 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, b if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; - /* if there is a custom write handler, and it returns true, use that */ - else if (memory.write(space.spacenum(), address, 8, data)) - ; - /* otherwise, call the byte reading function for the translated address */ else space.write_qword(address, data); @@ -802,15 +766,8 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) /* keep in logical range */ address &= space.logbytemask(); - /* return early if we got the result directly */ m_debugger_access = true; space.set_debugger_access(true); - if (memory.readop(address, size, result2)) - { - m_debugger_access = false; - space.set_debugger_access(false); - return result2; - } /* if we're bigger than the address bus, break into smaller pieces */ if (size > space.data_width() / 8) diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index e42ad28e9d3..cdb234cde79 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -181,52 +181,6 @@ bool device_memory_interface::memory_translate(address_spacenum spacenum, int in } -//------------------------------------------------- -// memory_read - perform internal memory -// operations that bypass the memory system; -// designed to be overridden by the actual device -// implementation if internal read operations are -// handled by bypassing the memory system -//------------------------------------------------- - -bool device_memory_interface::memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value) -{ - // by default, we don't do anything - return false; -} - - -//------------------------------------------------- -// memory_write - perform internal memory -// operations that bypass the memory system; -// designed to be overridden by the actual device -// implementation if internal write operations are -// handled by bypassing the memory system -//------------------------------------------------- - -bool device_memory_interface::memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value) -{ - // by default, we don't do anything - return false; -} - - -//------------------------------------------------- -// memory_readop - perform internal memory -// operations that bypass the memory system; -// designed to be overridden by the actual device -// implementation if internal opcode fetching -// operations are handled by bypassing the memory -// system -//------------------------------------------------- - -bool device_memory_interface::memory_readop(offs_t offset, int size, u64 &value) -{ - // by default, we don't do anything - return false; -} - - //------------------------------------------------- // interface_validity_check - perform validity // checks on the memory configuration diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index c5a3226c053..342c1f02cb1 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -99,11 +99,6 @@ public: // address translation bool translate(address_spacenum spacenum, int intention, offs_t &address) { return memory_translate(spacenum, intention, address); } - // read/write access - bool read(address_spacenum spacenum, offs_t offset, int size, u64 &value) { return memory_read(spacenum, offset, size, value); } - bool write(address_spacenum spacenum, offs_t offset, int size, u64 value) { return memory_write(spacenum, offset, size, value); } - bool readop(offs_t offset, int size, u64 &value) { return memory_readop(offset, size, value); } - // deliberately ambiguous functions; if you have the memory interface // just use it device_memory_interface &memory() { return *this; } @@ -114,9 +109,6 @@ protected: // optional operation overrides virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address); - virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value); - virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value); - virtual bool memory_readop(offs_t offset, int size, u64 &value); // interface-level overrides virtual void interface_validity_check(validity_checker &valid) const override; From 595d7e2cc8852bdb83d85b5e33a347f7110d26de Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 08:46:33 -0500 Subject: [PATCH 36/82] New machines added as NOT_WORKING: - Multistar 3 [Heihachi_73] --- src/mame/drivers/gkigt.cpp | 21 ++++++++++++++++++++- src/mame/mame.lst | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 2d4f40082d7..3805c43a5a8 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -198,6 +198,25 @@ static MACHINE_CONFIG_START( igt_gameking, igt_gameking_state ) MACHINE_CONFIG_END +ROM_START( ms3 ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "3b5060ax.u8", 0x000000, 0x080000, CRC(aff8d874) SHA1(1cb972759ee12c944a1cfdbe68848c9b2e64a4d3) ) + + ROM_REGION32_LE( 0x200000, "game", 0 ) + ROM_LOAD16_BYTE( "ea5006ax.u21", 0x000000, 0x080000, CRC(9109b2e2) SHA1(daa1f01315caf6e08c3cf8b0e4925c86d2cd8dc3) ) + ROM_LOAD16_BYTE( "ea5006ax.u5", 0x000001, 0x080000, CRC(66c33cf6) SHA1(600f75ab112348f43b38cafd6f871559372f2807) ) + + ROM_REGION( 0x100000, "cg", 0 ) + ROM_LOAD16_BYTE( "1g5032ax.u48", 0x000000, 0x040000, CRC(aba6002f) SHA1(2ed51aa8bbc1e703cd63f633d745dfa4fa7f3dd0) ) + ROM_LOAD16_BYTE( "1g5032ax.u47", 0x000001, 0x040000, CRC(605a71ec) SHA1(13fe64c611c0903a7b79d8680de3ac81f3226a67) ) + + ROM_REGION( 0x200000, "plx", 0 ) + ROM_LOAD16_BYTE( "1g5032ax.u20", 0x000000, 0x100000, CRC(517e7478) SHA1(316a8e48ad6502f9508b06f900555d53ef40b464) ) + ROM_LOAD16_BYTE( "1g5032ax.u4", 0x000001, 0x100000, CRC(e67c878f) SHA1(b03f8d28924351e96bb9f24d32f0e4a40a51910c) ) + + ROM_REGION( 0x200000, "snd", 0 ) + ROM_LOAD( "1h5053xx.u6", 0x000000, 0x080000, CRC(6735c65a) SHA1(198cacec5441aa615c0de63a0b4e47265636bcee) ) +ROM_END ROM_START( ms72c ) ROM_REGION( 0x80000, "maincpu", 0 ) @@ -389,7 +408,7 @@ ROM_START( gkkey ) ROM_REGION( 0x200000, "snd", ROMREGION_ERASEFF ) ROM_END - +GAME( 1994, ms3, 0, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Multistar 3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 1994, ms72c, 0, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Multistar 7 2c", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2003, gkigt4, 0, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Game King (v4.x)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2003, gkigt4ms, gkigt4, igt_gameking, igt_gameking, driver_device, 0, ROT0, "IGT", "Game King (v4.x, MS)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 8e7f9d3a6fc..60ec8386699 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -13376,6 +13376,7 @@ gkigtez // gkkey // igtsc // ms72c // +ms3 // @source:gladiatr.cpp gcastle // QB (c) 1986 Taito Corporation (prototype?) From f66261b713ed8b0d1f53b43416943a4b45687bb6 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 10:15:57 -0500 Subject: [PATCH 37/82] i960: added scanbyte and IP-relative lda opcodes, masked low bits of branch targets [R. Belmont] --- src/devices/cpu/i960/i960.cpp | 24 ++++++++++++++++++++++++ src/mame/drivers/gkigt.cpp | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index 1f9db2d385e..acdb0c4e927 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -105,6 +105,13 @@ uint32_t i960_cpu_device::get_ea(uint32_t opcode) switch(mode) { case 0x4: return m_r[abase]; + + case 0x5: // address of this instruction + the offset dword + 8 + // which in reality is "address of next instruction + the offset dword" + ret = m_direct->read_dword(m_IP); + m_IP += 4; + ret += m_IP; + return ret; case 0x7: return m_r[abase] + (m_r[index] << scale); @@ -357,6 +364,7 @@ void i960_cpu_device::bxx(uint32_t opcode, int mask) { if(m_AC & mask) { m_IP += get_disp(opcode); + m_IP &= ~3; } } @@ -364,6 +372,7 @@ void i960_cpu_device::bxx_s(uint32_t opcode, int mask) { if(m_AC & mask) { m_IP += get_disp_s(opcode); + m_IP &= ~3; } } @@ -1068,6 +1077,21 @@ void i960_cpu_device::execute_op(uint32_t opcode) cmp_s(t1, t2); set_ri(opcode, t2-1); break; + + case 0xc: // scanbyte + m_icount -= 2; + m_AC &= ~7; // clear CC + t1 = get_1_ri(opcode); + t2 = get_2_ri(opcode); + printf("t1 %08x t2 %08x\n", t1, t2); + if ((t1 & 0xff000000) == (t2 & 0xff000000) || + (t1 & 0x00ff0000) == (t2 & 0x00ff0000) || + (t1 & 0x0000ff00) == (t2 & 0x0000ff00) || + (t1 & 0x000000ff) == (t2 & 0x000000ff)) + { + m_AC |= 2; + } + break; case 0xe: // chkbit m_icount -= 2; diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 3805c43a5a8..ff8a31a8369 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -143,11 +143,14 @@ static ADDRESS_MAP_START( igt_gameking_mem, AS_PROGRAM, 32, igt_gameking_state ) AM_RANGE(0x10000000, 0x1000001f) AM_RAM AM_RANGE(0x10000020, 0x1000021f) AM_RAM // strange range to test, correct or CPU issue? AM_RANGE(0x10000220, 0x1003ffff) AM_RAM + + AM_RANGE(0x1807d000, 0x1807dfff) AM_RAM // used by MS3 for the restart IAC and afterwards AM_RANGE(0x28010008, 0x2801000b) AM_READ(igt_gk_28010008_r) + AM_RANGE(0x28020000, 0x280205ff) AM_RAM AM_RANGE(0x28030000, 0x28030003) AM_READ(igt_gk_28030000_r) - + AM_RANGE(0xa1000000, 0xa1011fff) AM_RAM // used by gkkey for restart IAC ADDRESS_MAP_END From 5090759570ad28e20befb3ee981ed8adc25b7aec Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 10:18:30 -0500 Subject: [PATCH 38/82] removed printf (nw) --- src/devices/cpu/i960/i960.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index acdb0c4e927..07e908ceb2b 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -1083,7 +1083,6 @@ void i960_cpu_device::execute_op(uint32_t opcode) m_AC &= ~7; // clear CC t1 = get_1_ri(opcode); t2 = get_2_ri(opcode); - printf("t1 %08x t2 %08x\n", t1, t2); if ((t1 & 0xff000000) == (t2 & 0xff000000) || (t1 & 0x00ff0000) == (t2 & 0x00ff0000) || (t1 & 0x0000ff00) == (t2 & 0x0000ff00) || From ed8dd06d2a79d47dd323cd16ace1bfacee755f25 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 10:44:16 -0500 Subject: [PATCH 39/82] gkigt: fill in RAM areas so all sets make it to polling vbl instead of crashing (nw) --- src/mame/drivers/gkigt.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index ff8a31a8369..c72d7a2b6df 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -140,11 +140,9 @@ static ADDRESS_MAP_START( igt_gameking_mem, AS_PROGRAM, 32, igt_gameking_state ) AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_RANGE(0x08000000, 0x081fffff) AM_ROM AM_REGION("game", 0) - AM_RANGE(0x10000000, 0x1000001f) AM_RAM - AM_RANGE(0x10000020, 0x1000021f) AM_RAM // strange range to test, correct or CPU issue? - AM_RANGE(0x10000220, 0x1003ffff) AM_RAM + AM_RANGE(0x10000000, 0x10ffffff) AM_RAM - AM_RANGE(0x1807d000, 0x1807dfff) AM_RAM // used by MS3 for the restart IAC and afterwards + AM_RANGE(0x18070000, 0x180fffff) AM_RAM // used by MS3 for the restart IAC and afterwards AM_RANGE(0x28010008, 0x2801000b) AM_READ(igt_gk_28010008_r) AM_RANGE(0x28020000, 0x280205ff) AM_RAM From 7a37570f09106b447706dd7f81e4a18a10f085e0 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 10 Dec 2016 16:48:48 +0100 Subject: [PATCH 40/82] New clone added ---------- Fidelity Designer 2000 Display [yovan] --- src/mame/drivers/fidel6502.cpp | 17 ++++++++++++++++- src/mame/mame.lst | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 311f796abce..08b725beed3 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -1801,6 +1801,13 @@ static MACHINE_CONFIG_START( fdes2100d, fidel6502_state ) MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( fdes2000d, fdes2100d ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", R65C02, XTAL_3MHz) // R65C02P3 + MCFG_CPU_PROGRAM_MAP(fdesdis_map) +MACHINE_CONFIG_END + static MACHINE_CONFIG_START( chesster, fidel6502_state ) /* basic machine hardware */ @@ -2173,6 +2180,13 @@ ROM_START( fdes2100d ) // model 6106, PCB label 510.1130A01. The 'rev B' dump ca ROM_LOAD("bk3_white.ic10", 0x0000, 0x8000, CRC(3857cc35) SHA1(f073dafb9fd885c7ddb7fbff10e3653f343ef1c6) ) // WSI 27C256L-12 ROM_END +ROM_START( fdes2000d ) // model 6105, PCB label 510.1130A01 + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("27c256.ic9", 0x8000, 0x8000, CRC(b136d1a1) SHA1(8438790a62f45284ff33a0255c5c89f526726d3e) ) // 27C256, no label + + ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) // no rom in ic10 +ROM_END + ROM_START( chesster ) // model 6120, PCB label 510.1141C01 ROM_REGION( 0x10000, "maincpu", 0 ) @@ -2226,10 +2240,11 @@ CONS( 1987, fexcelv, fexcel, 0, fexcelv, fexcelv, driver_device, 0 CONS( 1987, fexceld, fexcel, 0, fexceld, fexcelb, driver_device, 0, "Fidelity Electronics", "Excel Display", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1985, fexcela, fexcel, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "The Excellence (model EP12)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // 1st version of The Excellence CONS( 1985, fexcelb, fexcel, 0, fexcel, fexcel, driver_device, 0, "Fidelity Electronics", "The Excellence (model 6080)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1986, fexcelp, 0, 0, fexcelp, fexcel, driver_device, 0, "Fidelity Electronics", "The Par Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1986, fexcelp, fexcel, 0, fexcelp, fexcel, driver_device, 0, "Fidelity Electronics", "The Par Excellence", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1989, fdes2000, 0, 0, fdes2000, fdes, driver_device, 0, "Fidelity Electronics", "Designer 2000", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // Excellence series hardware CONS( 1988, fdes2100d, 0, 0, fdes2100d, fdesdis, fidel6502_state, fdesdis, "Fidelity Electronics", "Designer 2100 Display (rev. B)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1988, fdes2000d, fdes2100d,0, fdes2000d, fdesdis, fidel6502_state, fdesdis, "Fidelity Electronics", "Designer 2000 Display", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1990, chesster, 0, 0, chesster, chesster, fidel6502_state, chesster, "Fidelity Electronics", "Chesster Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 60ec8386699..a1da887d98b 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -12266,6 +12266,7 @@ cscfr // * French cscg // * German cscsp // * Spanish fdes2000 // +fdes2000d // fdes2100d // feasbu // EAS: Elite A/S Challenger (Budapest program, English) feasbufr // * French From e94ce2eec99fdfa620978378873bff31aeb6e190 Mon Sep 17 00:00:00 2001 From: Bavarese Date: Sat, 10 Dec 2016 20:05:25 +0100 Subject: [PATCH 41/82] DEC Rainbow 100: correct cursor position in REGIS --- src/mame/drivers/rainbow.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 5e240a25289..806d38e8e31 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -754,20 +754,19 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_state::hgdc_display_pixels ) return; // no output from graphics option } - address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x7FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); - // ********************* GET BITMAP DATA FOR 4 PLANES *************************************** // _READ_ BIT MAP from 2 or 4 planes (plane 0 is least, plane 3 most significant). See page 42 / 43 if(m_GDC_MODE_REGISTER & GDC_MODE_HIGHRES) { + address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x7FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); plane0 = m_video_ram[((address & 0x7fff) + 0x00000) >> 1]; plane1 = m_video_ram[((address & 0x7fff) + 0x10000) >> 1]; plane2 = plane3 = 0; } else { + address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x3FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); // MED.RESOLUTION (4 planes, 4 color bits, 16 color map entries / 16 (4) MONOCHROME SHADES) - // MANUAL SAYS: (GDC "sees" 4 planes X 16 bits X 8K words)! plane0 = m_video_ram[((address & 0x3fff) + 0x00000) >> 1]; plane1 = m_video_ram[((address & 0x3fff) + 0x10000) >> 1]; plane2 = m_video_ram[((address & 0x3fff) + 0x20000) >> 1]; @@ -2727,14 +2726,10 @@ READ16_MEMBER(rainbow_state::vram_r) // NOTE: Rainbow has separate registers for fore and background. WRITE16_MEMBER(rainbow_state::vram_w) { - if(!(m_GDC_MODE_REGISTER & GDC_MODE_VECTOR)) - { - // SCROLL_MAP IN BITMAP MODE ONLY...? - if(m_GDC_MODE_REGISTER & GDC_MODE_HIGHRES) + if(m_GDC_MODE_REGISTER & GDC_MODE_HIGHRES) offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x3FC0) >> 6 ] << 6) | (offset & 0x3F); - else + else offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x1FC0) >> 6 ] << 6) | (offset & 0x3F); - } offset &= 0xffff; // same as in VT240? uint16_t chr = data; // VT240 : uint8_t @@ -2868,7 +2863,7 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w) OPTION_RESET_PATTERNS } - m_PORT50 = data; + //m_PORT50 = data; break; case 1: // 51h - DATA loaded into register previously written to 53h. From 035a7bcd63abc009f7ba697276da935d21759b72 Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Sat, 10 Dec 2016 21:46:19 +0200 Subject: [PATCH 42/82] stv.cpp: document IO chip, fix astrass test mode hang --- src/mame/drivers/stv.cpp | 41 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index fb9ae38f2f3..292a9c16967 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -53,6 +53,7 @@ /* +Sega 315-5649 IO IC, functional same as 315-5338A, also used in Model 2/3, integrated into 315-6146 'MIE' MCU, etc I/O overview: Connector (as described in service manual) PORT-A 1st player inputs JAMMA (56P) PORT-B 2nd player inputs JAMMA (56P) @@ -75,17 +76,17 @@ offsets: 0x0009 PORT-E (P3) 0x000b PORT-F (P4 / Extra 6B layout) 0x000d PORT-G - 0x000f - 0x0011 PORT_SEL? + 0x000f unused + 0x0011 PORT_DIRECTION (each bit configure above IO ports, 1 - input, 0 - output) ---x ---- joystick/mahjong panel select ---- x--- used in danchih (different mux scheme for the hanafuda panel?) - 0x0013 - 0x0015 SERIAL COM Tx - 0x0017 - 0x0019 SERIAL COM Rx - 0x001b - 0x001d - 0x001f PORT-AD + 0x0013 RS422 TXD1 + 0x0015 RS422 TXD2 SERIAL COM Tx + 0x0017 RS422 RXD1 + 0x0019 RS422 RXD2 SERIAL COM Rx + 0x001b RS422 FLAG + 0x001d MODE (bit 7 - set PORT-G to counter-mode, bits 0-5 - RS422 satellite mode and node#) + 0x001f PORT-AD (8ch, write: bits 0-2 - set channel, read: channel data with autoinc channel number) */ READ8_MEMBER(stv_state::stv_ioga_r) @@ -103,7 +104,7 @@ READ8_MEMBER(stv_state::stv_ioga_r) case 0x01: res = ioport("PORTA")->read(); break; // P1 case 0x03: res = ioport("PORTB")->read(); break; // P2 case 0x05: res = ioport("PORTC")->read(); break; // SYSTEM - case 0x07: res = m_system_output | 0xf0; break; // port D, read-backs value written + case 0x07: res = m_system_output; break; // port D, read-backs value written case 0x09: res = ioport("PORTE")->read(); break; // P3 case 0x0b: res = ioport("PORTF")->read(); break; // P4 case 0x1b: res = 0; break; // Serial COM READ status @@ -122,7 +123,7 @@ WRITE8_MEMBER(stv_state::stv_ioga_w) switch(offset) { case 0x07: - m_system_output = data & 0xf; + m_system_output = data; /*Why does the BIOS tests these as ACTIVE HIGH? A program bug?*/ machine().bookkeeping().coin_counter_w(0,~data & 0x01); machine().bookkeeping().coin_counter_w(1,~data & 0x02); @@ -201,7 +202,7 @@ READ8_MEMBER(stv_state::stvmp_ioga_r) { case 0x01: case 0x03: - if(m_port_sel & 0x10) // joystick select + if(m_port_sel & 0x10) // joystick select <<< this is obviously wrong, this bit only select PORTE direction res = stv_ioga_r(space,offset); else // mahjong panel select { @@ -1783,7 +1784,7 @@ ROM_START( astrass ) ROM_LOAD16_WORD_SWAP( "mpr20832.8", 0x1c00000, 0x0400000, CRC(af1b0985) SHA1(d7a0e4e0a8b0556915f924bdde8c3d14e5b3423e) ) // good (was .18s) ROM_LOAD16_WORD_SWAP( "mpr20833.9", 0x2000000, 0x0400000, CRC(cb6af231) SHA1(4a2e5d7c2fd6179c19cdefa84a03f9a34fbb9e70) ) // good (was .19s) - // 25349801 1998 317-5040-COM ST-V (yes, the 317-5040-COM chip was reused for 3 different games and on both Naomi and ST-V!) + // 610-0374-90 1998 317-5040-COM ST-V (yes, the 317-5040-COM chip was reused for 3 different games and on both Naomi and ST-V!) ROM_PARAMETER( ":315_5881:key", "052e2901" ) ROM_END @@ -1930,7 +1931,7 @@ ROM_START( elandore ) ROM_LOAD16_WORD_SWAP( "mpr21306.1", 0x1800000, 0x0400000, CRC(87a5929c) SHA1(b259341d7b0e1fa98959bf52d23db5c308a8efdd) ) // good (was .17) ROM_LOAD16_WORD_SWAP( "mpr21308.8", 0x1c00000, 0x0400000, CRC(336ec1a4) SHA1(20d1fce050cf6132d284b91853a4dd5626372ef0) ) // good (was .18s) - // 1998 317-5043-COM ST-V + // 610-0374-126 1998 317-5043-COM ST-V ROM_PARAMETER( ":315_5881:key", "05226d41" ) ROM_END @@ -1946,7 +1947,7 @@ ROM_START( ffrevng10 ) ROM_LOAD16_WORD_SWAP( "mpr21877.6", 0x1400000, 0x0400000, CRC(c22a4a75) SHA1(3276bc0628e71b432f21ba9a4f5ff7ccc8769cd9) ) // good (was .16) ROM_LOAD16_WORD_SWAP( "opr21878.1", 0x1800000, 0x0200000, CRC(2ea4a64d) SHA1(928a973dce5eba0a1628d61ba56a530de990a946) ) // good (was .17) - // 1998 317-5049-COM ST-V + // 610-0374-128 1998 317-5049-COM ST-V ROM_PARAMETER( ":315_5881:key", "0524ac01" ) ROM_END @@ -1965,7 +1966,7 @@ ROM_START( ffreveng ) ROM_LOAD16_WORD_SWAP( "mpr21877.6", 0x1400000, 0x0400000, CRC(c22a4a75) SHA1(3276bc0628e71b432f21ba9a4f5ff7ccc8769cd9) ) // good (was .16) ROM_LOAD16_WORD_SWAP( "opr21878.1", 0x1800000, 0x0200000, CRC(2ea4a64d) SHA1(928a973dce5eba0a1628d61ba56a530de990a946) ) // good (was .17) - // 1998 317-5049-COM ST-V + // 610-0374-128 1998 317-5049-COM ST-V ROM_PARAMETER( ":315_5881:key", "0524ac01" ) ROM_END @@ -2224,7 +2225,7 @@ ROM_START( rsgun ) ROM_LOAD16_WORD_SWAP( "mpr20961.4", 0x0c00000, 0x0400000, CRC(0e06295c) SHA1(0ec2842622f3e9dc5689abd58aeddc7e5603b97a) ) // good (was .14) ROM_LOAD16_WORD_SWAP( "mpr20962.5", 0x1000000, 0x0400000, CRC(f1e6c7fc) SHA1(0ba0972f1bc7c56f4e0589d3e363523cea988bb0) ) // good (was .15) - // 1998 317-5041-COM ST-V + // 610-0374-96 1998 317-5041-COM ST-V ROM_PARAMETER( ":315_5881:key", "05272d01" ) ROM_END @@ -2415,7 +2416,7 @@ ROM_START( sss ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) // preconfigured to 1 player ROM_LOAD( "sss.nv", 0x0000, 0x0080, CRC(3473b2f3) SHA1(6480b4b321af8ee6e967710e74f2556c17bfca97) ) - // 1998 317-5042-COM ST-V + // 610-0374-107 1998 317-5042-COM ST-V ROM_PARAMETER( ":315_5881:key", "052b6901" ) ROM_END @@ -2448,7 +2449,7 @@ ROM_START( twcup98 ) ROM_LOAD16_WORD_SWAP( "mpr20823.14", 0x0c00000, 0x0400000, CRC(6e6d4e95) SHA1(c387d03ba27580c62ac0bf780915fdf41552df6f) ) // tested as IC4 ROM_LOAD16_WORD_SWAP( "mpr20824.15", 0x1000000, 0x0400000, CRC(4cf18a25) SHA1(310961a5f114fea8938a3f514dffd5231e910a5a) ) // tested as IC5 - // 25209801 1998 317-5039-COM ST-V + // 610-0374-89 1998 317-5039-COM ST-V ROM_PARAMETER( ":315_5881:key", "05200913" ) ROM_END @@ -2464,7 +2465,7 @@ ROM_START( twsoc98 ) ROM_LOAD16_WORD_SWAP( "mpr20823.14", 0x0c00000, 0x0400000, CRC(6e6d4e95) SHA1(c387d03ba27580c62ac0bf780915fdf41552df6f) ) // tested as IC4 ROM_LOAD16_WORD_SWAP( "mpr20824.15", 0x1000000, 0x0400000, CRC(4cf18a25) SHA1(310961a5f114fea8938a3f514dffd5231e910a5a) ) // tested as IC5 - // 25209801 1998 317-5039-COM ST-V + // 610-0374-91 1998 317-5039-COM ST-V ROM_PARAMETER( ":315_5881:key", "05200913" ) ROM_END From 08085f064bc2a941072de522dac5c0e216a98335 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 10 Dec 2016 22:31:24 +0100 Subject: [PATCH 43/82] sharcdrc: Fix horribly subtle bug (nw) --- src/devices/cpu/sharc/sharcdrc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/sharc/sharcdrc.cpp b/src/devices/cpu/sharc/sharcdrc.cpp index beefa289a6c..b8ab1a1f975 100644 --- a/src/devices/cpu/sharc/sharcdrc.cpp +++ b/src/devices/cpu/sharc/sharcdrc.cpp @@ -308,12 +308,12 @@ void adsp21062_device::static_generate_memory_accessor(MEM_ACCESSOR_TYPE type, c { case MEM_ACCESSOR_PM_READ48: UML_SHL(block, I1, I1, 3); - UML_READ(block, I0, I1, SIZE_QWORD, SPACE_PROGRAM); + UML_DREAD(block, I0, I1, SIZE_QWORD, SPACE_PROGRAM); break; case MEM_ACCESSOR_PM_WRITE48: UML_SHL(block, I1, I1, 3); - UML_WRITE(block, I1, I0, SIZE_QWORD, SPACE_PROGRAM); + UML_DWRITE(block, I1, I0, SIZE_QWORD, SPACE_PROGRAM); UML_MOV(block, mem(&m_core->force_recompile), 1); break; From 33d5d79763731696625c2762dfee24f582333c81 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 10 Dec 2016 16:48:32 -0500 Subject: [PATCH 44/82] gkigt: checkpoint (nw) I'm stopping here on this for now; bored people welcome. --- src/mame/drivers/gkigt.cpp | 70 ++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index c72d7a2b6df..33662299a10 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -78,8 +78,9 @@ PCB board that connects to 044 boards via J6 & J7 Adds the abillity to use legacy 038 EPROM based software or 039 EPROM + SIMM software - - +More chips (from eBay auction): + 2x Phillips / NXT 28C94 quad UART (8 serial channels total) + ADV476 256 color RAMDAC */ #include "emu.h" @@ -90,9 +91,12 @@ class igt_gameking_state : public driver_device { public: igt_gameking_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) + : driver_device(mconfig, type, tag), + m_palette(*this, "palette") { } + required_device m_palette; + virtual void video_start() override; uint32_t screen_update_igt_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -101,7 +105,7 @@ public: DECLARE_READ32_MEMBER(igt_gk_28010008_r) { - return rand(); + return rand(); // don't quite understand this one }; DECLARE_READ32_MEMBER(igt_gk_28030000_r) @@ -109,13 +113,57 @@ public: return rand(); }; + DECLARE_READ32_MEMBER(uart_status_r); + DECLARE_WRITE32_MEMBER(uart_w); + DECLARE_WRITE32_MEMBER(clut_w); + DECLARE_WRITE32_MEMBER(clut_mask_w); +private: + int m_offset, m_r, m_g, m_b, m_state; + bool m_bToggle; + u8 m_clut_mask; }; static INPUT_PORTS_START( igt_gameking ) INPUT_PORTS_END +WRITE32_MEMBER(igt_gameking_state::clut_w) +{ + if (mem_mask == 0x000000ff) + { + m_offset = data & 0xff; + m_state = 0; + } + else if (mem_mask == 0x00ff0000) + { + switch (m_state) + { + case 0: m_r = (data>>16) & 0xff; m_state++; break; + case 1: m_g = (data>>16) & 0xff; m_state++; break; + case 2: + m_b = (data>>16) & 0xff; + //printf("CLUT: color %d = R %d G %d B %d\n", m_offset, m_r, m_g, m_b); + m_palette->set_pen_color(m_offset, m_r<<18 | m_g<<10 | m_b<<2); + m_state = 0; + break; + } + } +} +WRITE32_MEMBER(igt_gameking_state::clut_mask_w) +{ + m_clut_mask = data & 0xff; +} + +READ32_MEMBER(igt_gameking_state::uart_status_r) +{ + return 0x00040000; +} + +WRITE32_MEMBER(igt_gameking_state::uart_w) +{ + printf("%c", (data>>16) & 0x7f); +} void igt_gameking_state::machine_start() { @@ -123,6 +171,9 @@ void igt_gameking_state::machine_start() void igt_gameking_state::machine_reset() { + m_bToggle = false; + m_offset = m_state = m_r = m_g = m_b = 0; + m_clut_mask = 0xff; } void igt_gameking_state::video_start() @@ -142,11 +193,18 @@ static ADDRESS_MAP_START( igt_gameking_mem, AS_PROGRAM, 32, igt_gameking_state ) AM_RANGE(0x10000000, 0x10ffffff) AM_RAM - AM_RANGE(0x18070000, 0x180fffff) AM_RAM // used by MS3 for the restart IAC and afterwards + AM_RANGE(0x18000000, 0x181fffff) AM_RAM // igtsc writes from 18000000 to 1817ffff, ms3 all the way to 181fffff. + // 28010000-2801007f: first 28C94 QUART AM_RANGE(0x28010008, 0x2801000b) AM_READ(igt_gk_28010008_r) - AM_RANGE(0x28020000, 0x280205ff) AM_RAM + AM_RANGE(0x28010030, 0x28010033) AM_READ(uart_status_r) // channel D + AM_RANGE(0x28010034, 0x28010037) AM_WRITE(uart_w) // channel D + // 28020000-2802007f: second 28C94 QUART AM_RANGE(0x28030000, 0x28030003) AM_READ(igt_gk_28030000_r) + AM_RANGE(0x28040000, 0x2804ffff) AM_RAM + AM_RANGE(0x28050000, 0x28050003) AM_DEVREADWRITE8("ymz", ymz280b_device, read, write, 0x00ff00ff) + AM_RANGE(0x28060000, 0x28060003) AM_WRITE(clut_w) + AM_RANGE(0x28060004, 0x28060007) AM_WRITE(clut_mask_w) AM_RANGE(0xa1000000, 0xa1011fff) AM_RAM // used by gkkey for restart IAC From 80b5c632f7f4769554cf228c7f4787c4834b80f9 Mon Sep 17 00:00:00 2001 From: rfka01 Date: Sat, 10 Dec 2016 23:35:43 +0100 Subject: [PATCH 45/82] Added floppy drives to the PG675 and PG685 variants. Changed floppy controller to FD1797. Floppy controller not hooked up yet. --- src/mame/drivers/pg685.cpp | 41 ++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index bf5c490501f..bf6d14994a3 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -105,7 +105,10 @@ public: m_maincpu(*this, "maincpu"), m_vram(*this, "framebuffer"), m_vram16(*this, "framebuffer16"), - m_fontram(*this, "charcopy") + m_fontram(*this, "charcopy"), + m_fdc (*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1") { } MC6845_UPDATE_ROW(crtc_update_row); @@ -122,6 +125,8 @@ public: DECLARE_READ8_MEMBER(f9f78_r); DECLARE_WRITE8_MEMBER(f9f78_w); DECLARE_WRITE8_MEMBER(f9f79_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); private: virtual void machine_reset() override; @@ -130,6 +135,9 @@ private: optional_shared_ptr m_vram; optional_shared_ptr m_vram16; optional_shared_ptr m_fontram; + required_device m_fdc; + required_device m_floppy0; + optional_device m_floppy1; }; //************************************************************************** @@ -147,7 +155,7 @@ static ADDRESS_MAP_START(pg675_mem, AS_PROGRAM, 8, pg685_state) AM_RANGE(0xf9f06, 0xf9f07) AM_DEVREADWRITE("mainpic", pic8259_device, read, write) AM_RANGE(0xf9f08, 0xf9f08) AM_DEVREADWRITE("mainuart", i8251_device, data_r, data_w) AM_RANGE(0xf9f09, 0xf9f09) AM_DEVREADWRITE("mainuart", i8251_device, status_r, control_w) - AM_RANGE(0xf9f20, 0xf9f23) AM_DEVREADWRITE("fdc", wd2797_t, read, write) + AM_RANGE(0xf9f20, 0xf9f23) AM_DEVREADWRITE("fdc", fd1797_t, read, write) AM_RANGE(0xf9f24, 0xf9f24) AM_READWRITE(f9f24_r, f9f24_w) AM_RANGE(0xf9f28, 0xf9f2b) AM_DEVREADWRITE("modppi1", i8255_device, read, write) AM_RANGE(0xf9f2c, 0xf9f2f) AM_DEVREADWRITE("modppi2", i8255_device, read, write) @@ -183,7 +191,7 @@ static ADDRESS_MAP_START(pg685oua12_mem, AS_PROGRAM, 16, pg685_state) AM_RANGE(0xf9f06, 0xf9f07) AM_DEVREADWRITE8("mainpic", pic8259_device, read, write, 0xffff) AM_RANGE(0xf9f08, 0xf9f09) AM_DEVREADWRITE8("mainuart", i8251_device, data_r, data_w, 0x00ff) AM_RANGE(0xf9f08, 0xf9f09) AM_DEVREADWRITE8("mainuart", i8251_device, status_r, control_w, 0xff00) - AM_RANGE(0xf9f20, 0xf9f23) AM_DEVREADWRITE8("fdc", wd2797_t, read, write, 0xffff) + AM_RANGE(0xf9f20, 0xf9f23) AM_DEVREADWRITE8("fdc", fd1797_t, read, write, 0xffff) AM_RANGE(0xf9f24, 0xf9f25) AM_READWRITE8(f9f24_r, f9f24_w, 0x00ff) AM_RANGE(0xf9f28, 0xf9f2b) AM_DEVREADWRITE8("modppi1", i8255_device, read, write, 0xffff) AM_RANGE(0xf9f2c, 0xf9f2f) AM_DEVREADWRITE8("modppi2", i8255_device, read, write, 0xffff) @@ -256,6 +264,15 @@ READ8_MEMBER(pg685_state::f9f3f_r) // FLOPPY //************************************************************************** +static SLOT_INTERFACE_START( pg675_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( pg685_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + READ8_MEMBER(pg685_state::f9f24_r) { logerror("Reading from F9F24\n"); @@ -267,6 +284,7 @@ WRITE8_MEMBER(pg685_state::f9f24_w) logerror("Writing %02X to F9F24\n", data); } + //************************************************************************** // HARDDISK //************************************************************************** @@ -370,7 +388,7 @@ static MACHINE_CONFIG_FRAGMENT(pg685_backplane) MACHINE_CONFIG_END static MACHINE_CONFIG_FRAGMENT(pg685_module) - MCFG_DEVICE_ADD("fdc", WD2797, XTAL_4MHz / 2) // divider guessed + MCFG_DEVICE_ADD("fdc", FD1797, XTAL_4MHz / 2) // divider guessed MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("mainpic", pic8259_device, ir4_w)) MCFG_DEVICE_ADD("modppi1", I8255, 0) @@ -379,6 +397,7 @@ static MACHINE_CONFIG_FRAGMENT(pg685_module) MCFG_DEVICE_ADD("moduart", I8251, XTAL_4MHz / 2) // divider guessed MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) + MACHINE_CONFIG_END static MACHINE_CONFIG_START( pg675, pg685_state ) @@ -419,6 +438,12 @@ static MACHINE_CONFIG_START( pg675, pg685_state ) // printer // floppy + // MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(zorba_state, fdc_intrq_w)) + // MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pg675_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pg675_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END @@ -462,6 +487,10 @@ static MACHINE_CONFIG_START( pg685, pg685_state ) // floppy + // MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pg685_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + // harddisk MCFG_DEVICE_ADD("hdc", WD2010, XTAL_10MHz / 2) // divider guessed MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("mainpic", pic8259_device, ir3_w)) @@ -507,6 +536,10 @@ static MACHINE_CONFIG_START( pg685oua12, pg685_state ) // floppy + // MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pg685_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + // harddisk MCFG_DEVICE_ADD("hdc", WD2010, XTAL_10MHz / 2) // divider guessed MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("mainpic", pic8259_device, ir3_w)) From d5f0f653dfe9f776219e63cc236089f1223f83fc Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 11 Dec 2016 10:28:13 +1100 Subject: [PATCH 46/82] MT 06450 --- src/mame/drivers/astinvad.cpp | 77 +++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 5fcc2838eeb..9ddee6d24db 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -53,31 +53,15 @@ public: }; astinvad_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi8255_0(*this, "ppi8255_0"), - m_ppi8255_1(*this, "ppi8255_1"), - m_palette(*this, "palette"), - m_videoram(*this, "videoram"), - m_samples(*this, "samples"), - m_screen(*this, "screen"){ } - - required_device m_maincpu; - optional_device m_ppi8255_0; - optional_device m_ppi8255_1; - required_device m_palette; - required_shared_ptr m_videoram; - - std::unique_ptr m_colorram; - emu_timer *m_int_timer; - uint8_t m_sound_state[2]; - uint8_t m_screen_flip; - uint8_t m_screen_red; - uint8_t m_flip_yoffs; - uint8_t m_color_latch; - - required_device m_samples; - required_device m_screen; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_ppi8255_0(*this, "ppi8255_0") + , m_ppi8255_1(*this, "ppi8255_1") + , m_palette(*this, "palette") + , m_videoram(*this, "videoram") + , m_samples(*this, "samples") + , m_screen(*this, "screen") + { } DECLARE_WRITE8_MEMBER(color_latch_w); DECLARE_WRITE8_MEMBER(spaceint_videoram_w); @@ -99,13 +83,31 @@ public: DECLARE_MACHINE_RESET(spaceint); DECLARE_VIDEO_START(spaceint); uint32_t screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(kamikaze_int_off); TIMER_CALLBACK_MEMBER(kamizake_int_gen); + +private: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; void plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color ); -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + std::unique_ptr m_colorram; + emu_timer *m_int_timer; + uint8_t m_sound_state[2]; + uint8_t m_screen_flip; + uint8_t m_screen_red; + uint8_t m_flip_yoffs; + uint8_t m_color_latch; + bool m_player; + + required_device m_maincpu; + optional_device m_ppi8255_0; + optional_device m_ppi8255_1; + required_device m_palette; + required_shared_ptr m_videoram; + required_device m_samples; + required_device m_screen; }; @@ -178,6 +180,25 @@ uint32_t astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rg } +uint32_t astinvad_state::screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const uint8_t *color_prom = memregion("proms")->base(); + uint8_t yoffs = m_flip_yoffs & m_screen_flip; + int x, y; + + /* render the visible pixels */ + for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8) + { + uint8_t color = color_prom[(((y & 0xf8) << 2) | (x >> 3)) ^ (m_screen_flip ? 0x3ff : m_player ? 0 : 0x3ff)] >> (m_player ? 4 : 0); + uint8_t data = m_videoram[(((y ^ m_screen_flip) + yoffs) << 5) | ((x ^ m_screen_flip) >> 3)]; + plot_byte(bitmap, y, x, data, m_screen_red ? 1 : color & 0x07); + } + + return 0; +} + + uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const uint8_t *color_prom = memregion("proms")->base(); @@ -400,6 +421,7 @@ WRITE8_MEMBER(astinvad_state::spcking2_sound2_w) if (bits_gone_hi & 0x10) m_samples->start(4, SND_UFOHIT); m_screen_flip = (ioport("CABINET")->read() & data & 0x20) ? 0xff : 0x00; + m_player = BIT(data, 5); } WRITE8_MEMBER(astinvad_state::spcking2_sound3_w) @@ -675,6 +697,7 @@ static MACHINE_CONFIG_DERIVED( spcking2, kamikaze ) /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 320, 0, 256, 256, 16, 240) + MCFG_SCREEN_UPDATE_DRIVER(astinvad_state, screen_update_spcking2) MACHINE_CONFIG_END From e23da89d4b49432ec7d80e58818eb08cfdfb8386 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sat, 10 Dec 2016 18:57:58 -0500 Subject: [PATCH 47/82] New clones added NOT WORKING ---------------------------- Golden Crown Hopper [Gerald COY] --- src/mame/drivers/bfm_sc2.cpp | 19 +++++++++++++++++++ src/mame/mame.lst | 1 + 2 files changed, 20 insertions(+) diff --git a/src/mame/drivers/bfm_sc2.cpp b/src/mame/drivers/bfm_sc2.cpp index 03b4069500d..28fc948f7fd 100644 --- a/src/mame/drivers/bfm_sc2.cpp +++ b/src/mame/drivers/bfm_sc2.cpp @@ -2523,6 +2523,24 @@ ROM_START( gldncrwn ) ROM_LOAD("gcrpal.bin", 0, 8 , CRC(4edd5a1d) SHA1(d6fe38377d5f2291d33ee8ed808548871e63c4d7)) ROM_END +ROM_START( gldncrwnhop ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("95752007.gam", 0x00000, 0x10000, CRC(ba009ab7) SHA1(df58f5ff4e9fdf8db5931833b909fb0e4ba8e23d)) + + ROM_REGION( 0x20000, "adder2", 0 ) + ROM_LOAD("95770146.vid", 0x00000, 0x20000, CRC(f3109cd5) SHA1(8da5207c07015d6f5a72397eaa6ab70800785f7f)) + + ROM_REGION( 0x20000, "upd", 0 ) + ROM_LOAD("95770139.snd", 0x00000, 0x20000, CRC(e76ca414) SHA1(2c441e3369e374c033b5585e8f6a9c34a4c5ec0f)) + + ROM_REGION( 0x40000, "gfx1", ROMREGION_ERASEFF ) + ROM_LOAD("95770147.chr", 0x00000, 0x20000, CRC(5a4d2b79) SHA1(c2f2f39ef6816e0da1b2ff4b723612c671c6215f)) + + ROM_REGION( 0x10, "proms", 0 ) + ROM_LOAD("gcrpal.bin", 0, 8 , BAD_DUMP CRC(4edd5a1d) SHA1(d6fe38377d5f2291d33ee8ed808548871e63c4d7)) // This was missing with dump, using gldncrwn +ROM_END + + // ROM definition Dutch Paradice ////////////////////////////////////////// ROM_START( paradice ) @@ -7646,6 +7664,7 @@ GAMEL( 1996, sltblgpo, 0, scorpion2_vid, sltblgpo, bfm_sc2_state, sltsb GAMEL( 1996, sltblgp1, sltblgpo, scorpion2_vid, sltblgpo, bfm_sc2_state, sltsbelg, 0, "BFM/ELAM", "Slots (Belgian Cash, Game Card 95-752-008)", MACHINE_SUPPORTS_SAVE,layout_sltblgpo ) GAMEL( 1997, gldncrwn, 0, scorpion2_vid, gldncrwn, bfm_sc2_state, gldncrwn, 0, "BFM/ELAM", "Golden Crown (Dutch, Game Card 95-752-011)", MACHINE_SUPPORTS_SAVE,layout_gldncrwn ) +GAMEL( 1997, gldncrwnhop,gldncrwn,scorpion2_vid, gldncrwn, bfm_sc2_state, gldncrwn, 0, "BFM/ELAM", "Golden Crown Hopper (Dutch, Game Card)", MACHINE_SUPPORTS_SAVE,layout_gldncrwn ) /* Non-Video */ diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a1da887d98b..d31e5eee52a 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -3144,6 +3144,7 @@ sc1zep // Zeppelin (Bellfruit) @source:bfm_sc2.cpp gldncrwn // 1997 +gldncrwnhop // 1997 paradice // 1995 pokio // 1994 pyramid // 1996 From fbed00ead9ff1ef9ac80c92961a546ac796f0444 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Sun, 11 Dec 2016 01:05:15 +0100 Subject: [PATCH 48/82] tnzs: Various refactoring. [Ryan Holtz] --- src/mame/drivers/cchance.cpp | 21 +- src/mame/drivers/tnzs.cpp | 461 +++++++++++++---------------------- src/mame/includes/tnzs.h | 313 ++++++++++++++++-------- src/mame/machine/tnzs.cpp | 262 +++++++++----------- src/mame/video/tnzs.cpp | 11 +- 5 files changed, 500 insertions(+), 568 deletions(-) diff --git a/src/mame/drivers/cchance.cpp b/src/mame/drivers/cchance.cpp index dddb53baa04..199631d4f04 100644 --- a/src/mame/drivers/cchance.cpp +++ b/src/mame/drivers/cchance.cpp @@ -39,19 +39,20 @@ cha3 $10d8 #include "includes/tnzs.h" #include "sound/ay8910.h" -class cchance_state : public tnzs_state +class cchance_state : public tnzs_base_state { public: cchance_state(const machine_config &mconfig, device_type type, const char *tag) - : tnzs_state(mconfig, type, tag) { } + : tnzs_base_state(mconfig, type, tag) { } + + void machine_reset() override; + void machine_start() override; uint8_t m_hop_io; uint8_t m_bell_io; DECLARE_WRITE8_MEMBER(output_0_w); DECLARE_READ8_MEMBER(input_1_r); DECLARE_WRITE8_MEMBER(output_1_w); - DECLARE_MACHINE_START(cchance); - DECLARE_MACHINE_RESET(cchance); }; @@ -191,18 +192,17 @@ static GFXDECODE_START( cchance ) GFXDECODE_ENTRY( "gfx1", 0, cchance_layout, 0x0, 32 ) GFXDECODE_END -MACHINE_START_MEMBER(cchance_state,cchance) +void cchance_state::machine_start() { save_item(NAME(m_hop_io)); save_item(NAME(m_bell_io)); } -MACHINE_RESET_MEMBER(cchance_state,cchance) +void cchance_state::machine_reset() { - m_mcu_type = -1; + tnzs_base_state::machine_reset(); m_hop_io = 0; m_bell_io = 0; - } static MACHINE_CONFIG_START( cchance, cchance_state ) @@ -211,9 +211,6 @@ static MACHINE_CONFIG_START( cchance, cchance_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", cchance_state, irq0_line_hold) - MCFG_MACHINE_START_OVERRIDE(cchance_state,cchance) - MCFG_MACHINE_RESET_OVERRIDE(cchance_state,cchance) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", cchance) MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) @@ -230,7 +227,7 @@ static MACHINE_CONFIG_START( cchance, cchance_state ) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_INIT_OWNER(cchance_state,arknoid2) + MCFG_PALETTE_INIT_OWNER(tnzs_base_state, prompalette) MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp index aab52b46744..f362fdf03b4 100644 --- a/src/mame/drivers/tnzs.cpp +++ b/src/mame/drivers/tnzs.cpp @@ -628,41 +628,30 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/11/06 #include "sound/volt_reg.h" #include "sound/ym2151.h" -SAMPLES_START_CB_MEMBER(tnzs_state::kageki_init_samples) +SAMPLES_START_CB_MEMBER(kageki_state::init_samples) { - uint8_t *scan, *src; - int16_t *dest; - int start, size; - int i, n; - - src = memregion("samples")->base() + 0x0090; - for (i = 0; i < MAX_SAMPLES; i++) + uint8_t *src = memregion("samples")->base() + 0x0090; + for (int i = 0; i < MAX_SAMPLES; i++) { - start = (src[(i * 2) + 1] * 256) + src[(i * 2)]; - scan = &src[start]; - size = 0; + int start = (src[(i * 2) + 1] * 256) + src[(i * 2)]; + uint8_t *scan = &src[start]; + int size = 0; // check sample length - while (1) - { - if (*scan++ == 0x00) - break; - else - size++; - } + while (*scan++ != 0x00) + size++; /* 2009-11 FP: should these be saved? */ m_sampledata[i] = std::make_unique(size); m_samplesize[i] = size; - if (start < 0x100) start = size = 0; // signed 8-bit sample to unsigned 8-bit sample convert - dest = m_sampledata[i].get(); + int16_t *dest = m_sampledata[i].get(); scan = &src[start]; - for (n = 0; n < size; n++) + for (int n = 0; n < size; n++) { *dest++ = (int8_t)((*scan++) ^ 0x80) * 256; } @@ -671,14 +660,14 @@ SAMPLES_START_CB_MEMBER(tnzs_state::kageki_init_samples) } -READ8_MEMBER(tnzs_state::kageki_csport_r) +READ8_MEMBER(kageki_state::csport_r) { int dsw, dsw1, dsw2; dsw1 = m_dswa->read(); dsw2 = m_dswb->read(); - switch (m_kageki_csport_sel) + switch (m_csport_sel) { case 0x00: // DSW2 5,1 / DSW1 5,1 dsw = (((dsw2 & 0x10) >> 1) | ((dsw2 & 0x01) << 2) | ((dsw1 & 0x10) >> 3) | ((dsw1 & 0x01) >> 0)); @@ -694,20 +683,20 @@ READ8_MEMBER(tnzs_state::kageki_csport_r) break; default: dsw = 0x00; - // logerror("kageki_csport_sel error !! (0x%08X)\n", m_kageki_csport_sel); + // logerror("csport_sel error !! (0x%08X)\n", m_csport_sel); } return (dsw & 0xff); } -WRITE8_MEMBER(tnzs_state::kageki_csport_w) +WRITE8_MEMBER(kageki_state::csport_w) { char mess[80]; if (data > 0x3f) { // read dipsw port - m_kageki_csport_sel = (data & 0x03); + m_csport_sel = (data & 0x03); } else { @@ -727,14 +716,7 @@ WRITE8_MEMBER(tnzs_state::kageki_csport_w) } } -WRITE8_MEMBER(tnzs_state::kabukiz_sound_bank_w) -{ - // to avoid the write when the sound chip is initialized - if (data != 0xff) - m_audiobank->set_entry(data & 0x07); -} - -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tnzs_base_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8) @@ -743,14 +725,18 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r8, spriteylow_w8) AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", seta001_device, spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("spritegen", seta001_device, spritebgflag_w8) /* enable / disable background transparency */ - AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(tnzs_ramrom_bankswitch_w) - /* arknoid2, extrmatn, plumppop and drtoppel have PROMs instead of RAM */ - /* drtoppel writes here anyway! (maybe leftover from tests during development) */ - /* so the handler is patched out in init_drtopple() */ + AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(ramrom_bankswitch_w) AM_RANGE(0xf800, 0xfbff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") ADDRESS_MAP_END -static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( prompal_main_map, AS_PROGRAM, 8, extrmatn_state ) + /* arknoid2, extrmatn, plumppop and drtoppel have PROMs instead of RAM */ + /* drtoppel writes here anyway! (maybe leftover from tests during development) */ + AM_RANGE(0xf800, 0xfbff) AM_WRITENOP + AM_IMPORT_FROM(main_map) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tnzsb_main_map, AS_PROGRAM, 8, tnzsb_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8) @@ -759,112 +745,100 @@ static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r8, spriteylow_w8) AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", seta001_device, spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("spritegen", seta001_device, spritebgflag_w8) /* enable / disable background transparency */ - AM_RANGE(0xf600, 0xf600) AM_WRITE(tnzs_ramrom_bankswitch_w) + AM_RANGE(0xf600, 0xf600) AM_WRITE(ramrom_bankswitch_w) /* kabukiz still writes here but it's not used (it's paletteram in type1 map) */ AM_RANGE(0xf800, 0xfbff) AM_WRITENOP ADDRESS_MAP_END - -static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( base_sub_map, AS_PROGRAM, 8, tnzs_base_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w) + AM_RANGE(0xa000, 0xa000) AM_WRITE(bankswitch1_w) AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) + AM_RANGE(0xd000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tnzs_sub_map, AS_PROGRAM, 8, tnzs_mcu_state ) AM_RANGE(0xc000, 0xc001) AM_READWRITE(mcu_r, mcu_w) /* not present in insectx */ - AM_RANGE(0xd000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) /* paddles in arkanoid2/plumppop. The ports are */ - /* read but not used by the other games, and are not read at */ - /* all by insectx. */ + AM_RANGE(0xa000, 0xa000) AM_WRITE(bankswitch1_w) + AM_RANGE(0xf000, 0xf003) AM_READ(analog_r) /* paddles in arkanoid2/plumppop. The ports are */ + /* read but not used by the other games, and are not read at */ + /* all by insectx. */ + AM_IMPORT_FROM(base_sub_map) ADDRESS_MAP_END -static ADDRESS_MAP_START( arknoid2_sub_map, AS_PROGRAM, 8, tnzs_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(arknoid2_mcu_reset_w) - AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) - AM_RANGE(0xc000, 0xc001) AM_READWRITE(arknoid2_mcu_r, arknoid2_mcu_w) - AM_RANGE(0xd000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) /* paddles in arkanoid2/plumppop. The ports are */ +static ADDRESS_MAP_START( arknoid2_sub_map, AS_PROGRAM, 8, arknoid2_state ) + AM_RANGE(0xc000, 0xc001) AM_READWRITE(mcu_r, mcu_w) + AM_IMPORT_FROM(tnzs_sub_map) ADDRESS_MAP_END -static ADDRESS_MAP_START( kageki_sub_map, AS_PROGRAM, 8, tnzs_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w) - AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) +static ADDRESS_MAP_START( kageki_sub_map, AS_PROGRAM, 8, kageki_state ) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") - AM_RANGE(0xd000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") + AM_IMPORT_FROM(base_sub_map) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( insectx_sub_map, AS_PROGRAM, 8, insectx_state ) + AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") + AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") + AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") + AM_IMPORT_FROM(base_sub_map) ADDRESS_MAP_END /* the later board is different, it has a third CPU (and of course no mcu) */ -WRITE8_MEMBER(tnzs_state::tnzsb_sound_command_w) -{ - m_soundlatch->write(space, offset, data); - m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); -} - -static ADDRESS_MAP_START( tnzsb_cpu1_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( tnzsb_base_sub_map, AS_PROGRAM, 8, tnzsb_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w) + AM_RANGE(0xa000, 0xa000) AM_WRITE(bankswitch1_w) AM_RANGE(0xb002, 0xb002) AM_READ_PORT("DSWA") AM_RANGE(0xb003, 0xb003) AM_READ_PORT("DSWB") - AM_RANGE(0xb004, 0xb004) AM_WRITE(tnzsb_sound_command_w) + AM_RANGE(0xb004, 0xb004) AM_WRITE(sound_command_w) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tnzsb_sub_map, AS_PROGRAM, 8, tnzsb_state ) AM_RANGE(0xf000, 0xf003) AM_READONLY AM_RANGE(0xf000, 0xf3ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_IMPORT_FROM(tnzsb_base_sub_map) ADDRESS_MAP_END -static ADDRESS_MAP_START( kabukiz_cpu1_map, AS_PROGRAM, 8, tnzs_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w) - AM_RANGE(0xb002, 0xb002) AM_READ_PORT("DSWA") - AM_RANGE(0xb003, 0xb003) AM_READ_PORT("DSWB") - AM_RANGE(0xb004, 0xb004) AM_WRITE(tnzsb_sound_command_w) - AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") - AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1") - AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2") - AM_RANGE(0xd000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") +static ADDRESS_MAP_START( kabukiz_sub_map, AS_PROGRAM, 8, kabukiz_state ) AM_RANGE(0xf800, 0xfbff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_IMPORT_FROM(tnzsb_base_sub_map) ADDRESS_MAP_END -static ADDRESS_MAP_START( tnzsb_cpu2_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( tnzsb_cpu2_map, AS_PROGRAM, 8, tnzsb_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( kabukiz_cpu2_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( kabukiz_cpu2_map, AS_PROGRAM, 8, kabukiz_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("audiobank") AM_RANGE(0xe000, 0xffff) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( tnzsb_io_map, AS_IO, 8, tnzs_state ) +static ADDRESS_MAP_START( tnzsb_io_map, AS_IO, 8, tnzsb_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) AM_RANGE(0x02, 0x02) AM_DEVREAD("soundlatch", generic_latch_8_device, read) ADDRESS_MAP_END -static ADDRESS_MAP_START( i8742_map, AS_IO, 8, tnzs_state ) +static ADDRESS_MAP_START( i8742_map, AS_IO, 8, tnzs_mcu_state ) AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(mcu_port1_r) AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_port2_r, mcu_port2_w) AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_PORT("COIN1") AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_PORT("COIN2") ADDRESS_MAP_END -static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8, jpopnics_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8) @@ -873,21 +847,15 @@ static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r8, spriteylow_w8) AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", seta001_device, spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("spritegen", seta001_device, spritebgflag_w8) /* enable / disable background transparency */ - AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(tnzs_ramrom_bankswitch_w) + AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(ramrom_bankswitch_w) AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") ADDRESS_MAP_END -WRITE8_MEMBER(tnzs_state::jpopnics_subbankswitch_w) -{ - /* bits 0-1 select ROM bank */ - m_subbank->set_entry(data & 0x03); -} - -static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, jpopnics_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank") - AM_RANGE(0xa000, 0xa000) AM_WRITE(jpopnics_subbankswitch_w) + AM_RANGE(0xa000, 0xa000) AM_WRITE(subbankswitch_w) AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN1") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN2") @@ -897,11 +865,11 @@ static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, tnzs_state ) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) + AM_RANGE(0xf000, 0xf003) AM_READ(analog_r) ADDRESS_MAP_END /* RAM/ROM bank that maps at 0x8000-0xbfff on maincpu */ -static ADDRESS_MAP_START( mainbank_map, AS_PROGRAM, 8, tnzs_state ) +static ADDRESS_MAP_START( mainbank_map, AS_PROGRAM, 8, tnzs_base_state ) AM_RANGE(0x00000, 0x07fff) AM_RAM // instead of the first two banks of ROM being repeated redundantly the hardware maps RAM here AM_RANGE(0x08000, 0x1ffff) AM_ROM AM_REGION(":maincpu", 0x8000) ADDRESS_MAP_END @@ -1541,44 +1509,31 @@ static GFXDECODE_START( insectx ) GFXDECODE_ENTRY( "gfx1", 0, insectx_charlayout, 0, 32 ) GFXDECODE_END - -/* handler called by the 2203 emulator when the internal timers cause an IRQ */ -WRITE_LINE_MEMBER(tnzs_state::irqhandler) -{ - m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); -} - -static MACHINE_CONFIG_START( tnzs, tnzs_state ) +static MACHINE_CONFIG_START( tnzs_base, tnzs_base_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz */ + MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz, verified on insectx, kageki, tnzsb */ MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) + MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_base_state, irq0_line_hold) - MCFG_CPU_ADD("sub", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz */ - MCFG_CPU_PROGRAM_MAP(sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_CPU_ADD("mcu", I8742, 12000000/2) /* 400KHz ??? - Main board Crystal is 12MHz */ - MCFG_CPU_IO_MAP(i8742_map) + MCFG_CPU_ADD("sub", Z80,XTAL_12MHz/2) /* 6.0 MHz ??? - Main board Crystal is 12MHz, verified on insectx, kageki, tnzsb */ + MCFG_CPU_PROGRAM_MAP(base_sub_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_base_state, irq0_line_hold) MCFG_FRAGMENT_ADD(tnzs_mainbank) MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - + /* video hardware */ MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.15) /* it should be the same as the newer pcb vsync */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) + MCFG_SCREEN_UPDATE_DRIVER(tnzs_base_state, screen_update_tnzs) + MCFG_SCREEN_VBLANK_DRIVER(tnzs_base_state, screen_eof_tnzs) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) @@ -1587,71 +1542,62 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("speaker") +MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( tnzs, tnzs_base, tnzs_state ) + MCFG_CPU_ADD("mcu", I8742, 12000000/2) /* 400KHz ??? - Main board Crystal is 12MHz */ + MCFG_CPU_IO_MAP(i8742_map) + + MCFG_CPU_MODIFY("sub") + MCFG_CPU_PROGRAM_MAP(tnzs_sub_map) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(59.15) /* it should be the same as the newer pcb vsync */ + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + + /* sound hardware */ MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( extrmatn, tnzs ) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( arknoid2, tnzs ) +static MACHINE_CONFIG_DERIVED_CLASS( extrmatn, tnzs, extrmatn_state ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, arknoid2_interrupt) + MCFG_CPU_PROGRAM_MAP(prompal_main_map) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(tnzs_base_state, prompalette) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( arknoid2, extrmatn, arknoid2_state ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_VBLANK_INT_DRIVER("screen", arknoid2_state, mcu_interrupt) MCFG_CPU_MODIFY("sub") MCFG_CPU_PROGRAM_MAP(arknoid2_sub_map) MCFG_CPU_MODIFY("mcu") MCFG_DEVICE_DISABLE() - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(tnzs_state,arknoid2) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( insectx, tnzs_state ) - +static MACHINE_CONFIG_DERIVED_CLASS( insectx, tnzs_base, insectx_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_CPU_ADD("sub", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") + MCFG_CPU_MODIFY("sub") + MCFG_CPU_PROGRAM_MAP(insectx_sub_map) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", insectx) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + MCFG_GFXDECODE_MODIFY("gfxdecode", insectx) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) /* verified on pcb */ MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) @@ -1659,47 +1605,15 @@ static MACHINE_CONFIG_START( insectx, tnzs_state ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( kageki, tnzs_state ) - +static MACHINE_CONFIG_DERIVED_CLASS( kageki, tnzs_base, kageki_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_CPU_ADD("sub", Z80, XTAL_12MHz/2) /* verified on pcb */ + MCFG_CPU_MODIFY("sub") MCFG_CPU_PROGRAM_MAP(kageki_sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) /* verified on pcb */ - MCFG_AY8910_PORT_A_READ_CB(READ8(tnzs_state, kageki_csport_r)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(tnzs_state, kageki_csport_w)) + MCFG_AY8910_PORT_A_READ_CB(READ8(kageki_state, csport_r)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(kageki_state, csport_w)) MCFG_SOUND_ROUTE(0, "speaker", 0.15) MCFG_SOUND_ROUTE(1, "speaker", 0.15) MCFG_SOUND_ROUTE(2, "speaker", 0.15) @@ -1707,57 +1621,31 @@ static MACHINE_CONFIG_START( kageki, tnzs_state ) MCFG_SOUND_ADD("samples", SAMPLES, 0) MCFG_SAMPLES_CHANNELS(1) - MCFG_SAMPLES_START_CB(tnzs_state, kageki_init_samples) + MCFG_SAMPLES_START_CB(kageki_state, init_samples) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( tnzsb, tnzs_state ) - +static MACHINE_CONFIG_DERIVED_CLASS( tnzsb, tnzs_base, tnzsb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(cpu0_type2) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tnzsb_main_map) - MCFG_CPU_ADD("sub", Z80, XTAL_12MHz/2) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(tnzsb_cpu1_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) + MCFG_CPU_MODIFY("sub") /* verified on pcb */ + MCFG_CPU_PROGRAM_MAP(tnzsb_sub_map) MCFG_CPU_ADD("audiocpu", Z80, XTAL_12MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(tnzsb_cpu2_map) MCFG_CPU_IO_MAP(tnzsb_io_map) - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,tnzs) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_REFRESH_RATE(59.15) /* verified on pcb */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_GENERIC_LATCH_8_ADD("soundlatch") MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) /* verified on pcb */ - MCFG_YM2203_IRQ_HANDLER(WRITELINE(tnzs_state, irqhandler)) + MCFG_YM2203_IRQ_HANDLER(WRITELINE(tnzsb_state, ym2203_irqhandler)) MCFG_SOUND_ROUTE(0, "speaker", 1.0) MCFG_SOUND_ROUTE(1, "speaker", 1.0) MCFG_SOUND_ROUTE(2, "speaker", 1.0) @@ -1765,17 +1653,18 @@ static MACHINE_CONFIG_START( tnzsb, tnzs_state ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( kabukiz, tnzsb ) +static MACHINE_CONFIG_DERIVED_CLASS( kabukiz, tnzsb, kabukiz_state ) /* basic machine hardware */ MCFG_CPU_MODIFY("sub") - MCFG_CPU_PROGRAM_MAP(kabukiz_cpu1_map) + MCFG_CPU_PROGRAM_MAP(kabukiz_sub_map) MCFG_CPU_MODIFY("audiocpu") MCFG_CPU_PROGRAM_MAP(kabukiz_cpu2_map) + /* sound hardware */ MCFG_SOUND_MODIFY("ymsnd") - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(tnzs_state, kabukiz_sound_bank_w)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(kabukiz_state, sound_bank_w)) MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("dac", dac_byte_interface, write)) MCFG_SOUND_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC @@ -1784,45 +1673,21 @@ static MACHINE_CONFIG_DERIVED( kabukiz, tnzsb ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( jpopnics, tnzs_state ) - +static MACHINE_CONFIG_DERIVED_CLASS( jpopnics, tnzs_base, jpopnics_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2) /* Not verified - Main board Crystal is 12MHz */ + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(jpopnics_main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - MCFG_CPU_ADD("sub", Z80,XTAL_12MHz/2) /* Not verified - Main board Crystal is 12MHz */ + MCFG_CPU_MODIFY("sub") MCFG_CPU_PROGRAM_MAP(jpopnics_sub_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold) - - MCFG_FRAGMENT_ADD(tnzs_mainbank) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs_common) - MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,jpopnics) - - MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) - MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(tnzs_state, screen_update_tnzs) - MCFG_SCREEN_VBLANK_DRIVER(tnzs_state, screen_eof_tnzs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tnzs) - MCFG_PALETTE_ADD("palette", 1024) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(1024) MCFG_PALETTE_FORMAT(GGGGBBBBRRRRxxxx) /* wrong, the other 4 bits seem to be used as well */ MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_YM2151_ADD("ymsnd", XTAL_12MHz/4) /* Not verified - Main board Crystal is 12MHz */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) MACHINE_CONFIG_END @@ -2672,40 +2537,40 @@ ROM_END // YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1987, plumppop, 0, extrmatn, plumppop, tnzs_state, plumpop, ROT0, "Taito Corporation", "Plump Pop (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, plumppop, 0, extrmatn, plumppop, driver_device, 0, ROT0, "Taito Corporation", "Plump Pop (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1992, jpopnics, 0, jpopnics, jpopnics, driver_device, 0, ROT0, "Nics", "Jumping Pop (Nics, Korean hack of Plump Pop)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatn, 0, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation Japan", "Extermination (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnu, extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito (World Games license)", "Extermination (US, World Games)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnur,extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito America Corporation (Romstar license)", "Extermination (US, Romstar)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, extrmatnj, extrmatn, extrmatn, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatn, 0, extrmatn, extrmatn, driver_device, 0, ROT270, "Taito Corporation Japan", "Extermination (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnu, extrmatn, extrmatn, extrmatn, driver_device, 0, ROT270, "Taito (World Games license)", "Extermination (US, World Games)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnur,extrmatn, extrmatn, extrmatn, driver_device, 0, ROT270, "Taito America Corporation (Romstar license)", "Extermination (US, Romstar)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, extrmatnj, extrmatn, extrmatn, extrmatn, driver_device, 0, ROT270, "Taito Corporation", "Extermination (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, arknoid2, 0, arknoid2, arknoid2, tnzs_state, arknoid2, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, arknoid2u, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, arknoid2j, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, arknoid2b, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "bootleg", "Arkanoid - Revenge of DOH (Japan bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, arknoid2, 0, arknoid2, arknoid2, driver_device, 0, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, arknoid2u, arknoid2, arknoid2, arknid2u, driver_device, 0, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, arknoid2j, arknoid2, arknoid2, arknid2u, driver_device, 0, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, arknoid2b, arknoid2, arknoid2, arknid2u, driver_device, 0, ROT270, "bootleg", "Arkanoid - Revenge of DOH (Japan bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, drtoppel, 0, extrmatn, drtoppel, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1987, drtoppelu, drtoppel, extrmatn, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1987, drtoppelj, drtoppel, extrmatn, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, drtoppel, 0, extrmatn, drtoppel, driver_device, 0, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1987, drtoppelu, drtoppel, extrmatn, drtopplu, driver_device, 0, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1987, drtoppelj, drtoppel, extrmatn, drtopplu, driver_device, 0, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, kageki, 0, kageki, kageki, tnzs_state, kageki, ROT90, "Kaneko / Taito America Corporation (Romstar license)", "Kageki (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, kagekij, kageki, kageki, kagekij, tnzs_state, kageki, ROT90, "Kaneko / Taito Corporation", "Kageki (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, kagekih, kageki, kageki, kageki, tnzs_state, kageki, ROT90, "hack", "Kageki (hack)", MACHINE_SUPPORTS_SAVE ) // date is hacked at least, might also be a Japan set hacked to show english +GAME( 1988, kageki, 0, kageki, kageki, driver_device, 0, ROT90, "Kaneko / Taito America Corporation (Romstar license)", "Kageki (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, kagekij, kageki, kageki, kagekij, driver_device, 0, ROT90, "Kaneko / Taito Corporation", "Kageki (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, kagekih, kageki, kageki, kageki, driver_device, 0, ROT90, "hack", "Kageki (hack)", MACHINE_SUPPORTS_SAVE ) // date is hacked at least, might also be a Japan set hacked to show english -GAME( 1988, chukatai, 0, tnzs, chukatai, tnzs_state, chukatai, ROT0, "Taito Corporation Japan", "Chuka Taisen (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1988, chukataiu, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito America Corporation", "Chuka Taisen (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ -GAME( 1988, chukataij, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chukatai, 0, tnzs, chukatai, driver_device, 0, ROT0, "Taito Corporation Japan", "Chuka Taisen (World)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1988, chukataiu, chukatai, tnzs, chukatau, driver_device, 0, ROT0, "Taito America Corporation", "Chuka Taisen (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */ +GAME( 1988, chukataij, chukatai, tnzs, chukatau, driver_device, 0, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzs, 0, tnzsb, tnzs, tnzs_state, tnzsb, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, tnzs_state, tnzsb, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, tnzs_state, tnzs, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzsuo, tnzs, tnzs, tnzsjo, tnzs_state, tnzs, ROT0, "Taito America Corporation", "The NewZealand Story (US, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzso, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzs, 0, tnzsb, tnzs, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzsuo, tnzs, tnzs, tnzsjo, driver_device, 0, ROT0, "Taito America Corporation", "The NewZealand Story (US, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzso, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, kabukiz, 0, kabukiz, kabukiz, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation Japan", "Kabuki-Z (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation", "Kabuki-Z (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, kabukiz, 0, kabukiz, kabukiz, driver_device, 0, ROT0, "Kaneko / Taito Corporation Japan", "Kabuki-Z (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, driver_device, 0, ROT0, "Kaneko / Taito Corporation", "Kabuki-Z (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, insectx, 0, insectx, insectx, tnzs_state, insectx, ROT0, "Taito Corporation Japan", "Insector X (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, insectxj, insectx, insectx, insectxj, tnzs_state, insectx, ROT0, "Taito Corporation", "Insector X (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, insectx, 0, insectx, insectx, driver_device, 0, ROT0, "Taito Corporation Japan", "Insector X (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, insectxj, insectx, insectx, insectxj, driver_device, 0, ROT0, "Taito Corporation", "Insector X (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index 1a7ff1d9052..7a418ce226f 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -1,6 +1,11 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia, Mirko Buffoni, Takahiro Nogi +#pragma once + +#ifndef MAME_INCLUDES_TNZS_H +#define MAME_INCLUDES_TNZS_H + #include "sound/dac.h" #include "sound/samples.h" #include "video/seta001.h" @@ -10,74 +15,128 @@ #define MAX_SAMPLES 0x2f /* max samples */ -enum -{ - MCU_ARKANOID_SIM = 0, - MCU_MCHIP_LLE, - MCU_NONE_INSECTX, - MCU_NONE_KAGEKI, - MCU_NONE_TNZSB, - MCU_NONE_KABUKIZ -}; - -class tnzs_state : public driver_device +class tnzs_base_state : public driver_device { public: - tnzs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_subcpu(*this, "sub"), - m_mcu(*this, "mcu"), - m_seta001(*this, "spritegen"), - m_samples(*this, "samples"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_mainbank(*this, "mainbank"), - m_subbank(*this, "subbank"), - m_audiobank(*this, "audiobank"), - m_dswa(*this, "DSWA"), - m_dswb(*this, "DSWB"), - m_in0(*this, "IN0"), - m_in1(*this, "IN1"), - m_in2(*this, "IN2"), - m_coin1(*this, "COIN1"), - m_coin2(*this, "COIN2"), - m_an1(*this, "AN1"), - m_an2(*this, "AN2"), - m_lockout_level(false) + tnzs_base_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_seta001(*this, "spritegen") + , m_palette(*this, "palette") + , m_mainbank(*this, "mainbank") + , m_subbank(*this, "subbank") + , m_an1(*this, "AN1") + , m_an2(*this, "AN2") { } + virtual void machine_start() override; + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w); + + DECLARE_WRITE8_MEMBER(ramrom_bankswitch_w); + + uint32_t screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_tnzs(screen_device &screen, bool state); + + DECLARE_READ8_MEMBER(analog_r); // TODO: Move into a subclass + + DECLARE_PALETTE_INIT(prompalette); + +protected: /* devices */ required_device m_maincpu; - optional_device m_audiocpu; optional_device m_subcpu; - optional_device m_mcu; optional_device m_seta001; - optional_device m_samples; required_device m_palette; - optional_device m_soundlatch; - optional_device m_mainbank; - optional_memory_bank m_subbank; /* optional because of reuse from cchance.c */ - optional_memory_bank m_audiobank; - required_ioport m_dswa; - required_ioport m_dswb; + optional_device m_mainbank; /* FIXME: optional because of reuse from cchance.cpp */ + optional_memory_bank m_subbank; /* FIXME: optional because of reuse from cchance.cpp */ + + optional_ioport m_an1; // TODO: Move these into a subclass + optional_ioport m_an2; + + /* misc / mcu */ + int m_bank2; +}; + +class tnzs_mcu_state : public tnzs_base_state +{ +public: + tnzs_mcu_state(const machine_config &mconfig, device_type type, const char *tag, bool lockout_level) + : tnzs_base_state(mconfig, type, tag) + , m_mcu(*this, "mcu") + , m_in0(*this, "IN0") + , m_in1(*this, "IN1") + , m_in2(*this, "IN2") + , m_input_select(0) + , m_lockout_level(lockout_level) + { } + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; + + DECLARE_READ8_MEMBER(mcu_port1_r); + DECLARE_READ8_MEMBER(mcu_port2_r); + DECLARE_WRITE8_MEMBER(mcu_port2_w ); + DECLARE_READ8_MEMBER(mcu_r); + DECLARE_WRITE8_MEMBER(mcu_w); + +protected: + required_device m_mcu; + required_ioport m_in0; required_ioport m_in1; required_ioport m_in2; - optional_ioport m_coin1; - optional_ioport m_coin2; - optional_ioport m_an1; - optional_ioport m_an2; - /* sound-related */ - std::unique_ptr m_sampledata[MAX_SAMPLES]; - int m_samplesize[MAX_SAMPLES]; - - /* misc / mcu */ - int m_kageki_csport_sel; int m_input_select; - int m_mcu_type; + bool m_lockout_level; +}; + +class tnzs_state : public tnzs_mcu_state +{ +public: + tnzs_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_mcu_state(mconfig, type, tag, true) + { } +}; + +class extrmatn_state : public tnzs_mcu_state +{ +public: + extrmatn_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_mcu_state(mconfig, type, tag, false) + { } +}; + +class arknoid2_state : public extrmatn_state +{ +public: + arknoid2_state(const machine_config &mconfig, device_type type, const char *tag) + : extrmatn_state(mconfig, type, tag) + , m_coin1(*this, "COIN1") + , m_coin2(*this, "COIN2") + , m_in0(*this, "IN0") + , m_in1(*this, "IN1") + , m_in2(*this, "IN2") + { } + + virtual void machine_start() override; + virtual void machine_reset() override; + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; + + DECLARE_READ8_MEMBER(mcu_r); + DECLARE_WRITE8_MEMBER(mcu_w); + INTERRUPT_GEN_MEMBER(mcu_interrupt); + +private: + required_ioport m_coin1; + required_ioport m_coin2; + required_ioport m_in0; + required_ioport m_in1; + required_ioport m_in2; + + void mcu_reset(); + int m_mcu_initializing; int m_mcu_coinage_init; int m_mcu_command; @@ -88,55 +147,103 @@ public: uint8_t m_mcu_coins_a; uint8_t m_mcu_coins_b; uint8_t m_mcu_credits; - int m_bank2; - bool m_lockout_level; - DECLARE_READ8_MEMBER(mcu_port1_r); - DECLARE_READ8_MEMBER(mcu_port2_r); - DECLARE_WRITE8_MEMBER(mcu_port2_w ); - DECLARE_READ8_MEMBER(mcu_r); - DECLARE_WRITE8_MEMBER(mcu_w); - - DECLARE_WRITE8_MEMBER(tnzsb_sound_command_w); - DECLARE_WRITE8_MEMBER(jpopnics_subbankswitch_w); - DECLARE_READ8_MEMBER(tnzs_port1_r); - DECLARE_READ8_MEMBER(tnzs_port2_r); - DECLARE_WRITE8_MEMBER(tnzs_port2_w); - DECLARE_WRITE8_MEMBER(extrmatn_port2_w); - DECLARE_READ8_MEMBER(arknoid2_sh_f000_r); - DECLARE_WRITE8_MEMBER(tnzs_ramrom_bankswitch_w); - DECLARE_WRITE8_MEMBER(tnzs_bankswitch1_w); - DECLARE_READ8_MEMBER(arknoid2_mcu_r); - DECLARE_WRITE8_MEMBER(arknoid2_mcu_w); - DECLARE_WRITE8_MEMBER(arknoid2_mcu_reset_w); - DECLARE_READ8_MEMBER(kageki_csport_r); - DECLARE_WRITE8_MEMBER(kageki_csport_w); - DECLARE_WRITE8_MEMBER(kabukiz_sound_bank_w); - DECLARE_WRITE_LINE_MEMBER(irqhandler); - - SAMPLES_START_CB_MEMBER(kageki_init_samples); - - DECLARE_DRIVER_INIT(arknoid2); - DECLARE_DRIVER_INIT(extrmatn); - DECLARE_DRIVER_INIT(drtoppel); - DECLARE_DRIVER_INIT(kabukiz); - DECLARE_DRIVER_INIT(plumpop); - DECLARE_DRIVER_INIT(insectx); - DECLARE_DRIVER_INIT(tnzs); - DECLARE_DRIVER_INIT(kageki); - DECLARE_DRIVER_INIT(chukatai); - DECLARE_DRIVER_INIT(tnzsb); - DECLARE_MACHINE_START(tnzs); - DECLARE_MACHINE_RESET(tnzs); - DECLARE_PALETTE_INIT(arknoid2); - DECLARE_MACHINE_START(tnzs_common); - DECLARE_MACHINE_RESET(jpopnics); - - uint32_t screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_tnzs(screen_device &screen, bool state); - - INTERRUPT_GEN_MEMBER(arknoid2_interrupt); - - void arknoid2_mcu_reset(); void mcu_handle_coins(int coin); }; + +class kageki_state : public tnzs_base_state +{ +public: + kageki_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_base_state(mconfig, type, tag) + , m_samples(*this, "samples") + , m_dswa(*this, "DSWA") + , m_dswb(*this, "DSWB") + , m_csport_sel(0) + { } + + virtual void machine_start() override; + virtual void machine_reset() override; + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; + + DECLARE_READ8_MEMBER(csport_r); + DECLARE_WRITE8_MEMBER(csport_w); + + DECLARE_MACHINE_RESET(kageki); + DECLARE_DRIVER_INIT(kageki); + + SAMPLES_START_CB_MEMBER(init_samples); + +private: + required_device m_samples; + + required_ioport m_dswa; + required_ioport m_dswb; + + /* sound-related */ + std::unique_ptr m_sampledata[MAX_SAMPLES]; + int m_samplesize[MAX_SAMPLES]; + + int m_csport_sel; +}; + +class jpopnics_state : public tnzs_base_state +{ +public: + jpopnics_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_base_state(mconfig, type, tag) + { } + + virtual void machine_reset() override; + + DECLARE_WRITE8_MEMBER(subbankswitch_w); +}; + +class insectx_state : public tnzs_base_state +{ +public: + insectx_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_base_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; +}; + +class tnzsb_state : public tnzs_base_state +{ +public: + tnzsb_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzs_base_state(mconfig, type, tag) + , m_audiocpu(*this, "audiocpu") + , m_soundlatch(*this, "soundlatch") + { } + + DECLARE_WRITE_LINE_MEMBER(ym2203_irqhandler); + + DECLARE_WRITE8_MEMBER(sound_command_w); + + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; + +protected: + required_device m_audiocpu; + required_device m_soundlatch; +}; + +class kabukiz_state : public tnzsb_state +{ +public: + kabukiz_state(const machine_config &mconfig, device_type type, const char *tag) + : tnzsb_state(mconfig, type, tag) + , m_audiobank(*this, "audiobank") + { } + + virtual void machine_start() override; + + DECLARE_WRITE8_MEMBER(sound_bank_w); + +protected: + required_memory_bank m_audiobank; +}; + +#endif // MAME_INCLUDES_TNZS_H \ No newline at end of file diff --git a/src/mame/machine/tnzs.cpp b/src/mame/machine/tnzs.cpp index 2119cfe2771..58a8559830f 100644 --- a/src/mame/machine/tnzs.cpp +++ b/src/mame/machine/tnzs.cpp @@ -18,7 +18,7 @@ #include "cpu/mcs48/mcs48.h" #include "includes/tnzs.h" -READ8_MEMBER(tnzs_state::mcu_r) +READ8_MEMBER(tnzs_mcu_state::mcu_r) { uint8_t data = m_mcu->upi41_master_r(space, offset & 1); space.device().execute().yield(); @@ -28,14 +28,14 @@ READ8_MEMBER(tnzs_state::mcu_r) return data; } -WRITE8_MEMBER(tnzs_state::mcu_w) +WRITE8_MEMBER(tnzs_mcu_state::mcu_w) { // logerror("PC %04x: write %02x to mcu $c00%01x\n", space.device().safe_pcbase(), data, offset); m_mcu->upi41_master_w(space, offset & 1, data); } -READ8_MEMBER(tnzs_state::mcu_port1_r) +READ8_MEMBER(tnzs_mcu_state::mcu_port1_r) { int data = 0; @@ -52,12 +52,12 @@ READ8_MEMBER(tnzs_state::mcu_port1_r) return data; } -READ8_MEMBER(tnzs_state::mcu_port2_r) +READ8_MEMBER(tnzs_mcu_state::mcu_port2_r) { return m_in2->read(); } -WRITE8_MEMBER(tnzs_state::mcu_port2_w) +WRITE8_MEMBER(tnzs_mcu_state::mcu_port2_w) { machine().bookkeeping().coin_lockout_w(0, (data & 0x40) != 0 ? m_lockout_level : !m_lockout_level); machine().bookkeeping().coin_lockout_w(1, (data & 0x80) != 0 ? m_lockout_level : !m_lockout_level); @@ -67,20 +67,18 @@ WRITE8_MEMBER(tnzs_state::mcu_port2_w) m_input_select = data & 0xf; } -READ8_MEMBER(tnzs_state::arknoid2_sh_f000_r) +// TODO: Eliminate this once arknoid2 MCU is dumped +READ8_MEMBER(tnzs_base_state::analog_r) { -// logerror("PC %04x: read input %04x\n", space.device().safe_pc(), 0xf000 + offset); - - int val = ((offset / 2) ? m_an2 : m_an1).read_safe(0); + uint16_t val = ((offset & 2) ? m_an2 : m_an1).read_safe(0); if (offset & 1) - return ((val >> 8) & 0xff); - else - return val & 0xff; + return val >> 8; + + return val; } - -void tnzs_state::arknoid2_mcu_reset() +void arknoid2_state::mcu_reset() { m_mcu_initializing = 3; m_mcu_coinage_init = 0; @@ -95,7 +93,7 @@ void tnzs_state::arknoid2_mcu_reset() m_mcu_command = 0; } -void tnzs_state::mcu_handle_coins( int coin ) +void arknoid2_state::mcu_handle_coins( int coin ) { /* The coin inputs and coin counters are managed by the i8742 mcu. */ /* Here we simulate it. */ @@ -212,91 +210,18 @@ interleave. *********************************/ /* -TIMER_CALLBACK_MEMBER(tnzs_state::kludge_callback) +TIMER_CALLBACK_MEMBER(tnzs_base_state::kludge_callback) { tnzs_sharedram[0x0f10] = param; } -WRITE8_MEMBER(tnzs_state::tnzs_sync_kludge_w) +WRITE8_MEMBER(tnzs_base_state::tnzs_sync_kludge_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(tnzs_state::kludge_callback),this), data); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(tnzs_base_state::kludge_callback),this), data); } */ - - -DRIVER_INIT_MEMBER(tnzs_state,plumpop) -{ - m_mcu_type = MCU_MCHIP_LLE; - m_lockout_level = false; -} - -DRIVER_INIT_MEMBER(tnzs_state,extrmatn) -{ - m_mcu_type = MCU_MCHIP_LLE; - m_lockout_level = false; -} - -DRIVER_INIT_MEMBER(tnzs_state,arknoid2) -{ - m_mcu_type = MCU_ARKANOID_SIM; -} - -DRIVER_INIT_MEMBER(tnzs_state,drtoppel) -{ - /* drtoppel writes to the palette RAM area even if it has PROMs! We have to patch it out. */ - m_maincpu->space(AS_PROGRAM).nop_write(0xf800, 0xfbff); - m_lockout_level = false; - m_mcu_type = MCU_MCHIP_LLE; -} - -DRIVER_INIT_MEMBER(tnzs_state,chukatai) -{ - m_lockout_level = true; - m_mcu_type = MCU_MCHIP_LLE; -} - -DRIVER_INIT_MEMBER(tnzs_state,tnzs) -{ - /* we need to install a kludge to avoid problems with a bug in the original code */ -// m_maincpu->space(AS_PROGRAM).install_write_handler(0xef10, 0xef10, write8_delegate(FUNC(tnzs_state::tnzs_sync_kludge_w), this)); - m_lockout_level = true; - m_mcu_type = MCU_MCHIP_LLE; -} - -DRIVER_INIT_MEMBER(tnzs_state,tnzsb) -{ - m_mcu_type = MCU_NONE_TNZSB; - - /* we need to install a kludge to avoid problems with a bug in the original code */ -// m_maincpu->space(AS_PROGRAM).install_write_handler(0xef10, 0xef10, write8_delegate(FUNC(tnzs_state::tnzs_sync_kludge_w), this)); -} - -DRIVER_INIT_MEMBER(tnzs_state,kabukiz) -{ - uint8_t *SOUND = memregion("audiocpu")->base(); - m_mcu_type = MCU_NONE_KABUKIZ; - - m_audiobank->configure_entries(0, 8, &SOUND[0x00000], 0x4000); -} - -DRIVER_INIT_MEMBER(tnzs_state,insectx) -{ - m_mcu_type = MCU_NONE_INSECTX; - - /* this game has no mcu, replace the handler with plain input port handlers */ - m_subcpu->space(AS_PROGRAM).install_read_port(0xc000, 0xc000, "IN0" ); - m_subcpu->space(AS_PROGRAM).install_read_port(0xc001, 0xc001, "IN1" ); - m_subcpu->space(AS_PROGRAM).install_read_port(0xc002, 0xc002, "IN2" ); -} - -DRIVER_INIT_MEMBER(tnzs_state,kageki) -{ - m_mcu_type = MCU_NONE_KAGEKI; -} - - -READ8_MEMBER(tnzs_state::arknoid2_mcu_r) +READ8_MEMBER(arknoid2_state::mcu_r) { static const char mcu_startup[] = "\x55\xaa\x5a"; @@ -357,7 +282,7 @@ READ8_MEMBER(tnzs_state::arknoid2_mcu_r) } } -WRITE8_MEMBER(tnzs_state::arknoid2_mcu_w) +WRITE8_MEMBER(arknoid2_state::mcu_w) { if (offset == 0) { @@ -401,7 +326,7 @@ WRITE8_MEMBER(tnzs_state::arknoid2_mcu_w) } } -INTERRUPT_GEN_MEMBER(tnzs_state::arknoid2_interrupt) +INTERRUPT_GEN_MEMBER(arknoid2_state::mcu_interrupt) { int coin = ((m_coin1->read() & 1) << 0); coin |= ((m_coin2->read() & 1) << 1); @@ -412,41 +337,37 @@ INTERRUPT_GEN_MEMBER(tnzs_state::arknoid2_interrupt) device.execute().set_input_line(0, HOLD_LINE); } -MACHINE_RESET_MEMBER(tnzs_state,tnzs) +void arknoid2_state::machine_reset() { /* initialize the mcu simulation */ - if (m_mcu_type == MCU_ARKANOID_SIM) - arknoid2_mcu_reset(); + mcu_reset(); - m_kageki_csport_sel = 0; - m_mcu_readcredits = 0; // this might belong to arknoid2_mcu_reset - m_insertcoin = 0; // this might belong to arknoid2_mcu_reset + m_mcu_readcredits = 0; + m_insertcoin = 0; } -MACHINE_RESET_MEMBER(tnzs_state,jpopnics) +void kageki_state::machine_reset() { - m_mcu_type = -1; + tnzs_base_state::machine_reset(); + m_csport_sel = 0; } - -MACHINE_START_MEMBER(tnzs_state,tnzs_common) +void tnzs_base_state::machine_start() { - uint8_t *SUB = memregion("sub")->base(); - - m_subbank->configure_entries(0, 4, &SUB[0x08000], 0x2000); - m_subbank->set_entry(m_bank2); + uint8_t *sub = memregion("sub")->base(); m_bank2 = 0; m_mainbank->set_bank(2); + m_subbank->configure_entries(0, 4, &sub[0x08000], 0x2000); + m_subbank->set_entry(m_bank2); + save_item(NAME(m_bank2)); } -MACHINE_START_MEMBER(tnzs_state,tnzs) +void arknoid2_state::machine_start() { - MACHINE_START_CALL_MEMBER( tnzs_common ); - - save_item(NAME(m_kageki_csport_sel)); + tnzs_base_state::machine_start(); save_item(NAME(m_mcu_readcredits)); save_item(NAME(m_insertcoin)); save_item(NAME(m_mcu_initializing)); @@ -457,11 +378,22 @@ MACHINE_START_MEMBER(tnzs_state,tnzs) save_item(NAME(m_mcu_credits)); save_item(NAME(m_mcu_reportcoin)); save_item(NAME(m_mcu_command)); - } +void kageki_state::machine_start() +{ + tnzs_base_state::machine_start(); + save_item(NAME(m_csport_sel)); +} -WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w) +void kabukiz_state::machine_start() +{ + tnzs_base_state::machine_start(); + uint8_t *sound = memregion("audiocpu")->base(); + m_audiobank->configure_entries(0, 8, &sound[0x00000], 0x4000); +} + +WRITE8_MEMBER(tnzs_base_state::ramrom_bankswitch_w) { // logerror("PC %04x: writing %02x to bankswitch\n", space.device().safe_pc(),data); @@ -475,49 +407,81 @@ WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w) m_mainbank->set_bank(data & 0x07); } -WRITE8_MEMBER(tnzs_state::arknoid2_mcu_reset_w) +WRITE8_MEMBER(arknoid2_state::bankswitch1_w) { + tnzs_base_state::bankswitch1_w(space, offset, data, mem_mask); if (data & 0x04) - arknoid2_mcu_reset(); - - /* bits 0-1 select ROM bank */ - m_bank2 = data & 0x03; - m_subbank->set_entry(m_bank2); + mcu_reset(); } -WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w) +WRITE8_MEMBER(insectx_state::bankswitch1_w) +{ + tnzs_base_state::bankswitch1_w(space, offset, data, mem_mask); + machine().bookkeeping().coin_lockout_w(0, (~data & 0x04)); + machine().bookkeeping().coin_lockout_w(1, (~data & 0x08)); + machine().bookkeeping().coin_counter_w(0, (data & 0x10)); + machine().bookkeeping().coin_counter_w(1, (data & 0x20)); +} + +WRITE8_MEMBER(tnzsb_state::bankswitch1_w) // kabukiz_state +{ + tnzs_base_state::bankswitch1_w(space, offset, data, mem_mask); + machine().bookkeeping().coin_lockout_w(0, (~data & 0x10)); + machine().bookkeeping().coin_lockout_w(1, (~data & 0x20)); + machine().bookkeeping().coin_counter_w(0, (data & 0x04)); + machine().bookkeeping().coin_counter_w(1, (data & 0x08)); +} + +WRITE8_MEMBER(kageki_state::bankswitch1_w) +{ + tnzs_base_state::bankswitch1_w(space, offset, data, mem_mask); + machine().bookkeeping().coin_lockout_global_w((~data & 0x20)); + machine().bookkeeping().coin_counter_w(0, (data & 0x04)); + machine().bookkeeping().coin_counter_w(1, (data & 0x08)); +} + +WRITE8_MEMBER(tnzs_mcu_state::bankswitch1_w) +{ + tnzs_base_state::bankswitch1_w(space, offset, data, mem_mask); + if ((data & 0x04) != 0 && m_mcu != nullptr) + m_mcu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); +} + +WRITE8_MEMBER(tnzs_base_state::bankswitch1_w) { // logerror("PC %04x: writing %02x to bankswitch 1\n", space.device().safe_pc(),data); - switch (m_mcu_type) - { - case MCU_MCHIP_LLE: - if ((data & 0x04) != 0 && m_mcu != nullptr) - m_mcu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - break; - case MCU_NONE_INSECTX: - machine().bookkeeping().coin_lockout_w(0, (~data & 0x04)); - machine().bookkeeping().coin_lockout_w(1, (~data & 0x08)); - machine().bookkeeping().coin_counter_w(0, (data & 0x10)); - machine().bookkeeping().coin_counter_w(1, (data & 0x20)); - break; - case MCU_NONE_TNZSB: - case MCU_NONE_KABUKIZ: - machine().bookkeeping().coin_lockout_w(0, (~data & 0x10)); - machine().bookkeeping().coin_lockout_w(1, (~data & 0x20)); - machine().bookkeeping().coin_counter_w(0, (data & 0x04)); - machine().bookkeeping().coin_counter_w(1, (data & 0x08)); - break; - case MCU_NONE_KAGEKI: - machine().bookkeeping().coin_lockout_global_w((~data & 0x20)); - machine().bookkeeping().coin_counter_w(0, (data & 0x04)); - machine().bookkeeping().coin_counter_w(1, (data & 0x08)); - break; - default: - break; - } - /* bits 0-1 select ROM bank */ m_bank2 = data & 0x03; m_subbank->set_entry(m_bank2); } + +void jpopnics_state::machine_reset() +{ + tnzs_base_state::machine_reset(); +} + +WRITE8_MEMBER(jpopnics_state::subbankswitch_w) +{ + /* bits 0-1 select ROM bank */ + m_subbank->set_entry(data & 0x03); +} + +WRITE8_MEMBER(tnzsb_state::sound_command_w) +{ + m_soundlatch->write(space, offset, data); + m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); +} + +/* handler called by the 2203 emulator when the internal timers cause an IRQ */ +WRITE_LINE_MEMBER(tnzsb_state::ym2203_irqhandler) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE8_MEMBER(kabukiz_state::sound_bank_w) +{ + // to avoid the write when the sound chip is initialized + if (data != 0xff) + m_audiobank->set_entry(data & 0x07); +} diff --git a/src/mame/video/tnzs.cpp b/src/mame/video/tnzs.cpp index 78bc5416649..803c39d67ac 100644 --- a/src/mame/video/tnzs.cpp +++ b/src/mame/video/tnzs.cpp @@ -31,20 +31,19 @@ ***************************************************************************/ -PALETTE_INIT_MEMBER(tnzs_state,arknoid2) +PALETTE_INIT_MEMBER(tnzs_base_state, prompalette) { const uint8_t *color_prom = memregion("proms")->base(); - int i, col; - for (i = 0; i < palette.entries(); i++) + for (int i = 0; i < palette.entries(); i++) { - col = (color_prom[i] << 8) + color_prom[i + 512]; + int col = (color_prom[i] << 8) + color_prom[i + 512]; palette.set_pen_color(i, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0)); } } -uint32_t tnzs_state::screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t tnzs_base_state::screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(0x1f0, cliprect); @@ -55,7 +54,7 @@ uint32_t tnzs_state::screen_update_tnzs(screen_device &screen, bitmap_ind16 &bit return 0; } -void tnzs_state::screen_eof_tnzs(screen_device &screen, bool state) +void tnzs_base_state::screen_eof_tnzs(screen_device &screen, bool state) { // rising edge if (state) From 66d2f7963780bb54b95ded54c6bd53a76e78e3d2 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 11 Dec 2016 13:48:31 +1100 Subject: [PATCH 49/82] spcking2, kamikaze: added bonus sound (nw) --- src/mame/drivers/astinvad.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 9ddee6d24db..9eb6740ee0d 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -39,7 +39,8 @@ enum SND_FLEET2, SND_FLEET3, SND_FLEET4, - SND_UFOHIT + SND_UFOHIT, + SND_BONUS }; @@ -370,7 +371,7 @@ WRITE8_MEMBER(astinvad_state::kamikaze_sound1_w) if (bits_gone_hi & 0x02) m_samples->start(1, SND_SHOT); if (bits_gone_hi & 0x04) m_samples->start(2, SND_BASEHIT); if (bits_gone_hi & 0x08) m_samples->start(3, SND_INVADERHIT); - if (bits_gone_hi & 0x10) m_samples->start(3, SND_INVADERHIT); + if (bits_gone_hi & 0x10) m_samples->start(2, SND_BONUS); machine().sound().system_enable(data & 0x20); } @@ -404,7 +405,7 @@ WRITE8_MEMBER(astinvad_state::spcking2_sound1_w) if (bits_gone_hi & 0x02) m_samples->start(1, SND_SHOT); if (bits_gone_hi & 0x04) m_samples->start(2, SND_BASEHIT); if (bits_gone_hi & 0x08) m_samples->start(3, SND_INVADERHIT); - + if (bits_gone_hi & 0x10) m_samples->start(2, SND_BONUS); machine().sound().system_enable(data & 0x20); m_screen_red = data & 0x04; // ? } @@ -640,6 +641,7 @@ static const char *const astinvad_sample_names[] = "6", "7", "8", + "9", nullptr }; From f38bc880f0fe3eb73740f8b5c00c359402afb3c4 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sun, 11 Dec 2016 00:10:38 -0500 Subject: [PATCH 50/82] ccastles.cpp: Clarified input situation by assigning port conditions/names to the button inputs so they have proper default mappings between Upright/Cocktail. This also fixes MT #6431 [Tafoid] --- src/mame/drivers/ccastles.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp index 170e738f1c8..0a3da1df0f5 100644 --- a/src/mame/drivers/ccastles.cpp +++ b/src/mame/drivers/ccastles.cpp @@ -361,8 +361,10 @@ static INPUT_PORTS_START( ccastles ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ccastles_state,get_vblank, nullptr) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* 1p Jump, non-cocktail start1 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* 2p Jump, non-cocktail start2 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Jump/1P Start Upright") PORT_CONDITION("IN1",0x20,EQUALS,0x00) /* left Jump, non-cocktail start1 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P Jump") PORT_CONDITION("IN1",0x20,EQUALS,0x20) /* 1p Jump, cocktail */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Jump/2P Start Upright") PORT_CONDITION("IN1",0x20,EQUALS,0x00) /* right Jump, non-cocktail start2 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("2P Jump") PORT_CONDITION("IN1",0x20,EQUALS,0x20) /* 2p Jump, cocktail */ PORT_START("IN1") /* IN1 */ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) @@ -374,8 +376,8 @@ static INPUT_PORTS_START( ccastles ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) /* cocktail only */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) /* cocktail only */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("1P Start Cocktail") /* cocktail only */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("2P Start Cocktail") /* cocktail only */ PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) ) @@ -388,10 +390,10 @@ static INPUT_PORTS_START( ccastles ) PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(30) PORT_START("LETA2") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_COCKTAIL PORT_SENSITIVITY(10) PORT_KEYDELTA(30) PORT_REVERSE + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_COCKTAIL PORT_SENSITIVITY(10) PORT_KEYDELTA(30) PORT_REVERSE /* cocktail only */ PORT_START("LETA3") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_COCKTAIL PORT_SENSITIVITY(10) PORT_KEYDELTA(30) + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_COCKTAIL PORT_SENSITIVITY(10) PORT_KEYDELTA(30) /* cocktail only */ INPUT_PORTS_END From c8f19544676e2954bf2bb4ca03aa90d1d1148fc8 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 11 Dec 2016 18:15:41 +1100 Subject: [PATCH 51/82] XML refactoring: * move stuff to namespace util::xml * scope down some enums * split config load/save delegate types * make config load take const so it can't mangle data --- src/devices/bus/ti99x/gromport.cpp | 20 +- src/devices/bus/ti99x/gromport.h | 6 +- src/devices/machine/laserdsc.cpp | 18 +- src/devices/machine/laserdsc.h | 4 +- src/emu/bookkeeping.cpp | 20 +- src/emu/bookkeeping.h | 4 +- src/emu/config.cpp | 104 ++++----- src/emu/config.h | 29 +-- src/emu/crsshair.cpp | 36 ++-- src/emu/crsshair.h | 4 +- src/emu/debug/debugcpu.cpp | 24 +-- src/emu/debug/debugcpu.h | 10 +- src/emu/image.cpp | 30 ++- src/emu/image.h | 12 +- src/emu/ioport.cpp | 54 ++--- src/emu/ioport.h | 18 +- src/emu/main.h | 2 +- src/emu/network.cpp | 17 +- src/emu/network.h | 10 +- src/emu/render.cpp | 32 +-- src/emu/render.h | 52 ++--- src/emu/rendlay.cpp | 74 +++---- src/emu/sound.cpp | 14 +- src/emu/sound.h | 4 +- src/frontend/mame/cheat.cpp | 42 ++-- src/frontend/mame/cheat.h | 18 +- src/frontend/mame/clifront.cpp | 16 +- src/frontend/mame/info.cpp | 82 ++++---- src/frontend/mame/mame.cpp | 6 +- src/lib/util/xmlfile.cpp | 199 +++++++++--------- src/lib/util/xmlfile.h | 95 +++++---- src/osd/modules/debugger/debugqt.cpp | 16 +- .../modules/debugger/qt/breakpointswindow.cpp | 4 +- .../modules/debugger/qt/breakpointswindow.h | 4 +- src/osd/modules/debugger/qt/dasmwindow.cpp | 4 +- src/osd/modules/debugger/qt/dasmwindow.h | 4 +- .../debugger/qt/deviceinformationwindow.cpp | 4 +- .../debugger/qt/deviceinformationwindow.h | 4 +- src/osd/modules/debugger/qt/deviceswindow.cpp | 4 +- src/osd/modules/debugger/qt/deviceswindow.h | 4 +- src/osd/modules/debugger/qt/logwindow.cpp | 4 +- src/osd/modules/debugger/qt/logwindow.h | 4 +- src/osd/modules/debugger/qt/mainwindow.cpp | 4 +- src/osd/modules/debugger/qt/mainwindow.h | 4 +- src/osd/modules/debugger/qt/memorywindow.cpp | 4 +- src/osd/modules/debugger/qt/memorywindow.h | 4 +- src/osd/modules/debugger/qt/windowqt.cpp | 4 +- src/osd/modules/debugger/qt/windowqt.h | 4 +- 48 files changed, 560 insertions(+), 576 deletions(-) diff --git a/src/devices/bus/ti99x/gromport.cpp b/src/devices/bus/ti99x/gromport.cpp index 8ac6edf02e5..468436a81e6 100644 --- a/src/devices/bus/ti99x/gromport.cpp +++ b/src/devices/bus/ti99x/gromport.cpp @@ -2628,7 +2628,7 @@ int rpk_reader::find_file(util::archive_file &zip, const char *filename, uint32_ /* Load a rom resource and put it in a pcb socket instance. */ -std::unique_ptr rpk_reader::load_rom_resource(util::archive_file &zip, xml_data_node const* rom_resource_node, const char* socketname) +std::unique_ptr rpk_reader::load_rom_resource(util::archive_file &zip, util::xml::data_node const* rom_resource_node, const char* socketname) { const char* file; const char* crcstr; @@ -2693,7 +2693,7 @@ std::unique_ptr rpk_reader::load_rom_resource(util::archive_file &zi /* Load a ram resource and put it in a pcb socket instance. */ -std::unique_ptr rpk_reader::load_ram_resource(emu_options &options, xml_data_node const* ram_resource_node, const char* socketname, const char* system_name) +std::unique_ptr rpk_reader::load_ram_resource(emu_options &options, util::xml::data_node const* ram_resource_node, const char* socketname, const char* system_name) { const char* length_string; const char* ram_type; @@ -2787,7 +2787,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy util::archive_file::ptr zipfile; std::vector layout_text; - xml_data_node *layout_xml = nullptr; + util::xml::data_node *layout_xml = nullptr; int i; @@ -2816,25 +2816,25 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy layout_text[zipfile->current_uncompressed_length()] = '\0'; // Null-terminate /* parse the layout text */ - layout_xml = xml_data_node::string_read(&layout_text[0], nullptr); + layout_xml = util::xml::data_node::string_read(&layout_text[0], nullptr); if (!layout_xml) throw rpk_exception(RPK_XML_ERROR); // Now we work within the XML tree // romset is the root node - xml_data_node const *const romset_node = layout_xml->get_child("romset"); + util::xml::data_node const *const romset_node = layout_xml->get_child("romset"); if (!romset_node) throw rpk_exception(RPK_INVALID_LAYOUT, "document element must be "); // resources is a child of romset - xml_data_node const *const resources_node = romset_node->get_child("resources"); + util::xml::data_node const *const resources_node = romset_node->get_child("resources"); if (!resources_node) throw rpk_exception(RPK_INVALID_LAYOUT, " must have a child"); // configuration is a child of romset; we're actually interested in ... - xml_data_node const *const configuration_node = romset_node->get_child("configuration"); + util::xml::data_node const *const configuration_node = romset_node->get_child("configuration"); if (!configuration_node) throw rpk_exception(RPK_INVALID_LAYOUT, " must have a child"); // ... pcb, which is a child of configuration - xml_data_node const *const pcb_node = configuration_node->get_child("pcb"); + util::xml::data_node const *const pcb_node = configuration_node->get_child("pcb"); if (!pcb_node) throw rpk_exception(RPK_INVALID_LAYOUT, " must have a child"); // We'll try to find the PCB type on the provided type list. @@ -2856,7 +2856,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy if (m_types[i].id==0) throw rpk_exception(RPK_UNKNOWN_PCB_TYPE); // Find the sockets and load their respective resource - for (xml_data_node const *socket_node = pcb_node->get_first_child(); socket_node != nullptr; socket_node = socket_node->get_next_sibling()) + for (util::xml::data_node const *socket_node = pcb_node->get_first_child(); socket_node != nullptr; socket_node = socket_node->get_next_sibling()) { if (strcmp(socket_node->get_name(), "socket")!=0) throw rpk_exception(RPK_INVALID_LAYOUT, " element has only children"); char const *const id = socket_node->get_attribute_string("id", nullptr); @@ -2866,7 +2866,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy bool found = false; // Locate the resource node - for (xml_data_node const *resource_node = resources_node->get_first_child(); resource_node != nullptr; resource_node = resource_node->get_next_sibling()) + for (util::xml::data_node const *resource_node = resources_node->get_first_child(); resource_node != nullptr; resource_node = resource_node->get_next_sibling()) { char const *const resource_name = resource_node->get_attribute_string("id", nullptr); if (!resource_name) throw rpk_exception(RPK_INVALID_LAYOUT, "resource node must have an 'id' attribute"); diff --git a/src/devices/bus/ti99x/gromport.h b/src/devices/bus/ti99x/gromport.h index fc7546bd804..ff99585d447 100644 --- a/src/devices/bus/ti99x/gromport.h +++ b/src/devices/bus/ti99x/gromport.h @@ -515,9 +515,9 @@ public: rpk *open(emu_options &options, const char *filename, const char *system_name); private: - int find_file(util::archive_file &zip, const char *filename, uint32_t crc); - std::unique_ptr load_rom_resource(util::archive_file &zip, xml_data_node const* rom_resource_node, const char* socketname); - std::unique_ptr load_ram_resource(emu_options &options, xml_data_node const* ram_resource_node, const char* socketname, const char* system_name); + int find_file(util::archive_file &zip, const char *filename, uint32_t crc); + std::unique_ptr load_rom_resource(util::archive_file &zip, util::xml::data_node const* rom_resource_node, const char* socketname); + std::unique_ptr load_ram_resource(emu_options &options, util::xml::data_node const* ram_resource_node, const char* socketname, const char* system_name); const pcb_type* m_types; }; diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index 824779c4231..b090b23dd04 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -321,7 +321,7 @@ void laserdisc_device::device_start() init_audio(); // register callbacks - machine().configuration().config_register("laserdisc", config_saveload_delegate(&laserdisc_device::config_load, this), config_saveload_delegate(&laserdisc_device::config_save, this)); + machine().configuration().config_register("laserdisc", config_load_delegate(&laserdisc_device::config_load, this), config_save_delegate(&laserdisc_device::config_save, this)); } @@ -1142,10 +1142,10 @@ void laserdisc_device::process_track_data() // configuration file //------------------------------------------------- -void laserdisc_device::config_load(config_type cfg_type, xml_data_node *parentnode) +void laserdisc_device::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // might not have any data @@ -1153,13 +1153,13 @@ void laserdisc_device::config_load(config_type cfg_type, xml_data_node *parentno return; // iterate over overlay nodes - for (xml_data_node const *ldnode = parentnode->get_child("device"); ldnode != nullptr; ldnode = ldnode->get_next_sibling("device")) + for (util::xml::data_node const *ldnode = parentnode->get_child("device"); ldnode != nullptr; ldnode = ldnode->get_next_sibling("device")) { const char *devtag = ldnode->get_attribute_string("tag", ""); if (strcmp(devtag, tag()) == 0) { // handle the overlay node - xml_data_node const *const overnode = ldnode->get_child("overlay"); + util::xml::data_node const *const overnode = ldnode->get_child("overlay"); if (overnode != nullptr) { // fetch positioning controls @@ -1178,21 +1178,21 @@ void laserdisc_device::config_load(config_type cfg_type, xml_data_node *parentno // file //------------------------------------------------- -void laserdisc_device::config_save(config_type cfg_type, xml_data_node *parentnode) +void laserdisc_device::config_save(config_type cfg_type, util::xml::data_node *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // create a node - xml_data_node *const ldnode = parentnode->add_child("device", nullptr); + util::xml::data_node *const ldnode = parentnode->add_child("device", nullptr); if (ldnode != nullptr) { // output the basics ldnode->set_attribute("tag", tag()); // add an overlay node - xml_data_node *const overnode = ldnode->add_child("overlay", nullptr); + util::xml::data_node *const overnode = ldnode->add_child("overlay", nullptr); bool changed = false; if (overnode != nullptr) { diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h index ada53fdd4d0..b69dec3ff86 100644 --- a/src/devices/machine/laserdsc.h +++ b/src/devices/machine/laserdsc.h @@ -286,8 +286,8 @@ private: void read_track_data(); static void *read_async_static(void *param, int threadid); void process_track_data(); - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); // configuration laserdisc_get_disc_delegate m_getdisc_callback; diff --git a/src/emu/bookkeeping.cpp b/src/emu/bookkeeping.cpp index 3c1cb519795..169d4d369ff 100644 --- a/src/emu/bookkeeping.cpp +++ b/src/emu/bookkeeping.cpp @@ -39,7 +39,7 @@ bookkeeping_manager::bookkeeping_manager(running_machine &machine) machine.save().save_item(NAME(m_dispensed_tickets)); // register for configuration - machine.configuration().config_register("counters", config_saveload_delegate(&bookkeeping_manager::config_load, this), config_saveload_delegate(&bookkeeping_manager::config_save, this)); + machine.configuration().config_register("counters", config_load_delegate(&bookkeeping_manager::config_load, this), config_save_delegate(&bookkeeping_manager::config_save, this)); } @@ -80,19 +80,19 @@ void bookkeeping_manager::increment_dispensed_tickets(int delta) and tickets -------------------------------------------------*/ -void bookkeeping_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void bookkeeping_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { - xml_data_node const *coinnode, *ticketnode; + util::xml::data_node const *coinnode, *ticketnode; /* on init, reset the counters */ - if (cfg_type == config_type::CONFIG_TYPE_INIT) + if (cfg_type == config_type::INIT) { memset(m_coin_count, 0, sizeof(m_coin_count)); m_dispensed_tickets = 0; } /* only care about game-specific data */ - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; /* might not have any data */ @@ -119,30 +119,32 @@ void bookkeeping_manager::config_load(config_type cfg_type, xml_data_node *paren and tickets -------------------------------------------------*/ -void bookkeeping_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void bookkeeping_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { int i; /* only care about game-specific data */ - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; /* iterate over coin counters */ for (i = 0; i < COIN_COUNTERS; i++) + { if (m_coin_count[i] != 0) { - xml_data_node *coinnode = parentnode->add_child("coins", nullptr); + util::xml::data_node *coinnode = parentnode->add_child("coins", nullptr); if (coinnode != nullptr) { coinnode->set_attribute_int("index", i); coinnode->set_attribute_int("number", m_coin_count[i]); } } + } /* output tickets */ if (m_dispensed_tickets != 0) { - xml_data_node *tickets = parentnode->add_child("tickets", nullptr); + util::xml::data_node *tickets = parentnode->add_child("tickets", nullptr); if (tickets != nullptr) tickets->set_attribute_int("number", m_dispensed_tickets); } diff --git a/src/emu/bookkeeping.h b/src/emu/bookkeeping.h index 131ae6e8be4..e66fdf042a4 100644 --- a/src/emu/bookkeeping.h +++ b/src/emu/bookkeeping.h @@ -59,8 +59,8 @@ public: // getters running_machine &machine() const { return m_machine; } private: - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); // internal state running_machine & m_machine; // reference to our machine diff --git a/src/emu/config.cpp b/src/emu/config.cpp index 8e3357adfd6..fb1204fd622 100644 --- a/src/emu/config.cpp +++ b/src/emu/config.cpp @@ -36,7 +36,7 @@ configuration_manager::configuration_manager(running_machine &machine) * *************************************/ -void configuration_manager::config_register(const char* nodename, config_saveload_delegate load, config_saveload_delegate save) +void configuration_manager::config_register(const char* nodename, config_load_delegate load, config_save_delegate save) { config_element element; element.name = nodename; @@ -61,7 +61,7 @@ int configuration_manager::load_settings() /* loop over all registrants and call their init function */ for (auto type : m_typelist) - type.load(config_type::CONFIG_TYPE_INIT, nullptr); + type.load(config_type::INIT, nullptr); /* now load the controller file */ if (controller[0] != 0) @@ -74,7 +74,7 @@ int configuration_manager::load_settings() throw emu_fatalerror("Could not load controller file %s.cfg", controller); /* load the XML */ - if (!load_xml(file, config_type::CONFIG_TYPE_CONTROLLER)) + if (!load_xml(file, config_type::CONTROLLER)) throw emu_fatalerror("Could not load controller file %s.cfg", controller); } @@ -82,16 +82,16 @@ int configuration_manager::load_settings() emu_file file(machine().options().cfg_directory(), OPEN_FLAG_READ); osd_file::error filerr = file.open("default.cfg"); if (filerr == osd_file::error::NONE) - load_xml(file, config_type::CONFIG_TYPE_DEFAULT); + load_xml(file, config_type::DEFAULT); /* finally, load the game-specific file */ filerr = file.open(machine().basename(), ".cfg"); if (filerr == osd_file::error::NONE) - loaded = load_xml(file, config_type::CONFIG_TYPE_GAME); + loaded = load_xml(file, config_type::GAME); /* loop over all registrants and call their final function */ for (auto type : m_typelist) - type.load(config_type::CONFIG_TYPE_FINAL, nullptr); + type.load(config_type::FINAL, nullptr); /* if we didn't find a saved config, return 0 so the main core knows that it */ /* is the first time the game is run and it should diplay the disclaimer. */ @@ -103,22 +103,22 @@ void configuration_manager::save_settings() { /* loop over all registrants and call their init function */ for (auto type : m_typelist) - type.save(config_type::CONFIG_TYPE_INIT, nullptr); + type.save(config_type::INIT, nullptr); /* save the defaults file */ emu_file file(machine().options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); osd_file::error filerr = file.open("default.cfg"); if (filerr == osd_file::error::NONE) - save_xml(file, config_type::CONFIG_TYPE_DEFAULT); + save_xml(file, config_type::DEFAULT); /* finally, save the game-specific file */ filerr = file.open(machine().basename(), ".cfg"); if (filerr == osd_file::error::NONE) - save_xml(file, config_type::CONFIG_TYPE_GAME); + save_xml(file, config_type::GAME); /* loop over all registrants and call their final function */ for (auto type : m_typelist) - type.save(config_type::CONFIG_TYPE_FINAL, nullptr); + type.save(config_type::FINAL, nullptr); } @@ -131,27 +131,25 @@ void configuration_manager::save_settings() int configuration_manager::load_xml(emu_file &file, config_type which_type) { - xml_data_node *root, *confignode, *systemnode; - const char *srcfile; - int version, count; - /* read the file */ - root = xml_data_node::file_read(file, nullptr); + std::unique_ptr const root( + util::xml::data_node::file_read(file, nullptr), + [] (util::xml::data_node *node) { node->file_free(); }); if (!root) - goto error; + return 0; /* find the config node */ - confignode = root->get_child("mameconfig"); + util::xml::data_node const *const confignode = root->get_child("mameconfig"); if (!confignode) - goto error; + return 0; /* validate the config data version */ - version = confignode->get_attribute_int("version", 0); + int const version = confignode->get_attribute_int("version", 0); if (version != CONFIG_VERSION) - goto error; + return 0; /* strip off all the path crap from the source filename */ - srcfile = strrchr(machine().system().source_file, '/'); + const char *srcfile = strrchr(machine().system().source_file, '/'); if (!srcfile) srcfile = strrchr(machine().system().source_file, '\\'); if (!srcfile) @@ -162,8 +160,8 @@ int configuration_manager::load_xml(emu_file &file, config_type which_type) srcfile++; /* loop over all system nodes in the file */ - count = 0; - for (systemnode = confignode->get_child("system"); systemnode; systemnode = systemnode->get_next_sibling("system")) + int count = 0; + for (util::xml::data_node const *systemnode = confignode->get_child("system"); systemnode; systemnode = systemnode->get_next_sibling("system")) { /* look up the name of the system here; skip if none */ const char *name = systemnode->get_attribute_string("name", ""); @@ -171,19 +169,19 @@ int configuration_manager::load_xml(emu_file &file, config_type which_type) /* based on the file type, determine whether we have a match */ switch (which_type) { - case config_type::CONFIG_TYPE_GAME: - /* only match on the specific game name */ - if (strcmp(name, machine().system().name) != 0) - continue; - break; + case config_type::GAME: + /* only match on the specific game name */ + if (strcmp(name, machine().system().name) != 0) + continue; + break; - case config_type::CONFIG_TYPE_DEFAULT: - /* only match on default */ - if (strcmp(name, "default") != 0) - continue; - break; + case config_type::DEFAULT: + /* only match on default */ + if (strcmp(name, "default") != 0) + continue; + break; - case config_type::CONFIG_TYPE_CONTROLLER: + case config_type::CONTROLLER: { int clone_of; /* match on: default, game name, source file name, parent name, grandparent name */ @@ -195,8 +193,9 @@ int configuration_manager::load_xml(emu_file &file, config_type which_type) continue; break; } - default: - break; + + default: + break; } /* log that we are processing this entry */ @@ -211,16 +210,9 @@ int configuration_manager::load_xml(emu_file &file, config_type which_type) /* error if this isn't a valid game match */ if (count == 0) - goto error; + return 0; - /* free the parser */ - root->file_free(); return 1; - -error: - if (root) - root->file_free(); - return 0; } @@ -233,32 +225,33 @@ error: int configuration_manager::save_xml(emu_file &file, config_type which_type) { - xml_data_node *const root = xml_data_node::file_create(); - xml_data_node *confignode, *systemnode; + std::unique_ptr const root( + util::xml::data_node::file_create(), + [] (util::xml::data_node *node) { node->file_free(); }); /* if we don't have a root, bail */ if (!root) return 0; /* create a config node */ - confignode = root->add_child("mameconfig", nullptr); + util::xml::data_node *const confignode = root->add_child("mameconfig", nullptr); if (!confignode) - goto error; + return 0; confignode->set_attribute_int("version", CONFIG_VERSION); /* create a system node */ - systemnode = confignode->add_child("system", nullptr); + util::xml::data_node *const systemnode = confignode->add_child("system", nullptr); if (!systemnode) - goto error; - systemnode->set_attribute("name", (which_type == config_type::CONFIG_TYPE_DEFAULT) ? "default" : machine().system().name); + return 0; + systemnode->set_attribute("name", (which_type == config_type::DEFAULT) ? "default" : machine().system().name); /* create the input node and write it out */ /* loop over all registrants and call their save function */ for (auto type : m_typelist) { - xml_data_node *curnode = systemnode->add_child(type.name.c_str(), nullptr); + util::xml::data_node *const curnode = systemnode->add_child(type.name.c_str(), nullptr); if (!curnode) - goto error; + return 0; type.save(which_type, curnode); /* if nothing was added, just nuke the node */ @@ -270,10 +263,5 @@ int configuration_manager::save_xml(emu_file &file, config_type which_type) root->file_write(file); /* free and get out of here */ - root->file_free(); return 1; - -error: - root->file_free(); - return 0; } diff --git a/src/emu/config.h b/src/emu/config.h index 172f9f19daa..e9f528a17cc 100644 --- a/src/emu/config.h +++ b/src/emu/config.h @@ -7,10 +7,10 @@ Wrappers for handling MAME configuration files ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_CONFIG_H +#define MAME_EMU_CONFIG_H -#ifndef __CONFIG_H__ -#define __CONFIG_H__ +#pragma once #include "xmlfile.h" @@ -24,11 +24,11 @@ enum class config_type { - CONFIG_TYPE_INIT = 0, /* opportunity to initialize things first */ - CONFIG_TYPE_CONTROLLER, /* loading from controller file */ - CONFIG_TYPE_DEFAULT, /* loading from default.cfg */ - CONFIG_TYPE_GAME, /* loading from game.cfg */ - CONFIG_TYPE_FINAL /* opportunity to finish initialization */ + INIT = 0, // opportunity to initialize things first + CONTROLLER, // loading from controller file + DEFAULT, // loading from default.cfg + GAME, // loading from game.cfg + FINAL // opportunity to finish initialization }; /************************************* @@ -37,7 +37,8 @@ enum class config_type * *************************************/ -typedef delegate config_saveload_delegate; +typedef delegate config_load_delegate; +typedef delegate config_save_delegate; // ======================> configuration_manager @@ -45,16 +46,16 @@ class configuration_manager { struct config_element { - std::string name; /* node name */ - config_saveload_delegate load; /* load callback */ - config_saveload_delegate save; /* save callback */ + std::string name; // node name + config_load_delegate load; // load callback + config_save_delegate save; // save callback }; public: // construction/destruction configuration_manager(running_machine &machine); - void config_register(const char* nodename, config_saveload_delegate load, config_saveload_delegate save); + void config_register(const char* nodename, config_load_delegate load, config_save_delegate save); int load_settings(); void save_settings(); @@ -69,4 +70,4 @@ private: std::vector m_typelist; }; -#endif /* __CONFIG_H__ */ +#endif /* MAME_EMU_CONFIG_H */ diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 26d671ec479..f4e69d26d50 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -311,7 +311,7 @@ crosshair_manager::crosshair_manager(running_machine &machine) /* register callbacks for when we load/save configurations */ if (m_usage) - machine.configuration().config_register("crosshairs", config_saveload_delegate(&crosshair_manager::config_load, this), config_saveload_delegate(&crosshair_manager::config_save, this)); + machine.configuration().config_register("crosshairs", config_load_delegate(&crosshair_manager::config_load, this), config_save_delegate(&crosshair_manager::config_save, this)); /* register the animation callback */ if (machine.first_screen() != nullptr) @@ -381,15 +381,12 @@ void crosshair_manager::render(screen_device &screen) configuration file -------------------------------------------------*/ -void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void crosshair_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { /* Note: crosshair_load() is only registered if croshairs are used */ - xml_data_node const *crosshairnode; - int auto_time; - /* we only care about game files */ - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; /* might not have any data */ @@ -397,11 +394,9 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn return; /* loop and get player crosshair info */ - for (crosshairnode = parentnode->get_child("crosshair"); crosshairnode; crosshairnode = crosshairnode->get_next_sibling("crosshair")) + for (util::xml::data_node const *crosshairnode = parentnode->get_child("crosshair"); crosshairnode; crosshairnode = crosshairnode->get_next_sibling("crosshair")) { - int player, mode; - - player = crosshairnode->get_attribute_int("player", -1); + int const player = crosshairnode->get_attribute_int("player", -1); // check to make sure we have a valid player if (player >= 0 && player < MAX_PLAYERS) @@ -411,7 +406,7 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn if (crosshair.is_used()) { // get, check, and store visibility mode - mode = crosshairnode->get_attribute_int("mode", CROSSHAIR_VISIBILITY_DEFAULT); + int const mode = crosshairnode->get_attribute_int("mode", CROSSHAIR_VISIBILITY_DEFAULT); if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO) { crosshair.set_mode(u8(mode)); @@ -427,10 +422,10 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn } /* get, check, and store auto visibility time */ - crosshairnode = parentnode->get_child("autotime"); - if (crosshairnode != nullptr) + util::xml::data_node const *crosshairnode = parentnode->get_child("autotime"); + if (crosshairnode) { - auto_time = crosshairnode->get_attribute_int("val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT); + int const auto_time = crosshairnode->get_attribute_int("val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT); if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX)) m_auto_time = u8(auto_time); } @@ -442,25 +437,22 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn configuration file -------------------------------------------------*/ -void crosshair_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void crosshair_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { /* Note: crosshair_save() is only registered if crosshairs are used */ - xml_data_node *crosshairnode; - int player; - /* we only care about game files */ - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; - for (player = 0; player < MAX_PLAYERS; player++) + for (int player = 0; player < MAX_PLAYERS; player++) { const render_crosshair &crosshair = *m_crosshair[player]; if (crosshair.is_used()) { /* create a node */ - crosshairnode = parentnode->add_child("crosshair", nullptr); + util::xml::data_node *const crosshairnode = parentnode->add_child("crosshair", nullptr); if (crosshairnode != nullptr) { @@ -492,7 +484,7 @@ void crosshair_manager::config_save(config_type cfg_type, xml_data_node *parentn if (m_auto_time != CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT) { /* create a node */ - crosshairnode = parentnode->add_child("autotime", nullptr); + util::xml::data_node *const crosshairnode = parentnode->add_child("autotime", nullptr); if (crosshairnode != nullptr) crosshairnode->set_attribute_int("val", m_auto_time); diff --git a/src/emu/crsshair.h b/src/emu/crsshair.h index 7981c249b98..c733f0afccf 100644 --- a/src/emu/crsshair.h +++ b/src/emu/crsshair.h @@ -116,8 +116,8 @@ private: void exit(); void animate(screen_device &device, bool vblank_state); - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); // internal state running_machine & m_machine; // reference to our machine diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 2c5885954de..98fa6c9f038 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -220,7 +220,7 @@ bool debugger_cpu::comment_save() bool comments_saved = false; // if we don't have a root, bail - xml_data_node *const root = xml_data_node::file_create(); + util::xml::data_node *const root = util::xml::data_node::file_create(); if (root == nullptr) return false; @@ -228,13 +228,13 @@ bool debugger_cpu::comment_save() try { // create a comment node - xml_data_node *const commentnode = root->add_child("mamecommentfile", nullptr); + util::xml::data_node *const commentnode = root->add_child("mamecommentfile", nullptr); if (commentnode == nullptr) throw emu_exception(); commentnode->set_attribute_int("version", COMMENT_VERSION); // create a system node - xml_data_node *const systemnode = commentnode->add_child("system", nullptr); + util::xml::data_node *const systemnode = commentnode->add_child("system", nullptr); if (systemnode == nullptr) throw emu_exception(); systemnode->set_attribute("name", m_machine.system().name); @@ -245,7 +245,7 @@ bool debugger_cpu::comment_save() if (device.debug() && device.debug()->comment_count() > 0) { // create a node for this device - xml_data_node *const curnode = systemnode->add_child("cpu", nullptr); + util::xml::data_node *const curnode = systemnode->add_child("cpu", nullptr); if (curnode == nullptr) throw emu_exception(); curnode->set_attribute("tag", device.tag()); @@ -295,7 +295,7 @@ bool debugger_cpu::comment_load(bool is_inline) return false; // wrap in a try/catch to handle errors - xml_data_node *const root = xml_data_node::file_read(file, nullptr); + util::xml::data_node *const root = util::xml::data_node::file_read(file, nullptr); try { // read the file @@ -303,7 +303,7 @@ bool debugger_cpu::comment_load(bool is_inline) throw emu_exception(); // find the config node - xml_data_node const *const commentnode = root->get_child("mamecommentfile"); + util::xml::data_node const *const commentnode = root->get_child("mamecommentfile"); if (commentnode == nullptr) throw emu_exception(); @@ -313,13 +313,13 @@ bool debugger_cpu::comment_load(bool is_inline) throw emu_exception(); // check to make sure the file is applicable - xml_data_node const *const systemnode = commentnode->get_child("system"); + util::xml::data_node const *const systemnode = commentnode->get_child("system"); const char *const name = systemnode->get_attribute_string("name", ""); if (strcmp(name, m_machine.system().name) != 0) throw emu_exception(); // iterate over devices - for (xml_data_node const *cpunode = systemnode->get_child("cpu"); cpunode; cpunode = cpunode->get_next_sibling("cpu")) + for (util::xml::data_node const *cpunode = systemnode->get_child("cpu"); cpunode; cpunode = cpunode->get_next_sibling("cpu")) { const char *cputag_name = cpunode->get_attribute_string("tag", ""); device_t *device = m_machine.device(cputag_name); @@ -2539,12 +2539,12 @@ const char *device_debug::comment_text(offs_t addr) const // given XML data node //------------------------------------------------- -bool device_debug::comment_export(xml_data_node &curnode) +bool device_debug::comment_export(util::xml::data_node &curnode) { // iterate through the comments for (const auto & elem : m_comment_set) { - xml_data_node *datanode = curnode.add_child("comment", xml_normalize_string(elem.m_text.c_str())); + util::xml::data_node *datanode = curnode.add_child("comment", util::xml::normalize_string(elem.m_text.c_str())); if (datanode == nullptr) return false; datanode->set_attribute_int("address", elem.m_address); @@ -2560,10 +2560,10 @@ bool device_debug::comment_export(xml_data_node &curnode) // given XML data node //------------------------------------------------- -bool device_debug::comment_import(xml_data_node const &cpunode, bool is_inline) +bool device_debug::comment_import(util::xml::data_node const &cpunode, bool is_inline) { // iterate through nodes - for (xml_data_node const *datanode = cpunode.get_child("comment"); datanode; datanode = datanode->get_next_sibling("comment")) + for (util::xml::data_node const *datanode = cpunode.get_child("comment"); datanode; datanode = datanode->get_next_sibling("comment")) { // extract attributes offs_t address = datanode->get_attribute_int("address", 0); diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 079b17d1fd0..c01cc0e0646 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -18,6 +18,9 @@ #include +namespace util { namespace xml { class data_node; } } + + //************************************************************************** // CONSTANTS //************************************************************************** @@ -37,9 +40,6 @@ constexpr int COMMENT_VERSION = 1; typedef int (*debug_instruction_hook_func)(device_t &device, offs_t curpc); -class xml_data_node; - - // ======================> device_debug // [TODO] This whole thing is terrible. @@ -242,8 +242,8 @@ public: const char *comment_text(offs_t addr) const; u32 comment_count() const { return m_comment_set.size(); } u32 comment_change_count() const { return m_comment_change; } - bool comment_export(xml_data_node &node); - bool comment_import(xml_data_node const &node, bool is_inline); + bool comment_export(util::xml::data_node &node); + bool comment_import(util::xml::data_node const &node, bool is_inline); u32 compute_opcode_crc32(offs_t pc) const; // history diff --git a/src/emu/image.cpp b/src/emu/image.cpp index b7e5ddd50a0..29d8424efc3 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -76,7 +76,7 @@ image_manager::image_manager(running_machine &machine) } } - machine.configuration().config_register("image_directories", config_saveload_delegate(&image_manager::config_load, this), config_saveload_delegate(&image_manager::config_save, this)); + machine.configuration().config_register("image_directories", config_load_delegate(&image_manager::config_load, this), config_save_delegate(&image_manager::config_save, this)); } //------------------------------------------------- @@ -95,24 +95,21 @@ void image_manager::unload_all() } } -void image_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void image_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { - xml_data_node const *node; - const char *dev_instance; - const char *working_directory; - - if ((cfg_type == config_type::CONFIG_TYPE_GAME) && (parentnode != nullptr)) + if ((cfg_type == config_type::GAME) && (parentnode != nullptr)) { - for (node = parentnode->get_child("device"); node; node = node->get_next_sibling("device")) + for (util::xml::data_node const *node = parentnode->get_child("device"); node; node = node->get_next_sibling("device")) { - dev_instance = node->get_attribute_string("instance", nullptr); + const char *const dev_instance = node->get_attribute_string("instance", nullptr); if ((dev_instance != nullptr) && (dev_instance[0] != '\0')) { for (device_image_interface &image : image_interface_iterator(machine().root_device())) { - if (!strcmp(dev_instance, image.instance_name())) { - working_directory = node->get_attribute_string("directory", nullptr); + if (!strcmp(dev_instance, image.instance_name())) + { + const char *const working_directory = node->get_attribute_string("directory", nullptr); if (working_directory != nullptr) image.set_working_directory(working_directory); } @@ -127,19 +124,16 @@ void image_manager::config_load(config_type cfg_type, xml_data_node *parentnode) directories to the configuration file -------------------------------------------------*/ -void image_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void image_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { - xml_data_node *node; - const char *dev_instance; - /* only care about game-specific data */ - if (cfg_type == config_type::CONFIG_TYPE_GAME) + if (cfg_type == config_type::GAME) { for (device_image_interface &image : image_interface_iterator(machine().root_device())) { - dev_instance = image.instance_name(); + const char *const dev_instance = image.instance_name(); - node = parentnode->add_child("device", nullptr); + util::xml::data_node *const node = parentnode->add_child("device", nullptr); if (node != nullptr) { node->set_attribute("instance", dev_instance); diff --git a/src/emu/image.h b/src/emu/image.h index 4a9e55e4c80..b0cc5f60852 100644 --- a/src/emu/image.h +++ b/src/emu/image.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_IMAGE_H +#define MAME_EMU_IMAGE_H -#ifndef __IMAGE_H__ -#define __IMAGE_H__ +#pragma once // ======================> image_manager @@ -27,8 +27,8 @@ public: // getters running_machine &machine() const { return m_machine; } private: - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); void options_extract(); int write_config(emu_options &options, const char *filename, const game_driver *gamedrv); @@ -37,4 +37,4 @@ private: running_machine & m_machine; // reference to our machine }; -#endif /* __IMAGE_H__ */ +#endif /* MAME_EMU_IMAGE_H */ diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 5e268ffa750..6f751a28dad 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -1747,7 +1747,7 @@ time_t ioport_manager::initialize() m_natkeyboard = std::make_unique(machine()); // register callbacks for when we load configurations - machine().configuration().config_register("input", config_saveload_delegate(&ioport_manager::load_config, this), config_saveload_delegate(&ioport_manager::save_config, this)); + machine().configuration().config_register("input", config_load_delegate(&ioport_manager::load_config, this), config_save_delegate(&ioport_manager::save_config, this)); // open playback and record files if specified time_t basetime = playback_init(); @@ -2080,10 +2080,10 @@ s32 ioport_manager::frame_interpolate(s32 oldval, s32 newval) // data from the XML nodes //------------------------------------------------- -void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode) +void ioport_manager::load_config(config_type cfg_type, util::xml::data_node const *parentnode) { // in the completion phase, we finish the initialization with the final ports - if (cfg_type == config_type::CONFIG_TYPE_FINAL) + if (cfg_type == config_type::FINAL) { m_safe_to_read = true; frame_update(); @@ -2094,14 +2094,14 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode return; // iterate over all the remap nodes for controller configs only - if (cfg_type == config_type::CONFIG_TYPE_CONTROLLER) + if (cfg_type == config_type::CONTROLLER) load_remap_table(parentnode); // load device map table for controller configs only - if (cfg_type == config_type::CONFIG_TYPE_CONTROLLER) + if (cfg_type == config_type::CONTROLLER) { std::unique_ptr devicemap_table = std::make_unique(); - for (xml_data_node const *mapdevice_node = parentnode->get_child("mapdevice"); mapdevice_node != nullptr; mapdevice_node = mapdevice_node->get_next_sibling("mapdevice")) + for (util::xml::data_node const *mapdevice_node = parentnode->get_child("mapdevice"); mapdevice_node != nullptr; mapdevice_node = mapdevice_node->get_next_sibling("mapdevice")) { const char *devicename = mapdevice_node->get_attribute_string("device", nullptr); const char *controllername = mapdevice_node->get_attribute_string("controller", nullptr); @@ -2119,7 +2119,7 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode } // iterate over all the port nodes - for (xml_data_node const *portnode = parentnode->get_child("port"); portnode; portnode = portnode->get_next_sibling("port")) + for (util::xml::data_node const *portnode = parentnode->get_child("port"); portnode; portnode = portnode->get_next_sibling("port")) { // get the basic port info from the attributes int player; @@ -2131,7 +2131,7 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode newseq[seqtype].set(INPUT_CODE_INVALID); // loop over new sequences - for (xml_data_node const *seqnode = portnode->get_child("newseq"); seqnode; seqnode = seqnode->get_next_sibling("newseq")) + for (util::xml::data_node const *seqnode = portnode->get_child("newseq"); seqnode; seqnode = seqnode->get_next_sibling("newseq")) { // with a valid type, parse out the new sequence input_seq_type seqtype = token_to_seq_type(seqnode->get_attribute_string("type", "")); @@ -2145,7 +2145,7 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode } // if we're loading default ports, apply to the defaults - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) load_default_config(portnode, type, player, newseq); else load_game_config(portnode, type, player, newseq); @@ -2153,7 +2153,7 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode // after applying the controller config, push that back into the backup, since that is // what we will diff against - if (cfg_type == config_type::CONFIG_TYPE_CONTROLLER) + if (cfg_type == config_type::CONTROLLER) for (input_type_entry &entry : m_typelist) for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) entry.defseq(seqtype) = entry.seq(seqtype); @@ -2165,11 +2165,11 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode // global remapping table //------------------------------------------------- -void ioport_manager::load_remap_table(xml_data_node const *parentnode) +void ioport_manager::load_remap_table(util::xml::data_node const *parentnode) { // count items first so we can allocate int count = 0; - for (xml_data_node const *remapnode = parentnode->get_child("remap"); remapnode != nullptr; remapnode = remapnode->get_next_sibling("remap")) + for (util::xml::data_node const *remapnode = parentnode->get_child("remap"); remapnode != nullptr; remapnode = remapnode->get_next_sibling("remap")) count++; // if we have some, deal with them @@ -2181,7 +2181,7 @@ void ioport_manager::load_remap_table(xml_data_node const *parentnode) // build up the remap table count = 0; - for (xml_data_node const *remapnode = parentnode->get_child("remap"); remapnode != nullptr; remapnode = remapnode->get_next_sibling("remap")) + for (util::xml::data_node const *remapnode = parentnode->get_child("remap"); remapnode != nullptr; remapnode = remapnode->get_next_sibling("remap")) { input_code origcode = machine().input().code_from_token(remapnode->get_attribute_string("origcode", "")); input_code newcode = machine().input().code_from_token(remapnode->get_attribute_string("newcode", "")); @@ -2207,7 +2207,7 @@ void ioport_manager::load_remap_table(xml_data_node const *parentnode) // data to the default mappings //------------------------------------------------- -bool ioport_manager::load_default_config(xml_data_node const *portnode, int type, int player, const input_seq *newseq) +bool ioport_manager::load_default_config(util::xml::data_node const *portnode, int type, int player, const input_seq *newseq) { // find a matching port in the list for (input_type_entry &entry : m_typelist) @@ -2228,7 +2228,7 @@ bool ioport_manager::load_default_config(xml_data_node const *portnode, int type // data to the current set of input ports //------------------------------------------------- -bool ioport_manager::load_game_config(xml_data_node const *portnode, int type, int player, const input_seq *newseq) +bool ioport_manager::load_game_config(util::xml::data_node const *portnode, int type, int player, const input_seq *newseq) { // read the mask, index, and defvalue attributes const char *tag = portnode->get_attribute_string("tag", nullptr); @@ -2292,17 +2292,17 @@ bool ioport_manager::load_game_config(xml_data_node const *portnode, int type, i // port configuration //------------------------------------------------- -void ioport_manager::save_config(config_type cfg_type, xml_data_node *parentnode) +void ioport_manager::save_config(config_type cfg_type, util::xml::data_node *parentnode) { // if no parentnode, ignore if (parentnode == nullptr) return; // default ports save differently - if (cfg_type == config_type::CONFIG_TYPE_DEFAULT) - save_default_inputs(parentnode); + if (cfg_type == config_type::DEFAULT) + save_default_inputs(*parentnode); else - save_game_inputs(parentnode); + save_game_inputs(*parentnode); } @@ -2311,7 +2311,7 @@ void ioport_manager::save_config(config_type cfg_type, xml_data_node *parentnode // sequence //------------------------------------------------- -void ioport_manager::save_sequence(xml_data_node *parentnode, input_seq_type type, ioport_type porttype, const input_seq &seq) +void ioport_manager::save_sequence(util::xml::data_node &parentnode, input_seq_type type, ioport_type porttype, const input_seq &seq) { // get the string for the sequence std::string seqstring; @@ -2321,7 +2321,7 @@ void ioport_manager::save_sequence(xml_data_node *parentnode, input_seq_type typ seqstring = machine().input().seq_to_tokens(seq); // add the new node - xml_data_node *const seqnode = parentnode->add_child("newseq", seqstring.c_str()); + util::xml::data_node *const seqnode = parentnode.add_child("newseq", seqstring.c_str()); if (seqnode != nullptr) seqnode->set_attribute("type", seqtypestrings[type]); } @@ -2354,7 +2354,7 @@ bool ioport_manager::save_this_input_field_type(ioport_type type) // mappings that have changed //------------------------------------------------- -void ioport_manager::save_default_inputs(xml_data_node *parentnode) +void ioport_manager::save_default_inputs(util::xml::data_node &parentnode) { // iterate over ports for (input_type_entry &entry : m_typelist) @@ -2372,7 +2372,7 @@ void ioport_manager::save_default_inputs(xml_data_node *parentnode) if (seqtype < SEQ_TYPE_TOTAL) { // add a new port node - xml_data_node *const portnode = parentnode->add_child("port", nullptr); + util::xml::data_node *const portnode = parentnode.add_child("port", nullptr); if (portnode != nullptr) { // add the port information and attributes @@ -2381,7 +2381,7 @@ void ioport_manager::save_default_inputs(xml_data_node *parentnode) // add only the sequences that have changed from the defaults for (input_seq_type type = SEQ_TYPE_STANDARD; type < SEQ_TYPE_TOTAL; ++type) if (entry.seq(type) != entry.defseq(type)) - save_sequence(portnode, type, entry.type(), entry.seq(type)); + save_sequence(*portnode, type, entry.type(), entry.seq(type)); } } } @@ -2394,7 +2394,7 @@ void ioport_manager::save_default_inputs(xml_data_node *parentnode) // mappings that have changed //------------------------------------------------- -void ioport_manager::save_game_inputs(xml_data_node *parentnode) +void ioport_manager::save_game_inputs(util::xml::data_node &parentnode) { // iterate over ports for (auto &port : m_portlist) @@ -2426,7 +2426,7 @@ void ioport_manager::save_game_inputs(xml_data_node *parentnode) if (changed) { // add a new port node - xml_data_node *portnode = parentnode->add_child("port", nullptr); + util::xml::data_node *const portnode = parentnode.add_child("port", nullptr); if (portnode != nullptr) { // add the identifying information and attributes @@ -2438,7 +2438,7 @@ void ioport_manager::save_game_inputs(xml_data_node *parentnode) // add sequences if changed for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) if (field.seq(seqtype) != field.defseq(seqtype)) - save_sequence(portnode, seqtype, field.type(), field.seq(seqtype)); + save_sequence(*portnode, seqtype, field.type(), field.seq(seqtype)); // write out non-analog changes if (!field.is_analog()) diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 2f266261698..a9a4d49b0c4 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -654,6 +654,7 @@ enum //************************************************************************** // forward declarations +namespace util { namespace xml { class data_node; } } class ioport_list; class ioport_port; struct ioport_port_live; @@ -661,7 +662,6 @@ class ioport_field; struct ioport_field_live; class ioport_manager; class natural_keyboard; -class xml_data_node; class analog_field; // constructor function pointer @@ -1436,16 +1436,16 @@ private: input_seq_type token_to_seq_type(const char *string); static const char *const seqtypestrings[]; - void load_config(config_type cfg_type, xml_data_node *parentnode); - void load_remap_table(xml_data_node const *parentnode); - bool load_default_config(xml_data_node const *portnode, int type, int player, const input_seq *newseq); - bool load_game_config(xml_data_node const *portnode, int type, int player, const input_seq *newseq); + void load_config(config_type cfg_type, util::xml::data_node const *parentnode); + void load_remap_table(util::xml::data_node const *parentnode); + bool load_default_config(util::xml::data_node const *portnode, int type, int player, const input_seq *newseq); + bool load_game_config(util::xml::data_node const *portnode, int type, int player, const input_seq *newseq); - void save_config(config_type cfg_type, xml_data_node *parentnode); - void save_sequence(xml_data_node *parentnode, input_seq_type type, ioport_type porttype, const input_seq &seq); + void save_config(config_type cfg_type, util::xml::data_node *parentnode); + void save_sequence(util::xml::data_node &parentnode, input_seq_type type, ioport_type porttype, const input_seq &seq); bool save_this_input_field_type(ioport_type type); - void save_default_inputs(xml_data_node *parentnode); - void save_game_inputs(xml_data_node *parentnode); + void save_default_inputs(util::xml::data_node &parentnode); + void save_game_inputs(util::xml::data_node &parentnode); template _Type playback_read(_Type &result); time_t playback_init(); diff --git a/src/emu/main.h b/src/emu/main.h index 7b753dd167f..12f0f1a9462 100644 --- a/src/emu/main.h +++ b/src/emu/main.h @@ -59,7 +59,7 @@ public: static void draw_user_interface(running_machine& machine); static void periodic_check(); static bool frame_hook(); - static void layout_file_cb(xml_data_node &layout); + static void layout_file_cb(util::xml::data_node &layout); static bool standalone(); }; diff --git a/src/emu/network.cpp b/src/emu/network.cpp index 8239949c958..259cca30efb 100644 --- a/src/emu/network.cpp +++ b/src/emu/network.cpp @@ -24,7 +24,7 @@ network_manager::network_manager(running_machine &machine) : m_machine(machine) { - machine.configuration().config_register("network", config_saveload_delegate(&network_manager::config_load, this), config_saveload_delegate(&network_manager::config_save, this)); + machine.configuration().config_register("network", config_load_delegate(&network_manager::config_load, this), config_save_delegate(&network_manager::config_save, this)); } //------------------------------------------------- @@ -32,12 +32,11 @@ network_manager::network_manager(running_machine &machine) // configuration file //------------------------------------------------- -void network_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void network_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { - xml_data_node const *node; - if ((cfg_type == config_type::CONFIG_TYPE_GAME) && (parentnode != nullptr)) + if ((cfg_type == config_type::GAME) && (parentnode != nullptr)) { - for (node = parentnode->get_child("device"); node; node = node->get_next_sibling("device")) + for (util::xml::data_node const *node = parentnode->get_child("device"); node; node = node->get_next_sibling("device")) { const char *tag = node->get_attribute_string("tag", nullptr); @@ -68,16 +67,14 @@ void network_manager::config_load(config_type cfg_type, xml_data_node *parentnod // file //------------------------------------------------- -void network_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void network_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { - xml_data_node *node; - /* only care about game-specific data */ - if (cfg_type == config_type::CONFIG_TYPE_GAME) + if (cfg_type == config_type::GAME) { for (device_network_interface &network : network_interface_iterator(machine().root_device())) { - node = parentnode->add_child("device", nullptr); + util::xml::data_node *const node = parentnode->add_child("device", nullptr); if (node != nullptr) { node->set_attribute("tag", network.device().tag()); diff --git a/src/emu/network.h b/src/emu/network.h index 41ed328c37d..29cf8c3c5d0 100644 --- a/src/emu/network.h +++ b/src/emu/network.h @@ -9,8 +9,8 @@ #pragma once -#ifndef __NETWORK_H__ -#define __NETWORK_H__ +#ifndef MAME_EMU_NETWORK_H +#define MAME_EMU_NETWORK_H // ======================> network_manager @@ -23,11 +23,11 @@ public: // getters running_machine &machine() const { return m_machine; } private: - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); // internal state running_machine & m_machine; // reference to our machine }; -#endif /* __NETWORK_H__ */ +#endif /* MAME_EMU_NETWORK_H */ diff --git a/src/emu/render.cpp b/src/emu/render.cpp index d1ee1a600f7..f1e7a952bc8 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -1701,9 +1701,9 @@ bool render_target::load_layout_file(const char *dirname, const internal_layout bool render_target::load_layout_file(const char *dirname, const char *filename) { // if the first character of the "file" is an open brace, assume it is an XML string - xml_data_node *rootnode; + util::xml::data_node *rootnode; if (filename[0] == '<') - rootnode = xml_data_node::string_read(filename, nullptr); + rootnode = util::xml::data_node::string_read(filename, nullptr); // otherwise, assume it is a file else @@ -1720,7 +1720,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) return false; // read the file - rootnode = xml_data_node::file_read(layoutfile, nullptr); + rootnode = util::xml::data_node::file_read(layoutfile, nullptr); } // if we didn't get a properly-formatted XML file, record a warning and exit @@ -2215,7 +2215,7 @@ int render_target::view_index(layout_view &targetview) const // config_load - process config information //------------------------------------------------- -void render_target::config_load(xml_data_node const &targetnode) +void render_target::config_load(util::xml::data_node const &targetnode) { // find the view const char *viewname = targetnode.get_attribute_string("view", nullptr); @@ -2290,7 +2290,7 @@ void render_target::config_load(xml_data_node const &targetnode) // return false if we are the same as the default //------------------------------------------------- -bool render_target::config_save(xml_data_node &targetnode) +bool render_target::config_save(util::xml::data_node &targetnode) { bool changed = false; @@ -2618,7 +2618,7 @@ render_manager::render_manager(running_machine &machine) m_ui_container(global_alloc(render_container(*this))) { // register callbacks - machine.configuration().config_register("video", config_saveload_delegate(&render_manager::config_load, this), config_saveload_delegate(&render_manager::config_save, this)); + machine.configuration().config_register("video", config_load_delegate(&render_manager::config_load, this), config_save_delegate(&render_manager::config_save, this)); // create one container per screen for (screen_device &screen : screen_device_iterator(machine.root_device())) @@ -2870,10 +2870,10 @@ void render_manager::container_free(render_container *container) // configuration file //------------------------------------------------- -void render_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void render_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // might not have any data @@ -2881,7 +2881,7 @@ void render_manager::config_load(config_type cfg_type, xml_data_node *parentnode return; // check the UI target - xml_data_node const *const uinode = parentnode->get_child("interface"); + util::xml::data_node const *const uinode = parentnode->get_child("interface"); if (uinode != nullptr) { render_target *target = target_by_index(uinode->get_attribute_int("target", 0)); @@ -2890,7 +2890,7 @@ void render_manager::config_load(config_type cfg_type, xml_data_node *parentnode } // iterate over target nodes - for (xml_data_node const *targetnode = parentnode->get_child("target"); targetnode; targetnode = targetnode->get_next_sibling("target")) + for (util::xml::data_node const *targetnode = parentnode->get_child("target"); targetnode; targetnode = targetnode->get_next_sibling("target")) { render_target *target = target_by_index(targetnode->get_attribute_int("index", -1)); if (target != nullptr) @@ -2898,7 +2898,7 @@ void render_manager::config_load(config_type cfg_type, xml_data_node *parentnode } // iterate over screen nodes - for (xml_data_node const *screennode = parentnode->get_child("screen"); screennode; screennode = screennode->get_next_sibling("screen")) + for (util::xml::data_node const *screennode = parentnode->get_child("screen"); screennode; screennode = screennode->get_next_sibling("screen")) { int index = screennode->get_attribute_int("index", -1); render_container *container = m_screen_container_list.find(index); @@ -2929,17 +2929,17 @@ void render_manager::config_load(config_type cfg_type, xml_data_node *parentnode // file //------------------------------------------------- -void render_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void render_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // write out the interface target if (m_ui_target->index() != 0) { // create a node for it - xml_data_node *const uinode = parentnode->add_child("interface", nullptr); + util::xml::data_node *const uinode = parentnode->add_child("interface", nullptr); if (uinode != nullptr) uinode->set_attribute_int("target", m_ui_target->index()); } @@ -2953,7 +2953,7 @@ void render_manager::config_save(config_type cfg_type, xml_data_node *parentnode break; // create a node - xml_data_node *const targetnode = parentnode->add_child("target", nullptr); + util::xml::data_node *const targetnode = parentnode->add_child("target", nullptr); if (targetnode != nullptr && !target->config_save(*targetnode)) targetnode->delete_node(); } @@ -2963,7 +2963,7 @@ void render_manager::config_save(config_type cfg_type, xml_data_node *parentnode for (render_container *container = m_screen_container_list.first(); container != nullptr; container = container->next(), scrnum++) { // create a node - xml_data_node *const screennode = parentnode->add_child("screen", nullptr); + util::xml::data_node *const screennode = parentnode->add_child("screen", nullptr); if (screennode != nullptr) { bool changed = false; diff --git a/src/emu/render.h b/src/emu/render.h index edffd769607..34f5734a1de 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -163,11 +163,11 @@ constexpr u32 PRIMFLAG_PACKABLE = 1 << PRIMFLAG_PACKABLE_SHIFT; //************************************************************************** // forward definitions +namespace util { namespace xml { class data_node; } } class device_t; class screen_device; class render_container; class render_manager; -class xml_data_node; class render_font; struct object_transform; class layout_element; @@ -645,7 +645,7 @@ class layout_element public: // construction/destruction - layout_element(running_machine &machine, xml_data_node const &elemnode, const char *dirname); + layout_element(running_machine &machine, util::xml::data_node const &elemnode, const char *dirname); virtual ~layout_element(); // getters @@ -664,7 +664,7 @@ private: typedef std::unique_ptr ptr; // construction/destruction - component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); virtual ~component() = default; // setup @@ -704,7 +704,7 @@ private: { public: // construction/destruction - image_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + image_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -728,7 +728,7 @@ private: { public: // construction/destruction - rect_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + rect_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -740,7 +740,7 @@ private: { public: // construction/destruction - disk_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + disk_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -752,7 +752,7 @@ private: { public: // construction/destruction - text_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + text_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -769,7 +769,7 @@ private: { public: // construction/destruction - led7seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led7seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -782,7 +782,7 @@ private: { public: // construction/destruction - led8seg_gts1_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led8seg_gts1_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -795,7 +795,7 @@ private: { public: // construction/destruction - led14seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led14seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -808,7 +808,7 @@ private: { public: // construction/destruction - led16seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led16seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -821,7 +821,7 @@ private: { public: // construction/destruction - led14segsc_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led14segsc_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -834,7 +834,7 @@ private: { public: // construction/destruction - led16segsc_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + led16segsc_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -847,7 +847,7 @@ private: { public: // construction/destruction - dotmatrix_component(int dots, running_machine &machine, xml_data_node const &compnode, const char *dirname); + dotmatrix_component(int dots, running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -864,7 +864,7 @@ private: { public: // construction/destruction - simplecounter_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + simplecounter_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -885,7 +885,7 @@ private: public: // construction/destruction - reel_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + reel_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); protected: // overrides @@ -932,13 +932,13 @@ private: int m_state; // associated state number }; - typedef component::ptr (*make_component_func)(running_machine &machine, xml_data_node const &compnode, const char *dirname); + typedef component::ptr (*make_component_func)(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); typedef std::map make_component_map; // internal helpers static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); - template static component::ptr make_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); - template static component::ptr make_dotmatrix_component(running_machine &machine, xml_data_node const &compnode, const char *dirname); + template static component::ptr make_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); + template static component::ptr make_dotmatrix_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname); static make_component_map const s_make_component; // maps component XML names to creator functions @@ -969,7 +969,7 @@ public: public: // construction/destruction - item(running_machine &machine, xml_data_node const &itemnode, simple_list &elemlist); + item(running_machine &machine, util::xml::data_node const &itemnode, simple_list &elemlist); virtual ~item(); // getters @@ -1005,7 +1005,7 @@ public: }; // construction/destruction - layout_view(running_machine &machine, xml_data_node const &viewnode, simple_list &elemlist); + layout_view(running_machine &machine, util::xml::data_node const &viewnode, simple_list &elemlist); virtual ~layout_view(); // getters @@ -1058,7 +1058,7 @@ class layout_file public: // construction/destruction - layout_file(running_machine &machine, xml_data_node const &rootnode, const char *dirname); + layout_file(running_machine &machine, util::xml::data_node const &rootnode, const char *dirname); virtual ~layout_file(); // getters @@ -1171,8 +1171,8 @@ private: bool map_point_internal(s32 target_x, s32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask); // config callbacks - void config_load(xml_data_node const &targetnode); - bool config_save(xml_data_node &targetnode); + void config_load(util::xml::data_node const &targetnode); + bool config_save(util::xml::data_node &targetnode); // view lookups layout_view *view_by_index(int index) const; @@ -1277,8 +1277,8 @@ private: void container_free(render_container *container); // config callbacks - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); // internal state running_machine & m_machine; // reference back to the machine diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index b917b958063..5785f5f20b7 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -222,7 +222,7 @@ static int get_variable_value(running_machine &machine, const char *string, char // substitution //------------------------------------------------- -static const char *xml_get_attribute_string_with_subst(running_machine &machine, xml_data_node const &node, const char *attribute, const char *defvalue) +static const char *xml_get_attribute_string_with_subst(running_machine &machine, util::xml::data_node const &node, const char *attribute, const char *defvalue) { const char *str = node.get_attribute_string(attribute, nullptr); static char buffer[1000]; @@ -259,7 +259,7 @@ static const char *xml_get_attribute_string_with_subst(running_machine &machine, // substitution //------------------------------------------------- -static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_node const &node, const char *attribute, int defvalue) +static int xml_get_attribute_int_with_subst(running_machine &machine, util::xml::data_node const &node, const char *attribute, int defvalue) { const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, nullptr); int value; @@ -283,7 +283,7 @@ static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_n // substitution //------------------------------------------------- -static float xml_get_attribute_float_with_subst(running_machine &machine, xml_data_node const &node, const char *attribute, float defvalue) +static float xml_get_attribute_float_with_subst(running_machine &machine, util::xml::data_node const &node, const char *attribute, float defvalue) { const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, nullptr); float value; @@ -298,7 +298,7 @@ static float xml_get_attribute_float_with_subst(running_machine &machine, xml_da // parse_bounds - parse a bounds XML node //------------------------------------------------- -void parse_bounds(running_machine &machine, xml_data_node const *boundsnode, render_bounds &bounds) +void parse_bounds(running_machine &machine, util::xml::data_node const *boundsnode, render_bounds &bounds) { // skip if nothing if (boundsnode == nullptr) @@ -339,7 +339,7 @@ void parse_bounds(running_machine &machine, xml_data_node const *boundsnode, ren // parse_color - parse a color XML node //------------------------------------------------- -void parse_color(running_machine &machine, xml_data_node const *colornode, render_color &color) +void parse_color(running_machine &machine, util::xml::data_node const *colornode, render_color &color) { // skip if nothing if (colornode == nullptr) @@ -367,7 +367,7 @@ void parse_color(running_machine &machine, xml_data_node const *colornode, rende // node //------------------------------------------------- -static void parse_orientation(running_machine &machine, xml_data_node const *orientnode, int &orientation) +static void parse_orientation(running_machine &machine, util::xml::data_node const *orientnode, int &orientation) { // skip if nothing if (orientnode == nullptr) @@ -422,7 +422,7 @@ layout_element::make_component_map const layout_element::s_make_component{ // layout_element - constructor //------------------------------------------------- -layout_element::layout_element(running_machine &machine, xml_data_node const &elemnode, const char *dirname) +layout_element::layout_element(running_machine &machine, util::xml::data_node const &elemnode, const char *dirname) : m_next(nullptr), m_machine(machine), m_defstate(0), @@ -440,7 +440,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node const &el // parse components in order bool first = true; render_bounds bounds = { 0 }; - for (xml_data_node const *compnode = elemnode.get_first_child(); compnode; compnode = compnode->get_next_sibling()) + for (util::xml::data_node const *compnode = elemnode.get_first_child(); compnode; compnode = compnode->get_next_sibling()) { make_component_map::const_iterator const make_func(s_make_component.find(compnode->get_name())); if (make_func == s_make_component.end()) @@ -539,7 +539,7 @@ void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, c //------------------------------------------------- template -layout_element::component::ptr layout_element::make_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::component::ptr layout_element::make_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) { return std::make_unique(machine, compnode, dirname); } @@ -551,7 +551,7 @@ layout_element::component::ptr layout_element::make_component(running_machine &m //------------------------------------------------- template -layout_element::component::ptr layout_element::make_dotmatrix_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::component::ptr layout_element::make_dotmatrix_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) { return std::make_unique(D, machine, compnode, dirname); } @@ -614,7 +614,7 @@ layout_element::texture &layout_element::texture::operator=(texture &&that) // component - constructor //------------------------------------------------- -layout_element::component::component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::component::component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : m_state(0) { // fetch common data @@ -641,7 +641,7 @@ void layout_element::component::normalize_bounds(float xoffs, float yoffs, float // image_component - constructor //------------------------------------------------- -layout_element::image_component::image_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::image_component::image_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) , m_hasalpha(false) { @@ -709,7 +709,7 @@ void layout_element::image_component::load_bitmap() // text_component - constructor //------------------------------------------------- -layout_element::text_component::text_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::text_component::text_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", ""); @@ -733,7 +733,7 @@ void layout_element::text_component::draw(running_machine &machine, bitmap_argb3 // dotmatrix_component - constructor //------------------------------------------------- -layout_element::dotmatrix_component::dotmatrix_component(int dots, running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::dotmatrix_component::dotmatrix_component(int dots, running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname), m_dots(dots) { @@ -769,7 +769,7 @@ void layout_element::dotmatrix_component::draw(running_machine &machine, bitmap_ // simplecounter_component - constructor //------------------------------------------------- -layout_element::simplecounter_component::simplecounter_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::simplecounter_component::simplecounter_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2); @@ -795,7 +795,7 @@ void layout_element::simplecounter_component::draw(running_machine &machine, bit // reel_component - constructor //------------------------------------------------- -layout_element::reel_component::reel_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::reel_component::reel_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { for (auto & elem : m_hasalpha) @@ -1203,7 +1203,7 @@ void layout_element::reel_component::load_reel_bitmap(int number) // led7seg_component - constructor //------------------------------------------------- -layout_element::led7seg_component::led7seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led7seg_component::led7seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1264,7 +1264,7 @@ void layout_element::led7seg_component::draw(running_machine &machine, bitmap_ar // led8seg_gts1_component - constructor //------------------------------------------------- -layout_element::led8seg_gts1_component::led8seg_gts1_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led8seg_gts1_component::led8seg_gts1_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1331,7 +1331,7 @@ void layout_element::led8seg_gts1_component::draw(running_machine &machine, bitm // led14seg_component - constructor //------------------------------------------------- -layout_element::led14seg_component::led14seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led14seg_component::led14seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1442,7 +1442,7 @@ void layout_element::led14seg_component::draw(running_machine &machine, bitmap_a // led14segsc_component - constructor //------------------------------------------------- -layout_element::led14segsc_component::led14segsc_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led14segsc_component::led14segsc_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1562,7 +1562,7 @@ void layout_element::led14segsc_component::draw(running_machine &machine, bitmap // led16seg_component - constructor //------------------------------------------------- -layout_element::led16seg_component::led16seg_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led16seg_component::led16seg_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1683,7 +1683,7 @@ void layout_element::led16seg_component::draw(running_machine &machine, bitmap_a // led16segsc_component - constructor //------------------------------------------------- -layout_element::led16segsc_component::led16segsc_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::led16segsc_component::led16segsc_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1813,7 +1813,7 @@ void layout_element::led16segsc_component::draw(running_machine &machine, bitmap // rect_component - constructor //------------------------------------------------- -layout_element::rect_component::rect_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::rect_component::rect_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -1859,7 +1859,7 @@ void layout_element::rect_component::draw(running_machine &machine, bitmap_argb3 // disk_component - constructor //------------------------------------------------- -layout_element::disk_component::disk_component(running_machine &machine, xml_data_node const &compnode, const char *dirname) +layout_element::disk_component::disk_component(running_machine &machine, util::xml::data_node const &compnode, const char *dirname) : component(machine, compnode, dirname) { } @@ -2213,7 +2213,7 @@ const simple_list layout_view::s_null_list; // layout_view - constructor //------------------------------------------------- -layout_view::layout_view(running_machine &machine, xml_data_node const &viewnode, simple_list &elemlist) +layout_view::layout_view(running_machine &machine, util::xml::data_node const &viewnode, simple_list &elemlist) : m_next(nullptr) , m_aspect(1.0f) , m_scraspect(1.0f) @@ -2222,33 +2222,33 @@ layout_view::layout_view(running_machine &machine, xml_data_node const &viewnode m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", ""); // if we have a bounds item, load it - xml_data_node const *const boundsnode = viewnode.get_child("bounds"); + util::xml::data_node const *const boundsnode = viewnode.get_child("bounds"); m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0; if (boundsnode != nullptr) parse_bounds(machine, boundsnode, m_expbounds); // load backdrop items - for (xml_data_node const *itemnode = viewnode.get_child("backdrop"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("backdrop")) + for (util::xml::data_node const *itemnode = viewnode.get_child("backdrop"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("backdrop")) m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // load screen items - for (xml_data_node const *itemnode = viewnode.get_child("screen"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("screen")) + for (util::xml::data_node const *itemnode = viewnode.get_child("screen"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("screen")) m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // load overlay items - for (xml_data_node const *itemnode = viewnode.get_child("overlay"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("overlay")) + for (util::xml::data_node const *itemnode = viewnode.get_child("overlay"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("overlay")) m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // load bezel items - for (xml_data_node const *itemnode = viewnode.get_child("bezel"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("bezel")) + for (util::xml::data_node const *itemnode = viewnode.get_child("bezel"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("bezel")) m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // load cpanel items - for (xml_data_node const *itemnode = viewnode.get_child("cpanel"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("cpanel")) + for (util::xml::data_node const *itemnode = viewnode.get_child("cpanel"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("cpanel")) m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // load marquee items - for (xml_data_node const *itemnode = viewnode.get_child("marquee"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("marquee")) + for (util::xml::data_node const *itemnode = viewnode.get_child("marquee"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("marquee")) m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist))); // recompute the data for the view based on a default layer config @@ -2410,7 +2410,7 @@ void layout_view::resolve_tags() // item - constructor //------------------------------------------------- -layout_view::item::item(running_machine &machine, xml_data_node const &itemnode, simple_list &elemlist) +layout_view::item::item(running_machine &machine, util::xml::data_node const &itemnode, simple_list &elemlist) : m_next(nullptr) , m_element(nullptr) , m_input_port(nullptr) @@ -2542,11 +2542,11 @@ void layout_view::item::resolve_tags() // layout_file - constructor //------------------------------------------------- -layout_file::layout_file(running_machine &machine, xml_data_node const &rootnode, const char *dirname) +layout_file::layout_file(running_machine &machine, util::xml::data_node const &rootnode, const char *dirname) : m_next(nullptr) { // find the layout node - xml_data_node const *const mamelayoutnode = rootnode.get_child("mamelayout"); + util::xml::data_node const *const mamelayoutnode = rootnode.get_child("mamelayout"); if (mamelayoutnode == nullptr) throw emu_fatalerror("Invalid XML file: missing mamelayout node"); @@ -2556,11 +2556,11 @@ layout_file::layout_file(running_machine &machine, xml_data_node const &rootnode throw emu_fatalerror("Invalid XML file: unsupported version"); // parse all the elements - for (xml_data_node const *elemnode = mamelayoutnode->get_child("element"); elemnode != nullptr; elemnode = elemnode->get_next_sibling("element")) + for (util::xml::data_node const *elemnode = mamelayoutnode->get_child("element"); elemnode != nullptr; elemnode = elemnode->get_next_sibling("element")) m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname))); // parse all the views - for (xml_data_node const *viewnode = mamelayoutnode->get_child("view"); viewnode != nullptr; viewnode = viewnode->get_next_sibling("view")) + for (util::xml::data_node const *viewnode = mamelayoutnode->get_child("view"); viewnode != nullptr; viewnode = viewnode->get_next_sibling("view")) m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist))); } diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index d22ee998f7a..1f3373caf0b 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -835,7 +835,7 @@ sound_manager::sound_manager(running_machine &machine) #endif // register callbacks - machine.configuration().config_register("mixer", config_saveload_delegate(&sound_manager::config_load, this), config_saveload_delegate(&sound_manager::config_save, this)); + machine.configuration().config_register("mixer", config_load_delegate(&sound_manager::config_load, this), config_save_delegate(&sound_manager::config_save, this)); machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(&sound_manager::pause, this)); machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(&sound_manager::resume, this)); machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&sound_manager::reset, this)); @@ -988,10 +988,10 @@ void sound_manager::resume() // configuration file //------------------------------------------------- -void sound_manager::config_load(config_type cfg_type, xml_data_node *parentnode) +void sound_manager::config_load(config_type cfg_type, util::xml::data_node const *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // might not have any data @@ -999,7 +999,7 @@ void sound_manager::config_load(config_type cfg_type, xml_data_node *parentnode) return; // iterate over channel nodes - for (xml_data_node const *channelnode = parentnode->get_child("channel"); channelnode != nullptr; channelnode = channelnode->get_next_sibling("channel")) + for (util::xml::data_node const *channelnode = parentnode->get_child("channel"); channelnode != nullptr; channelnode = channelnode->get_next_sibling("channel")) { mixer_input info; if (indexed_mixer_input(channelnode->get_attribute_int("index", -1), info)) @@ -1018,10 +1018,10 @@ void sound_manager::config_load(config_type cfg_type, xml_data_node *parentnode) // file //------------------------------------------------- -void sound_manager::config_save(config_type cfg_type, xml_data_node *parentnode) +void sound_manager::config_save(config_type cfg_type, util::xml::data_node *parentnode) { // we only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // iterate over mixer channels @@ -1035,7 +1035,7 @@ void sound_manager::config_save(config_type cfg_type, xml_data_node *parentnode) if (newvol != 1.0f) { - xml_data_node *const channelnode = parentnode->add_child("channel", nullptr); + util::xml::data_node *const channelnode = parentnode->add_child("channel", nullptr); if (channelnode != nullptr) { channelnode->set_attribute_int("index", mixernum); diff --git a/src/emu/sound.h b/src/emu/sound.h index d9b9a61b830..8cb4c725e6b 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -223,8 +223,8 @@ private: void reset(); void pause(); void resume(); - void config_load(config_type cfg_type, xml_data_node *parentnode); - void config_save(config_type cfg_type, xml_data_node *parentnode); + void config_load(config_type cfg_type, util::xml::data_node const *parentnode); + void config_save(config_type cfg_type, util::xml::data_node *parentnode); void update(void *ptr = nullptr, s32 param = 0); diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 3c2b2e1844b..2c758ed1020 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -108,16 +108,16 @@ inline std::string number_and_format::format() const switch (m_format) { default: - case xml_data_node::int_format::DECIMAL: + case util::xml::data_node::int_format::DECIMAL: return string_format("%d", uint32_t(m_value)); - case xml_data_node::int_format::DECIMAL_HASH: + case util::xml::data_node::int_format::DECIMAL_HASH: return string_format("#%d", uint32_t(m_value)); - case xml_data_node::int_format::HEX_DOLLAR: + case util::xml::data_node::int_format::HEX_DOLLAR: return string_format("$%X", uint32_t(m_value)); - case xml_data_node::int_format::HEX_C: + case util::xml::data_node::int_format::HEX_C: return string_format("0x%X", uint32_t(m_value)); } } @@ -132,7 +132,7 @@ inline std::string number_and_format::format() const // cheat_parameter - constructor //------------------------------------------------- -cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const ¶mnode) +cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const ¶mnode) : m_value(0) { // read the core attributes @@ -141,7 +141,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, m_stepval = number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step")); // iterate over items - for (xml_data_node const *itemnode = paramnode.get_child("item"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("item")) + for (util::xml::data_node const *itemnode = paramnode.get_child("item"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("item")) { // check for nullptr text if (itemnode->get_value() == nullptr || itemnode->get_value()[0] == 0) @@ -153,7 +153,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, // extract the parameters uint64_t const value = itemnode->get_attribute_int("value", 0); - xml_data_node::int_format const format = itemnode->get_attribute_int_format("value"); + util::xml::data_node::int_format const format = itemnode->get_attribute_int_format("value"); // allocate and append a new item auto curitem = std::make_unique(itemnode->get_value(), value, format); @@ -317,7 +317,7 @@ bool cheat_parameter::set_next_state() // cheat_script - constructor //------------------------------------------------- -cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &scriptnode) +cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode) : m_state(SCRIPT_STATE_RUN) { // read the core attributes @@ -332,7 +332,7 @@ cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const throw emu_fatalerror("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode.line, state); // iterate over nodes within the script - for (xml_data_node const *entrynode = scriptnode.get_first_child(); entrynode != nullptr; entrynode = entrynode->get_next_sibling()) + for (util::xml::data_node const *entrynode = scriptnode.get_first_child(); entrynode != nullptr; entrynode = entrynode->get_next_sibling()) { // handle action nodes if (strcmp(entrynode->get_name(), "action") == 0) @@ -399,7 +399,7 @@ void cheat_script::save(emu_file &cheatfile) const // script_entry - constructor //------------------------------------------------- -cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &entrynode, bool isaction) +cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction) : m_condition(&symbols), m_expression(&symbols) { @@ -442,7 +442,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s // then parse arguments int totalargs = 0; - for (xml_data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument")) + for (util::xml::data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument")) { auto curarg = std::make_unique(manager, symbols, filename, *argnode); // verify we didn't overrun the argument count @@ -608,7 +608,7 @@ void cheat_script::script_entry::validate_format(const char *filename, int line) // output_argument - constructor //------------------------------------------------- -cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &argnode) +cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode) : m_expression(&symbols), m_count(0) { @@ -676,7 +676,7 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons // cheat_entry - constructor //------------------------------------------------- -cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node const &cheatnode) +cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode) : m_manager(manager) , m_symbols(&manager.machine(), &globaltable) , m_state(SCRIPT_STATE_OFF) @@ -707,7 +707,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons } // read the first comment node - xml_data_node const *commentnode = cheatnode.get_child("comment"); + util::xml::data_node const *commentnode = cheatnode.get_child("comment"); if (commentnode != nullptr) { // set the value if not nullptr @@ -721,7 +721,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons } // read the first parameter node - xml_data_node const *paramnode = cheatnode.get_child("parameter"); + util::xml::data_node const *paramnode = cheatnode.get_child("parameter"); if (paramnode != nullptr) { // load this parameter @@ -734,7 +734,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons } // read the script nodes - for (xml_data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script")) + for (util::xml::data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script")) { // load this entry auto curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode)); @@ -1397,17 +1397,17 @@ void cheat_manager::load_cheats(const char *filename) osd_printf_verbose("Loading cheats file from %s\n", cheatfile.fullpath()); // read the XML file into internal data structures - xml_parse_options options = { nullptr }; - xml_parse_error error; + util::xml::parse_options options = { nullptr }; + util::xml::parse_error error; options.error = &error; - std::unique_ptr rootnode(xml_data_node::file_read(cheatfile, &options), [] (xml_data_node *node) { node->file_free(); }); + std::unique_ptr rootnode(util::xml::data_node::file_read(cheatfile, &options), [] (util::xml::data_node *node) { node->file_free(); }); // if unable to parse the file, just bail if (rootnode == nullptr) throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message); // find the layout node - xml_data_node *mamecheatnode = rootnode->get_child("mamecheat"); + util::xml::data_node const *const mamecheatnode = rootnode->get_child("mamecheat"); if (mamecheatnode == nullptr) throw emu_fatalerror("%s.xml: missing mamecheatnode node", filename); @@ -1417,7 +1417,7 @@ void cheat_manager::load_cheats(const char *filename) throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line); // parse all the elements - for (xml_data_node const *cheatnode = mamecheatnode->get_child("cheat"); cheatnode != nullptr; cheatnode = cheatnode->get_next_sibling("cheat")) + for (util::xml::data_node const *cheatnode = mamecheatnode->get_child("cheat"); cheatnode != nullptr; cheatnode = cheatnode->get_next_sibling("cheat")) { // load this entry auto curcheat = std::make_unique(*this, m_symtable, filename, *cheatnode); diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h index bc983c160f1..eaba3650e7e 100644 --- a/src/frontend/mame/cheat.h +++ b/src/frontend/mame/cheat.h @@ -50,7 +50,7 @@ class number_and_format { public: // construction/destruction - number_and_format(uint64_t value = 0, xml_data_node::int_format format = xml_data_node::int_format::DECIMAL) + number_and_format(uint64_t value = 0, util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL) : m_value(value) , m_format(format) { @@ -65,8 +65,8 @@ public: private: // internal state - uint64_t m_value; - xml_data_node::int_format m_format; + uint64_t m_value; + util::xml::data_node::int_format m_format; }; @@ -77,7 +77,7 @@ class cheat_parameter { public: // construction/destruction - cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const ¶mnode); + cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const ¶mnode); // queries const char *text(); @@ -99,7 +99,7 @@ private: { public: // construction/destruction - item(const char *text, uint64_t value, xml_data_node::int_format valformat) + item(const char *text, uint64_t value, util::xml::data_node::int_format valformat) : m_text(text) , m_value(value, valformat) { } @@ -131,7 +131,7 @@ class cheat_script { public: // construction/destruction - cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &scriptnode); + cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode); // getters script_state state() const { return m_state; } @@ -146,7 +146,7 @@ private: { public: // construction/destruction - script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &entrynode, bool isaction); + script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction); // actions void execute(cheat_manager &manager, uint64_t &argindex); @@ -158,7 +158,7 @@ private: { public: // construction/destruction - output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &argnode); + output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode); // getters int count() const { return m_count; } @@ -201,7 +201,7 @@ class cheat_entry { public: // construction/destruction - cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node const &cheatnode); + cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode); ~cheat_entry(); // getters diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 40775af09c9..ff7e371c438 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -1101,7 +1101,7 @@ void cli_frontend::verifysamples(const char *gamename) void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev) { - fprintf(out, "\t\n", swlistdev.list_name().c_str(), xml_normalize_string(swlistdev.description().c_str())); + fprintf(out, "\t\n", swlistdev.list_name().c_str(), util::xml::normalize_string(swlistdev.description().c_str())); for (const software_info &swinfo : swlistdev.get_info()) { fprintf(out, "\t\t\n" ); - fprintf(out, "\t\t\t%s\n", xml_normalize_string(swinfo.longname().c_str())); - fprintf(out, "\t\t\t%s\n", xml_normalize_string(swinfo.year().c_str())); - fprintf(out, "\t\t\t%s\n", xml_normalize_string(swinfo.publisher().c_str())); + fprintf(out, "\t\t\t%s\n", util::xml::normalize_string(swinfo.longname().c_str())); + fprintf(out, "\t\t\t%s\n", util::xml::normalize_string(swinfo.year().c_str())); + fprintf(out, "\t\t\t%s\n", util::xml::normalize_string(swinfo.publisher().c_str())); for (const feature_list_item &flist : swinfo.other_info()) - fprintf( out, "\t\t\t\n", flist.name().c_str(), xml_normalize_string( flist.value().c_str()) ); + fprintf( out, "\t\t\t\n", flist.name().c_str(), util::xml::normalize_string( flist.value().c_str()) ); for (const software_part &part : swinfo.parts()) { @@ -1128,7 +1128,7 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis fprintf(out, ">\n"); for (const feature_list_item &flist : part.featurelist()) - fprintf(out, "\t\t\t\t\n", flist.name().c_str(), xml_normalize_string(flist.value().c_str())); + fprintf(out, "\t\t\t\t\n", flist.name().c_str(), util::xml::normalize_string(flist.value().c_str())); /* TODO: display rom region information */ for (const rom_entry *region = part.romdata().data(); region; region = rom_next_region(region)) @@ -1145,9 +1145,9 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis if ( ROMENTRY_ISFILE(rom) ) { if (!is_disk) - fprintf( out, "\t\t\t\t\t\n", XML_ROOT, - xml_normalize_string(emulator_info::get_build_version()), + util::xml::normalize_string(emulator_info::get_build_version()), CONFIG_VERSION ); @@ -283,7 +283,7 @@ void info_xml_creator::output_one() // print the header and the game name fprintf(m_output, "\t<%s",XML_TOP); - fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name)); + fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(driver.name)); // strip away any path information from the source_file and output it const char *start = strrchr(driver.source_file, '/'); @@ -291,7 +291,7 @@ void info_xml_creator::output_one() start = strrchr(driver.source_file, '\\'); if (start == nullptr) start = driver.source_file - 1; - fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(start + 1)); + fprintf(m_output, " sourcefile=\"%s\"", util::xml::normalize_string(start + 1)); // append bios and runnable flags if (driver.flags & MACHINE_IS_BIOS_ROOT) @@ -304,9 +304,9 @@ void info_xml_creator::output_one() // display clone information int clone_of = m_drivlist.find(driver.parent); if (clone_of != -1 && !(m_drivlist.driver(clone_of).flags & MACHINE_IS_BIOS_ROOT)) - fprintf(m_output, " cloneof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name)); + fprintf(m_output, " cloneof=\"%s\"", util::xml::normalize_string(m_drivlist.driver(clone_of).name)); if (clone_of != -1) - fprintf(m_output, " romof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name)); + fprintf(m_output, " romof=\"%s\"", util::xml::normalize_string(m_drivlist.driver(clone_of).name)); // display sample information and close the game tag output_sampleof(); @@ -314,15 +314,15 @@ void info_xml_creator::output_one() // output game description if (driver.description != nullptr) - fprintf(m_output, "\t\t%s\n", xml_normalize_string(driver.description)); + fprintf(m_output, "\t\t%s\n", util::xml::normalize_string(driver.description)); // print the year only if is a number or another allowed character (? or +) if (driver.year != nullptr && strspn(driver.year, "0123456789?+") == strlen(driver.year)) - fprintf(m_output, "\t\t%s\n", xml_normalize_string(driver.year)); + fprintf(m_output, "\t\t%s\n", util::xml::normalize_string(driver.year)); // print the manufacturer information if (driver.manufacturer != nullptr) - fprintf(m_output, "\t\t%s\n", xml_normalize_string(driver.manufacturer)); + fprintf(m_output, "\t\t%s\n", util::xml::normalize_string(driver.manufacturer)); // now print various additional information output_bios(); @@ -376,15 +376,15 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) // start to output info fprintf(m_output, "\t<%s", XML_TOP); - fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); + fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(device.shortname())); std::string src(device.source()); strreplace(src,"../", ""); - fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.c_str())); + fprintf(m_output, " sourcefile=\"%s\"", util::xml::normalize_string(src.c_str())); fprintf(m_output, " isdevice=\"yes\""); fprintf(m_output, " runnable=\"no\""); output_sampleof(); fprintf(m_output, ">\n"); - fprintf(m_output, "\t\t%s\n", xml_normalize_string(device.name())); + fprintf(m_output, "\t\t%s\n", util::xml::normalize_string(device.name())); output_rom(device); @@ -478,7 +478,7 @@ void info_xml_creator::output_device_roms() { for (device_t &device : device_iterator(m_drivlist.config().root_device())) if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0] != '\0') - fprintf(m_output, "\t\t\n", xml_normalize_string(device.shortname())); + fprintf(m_output, "\t\t\n", util::xml::normalize_string(device.shortname())); } @@ -495,7 +495,7 @@ void info_xml_creator::output_sampleof() samples_iterator sampiter(device); if (sampiter.altbasename() != nullptr) { - fprintf(m_output, " sampleof=\"%s\"", xml_normalize_string(sampiter.altbasename())); + fprintf(m_output, " sampleof=\"%s\"", util::xml::normalize_string(sampiter.altbasename())); // must stop here, as there can only be one attribute of the same name return; @@ -529,8 +529,8 @@ void info_xml_creator::output_bios() { // output extracted name and descriptions fprintf(m_output, "\t\t\n"); @@ -597,11 +597,11 @@ void info_xml_creator::output_rom(device_t &device) // add name, merge, bios, and size tags */ if (name != nullptr && name[0] != 0) - util::stream_format(output, " name=\"%s\"", xml_normalize_string(name)); + util::stream_format(output, " name=\"%s\"", util::xml::normalize_string(name)); if (merge_name != nullptr) - util::stream_format(output, " merge=\"%s\"", xml_normalize_string(merge_name)); + util::stream_format(output, " merge=\"%s\"", util::xml::normalize_string(merge_name)); if (bios_name[0] != 0) - util::stream_format(output, " bios=\"%s\"", xml_normalize_string(bios_name)); + util::stream_format(output, " bios=\"%s\"", util::xml::normalize_string(bios_name)); if (!is_disk) util::stream_format(output, " size=\"%d\"", rom_file_size(rom)); @@ -659,7 +659,7 @@ void info_xml_creator::output_sample(device_t &device) continue; // output the sample name - fprintf(m_output, "\t\t\n", xml_normalize_string(samplename)); + fprintf(m_output, "\t\t\n", util::xml::normalize_string(samplename)); } } } @@ -682,8 +682,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag) fprintf(m_output, "\t\t\n"); } @@ -699,8 +699,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag) fprintf(m_output, "\t\t\n"); @@ -725,7 +725,7 @@ void info_xml_creator::output_display(device_t &device, const char *root_tag) newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); fprintf(m_output, "\t\t 1) fprintf(m_output, " player=\"%d\"", elem.player); if (elem.nbuttons > 0) @@ -1259,7 +1259,7 @@ void info_xml_creator::output_input(const ioport_list &portlist) if (elem.helper[0] == 0 && elem.helper[1] != 0) { elem.helper[0] = elem.helper[1]; elem.helper[1] = 0; } if (elem.helper[1] == 0 && elem.helper[2] != 0) { elem.helper[1] = elem.helper[2]; elem.helper[2] = 0; } const char *joys = (elem.helper[2] != 0) ? "triple" : (elem.helper[1] != 0) ? "double" : ""; - fprintf(m_output, "\t\t\t 1) fprintf(m_output, " player=\"%d\"", elem.player); if (elem.nbuttons > 0) @@ -1329,14 +1329,14 @@ void info_xml_creator::output_switches(const ioport_list &portlist, const char * newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); // output the switch name information - std::string normalized_field_name(xml_normalize_string(field.name())); - std::string normalized_newtag(xml_normalize_string(newtag.c_str())); + std::string normalized_field_name(util::xml::normalize_string(field.name())); + std::string normalized_newtag(util::xml::normalize_string(newtag.c_str())); util::stream_format(output,"\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.c_str(), normalized_newtag.c_str(), field.mask()); // loop over settings for (ioport_setting &setting : field.settings()) { - util::stream_format(output,"\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting.name()), setting.value(), setting.value() == field.defvalue() ? " default=\"yes\"" : ""); + util::stream_format(output,"\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, util::xml::normalize_string(setting.name()), setting.value(), setting.value() == field.defvalue() ? " default=\"yes\"" : ""); } // terminate the switch entry @@ -1355,7 +1355,7 @@ void info_xml_creator::output_ports(const ioport_list &portlist) // cycle through ports for (auto &port : portlist) { - fprintf(m_output,"\t\t\n", xml_normalize_string(port.second->tag())); + fprintf(m_output,"\t\t\n", util::xml::normalize_string(port.second->tag())); for (ioport_field &field : port.second->fields()) { if(field.is_analog()) @@ -1378,7 +1378,7 @@ void info_xml_creator::output_adjusters(const ioport_list &portlist) for (auto &port : portlist) for (ioport_field &field : port.second->fields()) if (field.type() == IPT_ADJUSTER) - fprintf(m_output, "\t\t\n", xml_normalize_string(field.name()), field.defvalue()); + fprintf(m_output, "\t\t\n", util::xml::normalize_string(field.name()), field.defvalue()); } @@ -1460,11 +1460,11 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag) newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); // print m_output device type - fprintf(m_output, "\t\t\n"); @@ -1486,8 +1486,8 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag) const char *shortname = imagedev.brief_instance_name(); fprintf(m_output, "\t\t\t\n"); std::string extensions(imagedev.file_extensions()); @@ -1496,7 +1496,7 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag) while (ext != nullptr) { fprintf(m_output, "\t\t\t\n"); ext = strtok(nullptr, ","); } @@ -1523,11 +1523,11 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); // print m_output device type - fprintf(m_output, "\t\t\n", xml_normalize_string(newtag.c_str())); + fprintf(m_output, "\t\t\n", util::xml::normalize_string(newtag.c_str())); /* if (slot.slot_interface()[0]) - fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot.slot_interface())); + fprintf(m_output, " interface=\"%s\"", util::xml::normalize_string(slot.slot_interface())); */ for (auto &option : slot.option_list()) @@ -1539,8 +1539,8 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) dev->config_complete(); fprintf(m_output, "\t\t\tname())); - fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname())); + fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(option.second->name())); + fprintf(m_output, " devname=\"%s\"", util::xml::normalize_string(dev->shortname())); if (slot.default_option() != nullptr && strcmp(slot.default_option(), option.second->name())==0) fprintf(m_output, " default=\"yes\""); fprintf(m_output, "/>\n"); diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp index 197194ceb3b..31d8fb447e0 100644 --- a/src/frontend/mame/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -339,12 +339,12 @@ bool emulator_info::frame_hook() return mame_machine_manager::instance()->lua()->frame_hook(); } -void emulator_info::layout_file_cb(xml_data_node &layout) +void emulator_info::layout_file_cb(util::xml::data_node &layout) { - xml_data_node const *const mamelayout = layout.get_child("mamelayout"); + util::xml::data_node const *const mamelayout = layout.get_child("mamelayout"); if (mamelayout) { - xml_data_node const *const script = mamelayout->get_child("script"); + util::xml::data_node const *const script = mamelayout->get_child("script"); if(script) mame_machine_manager::instance()->lua()->call_plugin_set("layout", script->get_value()); } diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index 458f3028e76..5a6e2d7a741 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -20,6 +20,8 @@ #include +namespace util { namespace xml { + /*************************************************************************** CONSTANTS ***************************************************************************/ @@ -32,12 +34,12 @@ TYPE DEFINITIONS ***************************************************************************/ -struct xml_parse_info +struct parse_info { - XML_Parser parser; - xml_data_node * rootnode; - xml_data_node * curnode; - uint32_t flags; + XML_Parser parser; + data_node * rootnode; + data_node * curnode; + uint32_t flags; }; @@ -47,7 +49,7 @@ struct xml_parse_info ***************************************************************************/ /* expat interfaces */ -static bool expat_setup_parser(xml_parse_info &info, xml_parse_options const *opts); +static bool expat_setup_parser(parse_info &info, parse_options const *opts); static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes); static void expat_data(void *data, const XML_Char *s, int len); static void expat_element_end(void *data, const XML_Char *name); @@ -59,25 +61,25 @@ static void expat_element_end(void *data, const XML_Char *name); ***************************************************************************/ /*------------------------------------------------- - xml_file_create - create a new xml file + file_create - create a new xml file object -------------------------------------------------*/ -xml_data_node *xml_data_node::file_create() +data_node *data_node::file_create() { - try { return new xml_data_node(); } + try { return new data_node(); } catch (...) { return nullptr; } } /*------------------------------------------------- - xml_file_read - parse an XML file into its + file_read - parse an XML file into its nodes -------------------------------------------------*/ -xml_data_node *xml_data_node::file_read(util::core_file &file, xml_parse_options const *opts) +data_node *data_node::file_read(util::core_file &file, parse_options const *opts) { - xml_parse_info info; + parse_info info; int done; /* set up the parser */ @@ -119,13 +121,13 @@ xml_data_node *xml_data_node::file_read(util::core_file &file, xml_parse_options /*------------------------------------------------- - xml_string_read - parse an XML string into its + string_read - parse an XML string into its nodes -------------------------------------------------*/ -xml_data_node *xml_data_node::string_read(const char *string, xml_parse_options const *opts) +data_node *data_node::string_read(const char *string, parse_options const *opts) { - xml_parse_info info; + parse_info info; int length = (int)strlen(string); /* set up the parser */ @@ -156,10 +158,10 @@ xml_data_node *xml_data_node::string_read(const char *string, xml_parse_options /*------------------------------------------------- - xml_file_write - write an XML tree to a file + file_write - write an XML tree to a file -------------------------------------------------*/ -void xml_data_node::file_write(util::core_file &file) const +void data_node::file_write(util::core_file &file) const { /* ensure this is a root node */ if (get_name()) @@ -170,16 +172,16 @@ void xml_data_node::file_write(util::core_file &file) const file.printf("\n"); /* loop over children of the root and output */ - for (xml_data_node const *node = get_first_child(); node; node = node->get_next_sibling()) + for (data_node const *node = get_first_child(); node; node = node->get_next_sibling()) node->write_recursive(0, file); } /*------------------------------------------------- - xml_file_free - free an XML file object + file_free - free an XML file object -------------------------------------------------*/ -void xml_data_node::file_free() +void data_node::file_free() { /* ensure this is a root node */ if (get_name()) @@ -194,7 +196,7 @@ void xml_data_node::file_free() XML NODE MANAGEMENT ***************************************************************************/ -xml_data_node::xml_data_node() +data_node::data_node() : line(0) , m_next(nullptr) , m_first_child(nullptr) @@ -205,7 +207,7 @@ xml_data_node::xml_data_node() { } -xml_data_node::xml_data_node(xml_data_node *parent, const char *name, const char *value) +data_node::data_node(data_node *parent, const char *name, const char *value) : line(0) , m_next(nullptr) , m_first_child(nullptr) @@ -223,10 +225,10 @@ xml_data_node::xml_data_node(xml_data_node *parent, const char *name, const char the data allocated to an XML node -------------------------------------------------*/ -xml_data_node::~xml_data_node() +data_node::~data_node() { /* free the children */ - for (xml_data_node *nchild = nullptr; m_first_child; m_first_child = nchild) + for (data_node *nchild = nullptr; m_first_child; m_first_child = nchild) { /* note the next node and free this node */ nchild = m_first_child->get_next_sibling(); @@ -235,19 +237,19 @@ xml_data_node::~xml_data_node() } -void xml_data_node::set_value(char const *value) +void data_node::set_value(char const *value) { m_value.assign(value ? value : ""); } -void xml_data_node::append_value(char const *value, int length) +void data_node::append_value(char const *value, int length) { m_value.append(value, length); } -void xml_data_node::trim_whitespace() +void data_node::trim_whitespace() { /* first strip leading spaces */ std::string::iterator start = m_value.begin(); @@ -264,99 +266,99 @@ void xml_data_node::trim_whitespace() /*------------------------------------------------- - xml_data_node::count_children - count the + data_node::count_children - count the number of child nodes -------------------------------------------------*/ -int xml_data_node::count_children() const +int data_node::count_children() const { int count = 0; /* loop over children and count */ - for (xml_data_node const *node = get_first_child(); node; node = node->get_next_sibling()) + for (data_node const *node = get_first_child(); node; node = node->get_next_sibling()) count++; return count; } /*------------------------------------------------- - xml_data_node::get_child - find the first + data_node::get_child - find the first child of the specified node with the specified tag -------------------------------------------------*/ -xml_data_node *xml_data_node::get_child(const char *name) +data_node *data_node::get_child(const char *name) { return m_first_child ? m_first_child->get_sibling(name) : nullptr; } -xml_data_node const *xml_data_node::get_child(const char *name) const +data_node const *data_node::get_child(const char *name) const { return m_first_child ? m_first_child->get_sibling(name) : nullptr; } /*------------------------------------------------- - xml_find_first_matching_child - find the first + find_first_matching_child - find the first child of the specified node with the specified tag or attribute/value pair -------------------------------------------------*/ -xml_data_node *xml_data_node::find_first_matching_child(const char *name, const char *attribute, const char *matchval) +data_node *data_node::find_first_matching_child(const char *name, const char *attribute, const char *matchval) { return m_first_child ? m_first_child->find_matching_sibling(name, attribute, matchval) : nullptr; } -xml_data_node const *xml_data_node::find_first_matching_child(const char *name, const char *attribute, const char *matchval) const +data_node const *data_node::find_first_matching_child(const char *name, const char *attribute, const char *matchval) const { return m_first_child ? m_first_child->find_matching_sibling(name, attribute, matchval) : nullptr; } /*------------------------------------------------- - xml_data_node::get_next_sibling - find the + data_node::get_next_sibling - find the next sibling of the specified node with the specified tag -------------------------------------------------*/ -xml_data_node *xml_data_node::get_next_sibling(const char *name) +data_node *data_node::get_next_sibling(const char *name) { return m_next ? m_next->get_sibling(name) : nullptr; } -xml_data_node const *xml_data_node::get_next_sibling(const char *name) const +data_node const *data_node::get_next_sibling(const char *name) const { return m_next ? m_next->get_sibling(name) : nullptr; } /*------------------------------------------------- - xml_find_next_matching_sibling - find the next + find_next_matching_sibling - find the next sibling of the specified node with the specified tag or attribute/value pair -------------------------------------------------*/ -xml_data_node *xml_data_node::find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) +data_node *data_node::find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) { return m_next ? m_next->find_matching_sibling(name, attribute, matchval) : nullptr; } -xml_data_node const *xml_data_node::find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) const +data_node const *data_node::find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) const { return m_next ? m_next->find_matching_sibling(name, attribute, matchval) : nullptr; } /*------------------------------------------------- - xml_add_child - add a new child node to the + add_child - add a new child node to the given node -------------------------------------------------*/ -xml_data_node *xml_data_node::add_child(const char *name, const char *value) +data_node *data_node::add_child(const char *name, const char *value) { /* new element: create a new node */ - xml_data_node *node; - try { node = new xml_data_node(this, name, value); } + data_node *node; + try { node = new data_node(this, name, value); } catch (...) { return nullptr; } if (!node->get_name() || (!node->get_value() && value)) @@ -366,7 +368,7 @@ xml_data_node *xml_data_node::add_child(const char *name, const char *value) } /* add us to the end of the list of siblings */ - xml_data_node **pnode; + data_node **pnode; for (pnode = &m_first_child; *pnode; pnode = &(*pnode)->m_next) { } *pnode = node; @@ -375,14 +377,14 @@ xml_data_node *xml_data_node::add_child(const char *name, const char *value) /*------------------------------------------------- - xml_get_or_add_child - find a child node of + get_or_add_child - find a child node of the specified type; if not found, add one -------------------------------------------------*/ -xml_data_node *xml_data_node::get_or_add_child(const char *name, const char *value) +data_node *data_node::get_or_add_child(const char *name, const char *value) { /* find the child first */ - xml_data_node *const child = m_first_child->get_sibling(name); + data_node *const child = m_first_child->get_sibling(name); if (child) return child; @@ -392,16 +394,16 @@ xml_data_node *xml_data_node::get_or_add_child(const char *name, const char *val /*------------------------------------------------- - xml_delete_node - delete a node and its + delete_node - delete a node and its children -------------------------------------------------*/ -void xml_data_node::delete_node() +void data_node::delete_node() { /* first unhook us from the list of children of our parent */ if (m_parent) { - for (xml_data_node **pnode = &m_parent->m_first_child; *pnode; pnode = &(*pnode)->m_next) + for (data_node **pnode = &m_parent->m_first_child; *pnode; pnode = &(*pnode)->m_next) { if (*pnode == this) { @@ -417,23 +419,23 @@ void xml_data_node::delete_node() /*------------------------------------------------- - xml_get_next_sibling - find the next sibling of + get_next_sibling - find the next sibling of the specified node with the specified tag -------------------------------------------------*/ -xml_data_node *xml_data_node::get_sibling(const char *name) +data_node *data_node::get_sibling(const char *name) { /* loop over siblings and find a matching name */ - for (xml_data_node *node = this; node; node = node->get_next_sibling()) + for (data_node *node = this; node; node = node->get_next_sibling()) if (strcmp(node->get_name(), name) == 0) return node; return nullptr; } -xml_data_node const *xml_data_node::get_sibling(const char *name) const +data_node const *data_node::get_sibling(const char *name) const { /* loop over siblings and find a matching name */ - for (xml_data_node const *node = this; node; node = node->get_next_sibling()) + for (data_node const *node = this; node; node = node->get_next_sibling()) if (strcmp(node->get_name(), name) == 0) return node; return nullptr; @@ -441,15 +443,15 @@ xml_data_node const *xml_data_node::get_sibling(const char *name) const /*------------------------------------------------- - xml_find_matching_sibling - find the next + find_matching_sibling - find the next sibling of the specified node with the specified tag or attribute/value pair -------------------------------------------------*/ -xml_data_node *xml_data_node::find_matching_sibling(const char *name, const char *attribute, const char *matchval) +data_node *data_node::find_matching_sibling(const char *name, const char *attribute, const char *matchval) { /* loop over siblings and find a matching attribute */ - for (xml_data_node *node = this; node; node = node->get_next_sibling()) + for (data_node *node = this; node; node = node->get_next_sibling()) { /* can pass nullptr as a wildcard for the node name */ if (!name || !strcmp(name, node->get_name())) @@ -463,10 +465,10 @@ xml_data_node *xml_data_node::find_matching_sibling(const char *name, const char return nullptr; } -xml_data_node const *xml_data_node::find_matching_sibling(const char *name, const char *attribute, const char *matchval) const +data_node const *data_node::find_matching_sibling(const char *name, const char *attribute, const char *matchval) const { /* loop over siblings and find a matching attribute */ - for (xml_data_node const *node = this; node; node = node->get_next_sibling()) + for (data_node const *node = this; node; node = node->get_next_sibling()) { /* can pass nullptr as a wildcard for the node name */ if (!name || !strcmp(name, node->get_name())) @@ -486,18 +488,18 @@ xml_data_node const *xml_data_node::find_matching_sibling(const char *name, cons XML ATTRIBUTE MANAGEMENT ***************************************************************************/ -bool xml_data_node::has_attribute(const char *attribute) const +bool data_node::has_attribute(const char *attribute) const { return get_attribute(attribute) != nullptr; } /*------------------------------------------------- - xml_get_attribute - get the value of the + get_attribute - get the value of the specified attribute, or nullptr if not found -------------------------------------------------*/ -xml_data_node::attribute_node *xml_data_node::get_attribute(const char *attribute) +data_node::attribute_node *data_node::get_attribute(const char *attribute) { /* loop over attributes and find a match */ for (attribute_node &anode : m_attributes) @@ -506,7 +508,7 @@ xml_data_node::attribute_node *xml_data_node::get_attribute(const char *attribut return nullptr; } -xml_data_node::attribute_node const *xml_data_node::get_attribute(const char *attribute) const +data_node::attribute_node const *data_node::get_attribute(const char *attribute) const { /* loop over attributes and find a match */ for (attribute_node const &anode : m_attributes) @@ -517,12 +519,12 @@ xml_data_node::attribute_node const *xml_data_node::get_attribute(const char *at /*------------------------------------------------- - xml_get_attribute_string - get the string + get_attribute_string - get the string value of the specified attribute; if not found, return = the provided default -------------------------------------------------*/ -const char *xml_data_node::get_attribute_string(const char *attribute, const char *defvalue) const +const char *data_node::get_attribute_string(const char *attribute, const char *defvalue) const { attribute_node const *attr = get_attribute(attribute); return attr ? attr->value.c_str() : defvalue; @@ -530,12 +532,12 @@ const char *xml_data_node::get_attribute_string(const char *attribute, const cha /*------------------------------------------------- - xml_get_attribute_int - get the integer + get_attribute_int - get the integer value of the specified attribute; if not found, return = the provided default -------------------------------------------------*/ -int xml_data_node::get_attribute_int(const char *attribute, int defvalue) const +int data_node::get_attribute_int(const char *attribute, int defvalue) const { char const *const string = get_attribute_string(attribute, nullptr); int value; @@ -554,11 +556,11 @@ int xml_data_node::get_attribute_int(const char *attribute, int defvalue) const /*------------------------------------------------- - xml_get_attribute_int_format - return the + get_attribute_int_format - return the format of the given integer attribute -------------------------------------------------*/ -xml_data_node::int_format xml_data_node::get_attribute_int_format(const char *attribute) const +data_node::int_format data_node::get_attribute_int_format(const char *attribute) const { char const *const string = get_attribute_string(attribute, nullptr); @@ -576,12 +578,12 @@ xml_data_node::int_format xml_data_node::get_attribute_int_format(const char *at /*------------------------------------------------- - xml_get_attribute_float - get the float + get_attribute_float - get the float value of the specified attribute; if not found, return = the provided default -------------------------------------------------*/ -float xml_data_node::get_attribute_float(const char *attribute, float defvalue) const +float data_node::get_attribute_float(const char *attribute, float defvalue) const { char const *const string = get_attribute_string(attribute, nullptr); float value; @@ -593,11 +595,11 @@ float xml_data_node::get_attribute_float(const char *attribute, float defvalue) /*------------------------------------------------- - xml_set_attribute - set a new attribute and + set_attribute - set a new attribute and string value on the node -------------------------------------------------*/ -void xml_data_node::set_attribute(const char *name, const char *value) +void data_node::set_attribute(const char *name, const char *value) { attribute_node *anode; @@ -618,11 +620,11 @@ void xml_data_node::set_attribute(const char *name, const char *value) /*------------------------------------------------- - xml_set_attribute_int - set a new attribute and + set_attribute_int - set a new attribute and integer value on the node -------------------------------------------------*/ -void xml_data_node::set_attribute_int(const char *name, int value) +void data_node::set_attribute_int(const char *name, int value) { char buffer[100]; sprintf(buffer, "%d", value); @@ -631,11 +633,11 @@ void xml_data_node::set_attribute_int(const char *name, int value) /*------------------------------------------------- - xml_set_attribute_int - set a new attribute and + set_attribute_int - set a new attribute and float value on the node -------------------------------------------------*/ -void xml_data_node::set_attribute_float(const char *name, float value) +void data_node::set_attribute_float(const char *name, float value) { char buffer[100]; sprintf(buffer, "%f", (double) value); @@ -649,11 +651,11 @@ void xml_data_node::set_attribute_float(const char *name, float value) ***************************************************************************/ /*------------------------------------------------- - xml_normalize_string - normalize a string + normalize_string - normalize a string to ensure it doesn't contain embedded tags -------------------------------------------------*/ -const char *xml_normalize_string(const char *string) +const char *normalize_string(const char *string) { static char buffer[1024]; char *d = &buffer[0]; @@ -723,7 +725,7 @@ static void *expat_realloc(void *ptr, size_t size) expat_setup_parser - set up expat for parsing -------------------------------------------------*/ -static bool expat_setup_parser(xml_parse_info &info, xml_parse_options const *opts) +static bool expat_setup_parser(parse_info &info, parse_options const *opts) { XML_Memory_Handling_Suite memcallbacks; @@ -741,7 +743,7 @@ static bool expat_setup_parser(xml_parse_info &info, xml_parse_options const *op } /* create a root node */ - info.rootnode = xml_data_node::file_create(); + info.rootnode = data_node::file_create(); if (info.rootnode == nullptr) return false; info.curnode = info.rootnode; @@ -776,9 +778,9 @@ static bool expat_setup_parser(xml_parse_info &info, xml_parse_options const *op static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) { - xml_parse_info *parse_info = (xml_parse_info *) data; - xml_data_node **curnode = &parse_info->curnode; - xml_data_node *newnode; + parse_info *info = (parse_info *) data; + data_node **curnode = &info->curnode; + data_node *newnode; int attr; /* add a new child node to the current node */ @@ -787,7 +789,7 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char return; /* remember the line number */ - newnode->line = XML_GetCurrentLineNumber(parse_info->parser); + newnode->line = XML_GetCurrentLineNumber(info->parser); /* add all the attributes as well */ for (attr = 0; attributes[attr]; attr += 2) @@ -805,8 +807,8 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char static void expat_data(void *data, const XML_Char *s, int len) { - xml_parse_info *parse_info = (xml_parse_info *) data; - xml_data_node **curnode = &parse_info->curnode; + parse_info *info = (parse_info *) data; + data_node **curnode = &info->curnode; (*curnode)->append_value(s, len); } @@ -818,11 +820,11 @@ static void expat_data(void *data, const XML_Char *s, int len) static void expat_element_end(void *data, const XML_Char *name) { - xml_parse_info *parse_info = (xml_parse_info *) data; - xml_data_node **curnode = &parse_info->curnode; + parse_info *info = (parse_info *) data; + data_node **curnode = &info->curnode; /* strip leading/trailing spaces from the value data */ - if (!(parse_info->flags & XML_PARSE_FLAG_WHITESPACE_SIGNIFICANT)) + if (!(info->flags & PARSE_FLAG_WHITESPACE_SIGNIFICANT)) (*curnode)->trim_whitespace(); /* back us up a node */ @@ -840,7 +842,7 @@ static void expat_element_end(void *data, const XML_Char *name) given node -------------------------------------------------*/ -void xml_data_node::add_attribute(const char *name, const char *value) +void data_node::add_attribute(const char *name, const char *value) { try { @@ -863,7 +865,7 @@ void xml_data_node::add_attribute(const char *name, const char *value) an XML node and its children to a file -------------------------------------------------*/ -void xml_data_node::write_recursive(int indent, util::core_file &file) const +void data_node::write_recursive(int indent, util::core_file &file) const { /* output this tag */ file.printf("%*s<%s", indent, "", get_name()); @@ -889,7 +891,7 @@ void xml_data_node::write_recursive(int indent, util::core_file &file) const /* loop over children and output them as well */ if (get_first_child()) { - for (xml_data_node const *child = this->get_first_child(); child; child = child->get_next_sibling()) + for (data_node const *child = this->get_first_child(); child; child = child->get_next_sibling()) child->write_recursive(indent + 4, file); } @@ -897,3 +899,6 @@ void xml_data_node::write_recursive(int indent, util::core_file &file) const file.printf("%*s\n", indent, "", get_name()); } } + + +} } // namespace util::xml diff --git a/src/lib/util/xmlfile.h b/src/lib/util/xmlfile.h index e6d33970292..c8f8c4ae4c6 100644 --- a/src/lib/util/xmlfile.h +++ b/src/lib/util/xmlfile.h @@ -21,26 +21,29 @@ #include +// forward type declarations +struct XML_ParserStruct; + + +namespace util { namespace xml { + /*************************************************************************** CONSTANTS ***************************************************************************/ enum { - XML_PARSE_FLAG_WHITESPACE_SIGNIFICANT = 1 + PARSE_FLAG_WHITESPACE_SIGNIFICANT = 1 }; + /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ -// forward type declarations -struct XML_ParserStruct; - - /* extended error information from parsing */ -struct xml_parse_error +struct parse_error { const char * error_message; int error_line; @@ -49,16 +52,16 @@ struct xml_parse_error // parsing options -struct xml_parse_options +struct parse_options { - xml_parse_error * error; - void (*init_parser)(struct XML_ParserStruct *parser); - uint32_t flags; + parse_error * error; + void (*init_parser)(XML_ParserStruct *parser); + uint32_t flags; }; // a node representing a data item and its relationships -class xml_data_node +class data_node { public: enum class int_format @@ -74,13 +77,13 @@ public: /* ----- XML file objects ----- */ // create a new empty xml file object - static xml_data_node *file_create(); + static data_node *file_create(); // parse an XML file into its nodes */ - static xml_data_node *file_read(util::core_file &file, xml_parse_options const *opts); + static data_node *file_read(util::core_file &file, parse_options const *opts); /* parse an XML string into its nodes */ - static xml_data_node *string_read(const char *string, xml_parse_options const *opts); + static data_node *string_read(const char *string, parse_options const *opts); // write an XML tree to a file void file_write(util::core_file &file) const; @@ -98,41 +101,41 @@ public: void append_value(char const *value, int length); void trim_whitespace(); - xml_data_node *get_parent() { return m_parent; } - xml_data_node const *get_parent() const { return m_parent; } + data_node *get_parent() { return m_parent; } + data_node const *get_parent() const { return m_parent; } // count the number of child nodes int count_children() const; // get the first child - xml_data_node *get_first_child() { return m_first_child; } - xml_data_node const *get_first_child() const { return m_first_child; } + data_node *get_first_child() { return m_first_child; } + data_node const *get_first_child() const { return m_first_child; } // find the first child with the given tag - xml_data_node *get_child(const char *name); - xml_data_node const *get_child(const char *name) const; + data_node *get_child(const char *name); + data_node const *get_child(const char *name) const; // find the first child with the given tag and/or attribute/value pair - xml_data_node *find_first_matching_child(const char *name, const char *attribute, const char *matchval); - xml_data_node const *find_first_matching_child(const char *name, const char *attribute, const char *matchval) const; + data_node *find_first_matching_child(const char *name, const char *attribute, const char *matchval); + data_node const *find_first_matching_child(const char *name, const char *attribute, const char *matchval) const; // get the next sibling - xml_data_node *get_next_sibling() { return m_next; } - xml_data_node const *get_next_sibling() const { return m_next; } + data_node *get_next_sibling() { return m_next; } + data_node const *get_next_sibling() const { return m_next; } // find the next sibling with the given tag - xml_data_node *get_next_sibling(const char *name); - xml_data_node const *get_next_sibling(const char *name) const; + data_node *get_next_sibling(const char *name); + data_node const *get_next_sibling(const char *name) const; // find the next sibling with the given tag and/or attribute/value pair - xml_data_node *find_next_matching_sibling(const char *name, const char *attribute, const char *matchval); - xml_data_node const *find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) const; + data_node *find_next_matching_sibling(const char *name, const char *attribute, const char *matchval); + data_node const *find_next_matching_sibling(const char *name, const char *attribute, const char *matchval) const; // add a new child node - xml_data_node *add_child(const char *name, const char *value); + data_node *add_child(const char *name, const char *value); // either return an existing child node or create one if it doesn't exist - xml_data_node *get_or_add_child(const char *name, const char *value); + data_node *get_or_add_child(const char *name, const char *value); // delete a node and its children void delete_node(); @@ -184,19 +187,19 @@ private: }; - xml_data_node(); - xml_data_node(xml_data_node *parent, const char *name, const char *value); - ~xml_data_node(); + data_node(); + data_node(data_node *parent, const char *name, const char *value); + ~data_node(); - xml_data_node(xml_data_node const &) = delete; - xml_data_node(xml_data_node &&) = delete; - xml_data_node &operator=(xml_data_node &&) = delete; - xml_data_node &operator=(xml_data_node const &) = delete; + data_node(data_node const &) = delete; + data_node(data_node &&) = delete; + data_node &operator=(data_node &&) = delete; + data_node &operator=(data_node const &) = delete; - xml_data_node *get_sibling(const char *name); - xml_data_node const *get_sibling(const char *name) const; - xml_data_node *find_matching_sibling(const char *name, const char *attribute, const char *matchval); - xml_data_node const *find_matching_sibling(const char *name, const char *attribute, const char *matchval) const; + data_node *get_sibling(const char *name); + data_node const *get_sibling(const char *name) const; + data_node *find_matching_sibling(const char *name, const char *attribute, const char *matchval); + data_node const *find_matching_sibling(const char *name, const char *attribute, const char *matchval) const; attribute_node *get_attribute(const char *attribute); attribute_node const *get_attribute(const char *attribute) const; @@ -204,11 +207,11 @@ private: void write_recursive(int indent, util::core_file &file) const; - xml_data_node * m_next; - xml_data_node * m_first_child; + data_node * m_next; + data_node * m_first_child; std::string m_name; std::string m_value; - xml_data_node * m_parent; + data_node * m_parent; std::list m_attributes; }; @@ -221,6 +224,8 @@ private: /* ----- miscellaneous interfaces ----- */ /* normalize a string into something that can be written to an XML file */ -const char *xml_normalize_string(const char *string); +const char *normalize_string(const char *string); + +} } // namespace util::xml #endif /* MAME_LIB_UTIL_XMLFILE_H */ diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp index ff53278d3a6..c138aa074aa 100644 --- a/src/osd/modules/debugger/debugqt.cpp +++ b/src/osd/modules/debugger/debugqt.cpp @@ -77,10 +77,10 @@ static MainWindow* mainQtWindow = nullptr; std::vector xmlConfigurations; -static void xml_configuration_load(running_machine &machine, config_type cfg_type, xml_data_node *parentnode) +static void xml_configuration_load(running_machine &machine, config_type cfg_type, util::xml::data_node const *parentnode) { // We only care about game files - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; // Might not have any data @@ -92,7 +92,7 @@ static void xml_configuration_load(running_machine &machine, config_type cfg_typ xmlConfigurations.clear(); // Configuration load - xml_data_node const * wnode = nullptr; + util::xml::data_node const * wnode = nullptr; for (wnode = parentnode->get_child("window"); wnode != nullptr; wnode = wnode->get_next_sibling("window")) { WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)wnode->get_attribute_int("type", WindowQtConfig::WIN_TYPE_UNKNOWN); @@ -112,10 +112,10 @@ static void xml_configuration_load(running_machine &machine, config_type cfg_typ } -static void xml_configuration_save(running_machine &machine, config_type cfg_type, xml_data_node *parentnode) +static void xml_configuration_save(running_machine &machine, config_type cfg_type, util::xml::data_node *parentnode) { // We only write to game configurations - if (cfg_type != config_type::CONFIG_TYPE_GAME) + if (cfg_type != config_type::GAME) return; for (int i = 0; i < xmlConfigurations.size(); i++) @@ -123,7 +123,7 @@ static void xml_configuration_save(running_machine &machine, config_type cfg_typ WindowQtConfig* config = xmlConfigurations[i]; // Create an xml node - xml_data_node *const debugger_node = parentnode->add_child("window", nullptr); + util::xml::data_node *const debugger_node = parentnode->add_child("window", nullptr); if (debugger_node == nullptr) continue; @@ -268,8 +268,8 @@ void debug_qt::init_debugger(running_machine &machine) m_machine = &machine; // Setup the configuration XML saving and loading machine.configuration().config_register("debugger", - config_saveload_delegate(&xml_configuration_load, &machine), - config_saveload_delegate(&xml_configuration_save, &machine)); + config_load_delegate(&xml_configuration_load, &machine), + config_save_delegate(&xml_configuration_save, &machine)); } diff --git a/src/osd/modules/debugger/qt/breakpointswindow.cpp b/src/osd/modules/debugger/qt/breakpointswindow.cpp index a5b06ec4caf..029cf2d0b72 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.cpp +++ b/src/osd/modules/debugger/qt/breakpointswindow.cpp @@ -122,14 +122,14 @@ void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget) } -void BreakpointsWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void BreakpointsWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); node.set_attribute_int("bwtype", m_bwType); } -void BreakpointsWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void BreakpointsWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); m_bwType = node.get_attribute_int("bwtype", m_bwType); diff --git a/src/osd/modules/debugger/qt/breakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h index 52d61e95f5b..60bbdc4379f 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.h +++ b/src/osd/modules/debugger/qt/breakpointswindow.h @@ -48,8 +48,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp index c317c41956f..fd98a6483be 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.cpp +++ b/src/osd/modules/debugger/qt/dasmwindow.cpp @@ -302,14 +302,14 @@ void DasmWindowQtConfig::applyToQWidget(QWidget* widget) rightBarGroup->actions()[m_rightBar]->trigger(); } -void DasmWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void DasmWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); node.set_attribute_int("cpu", m_cpu); node.set_attribute_int("rightbar", m_rightBar); } -void DasmWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void DasmWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); m_cpu = node.get_attribute_int("cpu", m_cpu); diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h index 9a8bf849ab2..27b652c04e8 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.h +++ b/src/osd/modules/debugger/qt/dasmwindow.h @@ -71,8 +71,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp index aa71d02b630..30daaaec9ea 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.cpp +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.cpp @@ -122,14 +122,14 @@ void DeviceInformationWindowQtConfig::applyToQWidget(QWidget* widget) } -void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void DeviceInformationWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); node.set_attribute("device-tag", m_device_tag.c_str()); } -void DeviceInformationWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void DeviceInformationWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); m_device_tag = node.get_attribute_string("device-tag", ":"); diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h index 05335b6f631..5ed1bfbde91 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -45,8 +45,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/deviceswindow.cpp b/src/osd/modules/debugger/qt/deviceswindow.cpp index 4c570253723..599022f40f9 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.cpp +++ b/src/osd/modules/debugger/qt/deviceswindow.cpp @@ -164,13 +164,13 @@ void DevicesWindowQtConfig::applyToQWidget(QWidget* widget) } -void DevicesWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void DevicesWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); } -void DevicesWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void DevicesWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); } diff --git a/src/osd/modules/debugger/qt/deviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h index e2440d6cc34..87e710a001b 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.h +++ b/src/osd/modules/debugger/qt/deviceswindow.h @@ -73,8 +73,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/logwindow.cpp b/src/osd/modules/debugger/qt/logwindow.cpp index 8bd0d55568d..ecb8bf66e14 100644 --- a/src/osd/modules/debugger/qt/logwindow.cpp +++ b/src/osd/modules/debugger/qt/logwindow.cpp @@ -60,13 +60,13 @@ void LogWindowQtConfig::applyToQWidget(QWidget* widget) } -void LogWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void LogWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); } -void LogWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void LogWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); } diff --git a/src/osd/modules/debugger/qt/logwindow.h b/src/osd/modules/debugger/qt/logwindow.h index dd1ebb4f8ad..53228ceafca 100644 --- a/src/osd/modules/debugger/qt/logwindow.h +++ b/src/osd/modules/debugger/qt/logwindow.h @@ -40,8 +40,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index 81be708c927..68a8fa0c644 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -526,7 +526,7 @@ void MainWindowQtConfig::applyToQWidget(QWidget* widget) } -void MainWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void MainWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); node.set_attribute_int("rightbar", m_rightBar); @@ -534,7 +534,7 @@ void MainWindowQtConfig::addToXmlDataNode(xml_data_node &node) const } -void MainWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void MainWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); const char* state = node.get_attribute_string("qtwindowstate", ""); diff --git a/src/osd/modules/debugger/qt/mainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h index 920ac438356..95a4e53ca99 100644 --- a/src/osd/modules/debugger/qt/mainwindow.h +++ b/src/osd/modules/debugger/qt/mainwindow.h @@ -199,8 +199,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index a15ce819acb..9875cc3dca8 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -430,7 +430,7 @@ void MemoryWindowQtConfig::applyToQWidget(QWidget* widget) } -void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void MemoryWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { WindowQtConfig::addToXmlDataNode(node); node.set_attribute_int("memoryregion", m_memoryRegion); @@ -440,7 +440,7 @@ void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node &node) const } -void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void MemoryWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { WindowQtConfig::recoverFromXmlNode(node); m_memoryRegion = node.get_attribute_int("memoryregion", m_memoryRegion); diff --git a/src/osd/modules/debugger/qt/memorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h index 42f81ac1178..ff0c974c838 100644 --- a/src/osd/modules/debugger/qt/memorywindow.h +++ b/src/osd/modules/debugger/qt/memorywindow.h @@ -91,8 +91,8 @@ public: void buildFromQWidget(QWidget* widget); void applyToQWidget(QWidget* widget); - void addToXmlDataNode(xml_data_node &node) const; - void recoverFromXmlNode(xml_data_node const &node); + void addToXmlDataNode(util::xml::data_node &node) const; + void recoverFromXmlNode(util::xml::data_node const &node); }; diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp index 09709adbbf7..c908ac583c7 100644 --- a/src/osd/modules/debugger/qt/windowqt.cpp +++ b/src/osd/modules/debugger/qt/windowqt.cpp @@ -257,7 +257,7 @@ void WindowQtConfig::applyToQWidget(QWidget* widget) } -void WindowQtConfig::addToXmlDataNode(xml_data_node &node) const +void WindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const { node.set_attribute_int("type", m_type); node.set_attribute_int("position_x", m_position.x()); @@ -267,7 +267,7 @@ void WindowQtConfig::addToXmlDataNode(xml_data_node &node) const } -void WindowQtConfig::recoverFromXmlNode(xml_data_node const &node) +void WindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) { m_size.setX(node.get_attribute_int("size_x", m_size.x())); m_size.setY(node.get_attribute_int("size_y", m_size.y())); diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h index 6f9701f0196..28b3039c28f 100644 --- a/src/osd/modules/debugger/qt/windowqt.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -92,8 +92,8 @@ public: virtual void buildFromQWidget(QWidget* widget); virtual void applyToQWidget(QWidget* widget); - virtual void addToXmlDataNode(xml_data_node &node) const; - virtual void recoverFromXmlNode(xml_data_node const &node); + virtual void addToXmlDataNode(util::xml::data_node &node) const; + virtual void recoverFromXmlNode(util::xml::data_node const &node); }; From acc42e344d8b7c25e973200c2c9009c471227cbe Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 11 Dec 2016 22:49:47 +1100 Subject: [PATCH 52/82] MT 06452 --- src/mame/video/phoenix.cpp | 44 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/src/mame/video/phoenix.cpp b/src/mame/video/phoenix.cpp index f4a824431bc..3d86eab1c26 100644 --- a/src/mame/video/phoenix.cpp +++ b/src/mame/video/phoenix.cpp @@ -186,11 +186,6 @@ VIDEO_START_MEMBER(phoenix_state,phoenix) m_fg_tilemap->set_transparent_pen(0); - m_fg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); - m_bg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); - m_fg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); - m_bg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); - save_pointer(NAME(m_videoram_pg[0].get()), 0x1000); save_pointer(NAME(m_videoram_pg[1].get()), 0x1000); save_item(NAME(m_videoram_pg_index)); @@ -233,7 +228,7 @@ WRITE8_MEMBER(phoenix_state::phoenix_videoram_w) m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); } - /* as part of the protecion, Survival executes code from $43a4 */ + /* as part of the protection, Survival executes code from $43a4 */ rom[offset + 0x4000] = data; } @@ -248,6 +243,21 @@ WRITE8_MEMBER(phoenix_state::phoenix_videoreg_w) m_cocktail_mode = m_videoram_pg_index && (ioport("CAB")->read() & 0x01); + if (m_cocktail_mode) + { + m_fg_tilemap->set_scrolldx(0, 0); + m_bg_tilemap->set_scrolldx(0, 0); + m_fg_tilemap->set_scrolldy(0, 0); + m_bg_tilemap->set_scrolldy(0, 0); + } + else + { + m_fg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); + m_bg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); + m_fg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); + m_bg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); + } + machine().tilemap().set_flip_all(m_cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); machine().tilemap().mark_all_dirty(); } @@ -271,6 +281,21 @@ WRITE8_MEMBER(phoenix_state::pleiads_videoreg_w) m_cocktail_mode = m_videoram_pg_index && (ioport("CAB")->read() & 0x01); + if (m_cocktail_mode) + { + m_fg_tilemap->set_scrolldx(0, 0); + m_bg_tilemap->set_scrolldx(0, 0); + m_fg_tilemap->set_scrolldy(0, 0); + m_bg_tilemap->set_scrolldy(0, 0); + } + else + { + m_fg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); + m_bg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART)); + m_fg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); + m_bg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART)); + } + machine().tilemap().set_flip_all(m_cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); machine().tilemap().mark_all_dirty(); } @@ -360,7 +385,12 @@ CUSTOM_INPUT_MEMBER(phoenix_state::pleiads_protection_r) #define REMAP_JS(js) ((ret & 0xf) | ( (js & 0xf) << 4)) READ8_MEMBER(phoenix_state::survival_input_port_0_r) { - uint8_t ret = ~ioport("IN0")->read(); + uint8_t ret; + + if (m_cocktail_mode) + ret = ~ioport("IN1")->read(); + else + ret = ~ioport("IN0")->read(); if( m_survival_input_readc++ == 2 ) { From b995c53b914269093ac66b50762e19641cc2ebd4 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sun, 11 Dec 2016 10:30:22 -0500 Subject: [PATCH 53/82] Changed a number of declarations in Imgtool to use std::string instead of 'const char *' --- src/tools/imgtool/imgtool.cpp | 27 ++++++++++++++------------- src/tools/imgtool/imgtool.h | 16 ++++++++-------- src/tools/imgtool/stream.cpp | 27 +++++++++++---------------- src/tools/imgtool/stream.h | 5 ++--- 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index 322dbe8175d..9afce54492d 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -881,7 +881,7 @@ char *imgtool_temp_str(void) ***************************************************************************/ -imgtoolerr_t imgtool::image::internal_open(const imgtool_module *module, const char *fname, +imgtoolerr_t imgtool::image::internal_open(const imgtool_module *module, const std::string &filename, int read_or_write, util::option_resolution *createopts, imgtool::image::ptr &outimg) { imgtoolerr_t err; @@ -908,7 +908,7 @@ imgtoolerr_t imgtool::image::internal_open(const imgtool_module *module, const c } // open the stream - stream = imgtool::stream::open(fname, read_or_write); + stream = imgtool::stream::open(filename, read_or_write); if (!stream) { err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); @@ -964,7 +964,7 @@ done: // open - open an image //------------------------------------------------- -imgtoolerr_t imgtool::image::open(const imgtool_module *module, const char *filename, int read_or_write, ptr &outimg) +imgtoolerr_t imgtool::image::open(const imgtool_module *module, const std::string &filename, int read_or_write, ptr &outimg) { read_or_write = read_or_write ? OSD_FOPEN_RW : OSD_FOPEN_READ; return internal_open(module, filename, read_or_write, nullptr, outimg); @@ -975,7 +975,7 @@ imgtoolerr_t imgtool::image::open(const imgtool_module *module, const char *file // imgtool::image::open_byname - open an image //------------------------------------------------- -imgtoolerr_t imgtool::image::open(const std::string &modulename, const char *filename, int read_or_write, ptr &outimg) +imgtoolerr_t imgtool::image::open(const std::string &modulename, const std::string &filename, int read_or_write, ptr &outimg) { const imgtool_module *module; @@ -1016,7 +1016,7 @@ imgtool::image::~image() // create - creates an image //------------------------------------------------- -imgtoolerr_t imgtool::image::create(const imgtool_module *module, const char *fname, +imgtoolerr_t imgtool::image::create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts, ptr &image) { std::unique_ptr alloc_resolution; @@ -1033,7 +1033,7 @@ imgtoolerr_t imgtool::image::create(const imgtool_module *module, const char *fn opts = alloc_resolution.get(); } - return internal_open(module, fname, OSD_FOPEN_RW_CREATE, opts, image); + return internal_open(module, filename, OSD_FOPEN_RW_CREATE, opts, image); } @@ -1041,7 +1041,7 @@ imgtoolerr_t imgtool::image::create(const imgtool_module *module, const char *fn // create - creates an image //------------------------------------------------- -imgtoolerr_t imgtool::image::create(const std::string &modulename, const char *fname, util::option_resolution *opts, ptr &image) +imgtoolerr_t imgtool::image::create(const std::string &modulename, const std::string &filename, util::option_resolution *opts, ptr &image) { const imgtool_module *module; @@ -1049,7 +1049,7 @@ imgtoolerr_t imgtool::image::create(const std::string &modulename, const char *f if (!module) return (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); - return create(module, fname, opts, image); + return create(module, filename, opts, image); } @@ -1057,11 +1057,11 @@ imgtoolerr_t imgtool::image::create(const std::string &modulename, const char *f // create - creates an image //------------------------------------------------- -imgtoolerr_t imgtool::image::create(const imgtool_module *module, const char *fname, +imgtoolerr_t imgtool::image::create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts) { std::unique_ptr image; - return create(module, fname, opts, image); + return create(module, filename, opts, image); } @@ -1069,10 +1069,10 @@ imgtoolerr_t imgtool::image::create(const imgtool_module *module, const char *fn // create - creates an image //------------------------------------------------- -imgtoolerr_t imgtool::image::create(const std::string &modulename, const char *fname, util::option_resolution *opts) +imgtoolerr_t imgtool::image::create(const std::string &modulename, const std::string &filename, util::option_resolution *opts) { std::unique_ptr image; - return create(modulename, fname, opts, image); + return create(modulename, filename, opts, image); } @@ -2416,8 +2416,9 @@ imgtool::directory::directory(imgtool::partition &partition) // enumerating files on a partition //------------------------------------------------- -imgtoolerr_t imgtool::directory::open(imgtool::partition &partition, const char *path, imgtool::directory::ptr &outenum) +imgtoolerr_t imgtool::directory::open(imgtool::partition &partition, const std::string &path_string, imgtool::directory::ptr &outenum) { + const char *path = path_string.c_str(); imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; imgtool::directory::ptr enumeration; char *alloc_path = nullptr; diff --git a/src/tools/imgtool/imgtool.h b/src/tools/imgtool/imgtool.h index fb1b6023fff..f7a6f50993a 100644 --- a/src/tools/imgtool/imgtool.h +++ b/src/tools/imgtool/imgtool.h @@ -98,12 +98,12 @@ namespace imgtool ~image(); static imgtoolerr_t identify_file(const char *filename, imgtool_module **modules, size_t count); - static imgtoolerr_t open(const imgtool_module *module, const char *filename, int read_or_write, ptr &outimg); - static imgtoolerr_t open(const std::string &modulename, const char *filename, int read_or_write, ptr &outimg); - static imgtoolerr_t create(const imgtool_module *module, const char *fname, util::option_resolution *opts, ptr &image); - static imgtoolerr_t create(const std::string &modulename, const char *fname, util::option_resolution *opts, ptr &image); - static imgtoolerr_t create(const imgtool_module *module, const char *fname, util::option_resolution *opts); - static imgtoolerr_t create(const std::string &modulename, const char *fname, util::option_resolution *opts); + static imgtoolerr_t open(const imgtool_module *module, const std::string &filename, int read_or_write, ptr &outimg); + static imgtoolerr_t open(const std::string &modulename, const std::string &filename, int read_or_write, ptr &outimg); + static imgtoolerr_t create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts, ptr &image); + static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts, ptr &image); + static imgtoolerr_t create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts); + static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts); static uint64_t rand(); std::string info(); @@ -129,7 +129,7 @@ namespace imgtool // better C++ adoption (e.g. - std::unique_ptr<>, std:move() etc) bool m_okay_to_close; - static imgtoolerr_t internal_open(const imgtool_module *module, const char *fname, + static imgtoolerr_t internal_open(const imgtool_module *module, const std::string &filename, int read_or_write, util::option_resolution *createopts, imgtool::image::ptr &outimg); }; } @@ -244,7 +244,7 @@ namespace imgtool ~directory(); // methods - static imgtoolerr_t open(imgtool::partition &partition, const char *path, ptr &outenum); + static imgtoolerr_t open(imgtool::partition &partition, const std::string &path, ptr &outenum); imgtoolerr_t get_next(imgtool_dirent &ent); // accessors diff --git a/src/tools/imgtool/stream.cpp b/src/tools/imgtool/stream.cpp index d5d0ee120b5..0bcca455010 100644 --- a/src/tools/imgtool/stream.cpp +++ b/src/tools/imgtool/stream.cpp @@ -24,7 +24,6 @@ imgtool::stream::stream(bool wp) : imgtype(IMG_FILE) , write_protect(wp) - , name(nullptr) , position(0) , filesize(0) , file() @@ -40,7 +39,6 @@ imgtool::stream::stream(bool wp) imgtool::stream::stream(bool wp, util::core_file::ptr &&f) : imgtype(IMG_FILE) , write_protect(wp) - , name(nullptr) , position(0) , filesize(f->size()) , file(std::move(f)) @@ -56,7 +54,6 @@ imgtool::stream::stream(bool wp, util::core_file::ptr &&f) imgtool::stream::stream(bool wp, std::size_t size) : imgtype(IMG_MEM) , write_protect(wp) - , name(nullptr) , position(0) , filesize(size) , file() @@ -72,7 +69,6 @@ imgtool::stream::stream(bool wp, std::size_t size) imgtool::stream::stream(bool wp, std::size_t size, void *buf) : imgtype(IMG_MEM) , write_protect(wp) - , name(nullptr) , position(0) , filesize(size) , file() @@ -96,13 +92,13 @@ imgtool::stream::~stream() // open_zip //------------------------------------------------- -imgtool::stream::ptr imgtool::stream::open_zip(const char *zipname, const char *subname, int read_or_write) +imgtool::stream::ptr imgtool::stream::open_zip(const std::string &zipname, const char *subname, int read_or_write) { if (read_or_write) return imgtool::stream::ptr(); /* check to see if the file exists */ - FILE *f = fopen(zipname, "r"); + FILE *f = fopen(zipname.c_str(), "r"); if (!f) return imgtool::stream::ptr(); fclose(f); @@ -139,7 +135,7 @@ imgtool::stream::ptr imgtool::stream::open_zip(const char *zipname, const char * // open //------------------------------------------------- -imgtool::stream::ptr imgtool::stream::open(const char *fname, int read_or_write) +imgtool::stream::ptr imgtool::stream::open(const std::string &filename, int read_or_write) { static const uint32_t write_modes[] = { @@ -151,22 +147,22 @@ imgtool::stream::ptr imgtool::stream::open(const char *fname, int read_or_write) imgtool::stream::ptr s; char c; - /* maybe we are just a ZIP? */ - const char *ext = strrchr(fname, '.'); - if (ext && !core_stricmp(ext, ".zip")) - return open_zip(fname, nullptr, read_or_write); + // maybe we are just a ZIP? + std::string ext = core_filename_extract_extension(filename); + if (!core_stricmp(ext.c_str(), ".zip")) + return open_zip(filename, nullptr, read_or_write); util::core_file::ptr f = nullptr; - auto const filerr = util::core_file::open(fname, write_modes[read_or_write], f); + auto const filerr = util::core_file::open(filename, write_modes[read_or_write], f); if (filerr != osd_file::error::NONE) { if (!read_or_write) { - int const len = strlen(fname); + int const len = filename.size(); /* can't open the file; try opening ZIP files with other names */ std::vector buf(len + 1); - strcpy(&buf[0], fname); + strcpy(&buf[0], filename.c_str()); for (int i = len-1; !s && (i >= 0); i--) { @@ -189,8 +185,7 @@ imgtool::stream::ptr imgtool::stream::open(const char *fname, int read_or_write) imgtool::stream::ptr imgfile(new imgtool::stream(read_or_write ? false : true, std::move(f))); - /* Normal file */ - imgfile->name = fname; + // normal file return imgfile; } diff --git a/src/tools/imgtool/stream.h b/src/tools/imgtool/stream.h index 9a99d96fcbc..4d968ca9551 100644 --- a/src/tools/imgtool/stream.h +++ b/src/tools/imgtool/stream.h @@ -23,7 +23,7 @@ namespace imgtool ~stream(); - static imgtool::stream::ptr open(const char *fname, int read_or_write); /* similar params to mame_fopen */ + static imgtool::stream::ptr open(const std::string &filename, int read_or_write); /* similar params to mame_fopen */ static imgtool::stream::ptr open_write_stream(int filesize); static imgtool::stream::ptr open_mem(void *buf, size_t sz); @@ -61,7 +61,6 @@ namespace imgtool imgtype_t imgtype; bool write_protect; - const char *name; // needed for clear std::uint64_t position; std::uint64_t filesize; @@ -75,7 +74,7 @@ namespace imgtool stream(bool wp, std::size_t size, void *buf); // private methods - static stream::ptr open_zip(const char *zipname, const char *subname, int read_or_write); + static stream::ptr open_zip(const std::string &zipname, const char *subname, int read_or_write); }; } From b5f03f4ef907616a32acb802a3e529ccd0c915a3 Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 11 Dec 2016 09:22:21 +0000 Subject: [PATCH 54/82] HACK: return 0xffff for the current program counter while fetching the vector as the segag80r protection currently relies on it. Reduce the number of extraneous reads that the segag80r protection performs. [smf] --- src/devices/cpu/z80/z80.cpp | 6 ++++++ src/mame/drivers/segag80r.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 9e0fec6b487..7799dff84d5 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3126,6 +3126,8 @@ OP(op,ff) { rst(0x38); void z80_device::take_nmi() { + PRVPC = 0xffff; // HACK: segag80r protection kludge + /* Check if processor was halted */ leave_halt(); @@ -3146,6 +3148,8 @@ void z80_device::take_interrupt() { int irq_vector; + PRVPC = 0xffff; // HACK: segag80r protection kludge + /* Check if processor was halted */ leave_halt(); @@ -3230,6 +3234,8 @@ void z80_device::take_interrupt() void nsc800_device::take_interrupt_nsc800() { + PRVPC = 0xffff; // HACK: segag80r protection kludge + /* Check if processor was halted */ leave_halt(); diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp index f278a775a67..d374bc6d561 100644 --- a/src/mame/drivers/segag80r.cpp +++ b/src/mame/drivers/segag80r.cpp @@ -172,8 +172,8 @@ offs_t segag80r_state::decrypt_offset(address_space &space, offs_t offset) if ((uint16_t)pc == 0xffff || space.read_byte(pc) != 0x32) return offset; - /* fetch the low byte of the address and munge it */ - return (offset & 0xff00) | (*m_decrypt)(pc, space.read_byte(pc + 1)); + /* munge the low byte of the address */ + return (offset & 0xff00) | (*m_decrypt)(pc, offset & 0xff); } WRITE8_MEMBER(segag80r_state::mainram_w) From 848ac84e508fc77480d7e89fad2440054062c2d6 Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 11 Dec 2016 12:47:03 +0000 Subject: [PATCH 55/82] remove unnecessary file (nw) --- src/mame/drivers/gammagic.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mame/drivers/gammagic.cpp b/src/mame/drivers/gammagic.cpp index 6fb03850748..33bffb291de 100644 --- a/src/mame/drivers/gammagic.cpp +++ b/src/mame/drivers/gammagic.cpp @@ -31,7 +31,6 @@ Additional CD-ROM games: "99 Bottles of Beer" #include "emu.h" #include "cpu/i386/i386.h" -#include "machine/cr589.h" //#include "machine/i82371sb.h" //#include "machine/i82439tx.h" #include "machine/lpci.h" From 0c4cb4b01fd0a13c3a0b8d77cf7f1783db831c87 Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 11 Dec 2016 18:06:29 +0000 Subject: [PATCH 56/82] Use correct Commodore LCD font [Mike Naberezny, smf] --- src/mame/drivers/clcd.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 391bb56dc8d..2454262d341 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -139,27 +139,20 @@ public: int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; - for (int y = 0; y < 16; y++) + for (int y = 0; y < 128; y++) { - int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + (y * 128); + int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); for (int x = 0; x < 480; x++) { uint8_t ch = m_ram->pointer()[offset + (x / chrw)]; - uint8_t bit = font[((ch & 0x7f) * chrw) + (x % chrw)]; + uint8_t bit = font[((ch & 0x7f) * 8) + (y % 8)]; if (ch & 0x80) { bit = ~bit; } - bitmap.pix16((y * 8) + 0, x) = (bit >> 0) & 1; - bitmap.pix16((y * 8) + 1, x) = (bit >> 1) & 1; - bitmap.pix16((y * 8) + 2, x) = (bit >> 2) & 1; - bitmap.pix16((y * 8) + 3, x) = (bit >> 3) & 1; - bitmap.pix16((y * 8) + 4, x) = (bit >> 4) & 1; - bitmap.pix16((y * 8) + 5, x) = (bit >> 5) & 1; - bitmap.pix16((y * 8) + 6, x) = (bit >> 6) & 1; - bitmap.pix16((y * 8) + 7, x) = (bit >> 7) & 1; + bitmap.pix16(y, x) = (bit >> (7 - (x % chrw))) & 1; } } } @@ -838,8 +831,8 @@ ROM_START( clcd ) ROM_LOAD( "sizapr.u103", 0x10000, 0x8000, CRC(0aa91d9f) SHA1(f0842f370607f95d0a0ec6afafb81bc063c32745)) ROM_LOAD( "kizapr.u102", 0x18000, 0x8000, CRC(59103d52) SHA1(e49c20b237a78b54c2cb26b133d5903bb60bd8ef)) - ROM_REGION( 0x20000, "lcd_char_rom", 0 ) - ROM_LOAD( "lcd_char_rom", 0x000000, 0x000800, BAD_DUMP CRC(7db9d225) SHA1(0a8835fa182efa55d027828b42aa554608795274) ) + ROM_REGION( 0x1000, "lcd_char_rom", 0 ) + ROM_LOAD( "lcd-char-rom.u16", 0x00000, 0x1000, CRC(7b6d3867) SHA1(cb594801438849f933ddc3e64b03b56f42f59f09)) ROM_END From 0517f1c4c5fe68146e1e7607820ac314d4b5e8b1 Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 11 Dec 2016 18:43:48 +0000 Subject: [PATCH 57/82] fixed alt font offset (nw) --- src/mame/drivers/clcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 2454262d341..063cc6bc154 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -134,7 +134,7 @@ public: uint8_t *font = m_lcd_char_rom->base(); if (m_lcd_mode & LCD_MODE_ALT) { - font += 1024; + font += 2048; } int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; From 02056c04b1988fe01404102ec7ec6a031c85a87f Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sun, 11 Dec 2016 15:39:25 -0500 Subject: [PATCH 58/82] [Imgtool] Removed dead strncatz() function --- src/tools/imgtool/imgtool.cpp | 12 ------------ src/tools/imgtool/imgtool.h | 1 - 2 files changed, 13 deletions(-) diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index 322dbe8175d..d5ee821315d 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -67,18 +67,6 @@ char *strncpyz(char *dest, const char *source, size_t len) return s; } -char *strncatz(char *dest, const char *source, size_t len) -{ - size_t l; - l = strlen(dest); - dest += l; - if (len > l) - len -= l; - else - len = 0; - return strncpyz(dest, source, len); -} - //------------------------------------------------- // markerrorsource - marks where an error source //------------------------------------------------- diff --git a/src/tools/imgtool/imgtool.h b/src/tools/imgtool/imgtool.h index fb1b6023fff..5f5da586da5 100644 --- a/src/tools/imgtool/imgtool.h +++ b/src/tools/imgtool/imgtool.h @@ -265,7 +265,6 @@ int imgtool_validitychecks(void); void unknown_partition_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info); char *strncpyz(char *dest, const char *source, size_t len); -char *strncatz(char *dest, const char *source, size_t len); void rtrim(char *buf); #endif /* IMGTOOL_H */ From c77720f85751a89073818d010a3d2965bc285a03 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 12 Dec 2016 08:20:14 +1100 Subject: [PATCH 59/82] MT 04796 --- src/mame/video/m58.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp index 1e0d28e4386..2120ee396d7 100644 --- a/src/mame/video/m58.cpp +++ b/src/mame/video/m58.cpp @@ -127,6 +127,7 @@ WRITE8_MEMBER(m58_state::scroll_panel_w) col = ((col >> 3) | col) & 3; m_scroll_panel_bitmap.pix16(sy, sx + i) = 0x100 + (sy & 0xfc) + col; + m_scroll_panel_bitmap.pix16(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen } } @@ -169,13 +170,7 @@ TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows) void m58_state::video_start() { - int width = m_screen->width(); - int height = m_screen->height(); - const rectangle &visarea = m_screen->visible_area(); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::tilemap_scan_rows),this), 8, 8, 64, 32); - m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1)); - m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1)); m_screen->register_screen_bitmap(m_scroll_panel_bitmap); save_item(NAME(m_scroll_panel_bitmap)); @@ -191,8 +186,24 @@ void m58_state::video_start() WRITE8_MEMBER(m58_state::flipscreen_w) { + int width = m_screen->width(); + int height = m_screen->height(); + const rectangle &visarea = m_screen->visible_area(); + /* screen flip is handled both by software and hardware */ - flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01)); + bool flipscreen = BIT(data, 0) ^ BIT(~ioport("DSW2")->read(), 0); + flip_screen_set(flipscreen); + + if (flipscreen) + { + m_bg_tilemap->set_scrolldx(0, 0); + m_bg_tilemap->set_scrolldy(0, 32); + } + else + { + m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1)); + m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1)); + } machine().bookkeeping().coin_counter_w(0, data & 0x02); machine().bookkeeping().coin_counter_w(1, data & 0x20); From a5729bb5d971527f4e36c076553a2600a188397d Mon Sep 17 00:00:00 2001 From: Ted Green Date: Sun, 11 Dec 2016 15:07:42 -0700 Subject: [PATCH 60/82] zeusII: WIP: Update screen rectangle to keep mwskins from crashing. (nw) --- src/devices/video/zeus2.cpp | 400 +++++++++++++++++----------------- src/devices/video/zeus2.h | 3 + src/mame/drivers/atlantis.cpp | 2 +- 3 files changed, 210 insertions(+), 195 deletions(-) diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 51a6b7e0c60..01806e7be3c 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -117,6 +117,8 @@ void zeus2_device::device_reset() memset(m_zeusbase, 0, sizeof(m_zeusbase[0]) * 0x80); memset(m_renderRegs, 0, sizeof(m_renderRegs[0]) * 0x50); + m_curUCodeSrc = 0; + m_curPalTableSrc = 0; m_palSize = 0; zbase = 32.0f; m_yScale = 0; @@ -192,7 +194,7 @@ void zeus2_device::device_stop() uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // Wait until configuration is completed before transfering anything - if (m_zeusbase[0x30] == 0) + if (!(m_zeusbase[0x10] & 0x20)) return 0; int x, y; @@ -206,14 +208,12 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap //if (!machine().input().code_pressed(KEYCODE_W)) if (1) { - int xoffs = screen.visible_area().min_x; for (y = cliprect.min_y; y <= cliprect.max_y; y++) { uint32_t *colorptr = &m_frameColor[frame_addr_from_xy(0, y, false)]; uint32_t *dest = &bitmap.pix32(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint32_t bufX = x - xoffs; - dest[x] = colorptr[bufX]; + dest[x] = colorptr[x]; } } } @@ -398,90 +398,105 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log int_timer->adjust(attotime::from_nsec(500)); break; - case 0x20: - /* toggles between two values based on the page: - - Page # m_zeusbase[0x20] m_zeusbase[0x38] - ------ -------------- -------------- - 0 $04000190 $00000000 - 1 $04000000 $01900000 - */ - zeus2_pointer_write(m_zeusbase[0x20] >> 24, (m_zeusbase[0x20] & 0xffffff), logit); - break; - - case 0x22: - if (logit) - logerror("\tRend Setup 0"); - break; - - case 0x23: - if (logit) - logerror("\tRend Setup 1"); - break; - - case 0x24: - if (logit) - logerror("\tRend Setup 4"); - break; - - case 0x2a: - // 0x000000c0 = bilenear off - if (logit) - logerror("\tRend Force Off"); - break; - - case 0x2b: - if (logit) - logerror("\tRend Force On"); - break; - - case 0x2c: - if (logit) - logerror("\tRend AE Flag"); - break; - - case 0x2d: - if (logit) - logerror("\tRend AF Flag"); - break; - - case 0x2f: - if (logit) - logerror("\tPixel Proc Setup"); - break; - - - case 0x30: + case 0x10: + // BITS 11 - 10 COL SIZE / BANK FOR WR1 + // BITS 9 - 8 COL SIZE / BANK FOR WR0 + if (logit) logerror("\tSys Setup"); + if (m_zeusbase[0x10] & 0x20) { m_yScale = (((m_zeusbase[0x39] >> 16) & 0xfff) < 0x100) ? 0 : 1; int hor = ((m_zeusbase[0x34] & 0xffff) - (m_zeusbase[0x33] >> 16)) << m_yScale; int ver = ((m_zeusbase[0x35] & 0xffff) + 1) << m_yScale; popmessage("reg[30]: %08X Screen: %dH X %dV yScale: %d", m_zeusbase[0x30], hor, ver, m_yScale); - } - m_screen->update_partial(m_screen->vpos()); - { int vtotal = (m_zeusbase[0x37] & 0xffff) << m_yScale; int htotal = (m_zeusbase[0x34] >> 16) << m_yScale; - rectangle visarea((m_zeusbase[0x33] >> 16) << m_yScale, htotal - 1, 0, (m_zeusbase[0x35] & 0xffff) << m_yScale); - if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) - { - m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)ZEUS2_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); - zeus_cliprect = visarea; - zeus_cliprect.max_x -= zeus_cliprect.min_x; - zeus_cliprect.min_x = 0; - // Startup vblank timer - vblank_timer->adjust(attotime::from_usec(1)); - } + //rectangle visarea((m_zeusbase[0x33] >> 16) << m_yScale, htotal - 1, 0, (m_zeusbase[0x35] & 0xffff) << m_yScale); + rectangle visarea(0, hor-1, 0, ver-1); + m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)ZEUS2_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); + zeus_cliprect = visarea; + zeus_cliprect.max_x -= zeus_cliprect.min_x; + zeus_cliprect.min_x = 0; + // Startup vblank timer + vblank_timer->adjust(attotime::from_usec(1)); } break; - case 0x33: - case 0x34: - case 0x35: - case 0x36: - case 0x37: + case 0x11: + if (logit) logerror("\tHost Interface Setup"); break; + case 0x12: + if (logit) logerror("\tPLL Setup"); + break; + + case 0x13: + if (logit) logerror("\tZeus Test Out"); + break; + + case 0x20: + zeus2_pointer_write(m_zeusbase[0x20] >> 24, (m_zeusbase[0x20] & 0xffffff), logit); + break; + + case 0x22: + if (logit) logerror("\tRend Setup 0"); + break; + + case 0x23: + if (logit) logerror("\tRend Setup 1"); + break; + + case 0x24: + // 0x601 == test mode + if (logit) logerror("\tRend Setup 4"); + break; + + case 0x2a: + // 0x000000c0 = bilenear off + if (logit) logerror("\tRend Force Off"); + break; + + case 0x2b: + if (logit) logerror("\tRend Force On"); + break; + + case 0x2c: + if (logit) logerror("\tRend AE Flag"); + break; + + case 0x2d: + if (logit) logerror("\tRend AF Flag"); + break; + + case 0x2f: + if (logit) logerror("\tPixel Proc Setup"); + break; + + + case 0x30: + if (logit) logerror("\tCRT Controller Setup = %08X", m_zeusbase[offset]); + break; + + case 0x31: + if (logit) logerror("\tDotClk Sel 1 : DotClk Sel 2 = %08X", m_zeusbase[offset]); + break; + case 0x32: + if (logit) logerror("\tHSync End = %i HSync Start = %i", (m_zeusbase[offset] >> 16), m_zeusbase[offset] & 0xffff); + break; + case 0x33: + if (logit) logerror("\tHBlank End = %i Update Start = %i", (m_zeusbase[offset] >> 16), m_zeusbase[offset] & 0xffff); + break; + case 0x34: + if (logit) logerror("\tHTotal = %i HBlank Start = %i", (m_zeusbase[offset] >> 16), m_zeusbase[offset] & 0xffff); + break; + case 0x35: + if (logit) logerror("\tVSync Start = %i VBlank Start = %i", (m_zeusbase[offset] >> 16), m_zeusbase[offset] & 0xffff); + break; + case 0x36: + if (logit) logerror("\tVTotal = %i VSync End = %i", (m_zeusbase[offset] >> 16), m_zeusbase[offset] & 0xffff); + break; + case 0x37: + if (logit) logerror("\tVTotal = %i", m_zeusbase[offset]); + break; case 0x38: { uint32_t temp = m_zeusbase[0x38]; @@ -492,6 +507,9 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log m_zeusbase[0x38] = temp; } break; + case 0x39: + if (logit) logerror("\tLine Length = %i FIFO AF = %i FIFO AE = %i", (m_zeusbase[offset] >> 16) & 0xfff, (m_zeusbase[offset] >> 8) & 0xff, m_zeusbase[offset] & 0xff); + break; case 0x40: { @@ -511,24 +529,30 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log m_zeusbase[0x41] &= ~0xfc00; } } - // mwskinsa 0xE085001F -- light table? - // thegrid 0x0055002C ??? - // crusnexo 0x005500FF ??? - // crusnexo 0x00A20000 ??? + } + else if (code == 0x4) { + // Load pal table from RGB555 + if (logit) + logerror("\t-- pal table rgb555 load: control: %08X addr: %08X", m_zeusbase[0x40], m_zeusbase[0x41]); + poly->wait("PAL_TABLE_WRITE"); + m_curPalTableSrc = m_zeusbase[0x41]; + void *dataPtr = waveram0_ptr_from_expanded_addr(m_zeusbase[0x41]); + load_pal_table(dataPtr, m_zeusbase[0x40], 0, logit); } else if (code == 0x5) { - // Zeus burst from waveram + // Zeus microcode burst from waveram if (logit) logerror("\t-- ucode load: control: %08X addr: %08X", m_zeusbase[0x40], m_zeusbase[0x41]); // Load ucode from waveram poly->wait("UCODE_LOAD"); void *dataPtr = waveram0_ptr_from_expanded_addr(m_zeusbase[0x41]); load_ucode(dataPtr, m_zeusbase[0x40], logit); - if (((m_zeusbase[0x40] >> 24) & 0xff) == 0xc0) { + if (((m_zeusbase[0x40] >> 24) & 0xff) >= 0xc0) { // Light table load if (logit) logerror("\t-- light table loaded"); } else { + m_curUCodeSrc = m_zeusbase[0x41]; // Zeus Quad Size switch (m_zeusbase[0x40]) { case 0x38550083: case 0x2D550083: case 0x3885007B: @@ -568,13 +592,8 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log logerror("\n"); } } - else if (code == 0x4) { - // Load pal table from RGB555 - if (logit) - logerror("\t-- pal table rgb555 load: control: %08X addr: %08X", m_zeusbase[0x40], m_zeusbase[0x41]); - poly->wait("PAL_TABLE_WRITE"); - void *dataPtr = waveram0_ptr_from_expanded_addr(m_zeusbase[0x41]); - load_pal_table(dataPtr, m_zeusbase[0x40], 0, logit); + else if (code == 0x6) { + // Zeus model fifo burst from waveram } else { if (logit) @@ -638,65 +657,67 @@ void zeus2_device::zeus2_register_update(offs_t offset, uint32_t oldval, int log break; case 0x50: - if (m_zeusbase[0x50] == 0x00510000) { - // SGRAM Special Mode Register Write - if (m_zeusbase[0x51] == 0x00200000) { - // SGRAM Mask Register - if ((m_zeusbase[0x58] & m_zeusbase[0x59] & m_zeusbase[0x5a]) != 0xffffffff) - logerror("zeus2_register_update: Warning! Mask Register not equal to 0xffffffff\n"); + { + int code = (m_zeusbase[0x50] >> 16) & 0xf; + + if (code == 0x1) { + // SGRAM Special Mode Register Write + if (m_zeusbase[0x51] == 0x00200000) { + // SGRAM Mask Register + if ((m_zeusbase[0x58] & m_zeusbase[0x59] & m_zeusbase[0x5a]) != 0xffffffff) + logerror("zeus2_register_update: Warning! Mask Register not equal to 0xffffffff\n"); + } + if (m_zeusbase[0x51] == 0x00400000) { + // SGRAM Color Register + m_fill_color = m_zeusbase[0x58]; + m_fill_depth = ((m_zeusbase[0x5a] & 0xffff) << 16) | ((m_zeusbase[0x58] >> 24) << 8); + m_fill_depth >>= 8; // Sign extend down to 24 bits + if (m_zeusbase[0x58] != m_zeusbase[0x59]) + logerror("zeus2_register_update: Warning! Different fill colors are set.\n"); + } } - if (m_zeusbase[0x51] == 0x00400000) { - // SGRAM Color Register - m_fill_color = m_zeusbase[0x58]; - m_fill_depth = ((m_zeusbase[0x5a] & 0xffff) << 16) | ((m_zeusbase[0x58]>>24)<<8); - m_fill_depth >>= 8; // Sign extend down to 24 bits - if (m_zeusbase[0x58] != m_zeusbase[0x59]) - logerror("zeus2_register_update: Warning! Different fill colors are set.\n"); + else if (code == 0x8) { + // Fast fill + // Unknown what the exact bit fields are, this is a just a guess + // Atlantis: 0x00983FFF => clear entire frame buffer, 0x00981FFF => clear one frame + // crusnexo: 0x007831FF => clear one frame + // thegrid: 0x008831FF => clear one frame + // thegrid: 0x0079FFFF => clear entire frame buffer at 51=0 then 51=00800000, only seen at initial tests in thegrid + uint32_t addr = frame_addr_from_phys_addr(m_zeusbase[0x51]); + uint32_t numBytes = (m_zeusbase[0x50] & 0xffff) + 1; + numBytes *= 0x40; + if (m_zeusbase[0x50] & 0x10000) { + addr = 0x0; + numBytes = WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8; + //printf("Clearing buffer: numBytes: %08X addr: %08X reg50: %08X\n", numBytes, addr, m_zeusbase[0x50]); + } + if (logit) + logerror(" -- Clearing buffer: numBytes: %08X addr: %08X reg51: %08X", numBytes, addr, m_zeusbase[0x51]); + memset(&m_frameColor[addr], m_fill_color, numBytes); + memset(&m_frameDepth[addr], m_fill_depth, numBytes); } - } - //else if (1 && ((m_zeusbase[0x50] & 0x000f0000)==0x80000) && (m_zeusbase[0x50] & 0xffff)) { - else if ((m_zeusbase[0x50] & 0x80000) && (m_zeusbase[0x50] & 0xffff)) { - // Fast fill - // Unknown what the exact bit fields are, this is a just a guess - // Atlantis: 0x00983FFF => clear entire frame buffer, 0x00981FFF => clear one frame - // crusnexo: 0x007831FF => clear one frame - // thegrid: 0x008831FF => clear one frame - // thegrid: 0x0079FFFF => clear entire frame buffer at 51=0 then 51=00800000, only seen at initial tests in thegrid - uint32_t addr = frame_addr_from_phys_addr(m_zeusbase[0x51]); - uint32_t numBytes = (m_zeusbase[0x50] & 0xffff) + 1; - numBytes *= 0x40; - if (m_zeusbase[0x50] & 0x10000) { - addr = 0x0; - numBytes = WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8; - //printf("Clearing buffer: numBytes: %08X addr: %08X reg50: %08X\n", numBytes, addr, m_zeusbase[0x50]); + else if ((m_zeusbase[0x5e] >> 16) != 0xf208 && !(m_zeusbase[0x5e] & 0xffff)) { + /* If 0x5e==0xf20a0000 (atlantis) or 0xf20d0000 (the grid) then process the read/write now */ + /* + m_zeusbase[0x5e]: + bit 0-1: which register triggers write through + bit 3: enable write through via these registers + bit 4: seems to be set during reads, when 0x51 is used for latching + bit 5: unknown, currently used to specify ordering, but this is suspect + bit 6: enable autoincrement on write through + */ + if (code == 0x9) + { + frame_write(); + } + else if (code == 0x2) { + /* Do the read */ + frame_read(); + } + /* make sure we log anything else */ + //else if (logit || m_zeusbase[0x50] != 0x0) + // logerror("\tw[50]=%08X [5E]=%08X\n", m_zeusbase[0x50], m_zeusbase[0x5e]); } - if (logit) - logerror(" -- Clearing buffer: numBytes: %08X addr: %08X reg51: %08X", numBytes, addr, m_zeusbase[0x51]); - memset(&m_frameColor[addr], m_fill_color, numBytes); - memset(&m_frameDepth[addr], m_fill_depth, numBytes); - } - else if ((m_zeusbase[0x5e] >> 16) != 0xf208 && !(m_zeusbase[0x5e] & 0xffff)) { - /* If 0x5e==0xf20a0000 (atlantis) or 0xf20d0000 (the grid) then process the read/write now */ - /* - m_zeusbase[0x5e]: - bit 0-1: which register triggers write through - bit 3: enable write through via these registers - bit 4: seems to be set during reads, when 0x51 is used for latching - bit 5: unknown, currently used to specify ordering, but this is suspect - bit 6: enable autoincrement on write through - */ - //if (m_zeusbase[0x50] == 0x00890000) - if ((m_zeusbase[0x50] == 0x00890000) || (m_zeusbase[0x50] == 0x00e90000)) - { - frame_write(); - } - else if (m_zeusbase[0x50] == 0x00720000) { - /* Do the read */ - frame_read(); - } - /* make sure we log anything else */ - //else if (logit || m_zeusbase[0x50] != 0x0) - // logerror("\tw[50]=%08X [5E]=%08X\n", m_zeusbase[0x50], m_zeusbase[0x5e]); } break; case 0x51: @@ -939,17 +960,19 @@ if (subregdata_count[which] < 256) switch (which) { case 0x01: - // Limit to 16 bits - m_renderRegs[which] &= 0xffff; + // Limit to 12 bits + m_renderRegs[which] &= 0xfff; + zeus_cliprect.max_x = m_renderRegs[which]; if (logit) - logerror("\t(R%02X) = %4i Rend XClip", which & 0xffff, value); + logerror("\t(R%02X) = %4i Rend XClip", which & 0xfff, value); break; case 0x02: - // Limit to 16 bits - m_renderRegs[which] &= 0xffff; + // Limit to 12 bits + m_renderRegs[which] &= 0xfff; + zeus_cliprect.max_y = m_renderRegs[which]; if (logit) - logerror("\t(R%02X) = %4i Rend YClip", which & 0xffff, value); + logerror("\t(R%02X) = %4i Rend YClip", which & 0xfff, value); break; case 0x03: @@ -970,7 +993,7 @@ if (subregdata_count[which] < 256) case 0x07: if (logit) - logerror("\t(R%02X) texel mask = %06x", which, zeus_texbase); + logerror("\t(R%02X) Texel Mask = %06x", which, value); break; case 0x08: @@ -980,72 +1003,61 @@ if (subregdata_count[which] < 256) void *dataPtr = (void *)(&waveram[blockNum * 2]); if (logit) logerror("\t(R%02X) = %06x PAL Control Load Table Byte Addr = %08X", which, value, blockNum * 8); + m_curPalTableSrc = m_renderRegs[0x9]; load_pal_table(dataPtr, m_renderRegs[0x8], 0, logit); } break; case 0x09: - if (logit) - logerror("\t(R%02X) = %06x PAL Addr", which, value); + if (logit) logerror("\t(R%02X) = %06x PAL Addr", which, value); break; case 0x0a: - if (logit) - logerror("\t(R%02X) = %4i Pixel ALU IntA", which, value); + if (logit) logerror("\t(R%02X) = %4i Pixel ALU IntA", which, value); break; case 0x0b: - if (logit) - logerror("\t(R%02X) = %4i Pixel ALU IntB", which, value); + if (logit) logerror("\t(R%02X) = %4i Pixel ALU IntB", which, value); break; case 0x0c: - if (logit) - logerror("\t(R%02X) = %4i Pixel ALU IntC (Translucency FG)", which, value); + if (logit) logerror("\t(R%02X) = %4i Pixel ALU IntC (Translucency FG)", which, value); break; case 0x0d: - if (logit) - logerror("\t(R%02X) = %4i Pixel ALU IntD (Translucency BG)", which, value); + if (logit) logerror("\t(R%02X) = %4i Pixel ALU IntD (Translucency BG)", which, value); break; case 0x11: - if (logit) - logerror("\t(R%02X) Texel Setup = %06x", which, zeus_texbase); + if (logit) logerror("\t(R%02X) Texel Setup = %06x", which, value); break; case 0x12: - if (logit) - logerror("\t(R%02X) Pixel FIFO Setup = %06x", which, value); + if (logit) logerror("\t(R%02X) Pixel FIFO Setup = %06x", which, value); break; case 0x14: - if (logit) - logerror("\t(R%02X) = %06x ZBuf Control", which, value); + if (logit) logerror("\t(R%02X) = %06x ZBuf Control", which, value); break; case 0x15: m_zbufmin = int32_t((value & 0xffffff) << 8) >> 8; - if (logit) - logerror("\t(R%02X) = %d zbufmin", which, m_zbufmin / 4096.0f); + if (logit) logerror("\t(R%02X) = %d ZBuf Min", which, m_zbufmin / 4096.0f); break; case 0x40: // 0x004000 no shading // 0x024004 gouraud shading - if (logit) - logerror("\t(R%02X) = %06x Pixel ALU Control", which, value); + if (logit) logerror("\t(R%02X) = %06x Pixel ALU Control", which, value); break; case 0xff: // Reset??? - if (logit) - logerror("\tRender Reset"); + if (logit) logerror("\tRender Reset"); break; default: - if (logit) - logerror("\t(R%02X) = %06x", which, value); + if (logit) logerror("\t(R%02X) = %06x", which, value); break; @@ -1134,10 +1146,10 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) } break; - // 0x14: ?? atlantis /* 0x15: set point only (thegrid) */ /* 0x16: set point only (crusnexo) */ - case 0x14: + // 0x10: atlantis + case 0x10: case 0x15: case 0x16: if (numwords < 4) @@ -1159,6 +1171,8 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) break; // 0x1c: thegrid (3 words) + // 0x14: atlantis + case 0x14: case 0x1c: if (m_thegrid) { if (numwords < 3) @@ -1169,8 +1183,6 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) } // 0x1b: thegrid // 0x1c: crusnexo (4 words) - // 0x10: atlantis??? - case 0x10: case 0x1b: if (numwords < 4) return false; @@ -1276,7 +1288,7 @@ void zeus2_device::zeus2_draw_model(uint32_t baseaddr, uint16_t count, int logit uint32_t texdata = 0; if (logit) - logerror(" -- model @ %08X, len %04X\n", baseaddr, count); + logerror(" -- model @ %08X, len %04X, palSrc %08x, rendSrc %08x\n", baseaddr, count, m_curPalTableSrc, m_curUCodeSrc); if (count > 0xc800) fatalerror("Extreme count\n"); @@ -1507,26 +1519,26 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat vert[0].x = (int16_t)databuffer[2]; vert[0].y = (int16_t)databuffer[3]; vert[0].p[0] = (int16_t)databuffer[4]; - vert[0].p[1] = (databuffer[5] >> 0) & 0xff; - vert[0].p[2] = (databuffer[5] >> 8) & 0xff; + vert[0].p[1] = ((databuffer[5] >> 0) & 0xff) << 2; + vert[0].p[2] = ((databuffer[5] >> 8) & 0xff) << 2; vert[1].x = (int16_t)(databuffer[2] >> 16); vert[1].y = (int16_t)(databuffer[3] >> 16); vert[1].p[0] = (int16_t)(databuffer[4] >> 16); - vert[1].p[1] = (databuffer[5] >> 16) & 0xff; - vert[1].p[2] = (databuffer[5] >> 24) & 0xff; + vert[1].p[1] = ((databuffer[5] >> 16) & 0xff) << 2; + vert[1].p[2] = ((databuffer[5] >> 24) & 0xff) << 2; vert[2].x = (int16_t)databuffer[6]; vert[2].y = (int16_t)databuffer[7]; vert[2].p[0] = (int16_t)databuffer[8]; - vert[2].p[1] = (databuffer[9] >> 0) & 0xff; - vert[2].p[2] = (databuffer[9] >> 8) & 0xff; + vert[2].p[1] = ((databuffer[9] >> 0) & 0xff) << 2; + vert[2].p[2] = ((databuffer[9] >> 8) & 0xff) << 2; vert[3].x = (int16_t)(databuffer[6] >> 16); vert[3].y = (int16_t)(databuffer[7] >> 16); vert[3].p[0] = (int16_t)(databuffer[8] >> 16); - vert[3].p[1] = (databuffer[9] >> 16) & 0xff; - vert[3].p[2] = (databuffer[9] >> 24) & 0xff; + vert[3].p[1] = ((databuffer[9] >> 16) & 0xff) << 2; + vert[3].p[2] = ((databuffer[9] >> 24) & 0xff) << 2; } else { //printf("R40: %06X\n", m_state->m_renderRegs[0x40]); @@ -1726,7 +1738,7 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat //extra.texwidth = 2 << ((texmode >> 2) & 7); extra.texwidth = 0x20 << ((texmode >> 2) & 3); //extra.texwidth = 0x2 << ((texmode >> 2) & 0xf); - + //if (m_state->m_palSize == 16) extra.texwidth *= 2; //switch (texmode) //{ //case 0x14d: // atlantis @@ -1779,7 +1791,7 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat extra.solidcolor = 0;//m_zeusbase[0x00] & 0x7fff; extra.zbufmin = m_state->m_zbufmin; extra.alpha = 0;//m_zeusbase[0x4e]; - extra.transcolor = 0x100; // !(texmode & 100) ? 0 : 0x100; + extra.transcolor = 0x100; // (texmode & 0x100) ? 0 : 0x100; extra.texbase = WAVERAM_BLOCK0_EXT(m_state->zeus_texbase); extra.palbase = m_state->waveram0_ptr_from_expanded_addr(m_state->m_zeusbase[0x41]); //extra.depth_test_enable = !(m_state->m_renderRegs[0x40] & 0x020000); @@ -1844,12 +1856,12 @@ void zeus2_renderer::render_poly_8bit(int32_t scanline, const extent_t& extent, int u1 = (u0 + 1); int v1 = (v0 + 1); uint8_t texel0 = object.get_texel(texbase, v0, u0, texwidth); - //if (texel0 == object.transcolor) - // continue; + if (texel0 == transcolor) + continue; uint8_t texel1 = object.get_texel(texbase, v0, u1, texwidth); uint8_t texel2 = object.get_texel(texbase, v1, u0, texwidth); uint8_t texel3 = object.get_texel(texbase, v1, u1, texwidth); - if (texel0 != transcolor) + //if (texel0 != transcolor) { uint32_t color0 = m_state->m_pal_table[texel0]; uint32_t color1 = m_state->m_pal_table[texel1]; diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index 0b7b14c9b72..5d6cfe4fafc 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -145,6 +145,8 @@ public: std::unique_ptr m_frameDepth; uint32_t m_pal_table[0x100]; uint32_t m_ucode[0x200]; + uint32_t m_curUCodeSrc; + uint32_t m_curPalTableSrc; emu_timer *int_timer; emu_timer *vblank_timer; @@ -353,6 +355,7 @@ public: static inline uint8_t get_texel_4bit(const void *base, int y, int x, int width) { uint32_t byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3); + //uint32_t byteoffs = (y / 4) * (width * 4) + ((x / 4) << 3) + ((y & 3) << 1) + ((x / 2) & 1); return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f; } diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp index f3e62c7032b..df6715e208c 100644 --- a/src/mame/drivers/atlantis.cpp +++ b/src/mame/drivers/atlantis.cpp @@ -371,7 +371,7 @@ WRITE32_MEMBER(atlantis_state::status_leds_w) } //popmessage("LED: %c", digit); osd_printf_debug("%06X: status_leds_w digit: %c %08x = %02x\n", machine().device("maincpu")->safe_pc(), digit, offset, data); - logerror("%06X: status_leds_w digit: %c %08x = %02x\n", machine().device("maincpu")->safe_pc(), digit, offset, data); + if (0) logerror("%06X: status_leds_w digit: %c %08x = %02x\n", machine().device("maincpu")->safe_pc(), digit, offset, data); } } } From f0bceea10504e1b160305098157372e856c65120 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 11 Dec 2016 14:38:36 -0500 Subject: [PATCH 61/82] equites.cpp: Use 8155 device (nw) --- src/mame/drivers/equites.cpp | 84 +++++++++++++++--------------------- src/mame/includes/equites.h | 6 +-- 2 files changed, 38 insertions(+), 52 deletions(-) diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp index cacf60c5d19..4c108332c09 100644 --- a/src/mame/drivers/equites.cpp +++ b/src/mame/drivers/equites.cpp @@ -169,8 +169,6 @@ TODO: - bassline imperfect. This is just the square wave output of the 5232 at the moment. It should go through analog stages. -- properly emulate the 8155 on the sound board. - - implement low-pass filters on the DAC output - the purpose of the sound PROM is unclear. From the schematics, it seems it @@ -365,6 +363,7 @@ D #include "cpu/alph8201/alph8201.h" #include "cpu/i8085/i8085.h" #include "cpu/m68000/m68000.h" +#include "machine/i8155.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "sound/ay8910.h" @@ -385,9 +384,10 @@ D /******************************************************************************/ // Sound -TIMER_CALLBACK_MEMBER(equites_state::equites_nmi_callback) +WRITE_LINE_MEMBER(equites_state::equites_8155_timer_pulse) { - m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + if (!state) // active low + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } TIMER_CALLBACK_MEMBER(equites_state::equites_frq_adjuster_callback) @@ -518,12 +518,35 @@ WRITE8_MEMBER(equites_state::equites_dac_latch_w) equites_update_dac(); } +WRITE8_MEMBER(equites_state::equites_8155_porta_w) +{ + m_eq8155_port_a = data; + m_msm->set_output_gain(0, (data >> 4) / 15.0); /* group1 from msm5232 */ + m_msm->set_output_gain(1, (data >> 4) / 15.0); /* group1 from msm5232 */ + m_msm->set_output_gain(2, (data >> 4) / 15.0); /* group1 from msm5232 */ + m_msm->set_output_gain(3, (data >> 4) / 15.0); /* group1 from msm5232 */ + m_msm->set_output_gain(4, (data & 0x0f) / 15.0); /* group2 from msm5232 */ + m_msm->set_output_gain(5, (data & 0x0f) / 15.0); /* group2 from msm5232 */ + m_msm->set_output_gain(6, (data & 0x0f) / 15.0); /* group2 from msm5232 */ + m_msm->set_output_gain(7, (data & 0x0f) / 15.0); /* group2 from msm5232 */ +} + WRITE8_MEMBER(equites_state::equites_8155_portb_w) { m_eq8155_port_b = data; equites_update_dac(); } +WRITE8_MEMBER(equites_state::equites_8155_portc_w) +{ + m_eq8155_port_c = data; + m_msm->set_output_gain(8, (data & 0x0f) / 15.0); /* SOLO 8' from msm5232 */ + if (data & 0x20) + m_msm->set_output_gain(9, (data & 0x0f) / 15.0); /* SOLO 16' from msm5232 */ + else + m_msm->set_output_gain(9, 0); /* SOLO 16' from msm5232 */ +} + WRITE_LINE_MEMBER(equites_state::equites_msm5232_gate) { } @@ -555,47 +578,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(equites_state::splndrbt_scanline) m_maincpu->set_input_line(2, HOLD_LINE); } -WRITE8_MEMBER(equites_state::equites_8155_w) -{ - // FIXME proper 8155 emulation must be implemented - switch( offset ) - { - case 0: //logerror( "8155 Command register write %x, timer command = %x, interrupt enable = %x, ports = %x\n", data, (data >> 6) & 3, (data >> 4) & 3, data & 0xf ); - if (((data >> 6) & 3) == 3) - m_nmi_timer->adjust(attotime::from_hz(XTAL_6_144MHz/2 / m_timer_count), 0, attotime::from_hz(XTAL_6_144MHz/2 / m_timer_count)); - break; - case 1: //logerror( "8155 I/O Port A write %x\n", data ); - m_eq8155_port_a = data; - m_msm->set_output_gain(0, (data >> 4) / 15.0); /* group1 from msm5232 */ - m_msm->set_output_gain(1, (data >> 4) / 15.0); /* group1 from msm5232 */ - m_msm->set_output_gain(2, (data >> 4) / 15.0); /* group1 from msm5232 */ - m_msm->set_output_gain(3, (data >> 4) / 15.0); /* group1 from msm5232 */ - m_msm->set_output_gain(4, (data & 0x0f) / 15.0); /* group2 from msm5232 */ - m_msm->set_output_gain(5, (data & 0x0f) / 15.0); /* group2 from msm5232 */ - m_msm->set_output_gain(6, (data & 0x0f) / 15.0); /* group2 from msm5232 */ - m_msm->set_output_gain(7, (data & 0x0f) / 15.0); /* group2 from msm5232 */ - break; - case 2: //logerror( "8155 I/O Port B write %x\n", data ); - equites_8155_portb_w(space, 0, data); - break; - case 3: //logerror( "8155 I/O Port C (or control) write %x\n", data ); - m_eq8155_port_c = data; - m_msm->set_output_gain(8, (data & 0x0f) / 15.0); /* SOLO 8' from msm5232 */ - if (data & 0x20) - m_msm->set_output_gain(9, (data & 0x0f) / 15.0); /* SOLO 16' from msm5232 */ - else - m_msm->set_output_gain(9, 0); /* SOLO 16' from msm5232 */ - - break; - case 4: //logerror( "8155 Timer low 8 bits write %x\n", data ); - m_timer_count = (m_timer_count & 0xff00) | data; - break; - case 5: //logerror( "8155 Timer high 6 bits write %x, timer mode %x\n", data & 0x3f, (data >> 6) & 3); - m_timer_count = (m_timer_count & 0x00ff) | ((data & 0x3f) << 8); - break; - } -} - /******************************************************************************/ @@ -717,11 +699,11 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, equites_state ) AM_RANGE(0xc0d0, 0xc0d0) AM_WRITE(equites_dac_latch_w) // followed by 1 (and usually 0) on 8155 port B AM_RANGE(0xc0e0, 0xc0e0) AM_WRITE(equites_dac_latch_w) // followed by 2 (and usually 0) on 8155 port B AM_RANGE(0xc0f8, 0xc0ff) AM_WRITE(equites_c0f8_w) - AM_RANGE(0xe000, 0xe0ff) AM_RAM + AM_RANGE(0xe000, 0xe0ff) AM_DEVREADWRITE("audio8155", i8155_device, memory_r, memory_w) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, equites_state ) - AM_RANGE(0x00e0, 0x00e5) AM_WRITE(equites_8155_w) + AM_RANGE(0x00e0, 0x00e7) AM_DEVREADWRITE("audio8155", i8155_device, io_r, io_w) ADDRESS_MAP_END @@ -1056,6 +1038,12 @@ static MACHINE_CONFIG_FRAGMENT( common_sound ) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_CPU_IO_MAP(sound_portmap) + MCFG_DEVICE_ADD("audio8155", I8155, XTAL_6_144MHz/2) + MCFG_I8155_OUT_PORTA_CB(WRITE8(equites_state, equites_8155_porta_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(equites_state, equites_8155_portb_w)) + MCFG_I8155_OUT_PORTC_CB(WRITE8(equites_state, equites_8155_portc_w)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(equites_state, equites_8155_timer_pulse)) + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("speaker") @@ -1133,8 +1121,6 @@ void equites_state::machine_start() save_item(NAME(m_timer_count)); save_item(NAME(m_gekisou_unknown_bit)); - m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(equites_state::equites_nmi_callback), this)); - m_adjuster_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(equites_state::equites_frq_adjuster_callback), this)); m_adjuster_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); } diff --git a/src/mame/includes/equites.h b/src/mame/includes/equites.h index e30699f0317..5de0b388de1 100644 --- a/src/mame/includes/equites.h +++ b/src/mame/includes/equites.h @@ -60,7 +60,6 @@ public: uint8_t m_ay_port_a; uint8_t m_ay_port_b; uint8_t m_eq_cymbal_ctrl; - emu_timer *m_nmi_timer; emu_timer *m_adjuster_timer; float m_cymvol; float m_hihatvol; @@ -84,8 +83,9 @@ public: DECLARE_WRITE8_MEMBER(equites_c0f8_w); DECLARE_WRITE8_MEMBER(equites_cymbal_ctrl_w); DECLARE_WRITE8_MEMBER(equites_dac_latch_w); + DECLARE_WRITE8_MEMBER(equites_8155_porta_w); DECLARE_WRITE8_MEMBER(equites_8155_portb_w); - DECLARE_WRITE8_MEMBER(equites_8155_w); + DECLARE_WRITE8_MEMBER(equites_8155_portc_w); DECLARE_WRITE16_MEMBER(gekisou_unknown_bit_w); DECLARE_READ16_MEMBER(equites_spriteram_kludge_r); DECLARE_READ8_MEMBER(mcu_ram_r); @@ -117,7 +117,7 @@ public: DECLARE_PALETTE_INIT(splndrbt); uint32_t screen_update_equites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_splndrbt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(equites_nmi_callback); + DECLARE_WRITE_LINE_MEMBER(equites_8155_timer_pulse); TIMER_CALLBACK_MEMBER(equites_frq_adjuster_callback); TIMER_DEVICE_CALLBACK_MEMBER(equites_scanline); TIMER_DEVICE_CALLBACK_MEMBER(splndrbt_scanline); From 95d24633de351373e95e656cd631c6dc28ab0289 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 11 Dec 2016 18:19:50 -0500 Subject: [PATCH 62/82] Attempt at fixing 8155 timer behavior so 8085 doesn't lose interrupts in equites --- src/devices/machine/i8155.cpp | 47 ++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/devices/machine/i8155.cpp b/src/devices/machine/i8155.cpp index 74989e51f81..aca33145518 100644 --- a/src/devices/machine/i8155.cpp +++ b/src/devices/machine/i8155.cpp @@ -294,18 +294,9 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param, { if (LOG) logerror("8155 Timer Count Reached\n"); - switch (m_command & COMMAND_TM_MASK) - { - case COMMAND_TM_STOP_AFTER_TC: - // stop timer - m_timer->enable(0); - - if (LOG) logerror("8155 Timer Stopped\n"); - break; - } - switch (get_timer_mode()) { + case TIMER_MODE_LOW: case TIMER_MODE_SQUARE_WAVE: // toggle timer output m_to = !m_to; @@ -313,15 +304,8 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param, break; case TIMER_MODE_SINGLE_PULSE: - // single pulse upon TC being reached - pulse_timer_output(); - - // clear timer mode setting - m_command &= ~COMMAND_TM_MASK; - break; - case TIMER_MODE_AUTOMATIC_RELOAD: - // automatic reload, i.e. single pulse every time TC is reached + // pulse upon TC being reached pulse_timer_output(); break; } @@ -329,8 +313,28 @@ void i8155_device::device_timer(emu_timer &timer, device_timer_id id, int param, // set timer flag m_status |= STATUS_TIMER; - // reload timer counter - m_counter = m_count_length & 0x3fff; + if ((m_command & COMMAND_TM_MASK) == COMMAND_TM_START) + { + // load new timer counter + m_counter = m_count_length & 0x3fff; + + if (LOG) logerror("8155 Timer New Start\n"); + } + else if ((m_command & COMMAND_TM_MASK) == COMMAND_TM_STOP_AFTER_TC || get_timer_mode() == TIMER_MODE_SINGLE_PULSE) + { + // stop timer + m_timer->enable(0); + + if (LOG) logerror("8155 Timer Stopped\n"); + } + else + { + // automatically reload the counter + m_counter = m_count_length & 0x3fff; + } + + // clear timer command + m_command &= ~COMMAND_TM_MASK; } } @@ -455,6 +459,9 @@ void i8155_device::register_w(int offset, uint8_t data) // load mode and CNT length and start immediately after loading (if timer is not running) m_counter = m_count_length & 0x3fff; m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock())); + + // clear timer command so this won't execute twice + m_command &= ~COMMAND_TM_MASK; } break; } From 92ce7cd13c68c063b1b03d1f7f7c6dac4f77dd4e Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 12 Dec 2016 01:07:45 +0100 Subject: [PATCH 63/82] beezer: Rewrite driver - Uses the standard 6840 PTM core for sound generation - New MM583 Noise Generator device - New DAC-76 DAC sound - Use resistor network values for colors - Use bankdev device for banking --- scripts/src/sound.lua | 23 ++ scripts/target/mame/arcade.lua | 6 +- scripts/target/mame/mess.lua | 2 + src/devices/sound/dac76.cpp | 91 +++++ src/devices/sound/dac76.h | 76 +++++ src/devices/sound/mm5837.cpp | 90 +++++ src/devices/sound/mm5837.h | 81 +++++ src/mame/audio/beezer.cpp | 482 -------------------------- src/mame/drivers/beezer.cpp | 599 ++++++++++++++++++++++++++++----- src/mame/includes/beezer.h | 123 ------- src/mame/machine/beezer.cpp | 144 -------- src/mame/video/beezer.cpp | 75 ----- 12 files changed, 872 insertions(+), 920 deletions(-) create mode 100644 src/devices/sound/dac76.cpp create mode 100644 src/devices/sound/dac76.h create mode 100644 src/devices/sound/mm5837.cpp create mode 100644 src/devices/sound/mm5837.h delete mode 100644 src/mame/audio/beezer.cpp delete mode 100644 src/mame/includes/beezer.h delete mode 100644 src/mame/machine/beezer.cpp delete mode 100644 src/mame/video/beezer.cpp diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua index fc555804072..ab05c06847c 100644 --- a/scripts/src/sound.lua +++ b/scripts/src/sound.lua @@ -1401,3 +1401,26 @@ if (SOUNDS["VOLT_REG"]~=null) then MAME_DIR .. "src/devices/sound/volt_reg.h", } end + +--------------------------------------------------- +-- DAC-76 COMDAC +--@src/devices/sound/dac76.h,SOUNDS["DAC76"] = true +--------------------------------------------------- +if (SOUNDS["DAC76"]~=null) then + files { + MAME_DIR .. "src/devices/sound/dac76.cpp", + MAME_DIR .. "src/devices/sound/dac76.h", + } +end + +--------------------------------------------------- +-- MM5837 Noise Generator +--@src/devices/sound/mm5837.h,MACHINES["MM5837"] = true +--------------------------------------------------- + +if (SOUNDS["MM5837"]~=null) then + files { + MAME_DIR .. "src/devices/sound/mm5837.cpp", + MAME_DIR .. "src/devices/sound/mm5837.h", + } +end diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 0aa2d3af4f0..5bb67032378 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -263,6 +263,8 @@ SOUNDS["AD1848"] = true --SOUNDS["UPD1771"] = true SOUNDS["VOLT_REG"] = true --SOUNDS["MEA8000"] = true +SOUNDS["DAC76"] = true +SOUNDS["MM5837"] = true -------------------------------------------------- -- specify available video cores @@ -3969,10 +3971,6 @@ files { createMAMEProjects(_target, _subtarget, "tong") files { MAME_DIR .. "src/mame/drivers/beezer.cpp", - MAME_DIR .. "src/mame/includes/beezer.h", - MAME_DIR .. "src/mame/machine/beezer.cpp", - MAME_DIR .. "src/mame/video/beezer.cpp", - MAME_DIR .. "src/mame/audio/beezer.cpp", } createMAMEProjects(_target, _subtarget, "unico") diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index c6121b5fe0d..262af489e2a 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -264,6 +264,8 @@ SOUNDS["GB_SOUND"] = true SOUNDS["PCD3311"] = true SOUNDS["VOLT_REG"] = true SOUNDS["MEA8000"] = true +--SOUNDS["DAC76"] = true +--SOUNDS["MM5837"] = true -------------------------------------------------- -- specify available video cores diff --git a/src/devices/sound/dac76.cpp b/src/devices/sound/dac76.cpp new file mode 100644 index 00000000000..965b74473e6 --- /dev/null +++ b/src/devices/sound/dac76.cpp @@ -0,0 +1,91 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + PMI DAC-76 COMDAC + + Companding D/A Converter + +***************************************************************************/ + +#include "dac76.h" + + +//************************************************************************** +// CONSTEXPR DEFINITIONS +//************************************************************************** + +constexpr int dac76_device::m_level[]; + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type DAC76 = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dac76_device - constructor +//------------------------------------------------- + +dac76_device::dac76_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, DAC76, "DAC-76 COMDAC", tag, owner, clock, "dac76", __FILE__), + device_sound_interface(mconfig, *this), + m_stream(nullptr), + m_chord(0), + m_step(0), + m_sb(false) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dac76_device::device_start() +{ + // create sound stream + m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate() * 8); + + // register for save states + save_item(NAME(m_chord)); + save_item(NAME(m_step)); + save_item(NAME(m_sb)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dac76_device::device_reset() +{ + m_chord = 0; + m_step = 0; + m_sb = false; +} + +//------------------------------------------------- +// sound_stream_update - handle update requests for +// our sound stream +//------------------------------------------------- + +void dac76_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // get current output level + int step_size = (2 << m_chord); + stream_sample_t vout = m_level[m_chord] + m_step * step_size; + + // apply sign bit + vout *= (m_sb ? +1 : -1); + + // range is 0-8031, normalize to about 0-32768 range + vout *= 4; + + for (int i = 0; i < samples; i++) + outputs[0][i] = vout; +} diff --git a/src/devices/sound/dac76.h b/src/devices/sound/dac76.h new file mode 100644 index 00000000000..b0086b2885f --- /dev/null +++ b/src/devices/sound/dac76.h @@ -0,0 +1,76 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + PMI DAC-76 COMDAC + + Companding D/A Converter + + ___ ___ + E/D 1 |* u | 10 VLC + SB 2 | | 11 VR+ + B1 3 | | 12 VR- + B2 4 | | 13 V- + B3 5 | | 14 IOE+ + B4 6 | | 15 IOE- + B5 7 | | 16 IOD+ + B6 8 | | 17 IOD- + B7 9 |_______| 18 V+ + +***************************************************************************/ + +#pragma once + +#ifndef __DAC76_H__ +#define __DAC76_H__ + +#include "emu.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class dac76_device : public device_t, public device_sound_interface +{ +public: + // construction/destruction + dac76_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // chord + DECLARE_WRITE_LINE_MEMBER(b1_w) { m_chord &= ~(1 << 2); m_chord |= (state << 2); }; + DECLARE_WRITE_LINE_MEMBER(b2_w) { m_chord &= ~(1 << 1); m_chord |= (state << 1); }; + DECLARE_WRITE_LINE_MEMBER(b3_w) { m_chord &= ~(1 << 0); m_chord |= (state << 0); }; + + // step + DECLARE_WRITE_LINE_MEMBER(b4_w) { m_step &= ~(1 << 3); m_step |= (state << 3); }; + DECLARE_WRITE_LINE_MEMBER(b5_w) { m_step &= ~(1 << 2); m_step |= (state << 2); }; + DECLARE_WRITE_LINE_MEMBER(b6_w) { m_step &= ~(1 << 1); m_step |= (state << 1); }; + DECLARE_WRITE_LINE_MEMBER(b7_w) { m_step &= ~(1 << 0); m_step |= (state << 0); }; + + // sign bit + DECLARE_WRITE_LINE_MEMBER(sb_w) { m_sb = bool(state); }; + + void update() { m_stream->update(); } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; + +private: + static constexpr int m_level[8] = { 0, 33, 99, 231, 495, 1023, 2079, 4191 }; + + sound_stream *m_stream; + + uint8_t m_chord; // 4-bit + uint8_t m_step; // 3-bit + bool m_sb; +}; + +// device type definition +extern const device_type DAC76; + +#endif // __DAC76_H__ diff --git a/src/devices/sound/mm5837.cpp b/src/devices/sound/mm5837.cpp new file mode 100644 index 00000000000..fc700cdd55b --- /dev/null +++ b/src/devices/sound/mm5837.cpp @@ -0,0 +1,90 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + National Semiconductor MM5837 + + Digital Noise Source + +***************************************************************************/ + +#include "mm5837.h" + + +//************************************************************************** +// CONSTEXPR DEFINITIONS +//************************************************************************** + +constexpr int mm5837_device::m_frequency[]; + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type MM5837 = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// mm5837_device - constructor +//------------------------------------------------- + +mm5837_device::mm5837_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, MM5837, "MM5837 Digital Noise Source", tag, owner, clock, "mm5837", __FILE__), + m_output_cb(*this), + m_vdd(0), + m_timer(nullptr), + m_shift(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mm5837_device::device_start() +{ + // resolve callbacks + m_output_cb.resolve_safe(); + + // get timer + m_timer = timer_alloc(0); + + // register for save states + save_item(NAME(m_shift)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mm5837_device::device_reset() +{ + // initialize with something + m_shift = 123456; + + if (m_vdd < 16) + m_timer->adjust(attotime::zero, 0, attotime::from_hz(m_frequency[m_vdd])); + else + throw emu_fatalerror("%s: Invalid voltage: %d\n", tag(), m_vdd); +} + +//------------------------------------------------- +// device_timer - handle timer callbacks +//------------------------------------------------- + +void mm5837_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + int tap_14 = BIT(m_shift, 13); + int tap_17 = BIT(m_shift, 16); + int zero = (m_shift == 0) ? 1 : 0; + + m_shift <<= 1; + m_shift |= tap_14 ^ tap_17 ^ zero; + + m_output_cb(BIT(m_shift, 16)); +} diff --git a/src/devices/sound/mm5837.h b/src/devices/sound/mm5837.h new file mode 100644 index 00000000000..f7d7b18b509 --- /dev/null +++ b/src/devices/sound/mm5837.h @@ -0,0 +1,81 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + National Semiconductor MM5837 + + Digital Noise Source + + ___ ___ + VDD 1 |* u | 5 N/C + VGG 2 | | 6 N/C + OUTPUT 3 | | 7 N/C + VSS 4 |_______| 8 N/C + +***************************************************************************/ + +#pragma once + +#ifndef __MM5837_H__ +#define __MM5837_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MM5837_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, MM5837, 0) + +#define MCFG_MM5837_VDD(_voltage) \ + mm5837_device::set_vdd_voltage(*device, _voltage); + +#define MCFG_MM5837_OUTPUT_CB(_devcb) \ + devcb = &mm5837_device::set_output_callback(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class mm5837_device : public device_t +{ +public: + // construction/destruction + mm5837_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // configuration + static void set_vdd_voltage(device_t &device, int voltage) { downcast(device).m_vdd = voltage; } + template static devcb_base &set_output_callback(device_t &device, _Object object) + { return downcast(device).m_output_cb.set_callback(object); } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + // taken from the book 'mims circuit scrapbook, vol. 1' + // this is the frequency the chip runs at when given a vdd voltage of -0 to -15 + static constexpr int m_frequency[16] = { 0, 0, 0, 0, 0, 0, 1, 2267, 8731, 16382, 23531, 32564, 38347, 40010, 37800, 33173 }; + + // callbacks + devcb_write_line m_output_cb; + + // voltage (as positive number) + int m_vdd; + + // output timer + emu_timer *m_timer; + + // state + uint32_t m_shift; +}; + +// device type definition +extern const device_type MM5837; + +#endif // __MM5837_H__ diff --git a/src/mame/audio/beezer.cpp b/src/mame/audio/beezer.cpp deleted file mode 100644 index a2a19a242f1..00000000000 --- a/src/mame/audio/beezer.cpp +++ /dev/null @@ -1,482 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -/************************************************************************* - - Beezer 6522+6840 audio hardware - driver based on exidy audio hardware which it shares some similarity to - Original driver by ? (Nicola or Aaron, I think) - Preliminary, partially functional driver by Jonathan Gevaryahu - AKA Lord Nightmare - - TODO: - * Several inexplicable things on the schematic are not handled, such as the - 'VCO' input for 6840 channel 2 external clock whose source does not appear - anywhere on the schematic, nor does it handle the 'DMOD DATA' and 'DMOD - CLR' outputs for some sort of digital modulator (perhaps an hc55516?) - from the VIA, which also does not appear anywhere on schematic. - The latter the VIA *DOES* seem to write something to, but it may be just - a silence waveform for 55516, alternating zeroes and ones. - * The channel mixing is done additively at the moment rather than - emulating the original multiplexer, which is actually not that hard to do - but adds a bit of complexity to the render loop. - * The 'FM OR AM' output of the audio via (pb1) appears to control some sort - of suppression or filtering change of the post-DAC amplifier when enabled, - only during the TIMER1 OUT time-slot of the multiplexer, see page 1B 3-3 - of schematics. This will be a MESS to emulate since theres a lot of analog - crap involved. - * The /INT line and related logic of the 6840 is not emulated, and should - be hooked to the audio 6809. - * Convert this to a modern device instead of a deprecated old style device - - - Notes on multiplexer: - The sound output is from a DAC76xx 8-bit dac; driving this dac is a pair - of 74ls670 4x4 register files wired up as four 8-bit words; - The four words are used as the volumes for four 1-bit channels by inversion - of the MSB of the 8 bit value. - NOISE is the output of an MM5837 whitenoise generator, a self-clocked (at - around 100khz) LFSR with taps on bits (base-0) 16 and 13. - The four channels are: - CNT1 CNT0 - 0 0 6522 pin 7 output (squarewave); 'FM or AM' affects this slot only - 0 1 6840 channel 1 clocked by E1(int) OR by 6522 PB7-latched NOISE - 1 0 6840 channel 2 clocked by E1(int) OR by "VCO" ext (Huh?) - 1 1 6840 channel 3 clocked by E1(int) OR by channel 2-latched NOISE - - The four slots determine which address is selected of the 8-bit words and - which source will XOR against the MSB of the 8-bit word before it goes - to the DAC (effectively making the 8-bit word be a 7-bit volume control - plus optional wave invert). The speed which cnt0 and cnt1 count at is - E1/16 or 62500Hz. - -*************************************************************************/ - -#include "emu.h" -#include "machine/rescap.h" -#include "includes/beezer.h" - - -/************************************* - * - * Constants - * - *************************************/ - -#define CRYSTAL_OSC (XTAL_12MHz) -#define SH6840_CLOCK (CRYSTAL_OSC / 12) -#define MULTIPLEX_FREQ (SH6840_CLOCK / 16) - - -const device_type BEEZER = &device_creator; - -beezer_sound_device::beezer_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, BEEZER, "beezer SFX", tag, owner, clock, "beezer_sound", __FILE__), - device_sound_interface(mconfig, *this), - //m_ptm_irq_state(0), - m_sh6840_MSB_latch(0), - m_sh6840_LSB_latch(0), - m_sh6840_LFSR(0), - m_sh6840_LFSR_clocks(0), - m_sh6840_clocks_per_sample(0), - m_sh6840_clock_count(0), - m_sh6840_latchwrite(0), - m_sh6840_latchwriteold(0), - m_sh6840_noiselatch1(0), - m_sh6840_noiselatch3(0), - m_stream(nullptr)/*, - m_freq_to_step(0)*/ -{ - memset(m_sh6840_timer, 0, sizeof(m_sh6840_timer)); - m_sh6840_volume[0] = 0; - m_sh6840_volume[1] = 0; - m_sh6840_volume[2] = 0; - m_sh6840_volume[3] = 0; -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void beezer_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void beezer_sound_device::device_start() -{ - int sample_rate = MULTIPLEX_FREQ; - - m_sh6840_clocks_per_sample = (int)(((double)SH6840_CLOCK / (double)sample_rate) * (double)(1 << 24)); - - /* allocate the stream */ - m_stream = machine().sound().stream_alloc(*this, 0, 1, sample_rate); - m_maincpu = machine().device("maincpu"); - - save_item(NAME(m_sh6840_volume)); - save_item(NAME(m_sh6840_MSB_latch)); - save_item(NAME(m_sh6840_LSB_latch)); - save_item(NAME(m_sh6840_LFSR)); - save_item(NAME(m_sh6840_LFSR_clocks)); - save_item(NAME(m_sh6840_clock_count)); - save_item(NAME(m_sh6840_latchwrite)); - save_item(NAME(m_sh6840_latchwriteold)); - save_item(NAME(m_sh6840_noiselatch1)); - save_item(NAME(m_sh6840_noiselatch3)); - save_item(NAME(m_sh6840_timer[0].cr)); - save_item(NAME(m_sh6840_timer[0].state)); - save_item(NAME(m_sh6840_timer[0].leftovers)); - save_item(NAME(m_sh6840_timer[0].timer)); - save_item(NAME(m_sh6840_timer[0].clocks)); - save_item(NAME(m_sh6840_timer[0].counter.w)); - save_item(NAME(m_sh6840_timer[1].cr)); - save_item(NAME(m_sh6840_timer[1].state)); - save_item(NAME(m_sh6840_timer[1].leftovers)); - save_item(NAME(m_sh6840_timer[1].timer)); - save_item(NAME(m_sh6840_timer[1].clocks)); - save_item(NAME(m_sh6840_timer[1].counter.w)); - save_item(NAME(m_sh6840_timer[2].cr)); - save_item(NAME(m_sh6840_timer[2].state)); - save_item(NAME(m_sh6840_timer[2].leftovers)); - save_item(NAME(m_sh6840_timer[2].timer)); - save_item(NAME(m_sh6840_timer[2].clocks)); - save_item(NAME(m_sh6840_timer[2].counter.w)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void beezer_sound_device::device_reset() -{ - /* 6840 */ - memset(m_sh6840_timer, 0, sizeof(m_sh6840_timer)); - m_sh6840_MSB_latch = 0; - m_sh6840_LSB_latch = 0; - m_sh6840_volume[0] = 0; - m_sh6840_volume[1] = 0; - m_sh6840_volume[2] = 0; - m_sh6840_volume[3] = 0; - m_sh6840_clock_count = 0; - m_sh6840_latchwrite = 0; - m_sh6840_latchwriteold = 0; - m_sh6840_noiselatch1 = 0; - m_sh6840_noiselatch3 = 0; - - /* LFSR */ - m_sh6840_LFSR = 0xffffffff; - m_sh6840_LFSR_clocks = 0; -} - - -/************************************* - * - * Interrupt generation helper - * TODO: make this actually do something useful - *************************************/ - -/*WRITE_LINE_MEMBER( beezer_sound_device::update_irq_state ) -{ - m_audiocpu->set_input_line(M6809_IRQ_LINE, (sndptm_irq_state) ? ASSERT_LINE : CLEAR_LINE); -}*/ - - - -/************************************* - * - * 6840 clock counting helper - * - *************************************/ -// need to set int_flag properly here -static inline void sh6840_apply_clock(struct sh6840_timer_channel_beez *t, int clocks) -{ - /* dual 8-bit case */ - if (t->cr & 0x04) - { - /* handle full decrements */ - while (clocks > t->counter.b.l) - { - clocks -= t->counter.b.l + 1; - t->counter.b.l = t->timer; - - /* decrement MSB */ - if (!t->counter.b.h--) - { - t->state = 0; - t->counter.w = t->timer; - } - - /* state goes high when MSB is 0 */ - else if (!t->counter.b.h) - { - t->state = 1; - t->clocks++; - } - } - - /* subtract off the remainder */ - t->counter.b.l -= clocks; - } - - /* 16-bit case */ - else - { - /* handle full decrements */ - while (clocks > t->counter.w) - { - clocks -= t->counter.w + 1; - t->state ^= 1; - t->clocks += t->state; - t->counter.w = t->timer; - } - - /* subtract off the remainder */ - t->counter.w -= clocks; - } -} - - - -/************************************* - * - * Noise generation helper - * - *************************************/ - -int beezer_sound_device::sh6840_update_noise(int clocks) -{ - uint32_t newxor; - int noise_clocks = 0; - int i; - - /* loop over clocks */ - for (i = 0; i < clocks; i++) - { - m_sh6840_LFSR_clocks++; - if (m_sh6840_LFSR_clocks >= 10) // about 10 clocks per 6840 clock, as MM5837 runs at around 100kHz, while clock is 1MHz - { - m_sh6840_LFSR_clocks = 0; - /* shift the LFSR. finally or in the result and see if we've - * had a 0->1 transition */ - newxor = (((m_sh6840_LFSR&0x10000)?1:0) ^ ((m_sh6840_LFSR&0x2000)?1:0))?1:0; - m_sh6840_LFSR <<= 1; - m_sh6840_LFSR |= newxor; - /*printf("LFSR: %4x, %4x, %4x, %4x\n", sh6840_LFSR_3, sh6840_LFSR_2, sh6840_LFSR_1, sh6840_LFSR_0);*/ - /* if we clocked 0->1, that will serve as an external clock */ - if ((m_sh6840_LFSR & 0x01) == 0x01) /* tap is at bit 0, GUESSED */ - { - noise_clocks++; - } - } - } - return noise_clocks; -} - - -/************************************* - * - * 6840 timer handlers - * - *************************************/ - -READ8_MEMBER( beezer_sound_device::sh6840_r ) -{ - /* force an update of the stream */ - m_stream->update(); - - switch (offset) - { - /* offset 0: Motorola datasheet says it isn't used, Hitachi datasheet says it reads as 0s always*/ - case 0: - return 0; - /* offset 1 reads the status register: bits 2 1 0 correspond to ints on channels 2,1,0, and bit 7 is an 'OR' of bits 2,1,0 */ - case 1: - logerror("%04X:beezer_sh6840_r - unexpected read, status register is TODO!\n", m_maincpu->pc()); - return 0; - /* offsets 2,4,6 read channel 0,1,2 MSBs and latch the LSB*/ - case 2: case 4: case 6: - m_sh6840_LSB_latch = m_sh6840_timer[((offset>>1)-1)].counter.b.l; - return m_sh6840_timer[((offset>>1)-1)].counter.b.h; - /* offsets 3,5,7 read the LSB latch*/ - default: /* case 3,5,7 */ - return m_sh6840_LSB_latch; - } -} - -WRITE8_MEMBER( beezer_sound_device::timer1_w ) -{ - /* force an update of the stream */ - m_stream->update(); - m_sh6840_latchwriteold = m_sh6840_latchwrite; - m_sh6840_latchwrite = data&0x80; - if ((!m_sh6840_latchwriteold) && (m_sh6840_latchwrite)) // rising edge - { - m_sh6840_noiselatch1 = (m_sh6840_LFSR&0x1); - } -} - -READ8_MEMBER( beezer_sound_device::noise_r ) -{ - /* force an update of the stream */ - m_stream->update(); - return (m_sh6840_LFSR&0x1); -} - -WRITE8_MEMBER( beezer_sound_device::sh6840_w ) -{ - struct sh6840_timer_channel_beez *sh6840_timer = m_sh6840_timer; - - /* force an update of the stream */ - m_stream->update(); - - switch (offset) - { - /* offset 0 writes to either channel 0 control or channel 2 control */ - case 0: - if (sh6840_timer[1].cr & 0x01) - sh6840_timer[0].cr = data; - else - sh6840_timer[2].cr = data; - - /* only support mode 0 and 2 */ - if (((data >> 3) & 5) != 0) - fprintf(stderr,"beezer_sh6840_w - channel %d configured for mode %d (write was %02x to offset 0)", (sh6840_timer[1].cr & 0x01) ? 0 : 2, (data >> 3) & 7, data); - break; - - /* offset 1 writes to channel 1 control */ - case 1: - sh6840_timer[1].cr = data; - - /* only support mode 0 and 2 */ - if (((data >> 3) & 5) != 0) - fprintf(stderr,"beezer_sh6840_w - channel 1 configured for mode %d (write was %02x to offset 1)", (data >> 3) & 7, data); - break; - - /* offsets 2/4/6 write to the common MSB latch */ - case 2: - case 4: - case 6: - m_sh6840_MSB_latch = data; - break; - - /* offsets 3/5/7 write to the LSB controls */ - case 3: - case 5: - case 7: - { - /* latch the timer value */ - int ch = (offset - 3) / 2; - sh6840_timer[ch].timer = (m_sh6840_MSB_latch << 8) | (data & 0xff); - - /* if CR4 is clear, the value is loaded immediately */ - if (!(sh6840_timer[ch].cr & 0x10)) - sh6840_timer[ch].counter.w = sh6840_timer[ch].timer; - break; - } - } -} - - - -/************************************* - * - * DAC write handler - * - *************************************/ - -WRITE8_MEMBER( beezer_sound_device::sfxctrl_w ) -{ - m_stream->update(); - m_sh6840_volume[offset] = data; -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void beezer_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - struct sh6840_timer_channel_beez *sh6840_timer = m_sh6840_timer; - - /* hack to skip the expensive lfsr noise generation unless at least one of the 2 channels which actually depend on it are set to use it as a source */ - int noisy = ((sh6840_timer[0].cr & sh6840_timer[2].cr & 0x02) == 0); - stream_sample_t *buffer = outputs[0]; - - /* loop over samples */ - while (samples--) - { - struct sh6840_timer_channel_beez *t; - int clocks_this_sample; - int clocks; - int16_t sample1, sample2, sample3, sample0; - int16_t sample = 0; - sample1 = sample2 = sample3 = sample0 = 0; - - /* determine how many 6840 clocks this sample */ - m_sh6840_clock_count += m_sh6840_clocks_per_sample; - clocks_this_sample = m_sh6840_clock_count >> 24; - m_sh6840_clock_count &= (1 << 24) - 1; - - /* skip if nothing enabled */ - if ((sh6840_timer[0].cr & 0x01) == 0) // if we're not in reset... - { - // int noise_clocks_this_sample = 0; - uint32_t chan1_clocks; - - /* generate noise if configured to do so */ - if (noisy != 0) - sh6840_update_noise(clocks_this_sample); - - /* handle timer 0 if enabled */ - t = &sh6840_timer[0]; - clocks = (t->cr & 0x02) ? clocks_this_sample : m_sh6840_noiselatch1; - sh6840_apply_clock(t, clocks); - sample1 = (t->state && (t->cr & 0x80))?1:0; - - /* handle timer 1 if enabled */ - t = &sh6840_timer[1]; - chan1_clocks = t->clocks; - clocks = (t->cr & 0x02) ? clocks_this_sample : 0; // TODO: this is WRONG: channel 1 is clocked by a mystery "VCO CLOCK" signal if not set to E clock. it may not even be connected to anything! - sh6840_apply_clock(t, clocks); - sample2 = (t->state && (t->cr & 0x80))?1:0; - - /* generate channel 1-clocked noise if configured to do so */ - if (noisy != 0) - { - sh6840_update_noise(t->clocks - chan1_clocks); - if (clocks) m_sh6840_noiselatch3 = (m_sh6840_LFSR&0x1); - } - - /* handle timer 2 if enabled */ - t = &sh6840_timer[2]; - clocks = (t->cr & 0x02) ? clocks_this_sample : m_sh6840_noiselatch3; - /* prescale */ - if (t->cr & 0x01) - { - clocks += t->leftovers; - t->leftovers = clocks % 8; - clocks /= 8; - } - sh6840_apply_clock(t, clocks); - sample3 = (t->state && (t->cr & 0x80))?1:0; - } - sample0 = m_sh6840_latchwrite?1:0; - - /* stash */ - /* each sample feeds an xor bit on the sign bit of a sign-magnitude (NOT 2'S COMPLEMENT) - * DAC. This requires some rather convoluted processing: - * samplex*0x80 brings the sample to the sign bit - * m_sh6840_volume[x]&0x80 pulls the sign bit from the dac sample - * m_sh6840_volume[x]&0x7F pulls the magnitude from the dac sample - */ - sample += (((sample0*0x80)^(m_sh6840_volume[0]&0x80))?-1:1)*(m_sh6840_volume[0]&0x7F); - sample += (((sample1*0x80)^(m_sh6840_volume[1]&0x80))?-1:1)*(m_sh6840_volume[1]&0x7F); - sample += (((sample2*0x80)^(m_sh6840_volume[2]&0x80))?-1:1)*(m_sh6840_volume[2]&0x7F); - sample += (((sample3*0x80)^(m_sh6840_volume[3]&0x80))?-1:1)*(m_sh6840_volume[3]&0x7F); - *buffer++ = sample*64; // adding 4 numbers ranging from -128 to 127 yields a range of -512 to 508; to scale that to '-32768 to 32767' we multiply by 64 - } -} diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp index ce5630be6e1..e4a8ff812b7 100644 --- a/src/mame/drivers/beezer.cpp +++ b/src/mame/drivers/beezer.cpp @@ -1,57 +1,186 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -/* +// license: BSD-3-Clause +// copyright-holders: Mathis Rosenhauer, Dirk Best +// thanks-to: Jonathan Gevaryahu +/*************************************************************************** - Beezer - (c) 1982 Tong Electronic + Beezer - Written by Mathis Rosenhauer + (c) 1982 Tong Electronic - TODO: - - what's really wrong with the sound? Any reference available? + Notes: + - To enter test mode, hold down 1P Start and 2P Start, then reset + - One of the ROMs contains a message that this game was created + by "Pacific Polytechnical Corporation, Santa Cruz" -*/ + TODO: + - Improve sound (filters? A reference recording would be nice) + - Schematics in the sound area seem incomplete, there are + several unknown connections + - Watchdog timing (controlled by a 555) + - Figure out differences between the two sets (test mode isn't + working in beezer1, instruction screen is different) + - Verify accuracy of colors + +***************************************************************************/ #include "emu.h" -#include "machine/6522via.h" #include "cpu/m6809/m6809.h" -#include "includes/beezer.h" +#include "machine/input_merger.h" +#include "machine/watchdog.h" +#include "machine/bankdev.h" +#include "machine/6522via.h" +#include "machine/6840ptm.h" +#include "sound/mm5837.h" +#include "sound/dac76.h" +#include "video/resnet.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class beezer_state : public driver_device +{ +public: + beezer_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sysbank(*this, "sysbank"), + m_banked_roms(*this, "banked"), + m_rombank{ {*this, "rombank_f1"}, {*this, "rombank_f3"}, {*this, "rombank_e1"}, {*this, "rombank_e3"}, {*this, "rombank_e5"}, {*this, "rombank_f5"}, {*this, "rombank_f7"} }, + m_via_system(*this, "via_u6"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_audiocpu(*this, "audiocpu"), + m_via_audio(*this, "via_u18"), + m_ptm(*this, "ptm"), + m_dac(*this, "dac"), + m_timer_count(nullptr), + m_count(0), m_noise(0), + m_pbus(0xff), m_x(0), m_y(0), m_z(0) + { + m_ch_sign[0] = m_ch_sign[1] = m_ch_sign[2] = m_ch_sign[3] = 0; + m_dac_data[0] = m_dac_data[1] = m_dac_data[2] = m_dac_data[3] = 0; + } + + TIMER_DEVICE_CALLBACK_MEMBER(scanline_cb); + uint32_t screen_update_beezer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_PALETTE_INIT(beezer); + DECLARE_WRITE8_MEMBER(palette_w); + DECLARE_READ8_MEMBER(line_r); + + DECLARE_WRITE_LINE_MEMBER(noise_w); + DECLARE_WRITE8_MEMBER(dac_w); + DECLARE_READ8_MEMBER(via_audio_pa_r); + DECLARE_WRITE8_MEMBER(via_audio_pa_w); + DECLARE_WRITE8_MEMBER(via_audio_pb_w); + DECLARE_WRITE_LINE_MEMBER(ptm_out0_w); + DECLARE_WRITE_LINE_MEMBER(ptm_out1_w); + DECLARE_WRITE_LINE_MEMBER(ptm_out2_w); + DECLARE_WRITE_LINE_MEMBER(dmod_clr_w); + DECLARE_WRITE_LINE_MEMBER(dmod_data_w); + + DECLARE_READ8_MEMBER(via_system_pa_r); + DECLARE_READ8_MEMBER(via_system_pb_r); + DECLARE_WRITE8_MEMBER(via_system_pa_w); + DECLARE_WRITE8_MEMBER(via_system_pb_w); + DECLARE_WRITE8_MEMBER(bankswitch_w); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + required_device m_maincpu; + required_device m_sysbank; + required_memory_region m_banked_roms; + required_memory_bank m_rombank[7]; + required_device m_via_system; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_videoram; + required_device m_audiocpu; + required_device m_via_audio; + required_device m_ptm; + required_device m_dac; + + double m_weights_r[3]; + double m_weights_g[3]; + double m_weights_b[2]; + + emu_timer *m_timer_count; + + int m_ch_sign[4]; + uint8_t m_dac_data[4]; + int m_count; + int m_noise; + + uint8_t m_pbus; + int m_x, m_y, m_z; +}; + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, beezer_state ) AM_RANGE(0x0000, 0xbfff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xc000, 0xcfff) AM_ROMBANK("bank1") - AM_RANGE(0xd000, 0xdfff) AM_ROM AM_WRITE(beezer_bankswitch_w) // ROM at G1, bankswitch - AM_RANGE(0xe000, 0xffff) AM_ROM // ROMS at G3, G5 + AM_RANGE(0xc000, 0xcfff) AM_DEVICE("sysbank", address_map_bank_device, amap8) + AM_RANGE(0xd000, 0xdfff) AM_ROM AM_REGION("maincpu", 0x0000) AM_WRITE(bankswitch_w) // g1 + AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION("maincpu", 0x1000) // g3 + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("maincpu", 0x2000) // g5 +ADDRESS_MAP_END + +static ADDRESS_MAP_START( banked_map, AS_PROGRAM, 8, beezer_state ) + AM_RANGE(0x0600, 0x0600) AM_MIRROR(0x1ff) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) + AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x1f0) AM_WRITE(palette_w) + AM_RANGE(0x0a00, 0x0a00) AM_MIRROR(0x1ff) AM_READ(line_r) + AM_RANGE(0x0e00, 0x0e0f) AM_MIRROR(0x1f0) AM_DEVREADWRITE("via_u6", via6522_device, read, write) + AM_RANGE(0x1000, 0x1fff) AM_ROMBANK("rombank_f1") + AM_RANGE(0x2000, 0x2fff) AM_ROMBANK("rombank_f3") + AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("rombank_e1") + AM_RANGE(0x4000, 0x4fff) AM_ROMBANK("rombank_e3") + AM_RANGE(0x5000, 0x5fff) AM_ROMBANK("rombank_e5") + AM_RANGE(0x6000, 0x6fff) AM_ROMBANK("rombank_f5") + AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("rombank_f7") ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, beezer_state ) - AM_RANGE(0x0000, 0x07ff) AM_RAM // RAM at 0D - AM_RANGE(0x0800, 0x0fff) AM_RAM // optional RAM at 2D (can be rom here instead) - AM_RANGE(0x1000, 0x1007) AM_MIRROR(0x07f8) AM_DEVREADWRITE("custom", beezer_sound_device, sh6840_r, sh6840_w) - AM_RANGE(0x1800, 0x180F) AM_MIRROR(0x07f0) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) - AM_RANGE(0x8000, 0x8003) AM_MIRROR(0x1ffc) AM_DEVWRITE("custom", beezer_sound_device, sfxctrl_w) - //AM_RANGE(0xa000, 0xbfff) AM_ROM // ROM at 2D (can be ram here instead), unpopulated - //AM_RANGE(0xc000, 0xdfff) AM_ROM // ROM at 4D, unpopulated - AM_RANGE(0xe000, 0xffff) AM_ROM // ROM at 6D + AM_RANGE(0x0000, 0x07ff) AM_RAM // 0d + AM_RANGE(0x0800, 0x0fff) AM_RAM // 2d, optional (can be rom) + AM_RANGE(0x1000, 0x1007) AM_MIRROR(0x07f8) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) + AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x07f0) AM_DEVREADWRITE("via_u18", via6522_device, read, write) + AM_RANGE(0x8000, 0x8003) AM_MIRROR(0x1ffc) AM_WRITE(dac_w) +// AM_RANGE(0xa000, 0xbfff) AM_ROM // 2d (can be ram, unpopulated) +// AM_RANGE(0xc000, 0xdfff) AM_ROM // 4d (unpopulated) + AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("audiocpu", 0) // 6d ADDRESS_MAP_END +//************************************************************************** +// INPUTS +//************************************************************************** + static INPUT_PORTS_START( beezer ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN1") PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE PORT_START("IN2") PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE - /* Manual says "Dip Switch A" is not used. */ + // DSWA isn't populated on the board and is pulled to 0xff with a resistor pack PORT_START("DSWA") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -78,23 +207,281 @@ static INPUT_PORTS_START( beezer ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END -void beezer_state::machine_start() + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +TIMER_DEVICE_CALLBACK_MEMBER( beezer_state::scanline_cb ) { + // TDISP, each 32 lines + m_via_system->write_ca2((param & 32) ? 1 : 0); + + // actually unused by the game (points to a tight loop) + if (param == 240) + m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); + else + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); } +uint32_t beezer_state::screen_update_beezer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) + { + bitmap.pix16(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; + bitmap.pix16(y, x + 0) = m_videoram[0x80 * x + y] >> 4; + } + } + + return 0; +} + +PALETTE_INIT_MEMBER(beezer_state, beezer) +{ + const int resistances_rg[3] = { 1200, 560, 330 }; + const int resistances_b[2] = { 560, 330 }; + + // calculate coefficients for later use + compute_resistor_weights(0, 255, -1.0, + 3, resistances_rg, m_weights_r, 680, 150, + 3, resistances_rg, m_weights_g, 680, 150, + 2, resistances_b, m_weights_b, 680, 150); +} + +WRITE8_MEMBER( beezer_state::palette_w ) +{ + int r = combine_3_weights(m_weights_r, BIT(data, 0), BIT(data, 1), BIT(data, 2)); + int g = combine_3_weights(m_weights_g, BIT(data, 3), BIT(data, 4), BIT(data, 5)); + int b = combine_2_weights(m_weights_b, BIT(data, 6), BIT(data, 7)); + + m_palette->set_pen_color(offset, rgb_t(r, g, b)); +} + +READ8_MEMBER( beezer_state::line_r ) +{ + // d2 to d7 connected to hex buffer u34 + return m_screen->vpos() & 0xfc; +} + + +//************************************************************************** +// AUDIO +//************************************************************************** + +void beezer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + // channel multiplexer at u52 + int ch = m_count++ & 3; + + m_dac->update(); + + m_dac->b1_w(BIT(m_dac_data[ch], 6)); + m_dac->b2_w(BIT(m_dac_data[ch], 5)); + m_dac->b3_w(BIT(m_dac_data[ch], 4)); + m_dac->b4_w(BIT(m_dac_data[ch], 3)); + m_dac->b5_w(BIT(m_dac_data[ch], 2)); + m_dac->b6_w(BIT(m_dac_data[ch], 1)); + m_dac->b7_w(BIT(m_dac_data[ch], 0)); + + m_dac->sb_w(m_ch_sign[ch] ^ BIT(m_dac_data[ch], 7)); +} + +WRITE_LINE_MEMBER( beezer_state::noise_w ) +{ + m_noise = state; + m_via_audio->write_pb6(m_noise); +} + +WRITE8_MEMBER( beezer_state::dac_w ) +{ + m_dac_data[offset] = data; +} + +READ8_MEMBER( beezer_state::via_audio_pa_r ) +{ + return m_pbus; +} + +WRITE8_MEMBER( beezer_state::via_audio_pa_w ) +{ + m_pbus = data; +} + +WRITE8_MEMBER( beezer_state::via_audio_pb_w ) +{ + // bit 0 - dmod disable + // bit 1 - fm or am + // bit 2 - am + // bit 3 - fmsel0 + // bit 4 - fmsel1 + // -- above bits not handled and only partially visible on the schematic + + // bit 7 - noise gate on rising edge to ptm c1 + if (m_ch_sign[0] == 0 && (BIT(data, 7) == 1)) + m_ptm->set_c1(m_noise); + + m_ch_sign[0] = BIT(data, 7); +} + +WRITE_LINE_MEMBER( beezer_state::ptm_out0_w ) +{ + m_ch_sign[1] = state; +} + +WRITE_LINE_MEMBER( beezer_state::ptm_out1_w ) +{ + // on rising edge, enable noise input to ptm c3 + if (m_ch_sign[2] == 0 && state == 1) + m_ptm->set_c3(m_noise); + + m_ch_sign[2] = state; +} + +WRITE_LINE_MEMBER( beezer_state::ptm_out2_w ) +{ + m_ch_sign[3] = state; +} + +WRITE_LINE_MEMBER( beezer_state::dmod_clr_w ) +{ + // schematics don't show where this is connected +} + +WRITE_LINE_MEMBER( beezer_state::dmod_data_w ) +{ + // schematics don't show where this is connected +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +READ8_MEMBER( beezer_state::via_system_pa_r ) +{ + uint8_t data = 0; + + data |= 1 << 4; // N/C + data |= m_z << 5; + data |= m_y << 6; + data |= m_x << 7; + + return data; +} + +WRITE8_MEMBER(beezer_state::via_system_pa_w) +{ + // bit 3, audio cpu reset line + m_audiocpu->set_input_line(INPUT_LINE_RESET, BIT(data, 3) ? CLEAR_LINE : ASSERT_LINE); + + // bit 2, enable for ls139 + if (BIT(data, 2) == 0) + { + // bit 0-1, input selection + switch (data & 0x03) + { + case 0: + m_pbus = ioport("IN0")->read(); + break; + case 1: + m_pbus = ioport("IN1")->read() | (ioport("IN2")->read() << 4); + break; + case 2: + m_pbus = ioport("DSWB")->read(); + break; + case 3: + m_pbus = ioport("DSWA")->read(); + break; + } + } +} + +READ8_MEMBER( beezer_state::via_system_pb_r ) +{ + return m_pbus; +} + +WRITE8_MEMBER( beezer_state::via_system_pb_w ) +{ + m_pbus = data; +} + +WRITE8_MEMBER( beezer_state::bankswitch_w ) +{ + m_x = BIT(data, 3); + m_y = BIT(data, 4); + m_z = BIT(data, 5); + + m_sysbank->set_bank(data & 0x07); + + for (int i = 0; i < 7; i++) + m_rombank[i]->set_entry(m_x); +} + +void beezer_state::machine_start() +{ + // configure rom banks + for (int i = 0; i < 7; i++) + m_rombank[i]->configure_entries(0, 2, m_banked_roms->base() + (i * 0x2000), 0x1000); + + // allocate timers + m_timer_count = timer_alloc(0); + + // register for state saving + save_pointer(NAME(m_ch_sign), 4); + save_pointer(NAME(m_dac_data), 4); + save_item(NAME(m_count)); + save_item(NAME(m_noise)); + save_item(NAME(m_pbus)); + save_item(NAME(m_x)); + save_item(NAME(m_y)); + save_item(NAME(m_z)); +} + +void beezer_state::machine_reset() +{ + m_pbus = 0xff; + + // initialize memory banks + bankswitch_w(machine().dummy_space(), 0, 0); + + // start timer + m_timer_count->adjust(attotime::zero, 0, attotime::from_hz((XTAL_12MHz / 12) / 16)); +} + + +//************************************************************************** +// MACHINE DEFINTIONS +//************************************************************************** + static MACHINE_CONFIG_START( beezer, beezer_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1000000) /* 1 MHz */ + // basic machine hardware + MCFG_CPU_ADD("maincpu", M6809, XTAL_12MHz / 12) MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", beezer_state, beezer_interrupt, "screen", 0, 1) - MCFG_CPU_ADD("audiocpu", M6809, 1000000) /* 1 MHz */ - MCFG_CPU_PROGRAM_MAP(sound_map) + MCFG_DEVICE_ADD("sysbank", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(15) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000) + + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", beezer_state, scanline_cb, "screen", 0, 1) + + MCFG_DEVICE_ADD("via_u6", VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(beezer_state, via_system_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(beezer_state, via_system_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(beezer_state, via_system_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(beezer_state, via_system_pb_w)) + MCFG_VIA6522_CB1_HANDLER(DEVWRITELINE("via_u18", via6522_device, write_ca2)) + MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE("via_u18", via6522_device, write_ca1)) + MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) MCFG_WATCHDOG_ADD("watchdog") - /* video hardware */ + // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) @@ -104,81 +491,109 @@ static MACHINE_CONFIG_START( beezer, beezer_state ) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(beezer_state, beezer) + // sound hardware + MCFG_CPU_ADD("audiocpu", M6809, XTAL_12MHz / 12) + MCFG_CPU_PROGRAM_MAP(sound_map) + + MCFG_INPUT_MERGER_ACTIVE_HIGH("audio_irqs") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", M6809_IRQ_LINE)) + + MCFG_DEVICE_ADD("via_u18", VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(beezer_state, via_audio_pa_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(beezer_state, via_audio_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(beezer_state, via_audio_pb_w)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("via_u6", via6522_device, write_cb1)) + MCFG_VIA6522_CB1_HANDLER(WRITELINE(beezer_state, dmod_clr_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(beezer_state, dmod_data_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("audio_irqs", input_merger_active_high_device, in0_w)) + + MCFG_DEVICE_ADD("ptm", PTM6840, XTAL_12MHz / 12) + MCFG_PTM6840_OUT0_CB(WRITELINE(beezer_state, ptm_out0_w)) + MCFG_PTM6840_OUT1_CB(WRITELINE(beezer_state, ptm_out1_w)) + MCFG_PTM6840_OUT2_CB(WRITELINE(beezer_state, ptm_out2_w)) + MCFG_PTM6840_IRQ_CB(DEVWRITELINE("audio_irqs", input_merger_active_high_device, in1_w)) + // schematics show an input labeled VCO to channel 2, but the source is unknown + + MCFG_MM5837_ADD("noise") + MCFG_MM5837_VDD(12) + MCFG_MM5837_OUTPUT_CB(WRITELINE(beezer_state, noise_w)) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("speaker") - - MCFG_SOUND_ADD("custom", BEEZER, 0) + MCFG_SOUND_ADD("dac", DAC76, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(beezer_state, b_via_0_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(beezer_state, b_via_0_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(beezer_state, b_via_0_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(beezer_state, b_via_0_pb_w)) - MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) - MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(beezer_state, b_via_1_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(beezer_state, b_via_1_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(beezer_state, b_via_1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(beezer_state, b_via_1_pb_w)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("audiocpu", M6809_IRQ_LINE)) MACHINE_CONFIG_END -/*************************************************************************** - Game driver(s) - -***************************************************************************/ +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** ROM_START( beezer ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "g1", 0x0d000, 0x1000, CRC(3467a0ec) SHA1(0b094a9bf772b101acd26cf09009c67dd4785ed2) ) - ROM_LOAD( "g3", 0x0e000, 0x1000, CRC(9950cdf2) SHA1(b2b59cc1080357de6ba297392881d626157df809) ) - ROM_LOAD( "g5", 0x0f000, 0x1000, CRC(a4b09879) SHA1(69739dd1d3c88ee6ab310ca3c71b3b50d8ec618f) ) + ROM_REGION(0xc000, "maincpu", 0) + ROM_LOAD("g1", 0x0000, 0x1000, CRC(3467a0ec) SHA1(0b094a9bf772b101acd26cf09009c67dd4785ed2)) + ROM_LOAD("g3", 0x1000, 0x1000, CRC(9950cdf2) SHA1(b2b59cc1080357de6ba297392881d626157df809)) + ROM_LOAD("g5", 0x2000, 0x1000, CRC(a4b09879) SHA1(69739dd1d3c88ee6ab310ca3c71b3b50d8ec618f)) - ROM_LOAD( "f1", 0x12000, 0x2000, CRC(ce1b0b8b) SHA1(8ed1d793928bb7afa041a4f61e0c2f78b4442f2f) ) - ROM_LOAD( "f3", 0x14000, 0x2000, CRC(6a11072a) SHA1(9700beaec669849da4d0e39d6dbf0b872d7f1b7f) ) - ROM_LOAD( "e1", 0x16000, 0x1000, CRC(21e4ca9b) SHA1(4024678a4006614051675858ba65db655931a539) ) - ROM_LOAD( "e3", 0x18000, 0x1000, CRC(a4f735d7) SHA1(110061d1c63a331384729951f93a31e62744d0d7) ) - ROM_LOAD( "e5", 0x1a000, 0x1000, CRC(0485575b) SHA1(c3be070541459fad4da4a71604883b2f3043374a) ) - ROM_LOAD( "f5", 0x1c000, 0x1000, CRC(4b11f572) SHA1(4f283c98a7f1bcf534921b4a54cf564335c53e37) ) - ROM_LOAD( "f7", 0x1e000, 0x1000, CRC(bef67473) SHA1(5759ceeca0bb677cee97b74f1a1087d53c25463a) ) + // rom type can be either 2732 or 2764 in all locations + ROM_REGION(0xe000, "banked", 0) + ROM_LOAD("f1", 0x0000, 0x2000, CRC(ce1b0b8b) SHA1(8ed1d793928bb7afa041a4f61e0c2f78b4442f2f)) + ROM_LOAD("f3", 0x2000, 0x2000, CRC(6a11072a) SHA1(9700beaec669849da4d0e39d6dbf0b872d7f1b7f)) + ROM_LOAD("e1", 0x4000, 0x1000, CRC(21e4ca9b) SHA1(4024678a4006614051675858ba65db655931a539)) + ROM_RELOAD(0x5000, 0x1000) + ROM_LOAD("e3", 0x6000, 0x1000, CRC(a4f735d7) SHA1(110061d1c63a331384729951f93a31e62744d0d7)) + ROM_RELOAD(0x7000, 0x1000) + ROM_LOAD("e5", 0x8000, 0x1000, CRC(0485575b) SHA1(c3be070541459fad4da4a71604883b2f3043374a)) + ROM_RELOAD(0x9000, 0x1000) + ROM_LOAD("f5", 0xa000, 0x1000, CRC(4b11f572) SHA1(4f283c98a7f1bcf534921b4a54cf564335c53e37)) + ROM_RELOAD(0xb000, 0x1000) + ROM_LOAD("f7", 0xc000, 0x1000, CRC(bef67473) SHA1(5759ceeca0bb677cee97b74f1a1087d53c25463a)) + ROM_RELOAD(0xd000, 0x1000) - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "d7", 0xf000, 0x1000, CRC(23b0782e) SHA1(7751327b84235a2e2700e4bdd21adec205c54f0e) ) + ROM_REGION(0x2000, "audiocpu", 0) + ROM_LOAD("d7", 0x1000, 0x1000, CRC(23b0782e) SHA1(7751327b84235a2e2700e4bdd21adec205c54f0e)) - ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "d1.cpu", 0x000, 0x0100, CRC(8db17a40) SHA1(0e04a4f5f99b302dbbbfda438808d549f8680fe2) ) - ROM_LOAD( "e1.cpu", 0x100, 0x0100, CRC(3c775c5e) SHA1(ac86f45938c0c9d5fec1245bf86718442baf445b) ) + ROM_REGION(0x200, "proms", 0) + ROM_LOAD("d1.cpu", 0x000, 0x100, CRC(8db17a40) SHA1(0e04a4f5f99b302dbbbfda438808d549f8680fe2)) + ROM_LOAD("e1.cpu", 0x100, 0x100, CRC(3c775c5e) SHA1(ac86f45938c0c9d5fec1245bf86718442baf445b)) ROM_END ROM_START( beezer1 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "g1.32", 0x0d000, 0x1000, CRC(3134cb93) SHA1(7d4a484378b66ccf2fded31885d6dfb2abae9317) ) - ROM_LOAD( "g3.32", 0x0e000, 0x1000, CRC(a3cb2c2d) SHA1(1e17eb0eaf02f86865845a065a5f714fc51aa7d6) ) - ROM_LOAD( "g5.32", 0x0f000, 0x1000, CRC(5e559bf9) SHA1(cd3713f3ed1215ea5c5640474ba6f005242cd093) ) + ROM_REGION(0x3000, "maincpu", 0) + ROM_LOAD("g1.32", 0x0000, 0x1000, CRC(3134cb93) SHA1(7d4a484378b66ccf2fded31885d6dfb2abae9317)) + ROM_LOAD("g3.32", 0x1000, 0x1000, CRC(a3cb2c2d) SHA1(1e17eb0eaf02f86865845a065a5f714fc51aa7d6)) + ROM_LOAD("g5.32", 0x2000, 0x1000, CRC(5e559bf9) SHA1(cd3713f3ed1215ea5c5640474ba6f005242cd093)) - ROM_LOAD( "f1.64", 0x12000, 0x2000, CRC(b8a78cca) SHA1(4218ef8c4c8e10d7cc47d6de4c4d189ef3c0f0a1) ) - ROM_LOAD( "f3.32", 0x14000, 0x1000, CRC(bfa023f5) SHA1(56fb15e2db61197e1aec5a5825beff7c788a4ba3) ) - ROM_LOAD( "e1", 0x16000, 0x1000, CRC(21e4ca9b) SHA1(4024678a4006614051675858ba65db655931a539) ) - ROM_LOAD( "e3", 0x18000, 0x1000, CRC(a4f735d7) SHA1(110061d1c63a331384729951f93a31e62744d0d7) ) - ROM_LOAD( "e5", 0x1a000, 0x1000, CRC(0485575b) SHA1(c3be070541459fad4da4a71604883b2f3043374a) ) - ROM_LOAD( "f5", 0x1c000, 0x1000, CRC(4b11f572) SHA1(4f283c98a7f1bcf534921b4a54cf564335c53e37) ) - ROM_LOAD( "f7", 0x1e000, 0x1000, CRC(bef67473) SHA1(5759ceeca0bb677cee97b74f1a1087d53c25463a) ) + // rom type can be either 2732 or 2764 in all locations + ROM_REGION(0xe000, "banked", 0) + ROM_LOAD("f1.64", 0x0000, 0x2000, CRC(b8a78cca) SHA1(4218ef8c4c8e10d7cc47d6de4c4d189ef3c0f0a1)) + ROM_LOAD("f3.32", 0x2000, 0x1000, CRC(bfa023f5) SHA1(56fb15e2db61197e1aec5a5825beff7c788a4ba3)) + ROM_RELOAD(0x3000, 0x1000) + ROM_LOAD("e1", 0x4000, 0x1000, CRC(21e4ca9b) SHA1(4024678a4006614051675858ba65db655931a539)) + ROM_RELOAD(0x5000, 0x1000) + ROM_LOAD("e3", 0x6000, 0x1000, CRC(a4f735d7) SHA1(110061d1c63a331384729951f93a31e62744d0d7)) + ROM_RELOAD(0x7000, 0x1000) + ROM_LOAD("e5", 0x8000, 0x1000, CRC(0485575b) SHA1(c3be070541459fad4da4a71604883b2f3043374a)) + ROM_RELOAD(0x9000, 0x1000) + ROM_LOAD("f5", 0xa000, 0x1000, CRC(4b11f572) SHA1(4f283c98a7f1bcf534921b4a54cf564335c53e37)) + ROM_RELOAD(0xb000, 0x1000) + ROM_LOAD("f7", 0xc000, 0x1000, CRC(bef67473) SHA1(5759ceeca0bb677cee97b74f1a1087d53c25463a)) + ROM_RELOAD(0xd000, 0x1000) - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "d7.32", 0xf000, 0x1000, CRC(b11028b5) SHA1(db8958f0bb12e333ce056da3338f1a824dda36e0) ) + ROM_REGION(0x2000, "audiocpu", 0) + ROM_LOAD("d7.32", 0x1000, 0x1000, CRC(b11028b5) SHA1(db8958f0bb12e333ce056da3338f1a824dda36e0)) - ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "d1.cpu", 0x000, 0x0100, CRC(8db17a40) SHA1(0e04a4f5f99b302dbbbfda438808d549f8680fe2) ) - ROM_LOAD( "e1.cpu", 0x100, 0x0100, CRC(3c775c5e) SHA1(ac86f45938c0c9d5fec1245bf86718442baf445b) ) + ROM_REGION(0x200, "proms", 0) + ROM_LOAD("d1.cpu", 0x000, 0x100, CRC(8db17a40) SHA1(0e04a4f5f99b302dbbbfda438808d549f8680fe2)) + ROM_LOAD("e1.cpu", 0x100, 0x100, CRC(3c775c5e) SHA1(ac86f45938c0c9d5fec1245bf86718442baf445b)) ROM_END -GAME( 1982, beezer, 0, beezer, beezer, beezer_state, beezer, ROT90, "Tong Electronic", "Beezer (set 1)", MACHINE_IMPERFECT_SOUND ) -GAME( 1982, beezer1, beezer, beezer, beezer, beezer_state, beezer, ROT90, "Tong Electronic", "Beezer (set 2)", MACHINE_IMPERFECT_SOUND ) + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROTATION COMPANY FULLNAME FLAGS +GAME( 1982, beezer, 0, beezer, beezer, driver_device, 0, ROT90, "Tong Electronic", "Beezer (set 1)", MACHINE_IMPERFECT_SOUND ) +GAME( 1982, beezer1, beezer, beezer, beezer, driver_device, 0, ROT90, "Tong Electronic", "Beezer (set 2)", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/includes/beezer.h b/src/mame/includes/beezer.h deleted file mode 100644 index 4ed0eb337bf..00000000000 --- a/src/mame/includes/beezer.h +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -#include "machine/6522via.h" -#include "cpu/m6809/m6809.h" -#include "machine/watchdog.h" - -class beezer_sound_device; - -class beezer_state : public driver_device -{ -public: - beezer_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_watchdog(*this, "watchdog"), - m_custom(*this, "custom"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } - - required_shared_ptr m_videoram; - int m_pbus; - int m_banklatch; - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_watchdog; - required_device m_custom; - required_device m_screen; - required_device m_palette; - - DECLARE_WRITE8_MEMBER(beezer_bankswitch_w); - DECLARE_WRITE8_MEMBER(beezer_map_w); - DECLARE_READ8_MEMBER(beezer_line_r); - DECLARE_DRIVER_INIT(beezer); - virtual void machine_start() override; - uint32_t screen_update_beezer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(beezer_interrupt); - DECLARE_READ8_MEMBER(b_via_0_pa_r); - DECLARE_READ8_MEMBER(b_via_0_pb_r); - DECLARE_WRITE8_MEMBER(b_via_0_pa_w); - DECLARE_WRITE8_MEMBER(b_via_0_pb_w); - DECLARE_READ8_MEMBER(b_via_1_pa_r); - DECLARE_READ8_MEMBER(b_via_1_pb_r); - DECLARE_WRITE8_MEMBER(b_via_1_pa_w); - DECLARE_WRITE8_MEMBER(b_via_1_pb_w); -}; - -/*----------- defined in audio/beezer.c -----------*/ - -/* 6840 variables */ -struct sh6840_timer_channel_beez -{ - uint8_t cr; - uint8_t state; - uint8_t leftovers; - uint16_t timer; - uint32_t clocks; - uint8_t int_flag; - union - { -#ifdef LSB_FIRST - struct { uint8_t l, h; } b; -#else - struct { uint8_t h, l; } b; -#endif - uint16_t w; - } counter; -}; - -class beezer_sound_device : public device_t, - public device_sound_interface -{ -public: - beezer_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - ~beezer_sound_device() {} - - DECLARE_READ8_MEMBER( sh6840_r ); - DECLARE_WRITE8_MEMBER( sh6840_w ); - DECLARE_WRITE8_MEMBER( sfxctrl_w ); - DECLARE_WRITE8_MEMBER( timer1_w ); - DECLARE_READ8_MEMBER( noise_r ); - - //DECLARE_WRITE_LINE_MEMBER( update_irq_state ); - -protected: - // device-level overrides - virtual void device_config_complete() override; - virtual void device_start() override; - virtual void device_reset() override; - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; -private: - // internal state - cpu_device *m_maincpu; - - /* IRQ variable */ - //uint8_t m_ptm_irq_state; - - struct sh6840_timer_channel_beez m_sh6840_timer[3]; - uint8_t m_sh6840_volume[4]; - uint8_t m_sh6840_MSB_latch; - uint8_t m_sh6840_LSB_latch; - uint32_t m_sh6840_LFSR; - uint32_t m_sh6840_LFSR_clocks; - uint32_t m_sh6840_clocks_per_sample; - uint32_t m_sh6840_clock_count; - - uint32_t m_sh6840_latchwrite; - uint32_t m_sh6840_latchwriteold; - uint32_t m_sh6840_noiselatch1; - uint32_t m_sh6840_noiselatch3; - - /* sound streaming variables */ - sound_stream *m_stream; - //double m_freq_to_step; - - int sh6840_update_noise(int clocks); -}; - -extern const device_type BEEZER; diff --git a/src/mame/machine/beezer.cpp b/src/mame/machine/beezer.cpp deleted file mode 100644 index 55fb06f1292..00000000000 --- a/src/mame/machine/beezer.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6522via.h" -#include "includes/beezer.h" - - - -/* VIA 0 (aka "PPCNP74", U6 @1C on schematics) - enabled at CE00-CFFF of main m6809 cpu when bankswitch is set to 0 - port A: - bit 7: input, X from banking latch (d3 of banking register) - bit 6: input, Y from banking latch (d4 of banking register) - bit 5: input, Z from banking latch (d5 of banking register) - bit 4: N/C - bit 3: output, /RESET for audio subcpu - bit 2: output, /ENABLE for LS139@2H for reading control and dipswitch inputs to pbus - bit 1: output, MSb of selector for inputs to pbus - bit 0: output, LSb of " - port B: - bits 7-0: input/output: pbus - port C: - CA1: N/C - CA2: input: "TDISP" (one of the higher bits in the video line counter, a mirror of the D5 bit from beezer_line_r), done in /video/beezer.c - CB1: ASH1 to via 1 - CB2: ASH2 to via 1 - /IRQ: to main m6809 cpu - /RES: from main reset generator/watchdog/button - - TODO: find a better way to attach ca2 read to beezer_line_r - */ - -/* VIA 1 (U18 @3C on schematics) - port A: - bits 7-0: input/output: pbus - port B: - bit 7: output: TIMER1 OUT (used to gate NOISE (see below) to clock channel 1 of 6840, plus acts as channel 0 by itself) - bit 6: input: NOISE (from mm5837 14-bit LFSR, which also connects to clock above) - bit 5: output?: N/C - bit 4: output?: FMSEL1 (does not appear elsewhere on schematics! what does this do? needs tracing) - always 0? - bit 3: output?: FMSEL0 (does not appear elsewhere on schematics! what does this do? needs tracing) - always 0? - bit 2: output?: AM (does not appear elsewhere on schematics! what does this do? needs tracing) - always 0? - bit 1: output: FM or AM (appears to control some sort of suppression or filtering change of the post-DAC amplifier when enabled, only during the TIMER1 OUT time-slot of the multiplexer, see page 1B 3-3 of schematics) - always 0? why is there a special circuit for it? - bit 0: output?: DMOD DISABLE (does not appear elsewhere on schematics! what does this do? needs tracing) - on startup is 0, turns to 1 and stays that way? - port C: - CA1: AHS2 from via 0 (are these two switched?) - CA2: AHS1 from via 0 " - CB1: ??put: DMOD CLR (does not appear elsewhere on schematics! what does this do? needs tracing) - CB2: ??put: DMOD DATA (does not appear elsewhere on schematics! what does this do? needs tracing) - /IRQ: to audio/sub m6809 cpu - /RES: from audio reset bit of via 0 - - TODO: the entirety of port B, much needs tracing - TODO: ports CB1 and CB2, need tracing; ports CA1 and CA2 could use verify as well - */ - -READ8_MEMBER(beezer_state::b_via_0_pa_r) -{ - return (m_banklatch&0x38)<<2; // return X,Y,Z bits TODO: the Z bit connects somewhere else... where? -} - -READ8_MEMBER(beezer_state::b_via_0_pb_r) -{ - return m_pbus; -} - -WRITE8_MEMBER(beezer_state::b_via_0_pa_w) -{ - if ((data & 0x08) == 0) - m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - else - m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - - if ((data & 0x04) == 0) - { - switch (data & 0x03) - { - case 0: - m_pbus = ioport("IN0")->read(); - break; - case 1: - m_pbus = ioport("IN1")->read() | (ioport("IN2")->read() << 4); - break; - case 2: - m_pbus = ioport("DSWB")->read(); - break; - case 3: - m_pbus = ioport("DSWA")->read(); // Technically DSWA isn't populated on the board and is pulled to 0xFF with resistor pack, but there IS a DSWA port in the driver so we may as well use it. - break; - } - } -} - -WRITE8_MEMBER(beezer_state::b_via_0_pb_w) -{ - m_pbus = data; -} - -READ8_MEMBER(beezer_state::b_via_1_pa_r) -{ - return m_pbus; -} - -READ8_MEMBER(beezer_state::b_via_1_pb_r) -{ - return 0x1F | (m_custom->noise_r(space, 0)?0x40:0); -} - -WRITE8_MEMBER(beezer_state::b_via_1_pa_w) -{ - m_pbus = data; -} - -WRITE8_MEMBER(beezer_state::b_via_1_pb_w) -{ - m_custom->timer1_w(space, 0, data&0x80); - //if ((data&0x1f) != 0x01) - // popmessage("via1 pb low write of 0x%02x is not supported! contact mamedev!", data&0x1f); -} - -DRIVER_INIT_MEMBER(beezer_state,beezer) -{ - m_pbus = 0; - m_banklatch = 0; -} - -WRITE8_MEMBER(beezer_state::beezer_bankswitch_w) -{ - m_banklatch = data&0x3f; // latched 'x,y,z' plus bank bits in ls174 @ 4H - if ((data & 0x07) == 0) - { - via6522_device *via_0 = machine().device("via6522_0"); - space.install_write_handler(0xc600, 0xc7ff, write8_delegate(FUNC(watchdog_timer_device::reset_w),&*m_watchdog)); - space.install_write_handler(0xc800, 0xc9ff, write8_delegate(FUNC(beezer_state::beezer_map_w),this)); - space.install_read_handler(0xca00, 0xcbff, read8_delegate(FUNC(beezer_state::beezer_line_r),this)); - space.install_readwrite_handler(0xce00, 0xcfff, read8_delegate(FUNC(via6522_device::read), via_0), write8_delegate(FUNC(via6522_device::write), via_0)); - } - else - { - uint8_t *rom = memregion("maincpu")->base() + 0x10000; - space.install_ram(0xc000, 0xcfff, rom + (data & 0x07) * 0x2000 + ((data & 0x08) ? 0x1000: 0)); - } -} diff --git a/src/mame/video/beezer.cpp b/src/mame/video/beezer.cpp deleted file mode 100644 index c957e1db09b..00000000000 --- a/src/mame/video/beezer.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6522via.h" -#include "includes/beezer.h" - - -TIMER_DEVICE_CALLBACK_MEMBER(beezer_state::beezer_interrupt) -{ - int scanline = param; - via6522_device *via_0 = machine().device("via6522_0"); - - via_0->write_ca2((scanline & 0x20) ? 1 : 0); - #if 0 - if (scanline == 240) // actually unused by the game! (points to a tight loop) - m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); - else - m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); - #endif -} - -uint32_t beezer_state::screen_update_beezer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *videoram = m_videoram; - int x,y; - - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - for (x = cliprect.min_x; x <= cliprect.max_x; x+=2) - { - bitmap.pix16(y, x+1) = videoram[0x80*x+y] & 0x0f; - bitmap.pix16(y, x+0) = videoram[0x80*x+y] >> 4; - } - - return 0; -} - -WRITE8_MEMBER(beezer_state::beezer_map_w) -{ - /* - bit 7 -- 330 ohm resistor -- BLUE - -- 560 ohm resistor -- BLUE - -- 330 ohm resistor -- GREEN - -- 560 ohm resistor -- GREEN - -- 1.2 kohm resistor -- GREEN - -- 330 ohm resistor -- RED - -- 560 ohm resistor -- RED - bit 0 -- 1.2 kohm resistor -- RED - */ - - int r, g, b, bit0, bit1, bit2; - - /* red component */ - bit0 = (data >> 0) & 0x01; - bit1 = (data >> 1) & 0x01; - bit2 = (data >> 2) & 0x01; - r = 0x26 * bit0 + 0x50 * bit1 + 0x89 * bit2; - /* green component */ - bit0 = (data >> 3) & 0x01; - bit1 = (data >> 4) & 0x01; - bit2 = (data >> 5) & 0x01; - g = 0x26 * bit0 + 0x50 * bit1 + 0x89 * bit2; - /* blue component */ - bit0 = (data >> 6) & 0x01; - bit1 = (data >> 7) & 0x01; - b = 0x5f * bit0 + 0xa0 * bit1; - - m_palette->set_pen_color(offset, rgb_t(r, g, b)); -} - -READ8_MEMBER(beezer_state::beezer_line_r) -{ - return m_screen->vpos(); -// Note: was (m_scanline & 0xfe) << 1; with scanline % 128 -} From c7d7f00eb0c3ea7339f91e34d9b17033ea388dc7 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 12 Dec 2016 13:06:32 +1100 Subject: [PATCH 64/82] MT 04921 --- src/mame/drivers/fcrash.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/fcrash.cpp b/src/mame/drivers/fcrash.cpp index d24b4aa496d..3f747612e76 100644 --- a/src/mame/drivers/fcrash.cpp +++ b/src/mame/drivers/fcrash.cpp @@ -491,7 +491,8 @@ void cps_state::fcrash_render_sprites( screen_device &screen, bitmap_ind16 &bitm int num_sprites = m_gfxdecode->gfx(2)->elements(); int last_sprite_offset = 0x1ffc; uint16_t *sprite_ram = m_gfxram; - uint16_t tileno,flipx,flipy,colour,xpos,ypos; + uint16_t tileno,colour,xpos,ypos; + bool flipx, flipy; /* if we have separate sprite ram, use it */ if (m_bootleg_sprite_ram) sprite_ram = m_bootleg_sprite_ram.get(); @@ -509,13 +510,16 @@ void cps_state::fcrash_render_sprites( screen_device &screen, bitmap_ind16 &bitm if (tileno >= num_sprites) continue; /* don't render anything outside our tiles */ xpos = sprite_ram[base + pos + 2] & 0x1ff; ypos = sprite_ram[base + pos - 1] & 0x1ff; - flipx = sprite_ram[base + pos + 1] & 0x20; - flipy = sprite_ram[base + pos + 1] & 0x40; + flipx = BIT(sprite_ram[base + pos + 1], 5); + flipy = BIT(sprite_ram[base + pos + 1], 6); colour = sprite_ram[base + pos + 1] & 0x1f; ypos = 256 - ypos - 16; xpos = xpos + m_sprite_x_offset + 49; - m_gfxdecode->gfx(2)->prio_transpen(bitmap,cliprect, tileno, colour, flipx, flipy, xpos, ypos, screen.priority(), 0x02, 15); + if (flip_screen()) + m_gfxdecode->gfx(2)->prio_transpen(bitmap, cliprect, tileno, colour, !flipx, !flipy, 512-16-xpos, 256-16-ypos, screen.priority(), 2, 15); + else + m_gfxdecode->gfx(2)->prio_transpen(bitmap, cliprect, tileno, colour, flipx, flipy, xpos, ypos, screen.priority(), 2, 15); } } } From 59e7361396ca95ce1bb2a0ddfe9b45716cb400e9 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 11 Dec 2016 23:50:57 -0500 Subject: [PATCH 65/82] discoboy.cpp, yunsung8.cpp: Use 74LS157 device (nw) --- src/mame/drivers/discoboy.cpp | 33 ++++++++++++++--------------- src/mame/drivers/yunsung8.cpp | 39 +++++++++++++++-------------------- src/mame/includes/yunsung8.h | 7 ++++--- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/src/mame/drivers/discoboy.cpp b/src/mame/drivers/discoboy.cpp index bdb78873e74..184a56d9a75 100644 --- a/src/mame/drivers/discoboy.cpp +++ b/src/mame/drivers/discoboy.cpp @@ -44,6 +44,7 @@ Notes: #include "emu.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" +#include "machine/74157.h" #include "sound/msm5205.h" #include "sound/3812intf.h" @@ -57,6 +58,7 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), + m_adpcm_select(*this, "adpcm_select"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch") { } @@ -65,13 +67,14 @@ public: uint8_t m_ram_bank; uint8_t m_gfxbank; uint8_t m_port_00; - int m_adpcm; - uint8_t m_toggle; + + bool m_toggle; /* devices */ required_device m_maincpu; required_device m_audiocpu; required_device m_msm; + required_device m_adpcm_select; required_device m_gfxdecode; required_device m_palette; required_device m_soundlatch; @@ -94,7 +97,6 @@ public: DECLARE_READ8_MEMBER(discoboy_ram_att_r); DECLARE_WRITE8_MEMBER(discoboy_ram_att_w); DECLARE_READ8_MEMBER(discoboy_port_06_r); - DECLARE_WRITE8_MEMBER(yunsung8_adpcm_w); DECLARE_WRITE8_MEMBER(yunsung8_sound_bankswitch_w); DECLARE_DRIVER_INIT(discoboy); virtual void machine_start() override; @@ -350,17 +352,11 @@ WRITE8_MEMBER(discoboy_state::yunsung8_sound_bankswitch_w) logerror("%s: Bank %02X\n", machine().describe_context(), data); } -WRITE8_MEMBER(discoboy_state::yunsung8_adpcm_w) -{ - /* Swap the nibbles */ - m_adpcm = ((data & 0xf) << 4) | ((data >> 4) & 0xf); -} - static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, discoboy_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("sndbank") AM_RANGE(0xe000, 0xe000) AM_WRITE(yunsung8_sound_bankswitch_w) - AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w) + AM_RANGE(0xe400, 0xe400) AM_DEVWRITE("adpcm_select", ls157_device, ba_w) AM_RANGE(0xec00, 0xec01) AM_DEVWRITE("ymsnd", ym3812_device, write) AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_RANGE(0xf800, 0xf800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) @@ -467,7 +463,6 @@ void discoboy_state::machine_start() save_item(NAME(m_ram_bank)); save_item(NAME(m_port_00)); save_item(NAME(m_gfxbank)); - save_item(NAME(m_adpcm)); save_item(NAME(m_toggle)); } @@ -476,16 +471,17 @@ void discoboy_state::machine_reset() m_ram_bank = 0; m_port_00 = 0; m_gfxbank = 0; - m_adpcm = 0x80; - m_toggle = 0; + m_toggle = false; } WRITE_LINE_MEMBER(discoboy_state::yunsung8_adpcm_int) { - m_msm->data_w(m_adpcm >> 4); - m_adpcm <<= 4; + if (!state) + return; - m_toggle ^= 1; + m_toggle = !m_toggle; + m_adpcm_select->select_w(m_toggle); + m_audiocpu->set_input_line(INPUT_LINE_NMI, m_toggle); } static MACHINE_CONFIG_START( discoboy, discoboy_state ) @@ -498,8 +494,6 @@ static MACHINE_CONFIG_START( discoboy, discoboy_state ) MCFG_CPU_ADD("audiocpu", Z80, XTAL_10MHz/2) /* 5 MHz? */ MCFG_CPU_PROGRAM_MAP(sound_map) - MCFG_CPU_PERIODIC_INT_DRIVER(discoboy_state, nmi_line_pulse, 32*60) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -523,6 +517,9 @@ static MACHINE_CONFIG_START( discoboy, discoboy_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.6) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.6) + MCFG_DEVICE_ADD("adpcm_select", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w)) + MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) MCFG_MSM5205_VCLK_CB(WRITELINE(discoboy_state, yunsung8_adpcm_int)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) /* 4KHz, 4 Bits */ diff --git a/src/mame/drivers/yunsung8.cpp b/src/mame/drivers/yunsung8.cpp index a6c1934b0ff..d5e4ac0ccd4 100644 --- a/src/mame/drivers/yunsung8.cpp +++ b/src/mame/drivers/yunsung8.cpp @@ -54,19 +54,19 @@ WRITE8_MEMBER(yunsung8_state::bankswitch_w) READ8_MEMBER(yunsung8_state::sound_command_r) { - m_audiocpu->set_input_line (0, CLEAR_LINE); - return (m_soundlatch->read (space, 0)); + m_audiocpu->set_input_line(0, CLEAR_LINE); + return m_soundlatch->read(space, 0); } -WRITE8_MEMBER (yunsung8_state::sound_command_w) +WRITE8_MEMBER(yunsung8_state::sound_command_w) { - m_soundlatch->write (space, 0, data); - m_audiocpu->set_input_line (0, ASSERT_LINE); + m_soundlatch->write(space, 0, data); + m_audiocpu->set_input_line(0, ASSERT_LINE); } -WRITE8_MEMBER (yunsung8_state::main_irq_ack_w) +WRITE8_MEMBER(yunsung8_state::main_irq_ack_w) { - m_maincpu->set_input_line (0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } /* @@ -118,18 +118,13 @@ WRITE8_MEMBER(yunsung8_state::sound_bankswitch_w) logerror("%s: Bank %02X\n", machine().describe_context(), data); } -WRITE8_MEMBER(yunsung8_state::adpcm_w) -{ - m_adpcm = data; -} - static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, yunsung8_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("soundbank") // Banked ROM AM_RANGE(0xe000, 0xe000) AM_WRITE(sound_bankswitch_w) // ROM Bank - AM_RANGE(0xe400, 0xe400) AM_WRITE(adpcm_w) + AM_RANGE(0xe400, 0xe400) AM_DEVWRITE("adpcm_select", ls157_device, ba_w) AM_RANGE(0xec00, 0xec01) AM_DEVWRITE("ymsnd", ym3812_device, write) AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_RANGE(0xf800, 0xf800) AM_READ(sound_command_r) // From Main CPU @@ -321,13 +316,12 @@ GFXDECODE_END WRITE_LINE_MEMBER(yunsung8_state::adpcm_int) { - m_msm->data_w(m_adpcm & 0x0F); - m_adpcm >>= 4; + if (!state) + return; - m_toggle ^= 1; - - if (m_toggle) - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_toggle = !m_toggle; + m_adpcm_select->select_w(m_toggle); + m_audiocpu->set_input_line(INPUT_LINE_NMI, m_toggle); } void yunsung8_state::machine_start() @@ -341,7 +335,6 @@ void yunsung8_state::machine_start() save_item(NAME(m_videoram)); save_item(NAME(m_layers_ctrl)); save_item(NAME(m_videobank)); - save_item(NAME(m_adpcm)); save_item(NAME(m_toggle)); } @@ -349,8 +342,7 @@ void yunsung8_state::machine_reset() { m_videobank = 0; m_layers_ctrl = 0; - m_adpcm = 0; - m_toggle = 0; + m_toggle = false; } @@ -384,6 +376,9 @@ static MACHINE_CONFIG_START( yunsung8, yunsung8_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + MCFG_DEVICE_ADD("adpcm_select", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm", msm5205_device, data_w)) + MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb */ MCFG_MSM5205_VCLK_CB(WRITELINE(yunsung8_state, adpcm_int)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) /* 4KHz, 4 Bits */ diff --git a/src/mame/includes/yunsung8.h b/src/mame/includes/yunsung8.h index 35130ae611a..94903be37e1 100644 --- a/src/mame/includes/yunsung8.h +++ b/src/mame/includes/yunsung8.h @@ -7,6 +7,7 @@ *************************************************************************/ #include "machine/gen_latch.h" +#include "machine/74157.h" #include "sound/msm5205.h" class yunsung8_state : public driver_device @@ -17,6 +18,7 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), + m_adpcm_select(*this, "adpcm_select"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch") @@ -32,13 +34,13 @@ public: int m_videobank; /* misc */ - int m_adpcm; - int m_toggle; + bool m_toggle; /* devices */ required_device m_maincpu; required_device m_audiocpu; required_device m_msm; + required_device m_adpcm_select; required_device m_gfxdecode; required_device m_palette; required_device m_soundlatch; @@ -50,7 +52,6 @@ public: DECLARE_READ8_MEMBER(sound_command_r); DECLARE_WRITE8_MEMBER(sound_command_w); DECLARE_WRITE8_MEMBER(main_irq_ack_w); - DECLARE_WRITE8_MEMBER(adpcm_w); DECLARE_WRITE8_MEMBER(videobank_w); DECLARE_READ8_MEMBER(videoram_r); DECLARE_WRITE8_MEMBER(videoram_w); From 3f82e5bc14210fd482f2009a2a4b47a85df752d4 Mon Sep 17 00:00:00 2001 From: Bavarese Date: Mon, 12 Dec 2016 09:15:47 +0100 Subject: [PATCH 66/82] Spacing and comments --- src/mame/drivers/rainbow.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 806d38e8e31..92c8018b1a6 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -2,7 +2,7 @@ // ENABLE BY UNCOMMENTING. ADDITIONALLY, SET SMOOTH SCROLL IN EMULATION (DISABLE BY SETTING JUMP SCROLL. To enter SETUP hit ScrollLock)- //#define BOOST_DEBUG_PERFORMANCE - + /* GDC COLOR EMULATION //-------------------- Differences to VT240: --------------------------------------------------- // - Registers of graphics option not directly mapped (indirect access via mode register) @@ -758,19 +758,19 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_state::hgdc_display_pixels ) // _READ_ BIT MAP from 2 or 4 planes (plane 0 is least, plane 3 most significant). See page 42 / 43 if(m_GDC_MODE_REGISTER & GDC_MODE_HIGHRES) { - address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x7FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); - plane0 = m_video_ram[((address & 0x7fff) + 0x00000) >> 1]; - plane1 = m_video_ram[((address & 0x7fff) + 0x10000) >> 1]; - plane2 = plane3 = 0; + address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x7FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); + plane0 = m_video_ram[((address & 0x7fff) + 0x00000) >> 1]; + plane1 = m_video_ram[((address & 0x7fff) + 0x10000) >> 1]; + plane2 = plane3 = 0; } else { - address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x3FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); - // MED.RESOLUTION (4 planes, 4 color bits, 16 color map entries / 16 (4) MONOCHROME SHADES) - plane0 = m_video_ram[((address & 0x3fff) + 0x00000) >> 1]; - plane1 = m_video_ram[((address & 0x3fff) + 0x10000) >> 1]; - plane2 = m_video_ram[((address & 0x3fff) + 0x20000) >> 1]; - plane3 = m_video_ram[((address & 0x3fff) + 0x30000) >> 1]; + address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x3FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); + // MED.RESOLUTION (4 planes, 4 color bits, 16 color map entries / 16 -or 4- MONOCHROME SHADES) + plane0 = m_video_ram[((address & 0x3fff) + 0x00000) >> 1]; + plane1 = m_video_ram[((address & 0x3fff) + 0x10000) >> 1]; + plane2 = m_video_ram[((address & 0x3fff) + 0x20000) >> 1]; + plane3 = m_video_ram[((address & 0x3fff) + 0x30000) >> 1]; } bool mono = (m_inp13->read() == MONO_MONITOR) ? true : false; // 1 = MONO, 2 = COLOR, 3 = DUAL MONITOR @@ -828,7 +828,7 @@ void rainbow_state::machine_start() if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B (5.01) 0x35 would test for V5.05 { rom[0xf4000 + 0x0303] = 0x00; // disable CRC check - rom[0xf4000 + 0x135e] = 0x00; // FLOPPY / RX-50 WORKAROUND: in case of Z80 RESPONSE FAILURE ($80 bit set in AL), do not block floppy access. + rom[0xf4000 + 0x135e] = 0x00; // Floppy / RX-50 workaround: in case of Z80 RESPONSE FAILURE ($80 bit set in AL), do not block floppy access. rom[0xf4000 + 0x198F] = 0xeb; // cond.JMP to uncond.JMP (disables error message 60...) } @@ -843,7 +843,7 @@ AM_RANGE(0x10000, END_OF_RAM) AM_RAM // There is a 2212 (256 x 4 bit) NVRAM from 0xed000 to 0xed0ff (*) // shadowed at $ec000 - $ecfff and from $ed100 - $edfff. -// (*) ED000 - ED0FF is the area the DEC-100-B BIOS accesses and checks +// (*) ED000 - ED0FF is the area the DEC-100-B Bios accesses and checks // - Specs say that the CPU has direct access to volatile RAM only. // So NVRAM is hidden and loads & saves are triggered within the @@ -2863,7 +2863,6 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w) OPTION_RESET_PATTERNS } - //m_PORT50 = data; break; case 1: // 51h - DATA loaded into register previously written to 53h. From ecdf2d1c6310eac9f1a1e26e9966fc92cc3a3d0d Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 12 Dec 2016 11:47:38 +0100 Subject: [PATCH 67/82] ddealer.cpp: fixed flip screen regression, removed prefixes / suffixes (nw) --- src/mame/drivers/ddealer.cpp | 106 +++++++++++++++++------------------ 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/src/mame/drivers/ddealer.cpp b/src/mame/drivers/ddealer.cpp index dec791a4376..284146145e4 100644 --- a/src/mame/drivers/ddealer.cpp +++ b/src/mame/drivers/ddealer.cpp @@ -9,7 +9,7 @@ Appears to be a down-grade of the nmk16 HW TODO: - -When you use the "gun card" the game gives "minus" points,but points are always added,inaccurate protection? + -When you use the "gun card" the game gives "minus" points, but points are always added, inaccurate protection? -Understand better the video emulation and convert it to tilemaps; -Coinage settings based on those listed at www.crazykong.com/dips/DoubleDealer.txt - coin/credit simulation need fixing; -Decap + emulate MCU, required if the random number generation is going to be accurate; @@ -51,10 +51,10 @@ - There's also MCU response (write/read/test) test just after these writes. (probably data used in the check depends on above writes). It's similar to - jalmah.c tests, but num of responses is different, and shared ram is + jalmah.cpp tests, but num of responses is different, and shared ram is used to communicate with MCU - - After last check (or maybe durning tests ... no idea) + - After last check (or maybe during tests ... no idea) MCU writes $4ef900000604 (jmp $604) to $fe000 and game jumps to this address. - code at $604 writes $20.w to $fe018 and $1.w to $fe01e. @@ -144,38 +144,40 @@ public: required_shared_ptr m_work_ram; required_shared_ptr m_mcu_shared_ram; + /* devices */ + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + /* video-related */ tilemap_t *m_back_tilemap; int m_respcount; - int m_flipscreen; /* misc */ uint8_t m_input_pressed; uint16_t m_coin_input; - DECLARE_WRITE16_MEMBER(ddealer_flipscreen_w); + + DECLARE_WRITE16_MEMBER(flipscreen_w); DECLARE_WRITE16_MEMBER(back_vram_w); - DECLARE_WRITE16_MEMBER(ddealer_vregs_w); - DECLARE_WRITE16_MEMBER(ddealer_mcu_shared_w); - DECLARE_READ16_MEMBER(ddealer_mcu_r); + DECLARE_WRITE16_MEMBER(mcu_shared_w); + DECLARE_READ16_MEMBER(mcu_r); + DECLARE_DRIVER_INIT(ddealer); TILE_GET_INFO_MEMBER(get_back_tile_info); virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update_ddealer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(ddealer_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(ddealer_mcu_sim); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - void ddealer_draw_video_layer( uint16_t* vreg_base, uint16_t* top, uint16_t* bottom, bitmap_ind16 &bitmap, const rectangle &cliprect, int flipy); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(mcu_sim); + void draw_video_layer(uint16_t* vreg_base, uint16_t* top, uint16_t* bottom, bitmap_ind16 &bitmap, const rectangle &cliprect, int flipy); }; -WRITE16_MEMBER(ddealer_state::ddealer_flipscreen_w) +WRITE16_MEMBER(ddealer_state::flipscreen_w) { - m_flipscreen = data & 0x01; + flip_screen_set(data & 0x01); } TILE_GET_INFO_MEMBER(ddealer_state::get_back_tile_info) @@ -189,11 +191,10 @@ TILE_GET_INFO_MEMBER(ddealer_state::get_back_tile_info) void ddealer_state::video_start() { - m_flipscreen = 0; m_back_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ddealer_state::get_back_tile_info),this), TILEMAP_SCAN_COLS, 8, 8, 64, 32); } -void ddealer_state::ddealer_draw_video_layer( uint16_t* vreg_base, uint16_t* top, uint16_t* bottom, bitmap_ind16 &bitmap, const rectangle &cliprect, int flipy) +void ddealer_state::draw_video_layer(uint16_t* vreg_base, uint16_t* top, uint16_t* bottom, bitmap_ind16 &bitmap, const rectangle &cliprect, int flipy) { gfx_element *gfx = m_gfxdecode->gfx(1); @@ -276,40 +277,40 @@ void ddealer_state::ddealer_draw_video_layer( uint16_t* vreg_base, uint16_t* top } -uint32_t ddealer_state::screen_update_ddealer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t ddealer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_back_tilemap->set_scrollx(0, m_flipscreen ? -192 : -64); - m_back_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPY | TILEMAP_FLIPX : 0); + m_back_tilemap->set_scrollx(0, -64); m_back_tilemap->draw(screen, bitmap, cliprect, 0, 0); /* the fg tilemap handling is a little hacky right now, - i'm not sure if it should be a single tilemap with + I'm not sure if it should be a single tilemap with rowscroll / linescroll, or two tilemaps which can be combined, the flipscreen case makes things more difficult to understand */ - - if (!m_flipscreen) + bool const flip = flip_screen(); + + if (!flip) { if (m_vregs[0xcc / 2] & 0x80) { - ddealer_draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, m_flipscreen); - ddealer_draw_video_layer(&m_vregs[0xcc / 2], m_right_fg_vram_top, m_right_fg_vram_bottom, bitmap, cliprect, m_flipscreen); + draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, flip); + draw_video_layer(&m_vregs[0xcc / 2], m_right_fg_vram_top, m_right_fg_vram_bottom, bitmap, cliprect, flip); } else { - ddealer_draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, m_flipscreen); + draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, flip); } } else { if (m_vregs[0xcc / 2] & 0x80) { - ddealer_draw_video_layer(&m_vregs[0xcc / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, m_flipscreen); - ddealer_draw_video_layer(&m_vregs[0x1e0 / 2], m_right_fg_vram_top, m_right_fg_vram_bottom, bitmap, cliprect, m_flipscreen); + draw_video_layer(&m_vregs[0xcc / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, flip); + draw_video_layer(&m_vregs[0x1e0 / 2], m_right_fg_vram_top, m_right_fg_vram_bottom, bitmap, cliprect, flip); } else { - ddealer_draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, m_flipscreen); + draw_video_layer(&m_vregs[0x1e0 / 2], m_left_fg_vram_top, m_left_fg_vram_bottom, bitmap, cliprect, flip); } } @@ -317,7 +318,7 @@ uint32_t ddealer_state::screen_update_ddealer(screen_device &screen, bitmap_ind1 return 0; } -TIMER_DEVICE_CALLBACK_MEMBER(ddealer_state::ddealer_mcu_sim) +TIMER_DEVICE_CALLBACK_MEMBER(ddealer_state::mcu_sim) { /*coin/credit simulation*/ /*$fe002 is used,might be for multiple coins for one credit settings.*/ @@ -351,7 +352,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ddealer_state::ddealer_mcu_sim) m_input_pressed = (m_input_pressed & 0xfb); /*0x104/2 is some sort of "start-lock",i.e. used on the girl selection. - Without it,the game "steals" one credit if you press the start button on that.*/ + Without it, the game "steals" one credit if you press the start button on that.*/ if (m_mcu_shared_ram[0x000 / 2] > 0 && m_work_ram[0x104 / 2] & 1) { if (m_coin_input & 0x08)//start 1 @@ -373,7 +374,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ddealer_state::ddealer_mcu_sim) m_input_pressed = (m_input_pressed & 0xef); } - /*random number generators,controls order of cards*/ + /*random number generators, controls order of cards*/ m_mcu_shared_ram[0x10 / 2] = machine().rand() & 0xffff; m_mcu_shared_ram[0x12 / 2] = machine().rand() & 0xffff; m_mcu_shared_ram[0x14 / 2] = machine().rand() & 0xffff; @@ -389,14 +390,9 @@ WRITE16_MEMBER(ddealer_state::back_vram_w) } -WRITE16_MEMBER(ddealer_state::ddealer_vregs_w) -{ - COMBINE_DATA(&m_vregs[offset]); -} - /****************************************************************************************************** -Protection handling,identical to Hacha Mecha Fighter / Thunder Dragon with different vectors. +Protection handling, identical to Hacha Mecha Fighter / Thunder Dragon with different vectors. ******************************************************************************************************/ @@ -415,7 +411,7 @@ Protection handling,identical to Hacha Mecha Fighter / Thunder Dragon with diffe m_mcu_shared_ram[_protinput_+1] = (_input_ & 0x0000ffff);\ } -WRITE16_MEMBER(ddealer_state::ddealer_mcu_shared_w) +WRITE16_MEMBER(ddealer_state::mcu_shared_w) { COMBINE_DATA(&m_mcu_shared_ram[offset]); @@ -425,7 +421,7 @@ WRITE16_MEMBER(ddealer_state::ddealer_mcu_shared_w) case 0x164/2: PROT_INPUT(0x164/2,0x5678,0x104/2,0x80002); break; case 0x62e/2: PROT_INPUT(0x62e/2,0x9ca3,0x108/2,0x80008); break; case 0x734/2: PROT_INPUT(0x734/2,0xaba2,0x10c/2,0x8000a); break; -/*These enables something for sure,maybe the random number generator?*/ +/*These enables something for sure, maybe the random number generator?*/ //00054C: 33FC B891 000F E828 move.w #$b891, $fe828.l //000554: 33FC C760 000F E950 move.w #$c760, $fe950.l //00055C: 33FC D45F 000F EA7C move.w #$d45f, $fea7c.l @@ -447,7 +443,7 @@ WRITE16_MEMBER(ddealer_state::ddealer_mcu_shared_w) case 0x4de/2: PROT_JSR(0x4de,0x803b,0x96c2); break; case 0x4ee/2: PROT_JSR(0x4ee,0x800c,0x5ca4); break;//palette ram buffer case 0x4fe/2: PROT_JSR(0x4fe,0x8018,0x9818); break; - /*Start-up vector,I think that only the first ram address can be written by the main CPU,or it is a whole sequence.*/ + /*Start-up vector, I think that only the first ram address can be written by the main CPU, or it is a whole sequence.*/ case 0x000/2: if (m_mcu_shared_ram[0x000 / 2] == 0x60fe) { @@ -480,7 +476,7 @@ static ADDRESS_MAP_START( ddealer, AS_PROGRAM, 16, ddealer_state ) AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("UNK") AM_RANGE(0x084000, 0x084003) AM_DEVWRITE8("ymsnd", ym2203_device, write, 0x00ff) // ym ? AM_RANGE(0x088000, 0x0887ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") - AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_SHARE("vregs") // palette ram + AM_RANGE(0x08c000, 0x08cfff) AM_RAM AM_SHARE("vregs") // palette ram /* this might actually be 1 tilemap with some funky rowscroll / columnscroll enabled, I'm not sure */ AM_RANGE(0x090000, 0x090fff) AM_RAM AM_SHARE("left_fg_vratop") @@ -488,10 +484,10 @@ static ADDRESS_MAP_START( ddealer, AS_PROGRAM, 16, ddealer_state ) AM_RANGE(0x092000, 0x092fff) AM_RAM AM_SHARE("left_fg_vrabot") AM_RANGE(0x093000, 0x093fff) AM_RAM AM_SHARE("right_fg_vrabot") //AM_RANGE(0x094000, 0x094001) AM_NOP // always 0? - AM_RANGE(0x098000, 0x098001) AM_WRITE(ddealer_flipscreen_w) + AM_RANGE(0x098000, 0x098001) AM_WRITE(flipscreen_w) AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(back_vram_w) AM_SHARE("back_vram") // bg tilemap AM_RANGE(0x0f0000, 0x0fdfff) AM_RAM AM_SHARE("work_ram") - AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(ddealer_mcu_shared_w) AM_SHARE("mcu_shared_ram") + AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(mcu_shared_w) AM_SHARE("mcu_shared_ram") AM_RANGE(0x0ff000, 0x0fffff) AM_RAM ADDRESS_MAP_END @@ -502,7 +498,7 @@ static INPUT_PORTS_START( ddealer ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) //used,"test" in service mode,unknown purpose + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) //used, "test" in service mode, unknown purpose PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -601,7 +597,6 @@ GFXDECODE_END void ddealer_state::machine_start() { save_item(NAME(m_respcount)); - save_item(NAME(m_flipscreen)); save_item(NAME(m_input_pressed)); save_item(NAME(m_coin_input)); } @@ -609,12 +604,11 @@ void ddealer_state::machine_start() void ddealer_state::machine_reset() { m_respcount = 0; - m_flipscreen = 0; m_input_pressed = 0; m_coin_input = 0; } -INTERRUPT_GEN_MEMBER(ddealer_state::ddealer_interrupt) +INTERRUPT_GEN_MEMBER(ddealer_state::interrupt) { device.execute().set_input_line(4, HOLD_LINE); } @@ -623,8 +617,8 @@ static MACHINE_CONFIG_START( ddealer, ddealer_state ) MCFG_CPU_ADD("maincpu" , M68000, XTAL_16MHz/2) /* 8MHz */ MCFG_CPU_PROGRAM_MAP(ddealer) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ddealer_state, ddealer_interrupt) - MCFG_CPU_PERIODIC_INT_DRIVER(ddealer_state, irq1_line_hold, 90)//guess,controls music tempo,112 is way too fast + MCFG_CPU_VBLANK_INT_DRIVER("screen", ddealer_state, interrupt) + MCFG_CPU_PERIODIC_INT_DRIVER(ddealer_state, irq1_line_hold, 90)//guess, controls music tempo, 112 is way too fast // M50747 or NMK-110 8131 MCU @@ -636,13 +630,13 @@ static MACHINE_CONFIG_START( ddealer, ddealer_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(512, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(ddealer_state, screen_update_ddealer) + MCFG_SCREEN_UPDATE_DRIVER(ddealer_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 0x400) MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx) - MCFG_TIMER_DRIVER_ADD_PERIODIC("coinsim", ddealer_state, ddealer_mcu_sim, attotime::from_hz(10000)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("coinsim", ddealer_state, mcu_sim, attotime::from_hz(10000)) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_6MHz / 8) /* 7.5KHz */ @@ -651,7 +645,7 @@ MACHINE_CONFIG_END -READ16_MEMBER(ddealer_state::ddealer_mcu_r) +READ16_MEMBER(ddealer_state::mcu_r) { static const int resp[] = { @@ -674,7 +668,7 @@ READ16_MEMBER(ddealer_state::ddealer_mcu_r) DRIVER_INIT_MEMBER(ddealer_state,ddealer) { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::ddealer_mcu_r), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::mcu_r), this)); } ROM_START( ddealer ) From 7ee59b6cf7cd17447ae1bf673e0b1fae07dffc6e Mon Sep 17 00:00:00 2001 From: rfka01 Date: Mon, 12 Dec 2016 13:58:46 +0100 Subject: [PATCH 68/82] Removed space per Vas' request --- src/mame/drivers/pg685.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index bf6d14994a3..9681dcd4ea7 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -106,7 +106,7 @@ public: m_vram(*this, "framebuffer"), m_vram16(*this, "framebuffer16"), m_fontram(*this, "charcopy"), - m_fdc (*this, "fdc"), + m_fdc(*this, "fdc"), m_floppy0(*this, "fdc:0"), m_floppy1(*this, "fdc:1") { } From e6d1003aaf3553cd8330bc5e2caaa9785865ddcf Mon Sep 17 00:00:00 2001 From: Bavarese Date: Mon, 12 Dec 2016 14:42:56 +0100 Subject: [PATCH 69/82] White space changes --- src/mame/drivers/rainbow.cpp | 54 +++++++++++++++++------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 92c8018b1a6..4e8b1880f6b 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -763,7 +763,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_state::hgdc_display_pixels ) plane1 = m_video_ram[((address & 0x7fff) + 0x10000) >> 1]; plane2 = plane3 = 0; } - else + else { address = ( m_GDC_SCROLL_BUFFER[ ((address & 0x3FC0) >> 7) & 0xff ] << 7) | (address & 0x7F); // MED.RESOLUTION (4 planes, 4 color bits, 16 color map entries / 16 -or 4- MONOCHROME SHADES) @@ -2727,31 +2727,31 @@ READ16_MEMBER(rainbow_state::vram_r) WRITE16_MEMBER(rainbow_state::vram_w) { if(m_GDC_MODE_REGISTER & GDC_MODE_HIGHRES) - offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x3FC0) >> 6 ] << 6) | (offset & 0x3F); + offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x3FC0) >> 6 ] << 6) | (offset & 0x3F); else - offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x1FC0) >> 6 ] << 6) | (offset & 0x3F); + offset = ( m_GDC_SCROLL_BUFFER[ (offset & 0x1FC0) >> 6 ] << 6) | (offset & 0x3F); offset &= 0xffff; // same as in VT240? uint16_t chr = data; // VT240 : uint8_t if(m_GDC_MODE_REGISTER & GDC_MODE_VECTOR) // VT240 : if(SELECT_VECTOR_PATTERN_REGISTER) { - chr = BITSWAP8(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx); - chr |= (chr << 8); - if(m_patcnt-- == 0) - { - m_patcnt = m_patmult; - if(m_patidx-- == 0) - m_patidx = 7; - } + chr = BITSWAP8(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx); + chr |= (chr << 8); + if(m_patcnt-- == 0) + { + m_patcnt = m_patmult; + if(m_patidx-- == 0) + m_patidx = 7; + } } - else + else { - chr = m_GDC_WRITE_BUFFER[ m_GDC_write_buffer_index++ ]; - m_GDC_write_buffer_index &= 0xf; + chr = m_GDC_WRITE_BUFFER[ m_GDC_write_buffer_index++ ]; + m_GDC_write_buffer_index &= 0xf; - chr |= (m_GDC_WRITE_BUFFER[m_GDC_write_buffer_index++] << 8); - m_GDC_write_buffer_index &= 0xf; + chr |= (m_GDC_WRITE_BUFFER[m_GDC_write_buffer_index++] << 8); + m_GDC_write_buffer_index &= 0xf; } if(m_GDC_MODE_REGISTER & GDC_MODE_ENABLE_WRITES) // 0x10 @@ -2786,10 +2786,10 @@ WRITE16_MEMBER(rainbow_state::vram_w) break; } - if(!(m_GDC_MODE_REGISTER & GDC_MODE_VECTOR)) // 0 : (NOT VECTOR MODE) Text Mode and Write Mask Batch + if(!(m_GDC_MODE_REGISTER & GDC_MODE_VECTOR)) // 0 : Text Mode and Write Mask Batch out = (out & ~m_GDC_WRITE_MASK) | (mem & m_GDC_WRITE_MASK); // // M_MASK (1st use) else - out = (out & ~data) | (mem & data); // VECTOR MODE ! + out = (out & ~data) | (mem & data); // vector mode if(m_GDC_MODE_REGISTER & GDC_MODE_ENABLE_WRITES) // 0x10 m_video_ram[(offset & 0xffff) + (0x8000 * i)] = out; @@ -2840,13 +2840,13 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w) if(offset > 0) // Port $50 reset done @ boot ROM 1EB4/8 regardless if option present. if (m_inp7->read() != 1) { - if(last_message != 1) - { - printf("\nCOLOR GRAPHICS ADAPTER INVOKED. PLEASE TURN ON THE APPROPRIATE DIP SWITCH, THEN RESTART.\n"); - printf("OFFSET: %x (PC=%x)\n", 0x50 +offset , machine().device("maincpu")->safe_pc()); - last_message = 1; - } - return; + if(last_message != 1) + { + printf("\nCOLOR GRAPHICS ADAPTER INVOKED. PLEASE TURN ON THE APPROPRIATE DIP SWITCH, THEN RESTART.\n"); + printf("OFFSET: %x (PC=%x)\n", 0x50 +offset , machine().device("maincpu")->safe_pc()); + last_message = 1; + } + return; } switch(offset) @@ -2855,12 +2855,10 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w) // FIXME: "Any write to this port also resynchronizes the // read/modify/write memory cycles of the Graphics Option to those of the GDC." (?) - //if( (!(m_PORT50 & 1)) && (data & 1)) // PDF QV069 suggests 1 -> 0 -> 1 - if( data & 1 ) // ; most programs just set bit 0 (PACMAN). + if( data & 1 ) // PDF QV069 suggests 1 -> 0 -> 1. Most programs just set bit 0 (PACMAN). { // Graphics option software reset (separate from GDC reset...) OPTION_GRFX_RESET - OPTION_RESET_PATTERNS } break; From 8c15632c496df32440448541ad745bf85118dec5 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 12 Dec 2016 17:46:13 +0100 Subject: [PATCH 70/82] pgm2: improve typo (nw) --- src/mame/drivers/pgm2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp index 813d01a1ee4..9f23d44887f 100644 --- a/src/mame/drivers/pgm2.cpp +++ b/src/mame/drivers/pgm2.cpp @@ -550,18 +550,18 @@ DRIVER_INIT_MEMBER(pgm2_state,kov3) GAME( 2007, orleg2, 0, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V104, China)", MACHINE_IS_SKELETON ) GAME( 2007, orleg2o, orleg2, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V103, China)", MACHINE_IS_SKELETON ) GAME( 2007, orleg2oa, orleg2, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V101, China)", MACHINE_IS_SKELETON ) -// should be earlier verisons too. +// should be earlier venison too. GAME( 2008, kov2nl, 0, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V302, China)", MACHINE_IS_SKELETON ) GAME( 2008, kov2nlo, kov2nl, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V301, China)", MACHINE_IS_SKELETON ) GAME( 2008, kov2nloa, kov2nl, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V300, Taiwan)", MACHINE_IS_SKELETON ) -// should be earlier verisons too. +// should be earlier venison too. GAME( 2010, ddpdojh, 0, pgm2, pgm2, pgm2_state, ddpdojh, ROT270, "IGS", "Dodonpachi Daioujou Tamashii (V201, China)", MACHINE_IS_SKELETON ) -// should be earlier verisons too. +// should be earlier venison too. GAME( 2011, kov3, 0, pgm2, pgm2, pgm2_state, kov3, ROT0, "IGS", "Knights of Valour 3 (V102, China)", MACHINE_IS_SKELETON ) -// should be earlier verisons too. +// should be earlier venison too. // The King of Fighters '98 - Ultimate Match - Hero // Jigsaw World Arena From 7a15fc8978d347ebbfe7efa10ad81a983ae80cb4 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 12 Dec 2016 17:53:29 +0100 Subject: [PATCH 71/82] mmm (nw) --- src/mame/drivers/pgm2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp index 9f23d44887f..e276dc224ad 100644 --- a/src/mame/drivers/pgm2.cpp +++ b/src/mame/drivers/pgm2.cpp @@ -550,18 +550,18 @@ DRIVER_INIT_MEMBER(pgm2_state,kov3) GAME( 2007, orleg2, 0, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V104, China)", MACHINE_IS_SKELETON ) GAME( 2007, orleg2o, orleg2, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V103, China)", MACHINE_IS_SKELETON ) GAME( 2007, orleg2oa, orleg2, pgm2, pgm2, pgm2_state, orleg2, ROT0, "IGS", "Oriental Legend 2 (V101, China)", MACHINE_IS_SKELETON ) -// should be earlier venison too. +// should be earlier versions too. GAME( 2008, kov2nl, 0, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V302, China)", MACHINE_IS_SKELETON ) GAME( 2008, kov2nlo, kov2nl, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V301, China)", MACHINE_IS_SKELETON ) GAME( 2008, kov2nloa, kov2nl, pgm2, pgm2, pgm2_state, kov2nl, ROT0, "IGS", "Knights of Valour 2 New Legend (V300, Taiwan)", MACHINE_IS_SKELETON ) -// should be earlier venison too. +// should be earlier versions too. GAME( 2010, ddpdojh, 0, pgm2, pgm2, pgm2_state, ddpdojh, ROT270, "IGS", "Dodonpachi Daioujou Tamashii (V201, China)", MACHINE_IS_SKELETON ) -// should be earlier venison too. +// should be earlier versions too. GAME( 2011, kov3, 0, pgm2, pgm2, pgm2_state, kov3, ROT0, "IGS", "Knights of Valour 3 (V102, China)", MACHINE_IS_SKELETON ) -// should be earlier venison too. +// should be earlier versions too. // The King of Fighters '98 - Ultimate Match - Hero // Jigsaw World Arena From 6dcc7276b76a1f6f27fdd970cae9bdb396e1f5e5 Mon Sep 17 00:00:00 2001 From: darq Date: Mon, 12 Dec 2016 18:35:58 +0100 Subject: [PATCH 72/82] tecmo_mix: Fixed the saturated colors in Final Star Force (Level 2) (#1823) * tecmo_mix: Fixed macro typo; renamed MCFG_TECMO_MIXER_BLENDSOUCE to MCFG_TECMO_MIXER_BLENDSOURCE (nw) * tecmo_mix: Fixed the 'direct sum' of two ARGB colors. This corrected the wrong 'saturated colors' in Final Star Force (level2: tank underwater, final boss) * tecmo16: Added a video reference for the title screen issue * sum_colors: Corrected some mistakes * sum_colors: Added extra parenthesis to std::min, removed 'extra spaces' (nw) --- src/mame/drivers/gaiden.cpp | 2 +- src/mame/drivers/spbactn.cpp | 4 ++-- src/mame/drivers/tecmo16.cpp | 4 ++-- src/mame/video/tecmo_mix.cpp | 45 +++++++++++++++++++++++------------- src/mame/video/tecmo_mix.h | 6 ++--- 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp index 48b4d121fd9..838d879056a 100644 --- a/src/mame/drivers/gaiden.cpp +++ b/src/mame/drivers/gaiden.cpp @@ -774,7 +774,7 @@ static MACHINE_CONFIG_START( shadoww, gaiden_state ) MCFG_TECMO_MIXER_SHIFTS(10,9,4) MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) - MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x200) + MCFG_TECMO_MIXER_BLENDSOURCE( 0x0800 + 0x000, 0x0800 + 0x200) MCFG_TECMO_MIXER_REVSPRITETILE MCFG_TECMO_MIXER_BGPEN(0x000 + 0x200) diff --git a/src/mame/drivers/spbactn.cpp b/src/mame/drivers/spbactn.cpp index 4ba2a0a2b8b..c3494b35116 100644 --- a/src/mame/drivers/spbactn.cpp +++ b/src/mame/drivers/spbactn.cpp @@ -432,7 +432,7 @@ static MACHINE_CONFIG_START( spbactn, spbactn_state ) MCFG_TECMO_MIXER_SHIFTS(8,10,4) MCFG_TECMO_MIXER_BLENDCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0800 + 0x300, 0x0800 + 0x200, 0x0800 + 0x100, 0x0800 + 0x000 ) - MCFG_TECMO_MIXER_BLENDSOUCE( 0x1000 + 0x000, 0x1000 + 0x100) + MCFG_TECMO_MIXER_BLENDSOURCE( 0x1000 + 0x000, 0x1000 + 0x100) MCFG_TECMO_MIXER_BGPEN(0x800 + 0x300) /* sound hardware */ @@ -485,7 +485,7 @@ static MACHINE_CONFIG_START( spbactnp, spbactn_state ) MCFG_TECMO_MIXER_SHIFTS(12,14,8) MCFG_TECMO_MIXER_BLENDCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0800 + 0x300, 0x0800 + 0x200, 0x0800 + 0x100, 0x0800 + 0x000 ) - MCFG_TECMO_MIXER_BLENDSOUCE( 0x1000 + 0x000, 0x1000 + 0x100) + MCFG_TECMO_MIXER_BLENDSOURCE( 0x1000 + 0x000, 0x1000 + 0x100) MCFG_TECMO_MIXER_BGPEN(0x800 + 0x300) /* sound hardware - different? */ diff --git a/src/mame/drivers/tecmo16.cpp b/src/mame/drivers/tecmo16.cpp index b1a33a42128..6a34ed999a9 100644 --- a/src/mame/drivers/tecmo16.cpp +++ b/src/mame/drivers/tecmo16.cpp @@ -13,7 +13,7 @@ driver by Hau, Nicola Salmoria special thanks to Nekomata, NTD & code-name'Siberia' TODO: -- wrong background in fstarfrc title +- wrong background in fstarfrc title (Video ref. -> https://www.youtube.com/watch?v=EXBTNk-0ejk) - there could be some priorities problems in riot (more noticeable in level 2) @@ -397,7 +397,7 @@ static MACHINE_CONFIG_START( fstarfrc, tecmo16_state ) MCFG_TECMO_MIXER_SHIFTS(10,9,4) MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 ) MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ) - MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x100) // riot seems to set palettes in 0x800 + 0x200, could be more to this.. + MCFG_TECMO_MIXER_BLENDSOURCE( 0x0800 + 0x000, 0x0800 + 0x100) // riot seems to set palettes in 0x800 + 0x200, could be more to this.. MCFG_TECMO_MIXER_REVSPRITETILE MCFG_TECMO_MIXER_BGPEN(0x000 + 0x300) diff --git a/src/mame/video/tecmo_mix.cpp b/src/mame/video/tecmo_mix.cpp index 013eed8ba99..33c4abb835b 100644 --- a/src/mame/video/tecmo_mix.cpp +++ b/src/mame/video/tecmo_mix.cpp @@ -89,6 +89,28 @@ void tecmo_mix_device::set_bgpen(device_t &device, int bgpen) dev.m_bgpen = bgpen; } +uint32_t tecmo_mix_device::sum_colors (const pen_t *pal, int c1_idx, int c2_idx) +{ + const pen_t c1 = pal[c1_idx]; + const pen_t c2 = pal[c2_idx]; + + const int c1_a = (c1 >> 24) & 0xFF; + const int c1_r = (c1 >> 16) & 0xFF; + const int c1_g = (c1 >> 8) & 0xFF; + const int c1_b = c1 & 0xFF; + + const int c2_a = (c2 >> 24) & 0xFF; + const int c2_r = (c2 >> 16) & 0xFF; + const int c2_g = (c2 >> 8) & 0xFF; + const int c2_b = c2 & 0xFF; + + const uint8_t a = (std::min)(0xFF, c1_a + c2_a); + const uint8_t r = (std::min)(0xFF, c1_r + c2_r); + const uint8_t g = (std::min)(0xFF, c1_g + c2_g); + const uint8_t b = (std::min)(0xFF, c1_b + c2_b); + + return ((a << 24) | (r << 16) | (g << 8) | b); +} void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, palette_device &palette, bitmap_ind16* bitmap_bg, bitmap_ind16* bitmap_fg, bitmap_ind16* bitmap_tx, bitmap_ind16* bitmap_sp) { @@ -113,7 +135,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, uint16_t m_sprbln = (sprpixel >> m_sprbln_shift) & 0x1; uint16_t m_sprcol = (sprpixel >> m_sprcol_shift) & 0xf; - sprpixel = (sprpixel & 0xf) | (m_sprcol << 4); //sprpixel &= 0xff; @@ -157,7 +178,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // solid sprite dd[x] = paldata[sprpixel + m_spregular_comp]; } - } } else if (m_sprpri == (1 ^ m_revspritetile)) // above bg, behind tx, fg @@ -171,12 +191,12 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // needs if bgpixel & 0xf check? // fg is used and blended with sprite, sprite is used and blended with bg? -- used on 'trail' of ball when ball is under the transparent area - dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source]; // WRONG?? + dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); // WRONG?? } else { // fg is used and blended with opaque sprite - dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[sprpixel + m_spblend_comp]; + dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, sprpixel + m_spblend_comp); } } else @@ -184,7 +204,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // fg is used and opaque dd[x] = paldata[fgpixel + m_fgregular_comp]; } - } else { @@ -193,7 +212,7 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // needs if bgpixel & 0xf check? //fg isn't used, sprite is used and blended with bg? -- used on trail of ball / flippers (looks odd) -- some ninja gaiden enemy deaths (when behind fg) (looks ok?) (maybe we need to check for colour saturation?) - dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source]; + dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); } else { @@ -201,8 +220,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, dd[x] = paldata[sprpixel + m_spregular_comp]; } } - - } else if (m_sprpri == (2 ^ m_revspritetile)) // above bg,fg, behind tx { @@ -218,18 +235,15 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, else { // blended sprite over solid fgpixel? - dd[x] = paldata[fgpixel + m_fgblend_comp] + paldata[sprpixel + m_spblend_source]; + dd[x] = sum_colors (paldata, fgpixel + m_fgblend_comp, sprpixel + m_spblend_source); } } else // needs if bgpixel & 0xf check? { // blended sprite over solid bg pixel - dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source]; - // dd[x] = rand(); + dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); + // dd[x] = rand(); } - - - } else { @@ -261,14 +275,13 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, if (fgbln) { // needs if bgpixel & 0xf check? - dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[bgpixel + m_bgblend_comp]; + dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, bgpixel + m_bgblend_comp); } else { dd[x] = paldata[fgpixel + m_fgregular_comp]; } - } else if (bgpixel & 0x0f) { diff --git a/src/mame/video/tecmo_mix.h b/src/mame/video/tecmo_mix.h index fdf0a00b8c4..3dbf2f04aac 100644 --- a/src/mame/video/tecmo_mix.h +++ b/src/mame/video/tecmo_mix.h @@ -46,9 +46,7 @@ protected: int m_bgpen; private: - - - + uint32_t sum_colors (const pen_t *pal, int c1_idx, int c2_idx); }; extern const device_type TECMO_MIXER; @@ -64,7 +62,7 @@ extern const device_type TECMO_MIXER; #define MCFG_TECMO_MIXER_REGULARCOLS(_bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp) \ tecmo_mix_device::set_regularcols(*device, _bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp); -#define MCFG_TECMO_MIXER_BLENDSOUCE(_spblend_source, _fgblend_source) \ +#define MCFG_TECMO_MIXER_BLENDSOURCE(_spblend_source, _fgblend_source) \ tecmo_mix_device::set_blendsource(*device, _spblend_source, _fgblend_source); #define MCFG_TECMO_MIXER_REVSPRITETILE \ From f57f9df10a39cde81a162dc647059233e4e6bfcd Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 12 Dec 2016 18:38:12 +0100 Subject: [PATCH 73/82] video/tecmo_mix.cpp: update method to MAME's coding style guidelines (nw) --- src/mame/video/tecmo_mix.cpp | 14 +++++++------- src/mame/video/tecmo_mix.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mame/video/tecmo_mix.cpp b/src/mame/video/tecmo_mix.cpp index 33c4abb835b..4de75355d33 100644 --- a/src/mame/video/tecmo_mix.cpp +++ b/src/mame/video/tecmo_mix.cpp @@ -89,7 +89,7 @@ void tecmo_mix_device::set_bgpen(device_t &device, int bgpen) dev.m_bgpen = bgpen; } -uint32_t tecmo_mix_device::sum_colors (const pen_t *pal, int c1_idx, int c2_idx) +uint32_t tecmo_mix_device::sum_colors(const pen_t *pal, int c1_idx, int c2_idx) { const pen_t c1 = pal[c1_idx]; const pen_t c2 = pal[c2_idx]; @@ -191,12 +191,12 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // needs if bgpixel & 0xf check? // fg is used and blended with sprite, sprite is used and blended with bg? -- used on 'trail' of ball when ball is under the transparent area - dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); // WRONG?? + dd[x] = sum_colors(paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); // WRONG?? } else { // fg is used and blended with opaque sprite - dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, sprpixel + m_spblend_comp); + dd[x] = sum_colors(paldata, fgpixel + m_fgblend_source, sprpixel + m_spblend_comp); } } else @@ -212,7 +212,7 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, // needs if bgpixel & 0xf check? //fg isn't used, sprite is used and blended with bg? -- used on trail of ball / flippers (looks odd) -- some ninja gaiden enemy deaths (when behind fg) (looks ok?) (maybe we need to check for colour saturation?) - dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); + dd[x] = sum_colors(paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); } else { @@ -235,13 +235,13 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, else { // blended sprite over solid fgpixel? - dd[x] = sum_colors (paldata, fgpixel + m_fgblend_comp, sprpixel + m_spblend_source); + dd[x] = sum_colors(paldata, fgpixel + m_fgblend_comp, sprpixel + m_spblend_source); } } else // needs if bgpixel & 0xf check? { // blended sprite over solid bg pixel - dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); + dd[x] = sum_colors(paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); // dd[x] = rand(); } } @@ -275,7 +275,7 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, if (fgbln) { // needs if bgpixel & 0xf check? - dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, bgpixel + m_bgblend_comp); + dd[x] = sum_colors(paldata, fgpixel + m_fgblend_source, bgpixel + m_bgblend_comp); } else diff --git a/src/mame/video/tecmo_mix.h b/src/mame/video/tecmo_mix.h index 3dbf2f04aac..b305b63d754 100644 --- a/src/mame/video/tecmo_mix.h +++ b/src/mame/video/tecmo_mix.h @@ -46,7 +46,7 @@ protected: int m_bgpen; private: - uint32_t sum_colors (const pen_t *pal, int c1_idx, int c2_idx); + uint32_t sum_colors(const pen_t *pal, int c1_idx, int c2_idx); }; extern const device_type TECMO_MIXER; From 2f9ef59017f515a22b54d79ecf6451fd256f7a54 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Mon, 12 Dec 2016 18:16:09 -0500 Subject: [PATCH 74/82] Some input port cleanup/simplification for Sunset Riders (4 Player). All inputs mappable are shown in the Test Mode even if they are not used for that particular versions/cabinet type. (nw) --- src/mame/drivers/tmnt.cpp | 99 ++++++++------------------------------- 1 file changed, 19 insertions(+), 80 deletions(-) diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp index 3643840ad41..6070c0f3507 100644 --- a/src/mame/drivers/tmnt.cpp +++ b/src/mame/drivers/tmnt.cpp @@ -1696,118 +1696,57 @@ static INPUT_PORTS_START( ssriders ) INPUT_PORTS_END static INPUT_PORTS_START( ssridr4p ) - PORT_START("COINS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_INCLUDE( ssriders ) + + PORT_MODIFY("COINS") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) - PORT_START("P1") + PORT_MODIFY("P1") KONAMI16_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN ) - PORT_START("P2") + PORT_MODIFY("P2") KONAMI16_LSB( 2, IPT_UNKNOWN, IPT_UNKNOWN ) - PORT_START("P3") + PORT_MODIFY("P3") KONAMI16_LSB( 3, IPT_UNKNOWN, IPT_UNKNOWN ) - PORT_START("P4") + PORT_MODIFY("P4") KONAMI16_LSB( 4, IPT_UNKNOWN, IPT_UNKNOWN ) - PORT_START("EEPROM") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* ?? TMNT2: OBJMPX */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") /* ?? TMNT2: NVBLK */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* ?? TMNT2: IPL0 */ - PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused? */ - PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW ) - - PORT_START( "EEPROMOUT" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write) INPUT_PORTS_END -/* Same as 'ssridr4p', but additional Start button for each player. +/* Same as 'ssridr4p', but additional Start button for each player. Seemingly only needed in sets with *U* region/version codes (EG: ADD, UDA). COIN3, COIN4, SERVICE3 and SERVICE4 only have an effect in the "test mode". */ static INPUT_PORTS_START( ssrid4ps ) - PORT_START("COINS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) - PORT_START("P1") + PORT_INCLUDE( ssridr4p ) + + PORT_MODIFY("P1") KONAMI16_LSB( 1, IPT_UNKNOWN, IPT_START1 ) - PORT_START("P2") + PORT_MODIFY("P2") KONAMI16_LSB( 2, IPT_UNKNOWN, IPT_START2 ) - PORT_START("P3") + PORT_MODIFY("P3") KONAMI16_LSB( 3, IPT_UNKNOWN, IPT_START3 ) - PORT_START("P4") + PORT_MODIFY("P4") KONAMI16_LSB( 4, IPT_UNKNOWN, IPT_START4 ) - PORT_START("EEPROM") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* ?? TMNT2: OBJMPX */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") /* ?? TMNT2: NVBLK */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* ?? TMNT2: IPL0 */ - PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused? */ - PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW ) - - PORT_START( "EEPROMOUT" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write) INPUT_PORTS_END /* Version for the bootleg, which has the service switch a little different */ static INPUT_PORTS_START( sunsetbl ) - PORT_START("COINS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) - PORT_START("P1") - KONAMI16_LSB( 1, IPT_UNKNOWN, IPT_START1 ) + PORT_INCLUDE( ssrid4ps ) - PORT_START("P2") - KONAMI16_LSB( 2, IPT_UNKNOWN, IPT_START2 ) - - PORT_START("P3") - KONAMI16_LSB( 3, IPT_UNKNOWN, IPT_START3 ) - - PORT_START("P4") - KONAMI16_LSB( 4, IPT_UNKNOWN, IPT_START4 ) - - PORT_START("EEPROM") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_MODIFY("EEPROM") PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW ) PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused? */ - PORT_START( "EEPROMOUT" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write) INPUT_PORTS_END static INPUT_PORTS_START( qgakumon ) @@ -4303,7 +4242,7 @@ GAME( 1991, tmnt22pu, tmnt2, tmnt2, ssriders, driver_device, 0, GAME( 1993, qgakumon, 0, tmnt2, qgakumon, driver_device, 0, ROT0, "Konami", "Quiz Gakumon no Susume (Japan ver. JA2 Type L)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssriders, 0, ssriders, ssridr4p, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver EAC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1991, ssriderseaa, ssriders, ssriders, ssrid4ps, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver EAA)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1991, ssriderseaa, ssriders, ssriders, ssridr4p, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver EAA)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersebd, ssriders, ssriders, ssriders, driver_device, 0, ROT0, "Konami", "Sunset Riders (2 Players ver EBD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersebc, ssriders, ssriders, ssriders, driver_device, 0, ROT0, "Konami", "Sunset Riders (2 Players ver EBC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersuda, ssriders, ssriders, ssrid4ps, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver UDA)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) @@ -4312,8 +4251,8 @@ GAME( 1991, ssridersuab, ssriders, ssriders, ssridr4p, driver_device, 0, GAME( 1991, ssridersubc, ssriders, ssriders, ssriders, driver_device, 0, ROT0, "Konami", "Sunset Riders (2 Players ver UBC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersadd, ssriders, ssriders, ssrid4ps, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver ADD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersabd, ssriders, ssriders, ssriders, driver_device, 0, ROT0, "Konami", "Sunset Riders (2 Players ver ABD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1991, ssridersjad, ssriders, ssriders, ssrid4ps, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver JAD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1991, ssridersjac, ssriders, ssriders, ssrid4ps, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver JAC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1991, ssridersjad, ssriders, ssriders, ssridr4p, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver JAD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1991, ssridersjac, ssriders, ssriders, ssridr4p, driver_device, 0, ROT0, "Konami", "Sunset Riders (4 Players ver JAC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersjbd, ssriders, ssriders, ssriders, driver_device, 0, ROT0, "Konami", "Sunset Riders (2 Players ver JBD)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssridersb, ssriders, sunsetbl, sunsetbl, driver_device, 0, ROT0, "bootleg","Sunset Riders (bootleg 4 Players ver ADD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, ssriders2, ssriders, sunsetbl, sunsetbl, driver_device, 0, ROT0, "bootleg","Sunset Riders 2 (bootleg 4 Players ver ADD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) From a68a72a7f762b0375d7868d5fac53b8d095c73da Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Mon, 12 Dec 2016 09:17:29 -0500 Subject: [PATCH 75/82] [Imgtool] Fixed a recently introduced error in the 'dir' command line command --- src/tools/imgtool/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp index f1087798c0d..79eec751834 100644 --- a/src/tools/imgtool/main.cpp +++ b/src/tools/imgtool/main.cpp @@ -179,7 +179,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) imgtool_dirent ent; char buf[512]; char last_modified[19]; - const char *path; + std::string path; int partition_index = 0; std::string info; @@ -193,7 +193,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) if (err) goto done; - path = argc > 2 ? argv[2] : nullptr; + path = argc > 2 ? argv[2] : ""; err = imgtool::directory::open(*partition, path, imgenum); if (err) @@ -204,7 +204,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) total_count = 0; total_size = 0; - fprintf(stdout, "Contents of %s:%s\n", argv[1], path ? path : ""); + fprintf(stdout, "Contents of %s:%s\n", argv[1], path.c_str()); info = image->info(); if (!info.empty()) From 1b462f74345f0549157d3c57c80d562bf19010b3 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Mon, 12 Dec 2016 20:13:28 -0500 Subject: [PATCH 76/82] [Imgtool] Cleaned up the output of the 'dir' command --- src/tools/imgtool/main.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp index f1087798c0d..6ea34d6d6d7 100644 --- a/src/tools/imgtool/main.cpp +++ b/src/tools/imgtool/main.cpp @@ -177,12 +177,21 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) imgtool::partition::ptr partition; imgtool::directory::ptr imgenum; imgtool_dirent ent; - char buf[512]; char last_modified[19]; const char *path; int partition_index = 0; std::string info; + // build the separator + const int columnwidth_filename = 30; + const int columnwidth_filesize = 8; + const int columnwidth_attributes = 15; + const int columnwidth_lastmodified = 18; + std::string separator = std::string(columnwidth_filename, '-') + " " + + std::string(columnwidth_filesize, '-') + " " + + std::string(columnwidth_attributes, '-') + " " + + std::string(columnwidth_lastmodified, '-'); + // attempt to open image err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_READ, image); if (err) @@ -209,14 +218,14 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) info = image->info(); if (!info.empty()) fprintf(stdout, "%s\n", info.c_str()); - fprintf(stdout, "------------------------------ -------- --------------- ------------------\n"); + + fprintf(stdout, "%s\n", separator.c_str()); while (((err = imgenum->get_next(ent)) == 0) && !ent.eof) { - if (ent.directory) - snprintf(buf, sizeof(buf), ""); - else - snprintf(buf, sizeof(buf), "%u", (unsigned int) ent.filesize); + std::string filesize_string = ent.directory + ? "" + : string_format("%u", (unsigned int) ent.filesize); if (ent.lastmodified_time != 0) strftime(last_modified, sizeof(last_modified), "%d-%b-%y %H:%M:%S", @@ -225,7 +234,11 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) if (ent.hardlink) strcat(ent.filename, " "); - fprintf(stdout, "%-30s %8s %15s %18s\n", ent.filename, buf, ent.attr, last_modified); + fprintf(stdout, "%*s %*s %*s %*s\n", + -columnwidth_filename, ent.filename, + columnwidth_filesize, filesize_string.c_str(), + columnwidth_attributes, ent.attr, + columnwidth_lastmodified, last_modified); if (ent.softlink && ent.softlink[0] != '\0') fprintf(stdout, "-> %s\n", ent.softlink); @@ -244,7 +257,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[]) if (err) goto done; - fprintf(stdout, "------------------------ ------ ---------------\n"); + fprintf(stdout, "%s\n", separator.c_str()); fprintf(stdout, "%8i File(s) %8i bytes\n", total_count, total_size); if (!freespace_err) fprintf(stdout, " %8u bytes free\n", (unsigned int) freespace); From bbdffb3327af4b54138486c753bbeaee6d7ae94d Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 12 Dec 2016 23:39:36 -0500 Subject: [PATCH 77/82] automat: Sound improvements - Reduce YM2203 speed to match music pitch on reference video - Add second MSM5205 + two 74LS157 and fix communications - Add sound banking (probably not entirely correct) --- src/mame/drivers/dec0.cpp | 114 ++++++++++++++++++++++++++------------ src/mame/includes/dec0.h | 27 ++++++--- 2 files changed, 99 insertions(+), 42 deletions(-) diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp index fabe82a3943..95b63fef2fc 100644 --- a/src/mame/drivers/dec0.cpp +++ b/src/mame/drivers/dec0.cpp @@ -43,7 +43,8 @@ Original Service Manuals and Service Mode (when available). ToDo: - Fix protection simulation in Birdie Try (that part needs at least comparison with a real board); -- graphics are completely broken in Automat and Secret Agent (bootleg); +- Fix remaining graphical problems in Automat (bootleg); +- graphics and sound are completely broken in Secret Agent (bootleg); - Fighting Fantasy (bootleg) doesn't boot at all; - Hook up the 68705 in Midnight Resistance (bootleg) (it might not be used, leftover from the Fighting Fantasy bootleg on the same PCB?) - Get rid of ROM patches in Sly Spy and Hippodrome; @@ -531,9 +532,14 @@ ADDRESS_MAP_END void dec0_automat_state::machine_start() { - save_item(NAME(m_automat_adpcm_byte)); - save_item(NAME(m_automat_msm5205_vclk_toggle)); + m_adpcm_toggle1 = false; + m_adpcm_toggle2 = false; + save_item(NAME(m_adpcm_toggle1)); + save_item(NAME(m_adpcm_toggle2)); save_item(NAME(m_automat_scroll_regs)); + + m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000); + m_soundbank->set_entry(0); } @@ -584,6 +590,8 @@ static ADDRESS_MAP_START( automat_map, AS_PROGRAM, 16, dec0_automat_state ) AM_RANGE(0x400000, 0x400007) AM_WRITE(automat_scroll_w) AM_RANGE(0x400008, 0x400009) AM_WRITE(dec0_priority_w) + AM_RANGE(0x500000, 0x500001) AM_WRITENOP // ??? + AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_SHARE("ram") /* Main ram */ AM_RANGE(0xffc000, 0xffcfff) AM_RAM AM_SHARE("spriteram") /* Sprites */ ADDRESS_MAP_END @@ -616,19 +624,16 @@ static ADDRESS_MAP_START( secretab_map, AS_PROGRAM, 16, dec0_automat_state ) ADDRESS_MAP_END -WRITE8_MEMBER(dec0_automat_state::automat_adpcm_w) -{ - m_automat_adpcm_byte = data; -} - static ADDRESS_MAP_START( automat_s_map, AS_PROGRAM, 8, dec0_automat_state ) - AM_RANGE(0x0103, 0x0103) AM_WRITENOP + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("soundbank") AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xc800, 0xc801) AM_DEVWRITE("2203a", ym2203_device, write) - AM_RANGE(0xd800, 0xd800) AM_DEVREAD("soundlatch", generic_latch_8_device, read) - AM_RANGE(0xd000, 0xd001) AM_DEVWRITE("2203b", ym2203_device, write) - AM_RANGE(0xf000, 0xf000) AM_WRITE(automat_adpcm_w) - AM_RANGE(0x0000, 0xffff) AM_ROM + AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE("2203a", ym2203_device, read, write) + AM_RANGE(0xd000, 0xd001) AM_DEVREADWRITE("2203b", ym2203_device, read, write) + AM_RANGE(0xd800, 0xd800) AM_READ(sound_command_r) + AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("adpcm_select2", ls157_device, ba_w) + AM_RANGE(0xe800, 0xe800) AM_WRITE(sound_bankswitch_w) + AM_RANGE(0xf000, 0xf000) AM_DEVWRITE("adpcm_select1", ls157_device, ba_w) ADDRESS_MAP_END static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, dec0_state ) @@ -1358,19 +1363,37 @@ static MACHINE_CONFIG_DERIVED( dec1, dec0_base ) MACHINE_CONFIG_END -WRITE_LINE_MEMBER(dec0_automat_state::automat_vclk_cb) +READ8_MEMBER(dec0_automat_state::sound_command_r) { - if (m_automat_msm5205_vclk_toggle == 0) - { - m_msm->data_w(m_automat_adpcm_byte & 0xf); - } - else - { - m_msm->data_w(m_automat_adpcm_byte >> 4); - //device->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); // gives some scratch samples but breaks other sounds too - } + m_audiocpu->set_input_line(0, CLEAR_LINE); + return m_soundlatch->read(space, 0); +} - m_automat_msm5205_vclk_toggle ^= 1; +WRITE8_MEMBER(dec0_automat_state::sound_bankswitch_w) +{ + m_msm1->reset_w(BIT(data, 3)); + m_msm2->reset_w(BIT(data, 4)); + + m_soundbank->set_entry(data & 3); +} + +WRITE_LINE_MEMBER(dec0_automat_state::msm1_vclk_cb) +{ + if (!state) + return; + + m_adpcm_toggle1 = !m_adpcm_toggle1; + m_adpcm_select1->select_w(m_adpcm_toggle1); + m_audiocpu->set_input_line(INPUT_LINE_NMI, m_adpcm_toggle1); +} + +WRITE_LINE_MEMBER(dec0_automat_state::msm2_vclk_cb) +{ + if (!state) + return; + + m_adpcm_toggle2 = !m_adpcm_toggle2; + m_adpcm_select2->select_w(m_adpcm_toggle2); } @@ -1418,21 +1441,32 @@ static MACHINE_CONFIG_START( automat, dec0_automat_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("2203a", YM2203, 1500000) + MCFG_SOUND_ADD("2203a", YM2203, 1250000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) MCFG_SOUND_ROUTE(3, "mono", 0.35) - MCFG_SOUND_ADD("2203b", YM2203, 1500000) + MCFG_SOUND_ADD("2203b", YM2203, 1250000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) MCFG_SOUND_ROUTE(3, "mono", 0.35) - MCFG_SOUND_ADD("msm", MSM5205, 384000/2) - MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, automat_vclk_cb)) - MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) + MCFG_DEVICE_ADD("adpcm_select1", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w)) + + MCFG_DEVICE_ADD("adpcm_select2", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w)) + + MCFG_SOUND_ADD("msm1", MSM5205, 384000) + MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm1_vclk_cb)) + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_SOUND_ADD("msm2", MSM5205, 384000) + MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm2_vclk_cb)) + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -1481,23 +1515,33 @@ static MACHINE_CONFIG_START( secretab, dec0_automat_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("2203a", YM2203, 1500000) + MCFG_SOUND_ADD("2203a", YM2203, 1250000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) MCFG_SOUND_ROUTE(3, "mono", 0.35) - MCFG_SOUND_ADD("2203b", YM2203, 1500000) + MCFG_SOUND_ADD("2203b", YM2203, 1250000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) MCFG_SOUND_ROUTE(3, "mono", 0.35) - MCFG_SOUND_ADD("msm", MSM5205, 384000/2) - MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, automat_vclk_cb)) - MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) + MCFG_DEVICE_ADD("adpcm_select1", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w)) + + MCFG_DEVICE_ADD("adpcm_select2", LS157, 0) + MCFG_74LS157_OUT_CB(DEVWRITE8("msm2", msm5205_device, data_w)) + + MCFG_SOUND_ADD("msm1", MSM5205, 384000) + MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm1_vclk_cb)) + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_ADD("msm2", MSM5205, 384000) + MCFG_MSM5205_VCLK_CB(WRITELINE(dec0_automat_state, msm2_vclk_cb)) + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S96_4B) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h index b6fe6f88243..04fa13641fd 100644 --- a/src/mame/includes/dec0.h +++ b/src/mame/includes/dec0.h @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail +#include "machine/74157.h" #include "machine/bankdev.h" #include "machine/gen_latch.h" #include "video/decbac06.h" @@ -15,7 +16,6 @@ public: m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), m_mcu(*this, "mcu"), - m_msm(*this, "msm"), m_palette(*this, "palette"), m_tilegen1(*this, "tilegen1"), m_tilegen2(*this, "tilegen2"), @@ -33,7 +33,6 @@ public: required_device m_audiocpu; optional_device m_subcpu; optional_device m_mcu; - optional_device m_msm; required_device m_palette; optional_device m_tilegen1; optional_device m_tilegen2; @@ -115,22 +114,36 @@ class dec0_automat_state : public dec0_state { public: dec0_automat_state(const machine_config &mconfig, device_type type, const char *tag) - : dec0_state(mconfig, type, tag) { + : dec0_state(mconfig, type, tag), + m_msm1(*this, "msm1"), + m_msm2(*this, "msm2"), + m_adpcm_select1(*this, "adpcm_select1"), + m_adpcm_select2(*this, "adpcm_select2"), + m_soundbank(*this, "soundbank") + { } - uint8_t m_automat_adpcm_byte; - int m_automat_msm5205_vclk_toggle; + required_device m_msm1; + required_device m_msm2; + required_device m_adpcm_select1; + required_device m_adpcm_select2; + required_memory_bank m_soundbank; + + bool m_adpcm_toggle1; + bool m_adpcm_toggle2; uint16_t m_automat_scroll_regs[4]; DECLARE_WRITE16_MEMBER(automat_control_w); - DECLARE_WRITE8_MEMBER(automat_adpcm_w); DECLARE_READ16_MEMBER( automat_palette_r ); DECLARE_WRITE16_MEMBER( automat_palette_w ); DECLARE_WRITE16_MEMBER( automat_scroll_w ) { COMBINE_DATA(&m_automat_scroll_regs[offset]); } - DECLARE_WRITE_LINE_MEMBER(automat_vclk_cb); + DECLARE_READ8_MEMBER(sound_command_r); + DECLARE_WRITE8_MEMBER(sound_bankswitch_w); + DECLARE_WRITE_LINE_MEMBER(msm1_vclk_cb); + DECLARE_WRITE_LINE_MEMBER(msm2_vclk_cb); virtual void machine_start() override; From 5fa910444708fcce3401aca81220de693bc63c40 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Tue, 13 Dec 2016 08:42:54 +0100 Subject: [PATCH 78/82] Fixed a regression fifo bug and a bug in the handling of Special Interrupts --- src/devices/machine/z80scc.cpp | 30 ++++++++++-------------------- src/devices/machine/z80scc.h | 4 ++-- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 825cb618c5c..ef665d29970 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -1772,17 +1772,19 @@ void z80scc_channel::do_sccreg_wr1(uint8_t data) break; case WR1_RX_INT_FIRST: - LOG(("- Receiver Interrupt on First Character\n")); - break; - - case WR1_RX_INT_ALL_PARITY: - LOG(("- Receiver Interrupt on All Characters, Parity Affects Vector\n")); + LOG(("- Receiver Interrupt on First Character or Special Conditions\n")); break; case WR1_RX_INT_ALL: - LOG(("- Receiver Interrupt on All Characters\n")); + LOG(("- Receiver Interrupt on All Characters or Special Conditions\n")); + break; + + case WR1_RX_INT_PARITY: + LOG(("- Receiver Interrupt on Special Conditions only\n")); break; } + if ((data & WR1_RX_INT_MODE_MASK) == WR1_PARITY_IS_SPEC_COND) + LOG(("- Parity error is a Special Condition\n")); m_uart->check_interrupts(); } @@ -2266,13 +2268,13 @@ uint8_t z80scc_channel::data_read() received into the other bytes of the Receive FIFO.*/ // load data from the FIFO - data = m_rx_fifo_rp_data(); + data = m_rx_data_fifo[m_rx_fifo_rp]; // load error status from the FIFO m_rr1 = (m_rr1 & ~(RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR)) | m_rx_error_fifo[m_rx_fifo_rp]; // trigger interrupt and lock the fifo if an error is present - if (m_rr1 & (RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR)) + if (m_rr1 & (RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | ((m_wr1 & WR1_PARITY_IS_SPEC_COND) ? RR1_PARITY_ERROR : 0))) { logerror("Rx Error %02x\n", m_rr1 & (RR1_CRC_FRAMING_ERROR | RR1_RX_OVERRUN_ERROR | RR1_PARITY_ERROR)); m_uart->trigger_interrupt(m_index, INT_SPECIAL); @@ -2293,18 +2295,6 @@ uint8_t z80scc_channel::data_read() return data; } -/* Get data from top of fifo data but restore read pointer in case of exit latch lock */ -uint8_t z80scc_channel::m_rx_fifo_rp_data() -{ - uint8_t data; - uint8_t old_rp = m_rx_fifo_rp; - m_rx_fifo_rp_step(); - data = m_rx_data_fifo[m_rx_fifo_rp]; - m_rx_fifo_rp = old_rp; - - return data; -} - /* Step read pointer */ void z80scc_channel::m_rx_fifo_rp_step() { diff --git a/src/devices/machine/z80scc.h b/src/devices/machine/z80scc.h index fa5f806c12c..496c82f4d45 100644 --- a/src/devices/machine/z80scc.h +++ b/src/devices/machine/z80scc.h @@ -409,8 +409,8 @@ protected: WR1_RX_INT_MODE_MASK = 0x18, WR1_RX_INT_DISABLE = 0x00, WR1_RX_INT_FIRST = 0x08, - WR1_RX_INT_ALL_PARITY = 0x10, - WR1_RX_INT_ALL = 0x18, + WR1_RX_INT_ALL = 0x10, + WR1_RX_INT_PARITY = 0x18, WR1_WRDY_ON_RX_TX = 0x20, WR1_WRDY_FUNCTION = 0x40, WR1_WRDY_ENABLE = 0x80 From b499d6e80530be048819f10779772bbc7b3bfccf Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 13 Dec 2016 12:05:45 -0500 Subject: [PATCH 79/82] secretab: Don't apply H6280 decryption to sound Z80 (nw) --- src/mame/drivers/dec0.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp index 95b63fef2fc..996cd071389 100644 --- a/src/mame/drivers/dec0.cpp +++ b/src/mame/drivers/dec0.cpp @@ -3375,5 +3375,5 @@ GAME( 1989, ffantasybl, hippodrm, ffantasybl, ffantasybl, dec0_state, ffantasybl GAME( 1988, drgninjab2, baddudes, baddudes, drgninja, dec0_state, baddudes, ROT0, "bootleg", "Dragonninja (bootleg with 68705)", MACHINE_SUPPORTS_SAVE ) // is this the same board as above? (region warning hacked to World, but still shows Japanese text) // these are different to the above but quite similar to each other -GAME( 1988, automat, robocop, automat, robocop, dec0_state, robocop, ROT0, "bootleg", "Automat (bootleg of Robocop)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // sound rom / music from section z with mods for ADPCM? -GAME( 1989, secretab, secretag, secretab, slyspy, dec0_state, slyspy, ROT0, "bootleg", "Secret Agent (bootleg)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1988, automat, robocop, automat, robocop, dec0_state, robocop, ROT0, "bootleg", "Automat (bootleg of Robocop)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // sound rom / music from section z with mods for ADPCM? +GAME( 1989, secretab, secretag, secretab, slyspy, driver_device, 0, ROT0, "bootleg", "Secret Agent (bootleg)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) From 8214ac74048107b1af5c0b79a46f6b3258b3f8ae Mon Sep 17 00:00:00 2001 From: Brad Hughes Date: Tue, 13 Dec 2016 13:47:19 -0500 Subject: [PATCH 80/82] UWP: Add temporary signing key for MSBUILD support (nw) --- scripts/resources/uwp/mame_TemporaryKey.pfx | Bin 0 -> 2454 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 scripts/resources/uwp/mame_TemporaryKey.pfx diff --git a/scripts/resources/uwp/mame_TemporaryKey.pfx b/scripts/resources/uwp/mame_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..de6ef5c5f8867deed03b60b8961690f9e72040da GIT binary patch literal 2454 zcmZuz2{=@38$M@d43m9dsv)w+cP4{u*)o>T&Jab$5JI+SB;nXgwop-;P!SPXYGh0K zlIo)k*~t>o5S591hwK0Q`>*S}-s^eKbKmcCKj*!k^PcA%2*zcjKr{s7tg$$yB(tP% z+#owhhjIEC7^j2Knh?y!`oAT%ISkA;jnET_jbJ(dqvF~IqUbQ@Cj?_y&<^aj|I$cu z9t_6=mueR$M#T^c#omp9F@5{)Ub^_Rwld1;+DMehpq*Y+w+H51^B3RYTgN131V4~= zT3*1Lp0W?0E+AJfZkrub6IocF7alm1#>sxTJvs5Z%JhPte72M5xmSIq`cGJE8)I=y z!OY{gWCh`A0^O}~_v&Xtq;W$E?#gw(s38N^QNZi&!z#V^3`=?)Y7O`0KkD6;^F&s8-IyuFRaP`(940Wzux0cv4xc|=zzWs@&-F|g0 zJuQUh8Mn`(OC0YG$K-hryy=ZJ8ck;vD^|kF-pW5E@=zsd#3fnQ1zbEwkbv*R09%XA z3%7ien)OL%CG$%KKU`&)Y74x*HhxaF=_QF;x_uQwv;xODZ9_wi`j_YrQRvx_g}~BS z-;|i>mhfhi42$inGt`E0pUkS$jq!K@V&0a2ZOeS$Q9VC4;%zOUz zp;6&g$NPXHfd@*gx_G6Z7Jl{QfRWYA%FfH`6ta(NK?zyEOR-vo^hX}BK!JG#}AiQ-xK!k zKa!$-6LDfgJuf;B)QsHDty>KnlCyFkC0r|zFW?P(e=GCOl%8eo%3AaTGFghQOgp1( zS4WXa;n(xiWe66)e>r5CpQq{5>t5LU{5Tp)Y|$}GU-fqSlf<}C?Ov+DH&b8q_BPs* z%{=Yk4{B)3o`t2IGx{Dl|31M79%~ban>`Ej%^K6Xq|}X{Wk;E+O6@Xp3z$pRZ;SP} zpr7jOk1$HrD8W)MKNEKeJFy=w;QHYg85%Z}hrV^H>ZPkeh#UT0w_r!hb4s}pPZ#Az znVhE~%QVS;ieHFd=@BO>yPMY_KhYU)`SLjnKD(^c@~EirHFs8onnst?b%v}`(VIwe zM*QpaDjkJS>Q$Cw+d^@sHZj5HaRH_41HHN7OqUK3@lidiznc!X>bM`HigO+mJny$X z(f66sjCkv4F+n_Jpl|gV^{T^+8dt=5#3QLUBlBE-Fb1b?+loG<~4!GHh&K+gXog$NdSGe8U23qXi@A%h5b z0xHP7iPg3|b>zAi@jL-dfV#D+22cR?t>KBpX(EV-#Hc}TSe!Bz#DK6SKS;2}TLV^r zA0i0_f`Bl@jshnDDZl}lH<{yr4}y#lKN1K=xF7_FBB_D_-z}9CV7nC;fgmry8wiD9 zwEC}|Z+;liau^sbjnH_+B!2JyXgZ8qf?(9builRnK?JB_42*h@@b4fPY^I}8APU9D z&r`zHQ+zVt3SI^$hy5ZT?q4?nIoSY6fWQawV9{g@T97@E66o#a9RcA*xd|GCy#zJF zJ_12a-4%hF2qZ$#7W`KY3`+l=8e{{|FvtraJK2VUK@gy45~hnI7cB&Y^LYXb%YYk8 zhu(AS85d&Q&Yrfq+t$|Oz}_@j%tfdZS+bYF#?(bc?kH7${g^CvV?5P@WR7F%&|<0+ zvO2|r?v*|gvDzrg71s0ix4tBjVVC3WoA6W@j8l54)T}G+8b1FxRnpU~tLgiE?-!=n zqQnH3^(jSBhni3h&(n?=ZzgG8cUDf)HSNQ_b4C|u8g*pb;XURB_%JoyiGcZWyoRMe zeRRq!rBH?08=t2``M9`ued<-w=_|`xWzi$2pD$(dgf6i99BxmLQOLLBeOZS$};+6-Ss;oVc_uq(=$9S(LYE zq;W+eyR7Pg|#|Vr7?eYpd_SQ>Pr1i)-0jaAOF2Yd) zquWiZlADS%#?o!b+Dd4%ZUs)Q8Gl!mF8;Cf=!bVcEvXqp2|JEHjf;?U@;G49*k>)^ z+p7tEdF?6lMZZ7beoe^E(T1R$!N$N#HC6+M+lM(WI+)6@RR%`76z19AI|Mfma)zDj z<}+PAxx2in+GB9C+_jVCV$;!_aZNw1oTS<~Tyg3KPsUjJ=j8~yx3#L-n1Y%z1ACRT zrGfk2+#k~N!V|aa22&i~1bi|TD#*hpf#%q<;VyeGF&- literal 0 HcmV?d00001 From 9a09fab1fc937a5d802c0a34ef40820e80ee5789 Mon Sep 17 00:00:00 2001 From: yz70s Date: Tue, 13 Dec 2016 19:45:45 +0100 Subject: [PATCH 81/82] chihiro.cpp: enable clipping of vertices where w is negative (nw) --- src/mame/includes/chihiro.h | 2 +- src/mame/video/chihiro.cpp | 105 +++++++++++++++++++++++------------- 2 files changed, 68 insertions(+), 39 deletions(-) diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/chihiro.h index 44f7561d58d..ec3879e1a6c 100644 --- a/src/mame/includes/chihiro.h +++ b/src/mame/includes/chihiro.h @@ -358,7 +358,7 @@ public: struct nv2avertex_t : public vertex_t { - float w; + double w; }; nv2a_renderer(running_machine &machine) : poly_manager(machine) diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 1028d4e615f..fbd0a4c72d4 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -2653,81 +2653,110 @@ uint32_t nv2a_renderer::render_triangle_culling(const rectangle &cliprect, rende uint32_t nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render_delegate callback, int paramcount, nv2avertex_t &_v1, nv2avertex_t &_v2, nv2avertex_t &_v3) { -#if 0 +#if 1 nv2avertex_t *vi[3]; nv2avertex_t vo[16]; int idx_prev, idx_curr; int neg_prev, neg_curr; - float tfactor; + double tfactor; int idx; + const double wthreshold = 0.00000001; #endif if ((_v1.w > 0) && (_v2.w > 0) && (_v3.w > 0)) return render_triangle_culling(cliprect, callback, paramcount, _v1, _v2, _v3); -#if 0 +#if 1 + // assign the elements of the array vi[0] = &_v1; vi[1] = &_v2; vi[2] = &_v3; - for (int n=0;n < 3;n++) + // go back to the state before perpective divide + if (vertex_pipeline == 4) { - // remove translate - vi[n]->x = vi[n]->x - translatex; - vi[n]->y = vi[n]->y - translatey; - vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] - translatez; - // remove scale - vi[n]->x = vi[n]->x / scalex; - vi[n]->y = vi[n]->y / scaley; - vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] / scalez; - // remove perspective divide - vi[n]->x = vi[n]->x * vi[n]->w; - vi[n]->y = vi[n]->y * vi[n]->w; - vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] * vi[n]->w; + for (int n = 0; n < 3; n++) + { + vi[n]->x = (vi[n]->x / (double)supersample_factor_x)*vi[n]->w; + vi[n]->y = (vi[n]->y / (double)supersample_factor_y)*vi[n]->w; + vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] * vi[n]->w; + } + } else + { + for (int n = 0; n < 3; n++) + { + // remove translate + vi[n]->x = vi[n]->x - matrix.translate[0]; + vi[n]->y = vi[n]->y - matrix.translate[1]; + vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] - matrix.translate[2]; + // remove scale + vi[n]->x = vi[n]->x / matrix.translate[0]; + vi[n]->y = vi[n]->y / matrix.translate[1]; + vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] / matrix.translate[2]; + // remove perspective divide + vi[n]->x = vi[n]->x * vi[n]->w; + vi[n]->y = vi[n]->y * vi[n]->w; + vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] = vi[n]->p[(int)VERTEX_PARAMETER::PARAM_Z] * vi[n]->w; + } } + // do the clipping idx_prev = 2; idx_curr = 0; idx = 0; - neg_prev = vi[idx_prev]->w < 0.00000001 ? 1 : 0; + neg_prev = vi[idx_prev]->w < wthreshold ? 1 : 0; while (idx_curr < 3) { - neg_curr = vi[idx_curr]->w < 0.00000001 ? 1 : 0; + neg_curr = vi[idx_curr]->w < wthreshold ? 1 : 0; if (neg_curr ^ neg_prev) { - float p = (float)0.00000001; - - tfactor = (p - vi[idx_prev]->w) / (vi[idx_curr]->w - vi[idx_prev]->w); - + tfactor = (wthreshold - vi[idx_prev]->w) / (vi[idx_curr]->w - vi[idx_prev]->w); + // compute values for the new intermediate point vo[idx].x = ((vi[idx_curr]->x - vi[idx_prev]->x) * tfactor) + vi[idx_prev]->x; vo[idx].y = ((vi[idx_curr]->y - vi[idx_prev]->y) * tfactor) + vi[idx_prev]->y; vo[idx].w = ((vi[idx_curr]->w - vi[idx_prev]->w) * tfactor) + vi[idx_prev]->w; - for (int n=0;n < 13;n++) + for (int n = 0; n < 13; n++) vo[idx].p[n] = ((vi[idx_curr]->p[n] - vi[idx_prev]->p[n]) * tfactor) + vi[idx_prev]->p[n]; idx++; } if (neg_curr == 0) { - memcpy(&vo[idx], vi[idx_curr],sizeof(nv2avertex_t)); + vo[idx].x = vi[idx_curr]->x; + vo[idx].y = vi[idx_curr]->y; + vo[idx].w = vi[idx_curr]->w; + for (int n = 0; n < 13; n++) + vo[idx].p[n] = vi[idx_curr]->p[n]; idx++; } neg_prev = neg_curr; idx_prev = idx_curr; idx_curr++; } - for (int n = 0; n < idx; n++) + // screen coordinates for the new points + if (vertex_pipeline == 4) { - // apply perspective divide - vo[n].x = vo[n].x / vo[n].w; - vo[n].y = vo[n].y / vo[n].w; - vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] / vo[n].w; - // apply scale - vo[n].x = vo[n].x * scalex; - vo[n].y = vo[n].y * scaley; - vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] * scalez; - // apply translate - vo[n].x = vo[n].x + translatex; - vo[n].y = vo[n].y + translatey; - vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] + translatez; + for (int n = 0; n < idx; n++) + { + vo[n].x = vo[n].x*(double)supersample_factor_x / vo[n].w; + vo[n].y = vo[n].y*(double)supersample_factor_y / vo[n].w; + vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] / vo[n].w; + } + } else + { + for (int n = 0; n < idx; n++) + { + // apply perspective divide + vo[n].x = vo[n].x / vo[n].w; + vo[n].y = vo[n].y / vo[n].w; + vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] / vo[n].w; + // apply scale + vo[n].x = vo[n].x * matrix.scale[0]; + vo[n].y = vo[n].y * matrix.scale[1]; + vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] * matrix.scale[2]; + // apply translate + vo[n].x = vo[n].x + matrix.translate[0]; + vo[n].y = vo[n].y + matrix.translate[1]; + vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] = vo[n].p[(int)VERTEX_PARAMETER::PARAM_Z] + matrix.translate[2]; + } } - for (int n = 0; n < (idx-2); n++) + for (int n = 0; n < (idx - 2); n++) { if ((n & 1) == 0) render_triangle_culling(cliprect, callback, paramcount, vo[n], vo[n + 1], vo[n + 2]); From 65353bf7acf6036b3e6a06165afb68d9c925787e Mon Sep 17 00:00:00 2001 From: yz70s Date: Tue, 13 Dec 2016 20:51:23 +0100 Subject: [PATCH 82/82] xbox: rename file video/chihiro.cpp to xbox_nv2a.cpp (nw) --- scripts/target/mame/arcade.lua | 4 ++-- scripts/target/mame/mess.lua | 2 +- src/mame/drivers/chihiro.cpp | 2 +- src/mame/drivers/xbox.cpp | 2 +- src/mame/includes/{chihiro.h => xbox_nv2a.h} | 0 src/mame/machine/xbox.cpp | 2 +- src/mame/machine/xbox_usb.cpp | 2 +- src/mame/video/{chihiro.cpp => xbox_nv2a.cpp} | 6 +----- 8 files changed, 8 insertions(+), 12 deletions(-) rename src/mame/includes/{chihiro.h => xbox_nv2a.h} (100%) rename src/mame/video/{chihiro.cpp => xbox_nv2a.cpp} (99%) diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 5bb67032378..ea84fe73138 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -3049,8 +3049,8 @@ files { MAME_DIR .. "src/mame/video/blockade.cpp", MAME_DIR .. "src/mame/drivers/calorie.cpp", MAME_DIR .. "src/mame/drivers/chihiro.cpp", - MAME_DIR .. "src/mame/includes/chihiro.h", - MAME_DIR .. "src/mame/video/chihiro.cpp", + MAME_DIR .. "src/mame/includes/xbox_nv2a.h", + MAME_DIR .. "src/mame/video/xbox_nv2a.cpp", MAME_DIR .. "src/mame/drivers/coolridr.cpp", MAME_DIR .. "src/mame/drivers/deniam.cpp", MAME_DIR .. "src/mame/includes/deniam.h", diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 262af489e2a..b2fa12977c0 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1229,7 +1229,7 @@ files { MAME_DIR .. "src/mame/drivers/cps1.cpp", MAME_DIR .. "src/mame/includes/cps1.h", MAME_DIR .. "src/mame/video/cps1.cpp", - MAME_DIR .. "src/mame/video/chihiro.cpp", + MAME_DIR .. "src/mame/video/xbox_nv2a.cpp", MAME_DIR .. "src/mame/machine/xbox.cpp", MAME_DIR .. "src/mame/machine/xbox_usb.cpp", MAME_DIR .. "src/mame/includes/saturn.h", diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 4e06ebb2dff..796d0c929c1 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -385,7 +385,7 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info. #include "debug/debugcon.h" #include "debug/debugcmd.h" #include "debugger.h" -#include "includes/chihiro.h" +#include "includes/xbox_nv2a.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" #include "machine/jvshost.h" diff --git a/src/mame/drivers/xbox.cpp b/src/mame/drivers/xbox.cpp index f6a9c60f0d7..c187622a3a7 100644 --- a/src/mame/drivers/xbox.cpp +++ b/src/mame/drivers/xbox.cpp @@ -22,7 +22,7 @@ #include "debug/debugcon.h" #include "debug/debugcmd.h" #include "debugger.h" -#include "includes/chihiro.h" +#include "includes/xbox_nv2a.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/xbox_nv2a.h similarity index 100% rename from src/mame/includes/chihiro.h rename to src/mame/includes/xbox_nv2a.h diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index b65c2512392..7e3ddf3ae63 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -14,7 +14,7 @@ #include "debugger.h" #include "debug/debugcon.h" #include "debug/debugcmd.h" -#include "includes/chihiro.h" +#include "includes/xbox_nv2a.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp index a8388467930..96d18b1f5bb 100644 --- a/src/mame/machine/xbox_usb.cpp +++ b/src/mame/machine/xbox_usb.cpp @@ -6,7 +6,7 @@ #include "machine/idectrl.h" #include "video/poly.h" #include "bitmap.h" -#include "includes/chihiro.h" +#include "includes/xbox_nv2a.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/xbox_nv2a.cpp similarity index 99% rename from src/mame/video/chihiro.cpp rename to src/mame/video/xbox_nv2a.cpp index fbd0a4c72d4..bd761a8259e 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/xbox_nv2a.cpp @@ -4,7 +4,7 @@ #include "video/poly.h" #include "bitmap.h" #include "machine/pic8259.h" -#include "includes/chihiro.h" +#include "includes/xbox_nv2a.h" //#define LOG_NV2A @@ -2653,7 +2653,6 @@ uint32_t nv2a_renderer::render_triangle_culling(const rectangle &cliprect, rende uint32_t nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, render_delegate callback, int paramcount, nv2avertex_t &_v1, nv2avertex_t &_v2, nv2avertex_t &_v3) { -#if 1 nv2avertex_t *vi[3]; nv2avertex_t vo[16]; int idx_prev, idx_curr; @@ -2661,11 +2660,9 @@ uint32_t nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, rend double tfactor; int idx; const double wthreshold = 0.00000001; -#endif if ((_v1.w > 0) && (_v2.w > 0) && (_v3.w > 0)) return render_triangle_culling(cliprect, callback, paramcount, _v1, _v2, _v3); -#if 1 // assign the elements of the array vi[0] = &_v1; vi[1] = &_v2; @@ -2763,7 +2760,6 @@ uint32_t nv2a_renderer::render_triangle_clipping(const rectangle &cliprect, rend else render_triangle_culling(cliprect, callback, paramcount, vo[n], vo[n + 2], vo[n + 1]); } -#endif return 0; }