From a5af4e4ccb873be79e6273ef716002cf7dd73df3 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 16 Jan 2024 18:02:28 +0100 Subject: New systems marked not working ------------------------------ Compact Vision TV Boy [hap] --- src/mame/mame.lst | 3 + src/mame/misc/ctvboy.cpp | 246 ++++++++++++++++++++++++++++++++++++++++++++ src/mame/saitek/ecbackg.cpp | 4 +- 3 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 src/mame/misc/ctvboy.cpp diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a44ae198b17..a7a39752c0f 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -28968,6 +28968,9 @@ topbladv // 2002 Sonokong urachamu // 2002 GamToU wulybuly // +@source:misc/ctvboy.cpp +ctvboy + @source:misc/cubeqst.cpp cubeqst // (c) 1983 Simutrek Inc. cubeqsta // (c) 1983 Simutrek Inc. diff --git a/src/mame/misc/ctvboy.cpp b/src/mame/misc/ctvboy.cpp new file mode 100644 index 00000000000..0759faca107 --- /dev/null +++ b/src/mame/misc/ctvboy.cpp @@ -0,0 +1,246 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/******************************************************************************* + +Gakken Compact Vision TV Boy (TVボーイ) + +Hardware notes: +- HD6801V0P or MC6801U4 @ 3.57MHz +- MC6847, MC1372 +- 2KB RAM (HM6116) +- 1-bit sound with volume filter +- cartridge slot + +There is no CPU inside the console. The MCU is on the cartridge, the console +itself has the video hardware and buttons. + +TODO: +- add softwarelist +- add volume decay (frogger uses it according to a video) +- some games don't work yet, assuming it's due to MCU emulation + +*******************************************************************************/ + +#include "emu.h" + +#include "bus/generic/carts.h" +#include "bus/generic/slot.h" +#include "cpu/m6800/m6801.h" +#include "sound/dac.h" +#include "video/mc6847.h" + +#include "screen.h" +#include "softlist_dev.h" +#include "speaker.h" + +namespace { + +class ctvboy_state : public driver_device +{ +public: + ctvboy_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_vram(*this, "vram"), + m_mc6847(*this, "mc6847"), + m_screen(*this, "screen"), + m_dac(*this, "dac"), + m_cart(*this, "cartslot"), + m_inputs(*this, "IN.%u", 0) + { } + + void ctvboy(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + required_device m_maincpu; + required_shared_ptr m_vram; + required_device m_mc6847; + required_device m_screen; + required_device m_dac; + required_device m_cart; + required_ioport_array<2> m_inputs; + + u8 m_inp_mux = 0; + + void main_map(address_map &map); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load); + + u8 p1_r(); + void p1_w(u8 data); + u8 p2_r(); + + void mc6847_w(u8 data); + u8 mc6847_vram_r(offs_t offset); +}; + + + +/******************************************************************************* + Initialization +*******************************************************************************/ + +void ctvboy_state::machine_start() +{ + save_item(NAME(m_inp_mux)); +} + +DEVICE_IMAGE_LOAD_MEMBER(ctvboy_state::cart_load) +{ + u32 size = m_cart->common_get_size("rom"); + + if (size != 0x1000) + return std::make_pair(image_error::INVALIDLENGTH, "Invalid ROM file size (must be 4096 bytes)"); + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + memcpy(memregion("maincpu")->base(), m_cart->get_rom_base(), size); + + return std::make_pair(std::error_condition(), std::string()); +} + + + +/******************************************************************************* + I/O +*******************************************************************************/ + +u8 ctvboy_state::p1_r() +{ + // P17: hsync? + return m_mc6847->hs_r() ? 0 : 0x80; +} + +void ctvboy_state::p1_w(u8 data) +{ + // P10,P11: input mux + m_inp_mux = ~data & 3; + + // P15: volume decay + // P16: speaker out + m_dac->write(BIT(data, 6)); +} + +u8 ctvboy_state::p2_r() +{ + u8 data = 0; + + // P21-P24: multiplexed inputs + for (int i = 0; i < 2; i++) + if (BIT(m_inp_mux, i)) + data |= m_inputs[i]->read(); + + return ~data; +} + +void ctvboy_state::mc6847_w(u8 data) +{ + // write to MC6847 pins + m_mc6847->gm1_w(BIT(data, 0)); + m_mc6847->gm0_w(BIT(data, 1)); + m_mc6847->intext_w(BIT(data, 2)); + m_mc6847->as_w(BIT(data, 3)); + m_mc6847->ag_w(BIT(data, 4)); + m_mc6847->css_w(BIT(data, 5)); +} + +u8 ctvboy_state::mc6847_vram_r(offs_t offset) +{ + u8 data = m_vram[offset & 0x7ff]; + m_mc6847->inv_w(BIT(data, 6)); + + return data; +} + + + +/******************************************************************************* + Address Maps +*******************************************************************************/ + +void ctvboy_state::main_map(address_map &map) +{ + map(0x1000, 0x17ff).ram().share(m_vram); + map(0x2000, 0x2000).w(FUNC(ctvboy_state::mc6847_w)); +} + + + +/******************************************************************************* + Input Ports +*******************************************************************************/ + +static INPUT_PORTS_START( ctvboy ) + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) // A + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) // START / B + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START) PORT_NAME("Pause") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) +INPUT_PORTS_END + + + +/******************************************************************************* + Machine Configs +*******************************************************************************/ + +void ctvboy_state::ctvboy(machine_config &config) +{ + // basic machine hardware + M6801U4(config, m_maincpu, 3.579545_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &ctvboy_state::main_map); + m_maincpu->in_p1_cb().set(FUNC(ctvboy_state::p1_r)); + m_maincpu->out_p1_cb().set(FUNC(ctvboy_state::p1_w)); + m_maincpu->in_p2_cb().set(FUNC(ctvboy_state::p2_r)); + + // video hardware + MC6847_NTSC(config, m_mc6847, 3.579545_MHz_XTAL); + m_mc6847->input_callback().set(FUNC(ctvboy_state::mc6847_vram_r)); + m_mc6847->fsync_wr_callback().set_inputline(m_maincpu, 0, HOLD_LINE).invert(); + m_mc6847->set_screen(m_screen); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + + // sound hardware + SPEAKER(config, "speaker").front_center(); + DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); + + // cartridge + GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "ctvboy_cart"); + m_cart->set_must_be_loaded(true); + m_cart->set_device_load(FUNC(ctvboy_state::cart_load)); + + SOFTWARE_LIST(config, "cart_list").set_original("ctvboy"); +} + + + +/******************************************************************************* + ROM Definitions +*******************************************************************************/ + +ROM_START( ctvboy ) + // nothing here yet, ROM is on the cartridge + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +} // anonymous namespace + + + +/******************************************************************************* + Drivers +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1983, ctvboy, 0, 0, ctvboy, ctvboy, ctvboy_state, empty_init, "Gakken", "Compact Vision TV Boy", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/saitek/ecbackg.cpp b/src/mame/saitek/ecbackg.cpp index 593ceea43b2..83c1ab6027d 100644 --- a/src/mame/saitek/ecbackg.cpp +++ b/src/mame/saitek/ecbackg.cpp @@ -332,8 +332,8 @@ ROM_START( ecbackg ) ROM_REGION( 0x4000, "maincpu", 0 ) ROM_LOAD("saitek_89_gx4b_c12_31y0rm79p.u1", 0x0000, 0x4000, CRC(d7278545) SHA1(9ece31cdb237067aeec480c066e0917752697a4d) ) - ROM_REGION( 109665, "screen", 0 ) - ROM_LOAD("ecbackg.svg", 0, 109665, CRC(6592acfe) SHA1(8425d7ce519a921cdbe4298ae9c6789f90d4d0b5) ) + ROM_REGION( 109526, "screen", 0 ) + ROM_LOAD("ecbackg.svg", 0, 109526, CRC(b8149d74) SHA1(0cc6f1a2c50f53f8d2be73379019d275799d0546) ) ROM_END } // anonymous namespace -- cgit v1.2.3