videopac: add 7seg outputs for testcartpl

This commit is contained in:
hap 2024-12-04 20:54:28 +01:00
parent a064e4e79b
commit 706502c615
5 changed files with 64 additions and 5 deletions

View File

@ -2556,7 +2556,7 @@ distinguished by the changed copyright from Magnavox to N.A.P. (North American P
<publisher>Philips</publisher>
<info name="usage" value="See testcart, and at end of normal tests, press both joystick buttons to continue." />
<part name="cart" interface="odyssey_cart">
<feature name="slot" value="o2_rally" />
<feature name="slot" value="o2_testpl" />
<feature name="b_pin" value="1" />
<dataarea name="rom" size="0x2000">
<rom name="testcartpl.bin" size="0x2000" crc="b72b1494" sha1="fb281a5e4c7664209106f94e463d9017751712b5" />

View File

@ -14,6 +14,9 @@ Used in:
#55 and #58 also work on the G7000.
It's used by the Videopac+ Service Test cartridge too, with 2 7segs added. The
7segs are just for showing error codes, it will still work fine without them.
******************************************************************************/
#include "emu.h"
@ -25,12 +28,16 @@ namespace {
// initialization
//-------------------------------------------------
// Rally / shared
class o2_rally_device : public device_t, public device_o2_cart_interface
{
public:
o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
o2_rally_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual void device_start() override ATTR_COLD;
virtual void cart_init() override;
@ -41,16 +48,19 @@ protected:
virtual void write_p1(u8 data) override { m_control = data; }
virtual void io_write(offs_t offset, u8 data) override;
private:
u8 m_control = 0;
u8 m_bank = 0;
};
o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_RALLY, tag, owner, clock),
o2_rally_device::o2_rally_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, type, tag, owner, clock),
device_o2_cart_interface(mconfig, *this)
{ }
o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
o2_rally_device(mconfig, O2_ROM_RALLY, tag, owner, clock)
{ }
void o2_rally_device::device_start()
{
save_item(NAME(m_control));
@ -64,6 +74,35 @@ void o2_rally_device::cart_init()
}
// Service Test Cartridge
class o2_testpl_device : public o2_rally_device
{
public:
o2_testpl_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void device_start() override ATTR_COLD;
virtual void io_write(offs_t offset, u8 data) override;
private:
output_finder<2> m_digit_out;
};
o2_testpl_device::o2_testpl_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
o2_rally_device(mconfig, O2_ROM_TESTPL, tag, owner, clock),
m_digit_out(*this, "tc_digit%u", 0U)
{ }
void o2_testpl_device::device_start()
{
o2_rally_device::device_start();
m_digit_out.resolve();
}
//-------------------------------------------------
// mapper specific handlers
//-------------------------------------------------
@ -81,7 +120,23 @@ void o2_rally_device::io_write(offs_t offset, u8 data)
m_bank = data;
}
void o2_testpl_device::io_write(offs_t offset, u8 data)
{
o2_rally_device::io_write(offset, data);
// write to 7segs if P11 is low
if (~m_control & 2)
{
static const u8 ls48_map[0x10] =
{ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 };
m_digit_out[0] = ls48_map[data >> 4];
m_digit_out[1] = ls48_map[data & 0xf];
}
}
} // anonymous namespace
DEFINE_DEVICE_TYPE_PRIVATE(O2_ROM_RALLY, device_o2_cart_interface, o2_rally_device, "o2_rally", "Videopac+ 60 Cartridge")
DEFINE_DEVICE_TYPE_PRIVATE(O2_ROM_TESTPL, device_o2_cart_interface, o2_testpl_device, "o2_testpl", "Videopac+ Service Test Cartridge")

View File

@ -14,5 +14,6 @@
#include "slot.h"
DECLARE_DEVICE_TYPE(O2_ROM_RALLY, device_o2_cart_interface)
DECLARE_DEVICE_TYPE(O2_ROM_TESTPL, device_o2_cart_interface)
#endif // MAME_BUS_ODYSSEY2_RALLY_H

View File

@ -102,6 +102,7 @@ static const o2_slot slot_list[] =
{ O2_CHESS, "o2_chess" },
{ O2_HOMECOMP, "o2_homecomp" },
{ O2_TEST, "o2_test" },
{ O2_TESTPL, "o2_testpl" },
{ O2_VOICE, "o2_voice" }
};
@ -291,5 +292,6 @@ void o2_cart(device_slot_interface &device)
device.option_add_internal("o2_chess", O2_ROM_CHESS);
device.option_add_internal("o2_homecomp", O2_ROM_HOMECOMP);
device.option_add_internal("o2_test", O2_ROM_TEST);
device.option_add_internal("o2_testpl", O2_ROM_TESTPL);
device.option_add_internal("o2_voice", O2_ROM_VOICE);
}

View File

@ -34,7 +34,7 @@ on Videopac+, B is used for video mixer override
*/
/* PCB */
// PCB
enum
{
O2_STD = 0,
@ -44,6 +44,7 @@ enum
O2_CHESS,
O2_HOMECOMP,
O2_TEST,
O2_TESTPL,
O2_VOICE
};