From b3172474d83d7eb8dadaa874051eb6c318c97b3c Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Sat, 6 Aug 2022 14:34:39 +0200 Subject: atari/a2600.cpp: Merged tvboy.cpp and a2600.h into a2600.cpp. (#10180) --- src/mame/atari/a2600.cpp | 312 +++++++++++++++++++++++++++++++++++++++-------- src/mame/atari/a2600.h | 138 --------------------- src/mame/atari/tvboy.cpp | 157 ------------------------ src/mame/mame.lst | 6 +- src/mame/mess.flt | 1 - 5 files changed, 265 insertions(+), 349 deletions(-) delete mode 100644 src/mame/atari/a2600.h delete mode 100644 src/mame/atari/tvboy.cpp diff --git a/src/mame/atari/a2600.cpp b/src/mame/atari/a2600.cpp index c5227ae3e9c..a0ce2b03355 100644 --- a/src/mame/atari/a2600.cpp +++ b/src/mame/atari/a2600.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nathan Woods, Wilbert Pol +// copyright-holders:Nathan Woods, Wilbert Pol, David Shah /*************************************************************************** Atari VCS 2600 driver @@ -8,6 +8,15 @@ TODO: - Move the 2 32-in-1 rom dumps into their own driver - Add 128-in-1 driver + + Systema TV Boy + +TODO: +- The TV-boy II and Super TV-Boy units did not have joystick ports but a builtin D-pad +- Find, dump and add the other devices (TV Boy, Super TV Boy) +- Add NTSC variant + + Atari A2600 Point of Purchase Display Unit TODO: @@ -87,20 +96,185 @@ E1 Prog ROM 42 DEMON/DIAMOND (CX2615) #include "emu.h" -#include "a2600.h" +#include "bus/vcs/compumat.h" +#include "bus/vcs/dpc.h" +#include "bus/vcs/harmony_melody.h" +#include "bus/vcs/rom.h" +#include "bus/vcs/scharger.h" +#include "bus/vcs/vcs_slot.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6507.h" #include "emupal.h" #include "screen.h" #include "softlist_dev.h" +#include "sound/tiaintf.h" #include "speaker.h" +#include "tia.h" + +#define USE_NEW_RIOT 0 + +#if USE_NEW_RIOT +#include "machine/mos6530n.h" +#else +#include "machine/6532riot.h" +#endif + +//#define VERBOSE (LOG_GENERAL) +#include "logmacro.h" -static constexpr auto MASTER_CLOCK_NTSC = 3.579575_MHz_XTAL; -static constexpr auto MASTER_CLOCK_PAL = 3.546894_MHz_XTAL; +namespace { static const uint16_t supported_screen_heights[4] = { 262, 312, 328, 342 }; +#define CONTROL1_TAG "joyport1" +#define CONTROL2_TAG "joyport2" + +class a2600_base_state : public driver_device +{ +protected: + a2600_base_state(const machine_config &mconfig, device_type type, const char *tag, XTAL xtal) : + driver_device(mconfig, type, tag), + m_riot_ram(*this, "riot_ram"), + m_tia(*this, "tia_video"), + m_maincpu(*this, "maincpu"), + m_riot(*this, "riot"), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_screen(*this, "screen"), + m_xtal(xtal) + { } + + virtual void machine_start() override; + + void a2600_mem(address_map &map); + + void a2600_base_ntsc(machine_config &config); + void a2600_base_pal(machine_config &config); + + void switch_A_w(uint8_t data); + uint8_t switch_A_r(); + void switch_B_w(uint8_t data); + DECLARE_WRITE_LINE_MEMBER(irq_callback); + uint16_t a2600_read_input_port(offs_t offset); + uint8_t a2600_get_databus_contents(offs_t offset); + void a2600_tia_vsync_callback(uint16_t data); + + required_shared_ptr m_riot_ram; + required_device m_tia; + required_device m_maincpu; +#if USE_NEW_RIOT + required_device m_riot; +#else + required_device m_riot; +#endif + required_device m_joy1; + required_device m_joy2; + required_device m_screen; + +private: + uint16_t m_current_screen_height = 0U; + XTAL m_xtal; +}; + + +class a2600_cons_state : public a2600_base_state +{ +public: + a2600_cons_state(const machine_config &mconfig, device_type type, const char *tag, XTAL xtal) : + a2600_base_state(mconfig, type, tag, xtal), + m_cartslot(*this, "cartslot") + { } + +protected: + void a2600_cartslot(machine_config &config); + +private: + required_device m_cartslot; +}; + + +class a2600_state : public a2600_cons_state +{ +public: + a2600_state(const machine_config &mconfig, device_type type, const char *tag) : + a2600_cons_state(mconfig, type, tag, 3.579575_MHz_XTAL) + { } + + void a2600(machine_config &config); +}; + + +class a2600p_state : public a2600_cons_state +{ +public: + a2600p_state(const machine_config &mconfig, device_type type, const char *tag) : + a2600_cons_state(mconfig, type, tag, 3.546894_MHz_XTAL) + { } + + void a2600p(machine_config &config); +}; + + +class a2600_pop_state : public a2600_base_state +{ +public: + a2600_pop_state(const machine_config &mconfig, device_type type, const char *tag) + : a2600_base_state(mconfig, type, tag, 3.579545_MHz_XTAL) + , m_bank(*this, "bank") + , m_a8(*this, "A8") + , m_swb(*this, "SWB") + { } + + void a2600_pop(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + void memory_map(address_map &map); + + uint8_t rom_switch_r(offs_t offset); + void rom_switch_w(offs_t offset, uint8_t data); + TIMER_CALLBACK_MEMBER(reset_timer_callback); + TIMER_CALLBACK_MEMBER(game_select_button_timer_callback); + + required_memory_bank m_bank; + required_ioport m_a8; + required_ioport m_swb; + emu_timer *m_reset_timer = nullptr; + emu_timer *m_game_select_button_timer = nullptr; +}; + +class tvboy_state : public a2600_base_state +{ +public: + tvboy_state(const machine_config &mconfig, device_type type, const char *tag) + : a2600_base_state(mconfig, type, tag, 3.546894_MHz_XTAL) + , m_crom(*this, "crom") + , m_rom(*this, "mainrom") + { } + + void tvboyii(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + void bank_write(offs_t offset, uint8_t data); + + void rom_map(address_map &map); + void tvboy_mem(address_map &map); + + required_memory_bank m_crom; + required_region_ptr m_rom; +}; + + void a2600_base_state::a2600_mem(address_map &map) // 6507 has 13-bit address space, 0x0000 - 0x1fff { map(0x0000, 0x007f).mirror(0x0f00).rw(m_tia, FUNC(tia_video_device::read), FUNC(tia_video_device::write)); @@ -119,6 +293,13 @@ void a2600_pop_state::memory_map(address_map &map) // 6507 has 13-bit address sp map(0x1000, 0x1fff).bankr(m_bank); } +void tvboy_state::tvboy_mem(address_map &map) +{ // 6507 has 13-bit address space, 0x0000 - 0x1fff + a2600_base_state::a2600_mem(map); + map(0x1800, 0x1fff).w(FUNC(tvboy_state::bank_write)); + map(0x1000, 0x1fff).bankr(m_crom); +} + // read returns number of empty game rom slots uint8_t a2600_pop_state::rom_switch_r(offs_t offset) @@ -162,6 +343,12 @@ void a2600_pop_state::rom_switch_w(offs_t offset, uint8_t data) } } +void tvboy_state::bank_write(offs_t offset, uint8_t data) +{ + LOG("banking (?) write %04x, %02x\n", offset, data); + m_crom->set_entry(data); +} + TIMER_CALLBACK_MEMBER(a2600_pop_state::reset_timer_callback) { @@ -288,29 +475,14 @@ static const rectangle visarea[4] = { void a2600_base_state::a2600_tia_vsync_callback(uint16_t data) { - for ( int i = 0; i < std::size(supported_screen_heights); i++ ) - { - if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) - { - if ( supported_screen_heights[i] != m_current_screen_height ) - { - m_current_screen_height = supported_screen_heights[i]; -// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height ); - } - } - } -} - -void a2600_base_state::a2600_tia_vsync_callback_pal(uint16_t data) -{ - for ( int i = 0; i < std::size(supported_screen_heights); i++ ) + for (int i = 0; i < std::size(supported_screen_heights); i++) { - if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) + if (data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3) { - if ( supported_screen_heights[i] != m_current_screen_height ) + if (supported_screen_heights[i] != m_current_screen_height) { m_current_screen_height = supported_screen_heights[i]; -// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height ); +// m_screen->configure(228, m_current_screen_height, visarea[i], HZ_TO_ATTOSECONDS(m_xtal) * 228 * m_current_screen_height); } } } @@ -324,6 +496,12 @@ void a2600_base_state::machine_start() save_item(NAME(m_current_screen_height)); } +void tvboy_state::machine_start() +{ + a2600_base_state::machine_start(); + m_crom->configure_entries(0, m_rom.bytes() / 0x1000, &m_rom[0], 0x1000); +} + void a2600_pop_state::machine_start() { a2600_base_state::machine_start(); @@ -334,6 +512,12 @@ void a2600_pop_state::machine_start() } +void tvboy_state::machine_reset() +{ + m_crom->set_entry(0); + a2600_base_state::machine_reset(); +} + void a2600_pop_state::machine_reset() { a2600_base_state::machine_reset(); @@ -362,7 +546,6 @@ static INPUT_PORTS_START( a2600 ) PORT_CONFSETTING( 0x00, "B" ) INPUT_PORTS_END - static INPUT_PORTS_START(a2600_pop) PORT_START("SWB") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset Game") PORT_CODE(KEYCODE_2) @@ -415,7 +598,7 @@ static void a2600_cart(device_slot_interface &device) device.option_add("a26_harmony", A26_ROM_HARMONY); } -void a2600_state::a2600_cartslot(machine_config &config) +void a2600_cons_state::a2600_cartslot(machine_config &config) { VCS_CART_SLOT(config, m_cartslot, a2600_cart, nullptr).set_must_be_loaded(true); m_cartslot->set_address_space(m_maincpu, AS_PROGRAM); @@ -428,7 +611,7 @@ void a2600_state::a2600_cartslot(machine_config &config) void a2600_base_state::a2600_base_ntsc(machine_config &config) { /* basic machine hardware */ - M6507(config, m_maincpu, MASTER_CLOCK_NTSC / 3); + M6507(config, m_maincpu, m_xtal / 3); m_maincpu->set_addrmap(AS_PROGRAM, &a2600_base_state::a2600_mem); /* video hardware */ @@ -438,23 +621,23 @@ void a2600_base_state::a2600_base_ntsc(machine_config &config) m_tia->vsync_callback().set(FUNC(a2600_state::a2600_tia_vsync_callback)); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(MASTER_CLOCK_NTSC, 228, 26, 26 + 160 + 16, 262, 24 , 24 + 192 + 31); + m_screen->set_raw(m_xtal, 228, 26, 26 + 160 + 16, 262, 24 , 24 + 192 + 31); m_screen->set_screen_update("tia_video", FUNC(tia_video_device::screen_update)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - TIA(config, "tia", MASTER_CLOCK_NTSC/114).add_route(ALL_OUTPUTS, "mono", 0.90); + TIA(config, "tia", m_xtal/114).add_route(ALL_OUTPUTS, "mono", 0.90); /* devices */ #if USE_NEW_RIOT - MOS6532_NEW(config, m_riot, MASTER_CLOCK_NTSC / 3); + MOS6532_NEW(config, m_riot, m_xtal / 3); m_riot->pa_rd_callback().set(FUNC(a2600_state::switch_A_r)); m_riot->pa_wr_callback().set(FUNC(a2600_state::switch_A_w)); m_riot->pb_rd_callback().set_ioport("SWB"); m_riot->pb_wr_callback().set(FUNC(a2600_state::switch_B_w)); m_riot->irq_wr_callback().set(FUNC(a2600_state::irq_callback)); #else - RIOT6532(config, m_riot, MASTER_CLOCK_NTSC / 3); + RIOT6532(config, m_riot, m_xtal / 3); m_riot->in_pa_callback().set(FUNC(a2600_state::switch_A_r)); m_riot->out_pa_callback().set(FUNC(a2600_state::switch_A_w)); m_riot->in_pb_callback().set_ioport("SWB"); @@ -467,44 +650,36 @@ void a2600_base_state::a2600_base_ntsc(machine_config &config) } -void a2600_state::a2600(machine_config &config) -{ - a2600_base_ntsc(config); - a2600_cartslot(config); - subdevice("cart_list")->set_filter("NTSC"); -} - - -void a2600_state::a2600p(machine_config &config) +void a2600_base_state::a2600_base_pal(machine_config &config) { /* basic machine hardware */ - M6507(config, m_maincpu, MASTER_CLOCK_PAL / 3); + M6507(config, m_maincpu, m_xtal / 3); m_maincpu->set_addrmap(AS_PROGRAM, &a2600_state::a2600_mem); /* video hardware */ TIA_PAL_VIDEO(config, m_tia, 0, "tia"); m_tia->read_input_port_callback().set(FUNC(a2600_state::a2600_read_input_port)); m_tia->databus_contents_callback().set(FUNC(a2600_state::a2600_get_databus_contents)); - m_tia->vsync_callback().set(FUNC(a2600_state::a2600_tia_vsync_callback_pal)); + m_tia->vsync_callback().set(FUNC(a2600_state::a2600_tia_vsync_callback)); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(MASTER_CLOCK_PAL, 228, 26, 26 + 160 + 16, 312, 32, 32 + 228 + 31); + m_screen->set_raw(m_xtal, 228, 26, 26 + 160 + 16, 312, 32, 32 + 228 + 31); m_screen->set_screen_update("tia_video", FUNC(tia_video_device::screen_update)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - TIA(config, "tia", MASTER_CLOCK_PAL/114).add_route(ALL_OUTPUTS, "mono", 0.90); + TIA(config, "tia", m_xtal/114).add_route(ALL_OUTPUTS, "mono", 0.90); /* devices */ #if USE_NEW_RIOT - MOS6532_NEW(config, m_riot, MASTER_CLOCK_PAL / 3); + MOS6532_NEW(config, m_riot, m_xtal / 3); m_riot->pa_rd_callback().set(FUNC(a2600_state::switch_A_r)); m_riot->pa_wr_callback().set(FUNC(a2600_state::switch_A_w)); m_riot->pb_rd_callback().set_ioport("SWB"); m_riot->pb_wr_callback().set(FUNC(a2600_state::switch_B_w)); m_riot->irq_wr_callback().set(FUNC(a2600_state::irq_callback)); #else - RIOT6532(config, m_riot, MASTER_CLOCK_PAL / 3); + RIOT6532(config, m_riot, m_xtal / 3); m_riot->in_pa_callback().set(FUNC(a2600_state::switch_A_r)); m_riot->out_pa_callback().set(FUNC(a2600_state::switch_A_w)); m_riot->in_pb_callback().set_ioport("SWB"); @@ -514,7 +689,20 @@ void a2600_state::a2600p(machine_config &config) VCS_CONTROL_PORT(config, CONTROL1_TAG, vcs_control_port_devices, "joy"); VCS_CONTROL_PORT(config, CONTROL2_TAG, vcs_control_port_devices, "joy"); +} + +void a2600_state::a2600(machine_config &config) +{ + a2600_base_ntsc(config); + a2600_cartslot(config); + subdevice("cart_list")->set_filter("NTSC"); +} + + +void a2600p_state::a2600p(machine_config &config) +{ + a2600_base_pal(config); a2600_cartslot(config); subdevice("cart_list")->set_filter("PAL"); } @@ -527,13 +715,20 @@ void a2600_pop_state::a2600_pop(machine_config &config) } +void tvboy_state::tvboyii(machine_config &config) +{ + a2600_base_pal(config); + m_maincpu->set_addrmap(AS_PROGRAM, &tvboy_state::tvboy_mem); +} + + ROM_START(a2600) ROM_REGION(0x2000, "maincpu", ROMREGION_ERASEFF) ROM_END #define rom_a2600p rom_a2600 -ROM_START( a2600_pop ) +ROM_START(a2600_pop) ROM_REGION(0x30000, "maincpu", 0) // Boot/Game selection ROM_LOAD("136003_101.c6", 0x000, 0x800, CRC(9d3cfba6) SHA1(b84c34aaedd84fca30b6e8223ee062439acf4fe0)) @@ -607,12 +802,31 @@ ROM_START( a2600_pop ) // empty slots f1, j1, k1, l1, m1 ? ROM_END +ROM_START(tvboyii) + ROM_REGION(0x2000, "maincpu", ROMREGION_ERASEFF) -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -CONS( 1977, a2600, 0, 0, a2600, a2600, a2600_state, empty_init, "Atari", "Atari 2600 (NTSC)" , MACHINE_SUPPORTS_SAVE ) -CONS( 1978, a2600p, a2600, 0, a2600p, a2600, a2600_state, empty_init, "Atari", "Atari 2600 (PAL)", MACHINE_SUPPORTS_SAVE ) + ROM_REGION(0x80000, "mainrom", 0) + ROM_LOAD("hy23400p.bin", 0x00000, 0x80000, CRC(f8485173) SHA1(cafbaa0c5437f192cb4fb49f9a672846aa038870)) +ROM_END + +ROM_START( stvboy ) + ROM_REGION(0x2000, "maincpu", ROMREGION_ERASEFF) + + ROM_REGION(0x80000, "mainrom", 0) + ROM_LOAD("supertvboy.bin", 0x00000, 0x80000, CRC(af2e73e8) SHA1(04b9ddc3b30b0e5b81b9f868d455e902a0151491)) +ROM_END + +} // anonymous namespace + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +CONS( 1977, a2600, 0, 0, a2600, a2600, a2600_state, empty_init, "Atari", "Atari 2600 (NTSC)" , MACHINE_SUPPORTS_SAVE ) +CONS( 1978, a2600p, a2600, 0, a2600p, a2600, a2600p_state, empty_init, "Atari", "Atari 2600 (PAL)", MACHINE_SUPPORTS_SAVE ) // Released in 1981/1982 // Games 35-42 are copyright 1982 and looking at the game list they seem to be // added later. GAME( 198?, a2600_pop, 0, a2600_pop, a2600_pop, a2600_pop_state, empty_init, ROT0, "Atari", "Atari 2600 Point of Purchase Display", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) + +// Clones +CONS( 199?, tvboyii, 0, 0, tvboyii, a2600, tvboy_state, empty_init, "Systema", "TV Boy II (PAL)" , MACHINE_SUPPORTS_SAVE ) +CONS( 1995, stvboy, 0, 0, tvboyii, a2600, tvboy_state, empty_init, "Akor", "Super TV Boy (PAL)" , MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/atari/a2600.h b/src/mame/atari/a2600.h deleted file mode 100644 index 9149d821b95..00000000000 --- a/src/mame/atari/a2600.h +++ /dev/null @@ -1,138 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Wilbert Pol, David Shah -/***************************************************************************** - - a2600.h - - Atari 2600 - - ****************************************************************************/ - -#ifndef MAME_INCLUDES_A2600_H -#define MAME_INCLUDES_A2600_H - -#pragma once - -#include "bus/vcs/compumat.h" -#include "bus/vcs/dpc.h" -#include "bus/vcs/harmony_melody.h" -#include "bus/vcs/rom.h" -#include "bus/vcs/scharger.h" -#include "bus/vcs/vcs_slot.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6507.h" -#include "sound/tiaintf.h" -#include "tia.h" - -#define USE_NEW_RIOT 0 - -#if USE_NEW_RIOT -#include "machine/mos6530n.h" -#else -#include "machine/6532riot.h" -#endif - -#define CONTROL1_TAG "joyport1" -#define CONTROL2_TAG "joyport2" - - -class a2600_base_state : public driver_device -{ -protected: - a2600_base_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_riot_ram(*this, "riot_ram"), - m_tia(*this, "tia_video"), - m_maincpu(*this, "maincpu"), - m_riot(*this, "riot"), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_screen(*this, "screen") - { } - - virtual void machine_start() override; - - void a2600_mem(address_map &map); - - void a2600_base_ntsc(machine_config &config); - - void switch_A_w(uint8_t data); - uint8_t switch_A_r(); - void switch_B_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(irq_callback); - uint16_t a2600_read_input_port(offs_t offset); - uint8_t a2600_get_databus_contents(offs_t offset); - void a2600_tia_vsync_callback(uint16_t data); - void a2600_tia_vsync_callback_pal(uint16_t data); - - required_shared_ptr m_riot_ram; - required_device m_tia; - required_device m_maincpu; -#if USE_NEW_RIOT - required_device m_riot; -#else - required_device m_riot; -#endif - required_device m_joy1; - required_device m_joy2; - required_device m_screen; - -private: - uint16_t m_current_screen_height = 0U; -}; - - -class a2600_state : public a2600_base_state -{ -public: - a2600_state(const machine_config &mconfig, device_type type, const char *tag) : - a2600_base_state(mconfig, type, tag), - m_cartslot(*this, "cartslot") - { } - - using a2600_base_state::a2600_mem; - - void a2600(machine_config &config); - void a2600p(machine_config &config); - -protected: - void a2600_cartslot(machine_config &config); - -private: - required_device m_cartslot; -}; - - -class a2600_pop_state : public a2600_base_state -{ -public: - a2600_pop_state(const machine_config &mconfig, device_type type, const char *tag) - : a2600_base_state(mconfig, type, tag) - , m_bank(*this, "bank") - , m_a8(*this, "A8") - , m_swb(*this, "SWB") - { } - - void a2600_pop(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - -private: - void memory_map(address_map &map); - - uint8_t rom_switch_r(offs_t offset); - void rom_switch_w(offs_t offset, uint8_t data); - TIMER_CALLBACK_MEMBER(reset_timer_callback); - TIMER_CALLBACK_MEMBER(game_select_button_timer_callback); - - required_memory_bank m_bank; - required_ioport m_a8; - required_ioport m_swb; - emu_timer *m_reset_timer = nullptr; - emu_timer *m_game_select_button_timer = nullptr; -}; - - -#endif // MAME_INCLUDES_A2600_H diff --git a/src/mame/atari/tvboy.cpp b/src/mame/atari/tvboy.cpp deleted file mode 100644 index 5fd1da6095b..00000000000 --- a/src/mame/atari/tvboy.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Shah -/*************************************************************************** - - Systema TV Boy Driver - -TODO: -- Find, dump and add the other devices (TV Boy, Super TV Boy) -- Add NTSC variant -***************************************************************************/ - -#include "emu.h" - -#include "a2600.h" -#include "machine/bankdev.h" - -#include "screen.h" -#include "softlist.h" -#include "speaker.h" - -class tvboy_state : public a2600_base_state -{ -public: - tvboy_state(const machine_config &mconfig, device_type type, const char *tag) - : a2600_base_state(mconfig, type, tag) - , m_crom(*this, "crom") - , m_rom(*this, "mainrom") - { } - - void tvboyii(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - -private: - void bank_write(offs_t offset, uint8_t data); - - void rom_map(address_map &map); - void tvboy_mem(address_map &map); - - required_memory_bank m_crom; - required_region_ptr m_rom; -}; - -void tvboy_state::machine_start() -{ - a2600_base_state::machine_start(); - m_crom->configure_entries(0, m_rom.bytes() / 0x1000, &m_rom[0], 0x1000); -} - -void tvboy_state::machine_reset() -{ - m_crom->set_entry(0); - a2600_base_state::machine_reset(); -} - -void tvboy_state::bank_write(offs_t offset, uint8_t data) -{ - logerror("banking (?) write %04x, %02x\n", offset, data); - if ((offset & 0xff00) == 0x0800) - m_crom->set_entry(data); -} - -void tvboy_state::tvboy_mem(address_map &map) -{ // 6507 has 13-bit address space, 0x0000 - 0x1fff - map(0x0000, 0x007f).mirror(0x0f00).rw("tia_video", FUNC(tia_video_device::read), FUNC(tia_video_device::write)); - map(0x0080, 0x00ff).mirror(0x0d00).ram().share("riot_ram"); -#if USE_NEW_RIOT - map(0x0280, 0x029f).mirror(0x0d00).m("riot", FUNC(mos6532_new_device::io_map)); -#else - map(0x0280, 0x029f).mirror(0x0d00).rw("riot", FUNC(riot6532_device::read), FUNC(riot6532_device::write)); -#endif - map(0x1000, 0x1fff).w(FUNC(tvboy_state::bank_write)); - map(0x1000, 0x1fff).bankr(m_crom); -} - -#define MASTER_CLOCK_PAL 3546894 - -void tvboy_state::tvboyii(machine_config &config) -{ - /* basic machine hardware */ - M6507(config, m_maincpu, MASTER_CLOCK_PAL / 3); - m_maincpu->set_addrmap(AS_PROGRAM, &tvboy_state::tvboy_mem); - - /* video hardware */ - TIA_PAL_VIDEO(config, m_tia, 0, "tia"); - m_tia->read_input_port_callback().set(FUNC(tvboy_state::a2600_read_input_port)); - m_tia->databus_contents_callback().set(FUNC(tvboy_state::a2600_get_databus_contents)); - m_tia->vsync_callback().set(FUNC(tvboy_state::a2600_tia_vsync_callback_pal)); - - SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(MASTER_CLOCK_PAL, 228, 26, 26 + 160 + 16, 312, 32, 32 + 228 + 31); - m_screen->set_screen_update("tia_video", FUNC(tia_video_device::screen_update)); - - /* sound hardware */ - SPEAKER(config, "mono").front_center(); - TIA(config, "tia", MASTER_CLOCK_PAL/114).add_route(ALL_OUTPUTS, "mono", 0.90); - - /* devices */ -#if USE_NEW_RIOT - MOS6532_NEW(config, m_riot, MASTER_CLOCK_PAL / 3); - m_riot->pa_rd_callback().set(FUNC(tvboy_state::switch_A_r)); - m_riot->pa_wr_callback().set(FUNC(tvboy_state::switch_A_w)); - m_riot->pb_rd_callback().set_ioport("SWB"); - m_riot->pb_wr_callback().set(FUNC(tvboy_state::switch_B_w)); - m_riot->irq_wr_callback().set(FUNC(tvboy_state::irq_callback)); -#else - RIOT6532(config, m_riot, MASTER_CLOCK_PAL / 3); - m_riot->in_pa_callback().set(FUNC(tvboy_state::switch_A_r)); - m_riot->out_pa_callback().set(FUNC(tvboy_state::switch_A_w)); - m_riot->in_pb_callback().set_ioport("SWB"); - m_riot->out_pb_callback().set(FUNC(tvboy_state::switch_B_w)); - m_riot->irq_callback().set(FUNC(tvboy_state::irq_callback)); -#endif - - VCS_CONTROL_PORT(config, m_joy1, vcs_control_port_devices, "joy"); - VCS_CONTROL_PORT(config, m_joy2, vcs_control_port_devices, nullptr); -} - -static INPUT_PORTS_START( tvboyii ) - PORT_START("SWB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset Game") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Select Game") PORT_CODE(KEYCODE_1) - PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x08, 0x08, "TV Type" ) PORT_CODE(KEYCODE_C) PORT_TOGGLE - PORT_DIPSETTING( 0x08, "Color" ) - PORT_DIPSETTING( 0x00, "B&W" ) - PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x40, 0x00, "Left Diff. Switch" ) PORT_CODE(KEYCODE_3) PORT_TOGGLE - PORT_DIPSETTING( 0x40, "A" ) - PORT_DIPSETTING( 0x00, "B" ) - PORT_DIPNAME( 0x80, 0x00, "Right Diff. Switch" ) PORT_CODE(KEYCODE_4) PORT_TOGGLE - PORT_DIPSETTING( 0x80, "A" ) - PORT_DIPSETTING( 0x00, "B" ) -INPUT_PORTS_END - -ROM_START( tvboyii ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x80000, "mainrom", 0 ) - ROM_LOAD( "hy23400p.bin", 0x00000, 0x80000, CRC(f8485173) SHA1(cafbaa0c5437f192cb4fb49f9a672846aa038870) ) -ROM_END - - -ROM_START( stvboy ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x80000, "mainrom", 0 ) - ROM_LOAD( "supertvboy.bin", 0x00000, 0x80000, CRC(af2e73e8) SHA1(04b9ddc3b30b0e5b81b9f868d455e902a0151491) ) -ROM_END - - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME -CONS( 199?, tvboyii, 0, 0, tvboyii, tvboyii, tvboy_state, empty_init, "Systema", "TV Boy II (PAL)" , MACHINE_SUPPORTS_SAVE ) -CONS( 1995, stvboy, 0, 0, tvboyii, tvboyii, tvboy_state, empty_init, "Akor", "Super TV Boy (PAL)" , MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index ea88b306747..043a5210b4a 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -284,6 +284,8 @@ tvpoker // (c) 197? A-1 Supply a2600 // Atari 2600 a2600p // Atari 2600 PAL a2600_pop // Atari 2600 Point of Purchase Display +stvboy +tvboyii // @source:robotron/a5105.cpp a5105 // @@ -42383,10 +42385,6 @@ tv965 // tv990 // 1992? TeleVideo tv995 // 1994 TeleVideo -@source:atari/tvboy.cpp -stvboy -tvboyii // - @source:videoton/tvc.cpp tvc64 // tvc64p // diff --git a/src/mame/mess.flt b/src/mame/mess.flt index c6a6fb4e64b..ab9fea8f531 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -70,7 +70,6 @@ atari/atari400.cpp atari/atarist.cpp atari/lynx.cpp atari/pofo.cpp -atari/tvboy.cpp att/att3b2.cpp att/att4425.cpp att/att610.cpp -- cgit v1.2.3