From a93e0407b9033c6e75dd7da8088c9f69e7f6bacd Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 18 Aug 2020 21:34:40 +0200 Subject: odyssey2: add cartridge B pin --- hash/g7400.xml | 32 ++++++++++++++++++++++++++++++++ hash/odyssey2.xml | 9 ++++++++- src/devices/bus/odyssey2/slot.cpp | 37 ++++++++++++++++++++++--------------- src/devices/bus/odyssey2/slot.h | 7 +++---- src/devices/bus/odyssey2/voice.h | 1 + src/devices/cpu/mcs48/mcs48.cpp | 2 +- src/mame/drivers/odyssey2.cpp | 33 +++++++++++++++++++-------------- 7 files changed, 86 insertions(+), 35 deletions(-) diff --git a/hash/g7400.xml b/hash/g7400.xml index f37234c46de..8c8b135b14d 100644 --- a/hash/g7400.xml +++ b/hash/g7400.xml @@ -50,6 +50,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -63,6 +64,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Jopac + @@ -75,6 +77,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -89,6 +92,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -102,6 +106,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -114,6 +119,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -126,6 +132,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -138,6 +145,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -150,6 +158,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Radiola + @@ -162,6 +171,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Jopac + @@ -174,6 +184,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Jopac + @@ -186,6 +197,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -198,6 +210,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -210,6 +223,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Radiola + @@ -222,6 +236,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -234,6 +249,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Radiola + @@ -246,6 +262,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Radiola + @@ -259,6 +276,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -272,6 +290,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -286,6 +305,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -298,6 +318,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -310,6 +331,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -322,6 +344,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Jopac + @@ -334,6 +357,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -346,6 +370,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -358,6 +383,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -375,6 +401,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + @@ -388,6 +415,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -401,6 +429,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -414,6 +443,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Radiola + @@ -428,6 +458,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. + @@ -440,6 +471,7 @@ The C7420 Home Computer Module contains a Z80, 16K RAM and 16K ROM. Philips + diff --git a/hash/odyssey2.xml b/hash/odyssey2.xml index 54fb1258452..cf7d5f68894 100644 --- a/hash/odyssey2.xml +++ b/hash/odyssey2.xml @@ -390,6 +390,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + @@ -529,6 +530,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + @@ -763,7 +765,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. - + @@ -1647,6 +1649,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + @@ -1659,6 +1662,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. Philips + @@ -1813,6 +1817,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + @@ -1827,6 +1832,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + @@ -1912,6 +1918,7 @@ The C7010 Chess Module had a NSC800 CMOS microprocessor, with 2K RAM and 8K ROM. + diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 417fb3230c1..1e1a9896921 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -55,16 +55,6 @@ void device_o2_cart_interface::rom_alloc(uint32_t size, const char *tag) } -//------------------------------------------------- -// ram_alloc - alloc the space for the ram -//------------------------------------------------- - -void device_o2_cart_interface::ram_alloc(uint32_t size) -{ - m_ram.resize(size); -} - - //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -78,6 +68,7 @@ o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const ch , device_single_card_slot_interface(mconfig, *this) , m_type(O2_STD) , m_cart(nullptr) + , m_b(0) { } @@ -156,19 +147,23 @@ image_init_result o2_cart_slot_device::call_load() uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom"); m_cart->rom_alloc(size, tag()); - if (!loaded_through_softlist()) - fread(m_cart->get_rom_base(), size); - else - memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); - if (loaded_through_softlist()) { + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + const char *pcb_name = get_feature("slot"); if (pcb_name) m_type = o2_get_pcb_id(pcb_name); + + // Videopac+ determines whether the screen should have a border, with a gate connected + // to the cartridge B pin. This way, old Videopac games can still run in full screen. + m_b = bool(strtoul(get_feature("b_pin"), nullptr, 0)) ? 1 : 0; } else + { + fread(m_cart->get_rom_base(), size); m_type = (size == 16384) ? O2_RALLY : O2_STD; + } m_cart->cart_init(); @@ -238,6 +233,18 @@ uint8_t o2_cart_slot_device::io_read(offs_t offset) return 0xff; } +int o2_cart_slot_device::b_read() +{ + if (m_cart) + { + int b = m_cart->b_read(); + const bool override = b != -1; + return override ? b : m_b; + } + else + return 0; +} + #include "bus/odyssey2/rom.h" #include "bus/odyssey2/4in1.h" diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 419e187ac7a..4571ec4f9fa 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -43,15 +43,13 @@ public: virtual void io_write(offs_t offset, uint8_t data) { } virtual uint8_t io_read(offs_t offset) { return 0xff; } virtual DECLARE_READ_LINE_MEMBER(t0_read) { return 0; } + virtual int b_read() { return -1; } virtual void cart_init() { } // called after loading ROM void rom_alloc(uint32_t size, const char *tag); - void ram_alloc(uint32_t size); uint8_t* get_rom_base() { return m_rom; } - uint8_t* get_ram_base() { return &m_ram[0]; } uint32_t get_rom_size() { return m_rom_size; } - uint32_t get_ram_size() { return m_ram.size(); } protected: device_o2_cart_interface(const machine_config &mconfig, device_t &device); @@ -59,7 +57,6 @@ protected: // internal state uint8_t *m_rom; uint32_t m_rom_size; - std::vector m_ram; }; @@ -108,6 +105,7 @@ public: void io_write(offs_t offset, uint8_t data); uint8_t io_read(offs_t offset); DECLARE_READ_LINE_MEMBER(t0_read) { if (m_cart) return m_cart->t0_read(); else return 0; } + int b_read(); void write_p1(uint8_t data) { if (m_cart) m_cart->write_p1(data); } void write_p2(uint8_t data) { if (m_cart) m_cart->write_p2(data); } @@ -121,6 +119,7 @@ protected: int m_type; device_o2_cart_interface* m_cart; + int m_b; }; // device type definition diff --git a/src/devices/bus/odyssey2/voice.h b/src/devices/bus/odyssey2/voice.h index 981eddeb1dd..54ad23ea76b 100644 --- a/src/devices/bus/odyssey2/voice.h +++ b/src/devices/bus/odyssey2/voice.h @@ -34,6 +34,7 @@ public: virtual void io_write(offs_t offset, u8 data) override; virtual u8 io_read(offs_t offset) override { return (m_subslot->exists()) ? m_subslot->io_read(offset) : 0xff; } virtual DECLARE_READ_LINE_MEMBER(t0_read) override; + virtual int b_read() override { return (m_subslot->exists()) ? m_subslot->b_read() : -1; } protected: // device-level overrides diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp index 951c9b5e5f6..3e10789f8a6 100644 --- a/src/devices/cpu/mcs48/mcs48.cpp +++ b/src/devices/cpu/mcs48/mcs48.cpp @@ -416,7 +416,7 @@ void mcs48_cpu_device::push_pc_psw() uint8_t sp = m_psw & 0x07; ram_w(8 + 2*sp, m_pc); ram_w(9 + 2*sp, ((m_pc >> 8) & 0x0f) | (m_psw & 0xf0)); - m_psw = (m_psw & 0xf8) | ((sp + 1) & 0x07); + m_psw = (m_psw & 0xf0) | ((sp + 1) & 0x07); } diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index e0cad9d5546..6b12c8e2116 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -36,7 +36,7 @@ TODO: - backgamm doesn't draw all the sprites, what causes it? It doesn't seem like it's a 824x bug since it does properly write data in the partial screen updates - 824x screen resolution is not strictly defined, height(243) is correct, but - horizontal overscan differs depending on monitor/tv? + horizontal overscan differs depending on monitor/tv? see syracuse for overscan - 824x on the real console, overlapping characters on eachother will cause glitches (it is used to an advantage in some as-of-yet undumped homebrews) - 8244(NTSC) is not supposed to show characters near the upper border, but @@ -44,19 +44,20 @@ TODO: - 8245(PAL) video timing is not 100% accurate, though vtotal and htotal should be correct - ppp(the tetris game) does not work properly on PAL, is this homebrew NTSC-only, - or is it due to PAL video timing? The game does mid-scanline updates + or is PAL detection going wrong? The game does mid-scanline updates - g7400 helicopt sometimes locks up at the sea level, timing related? - g7400 probably has different video timing too (not same as g7000) - 4in1 and musician are not supposed to work on g7400, but work fine on MAME, - reason they shouldn't work is probably because they write to P2 + caused by bus conflict or because they write to P2? - verify odyssey3 cpu/video clocks - odyssey3 keyboard layout is not the same as g7400, but there is no software to test the scancodes BTANB: - a lot of PAL games have problems on NTSC (the other way around, not so much) -- g7400 games don't look correct on odyssey3: ef934x graphics are placed lower -- Blackjack (Videopac 5) does not work on G7400 +- g7400 games don't look correct on odyssey3 and vice versa: ef934x graphics are + placed lower on odyssey3 +- Blackjack (Videopac 5) does not work on G7400, caused by a removed BIOS routine Plenty games have minor bugs not worth mentioning here. @@ -254,14 +255,18 @@ uint32_t g7400_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int x = clip.min_x; x <= clip.max_x; x++) { - uint16_t d = bitmap.pix16(y, x); + uint16_t d = bitmap.pix16(y, x) & 7; uint16_t e = ef934x_bitmap->pix16(y, x); - // I outputs to CX - bool i2 = !BIT(m_mix_ef934x, e & 0x07); + // i8244 decoder enable is masked with cartridge pin B + bool en = (e & 8) || !m_cart->b_read(); + e &= 7; + + // ef934x decoder output is tied to CX + bool i2 = !BIT(m_mix_ef934x, e); m_i8244->write_cx(x, i2); - if (m_mix_i8244 == 0xff || ((e & 0x08) && BIT(m_mix_i8244, d & 0x07))) + if (en && BIT(m_mix_i8244, d)) { // Use i8245 input bitmap.pix16(y, x) |= lum; @@ -269,7 +274,7 @@ uint32_t g7400_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, else { // Use EF934x input - bitmap.pix16(y, x) = i2 ? e | 0x08 : e & 0x07; + bitmap.pix16(y, x) = e | (i2 ? 8 : 0); } } } @@ -666,7 +671,7 @@ void odyssey2_state::odyssey2(machine_config &config) I8244(config, m_i8244, XTAL(7'159'090) / 2); m_i8244->set_screen("screen"); - m_i8244->set_screen_size(356, 243); + m_i8244->set_screen_size(360, 243); m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); @@ -685,7 +690,7 @@ void odyssey2_state::videopac(machine_config &config) // PAL video chip I8245(config.replace(), m_i8244, XTAL(17'734'476) / 5); m_i8244->set_screen("screen"); - m_i8244->set_screen_size(356, 243); + m_i8244->set_screen_size(360, 243); m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); @@ -739,7 +744,7 @@ void g7400_state::g7400(machine_config &config) I8245(config, m_i8244, XTAL(8'867'000)/5 * 2); m_i8244->set_screen("screen"); - m_i8244->set_screen_size(356, 243); + m_i8244->set_screen_size(360, 243); m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); @@ -758,7 +763,7 @@ void g7400_state::odyssey3(machine_config &config) // NTSC video chip I8244(config.replace(), m_i8244, XTAL(7'159'090) / 2); m_i8244->set_screen("screen"); - m_i8244->set_screen_size(356, 243); + m_i8244->set_screen_size(360, 243); m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); -- cgit v1.2.3