diff options
Diffstat (limited to 'src')
678 files changed, 35611 insertions, 17949 deletions
diff --git a/src/devices/bus/a2bus/a2alfam2.cpp b/src/devices/bus/a2bus/a2alfam2.cpp index 0bee8380532..d4decaeae92 100644 --- a/src/devices/bus/a2bus/a2alfam2.cpp +++ b/src/devices/bus/a2bus/a2alfam2.cpp @@ -10,7 +10,6 @@ *********************************************************************/ #include "a2alfam2.h" -#include "includes/apple2.h" #include "sound/sn76496.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2applicard.cpp b/src/devices/bus/a2bus/a2applicard.cpp index 1e4f71e3e33..9fe268dbabd 100644 --- a/src/devices/bus/a2bus/a2applicard.cpp +++ b/src/devices/bus/a2bus/a2applicard.cpp @@ -12,7 +12,6 @@ *********************************************************************/ #include "a2applicard.h" -#include "includes/apple2.h" #include "cpu/z80/z80.h" #include "machine/z80ctc.h" diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp index e046b2e120e..79420fff9d3 100644 --- a/src/devices/bus/a2bus/a2cffa.cpp +++ b/src/devices/bus/a2bus/a2cffa.cpp @@ -12,7 +12,6 @@ *********************************************************************/ #include "a2cffa.h" -#include "includes/apple2.h" #include "machine/ataintf.h" #include "imagedev/harddriv.h" #include "softlist.h" diff --git a/src/devices/bus/a2bus/a2corvus.cpp b/src/devices/bus/a2bus/a2corvus.cpp index 9ee553b17d8..32d86cdc091 100644 --- a/src/devices/bus/a2bus/a2corvus.cpp +++ b/src/devices/bus/a2bus/a2corvus.cpp @@ -41,7 +41,6 @@ *********************************************************************/ #include "a2corvus.h" -#include "includes/apple2.h" #include "imagedev/harddriv.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2diskii.cpp b/src/devices/bus/a2bus/a2diskii.cpp index 50243e2f596..fa89dfc228e 100644 --- a/src/devices/bus/a2bus/a2diskii.cpp +++ b/src/devices/bus/a2bus/a2diskii.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "imagedev/flopdrv.h" #include "formats/ap2_dsk.h" #include "machine/appldriv.h" diff --git a/src/devices/bus/a2bus/a2dx1.cpp b/src/devices/bus/a2bus/a2dx1.cpp index 158403ee10c..71eee7cea0b 100644 --- a/src/devices/bus/a2bus/a2dx1.cpp +++ b/src/devices/bus/a2bus/a2dx1.cpp @@ -8,7 +8,6 @@ *********************************************************************/ -#include "includes/apple2.h" #include "a2dx1.h" #include "sound/volt_reg.h" diff --git a/src/devices/bus/a2bus/a2echoii.cpp b/src/devices/bus/a2bus/a2echoii.cpp index ee8e318da31..b309e265a07 100644 --- a/src/devices/bus/a2bus/a2echoii.cpp +++ b/src/devices/bus/a2bus/a2echoii.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "a2echoii.h" -#include "includes/apple2.h" #include "sound/tms5220.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2eext80col.cpp b/src/devices/bus/a2bus/a2eext80col.cpp index 1d2f6ae4e74..bd975354314 100644 --- a/src/devices/bus/a2bus/a2eext80col.cpp +++ b/src/devices/bus/a2bus/a2eext80col.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "a2eext80col.h" diff --git a/src/devices/bus/a2bus/a2eramworks3.cpp b/src/devices/bus/a2bus/a2eramworks3.cpp index c0a0e2c016d..e832bb53123 100644 --- a/src/devices/bus/a2bus/a2eramworks3.cpp +++ b/src/devices/bus/a2bus/a2eramworks3.cpp @@ -10,7 +10,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "a2eramworks3.h" diff --git a/src/devices/bus/a2bus/a2estd80col.cpp b/src/devices/bus/a2bus/a2estd80col.cpp index c6982aafa83..28a669ffd20 100644 --- a/src/devices/bus/a2bus/a2estd80col.cpp +++ b/src/devices/bus/a2bus/a2estd80col.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "a2estd80col.h" diff --git a/src/devices/bus/a2bus/a2hsscsi.cpp b/src/devices/bus/a2bus/a2hsscsi.cpp index e8e5f4b98e4..eb36d7cb8cb 100644 --- a/src/devices/bus/a2bus/a2hsscsi.cpp +++ b/src/devices/bus/a2bus/a2hsscsi.cpp @@ -39,7 +39,6 @@ *********************************************************************/ #include "a2hsscsi.h" -#include "includes/apple2.h" #include "machine/nscsi_cd.h" #include "machine/nscsi_hd.h" diff --git a/src/devices/bus/a2bus/a2lang.cpp b/src/devices/bus/a2bus/a2lang.cpp index 3c156fd4c90..0bd6af638db 100644 --- a/src/devices/bus/a2bus/a2lang.cpp +++ b/src/devices/bus/a2bus/a2lang.cpp @@ -13,7 +13,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "a2lang.h" @@ -70,12 +69,12 @@ void a2bus_lang_device::device_reset() void a2bus_lang_device::langcard_touch(offs_t offset) { - uint32_t val, mask; +/* uint32_t val, mask; if (LOG_LANGCARD) logerror("language card bankswitch read, offset: $c08%0x\n", offset); - /* determine which flags to change */ + // determine which flags to change mask = VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2; val = 0; @@ -93,9 +92,9 @@ void a2bus_lang_device::langcard_touch(offs_t offset) if ((offset & 0x08) == 0) val |= VAR_LCRAM2; - /* change the flags */ + // change the flags apple2_state *state = machine().driver_data<apple2_state>(); - state->apple2_setvar(val, mask); + state->apple2_setvar(val, mask);*/ } @@ -106,7 +105,7 @@ void a2bus_lang_device::langcard_touch(offs_t offset) uint8_t a2bus_lang_device::read_c0nx(address_space &space, uint8_t offset) { - apple2_state *state = machine().driver_data<apple2_state>(); +/* apple2_state *state = machine().driver_data<apple2_state>(); // enforce "read twice" for c081/3/9/B // but only on the II/II+ with a discrete language card. @@ -128,7 +127,7 @@ uint8_t a2bus_lang_device::read_c0nx(address_space &space, uint8_t offset) } langcard_touch(offset); - last_offset = offset; + last_offset = offset;*/ return 0; } diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index 57abe911fd0..38b8ce36fa8 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -11,7 +11,6 @@ *********************************************************************/ #include "a2mcms.h" -#include "includes/apple2.h" // the actual sound device (a slot device can't currently also be a sound device so we keep this private here) enum diff --git a/src/devices/bus/a2bus/a2memexp.cpp b/src/devices/bus/a2bus/a2memexp.cpp index f34b71e435d..be1d28cd1bc 100644 --- a/src/devices/bus/a2bus/a2memexp.cpp +++ b/src/devices/bus/a2bus/a2memexp.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "a2memexp.h" -#include "includes/apple2.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2sam.cpp b/src/devices/bus/a2bus/a2sam.cpp index e8b6f811754..3abc1820061 100644 --- a/src/devices/bus/a2bus/a2sam.cpp +++ b/src/devices/bus/a2bus/a2sam.cpp @@ -8,7 +8,6 @@ *********************************************************************/ -#include "includes/apple2.h" #include "a2sam.h" #include "sound/volt_reg.h" diff --git a/src/devices/bus/a2bus/a2scsi.cpp b/src/devices/bus/a2bus/a2scsi.cpp index f1da850482d..3dba10aa849 100644 --- a/src/devices/bus/a2bus/a2scsi.cpp +++ b/src/devices/bus/a2bus/a2scsi.cpp @@ -32,7 +32,6 @@ *********************************************************************/ #include "a2scsi.h" -#include "includes/apple2.h" #include "machine/nscsi_cd.h" #include "machine/nscsi_hd.h" diff --git a/src/devices/bus/a2bus/a2softcard.cpp b/src/devices/bus/a2bus/a2softcard.cpp index df509e7e079..8ffb9ba88da 100644 --- a/src/devices/bus/a2bus/a2softcard.cpp +++ b/src/devices/bus/a2bus/a2softcard.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "a2softcard.h" -#include "includes/apple2.h" #include "cpu/z80/z80.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2swyft.cpp b/src/devices/bus/a2bus/a2swyft.cpp index 975974b849b..ec6ef5af5f7 100644 --- a/src/devices/bus/a2bus/a2swyft.cpp +++ b/src/devices/bus/a2bus/a2swyft.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "emu.h" -#include "includes/apple2.h" #include "a2swyft.h" diff --git a/src/devices/bus/a2bus/a2themill.cpp b/src/devices/bus/a2bus/a2themill.cpp index 71aed47ace9..ecabb3e085f 100644 --- a/src/devices/bus/a2bus/a2themill.cpp +++ b/src/devices/bus/a2bus/a2themill.cpp @@ -23,7 +23,6 @@ *********************************************************************/ #include "a2themill.h" -#include "includes/apple2.h" #include "cpu/m6809/m6809.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp index 5526515ab1d..82a56021e02 100644 --- a/src/devices/bus/a2bus/a2ultraterm.cpp +++ b/src/devices/bus/a2bus/a2ultraterm.cpp @@ -28,7 +28,6 @@ *********************************************************************/ #include "a2ultraterm.h" -#include "includes/apple2.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp index 53eb6d5d20a..03f1ba1f2f4 100644 --- a/src/devices/bus/a2bus/a2videoterm.cpp +++ b/src/devices/bus/a2bus/a2videoterm.cpp @@ -24,7 +24,6 @@ *********************************************************************/ #include "a2videoterm.h" -#include "includes/apple2.h" /*************************************************************************** diff --git a/src/devices/bus/a2bus/a2vulcan.cpp b/src/devices/bus/a2bus/a2vulcan.cpp index 216ccc7d043..6cb28536d94 100644 --- a/src/devices/bus/a2bus/a2vulcan.cpp +++ b/src/devices/bus/a2bus/a2vulcan.cpp @@ -54,7 +54,6 @@ *********************************************************************/ #include "a2vulcan.h" -#include "includes/apple2.h" #include "machine/ataintf.h" #include "imagedev/harddriv.h" diff --git a/src/devices/bus/a2bus/a2zipdrive.cpp b/src/devices/bus/a2bus/a2zipdrive.cpp index 369aec79a4d..0e57cf691c1 100644 --- a/src/devices/bus/a2bus/a2zipdrive.cpp +++ b/src/devices/bus/a2bus/a2zipdrive.cpp @@ -20,7 +20,6 @@ *********************************************************************/ #include "a2zipdrive.h" -#include "includes/apple2.h" #include "machine/ataintf.h" #include "imagedev/harddriv.h" diff --git a/src/devices/bus/a2bus/laser128.cpp b/src/devices/bus/a2bus/laser128.cpp index 3ba434abfa4..c7dae25191d 100644 --- a/src/devices/bus/a2bus/laser128.cpp +++ b/src/devices/bus/a2bus/laser128.cpp @@ -9,7 +9,6 @@ *********************************************************************/ #include "laser128.h" -#include "includes/apple2.h" /*************************************************************************** PARAMETERS diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp index 6c0c7410c9a..9a4c7526ee6 100644 --- a/src/devices/bus/a2bus/mouse.cpp +++ b/src/devices/bus/a2bus/mouse.cpp @@ -66,15 +66,9 @@ #include "mouse.h" /*************************************************************************** - PARAMETERS + CONSTANTS ***************************************************************************/ -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type A2BUS_MOUSE = &device_creator<a2bus_mouse_device>; - #define MOUSE_ROM_REGION "a2mse_rom" #define MOUSE_PIA_TAG "a2mse_pia" #define MOUSE_MCU_TAG "a2mse_mcu" @@ -83,9 +77,14 @@ const device_type A2BUS_MOUSE = &device_creator<a2bus_mouse_device>; #define MOUSE_XAXIS_TAG "a2mse_x" #define MOUSE_YAXIS_TAG "a2mse_y" -#define TIMER_QUADRATURE 0 -MACHINE_CONFIG_FRAGMENT( mouse ) +/*************************************************************************** + GLOBAL VARIABLES +***************************************************************************/ + +const device_type A2BUS_MOUSE = &device_creator<a2bus_mouse_device>; + +static MACHINE_CONFIG_FRAGMENT( mouse ) MCFG_CPU_ADD(MOUSE_MCU_TAG, M68705P3, 2043600) MCFG_M68705_PORTA_R_CB(READ8(a2bus_mouse_device, mcu_port_a_r)) MCFG_M68705_PORTB_R_CB(READ8(a2bus_mouse_device, mcu_port_b_r)) @@ -123,92 +122,85 @@ static INPUT_PORTS_START( mouse ) PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1) INPUT_PORTS_END + /*************************************************************************** - FUNCTION PROTOTYPES + DEVICE CONFIGURATION ***************************************************************************/ -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- +/*------------------------------------------------- + input_ports - device-specific input ports +-------------------------------------------------*/ ioport_constructor a2bus_mouse_device::device_input_ports() const { - return INPUT_PORTS_NAME( mouse ); + return INPUT_PORTS_NAME(mouse); } -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- +/*------------------------------------------------- + machine_config_additions - device-specific + machine configurations +-------------------------------------------------*/ machine_config_constructor a2bus_mouse_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( mouse ); + return MACHINE_CONFIG_NAME(mouse); } -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- +/*------------------------------------------------- + rom_region - device-specific ROM region +-------------------------------------------------*/ const tiny_rom_entry *a2bus_mouse_device::device_rom_region() const { - return ROM_NAME( mouse ); + return ROM_NAME(mouse); } -//************************************************************************** -// LIVE DEVICE -//************************************************************************** + +/*************************************************************************** + LIVE DEVICE +***************************************************************************/ a2bus_mouse_device::a2bus_mouse_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) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_a2bus_card_interface(mconfig, *this), m_pia(*this, MOUSE_PIA_TAG), m_mcu(*this, MOUSE_MCU_TAG), - m_mouseb(*this, MOUSE_BUTTON_TAG), m_mousex(*this, MOUSE_XAXIS_TAG), m_mousey(*this, MOUSE_YAXIS_TAG), + m_mouseb(*this, MOUSE_BUTTON_TAG), m_mousexy(*this, { MOUSE_XAXIS_TAG, MOUSE_YAXIS_TAG }), m_rom(*this, MOUSE_ROM_REGION), + m_rom_bank(0), m_port_a_in(0), m_port_b_in(0), - last_mx(0), last_my(0), count_x(0), count_y(0), - m_read_timer(nullptr) + m_last{ 0, 0 }, m_count{ 0, 0 } { - m_rom_bank = 0; } a2bus_mouse_device::a2bus_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : a2bus_mouse_device(mconfig, A2BUS_MOUSE, "Apple II Mouse Card", tag, owner, clock, "a2mouse", __FILE__) { - m_rom_bank = 0; } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- +/*------------------------------------------------- + device_start - device-specific startup +-------------------------------------------------*/ void a2bus_mouse_device::device_start() { // set_a2bus_device makes m_slot valid set_a2bus_device(); - // allocate a timer for the quadrature magic - m_read_timer = timer_alloc(TIMER_QUADRATURE, nullptr); - m_read_timer->adjust(attotime::never, TIMER_QUADRATURE); - // register save state variables save_item(NAME(m_port_a_in)); save_item(NAME(m_port_b_in)); - save_item(NAME(last_mx)); - save_item(NAME(last_my)); - save_item(NAME(count_x)); - save_item(NAME(count_y)); + save_item(NAME(m_last)); + save_item(NAME(m_count)); + + m_port_b_in = 0x00; } void a2bus_mouse_device::device_reset() { m_rom_bank = 0; - last_mx = last_my = count_x = count_y = 0; - m_port_a_in = 0; - m_port_b_in = 0x80; - - m_read_timer->adjust(attotime::from_hz(600.0), TIMER_QUADRATURE, attotime::from_hz(600.0)); + m_last[0] = m_last[1] = m_count[0] = m_count[1] = 0; + m_port_a_in = 0x00; } /*------------------------------------------------- @@ -220,7 +212,6 @@ uint8_t a2bus_mouse_device::read_c0nx(address_space &space, uint8_t offset) return m_pia->read(space, offset & 3); } - /*------------------------------------------------- write_c0nx - called for writes to this card's c0nx space -------------------------------------------------*/ @@ -271,12 +262,28 @@ WRITE8_MEMBER(a2bus_mouse_device::mcu_port_a_w) READ8_MEMBER(a2bus_mouse_device::mcu_port_b_r) { - uint8_t b_in = m_port_b_in; + enum { XAXIS, YAXIS }; + constexpr u8 BUTTON = 0x80; + constexpr u8 X0 = 0x02; // gate, must go 0/1 for each pixel moved + constexpr u8 X1 = 0x01; // direction, 0 = left, 1 = right + constexpr u8 Y0 = 0x04; // direction, 0 = up, 1 = down + constexpr u8 Y1 = 0x08; // gate, must go 0/1 for each pixel moved + + // update button now + if (m_mouseb->read()) + { + m_port_b_in &= ~BUTTON; + } + else + { + m_port_b_in |= BUTTON; + } - // clear the gates, leave everything else alone between pulses - m_port_b_in &= 0x85; + // update the axes + update_axis<XAXIS, X1, X0>(); + update_axis<YAXIS, Y0, Y1>(); - return b_in; + return m_port_b_in; } WRITE8_MEMBER(a2bus_mouse_device::mcu_port_b_w) @@ -296,83 +303,35 @@ WRITE8_MEMBER(a2bus_mouse_device::mcu_port_c_w) m_pia->portb_w(data << 4); } -/* - X0 = direction, 0 = left, 1 = right - X1 = gate, must go 0/1 for each pixel moved - Y0 = direction, 0 = up, 1 = down - Y1 = gate, must go 0/1 for each pixel moved - - The direction must stay constant for a given train of gate pulses or the MCU will get confused. -*/ -void a2bus_mouse_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +template <unsigned AXIS, u8 DIR, u8 CLK> void a2bus_mouse_device::update_axis() { - if (id == TIMER_QUADRATURE) - { - int new_mx, new_my; - m_port_b_in = 0x80; + // read the axis + const int new_m = m_mousexy[AXIS]->read(); - // update button now - if (m_mouseb->read()) m_port_b_in &= ~0x80; + // did it change? + int diff = new_m - m_last[AXIS]; - // read the axes - new_mx = m_mousex->read(); - new_my = m_mousey->read(); + // check for wrap + if (diff > 0x80) + diff = 0x100 - diff; + if (diff < -0x80) + diff = -0x100 - diff; - // did X change? - if (new_mx != last_mx) - { - int diff = new_mx - last_mx; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_x += diff; - last_mx = new_mx; - } - - // did Y change? - if (new_my != last_my) - { - int diff = new_my - last_my; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; + m_count[AXIS] += diff; + m_last[AXIS] = new_m; - count_y += diff; - last_my = new_my; - } - - if (count_x) + if (m_count[AXIS]) + { + m_port_b_in ^= CLK; + if (m_count[AXIS] < 0) { - if (count_x < 0) - { - count_x++; - } - else - { - count_x--; - m_port_b_in |= 0x01; // X1 - } - m_port_b_in |= 0x02; // X0 + m_count[AXIS]++; + if (m_port_b_in & CLK) m_port_b_in &= ~DIR; } - else if (count_y) + else { - if (count_y < 0) - { - count_y++; - } - else - { - count_y--; - m_port_b_in |= 0x04; // Y0 - } - m_port_b_in |= 0x08; // Y1 + m_count[AXIS]--; + if (m_port_b_in & CLK) m_port_b_in |= DIR; } } } diff --git a/src/devices/bus/a2bus/mouse.h b/src/devices/bus/a2bus/mouse.h index c5a36319d79..b3148eaa7ff 100644 --- a/src/devices/bus/a2bus/mouse.h +++ b/src/devices/bus/a2bus/mouse.h @@ -8,8 +8,8 @@ *********************************************************************/ -#ifndef __A2BUS_MOUSE__ -#define __A2BUS_MOUSE__ +#ifndef MAME_DEVICES_A2BUS_MOUSE_H +#define MAME_DEVICES_A2BUS_MOUSE_H #include "emu.h" #include "a2bus.h" @@ -33,7 +33,6 @@ public: virtual machine_config_constructor device_mconfig_additions() const override; virtual const tiny_rom_entry *device_rom_region() const override; virtual ioport_constructor device_input_ports() const override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; DECLARE_WRITE8_MEMBER(pia_out_a); DECLARE_WRITE8_MEMBER(pia_out_b); @@ -57,18 +56,19 @@ protected: required_device<pia6821_device> m_pia; required_device<m68705p_device> m_mcu; - required_ioport m_mouseb, m_mousex, m_mousey; + required_ioport m_mouseb; + required_ioport_array<2> m_mousexy; private: + template <unsigned AXIS, u8 DIR, u8 CLK> void update_axis(); + required_region_ptr<uint8_t> m_rom; int m_rom_bank; - uint8_t m_port_a_in; - uint8_t m_port_b_in; - int last_mx, last_my, count_x, count_y; - emu_timer *m_read_timer; + uint8_t m_port_a_in, m_port_b_in; + int m_last[2], m_count[2]; }; // device type definition extern const device_type A2BUS_MOUSE; -#endif /* __A2BUS_MOUSE__ */ +#endif // MAME_DEVICES_A2BUS_MOUSE_H diff --git a/src/devices/bus/abcbus/abcbus.h b/src/devices/bus/abcbus/abcbus.h index 906d3d1b3d2..9fe542944c9 100644 --- a/src/devices/bus/abcbus/abcbus.h +++ b/src/devices/bus/abcbus/abcbus.h @@ -121,34 +121,34 @@ #define MCFG_ABCBUS_SLOT_IRQ_CALLBACK(_irq) \ - downcast<abcbus_slot_t *>(device)->set_irq_callback(DEVCB_##_irq); + devcb = &downcast<abcbus_slot_t *>(device)->set_irq_callback(DEVCB_##_irq); #define MCFG_ABCBUS_SLOT_NMI_CALLBACK(_nmi) \ - downcast<abcbus_slot_t *>(device)->set_nmi_callback(DEVCB_##_nmi); + devcb = &downcast<abcbus_slot_t *>(device)->set_nmi_callback(DEVCB_##_nmi); #define MCFG_ABCBUS_SLOT_RDY_CALLBACK(_rdy) \ - downcast<abcbus_slot_t *>(device)->set_rdy_callback(DEVCB_##_rdy); + devcb = &downcast<abcbus_slot_t *>(device)->set_rdy_callback(DEVCB_##_rdy); #define MCFG_ABCBUS_SLOT_RESIN_CALLBACK(_resin) \ - downcast<abcbus_slot_t *>(device)->set_resin_callback(DEVCB_##_resin); + devcb = &downcast<abcbus_slot_t *>(device)->set_resin_callback(DEVCB_##_resin); #define MCFG_ABCBUS_SLOT_PREN_CALLBACK(_pren) \ - downcast<abcbus_slot_t *>(device)->set_pren_callback(DEVCB_##_pren); + devcb = &downcast<abcbus_slot_t *>(device)->set_pren_callback(DEVCB_##_pren); #define MCFG_ABCBUS_SLOT_TRRQ_CALLBACK(_trrq) \ - downcast<abcbus_slot_t *>(device)->set_trrq_callback(DEVCB_##_trrq); + devcb = &downcast<abcbus_slot_t *>(device)->set_trrq_callback(DEVCB_##_trrq); #define MCFG_ABCBUS_SLOT_XINT2_CALLBACK(_xint2) \ - downcast<abcbus_slot_t *>(device)->set_xint2_callback(DEVCB_##_xint2); + devcb = &downcast<abcbus_slot_t *>(device)->set_xint2_callback(DEVCB_##_xint2); #define MCFG_ABCBUS_SLOT_XINT3_CALLBACK(_xint3) \ - downcast<abcbus_slot_t *>(device)->set_xint3_callback(DEVCB_##_xint3); + devcb = &downcast<abcbus_slot_t *>(device)->set_xint3_callback(DEVCB_##_xint3); #define MCFG_ABCBUS_SLOT_XINT4_CALLBACK(_xint4) \ - downcast<abcbus_slot_t *>(device)->set_xint4_callback(DEVCB_##_xint4); + devcb = &downcast<abcbus_slot_t *>(device)->set_xint4_callback(DEVCB_##_xint4); #define MCFG_ABCBUS_SLOT_XINT5_CALLBACK(_xint5) \ - downcast<abcbus_slot_t *>(device)->set_xint5_callback(DEVCB_##_xint5); + devcb = &downcast<abcbus_slot_t *>(device)->set_xint5_callback(DEVCB_##_xint5); @@ -207,16 +207,16 @@ public: // construction/destruction abcbus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); } - template<class _nmi> void set_nmi_callback(_nmi nmi) { m_write_nmi.set_callback(nmi); } - template<class _rdy> void set_rdy_callback(_rdy rdy) { m_write_rdy.set_callback(rdy); } - template<class _resin> void set_resin_callback(_resin resin) { m_write_resin.set_callback(resin); } - template<class _pren> void set_pren_callback(_pren pren) { m_write_pren.set_callback(pren); } - template<class _trrq> void set_trrq_callback(_trrq trrq) { m_write_trrq.set_callback(trrq); } - template<class _xint2> void set_xint2_callback(_xint2 xint2) { m_write_xint2.set_callback(xint2); } - template<class _xint3> void set_xint3_callback(_xint3 xint3) { m_write_xint3.set_callback(xint3); } - template<class _xint4> void set_xint4_callback(_xint4 xint4) { m_write_xint4.set_callback(xint4); } - template<class _xint5> void set_xint5_callback(_xint5 xint5) { m_write_xint5.set_callback(xint5); } + template<class _irq> devcb_base &set_irq_callback(_irq irq) { return m_write_irq.set_callback(irq); } + template<class _nmi> devcb_base &set_nmi_callback(_nmi nmi) { return m_write_nmi.set_callback(nmi); } + template<class _rdy> devcb_base &set_rdy_callback(_rdy rdy) { return m_write_rdy.set_callback(rdy); } + template<class _resin> devcb_base &set_resin_callback(_resin resin) { return m_write_resin.set_callback(resin); } + template<class _pren> devcb_base &set_pren_callback(_pren pren) { return m_write_pren.set_callback(pren); } + template<class _trrq> devcb_base &set_trrq_callback(_trrq trrq) { return m_write_trrq.set_callback(trrq); } + template<class _xint2> devcb_base &set_xint2_callback(_xint2 xint2) { return m_write_xint2.set_callback(xint2); } + template<class _xint3> devcb_base &set_xint3_callback(_xint3 xint3) { return m_write_xint3.set_callback(xint3); } + template<class _xint4> devcb_base &set_xint4_callback(_xint4 xint4) { return m_write_xint4.set_callback(xint4); } + template<class _xint5> devcb_base &set_xint5_callback(_xint5 xint5) { return m_write_xint5.set_callback(xint5); } // computer interface void cs_w(uint8_t data) { if (m_card) m_card->abcbus_cs(data); } diff --git a/src/devices/bus/amiga/keyboard/a1200.cpp b/src/devices/bus/amiga/keyboard/a1200.cpp new file mode 100644 index 00000000000..c9588ca0a8a --- /dev/null +++ b/src/devices/bus/amiga/keyboard/a1200.cpp @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + Amiga 1200 Keyboard + + 391508-01 = Rev 0 is MC68HC05C4AFN + 391508-02 = Rev 1 is MC68HC05C12FN + +***************************************************************************/ + +#include "emu.h" +#include "a1200.h" +#include "matrix.h" + +#include "cpu/m6805/m68hc05.h" + +//#define VERBOSE 1 +#include "logmacro.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +device_type const A1200_KBD = &device_creator<bus::amiga::keyboard::a1200_kbd_device>; + + + +namespace bus { namespace amiga { namespace keyboard { + +namespace { + +INPUT_PORTS_START(a1200_mod) + PORT_START("MOD") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Left Alt") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Left Shift") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Ctrl") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Right Alt") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_NAME("Right Shift") +INPUT_PORTS_END + +INPUT_PORTS_START(a1200_us_keyboard) + PORT_INCLUDE(matrix_us) + PORT_INCLUDE(a1200_mod) +INPUT_PORTS_END + + +MACHINE_CONFIG_FRAGMENT(a1200kbd_revB) + MCFG_CPU_ADD("mpu", M68HC705C8A, XTAL_3MHz) + MCFG_M68HC05_PORTB_R_CB(READ8(a1200_kbd_device, mpu_portb_r)); + MCFG_M68HC05_PORTD_R_CB(IOPORT("MOD")); + MCFG_M68HC05_PORTA_W_CB(WRITE8(a1200_kbd_device, mpu_porta_w)); + MCFG_M68HC05_PORTB_W_CB(WRITE8(a1200_kbd_device, mpu_portb_w)); + MCFG_M68HC05_PORTC_W_CB(WRITE8(a1200_kbd_device, mpu_portc_w)); + MCFG_M68HC05_TCMP_CB(WRITELINE(a1200_kbd_device, mpu_tcmp)); +MACHINE_CONFIG_END + + +ROM_START(a1200kbd_revB) + ROM_REGION(0x2000, "mpu", 0) + ROM_LOAD("DFA_Rev_B_A1200_HC705.bin", 0x0000, 0x2000, CRC(2a77eec4) SHA1(301ec6a69404457d912c89e3fc54095eda9f0e93)) +ROM_END + +} // anonymous namespace + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a1200_kbd_device::a1200_kbd_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, A1200_KBD, "Amiga 1200 Keyboard Rev B", tag, owner, clock, "a1200kbd_rb", __FILE__) + , device_amiga_keyboard_interface(mconfig, *this) + , m_rows(*this, "ROW%u", 0) + , m_mpu(*this, "mpu") + , m_row_drive(0xffff) + , m_host_kdat(true) + , m_mpu_kdat(true) +{ +} + +WRITE_LINE_MEMBER(a1200_kbd_device::kdat_w) +{ + if (bool(state) != m_host_kdat) + { + LOG("host DATA %u -> %u\n", m_host_kdat ? 1 : 0, state ? 1 : 0); + m_host_kdat = bool(state); + if (m_mpu_kdat) + m_mpu->set_input_line(M68HC05_TCAP_LINE, m_host_kdat ? 1 : 0); + } +} + +READ8_MEMBER(a1200_kbd_device::mpu_portb_r) +{ + u8 result(m_host_kdat ? 0xff : 0xfe); + for (unsigned row = 0; m_rows.size() > row; ++row) + { + if (!BIT(m_row_drive, row)) + result &= m_rows[row]->read(); + } + return result; +} + +WRITE8_MEMBER(a1200_kbd_device::mpu_porta_w) +{ + m_row_drive = (m_row_drive & 0xff00) | u16(u8(data | ~mem_mask)); +} + +WRITE8_MEMBER(a1200_kbd_device::mpu_portb_w) +{ + u8 const kdat(BIT(data, 0) | BIT(~mem_mask, 0)); + m_host->kdat_w(kdat ? 1 : 0); + m_host->kclk_w(BIT(data, 1)); + + if (bool(kdat) != m_mpu_kdat) + { + LOG("keyboard DATA %u -> %u\n", m_mpu_kdat ? 1 : 0, kdat); + m_mpu_kdat = bool(kdat); + if (m_host_kdat) + m_mpu->set_input_line(M68HC05_TCAP_LINE, kdat); + } +} + +WRITE8_MEMBER(a1200_kbd_device::mpu_portc_w) +{ + m_row_drive = (m_row_drive & 0x80ff) | (u16(u8(data | ~mem_mask) & 0x7f) << 8); + machine().output().set_value("led_kbd_caps", BIT(~data, 7)); +} + +WRITE_LINE_MEMBER(a1200_kbd_device::mpu_tcmp) +{ + m_host->krst_w(state); +} + +machine_config_constructor a1200_kbd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(a1200kbd_revB); +} + +const tiny_rom_entry *a1200_kbd_device::device_rom_region() const +{ + return ROM_NAME(a1200kbd_revB); +} + +ioport_constructor a1200_kbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(a1200_us_keyboard); +} + +void a1200_kbd_device::device_start() +{ + save_item(NAME(m_row_drive)); + save_item(NAME(m_host_kdat)); + save_item(NAME(m_mpu_kdat)); + + m_row_drive = 0xffff; + m_host_kdat = true; + m_mpu_kdat = true; +} + +void a1200_kbd_device::device_reset() +{ +} + +} } } // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/a1200.h b/src/devices/bus/amiga/keyboard/a1200.h new file mode 100644 index 00000000000..f29689b18e3 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/a1200.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders: Vas Crabb +/*************************************************************************** + + Amiga 1200 Keyboard + + ***************************************************************************/ + +#ifndef DEVICES_BUS_AMIGA_KEYBOARD_A1200_H +#define DEVICES_BUS_AMIGA_KEYBOARD_A1200_H + +#pragma once + +#include "keyboard.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +extern device_type const A1200_KBD; + + +namespace bus { namespace amiga { namespace keyboard { + +//************************************************************************** +// TYPE DECLARATIONS +//************************************************************************** + +// ======================> a1200_kbd_device + +class a1200_kbd_device : public device_t, public device_amiga_keyboard_interface +{ +public: + // construction/destruction + a1200_kbd_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock); + + // from host + virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) override; + + // MPU I/O + DECLARE_READ8_MEMBER(mpu_portb_r); + DECLARE_WRITE8_MEMBER(mpu_porta_w); + DECLARE_WRITE8_MEMBER(mpu_portb_w); + DECLARE_WRITE8_MEMBER(mpu_portc_w); + DECLARE_WRITE_LINE_MEMBER(mpu_tcmp); + +protected: + virtual const tiny_rom_entry *device_rom_region() const override; + virtual machine_config_constructor device_mconfig_additions() const override; + virtual ioport_constructor device_input_ports() const override; + + virtual void device_start() override; + virtual void device_reset() override; + +private: + required_ioport_array<15> m_rows; + required_device<cpu_device> m_mpu; + + u16 m_row_drive; + bool m_host_kdat, m_mpu_kdat; +}; + +} } } // namespace bus::amiga::keyboard + +#endif // DEVICES_BUS_AMIGA_KEYBOARD_A1200_H diff --git a/src/devices/bus/amiga/keyboard/a500.cpp b/src/devices/bus/amiga/keyboard/a500.cpp new file mode 100644 index 00000000000..80c241a6b62 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/a500.cpp @@ -0,0 +1,423 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga 500 Keyboard + + TODO: - Move 6500/1 to its own CPU core so that it can be shared with + other systems + +***************************************************************************/ + +#include "emu.h" +#include "a500.h" +#include "matrix.h" + +#include "machine/rescap.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type A500_KBD_US = &device_creator<bus::amiga::keyboard::a500_kbd_us_device>; +const device_type A500_KBD_DE = &device_creator<bus::amiga::keyboard::a500_kbd_de_device>; + + +namespace bus { namespace amiga { namespace keyboard { + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, a500_kbd_us_device ) + ADDRESS_MAP_GLOBAL_MASK(0xfff) + AM_RANGE(0x000, 0x03f) AM_RAM + AM_RANGE(0x080, 0x080) AM_READWRITE(port_a_r, port_a_w) + AM_RANGE(0x081, 0x081) AM_READ_PORT("special") AM_WRITE(port_b_w) + AM_RANGE(0x082, 0x082) AM_WRITE(port_c_w) + AM_RANGE(0x083, 0x083) AM_WRITE(port_d_w) + AM_RANGE(0x084, 0x085) AM_WRITE(latch_w) + AM_RANGE(0x086, 0x087) AM_READ(counter_r) + AM_RANGE(0x088, 0x088) AM_WRITE(transfer_latch_w) + AM_RANGE(0x089, 0x089) AM_WRITE(clear_pa0_detect) + AM_RANGE(0x08a, 0x08a) AM_WRITE(clear_pa1_detect) + AM_RANGE(0x08f, 0x08f) AM_READWRITE(control_r, control_w) + AM_RANGE(0x090, 0x0ff) AM_NOP + AM_RANGE(0x800, 0xfff) AM_ROM AM_REGION("ic1", 0) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( kbd_pcb ) + MCFG_CPU_ADD("ic1", M6502, XTAL_3MHz / 2) + MCFG_CPU_PROGRAM_MAP(mpu6500_map) +MACHINE_CONFIG_END + +machine_config_constructor a500_kbd_us_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(kbd_pcb); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( kbd_pcb ) + ROM_REGION(0x800, "ic1", 0) + ROM_LOAD("328191-02.ic1", 0x000, 0x800, CRC(4a3fc332) SHA1(83b21d0c8b93fc9b9b3b287fde4ec8f3badac5a2)) +ROM_END + +const tiny_rom_entry *a500_kbd_us_device::device_rom_region() const +{ + return ROM_NAME(kbd_pcb); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( a500_special ) + PORT_START("special") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Left Alt") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Left Shift") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Right Alt") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_NAME("Right Shift") +INPUT_PORTS_END + +static INPUT_PORTS_START( a500_us_keyboard ) + PORT_INCLUDE(a500_special) + PORT_INCLUDE(matrix_us) +INPUT_PORTS_END + +static INPUT_PORTS_START( a500_de_keyboard ) + PORT_INCLUDE(a500_special) + PORT_INCLUDE(matrix_de) +INPUT_PORTS_END + +ioport_constructor a500_kbd_us_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a500_us_keyboard ); +} + +ioport_constructor a500_kbd_de_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a500_de_keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// a500_kbd_us_device - constructor +//------------------------------------------------- + +a500_kbd_us_device::a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a500_kbd_us_device(mconfig, tag, owner, clock, A500_KBD_US, "Amiga 500 Keyboard (U.S./Canada)", "a500_kbd_us", __FILE__) +{ +} + +a500_kbd_us_device::a500_kbd_us_device( + const machine_config &mconfig, + const char *tag, + device_t *owner, + uint32_t clock, + device_type type, + const char *name, + const char *shortname, + const char *file) : + device_t(mconfig, type, name, tag, owner, clock, shortname, file), + device_amiga_keyboard_interface(mconfig, *this), + m_mpu(*this, "ic1"), + m_special(*this, "special"), + m_rows(*this, "ROW%u", 0), + m_timer(nullptr), + m_watchdog(nullptr), + m_reset(nullptr), + m_host_kdat(1), + m_mpu_kdat(1), + m_kclk(1), + m_port_c(0xff), + m_port_d(0xff), + m_latch(0xffff), + m_counter(0xffff), + m_control(0x00) +{ +} + +//------------------------------------------------- +// a500_kbd_de_device - constructor +//------------------------------------------------- + +a500_kbd_de_device::a500_kbd_de_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a500_kbd_us_device(mconfig, tag, owner, clock, A500_KBD_DE, "Amiga 500 Keyboard (Germany/Austria)", "a500_kbd_de", __FILE__) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a500_kbd_us_device::device_start() +{ + // allocate timers + m_timer = timer_alloc(0, nullptr); + m_watchdog = timer_alloc(1, nullptr); + m_reset = timer_alloc(2, nullptr); + + // register for save states + save_item(NAME(m_host_kdat)); + save_item(NAME(m_mpu_kdat)); + save_item(NAME(m_kclk)); + save_item(NAME(m_port_c)); + save_item(NAME(m_port_d)); + save_item(NAME(m_latch)); + save_item(NAME(m_counter)); + save_item(NAME(m_control)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void a500_kbd_us_device::device_reset() +{ + // stack starts 0 + m_mpu->set_state_int(M6502_S, 0); + + m_host_kdat = 1; + m_mpu_kdat = 1; + m_kclk = 1; + m_port_c = 0xff; + m_port_d = 0xff; + m_latch = 0xffff; // not initialized by hardware + m_counter = 0xffff; // not initialized by hardware + m_control = 0x00; + + m_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_3MHz / 2)); + m_watchdog->adjust(attotime::from_msec(54)); +} + +void a500_kbd_us_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + switch (tid) + { + // 6500/1 internal timer + case 0: + switch (m_control & 0x03) + { + // interval timer, pulse width measurement (connected to gnd here) + case 0: + case 3: + if (m_counter-- == 0) + { + // counter overflow + m_control |= COUNTER_OVERFLOW; + m_counter = m_latch; + + // generate interrupt? + update_irqs(); + } + break; + + // pulse generator + case 1: + break; + + // event counter + case 2: + break; + } + break; + + // watchdog + case 1: + m_mpu->reset(); + m_watchdog->adjust(attotime::from_msec(54)); + break; + + // keyboard reset timer + case 2: + m_host->krst_w(1); + break; + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER( a500_kbd_us_device::check_reset ) +{ + uint8_t keys = m_special->read(); + + // ctrl-amiga-amiga pressed? + if (!BIT(keys, 6) && !BIT(keys, 3) && !BIT(keys, 2)) + { + m_host->krst_w(0); + m_reset->adjust(PERIOD_OF_555_MONOSTABLE(RES_K(47), CAP_U(10))); + } +} + +void a500_kbd_us_device::update_irqs() +{ + if ((m_control & PA1_INT_ENABLED) && (m_control & PA1_NEGATIVE_EDGE)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else if ((m_control & PA0_INT_ENABLED) && (m_control & PA0_POSITIVE_EDGE)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else if ((m_control & COUNTER_INT_ENABLED) && (m_control & COUNTER_OVERFLOW)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else + m_mpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); +} + +READ8_MEMBER( a500_kbd_us_device::port_a_r ) +{ + uint8_t data = 0xfc; + + // kdat & kclk + data |= (m_host_kdat & m_mpu_kdat) << 0; + data |= m_kclk << 1; + + // scan port d and c rows + uint16_t const row_drive = (uint16_t(m_port_d | 0x80) << 8) | uint16_t(m_port_c); + for (unsigned i = 0; i < m_rows.size(); i++) + if (!BIT(row_drive, m_rows.size() - i - 1)) data &= m_rows[i]->read(); + + return data; +} + +WRITE8_MEMBER( a500_kbd_us_device::port_a_w ) +{ + // look for pa0 edge + if (m_host_kdat && !m_mpu_kdat && BIT(data, 0)) + { + m_control |= PA0_POSITIVE_EDGE; + update_irqs(); + } + + // and pa1 edge + if (m_kclk && !BIT(data, 1)) + { + m_control |= PA1_NEGATIVE_EDGE; + update_irqs(); + } + + // update with new values and output + if (m_mpu_kdat != BIT(data, 0)) + { + m_mpu_kdat = BIT(data, 0); + m_host->kdat_w(m_mpu_kdat); + } + + if (m_kclk != BIT(data, 1)) + { + m_kclk = BIT(data, 1); + m_host->kclk_w(m_kclk); + } +} + +WRITE8_MEMBER( a500_kbd_us_device::port_b_w ) +{ + // caps lock led + machine().output().set_value("led_kbd_caps", BIT(data, 7)); +} + +WRITE8_MEMBER( a500_kbd_us_device::port_c_w ) +{ + m_port_c = data; +} + +WRITE8_MEMBER( a500_kbd_us_device::port_d_w ) +{ + // reset watchdog on 0 -> 1 transition + if (!BIT(m_port_d, 7) && BIT(data, 7)) + m_watchdog->adjust(attotime::from_msec(54)); + + m_port_d = data; +} + +WRITE8_MEMBER( a500_kbd_us_device::latch_w ) +{ + if (offset == 0) + { + m_latch &= 0x00ff; + m_latch |= data << 8; + } + else + { + m_latch &= 0xff00; + m_latch |= data << 0; + } +} + +READ8_MEMBER( a500_kbd_us_device::counter_r ) +{ + if (!space.debugger_access()) + { + m_control &= ~COUNTER_OVERFLOW; + update_irqs(); + } + + if (offset == 0) + return m_counter >> 8; + else + return m_counter >> 0; +} + +WRITE8_MEMBER( a500_kbd_us_device::transfer_latch_w ) +{ + m_control &= ~COUNTER_OVERFLOW; + update_irqs(); + + m_latch &= 0x00ff; + m_latch |= data << 8; + + m_counter = m_latch; +} + +WRITE8_MEMBER( a500_kbd_us_device::clear_pa0_detect ) +{ + m_control &= ~PA0_POSITIVE_EDGE; + update_irqs(); +} + +WRITE8_MEMBER( a500_kbd_us_device::clear_pa1_detect ) +{ + m_control &= ~PA1_NEGATIVE_EDGE; + update_irqs(); +} + +READ8_MEMBER( a500_kbd_us_device::control_r ) +{ + return m_control; +} + +WRITE8_MEMBER( a500_kbd_us_device::control_w ) +{ + m_control = data; + update_irqs(); +} + +WRITE_LINE_MEMBER( a500_kbd_us_device::kdat_w ) +{ + // detect positive edge + if (!m_host_kdat && m_mpu_kdat && state) + { + m_control |= PA0_POSITIVE_EDGE; + update_irqs(); + } + + m_host_kdat = state; +} + +} } } // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/a500.h b/src/devices/bus/amiga/keyboard/a500.h new file mode 100644 index 00000000000..f4aeee81804 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/a500.h @@ -0,0 +1,150 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga 500 Keyboard + + Assembly part numbers: + + - 312502-01 U.S./Canada + - 312502-02 Germany/Austria + - 312502-03 France/Belgium + - 312502-04 Italy + - 312502-05 Sweden/Finland + - 312502-06 Spain + - 312502-07 Denmark + - 312502-08 Switzerland + - 312502-09 Norway + - 312502-12 UK + + Amiga 1000 (for reference, to be moved): + + - 327063-01 U.S./Canada + - 327063-02 UK + - 327063-03 Germany + - 327063-04 France + - 327063-05 Italy + +***************************************************************************/ + +#ifndef DEVICES_BUS_AMIGA_KEYBOARD_A500_H +#define DEVICES_BUS_AMIGA_KEYBOARD_A500_H + +#pragma once + +#include "keyboard.h" +#include "cpu/m6502/m6502.h" + + +namespace bus { namespace amiga { namespace keyboard { + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> a500_kbd_us_device + +class a500_kbd_us_device : public device_t, public device_amiga_keyboard_interface +{ +public: + // construction/destruction + a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // from host + virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) override; + + // 6500/1 internal + DECLARE_READ8_MEMBER(port_a_r); + DECLARE_WRITE8_MEMBER(port_a_w); + DECLARE_WRITE8_MEMBER(port_b_w); + DECLARE_WRITE8_MEMBER(port_c_w); + DECLARE_WRITE8_MEMBER(port_d_w); + DECLARE_WRITE8_MEMBER(latch_w); + DECLARE_READ8_MEMBER(counter_r); + DECLARE_WRITE8_MEMBER(transfer_latch_w); + DECLARE_WRITE8_MEMBER(clear_pa0_detect); + DECLARE_WRITE8_MEMBER(clear_pa1_detect); + DECLARE_READ8_MEMBER(control_r); + DECLARE_WRITE8_MEMBER(control_w); + + DECLARE_INPUT_CHANGED_MEMBER(check_reset); + +protected: + a500_kbd_us_device( + const machine_config &mconfig, + const char *tag, + device_t *owner, + uint32_t clock, + device_type type, + const char *name, + const char *shortname, + const char *file); + + // device-level overrides + virtual const tiny_rom_entry *device_rom_region() const override; + virtual machine_config_constructor device_mconfig_additions() const override; + virtual ioport_constructor device_input_ports() const override; + 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: + enum + { + // counter modes + COUNTER_INTERVAL = 0x00, + COUNTER_PULSE = 0x01, + COUNTER_EVENT = 0x02, + COUNTER_PWM = 0x03, + + // interrupt enables + PA1_INT_ENABLED = 0x04, + PA0_INT_ENABLED = 0x08, + COUNTER_INT_ENABLED = 0x10, + + // status + PA1_NEGATIVE_EDGE = 0x20, + PA0_POSITIVE_EDGE = 0x40, + COUNTER_OVERFLOW = 0x80 + }; + + void update_irqs(); + + required_device<m6502_device> m_mpu; + required_ioport m_special; + required_ioport_array<15> m_rows; + + emu_timer *m_timer; + emu_timer *m_watchdog; + emu_timer *m_reset; + + int m_host_kdat; + int m_mpu_kdat; + int m_kclk; + + uint8_t m_port_c; + uint8_t m_port_d; + uint16_t m_latch; + uint16_t m_counter; + uint8_t m_control; +}; + +// ======================> a500_kbd_de_device + +class a500_kbd_de_device : public a500_kbd_us_device +{ +public: + a500_kbd_de_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual ioport_constructor device_input_ports() const override; +}; + +} } } // namespace bus::amiga::keyboard + + +// device type definition +extern const device_type A500_KBD_US; +extern const device_type A500_KBD_DE; + +#endif // DEVICES_BUS_AMIGA_KEYBOARD_A500_H diff --git a/src/devices/bus/amiga/keyboard/keyboard.cpp b/src/devices/bus/amiga/keyboard/keyboard.cpp new file mode 100644 index 00000000000..c9d9bc95ce9 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/keyboard.cpp @@ -0,0 +1,110 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga Keyboard Interface + +***************************************************************************/ + +#include "keyboard.h" +#include "a500.h" +#include "a1200.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type AMIGA_KEYBOARD_INTERFACE = &device_creator<amiga_keyboard_bus_device>; + + +//************************************************************************** +// SLOT DEVICE +//************************************************************************** + +//------------------------------------------------- +// amiga_keyboard_bus_device - constructor +//------------------------------------------------- + +amiga_keyboard_bus_device::amiga_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, AMIGA_KEYBOARD_INTERFACE, "Amiga Keyboard Interface", tag, owner, clock, "amiga_kbd", __FILE__), + device_slot_interface(mconfig, *this), + m_kbd(nullptr), + m_kclk_handler(*this), m_kdat_handler(*this), m_krst_handler(*this) +{ +} + +//------------------------------------------------- +// amiga_keyboard_bus_device - destructor +//------------------------------------------------- + +amiga_keyboard_bus_device::~amiga_keyboard_bus_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void amiga_keyboard_bus_device::device_start() +{ + // get connected keyboard + m_kbd = dynamic_cast<device_amiga_keyboard_interface *>(get_card_device()); + + // resolve callbacks + m_kclk_handler.resolve_safe(); + m_kdat_handler.resolve_safe(); + m_krst_handler.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void amiga_keyboard_bus_device::device_reset() +{ +} + +//------------------------------------------------- +// host to module interface +//------------------------------------------------- + +WRITE_LINE_MEMBER( amiga_keyboard_bus_device::kdat_in_w ) +{ + if (m_kbd) + m_kbd->kdat_w(state); +} + + +//************************************************************************** +// KEYBOARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_amiga_keyboard_interface - constructor +//------------------------------------------------- + +device_amiga_keyboard_interface::device_amiga_keyboard_interface(const machine_config &mconfig, device_t &device) : + device_slot_card_interface(mconfig, device) +{ + m_host = dynamic_cast<amiga_keyboard_bus_device *>(device.owner()); +} + +//------------------------------------------------- +// ~device_amiga_keyboard_interface - destructor +//------------------------------------------------- + +device_amiga_keyboard_interface::~device_amiga_keyboard_interface() +{ +} + + +//************************************************************************** +// SLOT INTERFACE +//************************************************************************** + +SLOT_INTERFACE_START( amiga_keyboard_devices ) + SLOT_INTERFACE("a500_us", A500_KBD_US) + SLOT_INTERFACE("a500_de", A500_KBD_DE) + SLOT_INTERFACE("a1200_us", A1200_KBD) +SLOT_INTERFACE_END diff --git a/src/devices/bus/amiga/keyboard/keyboard.h b/src/devices/bus/amiga/keyboard/keyboard.h new file mode 100644 index 00000000000..deb2f79295a --- /dev/null +++ b/src/devices/bus/amiga/keyboard/keyboard.h @@ -0,0 +1,108 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga Keyboard Interface + + Serial data and reset control + + - KDAT (serial data) + - KCLK (serial clock) + - KRST (reset output) + +***************************************************************************/ + +#pragma once + +#ifndef DEVICES_BUS_AMIGA_KEYBOARD_H +#define DEVICES_BUS_AMIGA_KEYBOARD_H + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_AMIGA_KEYBOARD_INTERFACE_ADD(_tag, _def_slot) \ + MCFG_DEVICE_ADD(_tag, AMIGA_KEYBOARD_INTERFACE, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(amiga_keyboard_devices, _def_slot, false) + +#define MCFG_AMIGA_KEYBOARD_KCLK_HANDLER(_devcb) \ + devcb = &amiga_keyboard_bus_device::set_kclk_handler(*device, DEVCB_##_devcb); + +#define MCFG_AMIGA_KEYBOARD_KDAT_HANDLER(_devcb) \ + devcb = &amiga_keyboard_bus_device::set_kdat_handler(*device, DEVCB_##_devcb); + +#define MCFG_AMIGA_KEYBOARD_KRST_HANDLER(_devcb) \ + devcb = &amiga_keyboard_bus_device::set_krst_handler(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class device_amiga_keyboard_interface; + +// ======================> amiga_keyboard_bus_device + +class amiga_keyboard_bus_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + amiga_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual ~amiga_keyboard_bus_device(); + + // callbacks + template<class _Object> static devcb_base &set_kclk_handler(device_t &device, _Object object) + { return downcast<amiga_keyboard_bus_device &>(device).m_kclk_handler.set_callback(object); } + + template<class _Object> static devcb_base &set_kdat_handler(device_t &device, _Object object) + { return downcast<amiga_keyboard_bus_device &>(device).m_kdat_handler.set_callback(object); } + + template<class _Object> static devcb_base &set_krst_handler(device_t &device, _Object object) + { return downcast<amiga_keyboard_bus_device &>(device).m_krst_handler.set_callback(object); } + + // called from keyboard + DECLARE_WRITE_LINE_MEMBER(kclk_w) { m_kclk_handler(state); } + DECLARE_WRITE_LINE_MEMBER(kdat_w) { m_kdat_handler(state); } + DECLARE_WRITE_LINE_MEMBER(krst_w) { m_krst_handler(state); } + + // called from host + DECLARE_WRITE_LINE_MEMBER(kdat_in_w); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + device_amiga_keyboard_interface *m_kbd; + + devcb_write_line m_kclk_handler; + devcb_write_line m_kdat_handler; + devcb_write_line m_krst_handler; +}; + +// ======================> device_amiga_keyboard_interface + +class device_amiga_keyboard_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_amiga_keyboard_interface(const machine_config &mconfig, device_t &device); + virtual ~device_amiga_keyboard_interface(); + + virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) = 0; + +protected: + amiga_keyboard_bus_device *m_host; +}; + +// device type definition +extern const device_type AMIGA_KEYBOARD_INTERFACE; + +// supported devices +SLOT_INTERFACE_EXTERN( amiga_keyboard_devices ); + +#endif // DEVICES_BUS_AMIGA_KEYBOARD_H diff --git a/src/devices/bus/amiga/keyboard/matrix.cpp b/src/devices/bus/amiga/keyboard/matrix.cpp new file mode 100644 index 00000000000..6f9b1d4d629 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/matrix.cpp @@ -0,0 +1,318 @@ +// license:BSD-3-Clause +// copyright-holders: Vas Crabb +/*************************************************************************** + + Amiga Keyboard Matrix Ports + + ***************************************************************************/ + +#include "emu.h" +#include "matrix.h" + +namespace bus { namespace amiga { namespace keyboard { + +INPUT_PORTS_START(matrix_us) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß § + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // ° + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(0x00b2) // ² + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // © + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00b3) // ³ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // dead key (acute) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ® + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) // ¢ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // dead key (grave) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // dead key (circumflex) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(0x00bd) // ½ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // dead key (tilde) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(0x00be) // ¾ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW8") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // dead key (umlaut) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(0x00b7) // · + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW9") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(0x00ab) // « + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW10") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(0x00bb) // » + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW11") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW12") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW13") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW14") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("Help") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +INPUT_PORTS_START(matrix_de) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß § + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // ° + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR('@') PORT_CHAR(0x00b2) // ² + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // © + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a7) PORT_CHAR(0x00b3) PORT_CHAR('#') // § ³ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // dead key (acute) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ® + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00b0) PORT_CHAR(0x00a2) // ° ¢ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // dead key (grave) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // dead key (circumflex) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // dead key (tilde) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) PORT_CHAR('&') // ¾ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW8") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // dead key (umlaut) not supported by natural keyboard + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) PORT_CHAR('*') // · + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW9") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(0x00ab) // « + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW10") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) PORT_CHAR(';') PORT_CHAR(':') // ö Ö + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(0x00bb) // » + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW11") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) PORT_CHAR('\'') PORT_CHAR('"') // ä Ä + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) PORT_CHAR('[') PORT_CHAR('{') // ü Ü + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00df) PORT_CHAR('?') PORT_CHAR('-') PORT_CHAR('_') // ß + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW12") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) // ´ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW13") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW14") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("Help") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +} } } // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/matrix.h b/src/devices/bus/amiga/keyboard/matrix.h new file mode 100644 index 00000000000..82f635c25a3 --- /dev/null +++ b/src/devices/bus/amiga/keyboard/matrix.h @@ -0,0 +1,21 @@ +// license:BSD-3-Clause +// copyright-holders: Vas Crabb +/*************************************************************************** + + Amiga Keyboard Matrix Ports + + ***************************************************************************/ + +#ifndef DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H +#define DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H + +#pragma once + +namespace bus { namespace amiga { namespace keyboard { + +INPUT_PORTS_EXTERN(matrix_us); +INPUT_PORTS_EXTERN(matrix_de); + +} } } // namespace bus::amiga::keyboard + +#endif // DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 92c7eb64e5d..ab37fe19481 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -339,6 +339,7 @@ int c64_expansion_slot_device::exrom_r(offs_t offset, int sphi2, int ba, int rw, #include "sfx_sound_expander.h" #include "silverrock.h" #include "simons_basic.h" +#include "speakeasy.h" #include "stardos.h" #include "std.h" #include "structured_basic.h" @@ -375,6 +376,7 @@ SLOT_INTERFACE_START( c64_expansion_cards ) SLOT_INTERFACE("reu1750", C64_REU1750) SLOT_INTERFACE("reu1764", C64_REU1764) SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER) + SLOT_INTERFACE("speakez", C64_SPEAKEASY) SLOT_INTERFACE("supercpu", C64_SUPERCPU) SLOT_INTERFACE("swiftlink", C64_SWIFTLINK) SLOT_INTERFACE("turbo232", C64_TURBO232) diff --git a/src/devices/bus/c64/speakeasy.cpp b/src/devices/bus/c64/speakeasy.cpp new file mode 100644 index 00000000000..6c59b7a11a5 --- /dev/null +++ b/src/devices/bus/c64/speakeasy.cpp @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:smf +/********************************************************************** + + Personal Peripheral Products Speakeasy 64 cartridge emulation + +**********************************************************************/ + +#include "speakeasy.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define SC01A_TAG "sc01a" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type C64_SPEAKEASY = &device_creator<c64_speakeasy_t>; + + +//------------------------------------------------- +// MACHINE_DRIVER( speakeasy ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( speakeasy ) + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(SC01A_TAG, VOTRAX_SC01, 720000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor c64_speakeasy_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( speakeasy ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// c64_speakeasy_t - constructor +//------------------------------------------------- + +c64_speakeasy_t::c64_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, C64_SPEAKEASY, "Speakeasy 64", tag, owner, clock, "speakeasy64", __FILE__), + device_c64_expansion_card_interface(mconfig, *this), + m_votrax(*this, SC01A_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void c64_speakeasy_t::device_start() +{ +} + + +//------------------------------------------------- +// c64_cd_r - cartridge data read +//------------------------------------------------- + +uint8_t c64_speakeasy_t::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) +{ + if (!io1) + { + return m_votrax->request() << 7; + } + + return data; +} + + +//------------------------------------------------- +// c64_cd_w - cartridge data write +//------------------------------------------------- + +void c64_speakeasy_t::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) +{ + if (!io1) + { + m_votrax->write(space, 0, data & 0x3f); + m_votrax->inflection_w(space, 0, data >> 6); + } +} diff --git a/src/devices/bus/c64/speakeasy.h b/src/devices/bus/c64/speakeasy.h new file mode 100644 index 00000000000..136a565344f --- /dev/null +++ b/src/devices/bus/c64/speakeasy.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Personal Peripheral Products Speakeasy 64 cartridge emulation + +**********************************************************************/ + +#pragma once + +#ifndef __C64_SPEAKEASY__ +#define __C64_SPEAKEASY__ + +#include "emu.h" +#include "exp.h" +#include "sound/votrax.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> c64_speakeasy_t + +class c64_speakeasy_t : public device_t, + public device_c64_expansion_card_interface +{ +public: + // construction/destruction + c64_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + +protected: + // device-level overrides + virtual void device_start() override; + + // device_c64_expansion_card_interface overrides + virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; + virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; + +private: + required_device<votrax_sc01_device> m_votrax; +}; + + +// device type definition +extern const device_type C64_SPEAKEASY; + + + +#endif diff --git a/src/devices/bus/cbmiec/cbmiec.h b/src/devices/bus/cbmiec/cbmiec.h index 8ba9b8b2f02..d9ee6605a93 100644 --- a/src/devices/bus/cbmiec/cbmiec.h +++ b/src/devices/bus/cbmiec/cbmiec.h @@ -32,19 +32,19 @@ #define MCFG_CBM_IEC_BUS_SRQ_CALLBACK(_write) \ - downcast<cbm_iec_device *>(device)->set_srq_callback(DEVCB_##_write); + devcb = &downcast<cbm_iec_device *>(device)->set_srq_callback(DEVCB_##_write); #define MCFG_CBM_IEC_BUS_ATN_CALLBACK(_write) \ - downcast<cbm_iec_device *>(device)->set_atn_callback(DEVCB_##_write); + devcb = &downcast<cbm_iec_device *>(device)->set_atn_callback(DEVCB_##_write); #define MCFG_CBM_IEC_BUS_CLK_CALLBACK(_write) \ - downcast<cbm_iec_device *>(device)->set_clk_callback(DEVCB_##_write); + devcb = &downcast<cbm_iec_device *>(device)->set_clk_callback(DEVCB_##_write); #define MCFG_CBM_IEC_BUS_DATA_CALLBACK(_write) \ - downcast<cbm_iec_device *>(device)->set_data_callback(DEVCB_##_write); + devcb = &downcast<cbm_iec_device *>(device)->set_data_callback(DEVCB_##_write); #define MCFG_CBM_IEC_BUS_RESET_CALLBACK(_write) \ - downcast<cbm_iec_device *>(device)->set_reset_callback(DEVCB_##_write); + devcb = &downcast<cbm_iec_device *>(device)->set_reset_callback(DEVCB_##_write); #define MCFG_CBM_IEC_SLOT_ADD(_tag, _address, _slot_intf, _def_slot) \ @@ -78,11 +78,11 @@ public: // construction/destruction cbm_iec_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _write> void set_srq_callback(_write wr) { m_write_srq.set_callback(wr); } - template<class _write> void set_atn_callback(_write wr) { m_write_atn.set_callback(wr); } - template<class _write> void set_clk_callback(_write wr) { m_write_clk.set_callback(wr); } - template<class _write> void set_data_callback(_write wr) { m_write_data.set_callback(wr); } - template<class _write> void set_reset_callback(_write wr) { m_write_reset.set_callback(wr); } + template<class _write> devcb_base &set_srq_callback(_write wr) { return m_write_srq.set_callback(wr); } + template<class _write> devcb_base &set_atn_callback(_write wr) { return m_write_atn.set_callback(wr); } + template<class _write> devcb_base &set_clk_callback(_write wr) { return m_write_clk.set_callback(wr); } + template<class _write> devcb_base &set_data_callback(_write wr) { return m_write_data.set_callback(wr); } + template<class _write> devcb_base &set_reset_callback(_write wr) { return m_write_reset.set_callback(wr); } void add_device(cbm_iec_slot_device *slot, device_t *target); diff --git a/src/devices/bus/coco/coco_dwsock.cpp b/src/devices/bus/coco/coco_dwsock.cpp index afd8e4dad5f..1d5322e1801 100644 --- a/src/devices/bus/coco/coco_dwsock.cpp +++ b/src/devices/bus/coco/coco_dwsock.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "osdcore.h" -#include "includes/coco.h" #include "coco_dwsock.h" diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp index c80ebc61391..fbab4c4c58a 100644 --- a/src/devices/bus/coco/coco_fdc.cpp +++ b/src/devices/bus/coco/coco_fdc.cpp @@ -46,7 +46,6 @@ #include "cococart.h" #include "coco_fdc.h" #include "imagedev/flopdrv.h" -#include "includes/coco.h" #include "machine/msm6242.h" #include "machine/ds1315.h" #include "machine/wd_fdc.h" diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp index fcfd764a169..dcfe5f062aa 100644 --- a/src/devices/bus/coco/coco_multi.cpp +++ b/src/devices/bus/coco/coco_multi.cpp @@ -52,7 +52,6 @@ ***************************************************************************/ #include "emu.h" -#include "includes/coco.h" #include "coco_multi.h" #include "coco_232.h" #include "coco_orch90.h" @@ -161,7 +160,7 @@ void coco_multipak_device::device_start() // install $FF7F handler write8_delegate wh = write8_delegate(FUNC(coco_multipak_device::ff7f_write), this); - machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh); + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh); // initial state m_select = 0xFF; diff --git a/src/devices/bus/coco/coco_pak.cpp b/src/devices/bus/coco/coco_pak.cpp index 1cc9e4f5e05..e3ba87bbbdb 100644 --- a/src/devices/bus/coco/coco_pak.cpp +++ b/src/devices/bus/coco/coco_pak.cpp @@ -10,9 +10,9 @@ #include "emu.h" #include "coco_pak.h" -#include "includes/coco.h" #define CARTSLOT_TAG "cart" +#define CART_AUTOSTART_TAG "cart_autostart" /*************************************************************************** IMPLEMENTATION @@ -26,6 +26,19 @@ ROM_START( coco_pak ) // this region is filled by cococart_slot_device::call_load() ROM_END + +//------------------------------------------------- +// INPUT_PORTS( coco_cart_autostart ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco_cart_autostart ) + PORT_START(CART_AUTOSTART_TAG) + PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x01, DEF_STR( On )) +INPUT_PORTS_END + + //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -42,14 +55,14 @@ const device_type COCO_PAK = &device_creator<coco_pak_device>; coco_pak_device::coco_pak_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) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_cococart_interface( mconfig, *this ), m_cart(nullptr), m_owner(nullptr), - m_autostart(*this, ":" CART_AUTOSTART_TAG) + m_autostart(*this, CART_AUTOSTART_TAG) { } coco_pak_device::coco_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, COCO_PAK, "CoCo Program PAK", tag, owner, clock, "cocopak", __FILE__), device_cococart_interface( mconfig, *this ), m_cart(nullptr), m_owner(nullptr), - m_autostart(*this, ":" CART_AUTOSTART_TAG) + m_autostart(*this, CART_AUTOSTART_TAG) { } @@ -74,6 +87,15 @@ machine_config_constructor coco_pak_device::device_mconfig_additions() const } //------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor coco_pak_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( coco_cart_autostart ); +} + +//------------------------------------------------- // rom_region - device-specific ROM region //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_pak.h b/src/devices/bus/coco/coco_pak.h index f6a93ec459f..84f8e68f75f 100644 --- a/src/devices/bus/coco/coco_pak.h +++ b/src/devices/bus/coco/coco_pak.h @@ -26,6 +26,7 @@ public: // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; virtual uint8_t* get_cart_base() override; protected: diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp index b969ac9bcbb..1d5c3b3fa2f 100644 --- a/src/devices/bus/coco/coco_t4426.cpp +++ b/src/devices/bus/coco/coco_t4426.cpp @@ -41,12 +41,11 @@ #include "emu.h" #include "coco_t4426.h" -#include "includes/coco.h" #define LOG_GENERAL 0x01 #define LOG_SETUP 0x02 #define LOG_PRINTF 0x04 -#define LOG_PIA 0x08 +#define LOG_PIA 0x08 #define VERBOSE 0 //(LOG_PIA | LOG_PRINTF | LOG_SETUP | LOG_GENERAL) @@ -74,6 +73,7 @@ #define UART_TAG "acia" #define PIA_TAG "pia" #define CARTSLOT_TAG "t4426" +#define CART_AUTOSTART_TAG "cart_autostart" /*************************************************************************** IMPLEMENTATION @@ -109,6 +109,17 @@ ROM_START( coco_t4426 ) ROM_RELOAD(0x18000,0x1000) ROM_END +//------------------------------------------------- +// INPUT_PORTS( coco_cart_autostart ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco_cart_autostart ) + PORT_START(CART_AUTOSTART_TAG) + PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x01, DEF_STR( On )) +INPUT_PORTS_END + //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -129,7 +140,7 @@ coco_t4426_device::coco_t4426_device(const machine_config &mconfig, device_type ,m_cart(nullptr) ,m_owner(nullptr) ,m_select(0) - ,m_autostart(*this, ":" CART_AUTOSTART_TAG) + ,m_autostart(*this, CART_AUTOSTART_TAG) ,m_uart(*this, UART_TAG) ,m_pia(*this, PIA_TAG) { @@ -141,7 +152,7 @@ coco_t4426_device::coco_t4426_device(const machine_config &mconfig, const char * ,m_cart(nullptr) ,m_owner(nullptr) ,m_select(0) - ,m_autostart(*this, ":" CART_AUTOSTART_TAG) + ,m_autostart(*this, CART_AUTOSTART_TAG) ,m_uart(*this, UART_TAG) ,m_pia(*this, PIA_TAG) { @@ -179,6 +190,16 @@ const tiny_rom_entry *coco_t4426_device::device_rom_region() const return ROM_NAME( coco_t4426 ); } +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor coco_t4426_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( coco_cart_autostart ); +} + + /*------------------------------------------------- device_reset - device-specific startup -------------------------------------------------*/ @@ -225,8 +246,8 @@ WRITE8_MEMBER(coco_t4426_device::write) /*---------------------------------------------------- pia_A_w - PIA port A write - The T4426 cartridge PIA Port A is connected to - the CE* input of each 2764 ROM and used for banking + The T4426 cartridge PIA Port A is connected to + the CE* input of each 2764 ROM and used for banking in the correct BASIC module at C000-DFFF The main cartridge ROM at E000-FF00 is fixed however -----------------------------------------------------*/ diff --git a/src/devices/bus/coco/coco_t4426.h b/src/devices/bus/coco/coco_t4426.h index a0ec0532142..9fd446c21fb 100644 --- a/src/devices/bus/coco/coco_t4426.h +++ b/src/devices/bus/coco/coco_t4426.h @@ -28,6 +28,7 @@ public: // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; virtual uint8_t* get_cart_base() override; DECLARE_WRITE8_MEMBER( pia_A_w ); diff --git a/src/devices/bus/coco/dragon_fdc.cpp b/src/devices/bus/coco/dragon_fdc.cpp index e32bab843e9..f633d465f8c 100644 --- a/src/devices/bus/coco/dragon_fdc.cpp +++ b/src/devices/bus/coco/dragon_fdc.cpp @@ -69,7 +69,6 @@ #include "cococart.h" #include "coco_fdc.h" #include "imagedev/flopdrv.h" -#include "includes/coco.h" #include "machine/wd_fdc.h" #include "formats/dmk_dsk.h" #include "formats/jvc_dsk.h" diff --git a/src/devices/bus/cpc/amdrum.cpp b/src/devices/bus/cpc/amdrum.cpp index 3ed2f019655..18eea564be0 100644 --- a/src/devices/bus/cpc/amdrum.cpp +++ b/src/devices/bus/cpc/amdrum.cpp @@ -7,7 +7,6 @@ */ #include "emu.h" -#include "includes/amstrad.h" #include "amdrum.h" #include "sound/volt_reg.h" diff --git a/src/devices/bus/cpc/cpc_pds.cpp b/src/devices/bus/cpc/cpc_pds.cpp index 311bca693cb..0708cb67f9a 100644 --- a/src/devices/bus/cpc/cpc_pds.cpp +++ b/src/devices/bus/cpc/cpc_pds.cpp @@ -8,7 +8,6 @@ #include "emu.h" #include "cpc_pds.h" -#include "includes/amstrad.h" //************************************************************************** diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp index 766c6b8277e..aae1044dc26 100644 --- a/src/devices/bus/cpc/cpc_rom.cpp +++ b/src/devices/bus/cpc/cpc_rom.cpp @@ -8,10 +8,10 @@ #include "emu.h" #include "cpc_rom.h" -#include "includes/amstrad.h" const device_type CPC_ROM = &device_creator<cpc_rom_device>; +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE CONFIG INTERFACE diff --git a/src/devices/bus/cpc/cpc_rs232.cpp b/src/devices/bus/cpc/cpc_rs232.cpp index 00090ace9aa..b00503584f0 100644 --- a/src/devices/bus/cpc/cpc_rs232.cpp +++ b/src/devices/bus/cpc/cpc_rs232.cpp @@ -7,7 +7,8 @@ */ #include "cpc_rs232.h" -#include "includes/amstrad.h" + +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/cpc_ssa1.cpp b/src/devices/bus/cpc/cpc_ssa1.cpp index 9779f4b96da..ef21af1e384 100644 --- a/src/devices/bus/cpc/cpc_ssa1.cpp +++ b/src/devices/bus/cpc/cpc_ssa1.cpp @@ -10,7 +10,7 @@ #include "emu.h" #include "cpc_ssa1.h" -#include "includes/amstrad.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/ddi1.cpp b/src/devices/bus/cpc/ddi1.cpp index ef21cb9f319..be82f2f05b8 100644 --- a/src/devices/bus/cpc/ddi1.cpp +++ b/src/devices/bus/cpc/ddi1.cpp @@ -6,8 +6,8 @@ #include "emu.h" #include "ddi1.h" -#include "includes/amstrad.h" #include "softlist.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/doubler.cpp b/src/devices/bus/cpc/doubler.cpp index 79d47383b6c..5e5f6587404 100644 --- a/src/devices/bus/cpc/doubler.cpp +++ b/src/devices/bus/cpc/doubler.cpp @@ -7,7 +7,7 @@ */ #include "doubler.h" -#include "includes/amstrad.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/hd20.cpp b/src/devices/bus/cpc/hd20.cpp index 163687d41c7..370b3076b8c 100644 --- a/src/devices/bus/cpc/hd20.cpp +++ b/src/devices/bus/cpc/hd20.cpp @@ -8,8 +8,7 @@ #include "emu.h" #include "hd20.h" -#include "includes/amstrad.h" - +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/magicsound.cpp b/src/devices/bus/cpc/magicsound.cpp index b80b9218884..d2bf11d2009 100644 --- a/src/devices/bus/cpc/magicsound.cpp +++ b/src/devices/bus/cpc/magicsound.cpp @@ -8,10 +8,9 @@ */ #include "emu.h" -#include "includes/amstrad.h" #include "magicsound.h" #include "sound/volt_reg.h" - +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/mface2.cpp b/src/devices/bus/cpc/mface2.cpp index 7832de1ba7c..90d08716e25 100644 --- a/src/devices/bus/cpc/mface2.cpp +++ b/src/devices/bus/cpc/mface2.cpp @@ -8,7 +8,7 @@ #include "emu.h" #include "mface2.h" -#include "includes/amstrad.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/playcity.cpp b/src/devices/bus/cpc/playcity.cpp index eece3a9c2d7..41896009037 100644 --- a/src/devices/bus/cpc/playcity.cpp +++ b/src/devices/bus/cpc/playcity.cpp @@ -11,7 +11,7 @@ */ #include "playcity.h" -#include "includes/amstrad.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/smartwatch.cpp b/src/devices/bus/cpc/smartwatch.cpp index f7ae8148037..b6a453d79cd 100644 --- a/src/devices/bus/cpc/smartwatch.cpp +++ b/src/devices/bus/cpc/smartwatch.cpp @@ -11,8 +11,7 @@ #include "emu.h" #include "smartwatch.h" -#include "includes/amstrad.h" - +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/cpc/transtape.cpp b/src/devices/bus/cpc/transtape.cpp index 1b3056d12c9..df05e1e491a 100644 --- a/src/devices/bus/cpc/transtape.cpp +++ b/src/devices/bus/cpc/transtape.cpp @@ -9,7 +9,7 @@ */ #include "transtape.h" -#include "includes/amstrad.h" +SLOT_INTERFACE_EXTERN(cpc_exp_cards); //************************************************************************** // DEVICE DEFINITIONS diff --git a/src/devices/bus/ep64/exp.h b/src/devices/bus/ep64/exp.h index 153afb0abc6..cbba96f1efa 100644 --- a/src/devices/bus/ep64/exp.h +++ b/src/devices/bus/ep64/exp.h @@ -48,7 +48,7 @@ #define __EP64_EXPANSION_BUS__ #include "emu.h" -#include "audio/dave.h" +#include "sound/dave.h" diff --git a/src/devices/bus/epson_sio/epson_sio.h b/src/devices/bus/epson_sio/epson_sio.h index c52ebcc11d9..616a407ae5c 100644 --- a/src/devices/bus/epson_sio/epson_sio.h +++ b/src/devices/bus/epson_sio/epson_sio.h @@ -23,10 +23,10 @@ MCFG_DEVICE_SLOT_INTERFACE(epson_sio_devices, _def_slot, false) #define MCFG_EPSON_SIO_RX(_rx) \ - downcast<epson_sio_device *>(device)->set_rx_callback(DEVCB_##_rx); + devcb = &downcast<epson_sio_device *>(device)->set_rx_callback(DEVCB_##_rx); #define MCFG_EPSON_SIO_PIN(_pin) \ - downcast<epson_sio_device *>(device)->set_pin_callback(DEVCB_##_pin); + devcb = &downcast<epson_sio_device *>(device)->set_pin_callback(DEVCB_##_pin); //************************************************************************** @@ -45,8 +45,8 @@ public: virtual ~epson_sio_device(); // callbacks - template<class _rx> void set_rx_callback(_rx rx) { m_write_rx.set_callback(rx); } - template<class _pin> void set_pin_callback(_pin pin) { m_write_pin.set_callback(pin); } + template<class _rx> devcb_base &set_rx_callback(_rx rx) { return m_write_rx.set_callback(rx); } + template<class _pin> devcb_base &set_pin_callback(_pin pin) { return m_write_pin.set_callback(pin); } // called from owner DECLARE_WRITE_LINE_MEMBER( tx_w ); diff --git a/src/devices/bus/ieee488/hp9895.cpp b/src/devices/bus/ieee488/hp9895.cpp index e5b1f6de2ec..6abe8bc773d 100644 --- a/src/devices/bus/ieee488/hp9895.cpp +++ b/src/devices/bus/ieee488/hp9895.cpp @@ -6,9 +6,52 @@ HP9895 floppy disk drive + Phew, this one was tough! + + This is a dual 8" floppy disk drive that interfaces through + HPIB/IEEE-488 bus. It implements the so-called "Amigo" command + set. + + Its main components are: + * A Z80A CPU @ 4 MHz with 8 kB of firmware ROM and 1 kB of + static RAM + * A HP PHI chip that interfaces CPU to HPIB bus + * A disk controller implemented with a lot of discrete TTLs + * 2 MPI 8" disk drives + + Data I/O with the disk is carried out through 2 shift registers, + one for data bits (@ 0x60 address) and one for clock bits (@ 0x61 + address). CPU is stalled by setting WAIT/ to 0 whenever it accesses + the data register and the hw is not ready for the byte. Once + the next byte boundary is reached (the SDOK signal activates) the + CPU is released and either the data byte is read from shift register + or written into it. At the same time clock shift register is + copied into clock register when reading or viceversa when writing. + + The 9895 drive can operate in 2 modes: HP/High density or IBM/low + density. This table summarizes the differences between the modes. + See also page 2-12 of service manual. + + | Characteristic | HP mode | IBM mode | + |----------------+----------+-----------| + | Bit cell size | 2 µs | 4 µs | + | Modulation | MMFM | FM | + | Bit order | LS first | MS first | + | Sync bytes | 4x FF | 6x 00 | + | Formatted size | 1155 kB | 250.25 kB | + Reference manual: HP 09895-90030, feb 81, 9895A Flexible Disc Memory Service Manual + Reference manual for the floppy drives: + Magnetic Peripherals, inc., feb 83, 9406-4 Flexible Disk Drive + Hardware Maintenance Manual + + TODO/Issues: + * floppy_image_device sometimes reports the wrong state for wpt + signal + * IBM mode hasn't been tested yet + *********************************************************************/ #include "hp9895.h" @@ -16,31 +59,334 @@ // Debugging #define VERBOSE 1 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define VERBOSE_0 0 +#define LOG_0(x) do { if (VERBOSE_0) logerror x; } while (0) + +// Macros to clear/set single bits +#define BIT_MASK(n) (1U << (n)) +#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) +#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) + +// Bits in RESET register +#define REG_RESET_TIMEOUT_START_BIT 0 // Start TIMEOUT oneshot (1) +#define REG_RESET_OVERUN_CLEAR_BIT 1 // Clear OVERUN (sic) (1) +#define REG_RESET_PROGRES_BIT 3 // PROGRES (1) + +// Bits in CNTL register +#define REG_CNTL_READON_BIT 1 // Enable reading (1) +#define REG_CNTL_WRITON_BIT 2 // Enable writing (1) +#define REG_CNTL_WRITDRV_BIT 3 // Enable writing to floppy (1) +#define REG_CNTL_CRCOUT_BIT 4 // Enable output of CRC word (1) +#define REG_CNTL_CRCON_BIT 5 // Enable updating of CRC word (1) or preset CRC to 0xffff (0) + +// Bits in DRV register +#define REG_DRV_STEP_BIT 0 // Step pulse to drive (1) +#define REG_DRV_MOVEIN_BIT 1 // Move heads inward (1) +#define REG_DRV_MGNENA_BIT 2 // Enable checking of bit cell margins (1) +#define REG_DRV_IN_USE_BIT 3 // "In use" signal to drive (1) +#define REG_DRV_LOWCURR_BIT 4 // Reduce write current in inner tracks (1) +#define REG_DRV_HEADSEL_BIT 7 // Head selection (1 = Head 1) + +// Bits in XV register +#define REG_XV_DRIVE3_BIT 0 // Select drive #3 (1) +#define REG_XV_DRIVE2_BIT 1 // Select drive #2 (1) +#define REG_XV_DRIVE1_BIT 2 // Select drive #1 (1) +#define REG_XV_DRIVE0_BIT 3 // Select drive #0 (1) +#define REG_XV_HIDEN_BIT 4 // Select HP/High density mode (1) or IBM/Low density mode (0) +#define REG_XV_PRECMP_BIT 5 // Enable pre-compensation + +// Bits in DRIVSTAT register +#define REG_DRIVSTAT_INDEX_BIT 0 // Index pulse from drive (1) +#define REG_DRIVSTAT_DISCHNG_BIT 1 // Disk changed (1) +#define REG_DRIVSTAT_TRACK0_BIT 2 // Heads on track #0 (1) +#define REG_DRIVSTAT_WRPROT_BIT 3 // Disk is write-protected (1) +#define REG_DRIVSTAT_READY_BIT 4 // Disk is ready (1) +#define REG_DRIVSTAT_CRCERR_BIT 5 // Error in CRC (1) +#define REG_DRIVSTAT_OVERUN_BIT 6 // I/O overrun between disk and CPU (1) +#define REG_DRIVSTAT_TWOSIDE_BIT 7 // 2-sided disk (1) + +// Bits in SWITCHES(2) registers +#define REG_SWITCHES_HPIB_ADDR_SHIFT 0 // LSB of HPIB address +#define REG_SWITCHES_HPIB_ADDR_MASK 7 // Mask of HPIB address +#define REG_SWITCHES_W_TEST_BIT 3 // "W" test push-button (1) +#define REG_SWITCHES_S_TEST_BIT 4 // "S" test push-button (1) +#define REG_SWITCHES_LOOP_BIT 5 // Test loop option (1) +#define REG_SWITCHES_TIMEOUT_BIT 6 // TIMEOUT (1) +#define REG_SWITCHES_AMDT_BIT 7 // Address mark detected (1) + +// Timers +enum { + TIMEOUT_TMR_ID, + BYTE_TMR_ID, + HALF_BIT_TMR_ID +}; + +// Timings +#define TIMEOUT_MSEC 450 // Timeout duration (ms) +#define HPMODE_BIT_FREQ 500000 // HP-mode bit frequency (Hz) +#define IBMMODE_BIT_FREQ 250000 // IBM-mode bit frequency (Hz) + +#define MIN_SYNC_BITS 29 // Number of bits to synchronize // device type definition const device_type HP9895 = &device_creator<hp9895_device>; +// Masks of drive selectors in XV register +static const uint8_t xv_drive_masks[] = { + BIT_MASK(REG_XV_DRIVE0_BIT), + BIT_MASK(REG_XV_DRIVE1_BIT) +}; + hp9895_device::hp9895_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HP9895, "HP9895", tag, owner, clock, "HP9895", __FILE__), device_ieee488_interface(mconfig, *this), m_cpu(*this , "cpu"), - m_phi(*this , "phi") + m_phi(*this , "phi"), + m_drives{{*this , "floppy0"} , {*this , "floppy1"}}, + m_switches{*this , "switches"} { } -#if 0 +static INPUT_PORTS_START(hp9895_port) + PORT_START("switches") + PORT_CONFNAME(REG_SWITCHES_HPIB_ADDR_MASK << REG_SWITCHES_HPIB_ADDR_SHIFT , 0x00 , "HPIB address") + PORT_CONFSETTING(0 << REG_SWITCHES_HPIB_ADDR_SHIFT , "0") + PORT_CONFSETTING(1 << REG_SWITCHES_HPIB_ADDR_SHIFT , "1") + PORT_CONFSETTING(2 << REG_SWITCHES_HPIB_ADDR_SHIFT , "2") + PORT_CONFSETTING(3 << REG_SWITCHES_HPIB_ADDR_SHIFT , "3") + PORT_CONFSETTING(4 << REG_SWITCHES_HPIB_ADDR_SHIFT , "4") + PORT_CONFSETTING(5 << REG_SWITCHES_HPIB_ADDR_SHIFT , "5") + PORT_CONFSETTING(6 << REG_SWITCHES_HPIB_ADDR_SHIFT , "6") + PORT_CONFSETTING(7 << REG_SWITCHES_HPIB_ADDR_SHIFT , "7") + PORT_CONFNAME(BIT_MASK(REG_SWITCHES_W_TEST_BIT) , 0x00 , "W Test") + PORT_CONFSETTING(0x00 , DEF_STR(Off)) + PORT_CONFSETTING(BIT_MASK(REG_SWITCHES_W_TEST_BIT) , DEF_STR(On)) + PORT_CONFNAME(BIT_MASK(REG_SWITCHES_S_TEST_BIT) , 0x00 , "S Test") + PORT_CONFSETTING(0x00 , DEF_STR(Off)) + PORT_CONFSETTING(BIT_MASK(REG_SWITCHES_S_TEST_BIT) , DEF_STR(On)) + PORT_CONFNAME(BIT_MASK(REG_SWITCHES_LOOP_BIT) , 0x00 , "Loop") + PORT_CONFSETTING(0x00 , DEF_STR(Off)) + PORT_CONFSETTING(BIT_MASK(REG_SWITCHES_LOOP_BIT) , DEF_STR(On)) +INPUT_PORTS_END + ioport_constructor hp9895_device::device_input_ports() const { - // TODO: inputs=HPIB address, "S" & "W" switches, "loop" pin + return INPUT_PORTS_NAME(hp9895_port); } -#endif + void hp9895_device::device_start() { + save_item(NAME(m_cpu_irq)); + save_item(NAME(m_current_drive_idx)); + save_item(NAME(m_dskchg)); + save_item(NAME(m_crc)); + save_item(NAME(m_crcerr_syn)); + save_item(NAME(m_overrun)); + save_item(NAME(m_accdata)); + save_item(NAME(m_timeout)); + save_item(NAME(m_cntl_reg)); + save_item(NAME(m_clock_sr)); + save_item(NAME(m_clock_reg)); + save_item(NAME(m_data_sr)); + save_item(NAME(m_wr_context)); + save_item(NAME(m_had_transition)); + save_item(NAME(m_lckup)); + save_item(NAME(m_amdt)); + save_item(NAME(m_sync_cnt)); + save_item(NAME(m_hiden)); + save_item(NAME(m_mgnena)); + + m_timeout_timer = timer_alloc(TIMEOUT_TMR_ID); + m_byte_timer = timer_alloc(BYTE_TMR_ID); + m_half_bit_timer = timer_alloc(HALF_BIT_TMR_ID); + + for (auto& d : m_drives) { + d->get_device()->setup_ready_cb(floppy_image_device::ready_cb(&hp9895_device::floppy_ready_cb , this)); + } } void hp9895_device::device_reset() { m_cpu_irq = false; + m_current_drive = nullptr; + m_current_drive_idx = ~0; + for (auto& d : m_dskchg) { + d = true; + } + preset_crc(); + m_crcerr_syn = false; + m_overrun = false; + m_accdata = false; + m_timeout = true; + m_cntl_reg = 0; + m_clock_sr = 0; + m_clock_reg = 0; + m_data_sr = 0; + m_wr_context = 0; + m_had_transition = false; + m_lckup = true; // Because READON = 0 + m_amdt = false; + m_sync_cnt = 0; + m_hiden = false; + m_mgnena = false; + m_timeout_timer->reset(); + m_byte_timer->reset(); + m_half_bit_timer->reset(); +} + +void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) { + case TIMEOUT_TMR_ID: + LOG(("Timeout!\n")); + m_timeout = true; + if (m_mgnena) { + // CPU is resumed by timeout if MGNENA=1 + m_cpu->trigger(1); + } + break; + + case BYTE_TMR_ID: + { + if (m_accdata) { + // Resume CPU when it's waiting for SDOK + m_cpu->trigger(1); + } else { + // No access to data register by CPU + LOG(("Data overrun!\n")); + m_overrun = true; + } + m_accdata = false; + + m_crcerr_syn = m_crc != 0; + + if (!BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) { + // CRC not enabled, keep it in preset state (all ones) + preset_crc(); + } + + attotime sdok_time{machine().time()}; + LOG_0(("SDOK @ %.06f\n" , sdok_time.as_double())); + bool do_crc_upd = true; + if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) { + // Writing + m_pll.commit(get_write_device() , sdok_time); + m_pll.ctime = sdok_time; + + // Check for AMDT when in loopback mode + if (!m_lckup && !m_amdt && BIT(m_cntl_reg , REG_CNTL_READON_BIT)) { + if (m_hiden) { + m_amdt = m_data_sr != 0xff; + } else { + m_amdt = m_data_sr != 0; + } + } + + LOG_0(("WR D=%02x/C=%02x\n" , m_data_sr , m_clock_sr)); + do_crc_upd = false; + for (unsigned i = 0; i < 8; i++) { + bool clock_bit; + bool data_bit; + + clock_bit = shift_sr(m_clock_sr, false); + data_bit = shift_sr(m_data_sr, true); + + if (BIT(m_cntl_reg , REG_CNTL_CRCOUT_BIT)) { + // Substitute data bits from DSR with those from CRC when CRCOUT=1 + data_bit = BIT(m_crc , 15); + m_crc <<= 1; + } else if (BIT(m_cntl_reg , REG_CNTL_CRCON_BIT)) { + // Update CRC + update_crc(data_bit); + } + write_bit(data_bit, clock_bit); + } + // When shifting is done DSR is filled with 1s and CSR with 0s + } + if (BIT(m_cntl_reg , REG_CNTL_READON_BIT)) { + // Reading + m_pll.ctime = sdok_time; + + for (unsigned i = 0; i < 8; i++) { + read_bit(do_crc_upd); + } + LOG_0(("RD D=%02x/C=%02x\n" , m_data_sr , m_clock_sr)); + } + LOG_0(("next SDOK @ %.06f\n" , m_pll.ctime.as_double())); + timer.adjust(m_pll.ctime - sdok_time); + } + break; + + case HALF_BIT_TMR_ID: + { + m_pll.ctime = machine().time(); + if (m_lckup) { + // Trying to lock on synchronization bytes + attotime edge; + attotime tm; + get_next_transition(m_pll.ctime, edge); + bool half_bit0 = m_pll.feed_read_data(tm , edge , attotime::never); + get_next_transition(m_pll.ctime, edge); + bool half_bit1 = m_pll.feed_read_data(tm , edge , attotime::never); + if (half_bit0 == half_bit1) { + // If half bits are equal, no synch + LOG_0(("Reset sync_cnt\n")); + m_sync_cnt = 0; + } else if (++m_sync_cnt >= MIN_SYNC_BITS) { + // Synchronized, now wait for AM + LOG_0(("Synchronized @ %.6f\n" , machine().time().as_double())); + m_lckup = false; + if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) { + // When loopback is active, leave AM detection to byte timer as + // byte boundary is already synchronized + timer.reset(); + return; + } else { + // Align with bit cell + // Synchronization bits in HP mode: 32x 1s -> C/D bits = 01010101... + // Synchronization bits in IBM mode: 32x 0s -> C/D bits = 10101010... + if (m_hiden != half_bit1) { + // Discard 1/2 bit cell if synchronization achieved in the clock part + get_next_transition(m_pll.ctime, edge); + m_pll.feed_read_data(tm , edge , attotime::never); + } + // Load CSR & DSR as they are after synchronization bits + if (m_hiden) { + m_clock_sr = 0; + m_data_sr = ~0; + } else { + m_clock_sr = ~0; + m_data_sr = 0; + } + } + } + } else { + // Looking for AM + /// CRC is not updated because it can't be possibly enabled at this point + read_bit(false); + if ((m_hiden && !BIT(m_data_sr , 7)) || + (!m_hiden && BIT(m_data_sr , 0))) { + // Got AM as soon as bits being shifted into DSR change value wrt synchronization bits + m_amdt = true; + // Finish the current byte + for (unsigned i = 0; i < 7; i++) { + read_bit(false); + } + attotime adjust{m_pll.ctime - machine().time()}; + LOG_0(("Got AM @ %.6f, ctime=%.6f, adj=%.6f, D=%02x/C=%02x\n" , machine().time().as_double() , m_pll.ctime.as_double() , adjust.as_double() , m_data_sr , m_clock_sr)); + // Disable half-bit timer & enable byte timer + timer.reset(); + m_byte_timer->adjust(adjust); + return; + } + } + timer.adjust(m_pll.ctime - machine().time()); + } + break; + + default: + break; + } } void hp9895_device::ieee488_eoi(int state) @@ -160,6 +506,336 @@ WRITE16_MEMBER(hp9895_device::z80_m1_w) } } +WRITE8_MEMBER(hp9895_device::data_w) +{ + LOG_0(("W DATA=%02x\n" , data)); + // CPU stalls until next SDOK + m_cpu->suspend_until_trigger(1 , true); + m_data_sr = data; + m_clock_sr = m_clock_reg; + m_accdata = true; +} + +WRITE8_MEMBER(hp9895_device::clock_w) +{ + LOG_0(("W CLOCK=%02x\n" , data)); + m_clock_reg = data; +} + +WRITE8_MEMBER(hp9895_device::reset_w) +{ + LOG_0(("W RESET=%02x\n" , data)); + if (BIT(data , REG_RESET_TIMEOUT_START_BIT)) { + m_timeout = false; + m_timeout_timer->adjust(attotime::from_msec(TIMEOUT_MSEC)); + } + if (BIT(data , REG_RESET_OVERUN_CLEAR_BIT)) { + m_overrun = false; + } + // TODO: PROGRES +} + +WRITE8_MEMBER(hp9895_device::leds_w) +{ + LOG(("W LEDS=%02x %c%c%c%c%c\n" , data , BIT(data , 4) ? '.' : '*' , BIT(data , 3) ? '.' : '*' , BIT(data , 2) ? '.' : '*' , BIT(data , 1) ? '.' : '*' , BIT(data , 0) ? '.' : '*')); + // TODO: +} + +WRITE8_MEMBER(hp9895_device::cntl_w) +{ + if (data != m_cntl_reg) { + LOG_0(("W CNTL=%02x -> %02x\n" , m_cntl_reg , data)); + uint8_t old_cntl_reg = m_cntl_reg; + m_cntl_reg = data; + + bool old_writon = BIT(old_cntl_reg , REG_CNTL_WRITON_BIT); + bool new_writon = BIT(m_cntl_reg , REG_CNTL_WRITON_BIT); + bool old_readon = BIT(old_cntl_reg , REG_CNTL_READON_BIT); + bool new_readon = BIT(m_cntl_reg , REG_CNTL_READON_BIT); + + bool byte_timer_running = old_writon || m_amdt; + bool byte_timer_needed = new_writon || (new_readon && m_amdt); + + if (!byte_timer_running && byte_timer_needed) { + LOG_0(("Enable byte tmr\n")); + attotime byte_period = get_half_bit_cell_period() * 16; + m_byte_timer->adjust(byte_period); + } else if (byte_timer_running && !byte_timer_needed) { + LOG_0(("Disable byte tmr\n")); + m_byte_timer->reset(); + } + + if (!old_writon && !old_readon && (new_writon || new_readon)) { + m_pll.set_clock(get_half_bit_cell_period()); + } + + if (!old_writon && new_writon) { + // Writing enabled + LOG_0(("Start writing..\n")); + m_pll.start_writing(machine().time()); + m_wr_context = 0; + m_had_transition = false; + } else if (old_writon && !new_writon) { + // Writing disabled + LOG_0(("Stop writing..\n")); + m_pll.stop_writing(get_write_device() , machine().time()); + } + if (!old_readon && new_readon) { + // Reading enabled + LOG_0(("Start reading..\n")); + m_pll.read_reset(machine().time()); + m_sync_cnt = 0; + m_half_bit_timer->adjust(get_half_bit_cell_period()); + } else if (old_readon && !new_readon) { + // Reading disabled + LOG_0(("Stop reading..\n")); + m_half_bit_timer->reset(); + m_lckup = true; + m_amdt = false; + } + if (!new_readon && !new_writon) { + m_crcerr_syn = false; + BIT_CLR(m_cntl_reg, REG_CNTL_CRCON_BIT); + BIT_CLR(m_cntl_reg, REG_CNTL_CRCOUT_BIT); + preset_crc(); + } + } +} + +WRITE8_MEMBER(hp9895_device::drv_w) +{ + LOG_0(("W DRV=%02x\n" , data)); + m_mgnena = BIT(data , REG_DRV_MGNENA_BIT); + if (m_current_drive != nullptr) { + m_current_drive->stp_w(!BIT(data , REG_DRV_STEP_BIT)); + m_current_drive->dir_w(!BIT(data , REG_DRV_MOVEIN_BIT)); + // TODO: in use signal + m_current_drive->ss_w(BIT(data , REG_DRV_HEADSEL_BIT)); + } +} + +WRITE8_MEMBER(hp9895_device::xv_w) +{ + LOG_0(("W XV=%02x\n" , data)); + // Disk Changed flag is cleared when drive is ready and it is deselected + if (m_current_drive_idx < 2 && (data & xv_drive_masks[ m_current_drive_idx ]) == 0 && !m_current_drive->ready_r()) { + if (m_dskchg[ m_current_drive_idx ]) { + LOG(("Dskchg %u cleared\n" , m_current_drive_idx)); + } + m_dskchg[ m_current_drive_idx ] = false; + } + + m_current_drive = nullptr; + m_current_drive_idx = ~0; + for (unsigned i = 0; i < 2; i++) { + if (data & xv_drive_masks[ i ]) { + m_current_drive = m_drives[ i ]->get_device(); + m_current_drive_idx = i; + break; + } + } + + m_hiden = BIT(data , REG_XV_HIDEN_BIT); +} + +READ8_MEMBER(hp9895_device::data_r) +{ + m_clock_reg = m_clock_sr; + m_accdata = true; + LOG_0(("R DATA=%02x\n" , m_data_sr)); + // CPU stalls until next SDOK + m_cpu->suspend_until_trigger(1 , true); + return m_data_sr; +} + +READ8_MEMBER(hp9895_device::clock_r) +{ + return m_clock_reg; +} + +READ8_MEMBER(hp9895_device::drivstat_r) +{ + uint8_t res = 0; + + if (m_current_drive != nullptr) { + if (m_current_drive->idx_r()) { + BIT_SET(res , REG_DRIVSTAT_INDEX_BIT); + } + if (m_dskchg[ m_current_drive_idx ]) { + BIT_SET(res , REG_DRIVSTAT_DISCHNG_BIT); + } + if (!m_current_drive->trk00_r()) { + BIT_SET(res , REG_DRIVSTAT_TRACK0_BIT); + } + if (m_current_drive->wpt_r()) { + BIT_SET(res , REG_DRIVSTAT_WRPROT_BIT); + } + if (!m_current_drive->ready_r()) { + BIT_SET(res , REG_DRIVSTAT_READY_BIT); + } + if (!m_current_drive->twosid_r()) { + BIT_SET(res , REG_DRIVSTAT_TWOSIDE_BIT); + } + } + if (m_crcerr_syn) { + BIT_SET(res , REG_DRIVSTAT_CRCERR_BIT); + } + if (m_overrun) { + BIT_SET(res , REG_DRIVSTAT_OVERUN_BIT); + } + LOG_0(("R DRIVSTAT=%02x\n" , res)); + return res; +} + +READ8_MEMBER(hp9895_device::switches_r) +{ + uint8_t res = get_switches2(); + res |= m_switches->read(); + return res; +} + +READ8_MEMBER(hp9895_device::switches2_r) +{ + return get_switches2(); +} + +void hp9895_device::floppy_ready_cb(floppy_image_device *floppy , int state) +{ + if (state) { + // Set Disk Changed flag when a drive is not ready + for (unsigned i = 0; i < 2; i++) { + if (floppy == m_drives[ i ]->get_device()) { + LOG(("Dskchg %u set\n" , i)); + m_dskchg[ i ] = true; + break; + } + } + } +} + +uint8_t hp9895_device::get_switches2(void) const +{ + uint8_t res = 0; + + if (m_timeout) { + BIT_SET(res, REG_SWITCHES_TIMEOUT_BIT); + } + if (m_amdt) { + BIT_SET(res, REG_SWITCHES_AMDT_BIT); + } + + return res; +} + +attotime hp9895_device::get_half_bit_cell_period(void) const +{ + return attotime::from_hz((m_hiden ? HPMODE_BIT_FREQ : IBMMODE_BIT_FREQ) * 2); +} + +floppy_image_device *hp9895_device::get_write_device(void) const +{ + if (!BIT(m_cntl_reg , REG_CNTL_WRITDRV_BIT)) { + return nullptr; + } else { + return m_current_drive; + } +} + +void hp9895_device::preset_crc(void) +{ + m_crc = ~0; +} + +void hp9895_device::update_crc(bool bit) +{ + bool msb = BIT(m_crc , 15); + + m_crc <<= 1; + if (bit ^ msb) { + m_crc ^= 0x1021; + } +} + +bool hp9895_device::shift_sr(uint8_t& sr , bool input_bit) +{ + bool res; + + if (m_hiden) { + res = BIT(sr , 0); + sr >>= 1; + if (input_bit) { + BIT_SET(sr , 7); + } + } else { + res = BIT(sr , 7); + sr <<= 1; + if (input_bit) { + BIT_SET(sr , 0); + } + } + return res; +} + +void hp9895_device::get_next_transition(const attotime& from_when , attotime& edge) +{ + edge = attotime::never; + + if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) { + // Loop back write transitions into reading data path + for (int idx = 0; idx < m_pll.write_position; idx++) { + if (m_pll.write_buffer[ idx ] >= from_when) { + edge = m_pll.write_buffer[ idx ]; + break; + } + } + } else if (m_current_drive != nullptr) { + edge = m_current_drive->get_next_transition(from_when); + } +} + +void hp9895_device::read_bit(bool crc_upd) +{ + attotime edge; + attotime tm; + + get_next_transition(m_pll.ctime, edge); + bool clock_bit = m_pll.feed_read_data(tm , edge , attotime::never); + get_next_transition(m_pll.ctime, edge); + bool data_bit = m_pll.feed_read_data(tm , edge , attotime::never); + + shift_sr(m_clock_sr, clock_bit); + data_bit = shift_sr(m_data_sr, data_bit); + + if (crc_upd && + BIT(m_cntl_reg , REG_CNTL_CRCON_BIT) && + !BIT(m_cntl_reg , REG_CNTL_CRCOUT_BIT)) { + update_crc(data_bit); + } +} + +void hp9895_device::write_bit(bool data_bit , bool clock_bit) +{ + if (m_hiden) { + // **** HP mode **** + // m_wr_context delays data bits by 2 bit cells + // Bit Content + // ============ + // 2 Data @ t-2 + // 1 Data @ t-1 + // 0 Data @ t + m_wr_context = (m_wr_context << 1) | data_bit; + data_bit = BIT(m_wr_context , 2); + clock_bit = !data_bit && (clock_bit || !m_had_transition); + m_had_transition = data_bit || clock_bit; + } + // else... IBM mode, nothing to do + + attotime dummy; + + m_pll.write_next_bit(clock_bit , dummy , nullptr , attotime::never); + m_pll.write_next_bit(data_bit , dummy , nullptr , attotime::never); +} + ROM_START(hp9895) ROM_REGION(0x2000 , "cpu" , 0) ROM_LOAD("1818-1391a.bin" , 0 , 0x2000 , CRC(b50dbfb5) SHA1(96edf9af78be75fbad2a0245b8af43958ba32752)) @@ -175,9 +851,20 @@ static ADDRESS_MAP_START(z80_io_map , AS_IO , 8 , hp9895_device) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x10 , 0x17) AM_DEVWRITE("phi" , phi_device , reg8_w) AM_READ(phi_reg_r) - // TODO: 60-67 range + AM_RANGE(0x60 , 0x60) AM_READWRITE(data_r , data_w) + AM_RANGE(0x61 , 0x61) AM_READWRITE(clock_r , clock_w) + AM_RANGE(0x62 , 0x62) AM_READWRITE(drivstat_r , reset_w) + AM_RANGE(0x63 , 0x63) AM_READWRITE(switches_r , leds_w) + AM_RANGE(0x64 , 0x64) AM_WRITE(cntl_w) + AM_RANGE(0x65 , 0x65) AM_WRITE(drv_w) + AM_RANGE(0x66 , 0x66) AM_WRITE(xv_w) + AM_RANGE(0x67 , 0x67) AM_READ(switches2_r) ADDRESS_MAP_END +static SLOT_INTERFACE_START(hp9895_floppies) + SLOT_INTERFACE("8dsdd" , FLOPPY_8_DSDD) +SLOT_INTERFACE_END + static MACHINE_CONFIG_FRAGMENT(hp9895) MCFG_CPU_ADD("cpu" , Z80 , 4000000) MCFG_CPU_PROGRAM_MAP(z80_program_map) @@ -195,6 +882,11 @@ static MACHINE_CONFIG_FRAGMENT(hp9895) MCFG_PHI_REN_WRITE_CB(WRITELINE(hp9895_device , phi_ren_w)) MCFG_PHI_DIO_READWRITE_CB(READ8(hp9895_device , phi_dio_r) , WRITE8(hp9895_device , phi_dio_w)) MCFG_PHI_INT_WRITE_CB(WRITELINE(hp9895_device , phi_int_w)) + + MCFG_FLOPPY_DRIVE_ADD("floppy0" , hp9895_floppies , "8dsdd" , floppy_image_device::default_floppy_formats) + MCFG_SLOT_FIXED(true) + MCFG_FLOPPY_DRIVE_ADD("floppy1" , hp9895_floppies , "8dsdd" , floppy_image_device::default_floppy_formats) + MCFG_SLOT_FIXED(true) MACHINE_CONFIG_END const tiny_rom_entry *hp9895_device::device_rom_region() const diff --git a/src/devices/bus/ieee488/hp9895.h b/src/devices/bus/ieee488/hp9895.h index d7591d684be..5837792de82 100644 --- a/src/devices/bus/ieee488/hp9895.h +++ b/src/devices/bus/ieee488/hp9895.h @@ -2,9 +2,9 @@ // copyright-holders: F. Ulivi /********************************************************************* - hp9895.h + hp9895.h - HP9895 floppy disk drive + HP9895 floppy disk drive *********************************************************************/ @@ -17,6 +17,8 @@ #include "ieee488.h" #include "cpu/z80/z80.h" #include "machine/phi.h" +#include "imagedev/floppy.h" +#include "machine/fdc_pll.h" class hp9895_device : public device_t, public device_ieee488_interface @@ -26,9 +28,10 @@ public: hp9895_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // device-level overrides - //virtual ioport_constructor device_input_ports() const override; + virtual ioport_constructor device_input_ports() const override; 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; virtual const tiny_rom_entry *device_rom_region() const override; virtual machine_config_constructor device_mconfig_additions() const override; @@ -63,11 +66,67 @@ public: DECLARE_READ8_MEMBER(phi_reg_r); DECLARE_WRITE16_MEMBER(z80_m1_w); + // Floppy interface + DECLARE_WRITE8_MEMBER(data_w); + DECLARE_WRITE8_MEMBER(clock_w); + DECLARE_WRITE8_MEMBER(reset_w); + DECLARE_WRITE8_MEMBER(leds_w); + DECLARE_WRITE8_MEMBER(cntl_w); + DECLARE_WRITE8_MEMBER(drv_w); + DECLARE_WRITE8_MEMBER(xv_w); + DECLARE_READ8_MEMBER(data_r); + DECLARE_READ8_MEMBER(clock_r); + DECLARE_READ8_MEMBER(drivstat_r); + DECLARE_READ8_MEMBER(switches_r); + DECLARE_READ8_MEMBER(switches2_r); + + // Floppy drive interface + void floppy_ready_cb(floppy_image_device *floppy , int state); + private: required_device<z80_device> m_cpu; required_device<phi_device> m_phi; + required_device<floppy_connector> m_drives[ 2 ]; + required_ioport m_switches; bool m_cpu_irq; + floppy_image_device *m_current_drive; + unsigned m_current_drive_idx; + bool m_dskchg[ 2 ]; + uint16_t m_crc; // U77 + bool m_crcerr_syn; + bool m_overrun; + bool m_accdata; + bool m_timeout; + uint8_t m_cntl_reg; // U31 + uint8_t m_clock_sr; // U22 & U4 + uint8_t m_clock_reg; // U23 & U5 + uint8_t m_data_sr; // U24 & U6 + uint8_t m_wr_context; + bool m_had_transition; + bool m_lckup; + bool m_amdt; + uint8_t m_sync_cnt; // U28 & U73 + bool m_hiden; + bool m_mgnena; + + // Timers + emu_timer *m_timeout_timer; + emu_timer *m_byte_timer; + emu_timer *m_half_bit_timer; + + // PLL + fdc_pll_t m_pll; + + uint8_t get_switches2(void) const; + attotime get_half_bit_cell_period(void) const; + floppy_image_device *get_write_device(void) const; + void preset_crc(void); + void update_crc(bool bit); + bool shift_sr(uint8_t& sr , bool input_bit); + void get_next_transition(const attotime& from_when , attotime& edge); + void read_bit(bool crc_upd); + void write_bit(bool data_bit , bool clock_bit); }; // device type definition diff --git a/src/devices/bus/ieee488/ieee488.h b/src/devices/bus/ieee488/ieee488.h index 8f6ae35a456..8c72f7eb155 100644 --- a/src/devices/bus/ieee488/ieee488.h +++ b/src/devices/bus/ieee488/ieee488.h @@ -33,28 +33,28 @@ #define MCFG_IEEE488_EOI_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_eoi_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_eoi_callback(DEVCB_##_write); #define MCFG_IEEE488_DAV_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_dav_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_dav_callback(DEVCB_##_write); #define MCFG_IEEE488_NRFD_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_nrfd_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_nrfd_callback(DEVCB_##_write); #define MCFG_IEEE488_NDAC_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_ndac_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_ndac_callback(DEVCB_##_write); #define MCFG_IEEE488_IFC_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_ifc_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_ifc_callback(DEVCB_##_write); #define MCFG_IEEE488_SRQ_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_srq_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_srq_callback(DEVCB_##_write); #define MCFG_IEEE488_ATN_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_atn_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_atn_callback(DEVCB_##_write); #define MCFG_IEEE488_REN_CALLBACK(_write) \ - downcast<ieee488_device *>(device)->set_ren_callback(DEVCB_##_write); + devcb = &downcast<ieee488_device *>(device)->set_ren_callback(DEVCB_##_write); #define MCFG_IEEE488_SLOT_ADD(_tag, _address, _slot_intf, _def_slot) \ @@ -92,14 +92,14 @@ public: // construction/destruction ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _write> void set_eoi_callback(_write wr) { m_write_eoi.set_callback(wr); } - template<class _write> void set_dav_callback(_write wr) { m_write_dav.set_callback(wr); } - template<class _write> void set_nrfd_callback(_write wr) { m_write_nrfd.set_callback(wr); } - template<class _write> void set_ndac_callback(_write wr) { m_write_ndac.set_callback(wr); } - template<class _write> void set_ifc_callback(_write wr) { m_write_ifc.set_callback(wr); } - template<class _write> void set_srq_callback(_write wr) { m_write_srq.set_callback(wr); } - template<class _write> void set_atn_callback(_write wr) { m_write_atn.set_callback(wr); } - template<class _write> void set_ren_callback(_write wr) { m_write_ren.set_callback(wr); } + template<class _write> devcb_base &set_eoi_callback(_write wr) { return m_write_eoi.set_callback(wr); } + template<class _write> devcb_base &set_dav_callback(_write wr) { return m_write_dav.set_callback(wr); } + template<class _write> devcb_base &set_nrfd_callback(_write wr) { return m_write_nrfd.set_callback(wr); } + template<class _write> devcb_base &set_ndac_callback(_write wr) { return m_write_ndac.set_callback(wr); } + template<class _write> devcb_base &set_ifc_callback(_write wr) { return m_write_ifc.set_callback(wr); } + template<class _write> devcb_base &set_srq_callback(_write wr) { return m_write_srq.set_callback(wr); } + template<class _write> devcb_base &set_atn_callback(_write wr) { return m_write_atn.set_callback(wr); } + template<class _write> devcb_base &set_ren_callback(_write wr) { return m_write_ren.set_callback(wr); } void add_device(ieee488_slot_device *slot, device_t *target); diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h index 25e6bb281ce..6e9c6f7e344 100644 --- a/src/devices/bus/isa/isa.h +++ b/src/devices/bus/isa/isa.h @@ -93,7 +93,7 @@ isa16_slot_device::static_set_isa16_slot(*device, owner, _isatag); #define MCFG_ISA_BUS_IOCHCK(_iochck) \ - downcast<isa8_device *>(device)->set_iochck_callback(DEVCB_##_iochck); + devcb = &downcast<isa8_device *>(device)->set_iochck_callback(DEVCB_##_iochck); #define MCFG_ISA_OUT_IRQ2_CB(_devcb) \ devcb = &isa8_device::set_out_irq2_callback(*device, DEVCB_##_devcb); @@ -191,7 +191,7 @@ public: // inline configuration static void static_set_cputag(device_t &device, const char *tag); static void static_set_custom_spaces(device_t &device); - template<class _iochck> void set_iochck_callback(_iochck iochck) { m_write_iochck.set_callback(iochck); } + template<class _iochck> devcb_base &set_iochck_callback(_iochck iochck) { return m_write_iochck.set_callback(iochck); } template<class _Object> static devcb_base &set_out_irq2_callback(device_t &device, _Object object) { return downcast<isa8_device &>(device).m_out_irq2_cb.set_callback(object); } template<class _Object> static devcb_base &set_out_irq3_callback(device_t &device, _Object object) { return downcast<isa8_device &>(device).m_out_irq3_cb.set_callback(object); } template<class _Object> static devcb_base &set_out_irq4_callback(device_t &device, _Object object) { return downcast<isa8_device &>(device).m_out_irq4_cb.set_callback(object); } diff --git a/src/devices/bus/nes/ggenie.cpp b/src/devices/bus/nes/ggenie.cpp index ec6664bb23d..7831f91b717 100644 --- a/src/devices/bus/nes/ggenie.cpp +++ b/src/devices/bus/nes/ggenie.cpp @@ -15,8 +15,7 @@ #include "emu.h" #include "ggenie.h" -#include "includes/nes.h" - +#include "bus/nes/nes_carts.h" #ifdef NES_PCB_DEBUG #define VERBOSE 1 diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index 4df5c1c5560..bd13bdb838c 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -414,7 +414,7 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c case 0xc3: // lanes 0, 1 m_declaration_rom.resize(romlen*2); - memset(&m_declaration_rom[0], 0, romlen*4); + memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)]; @@ -425,7 +425,7 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c case 0xa5: // lanes 0, 2 m_declaration_rom.resize(romlen*2); - memset(&m_declaration_rom[0], 0, romlen*4); + memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)]; @@ -436,7 +436,7 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c case 0x3c: // lanes 2,3 m_declaration_rom.resize(romlen*2); - memset(&m_declaration_rom[0], 0, romlen*4); + memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)]; diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp index c95601773e3..a07e623f72a 100644 --- a/src/devices/bus/vic20/exp.cpp +++ b/src/devices/bus/vic20/exp.cpp @@ -202,6 +202,7 @@ void vic20_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint #include "vic1111.h" #include "vic1112.h" #include "vic1210.h" +#include "speakeasy.h" SLOT_INTERFACE_START( vic20_expansion_cards ) SLOT_INTERFACE("exp", VIC1010) @@ -209,6 +210,7 @@ SLOT_INTERFACE_START( vic20_expansion_cards ) SLOT_INTERFACE("8k", VIC1110) SLOT_INTERFACE("16k", VIC1111) SLOT_INTERFACE("fe3", VIC20_FE3) + SLOT_INTERFACE("speakez", VIC20_SPEAKEASY) // the following need ROMs from the software list SLOT_INTERFACE_INTERNAL("standard", VIC20_STD) diff --git a/src/devices/bus/vic20/speakeasy.cpp b/src/devices/bus/vic20/speakeasy.cpp new file mode 100644 index 00000000000..d13a1908c75 --- /dev/null +++ b/src/devices/bus/vic20/speakeasy.cpp @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:smf +/********************************************************************** + + Personal Peripheral Products Speakeasy cartridge emulation + (aka Protecto Enterprizes VIC-20 Voice Synthesizer) + +**********************************************************************/ + +#include "speakeasy.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define SC01A_TAG "sc01a" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type VIC20_SPEAKEASY = &device_creator<vic20_speakeasy_t>; + + +//------------------------------------------------- +// MACHINE_DRIVER( speakeasy ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( speakeasy ) + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(SC01A_TAG, VOTRAX_SC01, 720000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor vic20_speakeasy_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( speakeasy ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vic20_speakeasy_t - constructor +//------------------------------------------------- + +vic20_speakeasy_t::vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, VIC20_SPEAKEASY, "Speakeasy VIC20", tag, owner, clock, "speakeasyvic20", __FILE__), + device_vic20_expansion_card_interface(mconfig, *this), + m_votrax(*this, SC01A_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vic20_speakeasy_t::device_start() +{ +} + + +//------------------------------------------------- +// vic20_cd_r - cartridge data read +//------------------------------------------------- + +uint8_t vic20_speakeasy_t::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) +{ + if (!io2) + { + return m_votrax->request() << 7; + } + + return data; +} + + +//------------------------------------------------- +// vic20_cd_w - cartridge data write +//------------------------------------------------- + +void vic20_speakeasy_t::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) +{ + if (!io2) + { + m_votrax->write(space, 0, data & 0x3f); + m_votrax->inflection_w(space, 0, data >> 6); + } +} diff --git a/src/devices/bus/vic20/speakeasy.h b/src/devices/bus/vic20/speakeasy.h new file mode 100644 index 00000000000..dbd9ccf4e84 --- /dev/null +++ b/src/devices/bus/vic20/speakeasy.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Personal Peripheral Products Speakeasy cartridge emulation + (aka Protecto Enterprizes VIC-20 Voice Synthesizer) + +**********************************************************************/ + +#pragma once + +#ifndef __VIC20_SPEAKEASY__ +#define __VIC20_SPEAKEASY__ + +#include "emu.h" +#include "exp.h" +#include "sound/votrax.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> vic20_speakeasy_t + +class vic20_speakeasy_t : public device_t, + public device_vic20_expansion_card_interface +{ +public: + // construction/destruction + vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + +protected: + // device-level overrides + virtual void device_start() override; + + // device_vic20_expansion_card_interface overrides + virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; + virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; + +private: + required_device<votrax_sc01_device> m_votrax; +}; + + +// device type definition +extern const device_type VIC20_SPEAKEASY; + + + +#endif diff --git a/src/devices/bus/vme/vme.cpp b/src/devices/bus/vme/vme.cpp index 79e6d5a8687..4d6b35a4c80 100644 --- a/src/devices/bus/vme/vme.cpp +++ b/src/devices/bus/vme/vme.cpp @@ -6,64 +6,64 @@ * The Versabus-E was standardized as the VME bus by VITA 1981 for Europe * in the single or double Euroboard form factor. Several standard revs has * been approved since then up until recently and the VME64 revision. - * - * This bus driver starts with Versabus and VME rev C. + * + * This bus driver starts with Versabus and VME rev C. * http://bitsavers.informatik.uni-stuttgart.de/pdf/motorola/versabus/M68KVBS_VERSAbus_Specification_Manual_Jul81.pdf * * Acronymes from the specification * --------------------------------- - * BACKPLANE - A printed circuit board which provides the interconnection path - between other printed circuit cards. - SLOT - A single position at which a card may be inserted into the backplane. + * BACKPLANE - A printed circuit board which provides the interconnection path + between other printed circuit cards. + SLOT - A single position at which a card may be inserted into the backplane. One slot may consist of more than one edge connector. - BOARD/CARD - Interchangeable terms representing one printed circuit board capable - of being inserted into the backplane and containing a collection of + BOARD/CARD - Interchangeable terms representing one printed circuit board capable + of being inserted into the backplane and containing a collection of electronic components. - MODULE - A collection of electronic components with a single functional - purpose. More than one module may exist on the same card, but one - module should never be spread over multiple cards. - MASTER - A functional module capable of initiating data bus transfers. - REQUESTER - A functional module capable of requesting control of the data - transfer bus. - INTERRUPT - A functional module capable of detecting interrupt requests + MODULE - A collection of electronic components with a single functional + purpose. More than one module may exist on the same card, but one + module should never be spread over multiple cards. + MASTER - A functional module capable of initiating data bus transfers. + REQUESTER - A functional module capable of requesting control of the data + transfer bus. + INTERRUPT - A functional module capable of detecting interrupt requests HANDLER and initiating appropriate responses. - MASTER - The combination of a MASTER, REQUESTER, INTERRUPT HANDLER, and - SUB-SYSTEM (optionally) an INTERRUPTER, which function together and which + MASTER - The combination of a MASTER, REQUESTER, INTERRUPT HANDLER, and + SUB-SYSTEM (optionally) an INTERRUPTER, which function together and which must be on the same card. - NOTE! All MASTERS, REQUESTERS, and INTERRUPT HANDLERS must be pieces of a - MASTER SUB-SYSTEM. - - SLAVE - A functional module capable of responding to data transfer - operations generated by a MASTER. - INTERRUPTER - A functional module capable of requesting service from a MASTER - SUB-SYSTEM by generating an interrupt request. - SLAVE - The combination of a SLAVE and INTERRUPTER which function together - SUB-SYSTEM and which must be on the same card. - - NOTE! All INTERRUPTERS must be part of either SLAVE SUB-SYSTEMS or MASTER - SUB-SYSTEMS. However, SLAVES may exist as stand-alone elements. - Such SLAVES will never be called SLAVE SUB-SYSTEMS. - - CONTROLLER - The combination of modules used to provide utility and emergency - SUB-SYSTEM signals for the VERSAbus. There will always be one and only one - CONTROLLER SUB-SYSTEM. It can contain the following functional - modules: - - a. Data Transfer Bus ARBITER - b. Emergency Data Transfer Bus REQUESTER - c. Power up/power down MASTER - d. System clock driver - e. System reset driver - f. System test controller - g. Power monitor (for AC clock and AC fail driver) - - In any VERSAbus system, only one each of the above functional modules will exist. - The slot numbered Al is designated as the controller sub-system slot because the - user will typically provide modules a through d on the board residing in this - slot. System reset and the system test controller are typically connected to - an operator control panel and may be located elsewhere. The power monitor is - interfaced to the incoming AC power source and may also be located remotely. + NOTE! All MASTERS, REQUESTERS, and INTERRUPT HANDLERS must be pieces of a + MASTER SUB-SYSTEM. + + SLAVE - A functional module capable of responding to data transfer + operations generated by a MASTER. + INTERRUPTER - A functional module capable of requesting service from a MASTER + SUB-SYSTEM by generating an interrupt request. + SLAVE - The combination of a SLAVE and INTERRUPTER which function together + SUB-SYSTEM and which must be on the same card. + + NOTE! All INTERRUPTERS must be part of either SLAVE SUB-SYSTEMS or MASTER + SUB-SYSTEMS. However, SLAVES may exist as stand-alone elements. + Such SLAVES will never be called SLAVE SUB-SYSTEMS. + + CONTROLLER - The combination of modules used to provide utility and emergency + SUB-SYSTEM signals for the VERSAbus. There will always be one and only one + CONTROLLER SUB-SYSTEM. It can contain the following functional + modules: + + a. Data Transfer Bus ARBITER + b. Emergency Data Transfer Bus REQUESTER + c. Power up/power down MASTER + d. System clock driver + e. System reset driver + f. System test controller + g. Power monitor (for AC clock and AC fail driver) + + In any VERSAbus system, only one each of the above functional modules will exist. + The slot numbered Al is designated as the controller sub-system slot because the + user will typically provide modules a through d on the board residing in this + slot. System reset and the system test controller are typically connected to + an operator control panel and may be located elsewhere. The power monitor is + interfaced to the incoming AC power source and may also be located remotely. */ #include "emu.h" @@ -139,12 +139,12 @@ void vme_slot_device::device_start() { device_vme_card_interface *dev = dynamic_cast<device_vme_card_interface *>(get_card_device()); LOG("%s %s - %s:%s\n", tag(), FUNCNAME, m_vme_tag, m_vme_slottag); - if (dev) + if (dev) { device_vme_card_interface::static_set_vme_tag(*dev, m_vme_tag, m_vme_slottag); } - // m_card = dynamic_cast<device_vme_card_interface *>(get_card_device()); + // m_card = dynamic_cast<device_vme_card_interface *>(get_card_device()); } //------------------------------------------------- @@ -164,8 +164,8 @@ READ8_MEMBER(vme_slot_device::read8) { uint16_t result = 0x00; LOG("%s %s\n", tag(), FUNCNAME); - // printf("%s %s\n", tag(), FUNCNAME); - // if (m_card) result = m_card->read8(space, offset); + // printf("%s %s\n", tag(), FUNCNAME); + // if (m_card) result = m_card->read8(space, offset); return result; } @@ -175,8 +175,8 @@ READ8_MEMBER(vme_slot_device::read8) WRITE8_MEMBER(vme_slot_device::write8) { LOG("%s %s\n", tag(), FUNCNAME); - // printf("%s %s\n", tag(), FUNCNAME); - // if (m_card) m_card->write8(space, offset, data); + // printf("%s %s\n", tag(), FUNCNAME); + // if (m_card) m_card->write8(space, offset, data); } #if 0 // Disabled until we know how to make a board driver also a slot device @@ -184,7 +184,7 @@ WRITE8_MEMBER(vme_slot_device::write8) /* Usually a VME firmware supports only a few boards so it will have its own slot collection defined */ // Controller capable boards that can go into slot1 ( or has an embedded VME bus ) SLOT_INTERFACE_START( vme_slot1 ) -// SLOT_INTERFACE("mzr8105", VME_MZR8105) +// SLOT_INTERFACE("mzr8105", VME_MZR8105) SLOT_INTERFACE_END #endif @@ -232,7 +232,7 @@ void vme_device::add_vme_card(device_vme_card_interface *card) void vme_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask) { - cpu_device *m_maincpu = machine().device<cpu_device>("maincpu"); + cpu_device *m_maincpu = machine().device<cpu_device>("maincpu"); int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_databus_width; LOG("%s width:%d\n", FUNCNAME, buswidth); @@ -325,7 +325,7 @@ void device_vme_card_interface::set_vme_device() { LOG("%s %s\n", m_device->tag(), FUNCNAME); m_vme = dynamic_cast<vme_device *>(device().machine().device(m_vme_tag)); - // printf("*** %s %sfound\n", m_vme_tag, m_vme ? "" : "not "); + // printf("*** %s %sfound\n", m_vme_tag, m_vme ? "" : "not "); if (m_vme) m_vme->add_vme_card(this); } @@ -352,7 +352,7 @@ a number of variants that has been more or less standardized: an almost compatible variant was developed by Motorola called MVMX32bus. - VSBbus replaced VMX and MVMX32and was approved by IEEE in 1988 - SCSA is a P2 standardization for telephony voice and facsimile applications -- SkyChannel is packet switched P2 architecture from Sky Computers and standardized +- SkyChannel is packet switched P2 architecture from Sky Computers and standardized through VITA/VSO. - RACEway is a 40Mhz P2 bus allowing 480MBps throughput from Mercusry Computers and standardized through VITA/VSO. diff --git a/src/devices/bus/vme/vme.h b/src/devices/bus/vme/vme.h index 6103379a4ac..c2aa6e2b666 100644 --- a/src/devices/bus/vme/vme.h +++ b/src/devices/bus/vme/vme.h @@ -53,7 +53,7 @@ #include "emu.h" //************************************************************************** -// CONSTANTS +// CONSTANTS //************************************************************************** #define VME_BUS_TAG "vme" @@ -78,7 +78,7 @@ public: DS0, DS1, BERR, - DTACK, + DTACK, WRITE }; @@ -152,7 +152,7 @@ public: void set_vme_device(); virtual DECLARE_READ8_MEMBER(read8); - virtual DECLARE_WRITE8_MEMBER(write8); + virtual DECLARE_WRITE8_MEMBER(write8); device_t *m_device; // inline configuration @@ -175,7 +175,7 @@ public: Short addressing AM codes indicate that address lines A02-A15 are being used to select a BYTE(0-3) group. Standard addressing AM codes ,indicate that address lines A02-A23 are being used to select a BYTE(0-3) group. Extended addressing AM codes indicate that address lines A02-A31 are being used to select a BYTE(0-3) group.*/ - enum + enum { // Defined and User Defined Address Modifier Values, The rest us Reserved between 0x00 and 0x3F AMOD_EXTENDED_NON_PRIV_DATA = 0x09, AMOD_EXTENDED_NON_PRIV_PRG = 0x0A, @@ -196,7 +196,7 @@ public: }; }; -#define MCFG_VME_SLOT_ADD(_tag, _slot_tag, _slot_intf,_def_slot) \ +#define MCFG_VME_SLOT_ADD(_tag, _slot_tag, _slot_intf,_def_slot) \ MCFG_DEVICE_ADD(_slot_tag, VME_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ vme_slot_device::static_set_vme_slot(*device, _tag, _slot_tag); diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp new file mode 100644 index 00000000000..e1d9c7afc9b --- /dev/null +++ b/src/devices/bus/vme/vme_fccpu20.cpp @@ -0,0 +1,663 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + * + * Force SYS68K CPU-20 VME SBC imaginary one (two) slot chassi + * + * 24/12/2016 + * + * Thanks to Al Kossow and his site http://www.bitsavers.org/ I got the information + * required to start the work with this driver. + * + * + * || + * || || CPU-21 - main board + * ||||--||_____________________________________________________________ + * ||||--|| | + * || || _ |__ + * || | | | + * RST o-[| | | | + * || +-------+ | | | + * ABT o-[| | XTAL | | | | + * || | 50MHz | +-----------------------+ | | | + * RUN C| +-------+ | MPCC | | | | + * HALT C| +-------+ | R68561P | | |VME| + * BM C| | XTAL | +-----------------------+ | | | + * || | 40MHz | +-----------------------+ | |P1 | + * || +-------+ | PIT | | | | + * FLMA C| +-------+ | MC68230P8 | | | | + * EPROM C| | XTAL | +-----------------------+ | | | + * 2WST C| | 32MHz | | | | + * 4WST C| +-------+ | | | + * 6WST C| | | | + * 8WST C| |_| | + * 12WST C| +--------------------+ |___| + * 14WST C| | BIM | | + * || | MC68153L | | + * || +--------------------+ | + * CSH o-[| | + * || | + * R/H o-[| | + * || | + * DIP0 - +----------------+ | + * . - | | |___ + * . - | | +---+ _| | + * . - | CPU | | |+------------+ | | | + * . - | M68020 | | || 27128 | | | | + * . - | | | || EPROM | | | | + * . - | | | |+------------+ | | | + * DIP7 - | | | F | | |VME| + * || +----------------+ | L |+------------+ | | | + * || | M || 27128 | | |P2 | + * [|||O +------------+ | E || EPROM | | | | + * +-|||| | | | |+------------+ | | | + * | |||| | FPU | | m | | | | + * | |||| | 68881 | | e |+------------+ | | | + * | |||| | | | m || 27128 | | | | + * | |||| | | | || EPROM | | | | + * P4 | |||| +------------+ | b |+------------+ | | | + * | |||| | u | | | | + * +-|||| | s |+------------+ |_| | + * [|||O | || 27128 | |___| + * || || | || EPROM | | + * ||||--|| +---++------------+ | + * ||||--||-------------------------------------------------------------+ + * || + * + * + * || + * || || CPU-21 - slave board (SRAM-22 - connected via FLME mem bus) + * ||||--||_____________________________________________________________ + * ||||--|| | + * || || 64 x 64Kbit SRAM = 512KB __|__ + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * || |IMS1600 | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * RUN C| | | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * || | | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| |VME| + * SEL0 C| | | | | | | | || | | + * SEL1 C| +-----------+ +-----------+ +-----------+ +-----------+| |P1 | + * || | | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * || | | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * || | | | | | | | || | | + * || +-----------+ +-----------+ +-----------+ +-----------+| | | + * || | | | | | | | ||_| | + * || +-----------+ +-----------+ +-----------+ +-----------+ |___| + * || | | | | | | | | | + * || +-----------+ +-----------+ +-----------+ +-----------+ | + * || | | | | | | | | | + * || +-----------+ +-----------+ +-----------+ +-----------+ | + * || | | | | | + * || +-----------+ +-----------+ +-----------+ +-----------+ | + * || | | | | | | | | | + * || +-----------+ +-----------+ +-----------+ +-----------+ | + * || |___ + * || +---++-----------+ +-----------+ _| | + * || | || | | || | | + * || | |+-----------+ +-----------+| | | + * || | || | | || | | + * || | |+-----------+ +-----------+| | | + * || | F || | | || |VME| + * || | L |+-----------+ +-----------+| | | + * || | M | | |P2 | + * [|||O | E | | | | + * +-|||| | | | | | + * | |||| | m | | | | + * | |||| | e | | | | + * | |||| | m | | | | + * | |||| | | | | | + * P8? | |||| | b | | | | + * | |||| | u | +-----------------------+ | | | + * +-|||| | s | | MPCC | |_| | + * [|||O | | | R68561P | |___| + * || || | | +-----------------------+ | + * ||||--|| +---+ (XTAL) | + * ||||--||------------------------------------------------------------+ + * || NOTE: Variants also available with 2MB and/or DRAM + * + * History of Force Computers + *--------------------------- + * see fccpu30.cpp + * + * Misc links about Force Computes and this board: + *------------------------------------------------ + * http://bitsavers.org/pdf/forceComputers/ + * + * Description(s) + * ------------- + * CPU-20 has the following feature set: + * - 68020 CPU with l6.7MHz Clock Frequency + * - 68881 Floating Point Coprocessor with l6.7MHz Clock Frequency + * - Static RAM 5l2Kbyte with 55ns access time + * - 5l2Kbyte (max) of ROM/EPROM for the system + * - 2 RS232 Multi Protocol Communication Interfaces (110-38400 Baud) + * - Parallel Interface and Timer Chip provides local control and timer function + * - VMXbus Primary Master Interface to p2 connector + * - Local Interrupt handling via interrupt vectors + * - Each VMEbus IRQ level can be enabled/disabled via software + * - Address range for the short I/O address modifies (AM4) + * - Address range for the standard address modifier + * - Single level bus arbiter + * - One level slave bus arbitration + * - Power monitor + * - RESET and SOFTWARE ABORT function switches + * - Fully VMEbus, VMXbus and IEEE Pl~14 compatible + * + * Address Map + * -------------------------------------------------------------------------- + * Range Decscription + * -------------------------------------------------------------------------- + * 00000000-0xxFFFFF Shared DRAM D8-D32 + * 0yy00000-FAFFFFFF VME A32 D8-D32 yy=xx+1 + * FB000000-FBFEFFFF VME A24 D8-D32 + * FBFF0000-FBFFFFFF VME A16 D8-D32 + * FC000000-FCFEFFFF VME A24 D8-D16 + * FCFF0000-FCFFFFFF VME A16 D8-D16 + * FF800000 MPCC + * FF800200 MPCC2 - on daughter board + * FF800600 MPCC3 - on daughter board + * FF800800 BIM + * FF800C00 PIT + * FF800A00 RTC + * + *--------------------------------------------------------------------------- + * TODO: + * - Find accurate documentation and adjust memory map for Y boards + * - Improve 68561 UART + * - Improve hookup of 68230 PIT + * - ABORT switch + * - Enable/Disable VME interrupts + * - Interrupts: Timer, ACFAIL, SYSFAIL and VMX irq + * - Memory config + * - Board ID + * - Add FGA, DUSCC devices and CPU-22 variants + * - Add FLME bus for memory expansions and optional extra MPCC + * - Add VMX bus on the P2 connector + * - Enable FPU + * - Add user EPROM sockets as cartridge interface enabling softlists + * NOT PLANNED: + * - VME bus arbiter as MAME always gets the bus + ****************************************************************************/ +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "bus/rs232/rs232.h" +#include "machine/68230pit.h" +#include "machine/68153bim.h" +#include "machine/68561mpcc.h" +#include "machine/clock.h" +#include "vme_fccpu20.h" + +#define LOG_GENERAL 0x01 +#define LOG_SETUP 0x02 +#define LOG_PRINTF 0x04 +#define LOG_INT 0x08 + +#define VERBOSE 0 //(LOG_PRINTF | LOG_SETUP | LOG_GENERAL) + +#define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) +#define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) + +#define LOG(...) LOGMASK(LOG_GENERAL, __VA_ARGS__) +#define LOGSETUP(...) LOGMASK(LOG_SETUP, __VA_ARGS__) +#define LOGINT(...) LOGMASK(LOG_SETUP, __VA_ARGS__) + +#if VERBOSE & LOG_PRINTF +#define logerror printf +#endif + +#ifdef _MSC_VER +#define FUNCNAME __func__ +#else +#define FUNCNAME __PRETTY_FUNCTION__ +#endif + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type VME_FCCPU20 = &device_creator<vme_fccpu20_card_device>; +const device_type VME_FCCPU21S = &device_creator<vme_fccpu21s_card_device>; +const device_type VME_FCCPU21 = &device_creator<vme_fccpu21_card_device>; +const device_type VME_FCCPU21A = &device_creator<vme_fccpu21a_card_device>; +const device_type VME_FCCPU21YA = &device_creator<vme_fccpu21ya_card_device>; +const device_type VME_FCCPU21B = &device_creator<vme_fccpu21b_card_device>; +const device_type VME_FCCPU21YB = &device_creator<vme_fccpu21yb_card_device>; + +#define CLOCK50 XTAL_50MHz /* HCJ */ +#define CLOCK40 XTAL_40MHz /* HCJ */ +#define CLOCK32 XTAL_32MHz /* HCJ */ + +static ADDRESS_MAP_START (cpu20_mem, AS_PROGRAM, 32, vme_fccpu20_device) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0x00000000, 0x00000007) AM_ROM AM_READ (bootvect_r) /* ROM mirror just during reset */ + AM_RANGE (0x00000000, 0x00000007) AM_RAM AM_WRITE (bootvect_w) /* After first write we act as RAM */ + AM_RANGE (0x00000008, 0x0007ffff) AM_RAM /* Local SRAM */ + AM_RANGE (0x00080000, 0x000fffff) AM_RAM /* SRAM-22 installed */ + AM_RANGE (0xff040000, 0xff04ffff) AM_RAM + AM_RANGE (0xff000000, 0xff00ffff) AM_ROM AM_REGION("roms", 0x0000) + AM_RANGE (0xff800000, 0xff80001f) AM_DEVREADWRITE8("mpcc", mpcc68561_device, read, write, 0xffffffff) + AM_RANGE (0xff800200, 0xff80021f) AM_DEVREADWRITE8("mpcc2", mpcc68561_device, read, write, 0xffffffff) + AM_RANGE (0xff800600, 0xff80061f) AM_DEVREADWRITE8("mpcc3", mpcc68561_device, read, write, 0xffffffff) + AM_RANGE (0xff800800, 0xff80080f) AM_DEVREADWRITE8("bim", bim68153_device, read, write, 0xff00ff00) + AM_RANGE (0xff800c00, 0xff800dff) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0xffffffff) +ADDRESS_MAP_END + +/* + * Machine configuration + */ +static MACHINE_CONFIG_FRAGMENT (fccpu20) + /* basic machine hardware */ + MCFG_CPU_ADD ("maincpu", M68020, CLOCK50 / 3) /* Crytstal verified from picture HCI */ + MCFG_CPU_PROGRAM_MAP (cpu20_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("bim", bim68153_device, iack) + + /* PIT Parallel Interface and Timer device, assumed strapped for on board clock */ + MCFG_DEVICE_ADD ("pit", PIT68230, CLOCK32 / 4) /* Crystal not verified */ + MCFG_PIT68230_PA_INPUT_CB(READ8(vme_fccpu20_device, pita_r)) + MCFG_PIT68230_PB_INPUT_CB(READ8(vme_fccpu20_device, pitb_r)) + MCFG_PIT68230_PC_INPUT_CB(READ8(vme_fccpu20_device, pitc_r)) + MCFG_PIT68230_TIMER_IRQ_CB(DEVWRITELINE("bim", bim68153_device, int2_w)) + + /* BIM */ + MCFG_MC68153_ADD("bim", CLOCK32 / 8) + MCFG_BIM68153_OUT_INT_CB(WRITELINE(vme_fccpu20_device, bim_irq_callback)) + /*INT0 - Abort switch */ + /*INT1 - MPCC@8.064 MHz aswell */ + /*INT2 - PI/T timer */ + /*INT3 - SYSFAIL/IRQVMX/ACFAIL/MPCC2/3 */ + + /* MPCC */ +#define RS232P1_TAG "rs232p1" +#define RS232P2_TAG "rs232p2" +#define RS232P3_TAG "rs232p3" + // MPCC + MCFG_MPCC68561_ADD ("mpcc", CLOCK32 / 4, 0, 0) + MCFG_MPCC_OUT_TXD_CB(DEVWRITELINE(RS232P1_TAG, rs232_port_device, write_txd)) + MCFG_MPCC_OUT_DTR_CB(DEVWRITELINE(RS232P1_TAG, rs232_port_device, write_dtr)) + MCFG_MPCC_OUT_RTS_CB(DEVWRITELINE(RS232P1_TAG, rs232_port_device, write_rts)) + MCFG_MPCC_OUT_INT_CB(DEVWRITELINE("bim", bim68153_device, int1_w)) + + /* Additional MPCC sits on FLME boards like SRAM-22, + TODO: install MPCC2/MPCC3 in FLME slot device */ + // MPCC2 + MCFG_MPCC68561_ADD ("mpcc2", CLOCK32 / 4, 0, 0) + MCFG_MPCC_OUT_TXD_CB(DEVWRITELINE(RS232P2_TAG, rs232_port_device, write_txd)) + MCFG_MPCC_OUT_DTR_CB(DEVWRITELINE(RS232P2_TAG, rs232_port_device, write_dtr)) + MCFG_MPCC_OUT_RTS_CB(DEVWRITELINE(RS232P2_TAG, rs232_port_device, write_rts)) + MCFG_MPCC_OUT_INT_CB(DEVWRITELINE("bim", bim68153_device, int3_w)) + // MPCC3 + MCFG_MPCC68561_ADD ("mpcc3", CLOCK32 / 4, 0, 0) + MCFG_MPCC_OUT_TXD_CB(DEVWRITELINE(RS232P3_TAG, rs232_port_device, write_txd)) + MCFG_MPCC_OUT_DTR_CB(DEVWRITELINE(RS232P3_TAG, rs232_port_device, write_dtr)) + MCFG_MPCC_OUT_RTS_CB(DEVWRITELINE(RS232P3_TAG, rs232_port_device, write_rts)) + MCFG_MPCC_OUT_INT_CB(DEVWRITELINE("bim", bim68153_device, int3_w)) + + // MPCC - RS232 + MCFG_RS232_PORT_ADD (RS232P1_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("mpcc", mpcc68561_device, write_rx)) + MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("mpcc", mpcc68561_device, cts_w)) + + // MPCC2 - RS232 + MCFG_RS232_PORT_ADD (RS232P2_TAG, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("mpcc2", mpcc68561_device, write_rx)) + MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("mpcc2", mpcc68561_device, cts_w)) + + // MPCC3 - RS232 + MCFG_RS232_PORT_ADD (RS232P3_TAG, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("mpcc3", mpcc68561_device, write_rx)) + MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("mpcc3", mpcc68561_device, cts_w)) +MACHINE_CONFIG_END + +// SYS68K/CPU-21S Part No.1 01 041 - 68020 CPU board + FPU 68881 at 12.5 MHz, 512 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21s, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK50 / 4) +MACHINE_CONFIG_END + +// SYS68K/CPU-21 Part No.1 01 001 - 68020 CPU board (CPU-20) + FPU 68881 at 16.7 MHz, 512 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK50 / 3) +MACHINE_CONFIG_END + +// SYS68K/CPU-21A Part No.1 01 011 - 68020 CPU board + FPU 68881 at 20 MHz, 512 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21a, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK40 / 2) +MACHINE_CONFIG_END + +// SYS68K/CPU-21YA Part No.1 01 061 - 68020 CPU board + FPU 68881 at 20 MHz, 2048 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21ya, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK40 / 2) +MACHINE_CONFIG_END + +// SYS68K/CPU-21B Part No.1 01 021 - 68020 CPU board + FPU 68881 at 25 MHz, 512 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21b, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK50 / 2) +MACHINE_CONFIG_END + +// SYS68K/CPU-21YB Part No.1 01 071 - 68020 CPU board + FPU 68881 at 25 MHz, 2048 KB RAM +static MACHINE_CONFIG_DERIVED( fccpu21yb, fccpu20 ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK( CLOCK50 / 2) +MACHINE_CONFIG_END + +machine_config_constructor vme_fccpu20_device::device_mconfig_additions() const +{ + LOG("%s %s\n", tag(), FUNCNAME); + + switch (m_board_id) + { + case cpu20: return MACHINE_CONFIG_NAME( fccpu20 ); break; + case cpu21a: return MACHINE_CONFIG_NAME( fccpu21a ); break; + case cpu21ya: return MACHINE_CONFIG_NAME( fccpu21ya ); break; + case cpu21b: return MACHINE_CONFIG_NAME( fccpu21b ); break; + case cpu21yb: return MACHINE_CONFIG_NAME( fccpu21yb ); break; + case cpu21s: return MACHINE_CONFIG_NAME( fccpu21s ); break; + case cpu21: return MACHINE_CONFIG_NAME( fccpu21 ); break; + default: logerror("Attempt to get config for unknown board type %02x, defaulting to CPU20\n", m_board_id); + return MACHINE_CONFIG_NAME( fccpu20 ); + } + return MACHINE_CONFIG_NAME( fccpu20 ); +} + +//************************************************************************** +// Base Device +//************************************************************************** +vme_fccpu20_device::vme_fccpu20_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, fc_board_t board_id) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_vme_card_interface(mconfig, *this) + , m_maincpu (*this, "maincpu") + , m_pit (*this, "pit") + , m_bim (*this, "bim") + , m_mpcc (*this, "mpcc") + , m_mpcc2 (*this, "mpcc2") + , m_mpcc3 (*this, "mpcc3") + , m_board_id(board_id) +{ + LOG("%s\n", FUNCNAME); +} + +//************************************************************************** +// Card Devices +//************************************************************************** +vme_fccpu20_card_device::vme_fccpu20_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu20_card_device( mconfig, VME_FCCPU20, "Force Computer SYS68K/CPU-20 CPU Board", tag, owner, clock, "fccpu20", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + + +vme_fccpu21s_card_device::vme_fccpu21s_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21s_card_device( mconfig, VME_FCCPU21S, "Force Computer SYS68K/CPU-21S CPU Board", tag, owner, clock, "fccpu21s", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +vme_fccpu21_card_device::vme_fccpu21_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21_card_device( mconfig, VME_FCCPU21, "Force Computer SYS68K/CPU-21 CPU Board", tag, owner, clock, "fccpu21", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +vme_fccpu21a_card_device::vme_fccpu21a_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21a_card_device( mconfig, VME_FCCPU21A, "Force Computer SYS68K/CPU-21A CPU Board", tag, owner, clock, "fccpu21a", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +// TODO: Change to 2MB on board RAM and move FLME memory and find/verify memory map +vme_fccpu21ya_card_device::vme_fccpu21ya_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21ya_card_device( mconfig, VME_FCCPU21YA, "Force Computer SYS68K/CPU-21YA CPU Board", tag, owner, clock, "fccpu21ya", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +vme_fccpu21b_card_device::vme_fccpu21b_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21b_card_device( mconfig, VME_FCCPU21B, "Force Computer SYS68K/CPU-21B CPU Board", tag, owner, clock, "fccpu21b", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +// TODO: Change to 2MB on board RAM and move FLME memory and find/verify memory map +vme_fccpu21yb_card_device::vme_fccpu21yb_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vme_fccpu21yb_card_device( mconfig, VME_FCCPU21B, "Force Computer SYS68K/CPU-21YB CPU Board", tag, owner, clock, "fccpu21yb", __FILE__) +{ + LOG("%s %s\n", tag, FUNCNAME); +} + +/* Start it up */ +void vme_fccpu20_device::device_start() +{ + LOG("%s\n", FUNCNAME); + + set_vme_device(); + + save_pointer (NAME (m_sysrom), sizeof(m_sysrom)); + save_pointer (NAME (m_sysram), sizeof(m_sysram)); + // save_item(NAME(m_board_id)); // TODO: Save this "non base type" item + + /* TODO: setup this RAM from (not yet) optional SRAM-2x board and also support 2MB versions */ + //m_maincpu->space(AS_PROGRAM).install_ram(0x80000, m_ram->size() + 0x7ffff, m_ram->pointer()); + + /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ + m_sysrom = (uint32_t*)(memregion ("roms")->base()); + +#if 0 // TODO: Setup VME access handlers for shared memory area + uint32_t base = 0xFFFF5000; + m_vme->install_device(base + 0, base + 1, // Channel B - Data + read8_delegate(FUNC(z80sio_device::db_r), subdevice<z80sio_device>("pit")), write8_delegate(FUNC(z80sio_device::db_w), subdevice<z80sio_device>("pit")), 0x00ff); + m_vme->install_device(base + 2, base + 3, // Channel B - Control + read8_delegate(FUNC(z80sio_device::cb_r), subdevice<z80sio_device>("pit")), write8_delegate(FUNC(z80sio_device::cb_w), subdevice<z80sio_device>("pit")), 0x00ff); +#endif + +} + +void vme_fccpu20_device::device_reset() +{ + LOG("%s\n", FUNCNAME); +} + +/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xff800000 to 0x0 at reset*/ +READ32_MEMBER (vme_fccpu20_device::bootvect_r) +{ + LOG("%s\n", FUNCNAME); + return m_sysrom[offset]; +} + +WRITE32_MEMBER (vme_fccpu20_device::bootvect_w) +{ + LOG("%s\n", FUNCNAME); + m_sysram[offset % sizeof(m_sysram)] &= ~mem_mask; + m_sysram[offset % sizeof(m_sysram)] |= (data & mem_mask); + m_sysrom = &m_sysram[0]; // redirect all upcomming accesses to masking RAM until reset. +} + +WRITE_LINE_MEMBER(vme_fccpu20_device::bim_irq_callback) +{ + LOGINT("%s(%02x)\n", FUNCNAME, state); + + bim_irq_state = state; + bim_irq_level = m_bim->get_irq_level(); + LOGINT(" - BIM irq level %02x\n", bim_irq_level); + update_irq_to_maincpu(); +} + +void vme_fccpu20_device::update_irq_to_maincpu() +{ + LOGINT("%s()\n", FUNCNAME); + LOGINT(" - bim_irq_level: %02x\n", bim_irq_level); + LOGINT(" - bim_irq_state: %02x\n", bim_irq_state); + switch (bim_irq_level & 0x07) + { + case 1: m_maincpu->set_input_line(M68K_IRQ_1, bim_irq_state); break; + case 2: m_maincpu->set_input_line(M68K_IRQ_2, bim_irq_state); break; + case 3: m_maincpu->set_input_line(M68K_IRQ_3, bim_irq_state); break; + case 4: m_maincpu->set_input_line(M68K_IRQ_4, bim_irq_state); break; + case 5: m_maincpu->set_input_line(M68K_IRQ_5, bim_irq_state); break; + case 6: m_maincpu->set_input_line(M68K_IRQ_6, bim_irq_state); break; + case 7: m_maincpu->set_input_line(M68K_IRQ_7, bim_irq_state); break; + default: logerror("Programmatic error in %s, please report\n", FUNCNAME); + } +} + +/* 8 configuration DIP switches + Baud B3 B2 B1 B0 + 9600 0 0 0 1 7 bits + 28800 0 0 1 0 7 bits + 38400 1 0 1 0 8 bits + 57600 0 0 1 1 7 bits + + B3: 8 bit 38400 baud + B4/B5: Both set boots FORCEbug + B6: Auto execute FF00C0000 + B7: memory size? +*/ +/* PIT Port definitions */ +#define BR7N9600 0x01 +#define BR7N28800 0x02 +#define BR7N38400 0x06 +#define BR7N57600 0x03 +#define BR8N38400 0x08 +#define FORCEBUG 0x30 + +READ8_MEMBER (vme_fccpu20_device::pita_r) +{ + LOG("%s\n", FUNCNAME); + return FORCEBUG | BR7N9600; +} + +/* Enabling/Disabling of VME IRQ 1-7 */ +READ8_MEMBER (vme_fccpu20_device::pitb_r) +{ + LOG("%s\n", FUNCNAME); + return 0xff; +} + +/* VME board ID bit and bus release software settings (output) (ROR, RAT, RATAR, RATBCLR, RORAT, RORRAT */ +READ8_MEMBER (vme_fccpu20_device::pitc_r) +{ + uint8_t board_id = 0; + + LOG("%s Board id:%02x\n", FUNCNAME, m_board_id); + + switch (m_board_id) + { + case cpu20: + board_id = CPU20; + break; + case cpu21a: + case cpu21ya: + case cpu21b: + case cpu21yb: + case cpu21s: + case cpu21: + board_id = CPU21; + break; + default: logerror("Attempt to set unknown board type %02x, defaulting to CPU20\n", board_id); + board_id = CPU20; + } + + return board_id | 0xbf; +} + +/* ROM definitions */ +ROM_START (fccpu20) /* This is an original rom dump */ + ROM_REGION32_BE(0x10000, "roms", 0) + ROM_LOAD32_BYTE("L.BIN", 0x000002, 0x4000, CRC (174ab801) SHA1 (0d7b8ed29d5fdd4bd2073005008120c5f20128dd)) + ROM_LOAD32_BYTE("LL.BIN", 0x000003, 0x4000, CRC (9fd9e3e4) SHA1 (e5a7c87021e6be412dd5a8166d9f62b681169eda)) + ROM_LOAD32_BYTE("U.BIN", 0x000001, 0x4000, CRC (d1afe4c0) SHA1 (b5baf9798d73632f7bb843cbc4b306c8c03f4296)) + ROM_LOAD32_BYTE("UU.BIN", 0x000000, 0x4000, CRC (b54d623b) SHA1 (49b272184a04570b09004de71fae0ed0d1bf5929)) +ROM_END + +/* These cpu-21 boards are supported by the latest cpu-20 rom */ +#define rom_fccpu21s rom_fccpu20 +#define rom_fccpu21 rom_fccpu20 +#define rom_fccpu21a rom_fccpu20 +#define rom_fccpu21ya rom_fccpu20 +#define rom_fccpu21b rom_fccpu20 +#define rom_fccpu21yb rom_fccpu20 + +const tiny_rom_entry *vme_fccpu20_device::device_rom_region() const +{ + LOG("%s\n", FUNCNAME); + + switch (m_board_id) + { + case cpu20: return ROM_NAME( fccpu20 ); break; + case cpu21a: return ROM_NAME( fccpu21a ); break; + case cpu21ya: return ROM_NAME( fccpu21ya ); break; + case cpu21b: return ROM_NAME( fccpu21b ); break; + case cpu21yb: return ROM_NAME( fccpu21yb ); break; + case cpu21s: return ROM_NAME( fccpu21s ); break; + case cpu21: return ROM_NAME( fccpu21 ); break; + default: logerror("Attempt to get rom set for unknown board type %02x, defaulting to CPU20\n", m_board_id); + return ROM_NAME( fccpu20 ); + } +} + +/* + * System ROM information + * + * FORCEbug SYS68K/CPU-20 Debugging Tool Version 1.3 22-Jan-87 + * FORCE PDOS Bootstrap , Revision 2.3 22-Jan-87 + * + * BIM setup: (reordered for improved reading) + * : 0 Reg vector <- 1f + * : 1 Reg vector <- 1c + * : 2 Reg vector <- 1d + * : 3 Reg vector <- 1c + * : 0 Reg control <- 57 - Lev:7 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 + * : 1 Reg control <- 54 - Lev:4 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 + * : 2 Reg control <- 55 - Lev:5 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 + * : 3 Reg control <- 54 - Lev:4 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 + * + * PIT setup: + * :pit Reg 0a -> 00 + * :pit Reg 00 <- 30 - PGCR - Mode 0, H34:enabled, H12:enabled, Sense assert H4:Lo, H3:Lo, H2:Lo, H1:Lo + * :pit Reg 01 <- 08 - PSSR - PC4 pin activated, PC5 pin support no interrupts, H prio mode:0 + * :pit Reg 06 <- 84 - PACR + * :pit Reg 02 <- 00 - PADDR: 00 + * :pit Reg 07 <- 84 - PBCR + * :pit Reg 09 <- ff - PBDR + * :pit Reg 03 <- ff - PBDDR: ff + * :pit Reg 0c <- 07 - PCDR + * :pit Reg 04 <- 87 - PCDDR: 87 + * :pit Reg 15 <- d8 - CPRL + * :pit Reg 14 <- 09 - CPRM + * :pit Reg 13 <- 00 - CPRH + * :pit Reg 10 <- e1 - TCR - PC3 used as TOUT and PC7 used as I/O pin, Interrupts enabled + - PC2 used as I/O pin,CLK and x32 prescaler are used + - Timer reload the preload values when reaching 0 (zero) + - Timer is enabled + * MPCC setup + * : Reg 19 <- 1e - PSR2: Byte mode, 1 Stop bit, 8 bit data, ASYNC mode + * : Reg 1c <- 8a - BRDR1: Baud Rate Divider 1 + * : Reg 1d <- 00 - BRDR1: Baud Rate Divider 2 + * : Reg 1e <- 1c - CCR: x3 Mode, TxC is output, internal RxC, ISOC + * : Reg 1f <- 00 - ECR: No parity + * : Reg 0d <- 00 - TIER: interrupts disabled + * : Reg 15 <- 00 - SIER: interrupts disabled + * : Reg 05 <- 80 - RIER: enable RDA interrupts + * : Reg 01 <- 01 - RCR: Reset receiver command + * : Reg 01 <- 00 - RCR: Reciver in normal operation + * : Reg 09 <- 01 - TCR: Reset transmitter command + * : Reg 09 <- 80 - TCR: Transmitter in normal operation + * : Reg 11 <- c0 - SICR: Assert RTS, Assert DTR + * : Reg 08 -> 80 - TSR: Tx FIFO has room + * : Reg 0a <- 0a - TDR: send 0x0a to Tx FIFO... etc + * + * TDR outputs: + * "Disk Controller installed + * Disk #0: Header sector error = 145 + * Disk #1: Header sector error = 145 + * Out of PDOS boot disk table entries. + * I'LL Retry them all." + * + */ diff --git a/src/devices/bus/vme/vme_fccpu20.h b/src/devices/bus/vme/vme_fccpu20.h new file mode 100644 index 00000000000..fd506da11ca --- /dev/null +++ b/src/devices/bus/vme/vme_fccpu20.h @@ -0,0 +1,143 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +#ifndef VME_FCCPU20_H +#define VME_FCCPU20_H +#pragma once + +#include "emu.h" + +#include "machine/68561mpcc.h" +#include "machine/68230pit.h" +#include "machine/68153bim.h" +#include "bus/vme/vme.h" + +extern const device_type VME_FCCPU20; +extern const device_type VME_FCCPU21S; +extern const device_type VME_FCCPU21; +extern const device_type VME_FCCPU21A; +extern const device_type VME_FCCPU21YA; +extern const device_type VME_FCCPU21B; +extern const device_type VME_FCCPU21YB; + +// PIT port C Board ID bits +#define CPU20 0x40 +#define CPU21 0x00 + +/* Board types */ +enum fc_board_t { + cpu20, + cpu21, + cpu21a, + cpu21ya, + cpu21b, + cpu21yb, + cpu21s +}; + +//************************************************************************** +// Base Device declaration +//************************************************************************** +class vme_fccpu20_device : public device_t, public device_vme_card_interface +{ +public: + vme_fccpu20_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, fc_board_t board_id); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual void device_start() override; + + // Below are duplicated declarations from src/mame/drivers/fccpu20.cpp + DECLARE_READ32_MEMBER (bootvect_r); + DECLARE_WRITE32_MEMBER (bootvect_w); + + DECLARE_WRITE_LINE_MEMBER(bim_irq_callback); + uint8_t bim_irq_state; + int bim_irq_level; + + /* PIT callbacks */ + DECLARE_READ8_MEMBER (pita_r); + DECLARE_READ8_MEMBER (pitb_r); + DECLARE_READ8_MEMBER (pitc_r); + +private: + required_device<cpu_device> m_maincpu; + required_device<pit68230_device> m_pit; + required_device<bim68153_device> m_bim; + required_device<mpcc68561_device> m_mpcc; + required_device<mpcc68561_device> m_mpcc2; + required_device<mpcc68561_device> m_mpcc3; + + // Pointer to System ROMs needed by bootvect_r and masking RAM buffer for post reset accesses + uint32_t *m_sysrom; + uint32_t m_sysram[2]; + void update_irq_to_maincpu(); + fc_board_t m_board_id; + + // Below replaces machine_start and machine_reset from src/mame/drivers/fccpu20.cpp +protected: + virtual void device_reset() override; +}; + +//************************************************************************** +// Board Device declarations +//************************************************************************** + +class vme_fccpu20_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu20_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu20_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu20) { } +}; + +class vme_fccpu21s_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21s_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21s_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21s) { } +}; + +class vme_fccpu21_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21) { } +}; + +class vme_fccpu21a_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21a_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21a_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21a) { } +}; + +class vme_fccpu21ya_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21ya_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21ya_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21ya) { } +}; + +class vme_fccpu21b_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21b_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21b_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21b) { } +}; + +class vme_fccpu21yb_card_device : public vme_fccpu20_device +{ +public : + vme_fccpu21yb_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + vme_fccpu21yb_card_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) + : vme_fccpu20_device( mconfig, type, name, tag, owner, clock, shortname, source, cpu21yb) { } +}; + + +#endif // VME_FCCPU20_H diff --git a/src/devices/bus/vme/vme_fcisio.cpp b/src/devices/bus/vme/vme_fcisio.cpp index 5845603f108..75d325f2c81 100644 --- a/src/devices/bus/vme/vme_fcisio.cpp +++ b/src/devices/bus/vme/vme_fcisio.cpp @@ -94,7 +94,7 @@ * * VME side A24 address map - Dual ported RAM * ---------------------------------------------------------- - * Offset Range Description + * Offset Range Description * ---------------------------------------------------------- * 000000 - 0007FF BIM * 000800 - 000FFF Status registers @@ -158,7 +158,7 @@ #endif //************************************************************************** -// GLOBAL VARIABLES +// GLOBAL VARIABLES //************************************************************************** const device_type VME_FCISIO1 = &device_creator<vme_fcisio1_card_device>; @@ -195,7 +195,7 @@ static MACHINE_CONFIG_FRAGMENT (fcisio1) MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("duscc0", duscc68562_device, rxa_w)) MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("duscc0", duscc68562_device, ctsa_w)) -// MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", fcisio_terminal) +// MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", fcisio_terminal) MCFG_DUSCC68562_ADD("duscc1", DUSCC_CLOCK, 0, 0, 0, 0 ) MCFG_DUSCC68562_ADD("duscc2", DUSCC_CLOCK, 0, 0, 0, 0 ) diff --git a/src/devices/bus/vme/vme_fcisio.h b/src/devices/bus/vme/vme_fcisio.h index 1152589e314..fc668cc276a 100644 --- a/src/devices/bus/vme/vme_fcisio.h +++ b/src/devices/bus/vme/vme_fcisio.h @@ -11,7 +11,7 @@ extern const device_type VME_FCISIO1; -class vme_fcisio1_card_device : +class vme_fcisio1_card_device : public device_t ,public device_vme_card_interface { diff --git a/src/devices/bus/vme/vme_fcscsi.cpp b/src/devices/bus/vme/vme_fcscsi.cpp index 3dcf7c17117..96e8548a86f 100644 --- a/src/devices/bus/vme/vme_fcscsi.cpp +++ b/src/devices/bus/vme/vme_fcscsi.cpp @@ -72,10 +72,10 @@ * - 68010 CPU for local control (10MHz) * - 68450 DMA Controller for local transfers (10MHz) * - Dual Ported l28Kbyte 0 wait state static RAM between the VMEbus and the local CPU - * - SCSlbus interface built with the NCR 5386S SCSlbus controller. + * - SCSlbus interface built with the NCR 5386S SCSlbus controller. * o Programmable as an initiator or target * o Transfer rate up to 1.5Mbyte/s - * - SHUGART compatible floppy interface with the WD1772 FDC. Up to 4 floppy drives can be + * - SHUGART compatible floppy interface with the WD1772 FDC. Up to 4 floppy drives can be * controlled independent of the SCSlbus * - All I/O signals available on P2 connector 4 different interrupt request signals to the VMEbus. Each * channel contains a software programmable IRQ level (1 to 7) and vector @@ -102,7 +102,7 @@ * * VME side A24 address map - Dual ported RAM * ---------------------------------------------------------- - * Default Range Description + * Default Range Description * ---------------------------------------------------------- * A00000 - A00000 Status word Bits 8:RESET 9:HALT 10:WD * A00001 - A0000F BIM - See below @@ -176,7 +176,7 @@ #endif //************************************************************************** -// GLOBAL VARIABLES +// GLOBAL VARIABLES //************************************************************************** const device_type VME_FCSCSI1 = &device_creator<vme_fcscsi1_card_device>; diff --git a/src/devices/bus/vme/vme_fcscsi.h b/src/devices/bus/vme/vme_fcscsi.h index 719f12df5b6..91b65a91552 100644 --- a/src/devices/bus/vme/vme_fcscsi.h +++ b/src/devices/bus/vme/vme_fcscsi.h @@ -11,7 +11,7 @@ extern const device_type VME_FCSCSI1; -class vme_fcscsi1_card_device : +class vme_fcscsi1_card_device : public device_t ,public device_vme_card_interface { diff --git a/src/devices/bus/vme/vme_mvme350.cpp b/src/devices/bus/vme/vme_mvme350.cpp index 69afff9490a..b4caeb65ab9 100644 --- a/src/devices/bus/vme/vme_mvme350.cpp +++ b/src/devices/bus/vme/vme_mvme350.cpp @@ -155,7 +155,7 @@ #endif //************************************************************************** -// GLOBAL VARIABLES +// GLOBAL VARIABLES //************************************************************************** const device_type VME_MVME350 = &device_creator<vme_mvme350_card_device>; @@ -178,8 +178,8 @@ static ADDRESS_MAP_START( mvme350_mem, AS_PROGRAM, 16, vme_mvme350_card_device ) ADDRESS_MAP_END //------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations +// machine_config_additions - device-specific +// machine configurations //------------------------------------------------- MACHINE_CONFIG_FRAGMENT( mvme350 ) @@ -236,10 +236,10 @@ void vme_mvme350_card_device::device_start() /* From MVME166 Single Board Computer Installation Guide: Controller Type First board Second board - CLUN Address CLUN Address + CLUN Address CLUN Address --------------------------------------------------- MVME350 - Streaming $04 $FFFF5000 $05 $FFFF5100 - Tape Controller + Tape Controller --------------------------------------------------- */ uint32_t base = 0xFFFF5000; diff --git a/src/devices/bus/vme/vme_mvme350.h b/src/devices/bus/vme/vme_mvme350.h index 5d79fa3d306..54aecc1ec82 100644 --- a/src/devices/bus/vme/vme_mvme350.h +++ b/src/devices/bus/vme/vme_mvme350.h @@ -8,7 +8,7 @@ extern const device_type VME_MVME350; -class vme_mvme350_card_device : +class vme_mvme350_card_device : public device_t ,public device_vme_card_interface { @@ -21,8 +21,8 @@ public: virtual const tiny_rom_entry *device_rom_region() const override; // Shared memory methods to be exported to the VME bus -// virtual DECLARE_READ16_MEMBER (read16) override; -// virtual DECLARE_WRITE16_MEMBER (write16) override; +// virtual DECLARE_READ16_MEMBER (read16) override; +// virtual DECLARE_WRITE16_MEMBER (write16) override; protected: virtual void device_start() override; virtual void device_reset() override; diff --git a/src/devices/bus/vme/vme_mzr8105.cpp b/src/devices/bus/vme/vme_mzr8105.cpp index 8239c0992f1..9b3813ee488 100644 --- a/src/devices/bus/vme/vme_mzr8105.cpp +++ b/src/devices/bus/vme/vme_mzr8105.cpp @@ -27,14 +27,14 @@ #endif //************************************************************************** -// GLOBAL VARIABLES +// GLOBAL VARIABLES //************************************************************************** const device_type VME_MZR8105 = &device_creator<vme_mzr8105_card_device>; //------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations +// machine_config_additions - device-specific +// machine configurations //------------------------------------------------- MACHINE_CONFIG_EXTERN( mzr8105 ); diff --git a/src/devices/bus/vme/vme_mzr8300.cpp b/src/devices/bus/vme/vme_mzr8300.cpp index 04ddd02636e..550cf2f3c2d 100644 --- a/src/devices/bus/vme/vme_mzr8300.cpp +++ b/src/devices/bus/vme/vme_mzr8300.cpp @@ -6,15 +6,15 @@ * * 23/09/2015 * - * This device was drycoded based on OS9 boot strap code on a Mizar mz8105 board + * This device was drycoded based on OS9 boot strap code on a Mizar mz8105 board * which expects to find a SIO on the VME bus + photos of a Mizar 8300 board on Ebay * I have found no formal documents for this board so far, so needs verification. - * - * || - * || - * || - * || - * ||____________________________________________________________ ___ + * + * || + * || + * || + * || + * ||____________________________________________________________ ___ * \+++====|| U2|AM26LS32| | NEC | |74LS04N||74LS645 ||_| | * \=/- o|| +--------+ | D7201C | ++-----+++----------+| | | * | | || +-------+ +--------------------+ | | |SN74LS374N|| | | @@ -32,14 +32,14 @@ * /=\- o||J1 K1 U4| xxx | xxx | 74LS164| K6 |AM25LS2521|| | | * /+++====|| J2 +-------+--------+--------+--------+ +----------+|_| | * ||Rev G U3| MC1488| MC1488 | 74LS161| 74F85 | K8 | |___| - * ||-----------+-------+----------------------------------------- - * || - * || + * ||-----------+-------+----------------------------------------- + * || + * || * * - * Misc links about this board: + * Misc links about this board: * http://www.ebay.com/itm/MIZAR-INC-8300-0-01-REV-J-INTERFACE-CONTROL-BOARD-W-RIBBON-AND-PLATE-/231508658429?hash=item35e6fdc8fd - * + * * Description * ------------ * The Mizar mz8300 is a Quad Serial board. @@ -52,8 +52,8 @@ * -------------------------------------------------------------------------- * Local VME Decscription * ------------------------------------------------------------------------- - * n/a 0xff0000 0xff0003 mzr8105.c Bootstrap expects to find a - * UPD7201 serial device here - configurable! + * n/a 0xff0000 0xff0003 mzr8105.c Bootstrap expects to find a + * UPD7201 serial device here - configurable! * -------------------------------------------------------------------------- * * Interrupt sources MVME @@ -61,15 +61,15 @@ * Description Device Lvl IRQ VME board * /Board Vector Address * ---------------------------------------------------------- - * On board Sources - * + * On board Sources + * * Off board Sources (other VME boards) * * ---------------------------------------------------------- * * DMAC Channel Assignments * ---------------------------------------------------------- - * Channel + * Channel * ---------------------------------------------------------- * * TODO: @@ -110,7 +110,7 @@ #endif //************************************************************************** -// GLOBAL VARIABLES +// GLOBAL VARIABLES //************************************************************************** const device_type VME_MZR8300 = &device_creator<vme_mzr8300_card_device>; @@ -135,8 +135,8 @@ MACHINE_CONFIG_FRAGMENT( mzr8300 ) MACHINE_CONFIG_END //------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations +// machine_config_additions - device-specific +// machine configurations //------------------------------------------------- diff --git a/src/devices/bus/vme/vme_mzr8300.h b/src/devices/bus/vme/vme_mzr8300.h index 73482cb5b77..b7145037073 100644 --- a/src/devices/bus/vme/vme_mzr8300.h +++ b/src/devices/bus/vme/vme_mzr8300.h @@ -8,7 +8,7 @@ extern const device_type VME_MZR8300; -class vme_mzr8300_card_device : +class vme_mzr8300_card_device : public device_t ,public device_vme_card_interface { @@ -19,8 +19,8 @@ public: // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; -// virtual DECLARE_READ8_MEMBER (read8) override; -// virtual DECLARE_WRITE8_MEMBER (write8) override; +// virtual DECLARE_READ8_MEMBER (read8) override; +// virtual DECLARE_WRITE8_MEMBER (write8) override; protected: virtual void device_start() override; virtual void device_reset() override; diff --git a/src/devices/cpu/amis2000/amis2000.cpp b/src/devices/cpu/amis2000/amis2000.cpp index a9b45e865b3..c79c858780c 100644 --- a/src/devices/cpu/amis2000/amis2000.cpp +++ b/src/devices/cpu/amis2000/amis2000.cpp @@ -55,15 +55,15 @@ ADDRESS_MAP_END // device definitions -amis2000_cpu_device::amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +amis2000_cpu_device::amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : amis2000_base_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, 2, 10, 3, 13, ADDRESS_MAP_NAME(program_1k), 6, ADDRESS_MAP_NAME(data_64x4), "amis2000", __FILE__) { } -amis2150_cpu_device::amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +amis2150_cpu_device::amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : amis2000_base_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__) { } -amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : amis2000_base_device(mconfig, AMI_S2152, "AMI S2152", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2152", __FILE__) { } @@ -89,7 +89,7 @@ void amis2000_base_device::state_string_export(const device_state_entry &entry, } } -offs_t amis2000_base_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t amis2000_base_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(amis2000); return CPU_DISASSEMBLE_NAME(amis2000)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/amis2000/amis2000.h b/src/devices/cpu/amis2000/amis2000.h index 76190cb3090..f72e5a5322d 100644 --- a/src/devices/cpu/amis2000/amis2000.h +++ b/src/devices/cpu/amis2000/amis2000.h @@ -14,25 +14,25 @@ // generic input pins (4 bits each) #define MCFG_AMI_S2000_READ_K_CB(_devcb) \ - amis2000_base_device::set_read_k_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_read_k_callback(*device, DEVCB_##_devcb); #define MCFG_AMI_S2000_READ_I_CB(_devcb) \ - amis2000_base_device::set_read_i_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_read_i_callback(*device, DEVCB_##_devcb); // 8-bit external databus coupled as input/output pins #define MCFG_AMI_S2000_READ_D_CB(_devcb) \ - amis2000_base_device::set_read_d_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_read_d_callback(*device, DEVCB_##_devcb); #define MCFG_AMI_S2000_WRITE_D_CB(_devcb) \ - amis2000_base_device::set_write_d_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_write_d_callback(*device, DEVCB_##_devcb); // 13-bit external address bus coupled as output pins #define MCFG_AMI_S2000_WRITE_A_CB(_devcb) \ - amis2000_base_device::set_write_a_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_write_a_callback(*device, DEVCB_##_devcb); // F_out pin (only for S2152) #define MCFG_AMI_S2152_FOUT_CB(_devcb) \ - amis2000_base_device::set_write_f_callback(*device, DEVCB_##_devcb); + devcb = &amis2000_base_device::set_write_f_callback(*device, DEVCB_##_devcb); // S2000 has a hardcoded 7seg table, that (unlike S2200) is officially // uncustomizable, but wildfire proves to be an exception to that rule. @@ -44,7 +44,7 @@ class amis2000_base_device : public cpu_device { public: // construction/destruction - amis2000_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t bu_bits, uint8_t callstack_bits, uint8_t callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + amis2000_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 bu_bits, u8 callstack_bits, u8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program) , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data) @@ -67,7 +67,7 @@ public: template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_d.set_callback(object); } template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_a.set_callback(object); } template<class _Object> static devcb_base &set_write_f_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_f.set_callback(object); } - static void set_7seg_table(device_t &device, const uint8_t *ptr) { downcast<amis2000_base_device &>(device).m_7seg_table = ptr; } + static void set_7seg_table(device_t &device, const u8 *ptr) { downcast<amis2000_base_device &>(device).m_7seg_table = ptr; } protected: // device-level overrides @@ -75,20 +75,20 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle - virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 4); } // " - virtual uint32_t execute_min_cycles() const override { return 1; } - virtual uint32_t execute_max_cycles() const override { return 2; } - virtual uint32_t execute_input_lines() const override { return 1; } + virtual u64 execute_clocks_to_cycles(u64 clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle + virtual u64 execute_cycles_to_clocks(u64 cycles) const override { return (cycles * 4); } // " + virtual u32 execute_min_cycles() const override { return 1; } + virtual u32 execute_max_cycles() const override { return 2; } + virtual u32 execute_input_lines() const override { return 1; } virtual void execute_run() override; // 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 1; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 1; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual u32 disasm_min_opcode_bytes() const override { return 1; } + virtual u32 disasm_max_opcode_bytes() const override { return 1; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; // device_state_interface overrides virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; @@ -98,33 +98,33 @@ protected: address_space *m_program; address_space *m_data; - uint8_t m_bu_bits; - uint16_t m_bu_mask; - uint8_t m_callstack_bits; // number of program counter bits held in callstack - uint16_t m_callstack_mask; - uint8_t m_callstack_depth; // callstack levels: 3 on 2000/2150, 5 on 2200/2400 - uint16_t m_callstack[5]; // max 5 + u8 m_bu_bits; + u16 m_bu_mask; + u8 m_callstack_bits; // number of program counter bits held in callstack + u16 m_callstack_mask; + u8 m_callstack_depth; // callstack levels: 3 on 2000/2150, 5 on 2200/2400 + u16 m_callstack[5]; // max 5 int m_icount; - uint16_t m_pc; // 13-bit program counter - uint8_t m_ppr; // prepared page register (PP 1) - uint8_t m_pbr; // prepared bank register (PP 2) - bool m_skip; // skip next opcode, including PP prefixes - uint8_t m_op; - uint8_t m_prev_op; // previous opcode, needed for PP, LAI, LB* - uint8_t m_f; // generic flags: 2 on 2000/2150, 6 on 2200/2400 - uint8_t m_carry; // carry flag - uint8_t m_bl; // 4-bit ram index x - uint8_t m_bu; // 2/3-bit ram index y - uint8_t m_acc; // 4-bit accumulator - uint8_t m_e; // 4-bit generic register - uint8_t m_ki_mask; // 4-bit k/i-pins select latch - uint8_t m_d; // 8-bit d-pins latch - bool m_d_active; // d-pins available for direct i/o(floating), or outputting d-latch - uint8_t m_d_polarity; // invert d-latch output - uint16_t m_a; // 13-bit a-pins latch (master strobe latch) + u16 m_pc; // 13-bit program counter + u8 m_ppr; // prepared page register (PP 1) + u8 m_pbr; // prepared bank register (PP 2) + bool m_skip; // skip next opcode, including PP prefixes + u8 m_op; + u8 m_prev_op; // previous opcode, needed for PP, LAI, LB* + u8 m_f; // generic flags: 2 on 2000/2150, 6 on 2200/2400 + u8 m_carry; // carry flag + u8 m_bl; // 4-bit ram index x + u8 m_bu; // 2/3-bit ram index y + u8 m_acc; // 4-bit accumulator + u8 m_e; // 4-bit generic register + u8 m_ki_mask; // 4-bit k/i-pins select latch + u8 m_d; // 8-bit d-pins latch + bool m_d_active; // d-pins available for direct i/o(floating), or outputting d-latch + u8 m_d_polarity; // invert d-latch output + u16 m_a; // 13-bit a-pins latch (master strobe latch) // i/o handlers - const uint8_t *m_7seg_table; + const u8 *m_7seg_table; devcb_read8 m_read_k; devcb_read8 m_read_i; devcb_read8 m_read_d; @@ -133,8 +133,8 @@ protected: devcb_write_line m_write_f; // misc internal helpers - uint8_t ram_r(); - void ram_w(uint8_t data); + u8 ram_r(); + void ram_w(u8 data); void pop_callstack(); void push_callstack(); void d_latch_out(bool active); @@ -203,21 +203,21 @@ protected: class amis2000_cpu_device : public amis2000_base_device { public: - amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class amis2150_cpu_device : public amis2000_base_device { public: - amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class amis2152_cpu_device : public amis2000_base_device { public: - amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides @@ -225,7 +225,7 @@ protected: virtual void device_reset() override; // digital-to-frequency converter - uint8_t m_d2f_latch; + u8 m_d2f_latch; emu_timer *m_d2f_timer; int m_fout_state; diff --git a/src/devices/cpu/amis2000/amis2000d.cpp b/src/devices/cpu/amis2000/amis2000d.cpp index 2dd3433718f..adf5e2ed338 100644 --- a/src/devices/cpu/amis2000/amis2000d.cpp +++ b/src/devices/cpu/amis2000/amis2000d.cpp @@ -32,7 +32,7 @@ static const char *const s_mnemonics[] = }; // number of bits per opcode parameter, negative indicates complement -static const int8_t s_bits[] = +static const s8 s_bits[] = { 0, 0, 4, 2, 2, 2, 2, 0, 0, 0, -2, -2, -2, -2, 2, 2, @@ -45,7 +45,7 @@ static const int8_t s_bits[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t s_flags[] = +static const u32 s_flags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -56,7 +56,7 @@ static const uint32_t s_flags[] = }; -static const uint8_t s2000_mnemonic[0x100] = +static const u8 s2000_mnemonic[0x100] = { /* 0x00 */ mNOP, mHALT, mRT, mRTS, mPSH, mPSL, mAND, mSOS, @@ -103,8 +103,8 @@ static const uint8_t s2000_mnemonic[0x100] = CPU_DISASSEMBLE(amis2000) { int pos = 0; - uint8_t op = oprom[pos++]; - uint8_t instr = s2000_mnemonic[op]; + u8 op = oprom[pos++]; + u8 instr = s2000_mnemonic[op]; util::stream_format(stream, "%-5s ", s_mnemonics[instr]); @@ -117,7 +117,7 @@ CPU_DISASSEMBLE(amis2000) if (mask != 0) { - uint8_t param = op; + u8 param = op; if (complement) param = ~param; param &= mask; diff --git a/src/devices/cpu/amis2000/amis2000op.cpp b/src/devices/cpu/amis2000/amis2000op.cpp index 2962f5327cc..685be166c3e 100644 --- a/src/devices/cpu/amis2000/amis2000op.cpp +++ b/src/devices/cpu/amis2000/amis2000op.cpp @@ -8,15 +8,15 @@ // internal helpers -inline uint8_t amis2000_base_device::ram_r() +inline u8 amis2000_base_device::ram_r() { - uint16_t address = m_bu << 4 | m_bl; + u16 address = m_bu << 4 | m_bl; return m_data->read_byte(address) & 0xf; } -inline void amis2000_base_device::ram_w(uint8_t data) +inline void amis2000_base_device::ram_w(u8 data) { - uint16_t address = m_bu << 4 | m_bl; + u16 address = m_bu << 4 | m_bl; m_data->write_byte(address, data & 0xf); } @@ -49,7 +49,7 @@ void amis2000_base_device::op_lai() // note: only execute the first one in a sequence of LAI if ((m_prev_op & 0xf0) != (m_op & 0xf0)) { - uint8_t param = m_op & 0x0f; + u8 param = m_op & 0x0f; m_acc = param; m_ki_mask = param; } @@ -70,7 +70,7 @@ void amis2000_base_device::op_lae() void amis2000_base_device::op_xab() { // XAB: exchange ACC with BL - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = m_bl; m_bl = old_acc; } @@ -78,7 +78,7 @@ void amis2000_base_device::op_xab() void amis2000_base_device::op_xabu() { // XABU: exchange ACC with BU - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = (m_acc & ~m_bu_mask) | (m_bu & m_bu_mask); m_bu = old_acc & m_bu_mask; } @@ -86,7 +86,7 @@ void amis2000_base_device::op_xabu() void amis2000_base_device::op_xae() { // XAE: exchange ACC with E - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = m_e; m_e = old_acc; } @@ -97,7 +97,7 @@ void amis2000_base_device::op_lbe() // note: only execute the first one in a sequence of LB* if ((m_prev_op & 0xf0) != (m_op & 0xf0)) { - uint8_t param = m_op & 0x03; + u8 param = m_op & 0x03; m_bu = param & m_bu_mask; m_bl = m_e; } @@ -109,7 +109,7 @@ void amis2000_base_device::op_lbep() // note: only execute the first one in a sequence of LB* if ((m_prev_op & 0xf0) != (m_op & 0xf0)) { - uint8_t param = m_op & 0x03; + u8 param = m_op & 0x03; m_bu = param & m_bu_mask; m_bl = (m_e + 1) & 0xf; } @@ -121,7 +121,7 @@ void amis2000_base_device::op_lbz() // note: only execute the first one in a sequence of LB* if ((m_prev_op & 0xf0) != (m_op & 0xf0)) { - uint8_t param = m_op & 0x03; + u8 param = m_op & 0x03; m_bu = param & m_bu_mask; m_bl = 0; } @@ -133,7 +133,7 @@ void amis2000_base_device::op_lbf() // note: only execute the first one in a sequence of LB* if ((m_prev_op & 0xf0) != (m_op & 0xf0)) { - uint8_t param = m_op & 0x03; + u8 param = m_op & 0x03; m_bu = param & m_bu_mask; m_bl = 0xf; } @@ -146,17 +146,17 @@ void amis2000_base_device::op_lam() { // LAM _Y: load ACC with RAM, xor BU with _Y m_acc = ram_r(); - uint8_t param = ~m_op & 0x03; + u8 param = ~m_op & 0x03; m_bu ^= (param & m_bu_mask); } void amis2000_base_device::op_xc() { // XC _Y: exchange ACC with RAM, xor BU with _Y - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = ram_r(); ram_w(old_acc); - uint8_t param = ~m_op & 0x03; + u8 param = ~m_op & 0x03; m_bu ^= (param & m_bu_mask); } @@ -179,14 +179,14 @@ void amis2000_base_device::op_xcd() void amis2000_base_device::op_stm() { // STM Z: set RAM bit Z - uint8_t param = 1 << (m_op & 0x03); + u8 param = 1 << (m_op & 0x03); ram_w(ram_r() | param); } void amis2000_base_device::op_rsm() { // RSM Z: reset RAM bit Z - uint8_t param = 1 << (m_op & 0x03); + u8 param = 1 << (m_op & 0x03); ram_w(ram_r() & ~param); } @@ -196,7 +196,7 @@ void amis2000_base_device::op_rsm() void amis2000_base_device::op_inp() { // INP: input D-pins to ACC and RAM - uint8_t in = m_d_active ? m_d : m_read_d(0, 0xff); + u8 in = m_d_active ? m_d : m_read_d(0, 0xff); m_acc = in & 0xf; ram_w(in >> 4 & 0xf); } @@ -217,12 +217,12 @@ void amis2000_base_device::op_disb() void amis2000_base_device::op_disn() { // DISN: set D-latch to ACC+carry via on-die segment decoder - static const uint8_t lut_segment_decoder[0x10] = + static const u8 lut_segment_decoder[0x10] = { // 0-F digits in bit order [DP]abcdefg 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47 }; - const uint8_t *ptr = (m_7seg_table != nullptr) ? m_7seg_table : lut_segment_decoder; + const u8 *ptr = (m_7seg_table != nullptr) ? m_7seg_table : lut_segment_decoder; m_d = ptr[m_acc] | (m_carry ? 0x80 : 0x00); d_latch_out(true); } @@ -301,7 +301,7 @@ void amis2000_base_device::op_eur() void amis2000_base_device::op_pp() { // PP _X: prepare page/bank with _X - uint8_t param = ~m_op & 0x0f; + u8 param = ~m_op & 0x0f; if ((m_prev_op & 0xf0) != (m_op & 0xf0)) m_ppr = param; else @@ -311,8 +311,8 @@ void amis2000_base_device::op_pp() void amis2000_base_device::op_jmp() { // JMP X: jump to X(+PP) - uint16_t mask = 0x3f; - uint16_t param = m_op & mask; + u16 mask = 0x3f; + u16 param = m_op & mask; // if previous opcode was PP, change PC high bits too if ((m_prev_op & 0xf0) == 0x60) @@ -371,7 +371,7 @@ void amis2000_base_device::op_szc() void amis2000_base_device::op_szm() { // SZM Z: skip next on zero RAM bit Z - uint8_t param = 1 << (m_op & 0x03); + u8 param = 1 << (m_op & 0x03); m_skip = !(ram_r() & param); } @@ -432,7 +432,7 @@ void amis2000_base_device::op_adcs() void amis2000_base_device::op_adis() { // ADIS X: add X to ACC, skip next on not carry - uint8_t param = m_op & 0x0f; + u8 param = m_op & 0x0f; m_acc += param; m_skip = !(m_acc & 0x10); m_acc &= 0xf; diff --git a/src/devices/cpu/clipper/clipper.cpp b/src/devices/cpu/clipper/clipper.cpp new file mode 100644 index 00000000000..3c4741d39dd --- /dev/null +++ b/src/devices/cpu/clipper/clipper.cpp @@ -0,0 +1,1401 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * An implementation of the Fairchild/Intergraph CLIPPER CPU family. + * + * Primary source: http://bitsavers.trailing-edge.com/pdf/fairchild/clipper/Clipper_Instruction_Set_Oct85.pdf + * + * TODO: + * - save/restore state + * - unimplemented instructions + * - C100, C300, C400 variants + * - correct boot logic + * - condition codes for multiply instructions + * - most cpu traps/faults + * - instruction timing + * - big endian support (not present in the wild) + */ + +#include "emu.h" +#include "debugger.h" +#include "clipper.h" + +#define VERBOSE 0 +#if VERBOSE +#define LOG_INTERRUPT(...) logerror(__VA_ARGS__) +#else +#define LOG_INTERRUPT(...) +#endif + +const device_type CLIPPER_C100 = &device_creator<clipper_c100_device>; +const device_type CLIPPER_C300 = &device_creator<clipper_c300_device>; +const device_type CLIPPER_C400 = &device_creator<clipper_c400_device>; + +clipper_c100_device::clipper_c100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : clipper_device(mconfig, CLIPPER_C100, "C100 CLIPPER", tag, owner, clock, "C100", __FILE__) { } + +clipper_c300_device::clipper_c300_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : clipper_device(mconfig, CLIPPER_C300, "C300 CLIPPER", tag, owner, clock, "C300", __FILE__) { } + +clipper_c400_device::clipper_c400_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : clipper_device(mconfig, CLIPPER_C400, "C400 CLIPPER", tag, owner, clock, "C400", __FILE__) { } + +clipper_device::clipper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) + : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), + m_pc(0), + m_r(m_rs), + m_insn_config("insn", ENDIANNESS_LITTLE, 32, 32, 0), + m_data_config("data", ENDIANNESS_LITTLE, 32, 32, 0), + m_insn(nullptr), + m_data(nullptr), + m_icount(0) +{ +} + +// rotate helpers to replace MSVC intrinsics +inline u32 rotl32(u32 x, u8 shift) +{ + shift &= 31; + return (x << shift) | (x >> ((32 - shift) & 31)); +} + +inline u32 rotr32(u32 x, u8 shift) +{ + shift &= 31; + return (x >> shift) | (x << ((32 - shift) & 31)); +} + +inline u64 rotl64(u64 x, u8 shift) +{ + shift &= 63; + return (x << shift) | (x >> ((64 - shift) & 63)); +} + +inline u64 rotr64(u64 x, u8 shift) +{ + shift &= 63; + return (x >> shift) | (x << ((64 - shift) & 63)); +} + +void clipper_device::device_start() +{ + // get our address spaces + m_insn = &space(AS_PROGRAM); + m_data = &space(AS_DATA); + + // set our instruction counter + m_icountptr = &m_icount; + + //save_item(NAME(m_pc)); + + state_add(STATE_GENPC, "GENPC", m_pc).noshow(); + state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow(); + state_add(STATE_GENSP, "GENSP", m_r[15]).noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_psw).mask(0xf).formatstr("%4s").noshow(); + + state_add(CLIPPER_PC, "pc", m_pc); + state_add(CLIPPER_PSW, "psw", m_psw); + state_add(CLIPPER_SSW, "ssw", m_ssw); + + state_add(CLIPPER_R0, "r0", m_r[0]); + state_add(CLIPPER_R1, "r1", m_r[1]); + state_add(CLIPPER_R2, "r2", m_r[2]); + state_add(CLIPPER_R3, "r3", m_r[3]); + state_add(CLIPPER_R4, "r4", m_r[4]); + state_add(CLIPPER_R5, "r5", m_r[5]); + state_add(CLIPPER_R6, "r6", m_r[6]); + state_add(CLIPPER_R7, "r7", m_r[7]); + state_add(CLIPPER_R8, "r8", m_r[8]); + state_add(CLIPPER_R9, "r9", m_r[9]); + state_add(CLIPPER_R10, "r10", m_r[10]); + state_add(CLIPPER_R11, "r11", m_r[11]); + state_add(CLIPPER_R12, "r12", m_r[12]); + state_add(CLIPPER_R13, "r13", m_r[13]); + state_add(CLIPPER_R14, "r14", m_r[14]); + state_add(CLIPPER_R15, "r15", m_r[15]); + + state_add(CLIPPER_F0, "f0", m_f[0]); + state_add(CLIPPER_F1, "f1", m_f[1]); + state_add(CLIPPER_F2, "f2", m_f[2]); + state_add(CLIPPER_F3, "f3", m_f[3]); + state_add(CLIPPER_F4, "f4", m_f[4]); + state_add(CLIPPER_F5, "f5", m_f[5]); + state_add(CLIPPER_F6, "f6", m_f[6]); + state_add(CLIPPER_F7, "f7", m_f[7]); + + // C400 has 8 additional floating point registers + if (type() == CLIPPER_C400) + { + state_add(CLIPPER_F8, "f8", m_f[8]); + state_add(CLIPPER_F9, "f9", m_f[9]); + state_add(CLIPPER_F10, "f10", m_f[10]); + state_add(CLIPPER_F11, "f11", m_f[11]); + state_add(CLIPPER_F12, "f12", m_f[12]); + state_add(CLIPPER_F13, "f13", m_f[13]); + state_add(CLIPPER_F14, "f14", m_f[14]); + state_add(CLIPPER_F15, "f15", m_f[15]); + } +} + +void clipper_device::device_reset() +{ + /* + * From C300 documentation, on reset: + * psw: T cleared, BIG set from hardware, others undefined + * ssw: EI, TP, M, U, K, KU, UU, P cleared, ID set from hardware, others undefined + */ + m_psw = 0; + m_ssw = 0; + + m_r = SSW(U) ? m_ru : m_rs; + + // we'll opt to clear the integer and floating point registers too + memset(m_r, 0, sizeof(s32)*16); + memset(m_f, 0, sizeof(m_f)); + + // FIXME: figure out how to branch to the boot code properly + m_pc = 0x7f100000; + m_irq = 0; + m_nmi = 0; +} + +void clipper_device::state_string_export(const device_state_entry &entry, std::string &str) const +{ + switch (entry.index()) + { + case STATE_GENFLAGS: + str = string_format("%c%c%c%c", + PSW(C) ? 'C' : '.', + PSW(V) ? 'V' : '.', + PSW(Z) ? 'Z' : '.', + PSW(N) ? 'N' : '.'); + break; + } +} + +void clipper_device::execute_run() +{ + u16 insn; + + // check for non-maskable and prioritised interrupts + if (m_nmi) + { + // acknowledge non-maskable interrupt + standard_irq_callback(INPUT_LINE_NMI); + + LOG_INTERRUPT("non-maskable interrupt - current pc = 0x%08x\n", m_pc); + m_pc = intrap(EXCEPTION_INTERRUPT_BASE, m_pc); + } + else if (SSW(EI) && m_irq) + { + // FIXME: sample interrupt vector from the bus without acknowledging the interrupt + u8 ivec = standard_irq_callback(-1); + LOG_INTERRUPT("received prioritised interrupt with vector 0x%04x\n", ivec); + + // allow equal/higher priority interrupts + if ((ivec >> 4) <= SSW(IL)) + { + // acknowledge interrupt + standard_irq_callback(INPUT_LINE_IRQ0); + + LOG_INTERRUPT("accepting interrupt vector 0x%04x - current pc = %08x\n", ivec, m_pc); + m_pc = intrap(EXCEPTION_INTERRUPT_BASE + ivec * 8, m_pc); + } + } + + while (m_icount > 0) { + + debugger_instruction_hook(this, m_pc); + + // fetch instruction word + insn = m_insn->read_word(m_pc + 0); + + decode_instruction(insn); + + // decode and execute instruction, return next pc + m_pc = execute_instruction(); + + // FIXME: some instructions take longer (significantly) than one cycle + // and also the timings are often slower for the C100 and C300 + m_icount--; + } +} + +void clipper_device::execute_set_input(int inputnum, int state) +{ + switch (inputnum) + { + case INPUT_LINE_IRQ0: + m_irq = state; + break; + + case INPUT_LINE_NMI: + m_nmi = state; + break; + } +} + +/* + * The CLIPPER has a true Harvard architecture. In the InterPro, these are tied back together + * again by the MMU, which then directs the access to one of 3 address spaces: main, i/o or boot. + */ +const address_space_config *clipper_device::memory_space_config(address_spacenum spacenum) const +{ + switch (spacenum) + { + case AS_PROGRAM: return &m_insn_config; + case AS_DATA: return &m_data_config; + default: break; + } + + return nullptr; +} + +/* + * This function decodes instruction operands and computes effective addresses (for + * instructions with addressing modes). The results are contained in the m_info + * structure to simplify passing between here and execute_instruction(). + */ +void clipper_device::decode_instruction (u16 insn) +{ + // decode the primary parcel + m_info.opcode = insn >> 8; + m_info.subopcode = insn & 0xff; + m_info.r1 = (insn & 0x00f0) >> 4; + m_info.r2 = insn & 0x000f; + + // initialise the other fields + m_info.imm = 0; + m_info.macro = 0; + m_info.size = 0; + m_info.address = 0; + + if ((insn & 0xf800) == 0x3800) + { + // instruction has a 16 bit immediate operand + + // fetch 16 bit immediate and sign extend + m_info.imm = (s16)m_insn->read_word(m_pc + 2); + m_info.size = 4; + } + else if ((insn & 0xd300) == 0x8300) + { + // instruction has an immediate operand, either 16 or 32 bit + if (insn & 0x0080) + { + // fetch 16 bit immediate and sign extend + m_info.imm = (s16)m_insn->read_word(m_pc + 2); + m_info.size = 4; + } + else + { + // fetch 32 bit immediate and sign extend + m_info.imm = (s32)m_insn->read_dword_unaligned(m_pc + 2); + m_info.size = 6; + } + } + else if ((insn & 0xc000) == 0x4000) + { + // instructions with addresses + if (insn & 0x0100) + { + // instructions with complex modes + u16 temp; + + switch (insn & 0x00f0) + { + case ADDR_MODE_PC32: + m_info.address = m_pc + (s32)m_insn->read_dword_unaligned(m_pc + 2); + m_info.size = 6; + break; + + case ADDR_MODE_ABS32: + m_info.address = m_insn->read_dword_unaligned(m_pc + 2); + m_info.size = 6; + break; + + case ADDR_MODE_REL32: + m_info.r2 = m_insn->read_word(m_pc + 2) & 0xf; + m_info.address = m_r[insn & 0xf] + (s32)m_insn->read_dword_unaligned(m_pc + 4); + m_info.size = 8; + break; + + case ADDR_MODE_PC16: + m_info.address = m_pc + (s16)m_insn->read_word(m_pc + 2); + m_info.size = 4; + break; + + case ADDR_MODE_REL12: + temp = m_insn->read_word(m_pc + 2); + + m_info.r2 = temp & 0xf; + m_info.address = m_r[insn & 0xf] + ((s16)temp >> 4); + m_info.size = 4; + break; + + case ADDR_MODE_ABS16: + m_info.address = (s16)m_insn->read_word(m_pc + 2); + m_info.size = 4; + break; + + case ADDR_MODE_PCX: + temp = m_insn->read_word(m_pc + 2); + + m_info.r2 = temp & 0xf; + m_info.address = m_pc + m_r[(temp >> 4) & 0xf]; + m_info.size = 4; + break; + + case ADDR_MODE_RELX: + temp = m_insn->read_word(m_pc + 2); + + m_info.r2 = temp & 0xf; + m_info.address = m_r[insn & 0xf] + m_r[(temp >> 4) & 0xf]; + m_info.size = 4; + break; + + default: + logerror("illegal addressing mode pc = 0x%08x\n", m_pc); + machine().debug_break(); + break; + } + } + else + { + // relative addressing mode + m_info.address = m_r[m_info.r1]; + m_info.size = 2; + } + } + else if ((insn & 0xfd00) == 0xb400) + { + // macro instructions + m_info.macro = m_insn->read_word(m_pc + 2); + m_info.size = 4; + } + else + // all other instruction formats are 16 bits + m_info.size = 2; +} + +int clipper_device::execute_instruction () +{ + // the address of the next instruction + u32 next_pc; + + // next instruction follows the current one by default, but + // may be changed for branch, call or trap instructions + next_pc = m_pc + m_info.size; + + switch (m_info.opcode) + { + case 0x00: // noop + break; + + case 0x10: + // movwp: move word to processor register + // treated as a noop if target ssw in user mode + // R1 == 3 means "fast" mode - avoids pipeline flush + if (R1 == 0) + m_psw = m_r[R2]; + else if (!SSW(U) && (R1 == 1 || R1 == 3)) + { + m_ssw = m_r[R2]; + m_r = SSW(U) ? m_ru : m_rs; + } + // FLAGS: CVZN + break; + case 0x11: + // movpw: move processor register to word + switch (R1) + { + case 0: m_r[R2] = m_psw; break; + case 1: m_r[R2] = m_ssw; break; + } + break; + case 0x12: + // calls: call supervisor + next_pc = intrap(EXCEPTION_SUPERVISOR_CALL_BASE + (m_info.subopcode & 0x7f) * 8, next_pc); + break; + case 0x13: + // ret: return from subroutine + next_pc = m_data->read_dword(m_r[R2]); + m_r[R2] += 4; + // TRAPS: C,U,A,P,R + break; + case 0x14: + // pushw: push word + m_r[R1] -= 4; + m_data->write_dword(m_r[R1], m_r[R2]); + // TRAPS: A,P,W + break; + + case 0x16: + // popw: pop word + m_r[R2] = m_data->read_dword(m_r[R1]); + m_r[R1] += 4; + // TRAPS: C,U,A,P,R + break; + + case 0x20: + // adds: add single floating + *((float *)&m_f[R2]) += *((float *)&m_f[R1]); + // TRAPS: F_IVUX + break; + case 0x21: + // subs: subtract single floating + *((float *)&m_f[R2]) -= *((float *)&m_f[R1]); + // TRAPS: F_IVUX + break; + case 0x22: + // addd: add double floating + m_f[R2] += m_f[R1]; + // TRAPS: F_IVUX + break; + case 0x23: + // subd: subtract double floating + m_f[R2] -= m_f[R1]; + // TRAPS: F_IVUX + break; + case 0x24: + // movs: move single floating + *((float *)&m_f[R2]) = *((float *)&m_f[R1]); + break; + case 0x25: + // cmps: compare single floating + FLAGS(0, 0, *((float *)&m_f[R2]) == *((float *)&m_f[R1]), *((float *)&m_f[R2]) < *((float *)&m_f[R1])) + break; + case 0x26: + // movd: move double floating + m_f[R2] = m_f[R1]; + break; + case 0x27: + // cmpd: compare double floating + FLAGS(0, 0, m_f[R2] == m_f[R1], m_f[R2] < m_f[R1]) + // FLAGS: 00ZN + break; + case 0x28: + // muls: multiply single floating + *((float *)&m_f[R2]) *= *((float *)&m_f[R1]); + // TRAPS: F_IVUX + break; + case 0x29: + // divs: divide single floating + *((float *)&m_f[R2]) /= *((float *)&m_f[R1]); + // TRAPS: F_IVDUX + break; + case 0x2a: + // muld: multiply double floating + m_f[R2] *= m_f[R1]; + // TRAPS: F_IVUX + break; + case 0x2b: + // divd: divide double floating + m_f[R2] /= m_f[R1]; + // TRAPS: F_IVDUX + break; + case 0x2c: + // movsw: move single floating to word + m_r[R2] = *((s32 *)&m_f[R1]); + break; + case 0x2d: + // movws: move word to single floating + *((s32 *)&m_f[R2]) = m_r[R1]; + break; + case 0x2e: + // movdl: move double floating to longword + ((double *)m_r)[R2 >> 1] = m_f[R1]; + break; + case 0x2f: + // movld: move longword to double floating + m_f[R2] = ((double *)m_r)[R1 >> 1]; + break; + case 0x30: + // shaw: shift arithmetic word + if (m_r[R1] > 0) + { + // save the bits that will be shifted out plus new sign bit + s32 v = m_r[R2] >> (31 - m_r[R1]); + + m_r[R2] <<= m_r[R1]; + + // overflow is set if sign changes during shift + FLAGS(0, v != 0 && v != -1, m_r[R2] == 0, m_r[R2] < 0) + } + else + { + m_r[R2] >>= -m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + } + // FLAGS: 0VZN + break; + case 0x31: + // shal: shift arithmetic longword + if (m_r[R1] > 0) + { + // save the bits that will be shifted out plus new sign bit + s64 v = ((s64 *)m_r)[R2 >> 1] >> (63 - m_r[R1]); + + ((s64 *)m_r)[R2 >> 1] <<= m_r[R1]; + + // overflow is set if sign changes during shift + FLAGS(0, v != 0 && v != -1, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0) + } + else + { + ((s64 *)m_r)[R2 >> 1] >>= -m_r[R1]; + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0) + } + // FLAGS: 0VZN + break; + case 0x32: + // shlw: shift logical word + if (m_r[R1] > 0) + m_r[R2] <<= m_r[R1]; + else + ((u32 *)m_r)[R2] >>= -m_r[R1]; + // FLAGS: 00ZN + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0); + break; + case 0x33: + // shll: shift logical longword + if (m_r[R1] > 0) + ((u64 *)m_r)[R2 >> 1] <<= m_r[R1]; + else + ((u64 *)m_r)[R2 >> 1] >>= -m_r[R1]; + // FLAGS: 00ZN + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0); + break; + case 0x34: + // rotw: rotate word + if (m_r[R1] > 0) + m_r[R2] = rotl32(m_r[R2], m_r[R1]); + else + m_r[R2] = rotr32(m_r[R2], -m_r[R1]); + // FLAGS: 00ZN + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0); + break; + case 0x35: + // rotl: rotate longword + if (m_r[R1] > 0) + ((u64 *)m_r)[R2 >> 1] = rotl64(((u64 *)m_r)[R2 >> 1], m_r[R1]); + else + ((u64 *)m_r)[R2 >> 1] = rotr64(((u64 *)m_r)[R2 >> 1], -m_r[R1]); + // FLAGS: 00ZN + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0); + break; + + case 0x38: + // shai: shift arithmetic immediate + if (m_info.imm > 0) + { + // save the bits that will be shifted out plus new sign bit + s32 v = m_r[R2] >> (31 - m_info.imm); + + m_r[R2] <<= m_info.imm; + + // overflow is set if sign changes during shift + FLAGS(0, v != 0 && v != -1, m_r[R2] == 0, m_r[R2] < 0) + } + else + { + m_r[R2] >>= -m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + } + // FLAGS: 0VZN + // TRAPS: I + break; + case 0x39: + // shali: shift arithmetic longword immediate + if (m_info.imm > 0) + { + // save the bits that will be shifted out plus new sign bit + s64 v = ((s64 *)m_r)[R2 >> 1] >> (63 - m_info.imm); + + ((s64 *)m_r)[R2 >> 1] <<= m_info.imm; + + // overflow is set if sign changes during shift + FLAGS(0, v != 0 && v != -1, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0) + } + else + { + ((s64 *)m_r)[R2 >> 1] >>= -m_info.imm; + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0) + } + // FLAGS: 0VZN + // TRAPS: I + break; + case 0x3a: + // shli: shift logical immediate + if (m_info.imm > 0) + m_r[R2] <<= m_info.imm; + else + ((u32 *)m_r)[R2] >>= -m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0); + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x3b: + // shlli: shift logical longword immediate + if (m_info.imm > 0) + ((u64 *)m_r)[R2 >> 1] <<= m_info.imm; + else + ((u64 *)m_r)[R2 >> 1] >>= -m_info.imm; + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0); + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x3c: + // roti: rotate immediate + if (m_info.imm > 0) + m_r[R2] = rotl32(m_r[R2], m_info.imm); + else + m_r[R2] = rotr32(m_r[R2], -m_info.imm); + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0); + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x3d: + // rotli: rotate longword immediate + if (m_info.imm > 0) + ((u64 *)m_r)[R2 >> 1] = rotl64(((u64 *)m_r)[R2 >> 1], m_info.imm); + else + ((u64 *)m_r)[R2 >> 1] = rotr64(((u64 *)m_r)[R2 >> 1], -m_info.imm); + FLAGS(0, 0, ((s64 *)m_r)[R2 >> 1] == 0, ((s64 *)m_r)[R2 >> 1] < 0); + // FLAGS: 00ZN + // TRAPS: I + break; + + case 0x44: + case 0x45: + // call: call subroutine + m_r[R2] -= 4; + m_data->write_dword(m_r[R2], next_pc); + next_pc = m_info.address; + // TRAPS: A,P,W + break; +#ifdef UNIMPLEMENTED_C400 + case 0x46: + case 0x47: + // loadd2: + break; +#endif + case 0x48: + case 0x49: + // b*: branch on condition + if (evaluate_branch()) + next_pc = m_info.address; + // TRAPS: A,I + break; +#ifdef UNIMPLEMENTED_C400 + case 0x4a: + case 0x4b: + // cdb: + break; + case 0x4c: + case 0x4d: + // cdbeq: + break; + case 0x4e: + case 0x4f: + // cdbne: + break; + case 0x50: + case 0x51: + // db*: + break; +#endif +#ifdef UNIMPLEMENTED + case 0x4c: + case 0x4d: + // bf*: + break; +#endif + + case 0x60: + case 0x61: + // loadw: load word + m_r[R2] = m_data->read_dword(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x62: + case 0x63: + // loada: load address + m_r[R2] = m_info.address; + // TRAPS: I + break; + case 0x64: + case 0x65: + // loads: load single floating + ((u64 *)&m_f)[R2] = m_data->read_dword(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x66: + case 0x67: + // loadd: load double floating + ((u64 *)&m_f)[R2] = m_data->read_qword(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x68: + case 0x69: + // loadb: load byte + m_r[R2] = (s8)m_data->read_byte(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x6a: + case 0x6b: + // loadbu: load byte unsigned + m_r[R2] = m_data->read_byte(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x6c: + case 0x6d: + // loadh: load halfword + m_r[R2] = (s16)m_data->read_word(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x6e: + case 0x6f: + // loadhu: load halfword unsigned + m_r[R2] = m_data->read_word(m_info.address); + // TRAPS: C,U,A,P,R,I + break; + case 0x70: + case 0x71: + // storw: store word + m_data->write_dword(m_info.address, m_r[R2]); + // TRAPS: A,P,W,I + break; + case 0x72: + case 0x73: + // tsts: test and set + m_r[R2] = m_data->read_dword(m_info.address); + m_data->write_dword(m_info.address, m_r[R2] | 0x80000000); + // TRAPS: C,U,A,P,R,W,I + break; + case 0x74: + case 0x75: + // stors: store single floating + m_data->write_dword(m_info.address, *((u32 *)&m_f[R2])); + // TRAPS: A,P,W,I + break; + case 0x76: + case 0x77: + // stord: store double floating + m_data->write_qword(m_info.address, *((u64 *)&m_f[R2])); + // TRAPS: A,P,W,I + break; + case 0x78: + case 0x79: + // storb: store byte + m_data->write_byte(m_info.address, (u8)m_r[R2]); + // TRAPS: A,P,W,I + break; + + case 0x7c: + case 0x7d: + // storh: store halfword + m_data->write_word(m_info.address, (u16)m_r[R2]); + // TRAPS: A,P,W,I + break; + + case 0x80: + // addw: add word + FLAGS_CV(C_ADD(m_r[R2], m_r[R1]), V_ADD(m_r[R2], m_r[R1])) + m_r[R2] += m_r[R1]; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + + case 0x82: + // addq: add quick + FLAGS_CV(C_ADD(m_r[R2], R1), V_ADD(m_r[R2], R1)) + m_r[R2] += R1; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + case 0x83: + // addi: add immediate + FLAGS_CV(C_ADD(m_r[R2], m_info.imm), V_ADD(m_r[R2], m_info.imm)) + m_r[R2] += m_info.imm; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + // TRAPS: I + break; + case 0x84: + // movw: move word + m_r[R2] = m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + break; + + case 0x86: + // loadq: load quick + m_r[R2] = R1; + FLAGS(0, 0, m_r[R2] == 0, 0) + // FLAGS: 00Z0 + break; + case 0x87: + // loadi: load immediate + m_r[R2] = m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x88: + // andw: and word + m_r[R2] &= m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + break; + + case 0x8b: + // andi: and immediate + m_r[R2] &= m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x8c: + // orw: or word + m_r[R2] |= m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + break; + + case 0x8f: + // ori: or immediate + m_r[R2] |= m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + // TRAPS: I + break; + case 0x90: + // addwc: add word with carry + FLAGS_CV(C_ADD(m_r[R2], (m_r[R1] + (PSW(C) ? 1 : 0))), V_ADD(m_r[R2], (m_r[R1] + (PSW(C) ? 1 : 0)))) + m_r[R2] += m_r[R1] + (PSW(C) ? 1 : 0); + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + case 0x91: + // subwc: subtract word with carry + FLAGS_CV(C_SUB(m_r[R2], (m_r[R1] + (PSW(C) ? 1 : 0))), V_SUB(m_r[R2], (m_r[R1] + (PSW(C) ? 1 : 0)))) + m_r[R2] -= m_r[R1] + (PSW(C) ? 1 : 0); + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + + case 0x93: + // negw: negate word + FLAGS_CV(m_r[R1] != 0, m_r[R1] == INT32_MIN) + m_r[R2] = -m_r[R1]; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + + case 0x98: + // mulw: multiply word + m_r[R2] = m_r[R2] * m_r[R1]; + // FLAGS: 0V00 + break; + case 0x99: + // mulwx: multiply word extended + ((s64 *)m_r)[R2 >> 1] = (s64)m_r[R2] * (s64)m_r[R1]; + // FLAGS: 0V00 + break; + case 0x9a: + // mulwu: multiply word unsigned + m_r[R2] = (u32)m_r[R2] * (u32)m_r[R1]; + // FLAGS: 0V00 + break; + case 0x9b: + // mulwux: multiply word unsigned extended + ((u64 *)m_r)[R2 >> 1] = (u64)m_r[R2] * (u64)m_r[R1]; + // FLAGS: 0V00 + break; + case 0x9c: + // divw: divide word + if (m_r[R1] != 0) + { + FLAGS(0, m_r[R2] == INT32_MIN && m_r[R1] == -1, 0, 0) + m_r[R2] = m_r[R2] / m_r[R1]; + } + else + next_pc = intrap(EXCEPTION_INTEGER_DIVIDE_BY_ZERO, next_pc, CTS_DIVIDE_BY_ZERO); + // FLAGS: 0V00 + // TRAPS: D + break; + case 0x9d: + // modw: modulus word + if (m_r[R1] != 0) + { + FLAGS(0, m_r[R2] == INT32_MIN && m_r[R1] == -1, 0, 0) + m_r[R2] = m_r[R2] % m_r[R1]; + } + else + next_pc = intrap(EXCEPTION_INTEGER_DIVIDE_BY_ZERO, next_pc, CTS_DIVIDE_BY_ZERO); + // FLAGS: 0V00 + // TRAPS: D + break; + case 0x9e: + // divwu: divide word unsigned + if ((u32)m_r[R1] != 0) + m_r[R2] = (u32)m_r[R2] / (u32)m_r[R1]; + else + next_pc = intrap(EXCEPTION_INTEGER_DIVIDE_BY_ZERO, next_pc, CTS_DIVIDE_BY_ZERO); + FLAGS(0, 0, 0, 0) + // FLAGS: 0000 + // TRAPS: D + break; + case 0x9f: + // modwu: modulus word unsigned + if ((u32)m_r[R1] != 0) + m_r[R2] = (u32)m_r[R2] % (u32)m_r[R1]; + else + next_pc = intrap(EXCEPTION_INTEGER_DIVIDE_BY_ZERO, next_pc, CTS_DIVIDE_BY_ZERO); + FLAGS(0, 0, 0, 0) + // FLAGS: 0000 + // TRAPS: D + break; + case 0xa0: + // subw: subtract word + FLAGS_CV(C_SUB(m_r[R2], m_r[R1]), V_SUB(m_r[R2], m_r[R1])) + m_r[R2] -= m_r[R1]; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + + case 0xa2: + // subq: subtract quick + FLAGS_CV(C_SUB(m_r[R2], R1), V_SUB(m_r[R2], R1)) + m_r[R2] -= R1; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + break; + case 0xa3: + // subi: subtract immediate + FLAGS_CV(C_SUB(m_r[R2], m_info.imm), V_SUB(m_r[R2], m_info.imm)) + m_r[R2] -= m_info.imm; + FLAGS_ZN(m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: CVZN + // TRAPS: I + break; + case 0xa4: + // cmpw: compare word + FLAGS(C_SUB(m_r[R2], m_r[R1]), V_SUB(m_r[R2], m_r[R1]), m_r[R2] == m_r[R1], m_r[R2] < m_r[R1]) + // FLAGS: CVZN + break; + + case 0xa6: + // cmpq: compare quick + FLAGS(C_SUB(m_r[R2], R1), V_SUB(m_r[R2], R1), m_r[R2] == (s32)R1, m_r[R2] < (s32)R1) + // FLAGS: CVZN + break; + case 0xa7: + // cmpi: compare immediate + FLAGS(C_SUB(m_r[R2], m_info.imm), V_SUB(m_r[R2], m_info.imm), m_r[R2] == m_info.imm, m_r[R2] < m_info.imm) + // FLAGS: CVZN + // TRAPS: I + break; + case 0xa8: + // xorw: exclusive or word + m_r[R2] ^= m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + break; + + case 0xab: + // xori: exclusive or immediate + m_r[R2] ^= m_info.imm; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + // TRAPS: I + break; + case 0xac: + // notw: not word + m_r[R2] = ~m_r[R1]; + FLAGS(0, 0, m_r[R2] == 0, m_r[R2] < 0) + // FLAGS: 00ZN + break; + + case 0xae: + // notq: not quick + m_r[R2] = ~R1; + FLAGS(0, 0, 0, 1) + // FLAGS: 0001 + break; + +#ifdef UNIMPLEMENTED_C400 + case 0xb0: + // abss: absolute value single floating? + break; + + case 0xb2: + // absd: absolute value double floating? + break; +#endif + + case 0xb4: + // unprivileged macro instructions + switch (m_info.subopcode) + { + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: + case 0x0c: + // savew0..savew12: push registers rN:r14 + + // store ri at sp - 4 * (15 - i) + for (int i = R2; i < 15; i++) + m_data->write_dword(m_r[15] - 4 * (15 - i), m_r[i]); + + // decrement sp after push to allow restart on exceptions + m_r[15] -= 4 * (15 - R2); + // TRAPS: A,P,W + break; + // NOTE: the movc, initc and cmpc macro instructions are implemented in a very basic way because + // at some point they will need to be improved to deal with possible exceptions (e.g. page faults) + // that may occur during execution. The implementation here is intended to allow the instructions + // to be "continued" after such exceptions. + case 0x0d: + // movc: copy r0 bytes from r1 to r2 + + while (m_r[0]) + { + m_data->write_byte(m_r[2], m_data->read_byte(m_r[1])); + + m_r[0]--; + m_r[1]++; + m_r[2]++; + } + // TRAPS: C,U,P,R,W + break; + case 0x0e: + // initc: initialise r0 bytes at r1 with value in r2 + while (m_r[0]) + { + m_data->write_byte(m_r[1], m_r[2] & 0xff); + + m_r[0]--; + m_r[1]++; + m_r[2] = rotr32(m_r[2], 8); + } + // TRAPS: P,W + break; + case 0x0f: + // cmpc: compare r0 bytes at r1 with r2 + + // set condition codes assuming strings match + FLAGS(0, 0, 1, 0); + + while (m_r[0]) + { + // set condition codes and abort the loop if the current byte does not match + s32 byte1 = (s8)m_data->read_byte(m_r[1]); + s32 byte2 = (s8)m_data->read_byte(m_r[2]); + if (byte1 != byte2) + { + FLAGS(C_SUB(byte2, byte1), V_SUB(byte2, byte1), byte2 == byte1, byte2 < byte1) + break; + } + + m_r[0]--; + m_r[1]++; + m_r[2]++; + } + // TRAPS: C,U,P,R + break; + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: + // restwN..restw12: pop registers rN:r14 + + // load ri from sp + 4 * (i - N) + for (int i = R2; i < 15; i++) + m_r[i] = m_data->read_dword(m_r[15] + 4 * (i - R2)); + + // increment sp after pop to allow restart on exceptions + m_r[15] += 4 * (15 - R2); + // TRAPS: C,U,A,P,R + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + case 0x24: case 0x25: case 0x26: case 0x27: + // saved0..saved7: push registers fN:f7 + + // store fi at sp - 8 * (8 - i) + for (int i = R2; i < 8; i++) + m_data->write_qword(m_r[15] - 8 * (8 - i), m_f[i]); + + // decrement sp after push to allow restart on exceptions + m_r[15] -= 8 * (8 - R2); + // TRAPS: A,P,W + break; + case 0x28: case 0x29: case 0x2a: case 0x2b: + case 0x2c: case 0x2d: case 0x2e: case 0x2f: + // restd0..restd7: pop registers fN:f7 + + // load fi from sp + 8 * (i - N) + for (int i = R2; i < 8; i++) + m_f[i] = m_data->read_qword(m_r[15] + 8 * (i - R2)); + + // increment sp after pop to allow restart on exceptions + m_r[15] += 8 * (8 - R2); + // TRAPS: C,U,A,P,R + break; +#ifdef UNIMPLEMENTED + case 0x30: + // cnvsw + case 0x31: + // cnvrsw + // TRAPS: F_IX + case 0x32: + // cnvtsw + // TRAPS: F_IX + case 0x33: + // cnvws + // TRAPS: F_X + case 0x34: + // cnvdw + // TRAPS: F_IX + case 0x35: + // cnvrdw + // TRAPS: F_IX + break; +#endif + case 0x36: // cnvtdw + m_r[m_info.macro & 0xf] = (s32)m_f[(m_info.macro >> 4) & 0xf]; + // TRAPS: F_IX + break; + case 0x37: // cnvwd + m_f[m_info.macro & 0xf] = (double)m_r[(m_info.macro >> 4) & 0xf]; + break; +#ifdef UNIMPLEMENTED + case 0x38: + // cnvsd + // TRAPS: F_I + case 0x39: + // cnvds + // TRAPS: F_IVUX + case 0x3a: + // negs + case 0x3b: + // negds + case 0x3c: + // scalbs + // TRAPS: F_IVUX + case 0x3d: + // scalbd + // FLAGS: N + // TRAPS: F_IVUX + case 0x3e: + // trapfn + // TRAPS: I + case 0x3f: + // loadfs + break; +#endif + default: + logerror("illegal unprivileged macro opcode at 0x%08x\n", m_pc); + next_pc = intrap(EXCEPTION_ILLEGAL_OPERATION, next_pc, CTS_ILLEGAL_OPERATION); + machine().debug_break(); + break; + } + + break; + + case 0xb6: + // privileged macro instructions + if (!SSW(U)) + { + switch (m_info.subopcode) + { + case 0x00: + // movus: move user to supervisor + m_rs[m_info.macro & 0xf] = m_ru[(m_info.macro >> 4) & 0xf]; + FLAGS(0, 0, m_rs[m_info.macro & 0xf] == 0, m_rs[m_info.macro & 0xf] < 0) + // FLAGS: 00ZN + // TRAPS: S + break; + case 0x01: + // movsu: move supervisor to user + m_ru[m_info.macro & 0xf] = m_rs[(m_info.macro >> 4) & 0xf]; + FLAGS(0, 0, m_ru[m_info.macro & 0xf] == 0, m_ru[m_info.macro & 0xf] < 0) + // FLAGS: 00ZN + // TRAPS: S + break; + case 0x02: + // saveur: save user registers + for (int i = 0; i < 16; i++) + m_data->write_dword(m_rs[(m_info.macro >> 4) & 0xf] - 4 * (i + 1), m_ru[15 - i]); + + m_rs[(m_info.macro >> 4) & 0xf] -= 64; + // TRAPS: A,P,W,S + break; + case 0x03: + // restur: restore user registers + for (int i = 0; i < 16; i++) + m_ru[i] = m_data->read_dword(m_rs[(m_info.macro >> 4) & 0xf] + 4 * i); + + m_rs[(m_info.macro >> 4) & 0xf] += 64; + // TRAPS: C,U,A,P,R,S + break; + case 0x04: + // reti: restore psw, ssw and pc from supervisor stack + LOG_INTERRUPT("reti r%d, ssp = %08x, pc = %08x, next_pc = %08x\n", + (macro >> 4) & 0xf, m_rs[(m_info.macro >> 4) & 0xf], m_pc, m_program->read_dword(m_rs[(m_info.macro >> 4) & 0xf] + 8)); + + m_psw = m_data->read_dword(m_rs[(m_info.macro >> 4) & 0xf] + 0); + m_ssw = m_data->read_dword(m_rs[(m_info.macro >> 4) & 0xf] + 4); + next_pc = m_data->read_dword(m_rs[(m_info.macro >> 4) & 0xf] + 8); + + m_rs[(m_info.macro >> 4) & 0xf] += 12; + + m_r = SSW(U) ? m_ru : m_rs; + // TRAPS: S + break; + case 0x05: + // wait: wait for interrupt + next_pc = m_pc; + // TRAPS: S + break; +#ifdef UNIMPLEMENTED_C400 + case 0x07: + // loadts: unknown? + break; +#endif + + default: + // illegal operation + logerror("illegal privileged macro opcode at 0x%08x\n", m_pc); + next_pc = intrap(EXCEPTION_ILLEGAL_OPERATION, next_pc, CTS_ILLEGAL_OPERATION); + machine().debug_break(); + break; + } + } + else + next_pc = intrap(EXCEPTION_PRIVILEGED_INSTRUCTION, next_pc, CTS_PRIVILEGED_INSTRUCTION); + break; + +#ifdef UNIMPLEMENTED_C400 + case 0xbc: + // waitd: + break; + + case 0xc0: + // s*: + break; +#endif + + default: + logerror("illegal opcode at 0x%08x\n", m_pc); + next_pc = intrap(EXCEPTION_ILLEGAL_OPERATION, next_pc, CTS_ILLEGAL_OPERATION); + break; + } + + return next_pc; +} + +/* +* Common entry point for transferring control in the event of an interrupt or exception. +*/ +u32 clipper_device::intrap(u32 vector, u32 pc, u32 cts, u32 mts) +{ + LOG_INTERRUPT("intrap - vector %x, pc = 0x%08x, next_pc = 0x%08x, ssp = 0x%08x\n", vector, pc, m_program->read_dword(vector + 4), m_rs[15]); + + // set cts and mts to indicate source of exception + m_psw = (m_psw & ~(PSW_CTS | PSW_MTS)) | mts | cts; + + // push pc, psw and ssw onto supervisor stack + m_data->write_dword(m_rs[15] - 4, pc); + m_data->write_dword(m_rs[15] - 12, m_psw); + m_data->write_dword(m_rs[15] - 8, m_ssw); + + // decrement supervisor stack pointer + + // NOTE: while not explicitly stated anywhere, it seems the InterPro boot code has been + // developed with the assumption that the SSP is decremented by 24 bytes during an exception, + // rather than the 12 bytes that might otherwise be expected. This means the exception handler + // code must explicitly increment the SSP by 12 prior to executing the RETI instruction, + // as otherwise the SSP will not be pointing at a valid return frame. It's possible this + // behaviour might vary with some other version of the CPU, but this is all we know for now. + m_rs[15] -= 24; + + // load ssw from trap vector and set previous mode + m_ssw = (m_data->read_dword(vector + 0) & ~SSW_P) | (SSW(U) << 1); + + // clear psw + m_psw = 0; + + m_r = SSW(U) ? m_ru : m_rs; + + // return new pc from trap vector + return m_data->read_dword(vector + 4); +} + +bool clipper_device::evaluate_branch () +{ + switch (m_info.r2) + { + case BRANCH_T: + return true; + + case BRANCH_LT: + return (!PSW(V) && !PSW(Z) && !PSW(N)) + || (PSW(V) && !PSW(Z) && PSW(N)); + + case BRANCH_LE: + return (!PSW(V) && !PSW(N)) + || (PSW(V) && !PSW(Z) && PSW(N)); + + case BRANCH_EQ: + return PSW(Z) && !PSW(N); + + case BRANCH_GT: + return (!PSW(V) && !PSW(Z) && PSW(N)) + || (PSW(V) && !PSW(N)); + + case BRANCH_GE: + return (PSW(V) && !PSW(N)) + || (!PSW(V) && !PSW(Z) && PSW(N)) + || (PSW(Z) && !PSW(N)); + + case BRANCH_NE: + return (!PSW(Z)) + || (PSW(Z) && PSW(N)); + + case BRANCH_LTU: + return (!PSW(C) && !PSW(Z)); + + case BRANCH_LEU: + return !PSW(C); + + case BRANCH_GTU: + return PSW(C); + + case BRANCH_GEU: + return PSW(C) || PSW(Z); + + case BRANCH_V: + return PSW(V); + case BRANCH_NV: + return !PSW(V); + + case BRANCH_N: + return !PSW(Z) && PSW(N); + case BRANCH_NN: + return !PSW(N); + + case BRANCH_FN: + return PSW(Z) && PSW(N); + } + + return false; +} + +offs_t clipper_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) +{ + return CPU_DISASSEMBLE_NAME(clipper)(this, stream, pc, oprom, opram, options); +} diff --git a/src/devices/cpu/clipper/clipper.h b/src/devices/cpu/clipper/clipper.h new file mode 100644 index 00000000000..ff872891bbd --- /dev/null +++ b/src/devices/cpu/clipper/clipper.h @@ -0,0 +1,296 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay +#pragma once + +#ifndef __CLIPPER_H__ +#define __CLIPPER_H__ + +#include <limits.h> + +enum clipper_registers +{ + CLIPPER_R0, CLIPPER_R1, CLIPPER_R2, CLIPPER_R3, CLIPPER_R4, CLIPPER_R5, CLIPPER_R6, CLIPPER_R7, + CLIPPER_R8, CLIPPER_R9, CLIPPER_R10, CLIPPER_R11, CLIPPER_R12, CLIPPER_R13, CLIPPER_R14, CLIPPER_R15, + + CLIPPER_F0, CLIPPER_F1, CLIPPER_F2, CLIPPER_F3, CLIPPER_F4, CLIPPER_F5, CLIPPER_F6, CLIPPER_F7, + CLIPPER_F8, CLIPPER_F9, CLIPPER_F10, CLIPPER_F11, CLIPPER_F12, CLIPPER_F13, CLIPPER_F14, CLIPPER_F15, + + CLIPPER_PSW, + CLIPPER_SSW, + CLIPPER_PC, +}; + +enum clipper_addressing_modes +{ + ADDR_MODE_PC32 = 0x10, + ADDR_MODE_ABS32 = 0x30, + ADDR_MODE_REL32 = 0x60, + ADDR_MODE_PC16 = 0x90, + ADDR_MODE_REL12 = 0xa0, + ADDR_MODE_ABS16 = 0xb0, + ADDR_MODE_PCX = 0xd0, + ADDR_MODE_RELX = 0xe0, +}; + +// branch conditions +enum clipper_branch_conditions +{ + BRANCH_T = 0x0, + BRANCH_LT = 0x1, + BRANCH_LE = 0x2, + BRANCH_EQ = 0x3, + BRANCH_GT = 0x4, + BRANCH_GE = 0x5, + BRANCH_NE = 0x6, + BRANCH_LTU = 0x7, + BRANCH_LEU = 0x8, + BRANCH_GTU = 0x9, + BRANCH_GEU = 0xa, + BRANCH_V = 0xb, + BRANCH_NV = 0xc, + BRANCH_N = 0xd, + BRANCH_NN = 0xe, + BRANCH_FN = 0xf, +}; + +enum clipper_psw +{ + PSW_N = 0x00000001, // negative + PSW_Z = 0x00000002, // zero + PSW_V = 0x00000004, // overflow + PSW_C = 0x00000008, // carry out or borrow in + PSW_FX = 0x00000010, // floating inexact + PSW_FU = 0x00000020, // floating underflow + PSW_FD = 0x00000040, // floating divide by zero + PSW_FV = 0x00000080, // floating overflow + PSW_FI = 0x00000100, // floating invalid operation + PSW_EFX = 0x00000200, // enable floating inexact trap + PSW_EFU = 0x00000400, // enable floating underflow trap + PSW_EFD = 0x00000800, // enable floating divide by zero trap + PSW_EFV = 0x00001000, // enable floating overflow trap + PSW_EFI = 0x00002000, // enable floating invalid operation trap + PSW_EFT = 0x00004000, // enable floating trap + PSW_FR = 0x00018000, // floating rounding mode (2 bits) + // unused (3 bits) + PSW_DSP = 0x00300000, // c400 - delay slot pointer (2 bits) + PSW_BIG = 0x00400000, // c400 - big endian (hardware) + PSW_T = 0x00800000, // trace trap + PSW_CTS = 0x0f000000, // cpu trap status (4 bits) + PSW_MTS = 0xf0000000, // memory trap status (4 bits) +}; + +enum clipper_ssw +{ + SSW_IN = 0x0000000f, // interrupt number (4 bits) + SSW_IL = 0x000000f0, // interrupt level (4 bits) + SSW_EI = 0x00000100, // enable interrupts + SSW_ID = 0x0001fe00, // cpu rev # and type (8 bits) + // unused (5 bits) + SSW_FRD = 0x00400000, // floating registers dirty + SSW_TP = 0x00800000, // trace trap pending + SSW_ECM = 0x01000000, // enabled corrected memory error + SSW_DF = 0x02000000, // fpu disabled + SSW_M = 0x04000000, // mapped mode + SSW_KU = 0x08000000, // user protect key + SSW_UU = 0x10000000, // user data mode + SSW_K = 0x20000000, // protect key + SSW_U = 0x40000000, // user mode + SSW_P = 0x80000000, // previous mode +}; + +enum clipper_exception_vectors +{ + // data memory trap group + EXCEPTION_D_CORRECTED_MEMORY_ERROR = 0x108, + EXCEPTION_D_UNCORRECTABLE_MEMORY_ERROR = 0x110, + EXCEPTION_D_ALIGNMENT_FAULT = 0x120, + EXCEPTION_D_PAGE_FAULT = 0x128, + EXCEPTION_D_READ_PROTECT_FAULT = 0x130, + EXCEPTION_D_WRITE_PROTECT_FAULT = 0x138, + + // floating-point arithmetic trap group + EXCEPTION_FLOATING_INEXACT = 0x180, + EXCEPTION_FLOATING_UNDERFLOW = 0x188, + EXCEPTION_FLOATING_DIVIDE_BY_ZERO = 0x190, + EXCEPTION_FLOATING_OVERFLOW = 0x1a0, + EXCEPTION_FLOATING_INVALID_OPERATION = 0x1c0, + + // integer arithmetic trap group + EXCEPTION_INTEGER_DIVIDE_BY_ZERO = 0x208, + + // instruction memory trap group + EXCEPTION_I_CORRECTED_MEMORY_ERROR = 0x288, + EXCEPTION_I_UNCORRECTABLE_MEMORY_ERROR = 0x290, + EXCEPTION_I_ALIGNMENT_FAULT = 0x2a0, + EXCEPTION_I_PAGE_FAULT = 0x2a8, + EXCEPTION_I_EXECUTE_PROTECT_FAULT = 0x2b0, + + // illegal operation trap group + EXCEPTION_ILLEGAL_OPERATION = 0x300, + EXCEPTION_PRIVILEGED_INSTRUCTION = 0x308, + + // diagnostic trap group + EXCEPTION_TRACE = 0x380, + + // supervisor calls (0x400-0x7f8) + EXCEPTION_SUPERVISOR_CALL_BASE = 0x400, + + // prioritized interrupts (0x800-0xff8) + EXCEPTION_INTERRUPT_BASE = 0x800, +}; + +// trap source values are shifted into the correct field in the psw +enum clipper_cpu_trap_sources +{ + CTS_NO_CPU_TRAP = 0 << 24, + CTS_DIVIDE_BY_ZERO = 2 << 24, + CTS_ILLEGAL_OPERATION = 4 << 24, + CTS_PRIVILEGED_INSTRUCTION = 5 << 24, + CTS_TRACE_TRAP = 7 << 24, +}; + +enum clipper_memory_trap_sources +{ + MTS_NO_MEMORY_TRAP = 0 << 28, + MTS_CORRECTED_MEMORY_ERROR = 1 << 28, + MTS_UNCORRECTABLE_MEMORY_ERROR = 2 << 28, + MTS_ALIGNMENT_FAULT = 4 << 28, + MTS_PAGE_FAULT = 5 << 28, + MTS_READ_OR_EXECUTE_PROTECT_FAULT = 6 << 28, + MTS_WRITE_PROTECT_FAULT = 7 << 28, +}; + +// convenience macros for frequently used instruction fields +#define R1 (m_info.r1) +#define R2 (m_info.r2) + +// convenience macros for dealing with the psw +#define PSW(mask) (m_psw & PSW_##mask) +#define SSW(mask) (m_ssw & SSW_##mask) + +// macros for setting psw condition codes +#define FLAGS(C,V,Z,N) \ + m_psw = (m_psw & ~(PSW_C | PSW_V | PSW_Z | PSW_N)) | (((C) << 3) | ((V) << 2) | ((Z) << 1) | ((N) << 0)); +#define FLAGS_CV(C,V) \ + m_psw = (m_psw & ~(PSW_C | PSW_V)) | (((C) << 3) | ((V) << 2)); +#define FLAGS_ZN(Z,N) \ + m_psw = (m_psw & ~(PSW_Z | PSW_N)) | (((Z) << 1) | ((N) << 0)); + +// over/underflow for addition/subtraction from here: http://stackoverflow.com/questions/199333/how-to-detect-integer-overflow-in-c-c +#define OF_ADD(a, b) ((b > 0) && (a > INT_MAX - b)) +#define UF_ADD(a, b) ((b < 0) && (a < INT_MIN - b)) +#define OF_SUB(a, b) ((b < 0) && (a > INT_MAX + b)) +#define UF_SUB(a, b) ((b > 0) && (a < INT_MIN + b)) + +// CLIPPER logic for carry and overflow flags +#define C_ADD(a, b) ((u32)a + (u32)b < (u32)a) +#define V_ADD(a, b) (OF_ADD((s32)a, (s32)b) || UF_ADD((s32)a, (s32)b)) +#define C_SUB(a, b) ((u32)a < (u32)b) +#define V_SUB(a, b) (OF_SUB((s32)a, (s32)b) || UF_SUB((s32)a, (s32)b)) + +class clipper_device : public cpu_device +{ +public: + clipper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); + + DECLARE_READ_LINE_MEMBER(ssw) { return m_ssw; } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_execute_interface overrides + virtual u32 execute_min_cycles() const override { return 1; }; + virtual u32 execute_max_cycles() const override { return 1; }; // FIXME: don't know, especially macro instructions + virtual u32 execute_input_lines() const override { return 2; }; // number of input/interrupt lines (irq/nmi) + virtual void execute_run() override; + virtual void execute_set_input(int inputnum, int state) override; + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; + + // device_state_interface overrides +#if 0 + virtual void state_import(const device_state_entry &entry) override; + virtual void state_export(const device_state_entry &entry) override; +#endif + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; + + // device_disasm_interface overrides + virtual uint32_t disasm_min_opcode_bytes() const override { return 2; } // smallest instruction + virtual uint32_t disasm_max_opcode_bytes() const override { return 8; } // largest instruction + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; + + // core registers + u32 m_pc; + u32 m_psw; + u32 m_ssw; + + // integer registers + s32 *m_r; // active registers + s32 m_ru[16]; // user registers + s32 m_rs[16]; // supervisor registers + + // floating registers + double m_f[16]; + +private: + address_space_config m_insn_config; + address_space_config m_data_config; + + address_space *m_insn; + address_space *m_data; + + int m_icount; + + int m_irq; + int m_nmi; + + // decoded instruction information + struct + { + u8 opcode, subopcode; + u8 r1, r2; + + s32 imm; + u16 macro; + + // total size of instruction in bytes + u32 size; + + // computed effective address + u32 address; + } m_info; + + void decode_instruction(u16 insn); + int execute_instruction(); + bool evaluate_branch(); + + uint32_t intrap(u32 vector, u32 pc, u32 cts = CTS_NO_CPU_TRAP, u32 mts = MTS_NO_MEMORY_TRAP); +}; + +class clipper_c100_device : public clipper_device +{ +public: + clipper_c100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class clipper_c300_device : public clipper_device +{ +public: + clipper_c300_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +class clipper_c400_device : public clipper_device +{ +public: + clipper_c400_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +extern const device_type CLIPPER_C100; +extern const device_type CLIPPER_C300; +extern const device_type CLIPPER_C400; + +extern CPU_DISASSEMBLE(clipper); +#endif /* __CLIPPER_H__ */ diff --git a/src/devices/cpu/clipper/clipperd.cpp b/src/devices/cpu/clipper/clipperd.cpp new file mode 100644 index 00000000000..735804b2742 --- /dev/null +++ b/src/devices/cpu/clipper/clipperd.cpp @@ -0,0 +1,351 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#include "emu.h" + +/* + * TODO + * - dynamically switch between C400 and C100/C300 instruction sets + * - handle failures of addressing mode decoding more elegantly + * - improve address decoding to use streams + * - detect various cases of illegal instruction encoding + */ + +// enable C400 instruction decoding +#define C400_INSTRUCTIONS 1 + +// the CLIPPER addressing modes (unshifted) +enum +{ + ADDR_MODE_PC32 = 0x10, + ADDR_MODE_ABS32 = 0x30, + ADDR_MODE_REL32 = 0x60, + ADDR_MODE_PC16 = 0x90, + ADDR_MODE_REL12 = 0xa0, + ADDR_MODE_ABS16 = 0xb0, + ADDR_MODE_PCX = 0xd0, + ADDR_MODE_RELX = 0xe0 +}; + +// macros for decoding various operand fields +#define R1 ((insn[0] & 0x00f0) >> 4) +#define R2 (insn[0] & 0x000f) + +#define I16 ((int16_t)insn[1]) +#define I32 (*(int32_t *)&insn[1]) +#define IMM_VALUE (insn[0] & 0x0080 ? I16 : I32) +#define IMM_SIZE (insn[0] & 0x0080 ? 2 : 4) + +#define ADDR_MODE (insn[0] & 0x00f0) +#define ADDR_R2 ((insn[0] & 0x0050) == 0x0010 ? (insn[0] & 0x000f) : (insn[1] & 0x000f)) +#define ADDR_SIZE (ADDR_MODE > ADDR_MODE_REL32 ? 2 : ADDR_MODE == ADDR_MODE_REL32 ? 6 : 4) +#define ADDR_RX ((insn[1] & 0xf0) >> 4) +#define ADDR_I12 (((int16_t)insn[1]) >> 4) + +/* + * Branch condition code mnemonics - the forms beginning with 'c' are + * supposed to be used for branches following comparison instructions, + * while those beginning with 'r' are for use after move or logical + * instructions. We use the first form because we can't know which type + * should be used without some kind of dynamic information. + */ +static const char *const cc[] = +{ + "", + "clt", // rgt + "cle", // rge + "ceq", // req + "cgt", // rlt + "cge", // rle + "cne", // rne + "cltu", // rgtu + "cleu", // rgeu, nc + "cgtu", // rltu, c + "cgeu", // rleu + "v", + "nv", + "n", + "nn", + "fn" +}; + +/* + * Decode an addressing mode into a string. + */ +char *address (offs_t pc, u16 *insn) +{ + static char buffer[32]; + + switch (ADDR_MODE) + { + case ADDR_MODE_PC32: sprintf(buffer, "0x%x", pc + I32); break; + case ADDR_MODE_ABS32: sprintf(buffer, "0x%x", I32); break; + case ADDR_MODE_REL32: sprintf(buffer, "%d(r%d)", *(int32_t *)&insn[2], R2); break; + case ADDR_MODE_PC16: sprintf(buffer, "0x%x", pc + I16); break; + case ADDR_MODE_REL12: sprintf(buffer, "%d(r%d)", ADDR_I12, R2); break; + case ADDR_MODE_ABS16: sprintf(buffer, "0x%x", I16); break; + case ADDR_MODE_PCX: sprintf(buffer, "[r%d](pc)", ADDR_RX); break; + case ADDR_MODE_RELX: sprintf(buffer, "[r%d](r%d)", ADDR_RX, R2); break; + default: sprintf(buffer, "ERROR"); break; + } + + return buffer; +} + +/* + * CLIPPER instructions are composed of 1, 2, 3 or 4 16-bit "parcels". The first parcel contains + * the opcode and enough information to work out how many additional parcels might be required. The + * instruction set is fairly typically RISC-ish, except for these variable length instructions, the + * 8 addressing modes, and the "macro instructions", which are actually "subroutines" embedded in + * an on-CPU macro instruction ROM. It appears at least some of these macro instructions were removed + * from the C400 and generate traps which can be used to implement them in software instead. + */ +CPU_DISASSEMBLE(clipper) +{ + u16 *insn = (u16 *)oprom; + u32 flags = DASMFLAG_SUPPORTED; + offs_t bytes; + + switch (insn[0] >> 8) + { + case 0x00: + if (oprom[0] == 0) + util::stream_format(stream, "noop"); + else + util::stream_format(stream, "noop $%d", oprom[0]); + bytes = 2; + break; + + case 0x10: util::stream_format(stream, "movwp r%d,%s", R2, R1 == 0 ? "psw" : R1 == 1 ? "ssw" : "sswf"); bytes = 2; break; + case 0x11: util::stream_format(stream, "movpw %s,r%d", R1 == 0 ? "psw" : "ssw", R2); bytes = 2; break; + case 0x12: util::stream_format(stream, "calls $%d", insn[0] & 0x7F); bytes = 2; flags |= DASMFLAG_STEP_OVER; break; + case 0x13: util::stream_format(stream, "ret r%d", R2); bytes = 2; flags |= DASMFLAG_STEP_OUT; break; + case 0x14: util::stream_format(stream, "pushw r%d,r%d", R2, R1); bytes = 2; break; + + case 0x16: util::stream_format(stream, "popw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x20: util::stream_format(stream, "adds f%d,f%d", R1, R2); bytes = 2; break; + case 0x21: util::stream_format(stream, "subs f%d,f%d", R1, R2); bytes = 2; break; + case 0x22: util::stream_format(stream, "addd f%d,f%d", R1, R2); bytes = 2; break; + case 0x23: util::stream_format(stream, "subd f%d,f%d", R1, R2); bytes = 2; break; + case 0x24: util::stream_format(stream, "movs f%d,f%d", R1, R2); bytes = 2; break; + case 0x25: util::stream_format(stream, "cmps f%d,f%d", R1, R2); bytes = 2; break; + case 0x26: util::stream_format(stream, "movd f%d,f%d", R1, R2); bytes = 2; break; + case 0x27: util::stream_format(stream, "cmpd f%d,f%d", R1, R2); bytes = 2; break; + case 0x28: util::stream_format(stream, "muls f%d,f%d", R1, R2); bytes = 2; break; + case 0x29: util::stream_format(stream, "divs f%d,f%d", R1, R2); bytes = 2; break; + case 0x2a: util::stream_format(stream, "muld f%d,f%d", R1, R2); bytes = 2; break; + case 0x2b: util::stream_format(stream, "divd f%d,f%d", R1, R2); bytes = 2; break; + case 0x2c: util::stream_format(stream, "movsw f%d,r%d", R1, R2); bytes = 2; break; + case 0x2d: util::stream_format(stream, "movws r%d,f%d", R1, R2); bytes = 2; break; + case 0x2e: util::stream_format(stream, "movdl f%d,r%d:%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + case 0x2f: util::stream_format(stream, "movld r%d:r%d,f%d", R1 + 0, R1 + 1, R2); bytes = 2; break; + + case 0x30: util::stream_format(stream, "shaw r%d,r%d", R1, R2); bytes = 2; break; + case 0x31: util::stream_format(stream, "shal r%d,r%d:r%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + case 0x32: util::stream_format(stream, "shlw r%d,r%d", R1, R2); bytes = 2; break; + case 0x33: util::stream_format(stream, "shll r%d,r%d:r%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + case 0x34: util::stream_format(stream, "rotw r%d,r%d", R1, R2); bytes = 2; break; + case 0x35: util::stream_format(stream, "rotl r%d,r%d:r%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + + case 0x38: util::stream_format(stream, "shai $%d,r%d", I16, R2); bytes = 4; break; + case 0x39: util::stream_format(stream, "shali $%d,r%d:r%d", I16, R2 + 0, R2 + 1); bytes = 4; break; + case 0x3a: util::stream_format(stream, "shli $%d,r%d", I16, R2); bytes = 4; break; + case 0x3b: util::stream_format(stream, "shlli $%d,r%d:r%d", I16, R2 + 0, R2 + 1); bytes = 4; break; + case 0x3c: util::stream_format(stream, "roti $%d,r%d", I16, R2); bytes = 4; break; + case 0x3d: util::stream_format(stream, "rotli $%d,r%d:r%d", I16, R2 + 0, R2 + 1); bytes = 4; break; + + case 0x44: util::stream_format(stream, "call r%d,(r%d)", R2, R1); bytes = 2; flags |= DASMFLAG_STEP_OVER; break; + case 0x45: util::stream_format(stream, "call r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; flags |= DASMFLAG_STEP_OVER; break; +#if C400_INSTRUCTIONS + case 0x46: util::stream_format(stream, "loadd2 (r%d),f%d", R1, R2); bytes = 2; break; + case 0x47: util::stream_format(stream, "loadd2 %s,f%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; +#endif + case 0x48: util::stream_format(stream, "b%-4s (r%d)", cc[R2], R1); bytes = 2; break; + case 0x49: util::stream_format(stream, "b%-4s %s", cc[ADDR_R2], address(pc, insn)); bytes = 2 + ADDR_SIZE; break; +#if C400_INSTRUCTIONS + // delayed branches + case 0x4a: util::stream_format(stream, "cdb r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x4b: util::stream_format(stream, "cdb r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x4c: util::stream_format(stream, "cdbeq r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x4d: util::stream_format(stream, "cdbeq r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x4e: util::stream_format(stream, "cdbne r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x4f: util::stream_format(stream, "cdbne r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x50: util::stream_format(stream, "db%-4s (r%d)", cc[R2], R1); bytes = 2; break; + case 0x51: util::stream_format(stream, "db%-4s %s", cc[ADDR_R2], address(pc, insn)); bytes = 2 + ADDR_SIZE; break; +#else + // these instructions are in the C300 documentation, but appear to be replaced in the C400 + case 0x4c: util::stream_format(stream, "bf%s (r%d)", R2 == 0 ? "any" : "bad", R1); bytes = 2; break; + case 0x4d: util::stream_format(stream, "bf%s %s", ADDR_R2 == 0 ? "any" : "bad", address(pc, insn)); bytes = 2 + ADDR_SIZE; break; +#endif + + case 0x60: util::stream_format(stream, "loadw (r%d),r%d", R1, R2); bytes = 2; break; + case 0x61: util::stream_format(stream, "loadw %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x62: util::stream_format(stream, "loada (r%d),r%d", R1, R2); bytes = 2; break; + case 0x63: util::stream_format(stream, "loada %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x64: util::stream_format(stream, "loads (r%d),f%d", R1, R2); bytes = 2; break; + case 0x65: util::stream_format(stream, "loads %s,f%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x66: util::stream_format(stream, "loadd (r%d),f%d", R1, R2); bytes = 2; break; + case 0x67: util::stream_format(stream, "loadd %s,f%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x68: util::stream_format(stream, "loadb (r%d),r%d", R1, R2); bytes = 2; break; + case 0x69: util::stream_format(stream, "loadb %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x6a: util::stream_format(stream, "loadbu (r%d),r%d", R1, R2); bytes = 2; break; + case 0x6b: util::stream_format(stream, "loadbu %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x6c: util::stream_format(stream, "loadh (r%d),r%d", R1, R2); bytes = 2; break; + case 0x6d: util::stream_format(stream, "loadh %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x6e: util::stream_format(stream, "loadhu (r%d),r%d", R1, R2); bytes = 2; break; + case 0x6f: util::stream_format(stream, "loadhu %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + + case 0x70: util::stream_format(stream, "storw r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x71: util::stream_format(stream, "storw r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x72: util::stream_format(stream, "tsts (r%d),r%d", R1, R2); bytes = 2; break; + case 0x73: util::stream_format(stream, "tsts %s,r%d", address(pc, insn), ADDR_R2); bytes = 2 + ADDR_SIZE; break; + case 0x74: util::stream_format(stream, "stors f%d,(r%d)", R2, R1); bytes = 2; break; + case 0x75: util::stream_format(stream, "stors f%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x76: util::stream_format(stream, "stord f%d,(r%d)", R2, R1); bytes = 2; break; + case 0x77: util::stream_format(stream, "stord f%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + case 0x78: util::stream_format(stream, "storb r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x79: util::stream_format(stream, "storb r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + + case 0x7c: util::stream_format(stream, "storh r%d,(r%d)", R2, R1); bytes = 2; break; + case 0x7d: util::stream_format(stream, "storh r%d,%s", ADDR_R2, address(pc, insn)); bytes = 2 + ADDR_SIZE; break; + + case 0x80: util::stream_format(stream, "addw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x82: util::stream_format(stream, "addq $%d,r%d", R1, R2); bytes = 2; break; + case 0x83: util::stream_format(stream, "addi $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0x84: util::stream_format(stream, "movw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x86: util::stream_format(stream, "loadq $%d,r%d", R1, R2); bytes = 2; break; + case 0x87: util::stream_format(stream, "loadi $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0x88: util::stream_format(stream, "andw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x8b: util::stream_format(stream, "andi $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0x8c: util::stream_format(stream, "orw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x8f: util::stream_format(stream, "ori $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + + case 0x90: util::stream_format(stream, "addwc r%d,r%d", R1, R2); bytes = 2; break; + case 0x91: util::stream_format(stream, "subwc r%d,r%d", R1, R2); bytes = 2; break; + + case 0x93: util::stream_format(stream, "negw r%d,r%d", R1, R2); bytes = 2; break; + + case 0x98: util::stream_format(stream, "mulw r%d,r%d", R1, R2); bytes = 2; break; + case 0x99: util::stream_format(stream, "mulwx r%d,r%d:r%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + case 0x9a: util::stream_format(stream, "mulwu r%d,r%d", R1, R2); bytes = 2; break; + case 0x9b: util::stream_format(stream, "mulwux r%d,r%d:r%d", R1, R2 + 0, R2 + 1); bytes = 2; break; + case 0x9c: util::stream_format(stream, "divw r%d,r%d", R1, R2); bytes = 2; break; + case 0x9d: util::stream_format(stream, "modw r%d,r%d", R1, R2); bytes = 2; break; + case 0x9e: util::stream_format(stream, "divwu r%d,r%d", R1, R2); bytes = 2; break; + case 0x9f: util::stream_format(stream, "modwu r%d,r%d", R1, R2); bytes = 2; break; + + case 0xa0: util::stream_format(stream, "subw r%d,r%d", R1, R2); bytes = 2; break; + + case 0xa2: util::stream_format(stream, "subq $%d,r%d", R1, R2); bytes = 2; break; + case 0xa3: util::stream_format(stream, "subi $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0xa4: util::stream_format(stream, "cmpw r%d,r%d", R1, R2); bytes = 2; break; + + case 0xa6: util::stream_format(stream, "cmpq $%d,r%d", R1, R2); bytes = 2; break; + case 0xa7: util::stream_format(stream, "cmpi $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0xa8: util::stream_format(stream, "xorw r%d,r%d", R1, R2); bytes = 2; break; + + case 0xab: util::stream_format(stream, "xori $%d,r%d", IMM_VALUE, R2); bytes = 2 + IMM_SIZE; break; + case 0xac: util::stream_format(stream, "notw r%d,r%d", R1, R2); bytes = 2; break; + + case 0xae: util::stream_format(stream, "notq $%d,r%d", R1, R2); bytes = 2; break; + +#if C400_INSTRUCTIONS + case 0xb0: util::stream_format(stream, "abss f%d,f%d", R1, R2); bytes = 2; break; + case 0xb2: util::stream_format(stream, "absd f%d,f%d", R1, R2); bytes = 2; break; +#endif + + case 0xb4: + case 0xb5: + // unprivileged macro instructions + switch (insn[0] & 0xff) + { + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: + case 0x0c: + util::stream_format(stream, "savew%d", R2); + break; + + case 0x0d: util::stream_format(stream, "movc"); break; + case 0x0e: util::stream_format(stream, "initc"); break; + case 0x0f: util::stream_format(stream, "cmpc"); break; + + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: + util::stream_format(stream, "restw%d", R2); + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + case 0x24: case 0x25: case 0x26: case 0x27: + util::stream_format(stream, "saved%d", R2); + break; + + case 0x28: case 0x29: case 0x2a: case 0x2b: + case 0x2c: case 0x2d: case 0x2e: case 0x2f: + util::stream_format(stream, "restd%d", R2); + break; + + case 0x30: util::stream_format(stream, "cnvsw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x31: util::stream_format(stream, "cnvrsw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x32: util::stream_format(stream, "cnvtsw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x33: util::stream_format(stream, "cnvws r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x34: util::stream_format(stream, "cnvdw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x35: util::stream_format(stream, "cnvrdw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x36: util::stream_format(stream, "cnvtdw f%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x37: util::stream_format(stream, "cnvwd r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x38: util::stream_format(stream, "cnvsd f%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x39: util::stream_format(stream, "cnvds f%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x3a: util::stream_format(stream, "negs f%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x3b: util::stream_format(stream, "negd f%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x3c: util::stream_format(stream, "scalbs r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x3d: util::stream_format(stream, "scalbd r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x3e: util::stream_format(stream, "trapfn"); break; + case 0x3f: util::stream_format(stream, "loadfs r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + + default: + util::stream_format(stream, "macro 0x%04x 0x%04x", insn[0], insn[1]); + break; + } + bytes = 4; + break; + case 0xb6: + case 0xb7: + // privileged macro instructions + switch (insn[0] & 0xff) + { + case 0x00: util::stream_format(stream, "movus r%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x01: util::stream_format(stream, "movsu r%d,r%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; + case 0x02: util::stream_format(stream, "saveur r%d", (insn[1] & 0xf0) >> 4); break; + case 0x03: util::stream_format(stream, "restur r%d", (insn[1] & 0xf0) >> 4); break; + case 0x04: util::stream_format(stream, "reti r%d", (insn[1] & 0xf0) >> 4); flags |= DASMFLAG_STEP_OUT; break; + case 0x05: util::stream_format(stream, "wait"); break; +#if C400_INSTRUCTIONS + case 0x07: util::stream_format(stream, "loadts r%d,f%d", (insn[1] & 0xf0) >> 4, insn[1] & 0xf); break; +#endif + default: + util::stream_format(stream, "macro 0x%04x 0x%04x", insn[0], insn[1]); + break; + } + bytes = 4; + break; + +#if C400_INSTRUCTIONS + case 0xbc: util::stream_format(stream, "waitd"); bytes = 2; break; + case 0xc0: util::stream_format(stream, "s%-4s r%d", cc[R2], R1); bytes = 2; break; +#endif + + default: + util::stream_format(stream, ".word 0x%04x", insn[0]); + bytes = 2; + break; + } + + return bytes | flags; +}
\ No newline at end of file diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp index 459375fb40d..28394aa88f8 100644 --- a/src/devices/cpu/cop400/cop400.cpp +++ b/src/devices/cpu/cop400/cop400.cpp @@ -10,29 +10,28 @@ Type ROM RAM G D IN - COP410 512x8 32x4 none - COP411 512x8 32x4 0-2 0-1 none - COP401 none 32x4 none - COP413? - COP414? - COP415? - COP405? + COP410 512x8 32x4 N/A + COP411 512x8 32x4 0-2 0-1 N/A + COP413 512x8 32x4 N/A N/A + COP401 N/A 32x4 N/A COP420 1024x8 64x4 - COP421 1024x8 64x4 none - COP422 1024x8 64x4 2-3 2-3 none - COP402 none 64x4 + COP421 1024x8 64x4 N/A + COP422 1024x8 64x4 2-3 2-3 N/A + COP402 N/A 64x4 - COP444 2048x8 128x4 - COP445 2048x8 128x4 none - COP424 1024x8 64x4 - COP425 1024x8 64x4 none - COP426 1024x8 64x4 2-3 2-3 - COP404 none none + COP444L 2048x8 128x4 + COP445L 2048x8 128x4 N/A + COP404L N/A 128x4 - COP440 2048x8 160x4 - COP441 2048x8 160x4 - COP442 2048x8 160x4 + COP424C 1024x8 64x4 + COP425C 1024x8 64x4 N/A + COP426C 1024x8 64x4 2-3 2-3 + + COP444C 2048x8 128x4 + COP445C 2048x8 128x4 N/A + COP446C 2048x8 128x4 2-3 2-3 + COP404C N/A 128x4 **************************************************************************** @@ -48,12 +47,9 @@ TODO: - - opcode support for 2048x8 and 128x4/160x4 memory sizes - - CKO sync input + - COP410L/COP410C - save internal RAM when CKO is RAM power supply pin - - COP413/COP414/COP415/COP405 - - COP404 opcode map switching, dual timer, microbus enable - - COP440/COP441/COP442 (new registers: 2-bit N, 4-bit H, 8-bit R; some new opcodes, 2Kx8 ROM, 160x4 RAM) + - COP404L opcode map switching, dual timer, microbus enable */ @@ -69,12 +65,17 @@ const device_type COP402 = &device_creator<cop402_cpu_device>; const device_type COP420 = &device_creator<cop420_cpu_device>; const device_type COP421 = &device_creator<cop421_cpu_device>; const device_type COP422 = &device_creator<cop422_cpu_device>; -const device_type COP404 = &device_creator<cop404_cpu_device>; -const device_type COP424 = &device_creator<cop424_cpu_device>; -const device_type COP425 = &device_creator<cop425_cpu_device>; -const device_type COP426 = &device_creator<cop426_cpu_device>; -const device_type COP444 = &device_creator<cop444_cpu_device>; -const device_type COP445 = &device_creator<cop445_cpu_device>; +const device_type COP404L = &device_creator<cop404l_cpu_device>; +const device_type COP444L = &device_creator<cop444l_cpu_device>; +const device_type COP445L = &device_creator<cop445l_cpu_device>; +const device_type COP404C = &device_creator<cop404c_cpu_device>; +const device_type COP424C = &device_creator<cop424c_cpu_device>; +const device_type COP425C = &device_creator<cop425c_cpu_device>; +const device_type COP426C = &device_creator<cop426c_cpu_device>; +const device_type COP444C = &device_creator<cop444c_cpu_device>; +const device_type COP445C = &device_creator<cop445c_cpu_device>; +const device_type COP446C = &device_creator<cop446c_cpu_device>; + /*************************************************************************** @@ -153,12 +154,6 @@ static ADDRESS_MAP_START( data_128b, AS_DATA, 8, cop400_cpu_device ) AM_RANGE(0x00, 0x7f) AM_RAM ADDRESS_MAP_END -#ifdef UNUSED_CODE -static ADDRESS_MAP_START( data_160b, AS_DATA, 8, cop400_cpu_device ) - AM_RANGE(0x00, 0x9f) AM_RAM -ADDRESS_MAP_END -#endif - cop400_cpu_device::cop400_cpu_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, uint8_t program_addr_bits, uint8_t data_addr_bits, uint8_t featuremask, uint8_t g_mask, uint8_t d_mask, uint8_t in_mask, bool has_counter, bool has_inil, address_map_constructor internal_map_program, address_map_constructor internal_map_data) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) @@ -185,37 +180,48 @@ cop400_cpu_device::cop400_cpu_device(const machine_config &mconfig, device_type , m_d_mask(d_mask) , m_in_mask(in_mask) { - int i; + for (int i = 0; i < 256; i++) { + m_InstLen[i] = 1; + } - /* initialize instruction length array */ - for (i=0; i<256; i++) m_InstLen[i]=1; + m_InstLen[0x33] = m_InstLen[0x23] = 2; switch (featuremask) { case COP410_FEATURE: - /* select opcode map */ m_opcode_map = COP410_OPCODE_MAP; - /* initialize instruction length array */ - m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x68] = - m_InstLen[0x69] = m_InstLen[0x33] = m_InstLen[0x23] = 2; + + for (int r = 0; r < 2; r++) { + m_InstLen[0x60 + r] = 2; // JMP + m_InstLen[0x68 + r] = 2; // JSR + } break; case COP420_FEATURE: - /* select opcode map */ m_opcode_map = COP420_OPCODE_MAP; - /* initialize instruction length array */ - m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] = - m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] = - m_InstLen[0x33] = m_InstLen[0x23] = 2; + + for (int r = 0; r < 4; r++) { + m_InstLen[0x60 + r] = 2; // JMP + m_InstLen[0x68 + r] = 2; // JSR + } break; - case COP444_FEATURE: - /* select opcode map */ - m_opcode_map = COP444_OPCODE_MAP; - /* initialize instruction length array */ - m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] = - m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] = - m_InstLen[0x33] = m_InstLen[0x23] = 2; + case COP444L_FEATURE: + m_opcode_map = COP444L_OPCODE_MAP; + + for (int r = 0; r < 8; r++) { + m_InstLen[0x60 + r] = 2; // JMP + m_InstLen[0x68 + r] = 2; // JSR + } + break; + + case COP424C_FEATURE: + m_opcode_map = COP424C_OPCODE_MAP; + + for (int r = 0; r < 8; r++) { + m_InstLen[0x60 + r] = 2; // JMP + m_InstLen[0x68 + r] = 2; // JSR + } break; default: @@ -258,36 +264,58 @@ cop422_cpu_device::cop422_cpu_device(const machine_config &mconfig, const char * { } -cop404_cpu_device::cop404_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP404, "COP404", tag, owner, clock, "cop404", __FILE__, 11, 7, COP444_FEATURE, 0xf, 0xf, 0xf, true, true, nullptr, ADDRESS_MAP_NAME(data_128b)) +cop404l_cpu_device::cop404l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP404L, "COP404L", tag, owner, clock, "cop404l", __FILE__, 11, 7, COP444L_FEATURE, 0xf, 0xf, 0xf, true, true, nullptr, ADDRESS_MAP_NAME(data_128b)) +{ +} + +cop444l_cpu_device::cop444l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP444L, "COP444L", tag, owner, clock, "cop444l", __FILE__, 11, 7, COP444L_FEATURE, 0xf, 0xf, 0xf, true, true, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) +{ +} + +cop445l_cpu_device::cop445l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP445L, "COP445L", tag, owner, clock, "cop445l", __FILE__, 11, 7, COP444L_FEATURE, 0x7, 0x3, 0, true, false, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) +{ +} + +cop404c_cpu_device::cop404c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP404C, "COP404C", tag, owner, clock, "cop404c", __FILE__, 11, 7, COP424C_FEATURE, 0xf, 0xf, 0xf, true, true, nullptr, ADDRESS_MAP_NAME(data_128b)) { } -cop424_cpu_device::cop424_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP424, "COP424", tag, owner, clock, "cop424", __FILE__, 10, 6, COP444_FEATURE, 0xf, 0xf, 0xf, true, true, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) +cop424c_cpu_device::cop424c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP424C, "COP424C", tag, owner, clock, "cop424c", __FILE__, 10, 6, COP424C_FEATURE, 0xf, 0xf, 0xf, true, true, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) { } -cop425_cpu_device::cop425_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP425, "COP425", tag, owner, clock, "cop425", __FILE__, 10, 6, COP444_FEATURE, 0xf, 0xf, 0, true, false, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) +cop425c_cpu_device::cop425c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP425C, "COP425C", tag, owner, clock, "cop425c", __FILE__, 10, 6, COP424C_FEATURE, 0xf, 0xf, 0, true, false, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) { } -cop426_cpu_device::cop426_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP426, "COP426", tag, owner, clock, "cop426", __FILE__, 10, 6, COP444_FEATURE, 0xe, 0xe, 0xf, true, true, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) +cop426c_cpu_device::cop426c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP426C, "COP426C", tag, owner, clock, "cop426c", __FILE__, 10, 6, COP424C_FEATURE, 0xe, 0xe, 0xf, true, true, ADDRESS_MAP_NAME(program_1kb), ADDRESS_MAP_NAME(data_64b)) { } -cop444_cpu_device::cop444_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP444, "COP444", tag, owner, clock, "cop444", __FILE__, 11, 7, COP444_FEATURE, 0xf, 0xf, 0xf, true, true, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) +cop444c_cpu_device::cop444c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP444C, "COP444C", tag, owner, clock, "cop444c", __FILE__, 11, 7, COP424C_FEATURE, 0xf, 0xf, 0xf, true, true, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) { } -cop445_cpu_device::cop445_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cop400_cpu_device(mconfig, COP445, "COP445", tag, owner, clock, "cop445", __FILE__, 11, 7, COP444_FEATURE, 0x7, 0x3, 0, true, false, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) +cop445c_cpu_device::cop445c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP445C, "COP445C", tag, owner, clock, "cop445c", __FILE__, 11, 7, COP424C_FEATURE, 0xf, 0xf, 0, true, false, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) { } +cop446c_cpu_device::cop446c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cop400_cpu_device(mconfig, COP446C, "COP446C", tag, owner, clock, "cop446c", __FILE__, 11, 7, COP424C_FEATURE, 0xe, 0xe, 0xf, true, true, ADDRESS_MAP_NAME(program_2kb), ADDRESS_MAP_NAME(data_128b)) +{ +} + + + /*************************************************************************** INLINE FUNCTIONS ***************************************************************************/ @@ -341,7 +369,7 @@ void cop400_cpu_device::WRITE_G(uint8_t data) INSTRUCTION(illegal) { - logerror("COP400: PC = %04x, Illegal opcode = %02x\n", PC-1, ROM(PC-1)); + logerror("COP400: PC = %03x, Illegal opcode = %02x\n", PC-1, ROM(PC-1)); } #include "cop400op.hxx" @@ -612,7 +640,7 @@ const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP420_OPCODE_MAP OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jid) }; -const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_23_MAP[256] = +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444L_OPCODE_23_MAP[256] = { OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , @@ -651,23 +679,23 @@ const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_23_ OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) }; -void cop400_cpu_device::cop444_op23(uint8_t opcode) +void cop400_cpu_device::cop444l_op23(uint8_t opcode) { uint8_t opcode23 = fetch(); - (this->*COP444_OPCODE_23_MAP[opcode23])(opcode23); + (this->*COP444L_OPCODE_23_MAP[opcode23])(opcode23); } -const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_33_MAP[256] = +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444L_OPCODE_33_MAP[256] = { OP(illegal) , OP(skgbz0) , OP(illegal) , OP(skgbz2) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(skgbz1) , OP(illegal) , OP(skgbz3) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(skgz) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , - OP(inin) , OP(inil) , OP(ing) , OP(illegal) , OP(cqma) , OP(illegal) , OP(inl) , OP(ctma) , + OP(inin) , OP(inil) , OP(ing) , OP(illegal) , OP(cqma) , OP(illegal) , OP(inl) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , - OP(it) , OP(illegal) , OP(omg) , OP(illegal) , OP(camq) , OP(illegal) , OP(obd) , OP(camt) , + OP(illegal) , OP(illegal) , OP(omg) , OP(illegal) , OP(camq) , OP(illegal) , OP(obd) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , @@ -697,22 +725,22 @@ const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_33_ OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) }; -void cop400_cpu_device::cop444_op33(uint8_t opcode) +void cop400_cpu_device::cop444l_op33(uint8_t opcode) { uint8_t opcode33 = fetch(); - (this->*COP444_OPCODE_33_MAP[opcode33])(opcode33); + (this->*COP444L_OPCODE_33_MAP[opcode33])(opcode33); } -const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_MAP[256] = +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444L_OPCODE_MAP[256] = { OP(clra) , OP(skmbz0) , OP(xor_) , OP(skmbz2) , OP(xis) , OP(ld) , OP(x) , OP(xds) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , - OP(casc) , OP(skmbz1) , OP(cop444_xabr), OP(skmbz3) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(casc) , OP(skmbz1) , OP(cop444l_xabr), OP(skmbz3) , OP(xis) , OP(ld) , OP(x) , OP(xds) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , - OP(skc) , OP(ske) , OP(sc) , OP(cop444_op23) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(skc) , OP(ske) , OP(sc) , OP(cop444l_op23) , OP(xis) , OP(ld) , OP(x) , OP(xds) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , - OP(asc) , OP(add) , OP(rc) , OP(cop444_op33) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(asc) , OP(add) , OP(rc) , OP(cop444l_op33) , OP(xis) , OP(ld) , OP(x) , OP(xds) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(comp) , OP(skt) , OP(rmb2) , OP(rmb3) , OP(nop) , OP(rmb1) , OP(smb2) , OP(smb1) , @@ -743,6 +771,136 @@ const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP444_OPCODE_MAP OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jid) }; +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP424C_OPCODE_23_MAP[256] = +{ + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , OP(ldd) , + + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , + OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) , OP(xad) +}; + +void cop400_cpu_device::cop424c_op23(uint8_t opcode) +{ + uint8_t opcode23 = fetch(); + + (this->*COP424C_OPCODE_23_MAP[opcode23])(opcode23); +} + +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP424C_OPCODE_33_MAP[256] = +{ + OP(illegal) , OP(skgbz0) , OP(illegal) , OP(skgbz2) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(illegal) , OP(skgbz1) , OP(illegal) , OP(skgbz3) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(illegal) , OP(skgz) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(inin) , OP(inil) , OP(ing) , OP(illegal) , OP(cqma) , OP(illegal) , OP(inl) , OP(ctma) , + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(it) , OP(illegal) , OP(omg) , OP(illegal) , OP(camq) , OP(illegal) , OP(obd) , OP(camt) , + + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , + OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , OP(ogi) , + OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , + OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , OP(lei) , + OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + OP(halt) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , OP(illegal) , + + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) +}; + +void cop400_cpu_device::cop424c_op33(uint8_t opcode) +{ + uint8_t opcode33 = fetch(); + + (this->*COP424C_OPCODE_33_MAP[opcode33])(opcode33); +} + +const cop400_cpu_device::cop400_opcode_func cop400_cpu_device::COP424C_OPCODE_MAP[256] = +{ + OP(clra) , OP(skmbz0) , OP(xor_) , OP(skmbz2) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(casc) , OP(skmbz1) , OP(cop444l_xabr), OP(skmbz3) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(skc) , OP(ske) , OP(sc) , OP(cop444l_op23) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + OP(asc) , OP(add) , OP(rc) , OP(cop444l_op33) , OP(xis) , OP(ld) , OP(x) , OP(xds) , + OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , OP(lbi) , + + OP(comp) , OP(skt) , OP(rmb2) , OP(rmb3) , OP(nop) , OP(rmb1) , OP(smb2) , OP(smb1) , + OP(cop420_ret) , OP(retsk) , OP(adt) , OP(smb3) , OP(rmb0) , OP(smb0) , OP(cba) , OP(xas) , + OP(cab) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , + OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , OP(aisc) , + OP(jmp) , OP(jmp) , OP(jmp) , OP(jmp) , OP(jmp) , OP(jmp) , OP(jmp) , OP(jmp) , + OP(jsr) , OP(jsr) , OP(jsr) , OP(jsr) , OP(jsr) , OP(jsr) , OP(jsr) , OP(jsr) , + OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , + OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , OP(stii) , + + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(lqid) , + + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , + OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jp) , OP(jid) +}; /*************************************************************************** TIMER CALLBACKS @@ -823,24 +981,11 @@ void cop400_cpu_device::serial_tick() void cop400_cpu_device::counter_tick() { - if (m_featuremask & (COP444_FEATURE | COP440_FEATURE)) - { - T++; + T++; - if (T == 0) - { - m_skt_latch = 1; - - if (m_idle) - { - m_idle = 0; - m_halt = 0; - } - } - } - else - { + if (!T) { m_skt_latch = 1; + m_idle = false; } } @@ -870,17 +1015,17 @@ void cop400_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int p { switch (id) { - case TIMER_SERIAL: - serial_tick(); - break; + case TIMER_SERIAL: + serial_tick(); + break; - case TIMER_COUNTER: - counter_tick(); - break; + case TIMER_COUNTER: + counter_tick(); + break; - case TIMER_INIL: - inil_tick(); - break; + case TIMER_INIL: + inil_tick(); + break; } } @@ -888,13 +1033,11 @@ void cop400_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int p void cop400_cpu_device::device_start() { /* find address spaces */ - m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); m_data = &space(AS_DATA); /* find i/o handlers */ - m_read_l.resolve_safe(0); m_read_l_tristate.resolve_safe(0); m_write_l.resolve_safe(); @@ -908,29 +1051,18 @@ void cop400_cpu_device::device_start() m_read_cko.resolve_safe(0); /* allocate serial timer */ - m_serial_timer = timer_alloc(TIMER_SERIAL); m_serial_timer->adjust(attotime::zero, 0, attotime::from_ticks(m_cki, clock())); /* allocate counter timer */ - m_counter_timer = nullptr; if (m_has_counter) { m_counter_timer = timer_alloc(TIMER_COUNTER); - - if (m_featuremask & (COP444_FEATURE | COP440_FEATURE)) - { - m_counter_timer->adjust(attotime::zero, 0, attotime::from_ticks(m_cki * 4, clock())); - } - else - { - m_counter_timer->adjust(attotime::zero, 0, attotime::from_ticks(m_cki * 1024, clock())); - } + m_counter_timer->adjust(attotime::zero, 0, attotime::from_ticks(m_cki * 4, clock())); } /* allocate IN latch timer */ - m_inil_timer = nullptr; if (m_has_inil) { @@ -939,10 +1071,8 @@ void cop400_cpu_device::device_start() } /* register for state saving */ - save_item(NAME(m_pc)); save_item(NAME(m_prevpc)); - save_item(NAME(m_n)); save_item(NAME(m_sa)); save_item(NAME(m_sb)); save_item(NAME(m_sc)); @@ -950,9 +1080,7 @@ void cop400_cpu_device::device_start() save_item(NAME(m_b)); save_item(NAME(m_c)); save_item(NAME(m_g)); - save_item(NAME(m_h)); save_item(NAME(m_q)); - save_item(NAME(m_r)); save_item(NAME(m_en)); save_item(NAME(m_sio)); save_item(NAME(m_skl)); @@ -966,68 +1094,42 @@ void cop400_cpu_device::device_start() save_item(NAME(m_halt)); save_item(NAME(m_idle)); - state_add(STATE_GENPC, "GENPC", m_pc).mask(0xfff).noshow(); - state_add(STATE_GENPCBASE, "CURPC", m_prevpc).mask(0xfff).noshow(); - state_add(STATE_GENSP, "GENSP", m_n).mask(0x3).noshow(); - state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).mask(0x3).callimport().callexport().noshow().formatstr("%3s"); - - state_add(COP400_PC, "PC", m_pc).mask(0xfff); - - if (m_featuremask & (COP410_FEATURE | COP420_FEATURE | COP444_FEATURE)) - { - state_add(COP400_SA, "SA", m_sa).mask(0xfff); - state_add(COP400_SB, "SB", m_sb).mask(0xfff); - if (m_featuremask & (COP420_FEATURE | COP444_FEATURE)) - { - state_add(COP400_SC, "SC", m_sc).mask(0xfff); - } - } - if (m_featuremask & COP440_FEATURE) - { - state_add(COP400_N, "N", m_n).mask(0x3); - } - - state_add(COP400_A, "A", m_a).mask(0xf); - state_add(COP400_B, "B", m_b); - state_add(COP400_C, "C", m_c).mask(0x1); - - state_add(COP400_EN, "EN", m_en).mask(0xf); - state_add(COP400_G, "G", m_g).mask(0xf); - if (m_featuremask & COP440_FEATURE) - { - state_add(COP400_H, "H", m_h).mask(0xf); + // setup debugger state display + offs_t pc_mask = m_program->addrmask(); + + state_add(STATE_GENPC, "GENPC", m_pc).mask(pc_mask).noshow(); + state_add(STATE_GENPCBASE, "CURPC", m_prevpc).mask(pc_mask).noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).mask(0x7).callimport().callexport().noshow().formatstr("%3s"); + state_add(COP400_PC, "PC", m_pc).mask(pc_mask); + state_add(COP400_SA, "SA", m_sa).mask(pc_mask); + state_add(COP400_SB, "SB", m_sb).mask(pc_mask); + if (!(m_featuremask & COP410_FEATURE)) { + state_add(COP400_SC, "SC", m_sc).mask(pc_mask); } - state_add(COP400_Q, "Q", m_q); - if (m_featuremask & COP440_FEATURE) - { - state_add(COP400_R, "R", m_r); - } - - state_add(COP400_SIO, "SIO", m_sio).mask(0xf); - state_add(COP400_SKL, "SKL", m_skl).mask(0x1); - - if (m_featuremask & (COP444_FEATURE | COP440_FEATURE)) - { - state_add(COP400_T, "T", m_t); + state_add(COP400_B, "B", m_b); + state_add(COP400_A, "A", m_a).mask(0xf); + state_add(COP400_G, "G", m_g).mask(0xf); + state_add(COP400_Q, "Q", m_q); + state_add(COP400_SIO, "SIO", m_sio).mask(0xf); + state_add(COP400_EN, "EN", m_en).mask(0xf); + if (m_featuremask & COP424C_FEATURE) { + state_add(COP400_T, "T", m_t); } m_icountptr = &m_icount; - m_n = 0; m_q = 0; m_sa = 0; m_sb = 0; m_sc = 0; m_sio = 0; - m_h = 0; - m_r = 0; m_flags = 0; m_il = 0; m_in[0] = m_in[1] = m_in[2] = m_in[3] = 0; m_si = 0; m_skip_lbi = 0; - m_last_skip = 0; - m_skip = 0; + m_last_skip = false; + m_skip = false; } @@ -1049,8 +1151,8 @@ void cop400_cpu_device::device_reset() T = 0; m_skt_latch = 1; - m_halt = 0; - m_idle = 0; + m_halt = false; + m_idle = false; } /*************************************************************************** @@ -1068,16 +1170,18 @@ void cop400_cpu_device::execute_run() { do { - // debugger hook - m_prevpc = PC; - debugger_instruction_hook(this, PC); + if (!m_skip) { + // debugger hook + m_prevpc = PC; + debugger_instruction_hook(this, PC); + } // halt logic if (m_cko == COP400_CKO_HALT_IO_PORT) { m_halt = IN_CKO(); } - if (m_halt) { + if (m_halt || m_idle) { m_icount--; continue; } @@ -1092,7 +1196,7 @@ void cop400_cpu_device::execute_run() if ((function != OP(jp)) && (function != OP(jmp)) && (function != OP(jsr)) && !m_skip_lbi) { // store skip logic m_last_skip = m_skip; - m_skip = 0; + m_skip = false; // push next PC PUSH(PC); @@ -1114,7 +1218,7 @@ void cop400_cpu_device::execute_run() opcode = fetch(); } - m_skip = 0; + m_skip = false; continue; } @@ -1138,10 +1242,11 @@ void cop400_cpu_device::state_import(const device_state_entry &entry) { switch (entry.index()) { - case STATE_GENFLAGS: - m_c = (m_flags >> 1) & 1; - m_skl = (m_flags >> 0) & 1; - break; + case STATE_GENFLAGS: + m_skt_latch = BIT(m_flags, 2); + m_c = BIT(m_flags, 1); + m_skl = BIT(m_flags, 0); + break; } } @@ -1149,9 +1254,9 @@ void cop400_cpu_device::state_export(const device_state_entry &entry) { switch (entry.index()) { - case STATE_GENFLAGS: - m_flags = (m_c ? 0x02 : 0x00) | (m_skl ? 0x01 : 0x00); - break; + case STATE_GENFLAGS: + m_flags = (m_skt_latch ? 0x04 : 0x00) | (m_c ? 0x02 : 0x00) | (m_skl ? 0x01 : 0x00); + break; } } @@ -1159,12 +1264,12 @@ void cop400_cpu_device::state_string_export(const device_state_entry &entry, std { switch (entry.index()) { - case STATE_GENFLAGS: - str = string_format("%c%c%c", - m_c ? 'C' : '.', - m_skl ? 'S' : '.', - m_skt_latch ? 'T' : '.'); - break; + case STATE_GENFLAGS: + str = string_format("%c%c%c", + m_c ? 'C' : '.', + m_skl ? 'S' : '.', + m_skt_latch ? 'T' : '.'); + break; } } @@ -1174,8 +1279,14 @@ offs_t cop400_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, co extern CPU_DISASSEMBLE( cop410 ); extern CPU_DISASSEMBLE( cop420 ); extern CPU_DISASSEMBLE( cop444 ); + extern CPU_DISASSEMBLE( cop424 ); + + if ( m_featuremask & COP424C_FEATURE ) + { + return CPU_DISASSEMBLE_NAME(cop424)(this, stream, pc, oprom, opram, options); + } - if ( m_featuremask & COP444_FEATURE ) + if ( m_featuremask & COP444L_FEATURE ) { return CPU_DISASSEMBLE_NAME(cop444)(this, stream, pc, oprom, opram, options); } diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h index 693210443b1..e2ce7e6577c 100644 --- a/src/devices/cpu/cop400/cop400.h +++ b/src/devices/cpu/cop400/cop400.h @@ -17,40 +17,40 @@ // L pins: 8-bit bi-directional #define MCFG_COP400_READ_L_CB(_devcb) \ - cop400_cpu_device::set_read_l_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_l_callback(*device, DEVCB_##_devcb); #define MCFG_COP400_WRITE_L_CB(_devcb) \ - cop400_cpu_device::set_write_l_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_write_l_callback(*device, DEVCB_##_devcb); // output state when pins are in tri-state, default 0 #define MCFG_COP400_READ_L_TRISTATE_CB(_devcb) \ - cop400_cpu_device::set_read_l_tristate_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_l_tristate_callback(*device, DEVCB_##_devcb); // G pins: 4-bit bi-directional #define MCFG_COP400_READ_G_CB(_devcb) \ - cop400_cpu_device::set_read_g_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_g_callback(*device, DEVCB_##_devcb); #define MCFG_COP400_WRITE_G_CB(_devcb) \ - cop400_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); // D outputs: 4-bit general purpose output #define MCFG_COP400_WRITE_D_CB(_devcb) \ - cop400_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); // IN inputs: 4-bit general purpose input #define MCFG_COP400_READ_IN_CB(_devcb) \ - cop400_cpu_device::set_read_in_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_in_callback(*device, DEVCB_##_devcb); // SI/SO lines: serial in/out or counter/gen.purpose #define MCFG_COP400_READ_SI_CB(_devcb) \ - cop400_cpu_device::set_read_si_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_si_callback(*device, DEVCB_##_devcb); #define MCFG_COP400_WRITE_SO_CB(_devcb) \ - cop400_cpu_device::set_write_so_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_write_so_callback(*device, DEVCB_##_devcb); // SK output line: logic-controlled clock or gen.purpose #define MCFG_COP400_WRITE_SK_CB(_devcb) \ - cop400_cpu_device::set_write_sk_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_write_sk_callback(*device, DEVCB_##_devcb); // CKI/CKO lines: only CKO input here #define MCFG_COP400_READ_CKO_CB(_devcb) \ - cop400_cpu_device::set_read_cko_callback(*device, DEVCB_##_devcb); + devcb = &cop400_cpu_device::set_read_cko_callback(*device, DEVCB_##_devcb); /*************************************************************************** @@ -64,14 +64,11 @@ enum COP400_SA, COP400_SB, COP400_SC, - COP400_N, COP400_A, COP400_B, COP400_C, COP400_G, - COP400_H, COP400_Q, - COP400_R, COP400_EN, COP400_SIO, COP400_SKL, @@ -87,7 +84,7 @@ enum COP400_IN2, COP400_IN3, - /* COP404 */ + /* COP404L */ COP400_MB, COP400_DUAL, COP400_SEL10, @@ -194,13 +191,14 @@ protected: enum { COP410_FEATURE = 0x01, COP420_FEATURE = 0x02, - COP444_FEATURE = 0x04, - COP440_FEATURE = 0x08 + COP444L_FEATURE = 0x04, + COP424C_FEATURE = 0x08 }; enum { TIMER_SERIAL, TIMER_COUNTER, + TIMER_COUNTER_T, TIMER_INIL }; @@ -223,15 +221,12 @@ protected: uint8_t m_a; /* 4-bit accumulator */ uint8_t m_b; /* 5/6/7-bit RAM address register */ int m_c; /* 1-bit carry register */ - uint8_t m_n; /* 2-bit stack pointer (COP440 only) */ uint8_t m_en; /* 4-bit enable register */ uint8_t m_g; /* 4-bit general purpose I/O port */ uint8_t m_q; /* 8-bit latch for L port */ - uint16_t m_sa, m_sb, m_sc; /* subroutine save registers (not present in COP440) */ + uint16_t m_sa, m_sb, m_sc; /* subroutine save registers */ uint8_t m_sio; /* 4-bit shift register and counter */ int m_skl; /* 1-bit latch for SK output */ - uint8_t m_h; /* 4-bit general purpose I/O port (COP440 only) */ - uint8_t m_r; /* 8-bit general purpose I/O port (COP440 only) */ uint8_t m_flags; // used for I/O only /* counter */ @@ -247,11 +242,11 @@ protected: uint8_t m_si; /* serial input */ /* skipping logic */ - int m_skip; /* skip next instruction */ + bool m_skip; /* skip next instruction */ int m_skip_lbi; /* skip until next non-LBI instruction */ - int m_last_skip; /* last value of skip */ - int m_halt; /* halt mode */ - int m_idle; /* idle mode */ + bool m_last_skip; /* last value of skip */ + bool m_halt; /* halt mode */ + bool m_idle; /* idle mode */ /* execution logic */ int m_InstLen[256]; /* instruction length in bytes */ @@ -272,9 +267,12 @@ protected: static const cop400_opcode_func COP420_OPCODE_23_MAP[256]; static const cop400_opcode_func COP420_OPCODE_33_MAP[256]; static const cop400_opcode_func COP420_OPCODE_MAP[256]; - static const cop400_opcode_func COP444_OPCODE_23_MAP[256]; - static const cop400_opcode_func COP444_OPCODE_33_MAP[256]; - static const cop400_opcode_func COP444_OPCODE_MAP[256]; + static const cop400_opcode_func COP444L_OPCODE_23_MAP[256]; + static const cop400_opcode_func COP444L_OPCODE_33_MAP[256]; + static const cop400_opcode_func COP444L_OPCODE_MAP[256]; + static const cop400_opcode_func COP424C_OPCODE_23_MAP[256]; + static const cop400_opcode_func COP424C_OPCODE_33_MAP[256]; + static const cop400_opcode_func COP424C_OPCODE_MAP[256]; void serial_tick(); void counter_tick(); @@ -333,7 +331,7 @@ protected: void lbi(uint8_t opcode); void lei(uint8_t opcode); void xabr(uint8_t opcode); - void cop444_xabr(uint8_t opcode); + void cop444l_xabr(uint8_t opcode); void skc(uint8_t opcode); void ske(uint8_t opcode); void skgz(uint8_t opcode); @@ -359,11 +357,12 @@ protected: void cop410_op33(uint8_t opcode); void cop420_op23(uint8_t opcode); void cop420_op33(uint8_t opcode); - void cop444_op23(uint8_t opcode); - void cop444_op33(uint8_t opcode); + void cop444l_op23(uint8_t opcode); + void cop444l_op33(uint8_t opcode); + void cop424c_op23(uint8_t opcode); + void cop424c_op33(uint8_t opcode); void skgbz(int bit); void skmbz(int bit); - }; @@ -431,56 +430,92 @@ public: /* COP444 family */ -// COP404 is a ROMless version of the COP444, which can emulate a COP410C/COP411C, COP424C/COP425C, or a COP444C/COP445C -class cop404_cpu_device : public cop400_cpu_device +// COP404L is a ROMless version of the COP444, which can emulate a COP410/COP411, COP424/COP425, or a COP444/COP445 +class cop404l_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop404_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop404l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -// COP424 is functionally equivalent to COP444, with only 1K ROM and 64x4 bytes RAM -class cop424_cpu_device : public cop400_cpu_device +class cop444l_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop424_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop444l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -// COP425 is a 24-pin package version of the COP424, lacking the IN ports -class cop425_cpu_device : public cop400_cpu_device +// COP445 is a 24-pin package version of the COP444, lacking the IN ports +class cop445l_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop425_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop445l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -// COP426 is a 20-pin package version of the COP424, with only L0-L7, G2-G3, D2-D3 ports -class cop426_cpu_device : public cop400_cpu_device +// COP404C +class cop404c_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop426_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop404c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class cop444_cpu_device : public cop400_cpu_device +// COP424C is functionally equivalent to COP444C, with only 1K ROM and 64x4 bytes RAM +class cop424c_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop444_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop424c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -// COP445 is a 24-pin package version of the COP444, lacking the IN ports -class cop445_cpu_device : public cop400_cpu_device +// COP425C is a 24-pin package version of the COP424C, lacking the IN ports +class cop425c_cpu_device : public cop400_cpu_device +{ +public: + // construction/destruction + cop425c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// COP426C is a 20-pin package version of the COP424C, with only L0-L7, G2-G3, D2-D3 ports +class cop426c_cpu_device : public cop400_cpu_device +{ +public: + // construction/destruction + cop426c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// COP444C +class cop444c_cpu_device : public cop400_cpu_device +{ +public: + // construction/destruction + cop444c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// COP445C +class cop445c_cpu_device : public cop400_cpu_device { public: // construction/destruction - cop445_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cop445c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// COP446C +class cop446c_cpu_device : public cop400_cpu_device +{ +public: + // construction/destruction + cop446c_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; @@ -491,12 +526,15 @@ extern const device_type COP402; extern const device_type COP420; extern const device_type COP421; extern const device_type COP422; -extern const device_type COP404; -extern const device_type COP424; -extern const device_type COP425; -extern const device_type COP426; -extern const device_type COP444; -extern const device_type COP445; - +extern const device_type COP404L; +extern const device_type COP444L; +extern const device_type COP445L; +extern const device_type COP404C; +extern const device_type COP424C; +extern const device_type COP425C; +extern const device_type COP426C; +extern const device_type COP444C; +extern const device_type COP445C; +extern const device_type COP446C; #endif /* __COP400__ */ diff --git a/src/devices/cpu/cop400/cop400op.hxx b/src/devices/cpu/cop400/cop400op.hxx index cf363be8ce6..3242973af3d 100644 --- a/src/devices/cpu/cop400/cop400op.hxx +++ b/src/devices/cpu/cop400/cop400op.hxx @@ -35,7 +35,7 @@ INSTRUCTION( asc ) if (A > 0xF) { C = 1; - m_skip = 1; + m_skip = true; A &= 0xF; } else @@ -86,7 +86,7 @@ INSTRUCTION( aisc ) if (A > 0x0f) { - m_skip = 1; + m_skip = true; A &= 0xF; } } @@ -238,7 +238,7 @@ INSTRUCTION( casc ) if (A > 0xF) { C = 1; - m_skip = 1; + m_skip = true; A &= 0xF; } else @@ -267,7 +267,7 @@ INSTRUCTION( casc ) INSTRUCTION( jid ) { PC = (PC & 0x700) | (A << 4) | RAM_R(B); - uint8_t operand = fetch(); + uint8_t operand = fetch(); PC = (PC & 0x700) | operand; } @@ -287,7 +287,7 @@ INSTRUCTION( jid ) INSTRUCTION( jmp ) { - uint8_t operand = fetch(); + uint8_t operand = fetch(); PC = ((opcode & 0x07) << 8) | operand; } @@ -351,9 +351,9 @@ INSTRUCTION( jp ) INSTRUCTION( jsr ) { - uint8_t operand = fetch(); + uint8_t operand = fetch(); PUSH(PC); - PC = ((opcode & 0x07) << 8) | operand; + PC = ((opcode & 0x07) << 8) | operand; } /* @@ -413,7 +413,7 @@ INSTRUCTION( cop420_ret ) INSTRUCTION( retsk ) { POP(); - m_skip = 1; + m_skip = true; } /* @@ -431,7 +431,7 @@ INSTRUCTION( retsk ) INSTRUCTION( halt ) { - m_halt = 1; + m_halt = true; } /* @@ -447,8 +447,8 @@ INSTRUCTION( halt ) INSTRUCTION( it ) { - m_halt = 1; - m_idle = 1; + m_halt = true; + m_idle = true; } /*************************************************************************** @@ -553,7 +553,7 @@ INSTRUCTION( lqid ) { PUSH(PC); PC = (PC & 0x700) | (A << 4) | RAM_R(B); - uint8_t operand = fetch(); + uint8_t operand = fetch(); WRITE_Q(operand); POP(); } @@ -732,7 +732,7 @@ INSTRUCTION( xds ) B = B ^ r; - if (Bd == 0x0f) m_skip = 1; + if (Bd == 0x0f) m_skip = true; } /* @@ -767,7 +767,7 @@ INSTRUCTION( xis ) B = B ^ r; - if (Bd == 0x00) m_skip = 1; + if (Bd == 0x00) m_skip = true; } /* @@ -979,7 +979,7 @@ INSTRUCTION( xabr ) /* - Processor: COP444 + Processor: COP444L Mnemonic: XABR @@ -992,7 +992,7 @@ INSTRUCTION( xabr ) */ -INSTRUCTION( cop444_xabr ) +INSTRUCTION( cop444l_xabr ) { uint8_t Br = A & 0x07; uint8_t Bd = B & 0x0f; @@ -1020,7 +1020,7 @@ INSTRUCTION( cop444_xabr ) INSTRUCTION( skc ) { - if (C == 1) m_skip = 1; + if (C == 1) m_skip = true; } /* @@ -1038,7 +1038,7 @@ INSTRUCTION( skc ) INSTRUCTION( ske ) { - if (A == RAM_R(B)) m_skip = 1; + if (A == RAM_R(B)) m_skip = true; } /* @@ -1056,7 +1056,7 @@ INSTRUCTION( ske ) INSTRUCTION( skgz ) { - if (IN_G() == 0) m_skip = 1; + if (IN_G() == 0) m_skip = true; } /* @@ -1081,7 +1081,7 @@ INSTRUCTION( skgz ) void cop400_cpu_device::skgbz(int bit) { - if (!BIT(IN_G(), bit)) m_skip = 1; + if (!BIT(IN_G(), bit)) m_skip = true; } INSTRUCTION( skgbz0 ) { skgbz(0); } @@ -1111,7 +1111,7 @@ INSTRUCTION( skgbz3 ) { skgbz(3); } void cop400_cpu_device::skmbz(int bit) { - if (!BIT(RAM_R(B), bit)) m_skip = 1; + if (!BIT(RAM_R(B), bit)) m_skip = true; } INSTRUCTION( skmbz0 ) { skmbz(0); } @@ -1137,7 +1137,7 @@ INSTRUCTION( skt ) if (m_skt_latch) { m_skt_latch = 0; - m_skip = 1; + m_skip = true; } } diff --git a/src/devices/cpu/cop400/cop410ds.cpp b/src/devices/cpu/cop400/cop410ds.cpp index a187506d8b5..4570417538f 100644 --- a/src/devices/cpu/cop400/cop410ds.cpp +++ b/src/devices/cpu/cop400/cop410ds.cpp @@ -25,19 +25,19 @@ CPU_DISASSEMBLE(cop410) if (page == 2 || page == 3) //JP pages 2,3 { address = (uint16_t)((pc & 0x180) | (opcode & 0x7F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else { if ((opcode & 0xC0) == 0xC0) //JP other pages { address = (uint16_t)((pc & 0x1C0) | (opcode & 0x3F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else //JSRP { address = (uint16_t)(0x80 | (opcode & 0x3F)); - util::stream_format(stream, "JSRP %03x", address); + util::stream_format(stream, "JSRP %03X", address); flags = DASMFLAG_STEP_OVER; } } @@ -65,13 +65,13 @@ CPU_DISASSEMBLE(cop410) else if (opcode >= 0x60 && opcode <= 0x61) { address = ((opcode & 0x01) << 8) | next_opcode; - util::stream_format(stream, "JMP %03x", address); + util::stream_format(stream, "JMP %03X", address); bytes = 2; } else if (opcode >= 0x68 && opcode <= 0x69) { address = ((opcode & 0x01) << 8) | next_opcode; - util::stream_format(stream, "JSR %03x", address); + util::stream_format(stream, "JSR %03X", address); flags = DASMFLAG_STEP_OVER; bytes = 2; } diff --git a/src/devices/cpu/cop400/cop420ds.cpp b/src/devices/cpu/cop400/cop420ds.cpp index 6281e7f53ef..39ea87ba9b4 100644 --- a/src/devices/cpu/cop400/cop420ds.cpp +++ b/src/devices/cpu/cop400/cop420ds.cpp @@ -25,19 +25,19 @@ CPU_DISASSEMBLE(cop420) if (page == 2 || page == 3) //JP pages 2,3 { address = (uint16_t)((pc & 0x380) | (opcode & 0x7F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else { if ((opcode & 0xC0) == 0xC0) //JP other pages { address = (uint16_t)((pc & 0x3C0) | (opcode & 0x3F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else //JSRP { address = (uint16_t)(0x80 | (opcode & 0x3F)); - util::stream_format(stream, "JSRP %03x", address); + util::stream_format(stream, "JSRP %03X", address); flags = DASMFLAG_STEP_OVER; } } @@ -65,13 +65,13 @@ CPU_DISASSEMBLE(cop420) else if (opcode >= 0x60 && opcode <= 0x63) { address = ((opcode & 0x03) << 8) | next_opcode; - util::stream_format(stream, "JMP %03x", address); + util::stream_format(stream, "JMP %03X", address); bytes = 2; } else if (opcode >= 0x68 && opcode <= 0x6B) { address = ((opcode & 0x03) << 8) | next_opcode; - util::stream_format(stream, "JSR %03x", address); + util::stream_format(stream, "JSR %03X", address); flags = DASMFLAG_STEP_OVER; bytes = 2; } diff --git a/src/devices/cpu/cop400/cop440ds.cpp b/src/devices/cpu/cop400/cop424ds.cpp index 14489f05ab5..fc8396f4903 100644 --- a/src/devices/cpu/cop400/cop440ds.cpp +++ b/src/devices/cpu/cop400/cop424ds.cpp @@ -2,15 +2,15 @@ // copyright-holders:Curt Coder /*************************************************************************** - cop440ds.c + cop424ds.c - National Semiconductor COP440 Emulator. + National Semiconductor COP424C/COP444C Emulator. ***************************************************************************/ #include "emu.h" -CPU_DISASSEMBLE(cop444) +CPU_DISASSEMBLE(cop424) { uint8_t opcode = oprom[0]; uint8_t next_opcode = oprom[1]; @@ -25,19 +25,19 @@ CPU_DISASSEMBLE(cop444) if (page == 2 || page == 3) //JP pages 2,3 { address = (uint16_t)((pc & 0x780) | (opcode & 0x7F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else { if ((opcode & 0xC0) == 0xC0) //JP other pages { address = (uint16_t)((pc & 0x7C0) | (opcode & 0x3F)); - util::stream_format(stream, "JP %03x", address); + util::stream_format(stream, "JP %03X", address); } else //JSRP { address = (uint16_t)(0x80 | (opcode & 0x3F)); - util::stream_format(stream, "JSRP %03x", address); + util::stream_format(stream, "JSRP %03X", address); flags = DASMFLAG_STEP_OVER; } } @@ -62,16 +62,16 @@ CPU_DISASSEMBLE(cop444) { util::stream_format(stream, "AISC %u", opcode & 0xF); } - else if (opcode >= 0x60 && opcode <= 0x63) + else if (opcode >= 0x60 && opcode <= 0x67) { - address = ((opcode & 0x03) << 8) | next_opcode; - util::stream_format(stream, "JMP %03x", address); + address = ((opcode & 0x07) << 8) | next_opcode; + util::stream_format(stream, "JMP %03X", address); bytes = 2; } - else if (opcode >= 0x68 && opcode <= 0x6B) + else if (opcode >= 0x68 && opcode <= 0x6f) { - address = ((opcode & 0x03) << 8) | next_opcode; - util::stream_format(stream, "JSR %03x", address); + address = ((opcode & 0x07) << 8) | next_opcode; + util::stream_format(stream, "JSR %03X", address); flags = DASMFLAG_STEP_OVER; bytes = 2; } @@ -162,19 +162,15 @@ CPU_DISASSEMBLE(cop444) case 0x23: bytes = 2; - if (next_opcode <= 0x3f) + if (next_opcode <= 0x7f) { - address = (uint16_t)(next_opcode & 0x3F); - util::stream_format(stream, "LDD %u,%u", ((address & 0x30) >> 4),address & 0x0F); + address = (uint16_t)(next_opcode & 0x7F); + util::stream_format(stream, "LDD %u,%u", address >> 4, address & 0x0F); } - else if (next_opcode >= 0x80 && next_opcode <= 0xbf) + else if (next_opcode >= 0x80) { - address = (uint16_t)(next_opcode & 0x3F); - util::stream_format(stream, "XAD %u,%u", ((address & 0x30) >> 4),address & 0x0F); - } - else - { - util::stream_format(stream, "Invalid"); + address = (uint16_t)(next_opcode & 0x7f); + util::stream_format(stream, "XAD %u,%u", address >> 4, address & 0x0F); } break; @@ -217,21 +213,9 @@ CPU_DISASSEMBLE(cop444) { util::stream_format(stream, "LEI %u", next_opcode & 0xF); } - else if (next_opcode >= 0x80 && next_opcode <= 0x8F) - { - util::stream_format(stream, "LBI 0,%u", next_opcode & 0xF); - } - else if (next_opcode >= 0x90 && next_opcode <= 0x9F) - { - util::stream_format(stream, "LBI 1,%u", next_opcode & 0xF); - } - else if (next_opcode >= 0xA0 && next_opcode <= 0xAF) - { - util::stream_format(stream, "LBI 2,%u", next_opcode & 0xF); - } - else if (next_opcode >= 0xB0 && next_opcode <= 0xBF) + else if (next_opcode >= 0x80) { - util::stream_format(stream, "LBI 3,%u", next_opcode & 0xF); + util::stream_format(stream, "LBI %u,%u", (next_opcode >> 4) & 0x07, next_opcode & 0xF); } else { diff --git a/src/devices/cpu/cop400/cop444ds.cpp b/src/devices/cpu/cop400/cop444ds.cpp new file mode 100644 index 00000000000..cae2274546c --- /dev/null +++ b/src/devices/cpu/cop400/cop444ds.cpp @@ -0,0 +1,384 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + cop444ds.c + + National Semiconductor COP444L Emulator. + +***************************************************************************/ + +#include "emu.h" + +CPU_DISASSEMBLE(cop444) +{ + uint8_t opcode = oprom[0]; + uint8_t next_opcode = oprom[1]; + uint16_t address; + uint32_t flags = 0; + int bytes = 1; + + if ((opcode >= 0x80 && opcode <= 0xBE) || (opcode >= 0xC0 && opcode <= 0xFE)) + { + int page = pc >> 6; + + if (page == 2 || page == 3) //JP pages 2,3 + { + address = (uint16_t)((pc & 0x780) | (opcode & 0x7F)); + util::stream_format(stream, "JP %03X", address); + } + else + { + if ((opcode & 0xC0) == 0xC0) //JP other pages + { + address = (uint16_t)((pc & 0x7C0) | (opcode & 0x3F)); + util::stream_format(stream, "JP %03X", address); + } + else //JSRP + { + address = (uint16_t)(0x80 | (opcode & 0x3F)); + util::stream_format(stream, "JSRP %03X", address); + flags = DASMFLAG_STEP_OVER; + } + } + } + else if (opcode >= 0x08 && opcode <= 0x0F) + { + util::stream_format(stream, "LBI 0,%u", ((opcode & 0xF) + 1) & 0xF); + } + else if (opcode >= 0x18 && opcode <= 0x1F) + { + util::stream_format(stream, "LBI 1,%u", ((opcode & 0xF) + 1) & 0xF); + } + else if (opcode >= 0x28 && opcode <= 0x2F) + { + util::stream_format(stream, "LBI 2,%u", ((opcode & 0xF) + 1) & 0xF); + } + else if (opcode >= 0x38 && opcode <= 0x3F) + { + util::stream_format(stream, "LBI 3,%u", ((opcode & 0xF) + 1) & 0xF); + } + else if (opcode >= 0x51 && opcode <= 0x5F) + { + util::stream_format(stream, "AISC %u", opcode & 0xF); + } + else if (opcode >= 0x60 && opcode <= 0x67) + { + address = ((opcode & 0x07) << 8) | next_opcode; + util::stream_format(stream, "JMP %03X", address); + bytes = 2; + } + else if (opcode >= 0x68 && opcode <= 0x6f) + { + address = ((opcode & 0x07) << 8) | next_opcode; + util::stream_format(stream, "JSR %03X", address); + flags = DASMFLAG_STEP_OVER; + bytes = 2; + } + else if (opcode >= 0x70 && opcode <= 0x7F) + { + util::stream_format(stream, "STII %u", opcode & 0xF); + } + else + { + switch (opcode) + { + case 0: + util::stream_format(stream, "CLRA"); + break; + + case 1: + util::stream_format(stream, "SKMBZ 0"); + break; + + case 2: + util::stream_format(stream, "XOR"); + break; + + case 3: + util::stream_format(stream, "SKMBZ 2"); + break; + + case 4: + util::stream_format(stream, "XIS 0"); + break; + + case 5: + util::stream_format(stream, "LD 0"); + break; + + case 6: + util::stream_format(stream, "X 0"); + break; + + case 7: + util::stream_format(stream, "XDS 0"); + break; + + case 0x10: + util::stream_format(stream, "CASC"); + break; + + case 0x11: + util::stream_format(stream, "SKMBZ 1"); + break; + + case 0x12: + util::stream_format(stream, "XABR"); + break; + + case 0x13: + util::stream_format(stream, "SKMBZ 3"); + break; + + case 0x14: + util::stream_format(stream, "XIS 1"); + break; + + case 0x15: + util::stream_format(stream, "LD 1"); + break; + + case 0x16: + util::stream_format(stream, "X 1"); + break; + + case 0x17: + util::stream_format(stream, "XDS 1"); + break; + + case 0x20: + util::stream_format(stream, "SKC"); + break; + + case 0x21: + util::stream_format(stream, "SKE"); + break; + + case 0x22: + util::stream_format(stream, "SC"); + break; + + case 0x23: + bytes = 2; + + if (next_opcode <= 0x7f) + { + address = (uint16_t)(next_opcode & 0x7F); + util::stream_format(stream, "LDD %u,%u", address >> 4, address & 0x0F); + } + else if (next_opcode >= 0x80) + { + address = (uint16_t)(next_opcode & 0x7f); + util::stream_format(stream, "XAD %u,%u", address >> 4, address & 0x0F); + } + break; + + case 0x24: + util::stream_format(stream, "XIS 2"); + break; + + case 0x25: + util::stream_format(stream, "LD 2"); + break; + + case 0x26: + util::stream_format(stream, "X 2"); + break; + + case 0x27: + util::stream_format(stream, "XDS 2"); + break; + + case 0x30: + util::stream_format(stream, "ASC"); + break; + + case 0x31: + util::stream_format(stream, "ADD"); + break; + + case 0x32: + util::stream_format(stream, "RC"); + break; + + case 0x33: + bytes = 2; + + if (next_opcode >= 0x50 && next_opcode <= 0x5F) + { + util::stream_format(stream, "OGI %u", next_opcode & 0xF); + } + else if (next_opcode >= 0x60 && next_opcode <= 0x6F) + { + util::stream_format(stream, "LEI %u", next_opcode & 0xF); + } + else if (next_opcode >= 0x80) + { + util::stream_format(stream, "LBI %u,%u", (next_opcode >> 4) & 0x07, next_opcode & 0xF); + } + else + { + switch (next_opcode) + { + case 0x01: + util::stream_format(stream, "SKGBZ 0"); + break; + + case 0x03: + util::stream_format(stream, "SKGBZ 2"); + break; + + case 0x11: + util::stream_format(stream, "SKGBZ 1"); + break; + + case 0x13: + util::stream_format(stream, "SKGBZ 3"); + break; + + case 0x21: + util::stream_format(stream, "SKGZ"); + break; + + case 0x28: + util::stream_format(stream, "ININ"); + break; + + case 0x29: + util::stream_format(stream, "INIL"); + break; + + case 0x2A: + util::stream_format(stream, "ING"); + break; + + case 0x2C: + util::stream_format(stream, "CQMA"); + break; + + case 0x2E: + util::stream_format(stream, "INL"); + break; + + case 0x3A: + util::stream_format(stream, "OMG"); + break; + + case 0x3C: + util::stream_format(stream, "CAMQ"); + break; + + case 0x3E: + util::stream_format(stream, "OBD"); + break; + + default: + util::stream_format(stream, "Invalid"); + break; + } + } + break; + + case 0x34: + util::stream_format(stream, "XIS 3"); + break; + + case 0x35: + util::stream_format(stream, "LD 3"); + break; + + case 0x36: + util::stream_format(stream, "X 3"); + break; + + case 0x37: + util::stream_format(stream, "XDS 3"); + break; + + case 0x40: + util::stream_format(stream, "COMP"); + break; + + case 0x41: + util::stream_format(stream, "SKT"); + break; + + case 0x42: + util::stream_format(stream, "RMB 2"); + break; + + case 0x43: + util::stream_format(stream, "RMB 3"); + break; + + case 0x44: + util::stream_format(stream, "NOP"); + break; + + case 0x45: + util::stream_format(stream, "RMB 1"); + break; + + case 0x46: + util::stream_format(stream, "SMB 2"); + break; + + case 0x47: + util::stream_format(stream, "SMB 1"); + break; + + case 0x48: + util::stream_format(stream, "RET"); + flags = DASMFLAG_STEP_OUT; + break; + + case 0x49: + util::stream_format(stream, "RETSK"); + flags = DASMFLAG_STEP_OUT; + break; + + case 0x4A: + util::stream_format(stream, "ADT"); + break; + + case 0x4B: + util::stream_format(stream, "SMB 3"); + break; + + case 0x4C: + util::stream_format(stream, "RMB 0"); + break; + + case 0x4D: + util::stream_format(stream, "SMB 0"); + break; + + case 0x4E: + util::stream_format(stream, "CBA"); + break; + + case 0x4F: + util::stream_format(stream, "XAS"); + break; + + case 0x50: + util::stream_format(stream, "CAB"); + break; + + case 0xBF: + util::stream_format(stream, "LQID"); + break; + + case 0xFF: + util::stream_format(stream, "JID"); + break; + + default: + util::stream_format(stream, "Invalid"); + break; + } + } + + return bytes | flags | DASMFLAG_SUPPORTED; +} diff --git a/src/devices/cpu/cp1610/cp1610.h b/src/devices/cpu/cp1610/cp1610.h index 545c37fbb83..17bb37c2897 100644 --- a/src/devices/cpu/cp1610/cp1610.h +++ b/src/devices/cpu/cp1610/cp1610.h @@ -26,7 +26,7 @@ enum #define CP1610_INT_INTR INPUT_LINE_NMI /* Non-Maskable */ #define MCFG_CP1610_BEXT_CALLBACK(_read) \ - downcast<cp1610_cpu_device *>(device)->set_bext_callback(DEVCB_##_read); + devcb = &downcast<cp1610_cpu_device *>(device)->set_bext_callback(DEVCB_##_read); class cp1610_cpu_device : public cpu_device @@ -35,9 +35,9 @@ public: // construction/destruction cp1610_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, uint32_t _clock); - template<class _read> void set_bext_callback(_read rd) + template<class _read> devcb_base &set_bext_callback(_read rd) { - m_read_bext.set_callback(rd); + return m_read_bext.set_callback(rd); } protected: diff --git a/src/devices/cpu/drcbec.cpp b/src/devices/cpu/drcbec.cpp index 28a4abdd9be..ea0a3f08f5a 100644 --- a/src/devices/cpu/drcbec.cpp +++ b/src/devices/cpu/drcbec.cpp @@ -1747,7 +1747,7 @@ int drcbe_c::execute(code_handle &entry) break; case MAKE_OPCODE_SHORT(OP_ROL, 8, 0): // DROL dst,src,count[,f] - shift = DPARAM2 & 31; + shift = DPARAM2 & 63; DPARAM0 = (DPARAM1 << shift) | (DPARAM1 >> ((64 - shift) & 63)); break; diff --git a/src/devices/cpu/e0c6200/e0c6200.cpp b/src/devices/cpu/e0c6200/e0c6200.cpp index a7ccf514438..e78351b19aa 100644 --- a/src/devices/cpu/e0c6200/e0c6200.cpp +++ b/src/devices/cpu/e0c6200/e0c6200.cpp @@ -40,7 +40,7 @@ void e0c6200_cpu_device::state_string_export(const device_state_entry &entry, st } } -offs_t e0c6200_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t e0c6200_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(e0c6200); return CPU_DISASSEMBLE_NAME(e0c6200)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/e0c6200/e0c6200.h b/src/devices/cpu/e0c6200/e0c6200.h index bf43c80ad2b..4a38ae8fbf8 100644 --- a/src/devices/cpu/e0c6200/e0c6200.h +++ b/src/devices/cpu/e0c6200/e0c6200.h @@ -16,7 +16,7 @@ class e0c6200_cpu_device : public cpu_device { public: // construction/destruction - e0c6200_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program, address_map_constructor data, const char *shortname, const char *source) + e0c6200_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, address_map_constructor program, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 16, 13, -1, program) , m_data_config("data", ENDIANNESS_BIG, 8, 12, 0, data), m_program(nullptr), m_data(nullptr), m_op(0), m_prev_op(0), m_irq_vector(0), m_irq_id(0), m_possible_irq(false), m_halt(false), @@ -29,9 +29,9 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint32_t execute_min_cycles() const override { return 5; } - virtual uint32_t execute_max_cycles() const override { return 14; } // longest opcode is 12 cycles, but interrupt service takes up to 14 - virtual uint32_t execute_input_lines() const override { return 1; } + virtual u32 execute_min_cycles() const override { return 5; } + virtual u32 execute_max_cycles() const override { return 14; } // longest opcode is 12 cycles, but interrupt service takes up to 14 + virtual u32 execute_input_lines() const override { return 1; } virtual void execute_run() override; virtual void execute_one(); virtual bool check_interrupt() { return false; } // nothing to do by default @@ -41,9 +41,9 @@ protected: 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 2; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 2; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual u32 disasm_min_opcode_bytes() const override { return 2; } + virtual u32 disasm_max_opcode_bytes() const override { return 2; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; @@ -51,27 +51,27 @@ protected: address_space *m_program; address_space *m_data; - uint16_t m_op; - uint16_t m_prev_op; - uint8_t m_irq_vector; // low 4 bits for new programcounter after interrupt - int m_irq_id; // for standard_irq_callback(id) - bool m_possible_irq; // indicates interrupts need to be re-checked - bool m_halt; // cpu halt state - bool m_sleep; // cpu sleep state + u16 m_op; + u16 m_prev_op; + u8 m_irq_vector; // low 4 bits for new programcounter after interrupt + int m_irq_id; // for standard_irq_callback(id) + bool m_possible_irq; // indicates interrupts need to be re-checked + bool m_halt; // cpu halt state + bool m_sleep; // cpu sleep state int m_icount; - uint16_t m_pc; // 13-bit programcounter: 1-bit bank, 4-bit page, 8-bit 'step' - uint16_t m_prev_pc; - uint16_t m_npc; // new bank/page prepared by pset - uint16_t m_jpc; // actual bank/page destination for jumps + u16 m_pc; // 13-bit programcounter: 1-bit bank, 4-bit page, 8-bit 'step' + u16 m_prev_pc; + u16 m_npc; // new bank/page prepared by pset + u16 m_jpc; // actual bank/page destination for jumps // all work registers are 4-bit - uint8_t m_a; // accumulator - uint8_t m_b; // generic - uint8_t m_xp, m_xh, m_xl; // 12-bit index register when combined - uint8_t m_yp, m_yh, m_yl; // " - uint8_t m_sp; // stackpointer (SPH, SPL) - uint8_t m_f; // flags + u8 m_a; // accumulator + u8 m_b; // generic + u8 m_xp, m_xh, m_xl; // 12-bit index register when combined + u8 m_yp, m_yh, m_yl; // " + u8 m_sp; // stackpointer (SPH, SPL) + u8 m_f; // flags enum { C_FLAG = 1, @@ -81,39 +81,39 @@ protected: }; // internal data memory read/write - uint8_t read_mx(); - uint8_t read_my(); - uint8_t read_mn(); - void write_mx(uint8_t data); - void write_my(uint8_t data); - void write_mn(uint8_t data); + u8 read_mx(); + u8 read_my(); + u8 read_mn(); + void write_mx(u8 data); + void write_my(u8 data); + void write_mn(u8 data); // common stack ops - void push(uint8_t data); - uint8_t pop(); + void push(u8 data); + u8 pop(); void push_pc(); void pop_pc(); // misc internal helpers - void set_cf(uint8_t data); - void set_zf(uint8_t data); + void set_cf(u8 data); + void set_zf(u8 data); void inc_x(); void inc_y(); void do_branch(int condition = 1); // opcode handlers - uint8_t op_inc(uint8_t x); - uint8_t op_dec(uint8_t x); - uint8_t op_add(uint8_t x, uint8_t y, int decimal = 0); - uint8_t op_adc(uint8_t x, uint8_t y, int decimal = 0); - uint8_t op_sub(uint8_t x, uint8_t y, int decimal = 0); - uint8_t op_sbc(uint8_t x, uint8_t y, int decimal = 0); - - uint8_t op_and(uint8_t x, uint8_t y); - uint8_t op_or(uint8_t x, uint8_t y); - uint8_t op_xor(uint8_t x, uint8_t y); - uint8_t op_rlc(uint8_t x); - uint8_t op_rrc(uint8_t x); + u8 op_inc(u8 x); + u8 op_dec(u8 x); + u8 op_add(u8 x, u8 y, int decimal = 0); + u8 op_adc(u8 x, u8 y, int decimal = 0); + u8 op_sub(u8 x, u8 y, int decimal = 0); + u8 op_sbc(u8 x, u8 y, int decimal = 0); + + u8 op_and(u8 x, u8 y); + u8 op_or(u8 x, u8 y); + u8 op_xor(u8 x, u8 y); + u8 op_rlc(u8 x); + u8 op_rrc(u8 x); }; diff --git a/src/devices/cpu/e0c6200/e0c6200d.cpp b/src/devices/cpu/e0c6200/e0c6200d.cpp index eb8c4d55091..fde754ef051 100644 --- a/src/devices/cpu/e0c6200/e0c6200d.cpp +++ b/src/devices/cpu/e0c6200/e0c6200d.cpp @@ -34,7 +34,7 @@ static const char *const em_name[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t em_flags[] = +static const u32 em_flags[] = { 0, _OUT, _OVER, _OVER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -56,7 +56,7 @@ enum e_params // 0-digit is number of bits per opcode parameter, 0 bits is literal, // 0x10-digit is for shift-right, 0x100-digit is special flag for r/q param -static const uint16_t ep_bits[] = +static const u16 ep_bits[] = { 8, 8, 4, 0x102, 0x122, 0x142, 0x102, 0, 0, 0, 0, @@ -65,7 +65,7 @@ static const uint16_t ep_bits[] = }; // redirect for r/q param -static const uint8_t ep_redirect_r[4] = { ep_A, ep_B, ep_MX, ep_MY }; +static const u8 ep_redirect_r[4] = { ep_A, ep_B, ep_MX, ep_MY }; // literal opcode parameter static const char *const ep_name[] = @@ -77,11 +77,11 @@ static const char *const ep_name[] = }; -static char* decode_param(uint16_t opcode, int param, char* buffer) +static char* decode_param(u16 opcode, int param, char* buffer) { int bits = ep_bits[param] & 0xf; int shift = ep_bits[param] >> 4 & 0xf; - uint16_t opmask = opcode >> shift & ((1 << bits) - 1); + u16 opmask = opcode >> shift & ((1 << bits) - 1); // redirect r/q to A/B/MX/MY if (ep_bits[param] & 0x100) @@ -112,7 +112,7 @@ static char* decode_param(uint16_t opcode, int param, char* buffer) CPU_DISASSEMBLE(e0c6200) { - uint16_t op = (oprom[1] | oprom[0] << 8) & 0xfff; + u16 op = (oprom[1] | oprom[0] << 8) & 0xfff; int m; int p1 = -1; diff --git a/src/devices/cpu/e0c6200/e0c6200op.cpp b/src/devices/cpu/e0c6200/e0c6200op.cpp index ed2d4a06031..94295e43889 100644 --- a/src/devices/cpu/e0c6200/e0c6200op.cpp +++ b/src/devices/cpu/e0c6200/e0c6200op.cpp @@ -10,38 +10,38 @@ // MX/MY -uint8_t e0c6200_cpu_device::read_mx() +u8 e0c6200_cpu_device::read_mx() { - uint16_t address = m_xp << 8 | m_xh << 4 | m_xl; + u16 address = m_xp << 8 | m_xh << 4 | m_xl; return m_data->read_byte(address) & 0xf; } -uint8_t e0c6200_cpu_device::read_my() +u8 e0c6200_cpu_device::read_my() { - uint16_t address = m_yp << 8 | m_yh << 4 | m_yl; + u16 address = m_yp << 8 | m_yh << 4 | m_yl; return m_data->read_byte(address) & 0xf; } -void e0c6200_cpu_device::write_mx(uint8_t data) +void e0c6200_cpu_device::write_mx(u8 data) { - uint16_t address = m_xp << 8 | m_xh << 4 | m_xl; + u16 address = m_xp << 8 | m_xh << 4 | m_xl; m_data->write_byte(address, data); } -void e0c6200_cpu_device::write_my(uint8_t data) +void e0c6200_cpu_device::write_my(u8 data) { - uint16_t address = m_yp << 8 | m_yh << 4 | m_yl; + u16 address = m_yp << 8 | m_yh << 4 | m_yl; m_data->write_byte(address, data); } // Mn(RP) -uint8_t e0c6200_cpu_device::read_mn() +u8 e0c6200_cpu_device::read_mn() { return m_data->read_byte(m_op & 0xf) & 0xf; } -void e0c6200_cpu_device::write_mn(uint8_t data) +void e0c6200_cpu_device::write_mn(u8 data) { m_data->write_byte(m_op & 0xf, data); } @@ -49,12 +49,12 @@ void e0c6200_cpu_device::write_mn(uint8_t data) // common stack ops -void e0c6200_cpu_device::push(uint8_t data) +void e0c6200_cpu_device::push(u8 data) { m_data->write_byte(--m_sp, data); } -uint8_t e0c6200_cpu_device::pop() +u8 e0c6200_cpu_device::pop() { return m_data->read_byte(m_sp++) & 0xf; } @@ -70,7 +70,7 @@ void e0c6200_cpu_device::push_pc() void e0c6200_cpu_device::pop_pc() { // the highest bit(bank bit) is unchanged - uint16_t bank = m_pc & 0x1000; + u16 bank = m_pc & 0x1000; m_pc = pop(); m_pc |= pop() << 4; m_pc |= pop() << 8; @@ -80,13 +80,13 @@ void e0c6200_cpu_device::pop_pc() // misc internal helpers -void e0c6200_cpu_device::set_cf(uint8_t data) +void e0c6200_cpu_device::set_cf(u8 data) { // set carry flag if bit 4 is set, reset otherwise m_f = (m_f & ~C_FLAG) | ((data & 0x10) ? C_FLAG : 0); } -void e0c6200_cpu_device::set_zf(uint8_t data) +void e0c6200_cpu_device::set_zf(u8 data) { // set zero flag if 4-bit data is 0, reset otherwise m_f = (m_f & ~Z_FLAG) | ((data & 0xf) ? 0 : Z_FLAG); @@ -121,7 +121,7 @@ void e0c6200_cpu_device::do_branch(int condition) // arithmetic instructions -uint8_t e0c6200_cpu_device::op_inc(uint8_t x) +u8 e0c6200_cpu_device::op_inc(u8 x) { // INC x: increment x (flags: C, Z) m_icount -= 2; @@ -130,7 +130,7 @@ uint8_t e0c6200_cpu_device::op_inc(uint8_t x) return x & 0xf; } -uint8_t e0c6200_cpu_device::op_dec(uint8_t x) +u8 e0c6200_cpu_device::op_dec(u8 x) { // DEC x: decrement x (flags: C, Z) m_icount -= 2; @@ -139,7 +139,7 @@ uint8_t e0c6200_cpu_device::op_dec(uint8_t x) return x & 0xf; } -uint8_t e0c6200_cpu_device::op_add(uint8_t x, uint8_t y, int decimal) +u8 e0c6200_cpu_device::op_add(u8 x, u8 y, int decimal) { // ADD x,y: add y to x (flags: C, Z) m_icount -= 2; @@ -157,13 +157,13 @@ uint8_t e0c6200_cpu_device::op_add(uint8_t x, uint8_t y, int decimal) return x & 0xf; } -uint8_t e0c6200_cpu_device::op_adc(uint8_t x, uint8_t y, int decimal) +u8 e0c6200_cpu_device::op_adc(u8 x, u8 y, int decimal) { // ADC x,y: add with carry y to x (flags: C, Z) return op_add(x, y + (m_f & 1), decimal); } -uint8_t e0c6200_cpu_device::op_sub(uint8_t x, uint8_t y, int decimal) +u8 e0c6200_cpu_device::op_sub(u8 x, u8 y, int decimal) { // SUB x,y: subtract y from x (flags: C, Z) m_icount -= 2; @@ -178,7 +178,7 @@ uint8_t e0c6200_cpu_device::op_sub(uint8_t x, uint8_t y, int decimal) return x & 0xf; } -uint8_t e0c6200_cpu_device::op_sbc(uint8_t x, uint8_t y, int decimal) +u8 e0c6200_cpu_device::op_sbc(u8 x, u8 y, int decimal) { // SBC x,y: subtract with carry y from x (flags: C, Z) return op_sub(x, y + (m_f & 1), decimal); @@ -187,7 +187,7 @@ uint8_t e0c6200_cpu_device::op_sbc(uint8_t x, uint8_t y, int decimal) // logical instructions -uint8_t e0c6200_cpu_device::op_and(uint8_t x, uint8_t y) +u8 e0c6200_cpu_device::op_and(u8 x, u8 y) { // AND x,y: logical AND x with y (flags: Z) m_icount -= 2; @@ -196,7 +196,7 @@ uint8_t e0c6200_cpu_device::op_and(uint8_t x, uint8_t y) return x; } -uint8_t e0c6200_cpu_device::op_or(uint8_t x, uint8_t y) +u8 e0c6200_cpu_device::op_or(u8 x, u8 y) { // OR x,y: logical OR x with y (flags: Z) m_icount -= 2; @@ -205,7 +205,7 @@ uint8_t e0c6200_cpu_device::op_or(uint8_t x, uint8_t y) return x; } -uint8_t e0c6200_cpu_device::op_xor(uint8_t x, uint8_t y) +u8 e0c6200_cpu_device::op_xor(u8 x, u8 y) { // XOR x,y: exclusive-OR x with y (flags: Z) m_icount -= 2; @@ -214,7 +214,7 @@ uint8_t e0c6200_cpu_device::op_xor(uint8_t x, uint8_t y) return x; } -uint8_t e0c6200_cpu_device::op_rlc(uint8_t x) +u8 e0c6200_cpu_device::op_rlc(u8 x) { // RLC x: rotate x left through carry (flags: C, Z) m_icount -= 2; @@ -223,7 +223,7 @@ uint8_t e0c6200_cpu_device::op_rlc(uint8_t x) return x & 0xf; } -uint8_t e0c6200_cpu_device::op_rrc(uint8_t x) +u8 e0c6200_cpu_device::op_rrc(u8 x) { // RRC x: rotate x right through carry (flags: C, Z) // note: RRC only takes 5 clock cycles diff --git a/src/devices/cpu/e0c6200/e0c6s46.cpp b/src/devices/cpu/e0c6200/e0c6s46.cpp index 4feed3f4e32..49a754adf33 100644 --- a/src/devices/cpu/e0c6200/e0c6s46.cpp +++ b/src/devices/cpu/e0c6200/e0c6s46.cpp @@ -45,7 +45,7 @@ ADDRESS_MAP_END // device definitions -e0c6s46_device::e0c6s46_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +e0c6s46_device::e0c6s46_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : e0c6200_cpu_device(mconfig, E0C6S46, "E0C6S46", tag, owner, clock, ADDRESS_MAP_NAME(e0c6s46_program), ADDRESS_MAP_NAME(e0c6s46_data), "e0c6s46", __FILE__) , m_vram1(*this, "vram1") , m_vram2(*this, "vram2"), m_osc(0), m_svd(0), m_lcd_control(0), m_lcd_contrast(0) @@ -279,7 +279,7 @@ void e0c6s46_device::execute_set_input(int line, int state) state = (state) ? 1 : 0; int port = line >> 2 & 1; - uint8_t bit = 1 << (line & 3); + u8 bit = 1 << (line & 3); m_port_k[port] = (m_port_k[port] & ~bit) | (state ? bit : 0); } @@ -292,13 +292,13 @@ void e0c6s46_device::execute_set_input(int line, int state) // R output ports -void e0c6s46_device::write_r(uint8_t port, uint8_t data) +void e0c6s46_device::write_r(u8 port, u8 data) { data &= 0xf; m_port_r[port] = data; // ports R0x-R3x can be high-impedance - uint8_t out = data; + u8 out = data; if (port < 4 && !(m_r_dir >> port & 1)) out = 0xf; @@ -327,14 +327,14 @@ void e0c6s46_device::write_r4_out() // R40: _FOUT(clock inverted output) // R42: FOUT or _BZ // R43: BZ(buzzer) - uint8_t out = (m_port_r[4] & 2) | (m_bz_pulse << 3) | (m_bz_pulse << 2 ^ 4); + u8 out = (m_port_r[4] & 2) | (m_bz_pulse << 3) | (m_bz_pulse << 2 ^ 4); m_write_r4(4, out, 0xff); } // P I/O ports -void e0c6s46_device::write_p(uint8_t port, uint8_t data) +void e0c6s46_device::write_p(u8 port, u8 data) { data &= 0xf; m_port_p[port] = data; @@ -352,7 +352,7 @@ void e0c6s46_device::write_p(uint8_t port, uint8_t data) } } -uint8_t e0c6s46_device::read_p(uint8_t port) +u8 e0c6s46_device::read_p(u8 port) { // return written value if port direction is set to output if (m_p_dir >> port & 1) @@ -416,7 +416,7 @@ void e0c6s46_device::clock_clktimer() m_clktimer_count++; // irq on falling edge of 32, 8, 2, 1hz - uint8_t flag = 0; + u8 flag = 0; if ((m_clktimer_count & 0x07) == 0) flag |= 1; if ((m_clktimer_count & 0x1f) == 0) @@ -488,7 +488,7 @@ void e0c6s46_device::clock_prgtimer() bool e0c6s46_device::prgtimer_reset_prescaler() { // only 2 to 7 are clock dividers - uint8_t sel = m_prgtimer_select & 7; + u8 sel = m_prgtimer_select & 7; if (sel >= 2) m_prgtimer_handle->adjust(attotime::from_ticks(2 << (sel ^ 7), unscaled_clock())); @@ -572,12 +572,12 @@ void e0c6s46_device::clock_bz_1shot() // LCD Driver //------------------------------------------------- -uint32_t e0c6s46_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 e0c6s46_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // call this 32 times per second (osc1/1024: 32hz at default clock of 32768hz) for (int bank = 0; bank < 2; bank++) { - const uint8_t* vram = bank ? m_vram2 : m_vram1; + const u8* vram = bank ? m_vram2 : m_vram1; // determine operating mode bool lcd_on = false; @@ -626,7 +626,7 @@ READ8_MEMBER(e0c6s46_device::io_r) case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: { // irq flags are reset(acked) when read - uint8_t flag = m_irqflag[offset]; + u8 flag = m_irqflag[offset]; if (!space.debugger_access()) m_irqflag[offset] = 0; return flag; @@ -719,7 +719,7 @@ WRITE8_MEMBER(e0c6s46_device::io_w) // irq masks case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: { - static const uint8_t maskmask[6] = { 0xf, 3, 1, 1, 0xf, 0xf }; + static const u8 maskmask[6] = { 0xf, 3, 1, 1, 0xf, 0xf }; m_irqmask[offset-0x10] = data & maskmask[offset-0x10]; m_possible_irq = true; break; diff --git a/src/devices/cpu/e0c6200/e0c6s46.h b/src/devices/cpu/e0c6200/e0c6s46.h index 0d3ad7c250c..d4e4d0f50af 100644 --- a/src/devices/cpu/e0c6200/e0c6s46.h +++ b/src/devices/cpu/e0c6200/e0c6s46.h @@ -16,7 +16,7 @@ // 5 4-bit R output ports #define MCFG_E0C6S46_WRITE_R_CB(R, _devcb) \ - e0c6s46_device::set_write_r##R##_callback(*device, DEVCB_##_devcb); + devcb = &e0c6s46_device::set_write_r##R##_callback(*device, DEVCB_##_devcb); enum { @@ -29,9 +29,9 @@ enum // 4 4-bit P I/O ports #define MCFG_E0C6S46_READ_P_CB(R, _devcb) \ - hmcs40_cpu_device::set_read_r##P##_callback(*device, DEVCB_##_devcb); + devcb = &hmcs40_cpu_device::set_read_r##P##_callback(*device, DEVCB_##_devcb); #define MCFG_E0C6S46_WRITE_P_CB(R, _devcb) \ - e0c6s46_device::set_write_r##P##_callback(*device, DEVCB_##_devcb); + devcb = &e0c6s46_device::set_write_r##P##_callback(*device, DEVCB_##_devcb); enum { @@ -66,7 +66,7 @@ typedef void (*e0c6s46_pixel_update_func)(device_t &device, bitmap_ind16 &bitmap class e0c6s46_device : public e0c6200_cpu_device { public: - e0c6s46_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + e0c6s46_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // static configuration helpers template<class _Object> static devcb_base &set_write_r0_callback(device_t &device, _Object object) { return downcast<e0c6s46_device &>(device).m_write_r0.set_callback(object); } @@ -89,7 +89,7 @@ public: DECLARE_READ8_MEMBER(io_r); DECLARE_WRITE8_MEMBER(io_w); - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: // device-level overrides @@ -97,40 +97,40 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint32_t execute_input_lines() const override { return 8; } + virtual u32 execute_input_lines() const override { return 8; } virtual void execute_set_input(int line, int state) override; virtual void execute_one() override; virtual bool check_interrupt() override; private: - required_shared_ptr<uint8_t> m_vram1; - required_shared_ptr<uint8_t> m_vram2; + required_shared_ptr<u8> m_vram1; + required_shared_ptr<u8> m_vram2; - uint8_t m_irqflag[6]; - uint8_t m_irqmask[6]; - uint8_t m_osc; - uint8_t m_svd; + u8 m_irqflag[6]; + u8 m_irqmask[6]; + u8 m_osc; + u8 m_svd; - uint8_t m_lcd_control; - uint8_t m_lcd_contrast; + u8 m_lcd_control; + u8 m_lcd_contrast; e0c6s46_pixel_update_func m_pixel_update_handler; // i/o ports devcb_write8 m_write_r0, m_write_r1, m_write_r2, m_write_r3, m_write_r4; devcb_read8 m_read_p0, m_read_p1, m_read_p2, m_read_p3; devcb_write8 m_write_p0, m_write_p1, m_write_p2, m_write_p3; - void write_r(uint8_t port, uint8_t data); + void write_r(u8 port, u8 data); void write_r4_out(); - void write_p(uint8_t port, uint8_t data); - uint8_t read_p(uint8_t port); + void write_p(u8 port, u8 data); + u8 read_p(u8 port); - uint8_t m_port_r[5]; - uint8_t m_r_dir; - uint8_t m_port_p[4]; - uint8_t m_p_dir; - uint8_t m_p_pullup; - uint8_t m_port_k[2]; - uint8_t m_dfk0; + u8 m_port_r[5]; + u8 m_r_dir; + u8 m_port_p[4]; + u8 m_p_dir; + u8 m_p_pullup; + u8 m_port_k[2]; + u8 m_dfk0; // timers int m_256_src_pulse; @@ -139,34 +139,34 @@ private: int m_watchdog_count; void clock_watchdog(); - uint8_t m_clktimer_count; + u8 m_clktimer_count; void clock_clktimer(); - uint8_t m_stopwatch_on; + u8 m_stopwatch_on; int m_swl_cur_pulse; int m_swl_slice; int m_swl_count; int m_swh_count; void clock_stopwatch(); - uint8_t m_prgtimer_select; - uint8_t m_prgtimer_on; + u8 m_prgtimer_select; + u8 m_prgtimer_on; int m_prgtimer_src_pulse; int m_prgtimer_cur_pulse; - uint8_t m_prgtimer_count; - uint8_t m_prgtimer_reload; + u8 m_prgtimer_count; + u8 m_prgtimer_reload; emu_timer *m_prgtimer_handle; TIMER_CALLBACK_MEMBER(prgtimer_cb); bool prgtimer_reset_prescaler(); void clock_prgtimer(); - uint8_t m_bz_43_on; - uint8_t m_bz_freq; - uint8_t m_bz_envelope; - uint8_t m_bz_duty_ratio; - uint8_t m_bz_1shot_on; + u8 m_bz_43_on; + u8 m_bz_freq; + u8 m_bz_envelope; + u8 m_bz_duty_ratio; + u8 m_bz_1shot_on; bool m_bz_1shot_running; - uint8_t m_bz_1shot_count; + u8 m_bz_1shot_count; int m_bz_pulse; emu_timer *m_buzzer_handle; TIMER_CALLBACK_MEMBER(buzzer_cb); diff --git a/src/devices/cpu/hcd62121/hcd62121.cpp b/src/devices/cpu/hcd62121/hcd62121.cpp index 3c8e98149ea..59930adceec 100644 --- a/src/devices/cpu/hcd62121/hcd62121.cpp +++ b/src/devices/cpu/hcd62121/hcd62121.cpp @@ -10,6 +10,10 @@ CFX-9850 (and maybe some other things too). This CPU core is based on the information provided by Martin Poupe. Martin Poupe's site can be found at http://martin.poupe.org/casio/ +TODO: + - instruction timings + - unknown instructions + **********************************************************************/ #include "emu.h" @@ -19,11 +23,11 @@ Martin Poupe's site can be found at http://martin.poupe.org/casio/ /* From the battery check routine at 20:e874 it looks like bit 3 of the flag register should be the Zero flag. */ -#define _FLAG_Z 0x08 -#define _FLAG_C 0x02 -#define _FLAG_ZL 0x04 -#define _FLAG_CL 0x01 -#define _FLAG_ZH 0x10 +constexpr u8 FLAG_Z = 0x08; +constexpr u8 FLAG_C = 0x02; +constexpr u8 FLAG_ZL = 0x04; +constexpr u8 FLAG_CL = 0x01; +constexpr u8 FLAG_ZH = 0x10; const device_type HCD62121 = &device_creator<hcd62121_cpu_device>; @@ -32,105 +36,105 @@ const device_type HCD62121 = &device_creator<hcd62121_cpu_device>; hcd62121_cpu_device::hcd62121_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : cpu_device(mconfig, HCD62121, "Hitachi HCD62121", tag, owner, clock, "hcd62121", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 8, 24, 0) - , m_io_config("io", ENDIANNESS_BIG, 8, 8, 0), m_prev_pc(0) - , m_sp(0) + , m_prev_pc(0) + , m_sp(0) , m_ip(0) , m_dsize(0) , m_cseg(0) , m_dseg(0) , m_sseg(0) , m_f(0) - , m_lar(0), m_program(nullptr), m_io(nullptr), m_icount(0) + , m_lar(0) + , m_program(nullptr) + , m_icount(0) + , m_kol_cb(*this) + , m_koh_cb(*this) + , m_ki_cb(*this) + , m_in0_cb(*this) { } -uint8_t hcd62121_cpu_device::read_op() +u8 hcd62121_cpu_device::read_op() { - uint8_t d = m_program->read_byte( ( m_cseg << 16 ) | m_ip ); + u8 d = m_program->read_byte( ( m_cseg << 16 ) | m_ip ); m_ip++; return d; } -uint8_t hcd62121_cpu_device::datasize( uint8_t op ) +u8 hcd62121_cpu_device::datasize(u8 op) { - switch( op & 0x03 ) + switch (op & 0x03) { case 0: return 1; case 1: return 2; case 2: - return ( m_dsize >> 4 ) + 1; + return (m_dsize >> 4) + 1; case 3: - return ( m_dsize & 0x0f ) + 1; + return (m_dsize & 0x0f) + 1; } return 1; } -void hcd62121_cpu_device::read_reg( int size, uint8_t op1 ) +void hcd62121_cpu_device::read_reg(int size, u8 op1) { - int i; - - if ( op1 & 0x80 ) + if (op1 & 0x80) { - for ( i = 0; i < size; i++ ) - m_temp1[i] = m_reg[ ( op1 - i ) & 0x7f ]; + for (int i = 0; i < size; i++) + m_temp1[i] = m_reg[(op1 - i) & 0x7f]; } else { - for ( i = 0; i < size; i++ ) - m_temp1[i] = m_reg[ ( op1 + i ) & 0x7f ]; + for (int i = 0; i < size; i++) + m_temp1[i] = m_reg[(op1 + i) & 0x7f]; } } -void hcd62121_cpu_device::write_reg( int size, uint8_t op1 ) +void hcd62121_cpu_device::write_reg(int size, u8 op1) { - int i; - - if ( op1 & 0x80 ) + if (op1 & 0x80) { - for ( i = 0; i < size; i++ ) - m_reg[ ( op1 - i ) & 0x7f ] = m_temp1[i]; + for (int i = 0; i < size; i++) + m_reg[(op1 - i) & 0x7f] = m_temp1[i]; } else { - for ( i = 0; i < size; i++ ) - m_reg[ ( op1 + i ) & 0x7f ] = m_temp1[i]; + for (int i = 0; i < size; i++) + m_reg[(op1 + i) & 0x7f] = m_temp1[i]; } } -void hcd62121_cpu_device::read_regreg( int size, uint8_t op1, uint8_t op2, bool op_is_logical ) +void hcd62121_cpu_device::read_regreg(int size, u8 op1, u8 op2, bool op_is_logical) { - int i; + for (int i = 0; i < size; i++) + m_temp1[i] = m_reg[(op1 + i) & 0x7f]; - for ( i = 0; i < size; i++ ) - m_temp1[i] = m_reg[ (op1 + i) & 0x7f]; - - if ( op1 & 0x80 ) + if (op1 & 0x80) { /* Second operand is an immediate value */ m_temp2[0] = op2; - for ( i = 1; i < size; i++ ) + for (int i = 1; i < size; i++) m_temp2[i] = op_is_logical ? op2 : 0; } else { /* Second operand is a register */ - for ( i = 0; i < size; i++ ) - m_temp2[i] = m_reg[ (op2 + i) & 0x7f ]; + for (int i = 0; i < size; i++) + m_temp2[i] = m_reg[(op2 + i) & 0x7f]; } - if ( ! ( op1 & 0x80 ) && ! ( op2 & 0x80 ) ) + if (!(op1 & 0x80) && !(op2 & 0x80)) { /* We need to swap parameters */ - for ( i = 0; i < size; i++ ) + for (int i = 0; i < size; i++) { - uint8_t v = m_temp1[i]; + u8 v = m_temp1[i]; m_temp1[i] = m_temp2[i]; m_temp2[i] = v; } @@ -138,57 +142,52 @@ void hcd62121_cpu_device::read_regreg( int size, uint8_t op1, uint8_t op2, bool } -void hcd62121_cpu_device::write_regreg( int size, uint8_t op1, uint8_t op2 ) +void hcd62121_cpu_device::write_regreg(int size, u8 op1, u8 op2) { - int i; - - if ( ( op1 & 0x80 ) || ( op2 & 0x80 ) ) + if ((op1 & 0x80) || (op2 & 0x80)) { /* store in reg1 */ - for ( i = 0; i < size; i++ ) - m_reg[ (op1 + i) & 0x7f] = m_temp1[i]; + for (int i = 0; i < size; i++) + m_reg[(op1 + i) & 0x7f] = m_temp1[i]; } else { /* store in reg2 */ - for ( i = 0; i < size; i++ ) - m_reg[ (op2 + i) & 0x7f] = m_temp1[i]; + for (int i = 0; i < size; i++) + m_reg[(op2 + i) & 0x7f] = m_temp1[i]; } } -void hcd62121_cpu_device::read_iregreg( int size, uint8_t op1, uint8_t op2 ) +void hcd62121_cpu_device::read_iregreg(int size, u8 op1, u8 op2) { - int i; - uint16_t ad; + u16 ad = m_reg[(0x40 | op1) & 0x7f ] | (m_reg[(0x40 | (op1 + 1)) & 0x7f] << 8); - ad = m_reg[ ( 0x40 | op1 ) & 0x7f ] | ( m_reg[ ( 0x40 | ( op1 + 1 ) ) & 0x7f ] << 8 ); - - for ( i = 0; i < size; i++ ) + for (int i = 0; i < size; i++) { - m_temp1[i] = m_program->read_byte( ( m_dseg << 16 ) | ad ); - ad += ( op1 & 0x40 ) ? -1 : 1; + m_temp1[i] = m_program->read_byte((m_dseg << 16) | ad); + ad += (op1 & 0x40) ? -1 : 1; } m_lar = ad; - if ( op1 & 0x80 ) + if (op1 & 0x80) { m_temp2[0] = op2; - for ( i = 1; i < size; i++ ) + for (int i = 1; i < size; i++) m_temp2[i] = 0; } else { - for ( i = 0; i < size; i++ ) - m_temp2[i] = m_reg[ (op2 + i) & 0x7f ]; + for (int i = 0; i < size; i++) + m_temp2[i] = m_reg[(op2 + i) & 0x7f]; } - if ( ! ( op1 & 0x80 ) && ! ( op2 & 0x80 ) ) + if (!(op1 & 0x80) && !(op2 & 0x80)) { /* We need to swap parameters */ - for ( i = 0; i < size; i++ ) + for (int i = 0; i < size; i++) { - uint8_t v = m_temp1[i]; + u8 v = m_temp1[i]; m_temp1[i] = m_temp2[i]; m_temp2[i] = v; } @@ -196,174 +195,170 @@ void hcd62121_cpu_device::read_iregreg( int size, uint8_t op1, uint8_t op2 ) } -void hcd62121_cpu_device::write_iregreg( int size, uint8_t op1, uint8_t op2 ) +void hcd62121_cpu_device::write_iregreg(int size, u8 op1, u8 op2) { - int i; - - if ( ( op1 & 0x80 ) || ( op2 & 0x80 ) ) + if ((op1 & 0x80) || (op2 & 0x80)) { /* store in (reg1) */ - uint16_t ad = m_reg[ ( 0x40 | op1 ) & 0x7f ] | ( m_reg[ ( 0x40 | ( op1 + 1 ) ) & 0x7f ] << 8 ); + u16 ad = m_reg[(0x40 | op1) & 0x7f] | (m_reg[(0x40 | (op1 + 1)) & 0x7f] << 8); - for ( i = 0; i < size; i++ ) + for (int i = 0; i < size; i++) { - m_program->write_byte( ( m_dseg << 16 ) | ad, m_temp1[i] ); - ad += ( op1 & 0x40 ) ? -1 : 1; + m_program->write_byte((m_dseg << 16) | ad, m_temp1[i]); + ad += (op1 & 0x40) ? -1 : 1; } m_lar = ad; } else { /* store in reg2 */ - for ( i = 0; i < size; i++ ) - m_reg[ (op2 + i) & 0x7f] = m_temp1[i]; + for (int i = 0; i < size; i++) + m_reg[(op2 + i) & 0x7f] = m_temp1[i]; } } -void hcd62121_cpu_device::write_iregreg2( int size, uint8_t op1, uint8_t op2 ) +void hcd62121_cpu_device::write_iregreg2(int size, u8 op1, u8 op2) { - int i; - - if ( ( op1 & 0x80 ) || ( op2 & 0x80 ) ) + if ((op1 & 0x80) || (op2 & 0x80)) { /* store in reg2 */ - for ( i = 0; i < size; i++ ) - m_reg[ (op2 + i) & 0x7f] = m_temp2[i]; + for (int i = 0; i < size; i++) + m_reg[(op2 + i) & 0x7f] = m_temp2[i]; } else { /* store in (reg1) */ - uint16_t ad = m_reg[ ( 0x40 | op1 ) & 0x7f ] | ( m_reg[ ( 0x40 | ( op1 + 1 ) ) & 0x7f ] << 8 ); + u16 ad = m_reg[(0x40 | op1) & 0x7f] | (m_reg[(0x40 | (op1 + 1)) & 0x7f] << 8); - for ( i = 0; i < size; i++ ) + for (int i = 0; i < size; i++) { - m_program->write_byte( ( m_dseg << 16 ) | ad, m_temp2[i] ); - ad += ( op1 & 0x40 ) ? -1 : 1; + m_program->write_byte((m_dseg << 16) | ad, m_temp2[i]); + ad += (op1 & 0x40) ? -1 : 1; } m_lar = ad; } } -int hcd62121_cpu_device::check_cond( uint8_t op ) +bool hcd62121_cpu_device::check_cond(u8 op) { - switch ( op & 0x07 ) + switch (op & 0x07) { case 0x00: /* ZH set */ - if ( m_f & _FLAG_ZH ) - return 1; - break; + return (m_f & FLAG_ZH); case 0x01: /* ZL set */ - if ( m_f & _FLAG_ZL ) - return 1; - break; + return (m_f & FLAG_ZL); case 0x02: /* C set */ - if ( m_f & _FLAG_C ) - return 1; - break; + return (m_f & FLAG_C); case 0x03: /* Z set */ - if ( m_f & _FLAG_Z ) - return 1; - break; + return (m_f & FLAG_Z); case 0x04: /* Z or C set */ - if ( m_f & ( _FLAG_Z | _FLAG_C ) ) - return 1; - break; + return (m_f & (FLAG_Z | FLAG_C)); case 0x05: /* CL set */ - if ( m_f & _FLAG_CL ) - return 1; - break; + return (m_f & FLAG_CL); case 0x06: /* C clear */ - if ( ! ( m_f & _FLAG_C ) ) - return 1; - break; + return (!(m_f & FLAG_C)); case 0x07: /* Z clear */ - if ( ! ( m_f & _FLAG_Z ) ) - return 1; - break; + return (!(m_f & FLAG_Z)); } - return 0; + return false; } void hcd62121_cpu_device::device_start() { m_program = &space(AS_PROGRAM); - m_io = &space(AS_IO); - - save_item( NAME(m_prev_pc) ); - save_item( NAME(m_sp) ); - save_item( NAME(m_ip) ); - save_item( NAME(m_dsize) ); - save_item( NAME(m_cseg) ); - save_item( NAME(m_dseg) ); - save_item( NAME(m_sseg) ); - save_item( NAME(m_f) ); - save_item( NAME(m_lar) ); - save_item( NAME(m_reg) ); - save_item( NAME(m_temp1) ); - save_item( NAME(m_temp2) ); + + m_kol_cb.resolve_safe(); + m_koh_cb.resolve_safe(); + m_ki_cb.resolve_safe(0); + m_in0_cb.resolve_safe(0); + + save_item(NAME(m_prev_pc)); + save_item(NAME(m_sp)); + save_item(NAME(m_ip)); + save_item(NAME(m_dsize)); + save_item(NAME(m_cseg)); + save_item(NAME(m_dseg)); + save_item(NAME(m_sseg)); + save_item(NAME(m_f)); + save_item(NAME(m_lar)); + save_item(NAME(m_reg)); + save_item(NAME(m_temp1)); + save_item(NAME(m_temp2)); // Register state for debugger - state_add( STATE_GENPC, "GENPC", m_ip ).callexport().formatstr("%8s"); - state_add( STATE_GENPCBASE,"CURPC", m_ip ).callexport().formatstr("%8s"); - state_add( STATE_GENFLAGS, "GENFLAGS", m_f ).callimport().callexport().formatstr("%12s").noshow(); - - state_add( HCD62121_IP, "IP", m_ip ).callimport().callexport().formatstr("%04X"); - state_add( HCD62121_SP, "SP", m_sp ).callimport().callexport().formatstr("%04X"); - state_add( HCD62121_LAR, "LAR", m_lar ).callimport().callexport().formatstr("%04X"); - state_add( HCD62121_CS, "CS", m_cseg ).callimport().callexport().formatstr("%02X"); - state_add( HCD62121_DS, "DS", m_dseg ).callimport().callexport().formatstr("%02X"); - state_add( HCD62121_SS, "SS", m_sseg ).callimport().callexport().formatstr("%02X"); - state_add( HCD62121_DSIZE, "DSIZE", m_dsize ).callimport().callexport().formatstr("%02X"); - state_add( HCD62121_F, "F", m_f ).callimport().callexport().formatstr("%02X"); - - state_add( HCD62121_R00, "R00", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R04, "R04", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R08, "R08", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R0C, "R0C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R10, "R10", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R14, "R14", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R18, "R18", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R1C, "R1C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R20, "R20", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R24, "R24", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R28, "R28", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R2C, "R2C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R30, "R30", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R34, "R34", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R38, "R38", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R3C, "R3C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R40, "R40", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R44, "R44", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R48, "R48", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R4C, "R4C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R50, "R50", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R54, "R54", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R58, "R58", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R5C, "R5C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R60, "R60", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R64, "R64", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R68, "R68", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R6C, "R6C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R70, "R70", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R74, "R74", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R78, "R78", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); - state_add( HCD62121_R7C, "R7C", m_reg[0x00] ).callimport().callexport().formatstr("%8s"); + state_add(STATE_GENPC, "GENPC", m_rtemp).callexport().formatstr("%8s"); + state_add(STATE_GENPCBASE,"CURPC", m_rtemp).callexport().formatstr("%8s"); + state_add(STATE_GENFLAGS, "GENFLAGS", m_f ).callimport().callexport().formatstr("%12s").noshow(); + + state_add(HCD62121_IP, "IP", m_ip ).callimport().callexport().formatstr("%04X"); + state_add(HCD62121_SP, "SP", m_sp ).callimport().callexport().formatstr("%04X"); + state_add(HCD62121_LAR, "LAR", m_lar ).callimport().callexport().formatstr("%04X"); + state_add(HCD62121_CS, "CS", m_cseg ).callimport().callexport().formatstr("%02X"); + state_add(HCD62121_DS, "DS", m_dseg ).callimport().callexport().formatstr("%02X"); + state_add(HCD62121_SS, "SS", m_sseg ).callimport().callexport().formatstr("%02X"); + state_add(HCD62121_DSIZE, "DSIZE", m_dsize).callimport().callexport().formatstr("%02X"); + state_add(HCD62121_F, "F", m_f ).callimport().callexport().formatstr("%02X"); + + state_add(HCD62121_R00, "R00", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R04, "R04", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R08, "R08", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R0C, "R0C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R10, "R10", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R14, "R14", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R18, "R18", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R1C, "R1C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R20, "R20", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R24, "R24", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R28, "R28", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R2C, "R2C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R30, "R30", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R34, "R34", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R38, "R38", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R3C, "R3C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R40, "R40", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R44, "R44", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R48, "R48", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R4C, "R4C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R50, "R50", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R54, "R54", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R58, "R58", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R5C, "R5C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R60, "R60", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R64, "R64", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R68, "R68", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R6C, "R6C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R70, "R70", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R74, "R74", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R78, "R78", m_reg[0x00]).callimport().callexport().formatstr("%8s"); + state_add(HCD62121_R7C, "R7C", m_reg[0x00]).callimport().callexport().formatstr("%8s"); m_icountptr = &m_icount; } +void hcd62121_cpu_device::state_export(const device_state_entry &entry) +{ + switch (entry.index()) + { + case STATE_GENPC: + case STATE_GENPCBASE: + m_rtemp = (m_cseg << 16) | m_ip; + break; + } +} + + void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) @@ -375,11 +370,11 @@ void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, s case STATE_GENFLAGS: str = string_format("%s-%s-%s-%c-%c", - m_f & _FLAG_ZH ? "ZH":"__", - m_f & _FLAG_CL ? "CL":"__", - m_f & _FLAG_ZL ? "ZL":"__", - m_f & _FLAG_C ? 'C':'_', - m_f & _FLAG_Z ? 'Z':'_' + m_f & FLAG_ZH ? "ZH":"__", + m_f & FLAG_CL ? "CL":"__", + m_f & FLAG_ZL ? "ZL":"__", + m_f & FLAG_C ? 'C':'_', + m_f & FLAG_Z ? 'Z':'_' ); break; @@ -495,38 +490,999 @@ void hcd62121_cpu_device::device_reset() m_f = 0; m_dsize = 0; - for(auto & elem : m_reg) + for (auto & elem : m_reg) { elem = 0; } } +inline void hcd62121_cpu_device::set_zero_flag(bool is_zero) +{ + if (is_zero) + m_f |= FLAG_Z; + else + m_f &= ~FLAG_Z; +} + + +inline void hcd62121_cpu_device::set_carry_flag(bool is_carry) +{ + if (is_carry) + m_f |= FLAG_C; + else + m_f &= ~FLAG_C; +} + + +inline void hcd62121_cpu_device::set_zl_flag(bool is_zl) +{ + if (is_zl) + m_f |= FLAG_ZL; + else + m_f &= ~FLAG_ZL; +} + + +inline void hcd62121_cpu_device::set_zh_flag(bool is_zh) +{ + if (is_zh) + m_f |= FLAG_ZH; + else + m_f &= ~FLAG_ZH; +} + + +inline void hcd62121_cpu_device::set_cl_flag(bool is_cl) +{ + if (is_cl) + m_f |= FLAG_CL; + else + m_f &= ~FLAG_CL; +} + + +inline void hcd62121_cpu_device::op_msk(int size) +{ + bool mskres = true; + + for (int i = 0; i < size; i++) + { + if ((m_temp1[i] & m_temp2[i]) != m_temp2[i]) + mskres = false; + } + + set_zero_flag(!mskres); +} + + +inline void hcd62121_cpu_device::op_imsk(int size) +{ + bool mskres = true; + bool set_zero = false; + + for (int i = 0; i < size; i++) + { + if ((m_temp1[i] & ~m_temp2[i]) != ~m_temp2[i]) + mskres = false; + if (m_temp1[i] | m_temp2[i]) + set_zero = true; + } + + set_zero_flag(set_zero); + set_carry_flag(!mskres); +} + + +inline void hcd62121_cpu_device::op_and(int size) +{ + bool is_zero = true; + + for (int i = 0; i < size; i++) + { + m_temp1[i] = m_temp1[i] & m_temp2[i]; + if (m_temp1[i]) + is_zero = false; + } + + set_zero_flag(is_zero); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +inline void hcd62121_cpu_device::op_or(int size) +{ + bool is_zero = true; + + for (int i = 0; i < size; i++) + { + m_temp1[i] = m_temp1[i] | m_temp2[i]; + if (m_temp1[i]) + is_zero = false; + } + + set_zero_flag(is_zero); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +inline void hcd62121_cpu_device::op_xor(int size) +{ + bool is_zero = true; + + for (int i = 0; i < size; i++) + { + m_temp1[i] = m_temp1[i] ^ m_temp2[i]; + if (m_temp1[i]) + is_zero = false; + } + + set_zero_flag(is_zero); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +inline void hcd62121_cpu_device::op_add(int size) +{ + bool is_zero = true; + u8 carry = 0; + + set_cl_flag((m_temp1[0] & 0x0f) + (m_temp2[0] & 0x0f) > 15); + + for (int i = 0; i < size; i++) + { + u16 res = m_temp1[i] + m_temp2[i] + carry; + + m_temp1[i] = res & 0xff; + if (m_temp1[i]) + is_zero = false; + + carry = (res & 0xff00) ? 1 : 0; + } + + set_zero_flag(is_zero); + set_carry_flag(carry); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +// BCD ADD +inline void hcd62121_cpu_device::op_addb(int size) +{ + bool is_zero = true; + u8 carry = 0; + + set_cl_flag((m_temp1[0] & 0x0f) + (m_temp2[0] & 0x0f) > 9); + + for (int i = 0; i < size; i++) + { + u16 res = (m_temp1[i] & 0x0f) + (m_temp2[i] & 0x0f) + carry; + + if (res > 9) + { + res += 6; + } + res += (m_temp1[i] & 0xf0) + (m_temp2[i] & 0xf0); + if (res > 0x9f) + { + res += 0x60; + } + m_temp1[i] = res & 0xff; + if (m_temp1[i]) + is_zero = false; + + carry = (res & 0xff00) ? 1 : 0; + } + + set_zero_flag(is_zero); + set_carry_flag(carry); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +inline void hcd62121_cpu_device::op_sub(int size) +{ + bool is_zero = true; + u8 carry = 0; + + set_cl_flag((m_temp1[0] & 0x0f) < (m_temp2[0] & 0x0f)); + + for (int i = 0; i < size; i++) + { + u16 res = m_temp1[i] - m_temp2[i] - carry; + + m_temp1[i] = res & 0xff; + if (m_temp1[i]) + is_zero = false; + + carry = ( res & 0xff00 ) ? 1 : 0; + } + + set_zero_flag(is_zero); + set_carry_flag(carry); + set_zl_flag((m_temp1[0] & 0x0f) == 0); + set_zh_flag((m_temp1[0] & 0xf0) == 0); +} + + +inline void hcd62121_cpu_device::op_pushw(u16 source) +{ + m_program->write_byte(( m_sseg << 16) | m_sp, source & 0xff); + m_sp--; + m_program->write_byte(( m_sseg << 16) | m_sp, source >> 8); + m_sp--; +} + + +inline u16 hcd62121_cpu_device::op_popw() +{ + m_sp++; + u16 res = m_program->read_byte((m_sseg << 16) | m_sp) << 8; + m_sp++; + res |= m_program->read_byte((m_sseg << 16) | m_sp); + + return res; +} + + void hcd62121_cpu_device::execute_run() { do { - uint32_t pc = ( m_cseg << 16 ) | m_ip; - uint8_t op; + offs_t pc = (m_cseg << 16) | m_ip; debugger_instruction_hook(this, pc); m_prev_pc = pc; - op = read_op(); + u8 op = read_op(); + // actual instruction timings unknown m_icount -= 4; - switch ( op ) + switch (op) { -#include "hcd62121_ops.h" + case 0x04: /* mskb r1,r2 */ + case 0x05: /* mskw r1,r2 */ + case 0x06: /* mskq r1,r2 */ + case 0x07: /* mskt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_msk(size); + } + break; + + case 0x08: /* shb r1,4 */ + case 0x09: /* shw r1,4 */ + case 0x0A: /* shq r1,4 */ + case 0x0B: /* sht r1,4 */ + /* Shift is a nibble shift! */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 d1 = 0, d2 = 0; + + read_reg(size, reg1); + + for (int i = 0; i < size; i++) + { + if (reg1 & 0x80) + { + d1 = (m_temp1[i] & 0x0f) << 4; + m_temp1[i] = (m_temp1[i] >> 4) | d2; + } + else + { + d1 = (m_temp1[i] & 0xf0) >> 4; + m_temp1[i] = (m_temp1[i] << 4) | d2; + } + d2 = d1; + } + + write_reg(size, reg1); + } + break; + + case 0x0C: /* testb r1,r2 */ + case 0x0D: /* testw r1,r2 */ + case 0x0E: /* testq r1,r2 */ + case 0x0F: /* testt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_and(size); + } + break; + + case 0x10: /* xorb r1,r2 */ + case 0x11: /* xorw r1,r2 */ + case 0x12: /* xorq r1,r2 */ + case 0x13: /* xort r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_xor(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x14: /* cmpb r1,r2 */ + case 0x15: /* cmpw r1,r2 */ + case 0x16: /* cmpq r1,r2 */ + case 0x17: /* cmpt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_sub(size); + } + break; + + case 0x18: /* movb r1,r2 */ + case 0x19: /* movw r1,r2 */ + case 0x1A: /* movq r1,r2 */ + case 0x1B: /* movt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + for (int i = 0; i < size; i++) + m_temp1[i] = m_temp2[i]; + + write_regreg(size, reg1, reg2); + } + break; + + case 0x1C: /* imskb r1,r2 */ + case 0x1D: /* imskw r1,r2 */ + case 0x1E: /* imskq r1,r2 */ + case 0x1F: /* imskt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_imsk(size); + } + break; + + case 0x20: /* shrb r1 */ + case 0x21: /* shrw r1 */ + case 0x22: /* shrq r1 */ + case 0x23: /* shrt r1 */ + /* Shift is a single shift! */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 d1 = 0, d2 = 0; + + read_reg(size, reg1); + + for (int i = 0; i < size; i++) + { + d1 = (m_temp1[i] & 0x01) << 7; + m_temp1[i] = (m_temp1[i] >> 1) | d2; + d2 = d1; + } + + write_reg(size, reg1); + } + break; + + case 0x24: /* orb r1,r2 */ + case 0x25: /* orw r1,r2 */ + case 0x26: /* orq r1,r2 */ + case 0x27: /* ort r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_or(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x28: /* shlb r1 */ + case 0x29: /* shlw r1 */ + case 0x2A: /* shlq r1 */ + case 0x2B: /* shlt r1 */ + /* Shift is a single shift! */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 d1 = 0, d2 = 0; + + read_reg(size, reg1); + + for (int i = 0; i < size; i++) + { + d1 = (m_temp1[i] & 0x80) >> 7; + m_temp1[i] = (m_temp1[i] << 1) | d2; + d2 = d1; + } + + write_reg(size, reg1); + } + break; + + case 0x2C: /* andb r1,r2 */ + case 0x2D: /* andw r1,r2 */ + case 0x2E: /* andq r1,r2 */ + case 0x2F: /* andt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, true); + + op_and(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x34: /* subb r1,r2 */ + case 0x35: /* subw r1,r2 */ + case 0x36: /* subq r1,r2 */ + case 0x37: /* subt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_sub(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x38: /* adbb r1,r2 */ + case 0x39: /* adbw r1,r2 */ + case 0x3A: /* adbq r1,r2 */ + case 0x3B: /* adbt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_addb(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x3C: /* addb r1,r2 */ + case 0x3D: /* addw r1,r2 */ + case 0x3E: /* addq r1,r2 */ + case 0x3F: /* addt r1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_regreg(size, reg1, reg2, false); + + op_add(size); + + write_regreg(size, reg1, reg2); + } + break; + + case 0x4C: /* testb ir1,r2 */ + case 0x4D: /* testw ir1,r2 */ + case 0x4E: /* testq ir1,r2 */ + case 0x4F: /* testt ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + op_and(size); + } + break; + + case 0x54: /* cmpb ir1,r2 */ + case 0x55: /* cmpw ir1,r2 */ + case 0x56: /* cmpq ir1,r2 */ + case 0x57: /* cmpt ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + op_sub(size); + } + break; + + case 0x58: /* movb ir1,r2 */ + case 0x59: /* movw ir1,r2 */ + case 0x5A: /* movq ir1,r2 */ + case 0x5B: /* movt ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + for (int i = 0; i < size; i++) + m_temp1[i] = m_temp2[i]; + + write_iregreg(size, reg1, reg2); + } + break; + + case 0x64: /* orb ir1,r2 */ + case 0x65: /* orb ir1,r2 */ + case 0x66: /* orb ir1,r2 */ + case 0x67: /* orb ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + op_or(size); + + write_iregreg(size, reg1, reg2); + } + break; + + case 0x6C: /* andb ir1,r2 */ + case 0x6D: /* andw ir1,r2 */ + case 0x6E: /* andq ir1,r2 */ + case 0x6F: /* andt ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + op_and(size); + + write_iregreg(size, reg1, reg2); + } + break; + + case 0x7C: /* addb ir1,r2 */ + case 0x7D: /* addw ir1,r2 */ + case 0x7E: /* addq ir1,r2 */ + case 0x7F: /* addt ir1,r2 */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + op_add(size); + + write_iregreg(size, reg1, reg2); + } + break; + + case 0x88: /* jump _a16 */ + m_ip = (read_op() << 8) | read_op(); + break; + + case 0x89: /* jumpf cs:a16 */ + { + u8 cs = read_op(); + u8 a1 = read_op(); + u8 a2 = read_op(); + + m_cseg = cs; + m_ip = (a1 << 8) | a2; + } + break; + + case 0x8A: /* call a16 */ + { + u8 a1 = read_op(); + u8 a2 = read_op(); + + op_pushw(m_ip); + + m_ip = (a1 << 8) | a2; + } + break; + + case 0x8C: /* unk_8C */ + case 0x8D: /* unk_8D */ + case 0x8E: /* unk_8E */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + break; + + case 0x90: /* retzh */ + case 0x91: /* retzl */ + case 0x92: /* retc */ + case 0x93: /* retz */ + case 0x94: /* retzc */ + case 0x95: /* retcl */ + case 0x96: /* retnc */ + case 0x97: /* retnz */ + if (check_cond(op)) + m_ip = op_popw(); + break; + + case 0x98: /* jump (r1) */ + { + u8 reg1 = read_op(); + u16 ad = m_reg[(reg1 | 0x40) & 0x7f] << 8; + + if (reg1 & 0x40) + ad |= m_reg[((reg1 - 1) | 0x40) & 0x7f]; + else + ad |= m_reg[((reg1 + 1) | 0x40) & 0x7f]; + + m_ip = ad; + } + break; + + case 0x9F: /* ret */ + m_ip = op_popw(); + break; + + case 0xA0: /* jmpzh a16 */ + case 0xA1: /* jmpzl a16 */ + case 0xA2: /* jmpc a16 */ + case 0xA3: /* jmpz a16 */ + case 0xA4: /* jmpzc a16 */ + case 0xA5: /* jmpcl a16 */ + case 0xA6: /* jmpnc a16 */ + case 0xA7: /* jmpnz a16 */ + { + u8 a1 = read_op(); + u8 a2 = read_op(); + + if (check_cond(op)) + m_ip = (a1 << 8) | a2; + } + break; + + case 0xA8: /* callzh a16 */ + case 0xA9: /* callzl a16 */ + case 0xAA: /* callc a16 */ + case 0xAB: /* callz a16 */ + case 0xAC: /* callzc a16 */ + case 0xAD: /* callcl a16 */ + case 0xAE: /* callnc a16 */ + case 0xAF: /* callnz a16 */ + { + u8 a1 = read_op(); + u8 a2 = read_op(); + + if (check_cond(op)) + { + op_pushw(m_ip); + + m_ip = (a1 << 8) | a2; + } + } + break; + + case 0xB1: /* unk_B1 reg/i8 */ + case 0xB3: /* unk_B3 reg/i8 */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + read_op(); + break; + + case 0xB4: /* out koh,reg */ + m_koh_cb(m_reg[read_op() & 0x7f]); + break; + + case 0xB5: /* out koh,i8 */ + m_koh_cb(read_op()); + break; + + case 0xB6: /* out kol,reg */ + m_kol_cb(m_reg[read_op() & 0x7f]); + break; + + case 0xB7: /* out kol,i8 */ + m_kol_cb(read_op()); + break; + + case 0xB9: /* unk_B9 reg/i8 */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + read_op(); + break; + + case 0xBB: /* jmpcl? a16 */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + { + u8 a1 = read_op(); + u8 a2 = read_op(); + + if (m_f & FLAG_CL) + m_ip = ( a1 << 8) | a2; + } + break; + + case 0xBF: /* jmpncl? a16 */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + { + u8 a1 = read_op(); + u8 a2 = read_op(); + + if (!(m_f & FLAG_CL)) + m_ip = (a1 << 8) | a2; + } + break; + + case 0xC0: /* movb reg,i8 */ + case 0xC1: /* movw reg,i16 */ + case 0xC2: /* movw reg,i64 */ + case 0xC3: /* movw reg,i80 */ + { + int size = datasize(op); + u8 reg = read_op(); + + for (int i = 0; i < size; i++) + { + m_reg[(reg + i) & 0x7f] = read_op(); + } + } + break; + + case 0xC4: /* movb (lar),r1 / r1,(lar) */ + case 0xC5: /* movw (lar),r1 / r1,(lar) */ + case 0xC6: /* movq (lar),r1 / r1,(lar) */ + case 0xC7: /* movt (lar),r1 / r1,(lar) */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + int pre_inc = 0; + int post_inc = 1; + + switch (reg1 & 0x60) + { + case 0x00: + pre_inc = 0; + post_inc = 1; + break; + case 0x20: + pre_inc = 1; + post_inc = 0; + break; + case 0x40: + pre_inc = 0; + post_inc = -1; + break; + case 0x60: + pre_inc = -1; + post_inc = 0; + break; + } + + if ((reg1 & 0x80) || (reg2 & 0x80)) + { + /* (lar) <- r1 */ + for (int i = 0; i < size; i++) + { + m_lar += pre_inc; + m_program->write_byte((m_dseg << 16) | m_lar, m_reg[(reg2 + i) & 0x7f]); + m_lar += post_inc; + } + } + else + { + /* r1 <- (lar) */ + for (int i = 0; i < size; i++) + { + m_lar += pre_inc; + m_reg[(reg2 + i) & 0x7f] = m_program->read_byte((m_dseg << 16) | m_lar); + m_lar += post_inc; + } + } + } + break; + + case 0xCC: /* swapb ir1,r2 */ + case 0xCD: /* swapw ir1,r2 */ + case 0xCE: /* swapq ir1,r2 */ + case 0xCF: /* swapt ir1,r2? */ + { + int size = datasize(op); + u8 reg1 = read_op(); + u8 reg2 = read_op(); + + read_iregreg(size, reg1, reg2); + + for (int i = 0; i < size; i++) + { + u8 d = m_temp1[i]; + m_temp1[i] = m_temp2[i]; + m_temp2[i] = d; + } + + write_iregreg(size, reg1, reg2); + write_iregreg2(size, reg1, reg2); + } + break; + + case 0xD0: /* movb cs,reg */ + m_cseg = m_reg[read_op() & 0x7f]; + break; + + case 0xD1: /* movb cs,i8 */ + m_cseg = read_op(); + break; + + case 0xD2: /* movb dsize,reg */ + m_dsize = m_reg[read_op() & 0x7f]; + break; + + case 0xD3: /* movb dsize,i8 */ + m_dsize = read_op(); + break; + + case 0xD4: /* movb ss,reg */ + m_sseg = m_reg[read_op() & 0x7f]; + break; + + case 0xD5: /* movb ss,i8 */ + m_sseg = read_op(); + break; + + case 0xD6: /* movw sp,reg */ + { + u8 reg1 = read_op(); + + m_sp = m_reg[reg1 & 0x7f] | (m_reg[(reg1 + 1) & 0x7f] << 8); + } + break; + + case 0xD7: /* movw sp,i16 */ + m_sp = read_op() << 8; + m_sp |= read_op(); + break; + + case 0xD8: /* movb f,reg */ + m_f = m_reg[read_op() & 0x7f]; + break; + + case 0xD9: /* movb f,i8 */ + m_f = read_op(); + break; + + case 0xDC: /* movb ds,reg */ + m_dseg = m_reg[read_op() & 0x7f]; + break; + + case 0xDD: /* movb ds,i8 */ + m_dseg = read_op(); + break; + + case 0xDE: /* movw lar,reg */ + { + u8 reg1 = read_op(); + + m_lar = m_reg[reg1 & 0x7f] | (m_reg[( reg1 + 1) & 0x7f] << 8); + } + break; + + case 0xE0: /* in0 reg */ + { + u8 reg1 = read_op(); + + m_reg[reg1 & 0x7f] = m_in0_cb(); + } + break; + + case 0xE1: /* unk_E1 reg/i8 (in?) */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + read_op(); + break; + + case 0xE2: /* in kb, reg */ + m_reg[read_op() & 0x7f] = m_ki_cb(); + break; + + case 0xE3: /* unk_e3 reg/i8 (in?) */ + case 0xE4: /* unk_e4 reg/i8 (in?) */ + case 0xE5: /* unk_e5 reg/i8 (in?) */ + case 0xE6: /* unk_e6 reg/i8 (in?) */ + case 0xE7: /* unk_e7 reg/i8 (in?) */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + read_op(); + break; + + case 0xE8: /* movw r1,lar */ + { + u8 reg1 = read_op(); + + m_reg[reg1 & 0x7f] = m_lar & 0xff; + m_reg[(reg1 + 1) & 0x7f] = m_lar >> 8; + } + break; + + case 0xEB: /* movw reg,ss */ + { + u8 reg1 = read_op(); + + m_reg[reg1 & 0x7f] = m_sp & 0xff; + m_reg[(reg1 + 1) & 0x7f] = m_sp >> 8; + } + break; + + case 0xEF: /* movb reg,ss */ + m_reg[read_op() & 0x7f] = m_sseg; + break; + + case 0xF0: /* unk_F0 reg/i8 (out?) */ + case 0xF1: /* unk_F1 reg/i8 (out?) */ + case 0xF2: /* unk_F2 reg/i8 (out?) */ + case 0xF3: /* unk_F3 reg/i8 (out?) */ + case 0xF4: /* unk_F4 reg/i8 (out?) */ + case 0xF5: /* unk_F5 reg/i8 (out?) */ + case 0xF6: /* unk_F6 reg/i8 (out?) */ + case 0xF7: /* unk_F7 reg/i8 (out?) */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + read_op(); + break; + + case 0xFC: /* unk_FC - disable interrupts?? */ + case 0xFD: /* unk_FD */ + case 0xFE: /* unk_FE */ + logerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); + break; + + case 0xFF: /* nop */ + break; + + default: + fatalerror("%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op); }; } while (m_icount > 0); } -offs_t hcd62121_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t hcd62121_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, uint32_t options) { - extern CPU_DISASSEMBLE( hcd62121 ); + extern CPU_DISASSEMBLE(hcd62121); return CPU_DISASSEMBLE_NAME(hcd62121)(this, stream, pc, oprom, opram, options); } diff --git a/src/devices/cpu/hcd62121/hcd62121.h b/src/devices/cpu/hcd62121/hcd62121.h index af105c2a3a3..a7dd123f051 100644 --- a/src/devices/cpu/hcd62121/hcd62121.h +++ b/src/devices/cpu/hcd62121/hcd62121.h @@ -20,17 +20,10 @@ enum }; -/* I/O ports */ -enum -{ - /* Output ports */ - HCD62121_KOL=0x00, - HCD62121_KOH, - /* Input ports */ - HCD62121_KI, - /* Other I/O ports */ - HCD62121_IN0 -}; +#define MCFG_HCD62121_KOL_CB(_devcb) devcb = &hcd62121_cpu_device::set_kol_callback(*device, DEVCB_##_devcb); +#define MCFG_HCD62121_KOH_CB(_devcb) devcb = &hcd62121_cpu_device::set_koh_callback(*device, DEVCB_##_devcb); +#define MCFG_HCD62121_KI_CB(_devcb) devcb = &hcd62121_cpu_device::set_ki_callback(*device, DEVCB_##_devcb); +#define MCFG_HCD62121_IN0_CB(_devcb) devcb = &hcd62121_cpu_device::set_in0_callback(*device, DEVCB_##_devcb); class hcd62121_cpu_device : public cpu_device @@ -39,58 +32,85 @@ public: // construction/destruction hcd62121_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template<class _Object> static devcb_base &set_kol_callback(device_t &device, _Object object) { return downcast<hcd62121_cpu_device &>(device).m_kol_cb.set_callback(object); } + template<class _Object> static devcb_base &set_koh_callback(device_t &device, _Object object) { return downcast<hcd62121_cpu_device &>(device).m_koh_cb.set_callback(object); } + template<class _Object> static devcb_base &set_ki_callback(device_t &device, _Object object) { return downcast<hcd62121_cpu_device &>(device).m_ki_cb.set_callback(object); } + template<class _Object> static devcb_base &set_in0_callback(device_t &device, _Object object) { return downcast<hcd62121_cpu_device &>(device).m_in0_cb.set_callback(object); } + protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; // device_execute_interface overrides - virtual uint32_t execute_min_cycles() const override { return 4; } - virtual uint32_t execute_max_cycles() const override { return 48; } - virtual uint32_t execute_input_lines() const override { return 2; } + virtual u32 execute_min_cycles() const override { return 4; } + virtual u32 execute_max_cycles() const override { return 48; } + virtual u32 execute_input_lines() const override { return 2; } virtual void execute_run() override; // 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 : nullptr ); } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides + 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 - virtual uint32_t disasm_min_opcode_bytes() const override { return 1; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 18; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; - - uint8_t read_op(); - uint8_t datasize( uint8_t op ); - void read_reg( int size, uint8_t op1 ); - void write_reg( int size, uint8_t op1 ); - void read_regreg( int size, uint8_t op1, uint8_t op2, bool op_is_logical ); - void write_regreg( int size, uint8_t op1, uint8_t op2 ); - void read_iregreg( int size, uint8_t op1, uint8_t op2 ); - void write_iregreg( int size, uint8_t op1, uint8_t op2 ); - void write_iregreg2( int size, uint8_t op1, uint8_t op2 ); - int check_cond( uint8_t op ); + virtual u32 disasm_min_opcode_bytes() const override { return 1; } + virtual u32 disasm_max_opcode_bytes() const override { return 18; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; + +private: + u8 read_op(); + u8 datasize(u8 op); + void read_reg(int size, u8 op1); + void write_reg(int size, u8 op1); + void read_regreg(int size, u8 op1, u8 op2, bool op_is_logical); + void write_regreg(int size, u8 op1, u8 op2); + void read_iregreg(int size, u8 op1, u8 op2); + void write_iregreg(int size, u8 op1, u8 op2); + void write_iregreg2(int size, u8 op1, u8 op2); + bool check_cond(u8 op); + void set_zero_flag(bool is_zero); + void set_carry_flag(bool is_carry); + void set_zl_flag(bool is_zl); + void set_zh_flag(bool is_zh); + void set_cl_flag(bool is_cl); + void op_msk(int size); + void op_imsk(int size); + void op_and(int size); + void op_or(int size); + void op_xor(int size); + void op_add(int size); + void op_addb(int size); + void op_sub(int size); + void op_pushw(u16 source); + u16 op_popw(); address_space_config m_program_config; - address_space_config m_io_config; - - uint32_t m_prev_pc; - uint16_t m_sp; - uint16_t m_ip; - uint8_t m_dsize; - uint8_t m_cseg; - uint8_t m_dseg; - uint8_t m_sseg; - uint8_t m_f; - uint16_t m_lar; - uint8_t m_reg[0x80]; - uint8_t m_temp1[0x10]; - uint8_t m_temp2[0x10]; + + u32 m_prev_pc; + u16 m_sp; + u16 m_ip; + u8 m_dsize; + u8 m_cseg; + u8 m_dseg; + u8 m_sseg; + u8 m_f; + u16 m_lar; + u8 m_reg[0x80]; + u8 m_temp1[0x10]; + u8 m_temp2[0x10]; + u32 m_rtemp; address_space *m_program; - address_space *m_io; + int m_icount; + + devcb_write8 m_kol_cb; + devcb_write8 m_koh_cb; + devcb_read8 m_ki_cb; + devcb_read8 m_in0_cb; }; diff --git a/src/devices/cpu/hcd62121/hcd62121_ops.h b/src/devices/cpu/hcd62121/hcd62121_ops.h deleted file mode 100644 index 57c1f6b7d52..00000000000 --- a/src/devices/cpu/hcd62121/hcd62121_ops.h +++ /dev/null @@ -1,1022 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol - -#define HCD62121_MSK \ - { \ - int i; \ - uint8_t mskres = 1; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - if ( ( m_temp1[i] & m_temp2[i] ) != m_temp2[i] ) \ - mskres = 0; \ - } \ - \ - if ( mskres ) \ - m_f &= ~_FLAG_Z; \ - else \ - m_f |= _FLAG_Z; \ - } - -#define HCD62121_IMSK \ - { \ - int i; \ - uint8_t mskres = 1; \ - uint8_t set_zero = 0; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - if ( ( m_temp1[i] & ~m_temp2[i] ) != ~m_temp2[i] ) \ - mskres = 0; \ - if ( m_temp1[i] | m_temp2[i] ) \ - set_zero = 1; \ - } \ - \ - if ( set_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( mskres ) \ - m_f &= ~_FLAG_C; \ - else \ - m_f |= _FLAG_C; \ - } - - -#define HCD62121_AND \ - { \ - int i; \ - uint8_t is_zero = 1; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - m_temp1[i] = m_temp1[i] & m_temp2[i]; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -#define HCD62121_OR \ - { \ - int i; \ - uint8_t is_zero = 1; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - m_temp1[i] = m_temp1[i] | m_temp2[i]; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -#define HCD62121_XOR \ - { \ - int i; \ - uint8_t is_zero = 1; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - m_temp1[i] = m_temp1[i] ^ m_temp2[i]; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -#define HCD62121_ADD \ - { \ - int i; \ - uint8_t is_zero = 1, carry = 0; \ - \ - if ( ( m_temp1[0] & 0x0f ) + ( m_temp2[0] & 0x0f ) > 15 ) \ - m_f |= _FLAG_CL; \ - else \ - m_f &= ~_FLAG_CL; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - uint16_t res = m_temp1[i] + m_temp2[i] + carry; \ - \ - m_temp1[i] = res & 0xff; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - \ - carry = ( res & 0xff00 ) ? 1 : 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( carry ) \ - m_f |= _FLAG_C; \ - else \ - m_f &= ~_FLAG_C; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -/* BCD ADD */ -#define HCD62121_ADDB \ - { \ - int i; \ - uint8_t is_zero = 1, carry = 0; \ - \ - if ( ( m_temp1[0] & 0x0f ) + ( m_temp2[0] & 0x0f ) > 9 ) \ - m_f |= _FLAG_CL; \ - else \ - m_f &= ~_FLAG_CL; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - uint16_t res = ( m_temp1[i] & 0x0f ) + ( m_temp2[i] & 0x0f ) + carry; \ - \ - if ( res > 9 ) \ - { \ - res += 6; \ - } \ - res += ( m_temp1[i] & 0xf0 ) + ( m_temp2[i] & 0xf0 ); \ - if ( res > 0x9f ) \ - { \ - res += 0x60; \ - } \ - m_temp1[i] = res & 0xff; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - \ - carry = ( res & 0xff00 ) ? 1 : 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( carry ) \ - m_f |= _FLAG_C; \ - else \ - m_f &= ~_FLAG_C; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -#define HCD62121_SUB \ - { \ - int i; \ - uint8_t is_zero = 1, carry = 0; \ - \ - if ( ( m_temp1[0] & 0x0f ) < ( m_temp2[0] & 0x0f ) ) \ - m_f |= _FLAG_CL; \ - else \ - m_f &= ~_FLAG_CL; \ - \ - for ( i = 0; i < size; i++ ) \ - { \ - uint16_t res = m_temp1[i] - m_temp2[i] - carry; \ - \ - m_temp1[i] = res & 0xff; \ - if ( m_temp1[i] ) \ - is_zero = 0; \ - \ - carry = ( res & 0xff00 ) ? 1 : 0; \ - } \ - \ - if ( is_zero ) \ - m_f |= _FLAG_Z; \ - else \ - m_f &= ~_FLAG_Z; \ - \ - if ( carry ) \ - m_f |= _FLAG_C; \ - else \ - m_f &= ~_FLAG_C; \ - \ - if ( m_temp1[0] & 0x0f ) \ - m_f &= ~_FLAG_ZL; \ - else \ - m_f |= _FLAG_ZL; \ - \ - if ( m_temp1[0] & 0xf0 ) \ - m_f &= ~_FLAG_ZH; \ - else \ - m_f |= _FLAG_ZH; \ - } - -#define HCD62121_PUSHW(source) \ - { \ - uint16_t address = source; \ - m_program->write_byte( ( m_sseg << 16 ) | m_sp, ( address ) & 0xff ); \ - m_sp--; \ - m_program->write_byte( ( m_sseg << 16 ) | m_sp, ( address ) >> 8 ); \ - m_sp--; \ - } - -#define HCD62121_POPW(dest) \ - { \ - uint16_t res; \ - m_sp++; \ - res = m_program->read_byte( ( m_sseg << 16 ) | m_sp ) << 8; \ - m_sp++; \ - res |= m_program->read_byte( ( m_sseg << 16 ) | m_sp ); \ - dest = res; \ - } - -case 0x04: /* mskb r1,r2 */ -case 0x05: /* mskw r1,r2 */ -case 0x06: /* mskq r1,r2 */ -case 0x07: /* mskt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_MSK; - } - break; - -case 0x08: /* shb r1,4 */ -case 0x09: /* shw r1,4 */ -case 0x0A: /* shq r1,4 */ -case 0x0B: /* sht r1,4 */ - /* Shift is a nibble shift! */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t d1 = 0, d2 = 0; - - read_reg( size, reg1 ); - - for ( i = 0; i < size; i++ ) - { - if ( reg1 & 0x80 ) - { - d1 = ( m_temp1[i] & 0x0f ) << 4; - m_temp1[i] = ( m_temp1[i] >> 4 ) | d2; - } - else - { - d1 = ( m_temp1[i] & 0xf0 ) >> 4; - m_temp1[i] = ( m_temp1[i] << 4 ) | d2; - } - d2 = d1; - } - - write_reg( size, reg1 ); - } - break; - -case 0x0C: /* testb r1,r2 */ -case 0x0D: /* testw r1,r2 */ -case 0x0E: /* testq r1,r2 */ -case 0x0F: /* testt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_AND; - } - break; - -case 0x10: /* xorb r1,r2 */ -case 0x11: /* xorw r1,r2 */ -case 0x12: /* xorq r1,r2 */ -case 0x13: /* xort r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_XOR; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x14: /* cmpb r1,r2 */ -case 0x15: /* cmpw r1,r2 */ -case 0x16: /* cmpq r1,r2 */ -case 0x17: /* cmpt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_SUB; - } - break; - -case 0x18: /* movb r1,r2 */ -case 0x19: /* movw r1,r2 */ -case 0x1A: /* movq r1,r2 */ -case 0x1B: /* movt r1,r2 */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - for ( i = 0; i < size; i++ ) - m_temp1[i] = m_temp2[i]; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x1C: /* imskb r1,r2 */ -case 0x1D: /* imskw r1,r2 */ -case 0x1E: /* imskq r1,r2 */ -case 0x1F: /* imskt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_IMSK; - } - break; - -case 0x20: /* shrb r1 */ -case 0x21: /* shrw r1 */ -case 0x22: /* shrq r1 */ -case 0x23: /* shrt r1 */ - /* Shift is a single shift! */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t d1 = 0, d2 = 0; - - read_reg( size, reg1 ); - - for ( i = 0; i < size; i++ ) - { - d1 = ( m_temp1[i] & 0x01 ) << 7; - m_temp1[i] = ( m_temp1[i] >> 1 ) | d2; - d2 = d1; - } - - write_reg( size, reg1 ); - } - break; - -case 0x24: /* orb r1,r2 */ -case 0x25: /* orw r1,r2 */ -case 0x26: /* orq r1,r2 */ -case 0x27: /* ort r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_OR; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x28: /* shlb r1 */ -case 0x29: /* shlw r1 */ -case 0x2A: /* shlq r1 */ -case 0x2B: /* shlt r1 */ - /* Shift is a single shift! */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t d1 = 0, d2 = 0; - - read_reg( size, reg1 ); - - for ( i = 0; i < size; i++ ) - { - d1 = ( m_temp1[i] & 0x80 ) >> 7; - m_temp1[i] = ( m_temp1[i] << 1 ) | d2; - d2 = d1; - } - - write_reg( size, reg1 ); - } - break; - -case 0x2C: /* andb r1,r2 */ -case 0x2D: /* andw r1,r2 */ -case 0x2E: /* andq r1,r2 */ -case 0x2F: /* andt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, true ); - - HCD62121_AND; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x34: /* subb r1,r2 */ -case 0x35: /* subw r1,r2 */ -case 0x36: /* subq r1,r2 */ -case 0x37: /* subt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_SUB; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x38: /* adbb r1,r2 */ -case 0x39: /* adbw r1,r2 */ -case 0x3A: /* adbq r1,r2 */ -case 0x3B: /* adbt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_ADDB; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x3C: /* addb r1,r2 */ -case 0x3D: /* addw r1,r2 */ -case 0x3E: /* addq r1,r2 */ -case 0x3F: /* addt r1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_regreg( size, reg1, reg2, false ); - - HCD62121_ADD; - - write_regreg( size, reg1, reg2 ); - } - break; - -case 0x4C: /* testb ir1,r2 */ -case 0x4D: /* testw ir1,r2 */ -case 0x4E: /* testq ir1,r2 */ -case 0x4F: /* testt ir1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - HCD62121_AND; - } - break; - -case 0x54: /* cmpb ir1,r2 */ -case 0x55: /* cmpw ir1,r2 */ -case 0x56: /* cmpq ir1,r2 */ -case 0x57: /* cmpt ir1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - HCD62121_SUB; - } - break; - -case 0x58: /* movb ir1,r2 */ -case 0x59: /* movw ir1,r2 */ -case 0x5A: /* movq ir1,r2 */ -case 0x5B: /* movt ir1,r2 */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - for ( i = 0; i < size; i++ ) - m_temp1[i] = m_temp2[i]; - - write_iregreg( size, reg1, reg2 ); - } - break; - -case 0x64: /* orb ir1,r2 */ -case 0x65: /* orb ir1,r2 */ -case 0x66: /* orb ir1,r2 */ -case 0x67: /* orb ir1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - HCD62121_OR; - - write_iregreg( size, reg1, reg2 ); - } - break; - -case 0x6C: /* andb ir1,r2 */ -case 0x6D: /* andw ir1,r2 */ -case 0x6E: /* andq ir1,r2 */ -case 0x6F: /* andt ir1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - HCD62121_AND; - - write_iregreg( size, reg1, reg2 ); - } - break; - -case 0x7C: /* addb ir1,r2 */ -case 0x7D: /* addw ir1,r2 */ -case 0x7E: /* addq ir1,r2 */ -case 0x7F: /* addt ir1,r2 */ - { - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - HCD62121_ADD; - - write_iregreg( size, reg1, reg2 ); - } - break; - -case 0x88: /* jump _a16 */ - m_ip = ( read_op() << 8 ) | read_op(); - break; - -case 0x89: /* jumpf cs:a16 */ - { - uint8_t cs = read_op(); - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - m_cseg = cs; - m_ip = ( a1 << 8 ) | a2; - } - break; - -case 0x8A: /* call a16 */ - { - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - HCD62121_PUSHW( m_ip ); - - m_ip = ( a1 << 8 ) | a2; - } - break; - -case 0x8C: /* unk_8C */ -case 0x8D: /* unk_8D */ -case 0x8E: /* unk_8E */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - break; - -case 0x90: /* retzh */ -case 0x91: /* retzl */ -case 0x92: /* retc */ -case 0x93: /* retz */ -case 0x94: /* retzc */ -case 0x95: /* retcl */ -case 0x96: /* retnc */ -case 0x97: /* retnz */ - if ( check_cond( op ) ) - HCD62121_POPW( m_ip ); - break; - -case 0x98: /* jump (r1) */ - { - uint8_t reg1 = read_op(); - uint16_t ad = m_reg[ ( reg1 | 0x40 ) & 0x7f ] << 8; - - if ( reg1 & 0x40 ) - ad |= m_reg[ ( ( reg1 - 1 ) | 0x40 ) & 0x7f ]; - else - ad |= m_reg[ ( ( reg1 + 1 ) | 0x40 ) & 0x7f ]; - - m_ip = ad; - } - break; - -case 0x9F: /* ret */ - HCD62121_POPW( m_ip ); - break; - -case 0xA0: /* jmpzh a16 */ -case 0xA1: /* jmpzl a16 */ -case 0xA2: /* jmpc a16 */ -case 0xA3: /* jmpz a16 */ -case 0xA4: /* jmpzc a16 */ -case 0xA5: /* jmpcl a16 */ -case 0xA6: /* jmpnc a16 */ -case 0xA7: /* jmpnz a16 */ - { - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - if ( check_cond( op ) ) - m_ip = ( a1 << 8 ) | a2; - } - break; - -case 0xA8: /* callzh a16 */ -case 0xA9: /* callzl a16 */ -case 0xAA: /* callc a16 */ -case 0xAB: /* callz a16 */ -case 0xAC: /* callzc a16 */ -case 0xAD: /* callcl a16 */ -case 0xAE: /* callnc a16 */ -case 0xAF: /* callnz a16 */ - { - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - if ( check_cond( op ) ) - { - HCD62121_PUSHW( m_ip ); - - m_ip = ( a1 << 8 ) | a2; - } - } - break; - -case 0xB1: /* unk_B1 reg/i8 */ -case 0xB3: /* unk_B3 reg/i8 */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - read_op(); - break; - -case 0xB4: /* out koh,reg */ - m_io->write_byte( HCD62121_KOH, m_reg[ read_op() & 0x7f ] ); - break; - -case 0xB5: /* out koh,i8 */ - m_io->write_byte( HCD62121_KOH, read_op() ); - break; - -case 0xB6: /* out kol,reg */ - m_io->write_byte( HCD62121_KOL, m_reg[ read_op() & 0x7f ] ); - break; - -case 0xB7: /* out kol,i8 */ - m_io->write_byte( HCD62121_KOL, read_op() ); - break; - -case 0xB9: /* unk_B9 reg/i8 */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - read_op(); - break; - -case 0xBB: /* jmpcl? a16 */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - { - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - if ( m_f & _FLAG_CL ) - m_ip = ( a1 << 8 ) | a2; - } - break; - -case 0xBF: /* jmpncl? a16 */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - { - uint8_t a1 = read_op(); - uint8_t a2 = read_op(); - - if ( ! ( m_f & _FLAG_CL ) ) - m_ip = ( a1 << 8 ) | a2; - } - break; - -case 0xC0: /* movb reg,i8 */ -case 0xC1: /* movw reg,i16 */ -case 0xC2: /* movw reg,i64 */ -case 0xC3: /* movw reg,i80 */ - { - int i; - int size = datasize( op ); - uint8_t reg = read_op(); - - for( i = 0; i < size; i++ ) - { - m_reg[(reg + i) & 0x7f] = read_op(); - } - } - break; - -case 0xC4: /* movb (lar),r1 / r1,(lar) */ -case 0xC5: /* movw (lar),r1 / r1,(lar) */ -case 0xC6: /* movq (lar),r1 / r1,(lar) */ -case 0xC7: /* movt (lar),r1 / r1,(lar) */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - int pre_inc = 0; - int post_inc = 1; - - switch( reg1 & 0x60 ) - { - case 0x00: - pre_inc = 0; - post_inc = 1; - break; - case 0x20: - pre_inc = 1; - post_inc = 0; - break; - case 0x40: - pre_inc = 0; - post_inc = -1; - break; - case 0x60: - pre_inc = -1; - post_inc = 0; - break; - } - - if ( ( reg1 & 0x80 ) || ( reg2 & 0x80 ) ) - { - /* (lar) <- r1 */ - for ( i = 0; i < size; i++ ) - { - m_lar += pre_inc; - m_program->write_byte( ( m_dseg << 16 ) | m_lar, m_reg[ ( reg2 + i ) & 0x7f ] ); - m_lar += post_inc; - } - } - else - { - /* r1 <- (lar) */ - for ( i = 0; i < size; i++ ) - { - m_lar += pre_inc; - m_reg[ ( reg2 + i ) & 0x7f ] = m_program->read_byte( ( m_dseg << 16 ) | m_lar ); - m_lar += post_inc; - } - } - } - break; - -case 0xCC: /* swapb ir1,r2 */ -case 0xCD: /* swapw ir1,r2 */ -case 0xCE: /* swapq ir1,r2 */ -case 0xCF: /* swapt ir1,r2? */ - { - int i; - int size = datasize( op ); - uint8_t reg1 = read_op(); - uint8_t reg2 = read_op(); - - read_iregreg( size, reg1, reg2 ); - - for ( i = 0; i < size; i++ ) - { - uint8_t d = m_temp1[i]; - m_temp1[i] = m_temp2[i]; - m_temp2[i] = d; - } - - write_iregreg( size, reg1, reg2 ); - write_iregreg2( size, reg1, reg2 ); - } - break; - -case 0xD0: /* movb cs,reg */ - m_cseg = m_reg[ read_op() & 0x7f ]; - break; - -case 0xD1: /* movb cs,i8 */ - m_cseg = read_op(); - break; - -case 0xD2: /* movb dsize,reg */ - m_dsize = m_reg[ read_op() & 0x7f ]; - break; - -case 0xD3: /* movb dsize,i8 */ - m_dsize = read_op(); - break; - -case 0xD4: /* movb ss,reg */ - m_sseg = m_reg[ read_op() & 0x7f ]; - break; - -case 0xD5: /* movb ss,i8 */ - m_sseg = read_op(); - break; - -case 0xD6: /* movw sp,reg */ - { - uint8_t reg1 = read_op(); - - m_sp = m_reg[ reg1 & 0x7f ] | ( m_reg[ ( reg1 + 1 ) & 0x7f ] << 8 ); - } - break; - -case 0xD7: /* movw sp,i16 */ - m_sp = read_op() << 8; - m_sp |= read_op(); - break; - -case 0xD8: /* movb f,reg */ - m_f = m_reg[ read_op() & 0x7f ]; - break; - -case 0xD9: /* movb f,i8 */ - m_f = read_op(); - break; - -case 0xDC: /* movb ds,reg */ - m_dseg = m_reg[ read_op() & 0x7f ]; - break; - -case 0xDD: /* movb ds,i8 */ - m_dseg = read_op(); - break; - -case 0xDE: /* movw lar,reg */ - { - uint8_t reg1 = read_op(); - - m_lar = m_reg[ reg1 & 0x7f ] | ( m_reg[ ( reg1 + 1 ) & 0x7f ] << 8 ); - } - break; - -case 0xE0: /* in0 reg */ - { - uint8_t reg1 = read_op(); - - m_reg[ reg1 & 0x7f ] = m_io->read_byte( HCD62121_IN0 ); - } - break; - -case 0xE1: /* unk_E1 reg/i8 (in?) */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - read_op(); - break; - -case 0xE2: /* in kb, reg */ - m_reg[ read_op() & 0x7f ] = m_io->read_byte( HCD62121_KI ); - break; - -case 0xE3: /* unk_e3 reg/i8 (in?) */ -case 0xE4: /* unk_e4 reg/i8 (in?) */ -case 0xE5: /* unk_e5 reg/i8 (in?) */ -case 0xE6: /* unk_e6 reg/i8 (in?) */ -case 0xE7: /* unk_e7 reg/i8 (in?) */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - read_op(); - break; - -case 0xE8: /* movw r1,lar */ - { - uint8_t reg1 = read_op(); - - m_reg[ reg1 & 0x7f ] = m_lar & 0xff; - m_reg[ ( reg1 + 1 ) & 0x7f ] = m_lar >> 8; - } - break; - -case 0xEB: /* movw reg,ss */ - { - uint8_t reg1 = read_op(); - - m_reg[ reg1 & 0x7f ] = m_sp & 0xff; - m_reg[ ( reg1 + 1 ) & 0x7f ] = m_sp >> 8; - } - break; - -case 0xEF: /* movb reg,ss */ - m_reg[ read_op() & 0x7f ] = m_sseg; - break; - -case 0xF0: /* unk_F0 reg/i8 (out?) */ -case 0xF1: /* unk_F1 reg/i8 (out?) */ -case 0xF2: /* unk_F2 reg/i8 (out?) */ -case 0xF3: /* unk_F3 reg/i8 (out?) */ -case 0xF4: /* unk_F4 reg/i8 (out?) */ -case 0xF5: /* unk_F5 reg/i8 (out?) */ -case 0xF6: /* unk_F6 reg/i8 (out?) */ -case 0xF7: /* unk_F7 reg/i8 (out?) */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - read_op(); - break; - -case 0xFC: /* unk_FC */ -case 0xFD: /* unk_FD */ -case 0xFE: /* unk_FE */ - logerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); - break; - -case 0xFF: /* nop */ - break; - -default: - /*logerror*/fatalerror( "%02x:%04x: unimplemented instruction %02x encountered\n", m_cseg, m_ip-1, op ); diff --git a/src/devices/cpu/hcd62121/hcd62121d.cpp b/src/devices/cpu/hcd62121/hcd62121d.cpp index d355385f793..5c85f193224 100644 --- a/src/devices/cpu/hcd62121/hcd62121d.cpp +++ b/src/devices/cpu/hcd62121/hcd62121d.cpp @@ -2,139 +2,214 @@ // copyright-holders:Wilbert Pol #include "emu.h" -#include "debugger.h" -#include "hcd62121.h" - -#ifdef _MSC_VER -#undef _SP -#endif enum { - _REG=1, /* register */ - _REGREG, /* register1, register2, or register2, register1 or register1, imm byte */ - _IRG, /* register indirect */ - _IRGREG, /* 2 register indirect */ - _A16, /* 16bit address */ - _A24, /* seg:address */ - _F, /* flag register */ - _CS, /* cs register */ - _DS, /* ds register */ - _SS, /* ss register */ - _PC, /* program counter */ - _SP, /* stack pointer */ - _I8, /* immediate 8 bit value */ - _I16, /* immediate 16 bit value */ - _I64, /* immediate 64 bit value */ - _I80, /* immediate 80 bit value */ - _ILR, /* indirect last address register access */ - _LAR, /* last address register */ - _DSZ, /* dsize register? */ - _TIM, /* timing related register? */ - _KLO, /* KO1 - KO8 output lines */ - _KHI, /* KO9 - KO14(?) output lines */ - _KI, /* K input lines */ - _4 /* for nibble shifts */ + ARG_NONE=0, /* no argument or unknown */ + ARG_REG, /* register */ + ARG_REGREG, /* register1, register2, or register2, register1 or register1, imm byte */ + ARG_IRG, /* register indirect */ + ARG_IRGREG, /* 2 register indirect */ + ARG_A16, /* 16bit address */ + ARG_A24, /* seg:address */ + ARG_F, /* flag register */ + ARG_CS, /* cs register */ + ARG_DS, /* ds register */ + ARG_SS, /* ss register */ + ARG_PC, /* program counter */ + ARG_SP, /* stack pointer */ + ARG_I8, /* immediate 8 bit value */ + ARG_I16, /* immediate 16 bit value */ + ARG_I64, /* immediate 64 bit value */ + ARG_I80, /* immediate 80 bit value */ + ARG_ILR, /* indirect last address register access */ + ARG_LAR, /* last address register */ + ARG_DSZ, /* dsize register? */ + ARG_TIM, /* timing related register? */ + ARG_KLO, /* KO1 - KO8 output lines */ + ARG_KHI, /* KO9 - KO14(?) output lines */ + ARG_KI, /* K input lines */ + ARG_4 /* for nibble shifts */ }; struct hcd62121_dasm { const char *str; - uint8_t arg1; - uint8_t arg2; + u8 arg1; + u8 arg2; }; static const hcd62121_dasm hcd62121_ops[256] = { /* 0x00 */ - { "un00?", 0, 0 }, { "un01?", 0, 0 }, { "un02?", 0, 0 }, { "un03?", 0, 0 }, - { "mskb", _REGREG, 0 }, { "mskw", _REGREG, 0 }, { "mskq", _REGREG, 0 }, { "mskt", _REGREG, 0 }, - { "sh?b", _REG, _4 }, { "sh?w", _REG, _4 }, { "sh?q", _REG, _4 }, { "sh?t", _REG, _4 }, - { "tstb", _REGREG, 0 }, { "tstw", _REGREG, 0 }, { "tstq", _REGREG, 0 }, { "tstt", _REGREG, 0 }, - { "xorb", _REGREG, 0 }, { "xorw", _REGREG, 0 }, { "xorq", _REGREG, 0 }, { "xort", _REGREG, 0 }, - { "cmpb", _REGREG, 0 }, { "cmpw", _REGREG, 0 }, { "cmpq", _REGREG, 0 }, { "cmpt", _REGREG, 0 }, - { "movb", _REGREG, 0 }, { "movw", _REGREG, 0 }, { "movq", _REGREG, 0 }, { "movt", _REGREG, 0 }, - { "imskb", _REGREG, 0 }, { "imskw", _REGREG, 0 }, { "imskq", _REGREG, 0 }, { "imskt", _REGREG, 0 }, + { "un00?", ARG_NONE, ARG_NONE }, { "un01?", ARG_NONE, ARG_NONE }, + { "un02?", ARG_NONE, ARG_NONE }, { "un03?", ARG_NONE, ARG_NONE }, + { "mskb", ARG_REGREG, ARG_NONE }, { "mskw", ARG_REGREG, ARG_NONE }, + { "mskq", ARG_REGREG, ARG_NONE }, { "mskt", ARG_REGREG, ARG_NONE }, + { "sh?b", ARG_REG, ARG_4 }, { "sh?w", ARG_REG, ARG_4 }, + { "sh?q", ARG_REG, ARG_4 }, { "sh?t", ARG_REG, ARG_4 }, + { "tstb", ARG_REGREG, ARG_NONE }, { "tstw", ARG_REGREG, ARG_NONE }, + { "tstq", ARG_REGREG, ARG_NONE }, { "tstt", ARG_REGREG, ARG_NONE }, + + /* 0x10 */ + { "xorb", ARG_REGREG, ARG_NONE }, { "xorw", ARG_REGREG, ARG_NONE }, + { "xorq", ARG_REGREG, ARG_NONE }, { "xort", ARG_REGREG, ARG_NONE }, + { "cmpb", ARG_REGREG, ARG_NONE }, { "cmpw", ARG_REGREG, ARG_NONE }, + { "cmpq", ARG_REGREG, ARG_NONE }, { "cmpt", ARG_REGREG, ARG_NONE }, + { "movb", ARG_REGREG, ARG_NONE }, { "movw", ARG_REGREG, ARG_NONE }, + { "movq", ARG_REGREG, ARG_NONE }, { "movt", ARG_REGREG, ARG_NONE }, + { "imskb", ARG_REGREG, ARG_NONE }, { "imskw", ARG_REGREG, ARG_NONE }, + { "imskq", ARG_REGREG, ARG_NONE }, { "imskt", ARG_REGREG, ARG_NONE }, /* 0x20 */ - { "shrb", _REG, 0 }, { "shrw", _REG, 0 }, { "shrq", _REG, 0 }, { "shrt", _REG, 0 }, - { "orb", _REGREG, 0 }, { "orw", _REGREG, 0 }, { "orq", _REGREG, 0 }, { "ort", _REGREG, 0 }, - { "shlb", _REG, 0 }, { "shlw", _REG, 0 }, { "shlq", _REG, 0 }, { "shlt", _REG, 0 }, - { "andb", _REGREG, 0 }, { "andw", _REGREG, 0 }, { "andq", _REGREG, 0 }, { "andt", _REGREG, 0 }, - { "sbbb", _REGREG, 0 }, { "sbbw", _REGREG, 0 }, { "sbbq", _REGREG, 0 }, { "sbbt", _REGREG, 0 }, /* BCD SUB */ - { "subb", _REGREG, 0 }, { "subw", _REGREG, 0 }, { "subq", _REGREG, 0 }, { "subt", _REGREG, 0 }, - { "adbb", _REGREG, 0 }, { "adbw", _REGREG, 0 }, { "adbq", _REGREG, 0 }, { "adbt", _REGREG, 0 }, /* BCD ADD */ - { "addb", _REGREG, 0 }, { "addw", _REGREG, 0 }, { "addq", _REGREG, 0 }, { "addt", _REGREG, 0 }, + { "shrb", ARG_REG, ARG_NONE }, { "shrw", ARG_REG, ARG_NONE }, + { "shrq", ARG_REG, ARG_NONE }, { "shrt", ARG_REG, ARG_NONE }, + { "orb", ARG_REGREG, ARG_NONE }, { "orw", ARG_REGREG, ARG_NONE }, + { "orq", ARG_REGREG, ARG_NONE }, { "ort", ARG_REGREG, ARG_NONE }, + { "shlb", ARG_REG, ARG_NONE }, { "shlw", ARG_REG, ARG_NONE }, + { "shlq", ARG_REG, ARG_NONE }, { "shlt", ARG_REG, ARG_NONE }, + { "andb", ARG_REGREG, ARG_NONE }, { "andw", ARG_REGREG, ARG_NONE }, + { "andq", ARG_REGREG, ARG_NONE }, { "andt", ARG_REGREG, ARG_NONE }, + + /* 0x30 */ + { "sbbb", ARG_REGREG, ARG_NONE }, { "sbbw", ARG_REGREG, ARG_NONE }, /* BCD SUB */ + { "sbbq", ARG_REGREG, ARG_NONE }, { "sbbt", ARG_REGREG, ARG_NONE }, /* BCD SUB */ + { "subb", ARG_REGREG, ARG_NONE }, { "subw", ARG_REGREG, ARG_NONE }, + { "subq", ARG_REGREG, ARG_NONE }, { "subt", ARG_REGREG, ARG_NONE }, + { "adbb", ARG_REGREG, ARG_NONE }, { "adbw", ARG_REGREG, ARG_NONE }, /* BCD ADD */ + { "adbq", ARG_REGREG, ARG_NONE }, { "adbt", ARG_REGREG, ARG_NONE }, /* BCD ADD */ + { "addb", ARG_REGREG, ARG_NONE }, { "addw", ARG_REGREG, ARG_NONE }, + { "addq", ARG_REGREG, ARG_NONE }, { "addt", ARG_REGREG, ARG_NONE }, /* 0x40 */ - { "shrb?", _IRG, 0 }, { "shrw?", _IRG, 0 }, { "shrq?", _IRG, 0 }, { "shrt?", _IRG, 0 }, - { "mskb", _IRGREG, 0 }, { "mskw", _IRGREG, 0 }, { "mskq", _IRGREG, 0 }, { "mskt", _IRGREG, 0 }, - { "shrb", _IRG, 0 }, { "shrw", _IRG, 0 }, { "shrq", _IRG, 0 }, { "shrt", _IRG, 0 }, - { "tstb", _IRGREG, 0 }, { "tstw", _IRGREG, 0 }, { "tstq", _IRGREG, 0 }, { "tstt", _IRGREG, 0 }, - { "xorb", _IRGREG, 0 }, { "xorw", _IRGREG, 0 }, { "xorq", _IRGREG, 0 }, { "xort", _IRGREG, 0 }, - { "cmpb", _IRGREG, 0 }, { "cmpw", _IRGREG, 0 }, { "cmpq", _IRGREG, 0 }, { "cmpt", _IRGREG, 0 }, - { "movb", _IRGREG, 0 }, { "movw", _IRGREG, 0 }, { "movq", _IRGREG, 0 }, { "movt", _IRGREG, 0 }, - { "imskb", _IRGREG, 0 }, { "imskw", _IRGREG, 0 }, { "imskq", _IRGREG, 0 }, { "imskt", _IRGREG, 0 }, + { "shrb?", ARG_IRG, ARG_NONE }, { "shrw?", ARG_IRG, ARG_NONE }, + { "shrq?", ARG_IRG, ARG_NONE }, { "shrt?", ARG_IRG, ARG_NONE }, + { "mskb", ARG_IRGREG, ARG_NONE }, { "mskw", ARG_IRGREG, ARG_NONE }, + { "mskq", ARG_IRGREG, ARG_NONE }, { "mskt", ARG_IRGREG, ARG_NONE }, + { "shrb", ARG_IRG, ARG_NONE }, { "shrw", ARG_IRG, ARG_NONE }, + { "shrq", ARG_IRG, ARG_NONE }, { "shrt", ARG_IRG, ARG_NONE }, + { "tstb", ARG_IRGREG, ARG_NONE }, { "tstw", ARG_IRGREG, ARG_NONE }, + { "tstq", ARG_IRGREG, ARG_NONE }, { "tstt", ARG_IRGREG, ARG_NONE }, + + /* 0x50 */ + { "xorb", ARG_IRGREG, ARG_NONE }, { "xorw", ARG_IRGREG, ARG_NONE }, + { "xorq", ARG_IRGREG, ARG_NONE }, { "xort", ARG_IRGREG, ARG_NONE }, + { "cmpb", ARG_IRGREG, ARG_NONE }, { "cmpw", ARG_IRGREG, ARG_NONE }, + { "cmpq", ARG_IRGREG, ARG_NONE }, { "cmpt", ARG_IRGREG, ARG_NONE }, + { "movb", ARG_IRGREG, ARG_NONE }, { "movw", ARG_IRGREG, ARG_NONE }, + { "movq", ARG_IRGREG, ARG_NONE }, { "movt", ARG_IRGREG, ARG_NONE }, + { "imskb", ARG_IRGREG, ARG_NONE }, { "imskw", ARG_IRGREG, ARG_NONE }, + { "imskq", ARG_IRGREG, ARG_NONE }, { "imskt", ARG_IRGREG, ARG_NONE }, /* 0x60 */ - { "shrb", _IRG, 0 }, { "shrw", _IRG, 0 }, { "shrq", _IRG, 0 }, { "shrt", _IRG, 0 }, - { "orb", _IRGREG, 0 }, { "orw", _IRGREG, 0 }, { "orq", _IRGREG, 0 }, { "ort", _IRGREG, 0 }, - { "shlb", _IRG, 0 }, { "shlw", _IRG, 0 }, { "shlq", _IRG, 0 }, { "shlt", _IRG, 0 }, - { "andb", _IRGREG, 0 }, { "andw", _IRGREG, 0 }, { "andq", _IRGREG, 0 }, { "andt", _IRGREG, 0 }, - { "sbbb", _IRGREG, 0 }, { "sbbw", _IRGREG, 0 }, { "sbbq", _IRGREG, 0 }, { "sbbt", _IRGREG, 0 }, /* BCD SUB */ - { "subb", _IRGREG, 0 }, { "subw", _IRGREG, 0 }, { "subq", _IRGREG, 0 }, { "subt", _IRGREG, 0 }, - { "adbb", _IRGREG, 0 }, { "adbw", _IRGREG, 0 }, { "adbq", _IRGREG, 0 }, { "adbt", _IRGREG, 0 }, /* BCD ADD */ - { "addb", _IRGREG, 0 }, { "addw", _IRGREG, 0 }, { "addq", _IRGREG, 0 }, { "addt", _IRGREG, 0 }, + { "shrb", ARG_IRG, ARG_NONE }, { "shrw", ARG_IRG, ARG_NONE }, + { "shrq", ARG_IRG, ARG_NONE }, { "shrt", ARG_IRG, ARG_NONE }, + { "orb", ARG_IRGREG, ARG_NONE }, { "orw", ARG_IRGREG, ARG_NONE }, + { "orq", ARG_IRGREG, ARG_NONE }, { "ort", ARG_IRGREG, ARG_NONE }, + { "shlb", ARG_IRG, ARG_NONE }, { "shlw", ARG_IRG, ARG_NONE }, + { "shlq", ARG_IRG, ARG_NONE }, { "shlt", ARG_IRG, ARG_NONE }, + { "andb", ARG_IRGREG, ARG_NONE }, { "andw", ARG_IRGREG, ARG_NONE }, + { "andq", ARG_IRGREG, ARG_NONE }, { "andt", ARG_IRGREG, ARG_NONE }, + + /* 0x70 */ + { "sbbb", ARG_IRGREG, ARG_NONE }, { "sbbw", ARG_IRGREG, ARG_NONE }, /* BCD SUB */ + { "sbbq", ARG_IRGREG, ARG_NONE }, { "sbbt", ARG_IRGREG, ARG_NONE }, /* BCD SUB */ + { "subb", ARG_IRGREG, ARG_NONE }, { "subw", ARG_IRGREG, ARG_NONE }, + { "subq", ARG_IRGREG, ARG_NONE }, { "subt", ARG_IRGREG, ARG_NONE }, + { "adbb", ARG_IRGREG, ARG_NONE }, { "adbw", ARG_IRGREG, ARG_NONE }, /* BCD ADD */ + { "adbq", ARG_IRGREG, ARG_NONE }, { "adbt", ARG_IRGREG, ARG_NONE }, /* BCD ADD */ + { "addb", ARG_IRGREG, ARG_NONE }, { "addw", ARG_IRGREG, ARG_NONE }, + { "addq", ARG_IRGREG, ARG_NONE }, { "addt", ARG_IRGREG, ARG_NONE }, /* 0x80 */ - { "un80?", 0, 0 }, { "un81?", 0, 0 }, { "un82?", 0, 0 }, { "un83?", 0, 0 }, - { "un84?", 0, 0 }, { "un85?", 0, 0 }, { "un86?", 0, 0 }, { "un87?", 0, 0 }, - { "jump", _A16, 0 }, { "jump", _A24, 0 }, { "call", _A16, 0 }, { "un8b?", 0, 0 }, - { "un8C?", 0, 0 }, { "un8D?", 0, 0 }, { "un8E?", 0, 0 }, { "un8F?", 0, 0 }, - { "retzh", 0, 0 }, { "retzl", 0, 0 }, { "retc", 0, 0 }, { "retz", 0, 0 }, - { "retzc", 0, 0 }, { "retcl", 0, 0 }, { "retnc", 0, 0 }, { "retnz", 0, 0 }, - { "jump", _IRG, 0 }, { "un99?", 0, 0 }, { "un9A?", 0, 0 }, { "un9b?", 0, 0 }, - { "un9C?", 0, 0 }, { "un9D?", 0, 0 }, { "reti", 0, 0 }, { "ret", 0, 0 }, + { "un80?", ARG_NONE, ARG_NONE }, { "un81?", ARG_NONE, ARG_NONE }, + { "un82?", ARG_NONE, ARG_NONE }, { "un83?", ARG_NONE, ARG_NONE }, + { "un84?", ARG_NONE, ARG_NONE }, { "un85?", ARG_NONE, ARG_NONE }, + { "un86?", ARG_NONE, ARG_NONE }, { "un87?", ARG_NONE, ARG_NONE }, + { "jump", ARG_A16, ARG_NONE }, { "jump", ARG_A24, ARG_NONE }, + { "call", ARG_A16, ARG_NONE }, { "un8b?", ARG_NONE, ARG_NONE }, + { "un8C?", ARG_NONE, ARG_NONE }, { "un8D?", ARG_NONE, ARG_NONE }, + { "un8E?", ARG_NONE, ARG_NONE }, { "un8F?", ARG_NONE, ARG_NONE }, + + /* 0x90 */ + { "retzh", ARG_NONE, ARG_NONE }, { "retzl", ARG_NONE, ARG_NONE }, + { "retc", ARG_NONE, ARG_NONE }, { "retz", ARG_NONE, ARG_NONE }, + { "retzc", ARG_NONE, ARG_NONE }, { "retcl", ARG_NONE, ARG_NONE }, + { "retnc", ARG_NONE, ARG_NONE }, { "retnz", ARG_NONE, ARG_NONE }, + { "jump", ARG_IRG, ARG_NONE }, { "un99?", ARG_NONE, ARG_NONE }, + { "un9A?", ARG_NONE, ARG_NONE }, { "un9b?", ARG_NONE, ARG_NONE }, + { "un9C?", ARG_NONE, ARG_NONE }, { "un9D?", ARG_NONE, ARG_NONE }, + { "reti", ARG_NONE, ARG_NONE }, { "ret", ARG_NONE, ARG_NONE }, /* 0xa0 */ - { "jmpzh", _A16, 0 }, { "jmpzl", _A16, 0 }, { "jmpc", _A16, 0 }, { "jmpz", _A16, 0 }, - { "jmpzc", _A16, 0 }, { "jmpcl", _A16, 0 }, { "jmpnc", _A16, 0 }, { "jmpnz", _A16, 0 }, - { "callzh", _A16, 0 }, { "callzl", _A16, 0 }, { "callc", _A16, 0 }, { "callz", _A16, 0 }, - { "callzc", _A16, 0 }, { "callcl", _A16, 0 }, { "callnc", _A16, 0 }, { "callnz", _A16, 0 }, - { "unB0?", 0, 0 }, { "unB1?", _I8, 0 }, { "unB2?", 0, 0 }, { "unB3?", _I8, 0 }, - { "out", _KHI, _REG }, { "out", _KHI, _I8 }, { "out", _KLO, _REG }, { "out", _KLO, _I8 }, - { "unB8?", 0, 0 }, { "unB9?", _I8, 0 }, { "unBA?", 0, 0 }, { "jmpcl?", _A16, 0 }, - { "unBC?", 0, 0 }, { "unBD?", 0, 0 }, { "unBE?", 0, 0 }, { "jmpncl?", _A16, 0 }, + { "jmpzh", ARG_A16, ARG_NONE }, { "jmpzl", ARG_A16, ARG_NONE }, + { "jmpc", ARG_A16, ARG_NONE }, { "jmpz", ARG_A16, ARG_NONE }, + { "jmpzc", ARG_A16, ARG_NONE }, { "jmpcl", ARG_A16, ARG_NONE }, + { "jmpnc", ARG_A16, ARG_NONE }, { "jmpnz", ARG_A16, ARG_NONE }, + { "callzh", ARG_A16, ARG_NONE }, { "callzl", ARG_A16, ARG_NONE }, + { "callc", ARG_A16, ARG_NONE }, { "callz", ARG_A16, ARG_NONE }, + { "callzc", ARG_A16, ARG_NONE }, { "callcl", ARG_A16, ARG_NONE }, + { "callnc", ARG_A16, ARG_NONE }, { "callnz", ARG_A16, ARG_NONE }, + + /* 0xb0 */ + { "unB0?", ARG_NONE, ARG_NONE }, { "unB1?", ARG_I8, ARG_NONE }, + { "unB2?", ARG_NONE, ARG_NONE }, { "unB3?", ARG_I8, ARG_NONE }, + { "out", ARG_KHI, ARG_REG }, { "out", ARG_KHI, ARG_I8 }, + { "out", ARG_KLO, ARG_REG }, { "out", ARG_KLO, ARG_I8 }, + { "unB8?", ARG_NONE, ARG_NONE }, { "unB9?", ARG_I8, ARG_NONE }, + { "unBA?", ARG_NONE, ARG_NONE }, { "jmpcl?", ARG_A16, ARG_NONE }, + { "unBC?", ARG_NONE, ARG_NONE }, { "unBD?", ARG_NONE, ARG_NONE }, + { "unBE?", ARG_NONE, ARG_NONE }, { "jmpncl?", ARG_A16, ARG_NONE }, /* 0xc0 */ - { "movb", _REG, _I8 }, { "movw", _REG, _I16 }, { "movq", _REG, _I64 }, { "movt", _REG, _I80 }, - { "movb", _ILR, _ILR }, { "movw", _ILR, _ILR }, { "movq", _ILR, _ILR }, { "movt", _ILR, _ILR }, - { "unC8?", 0, 0 }, { "unC9?", 0, 0 }, { "unCA?", 0, 0 }, { "unCb?", 0, 0 }, - { "swapb", _IRGREG, 0 }, { "swapw", _IRGREG, 0 }, { "swapq", _IRGREG, 0 }, { "swapt", _IRGREG, 0 }, - { "movb", _CS, _REG }, { "movb", _CS, _I8 }, { "movb", _DSZ, _REG }, { "movb", _DSZ, _I8 }, - { "movb", _SS, _REG }, { "movb", _SS, _I8 }, { "movw", _SP, _REG }, { "movw", _SP, _I16 }, - { "movb", _F, _REG }, { "movb", _F, _I8 }, { "unDA?", 0, 0 }, { "unDb?", 0, 0 }, - { "movb", _DS, _REG }, { "movb", _DS, _I8 }, { "movw", _LAR, _REG }, { "movw?", _LAR, _I16 }, + { "movb", ARG_REG, ARG_I8 }, { "movw", ARG_REG, ARG_I16 }, + { "movq", ARG_REG, ARG_I64 }, { "movt", ARG_REG, ARG_I80 }, + { "movb", ARG_ILR, ARG_ILR }, { "movw", ARG_ILR, ARG_ILR }, + { "movq", ARG_ILR, ARG_ILR }, { "movt", ARG_ILR, ARG_ILR }, + { "unC8?", ARG_NONE, ARG_NONE }, { "unC9?", ARG_NONE, ARG_NONE }, + { "unCA?", ARG_NONE, ARG_NONE }, { "unCb?", ARG_NONE, ARG_NONE }, + { "swapb", ARG_IRGREG, ARG_NONE }, { "swapw", ARG_IRGREG, ARG_NONE }, + { "swapq", ARG_IRGREG, ARG_NONE }, { "swapt", ARG_IRGREG, ARG_NONE }, + + /* 0xd0 */ + { "movb", ARG_CS, ARG_REG }, { "movb", ARG_CS, ARG_I8 }, + { "movb", ARG_DSZ, ARG_REG }, { "movb", ARG_DSZ, ARG_I8 }, + { "movb", ARG_SS, ARG_REG }, { "movb", ARG_SS, ARG_I8 }, + { "movw", ARG_SP, ARG_REG }, { "movw", ARG_SP, ARG_I16 }, + { "movb", ARG_F, ARG_REG }, { "movb", ARG_F, ARG_I8 }, + { "unDA?", ARG_NONE, ARG_NONE }, { "unDb?", ARG_NONE, ARG_NONE }, + { "movb", ARG_DS, ARG_REG }, { "movb", ARG_DS, ARG_I8 }, + { "movw", ARG_LAR, ARG_REG }, { "movw?", ARG_LAR, ARG_I16 }, /* 0xe0 */ - { "in0", _REG, 0 }, { "unE1?", _I8, 0 }, { "in", _REG, _KI }, { "movb", _REG, _DSZ }, - { "movb", _REG, _F }, { "movb", _REG, _TIM }, { "unE6?", _I8, 0 }, { "unE7?", _I8, 0 }, - { "movw", _REG, _LAR }, { "movw?", _REG, _LAR }, { "movw", _REG, _PC }, { "movw", _REG, _SP }, - { "unEC?", 0, 0 }, { "movb", _REG, _DS }, { "movb", _REG, _CS }, { "movb", _REG, _SS }, - { "unF0?", _I8, 0 }, { "unF1?", _I8, 0 }, { "unF2?", _I8, 0 }, { "unF3?", _I8, 0 }, - { "unF4?", _I8, 0 }, { "unF5?", _I8, 0 }, { "unF6?", _I8, 0 }, { "unF7?", _I8, 0 }, - { "unF8?", 0, 0 }, { "unF9?", 0, 0 }, { "unFA?", 0, 0 }, { "unFb?", 0, 0 }, - { "unFC?", 0, 0 }, { "unFD?", 0, 0 }, { "unFE?", 0, 0 }, { "nop", 0, 0 } + { "in0", ARG_REG, ARG_NONE }, { "unE1?", ARG_I8, ARG_NONE }, + { "in", ARG_REG, ARG_KI }, { "movb", ARG_REG, ARG_DSZ }, + { "movb", ARG_REG, ARG_F }, { "movb", ARG_REG, ARG_TIM }, + { "unE6?", ARG_I8, ARG_NONE }, { "unE7?", ARG_I8, ARG_NONE }, + { "movw", ARG_REG, ARG_LAR }, { "movw?", ARG_REG, ARG_LAR }, + { "movw", ARG_REG, ARG_PC }, { "movw", ARG_REG, ARG_SP }, + { "unEC?", ARG_NONE, ARG_NONE }, { "movb", ARG_REG, ARG_DS }, + { "movb", ARG_REG, ARG_CS }, { "movb", ARG_REG, ARG_SS }, + + /* 0xf0 */ + { "unF0?", ARG_I8, ARG_NONE }, { "unF1?", ARG_I8, ARG_NONE }, + { "unF2?", ARG_I8, ARG_NONE }, { "unF3?", ARG_I8, ARG_NONE }, + { "unF4?", ARG_I8, ARG_NONE }, { "unF5?", ARG_I8, ARG_NONE }, + { "unF6?", ARG_I8, ARG_NONE }, { "unF7?", ARG_I8, ARG_NONE }, + { "unF8?", ARG_NONE, ARG_NONE }, { "unF9?", ARG_NONE, ARG_NONE }, + { "unFA?", ARG_NONE, ARG_NONE }, { "unFb?", ARG_NONE, ARG_NONE }, + { "unFC?", ARG_NONE, ARG_NONE }, { "unFD?", ARG_NONE, ARG_NONE }, + { "unFE?", ARG_NONE, ARG_NONE }, { "nop", ARG_NONE, ARG_NONE } }; CPU_DISASSEMBLE(hcd62121) { - uint8_t op; - uint8_t op1; - uint8_t op2; - int pos = 0; + u8 op; + u8 op1; + u8 op2; + u32 pos = 0; const hcd62121_dasm *inst; op = oprom[pos++]; @@ -142,213 +217,213 @@ CPU_DISASSEMBLE(hcd62121) inst = &hcd62121_ops[op]; /* Special case for nibble shift instruction */ - if ( inst->arg2 == _4 ) - util::stream_format(stream, "sh%c%c ", ( oprom[pos] & 0x80 ) ? 'l' : 'r', inst->str[3]); + if (inst->arg2 == ARG_4) + util::stream_format(stream, "sh%c%c ", (oprom[pos] & 0x80) ? 'l' : 'r', inst->str[3]); else util::stream_format(stream, "%-8s", inst->str); - switch( inst->arg1 ) + switch(inst->arg1) { - case _REGREG: + case ARG_REGREG: op1 = oprom[pos++]; op2 = oprom[pos++]; - if ( op1 & 0x80 ) + if (op1 & 0x80) { - util::stream_format( stream, "r%02x,0x%02x", op1 & 0x7f, op2 ); + util::stream_format(stream, "r%02x,0x%02x", op1 & 0x7f, op2); } else { - if ( op2 & 0x80 ) - util::stream_format( stream, "r%02x,r%02x", op1 & 0x7f, op2 & 0x7f ); + if (op2 & 0x80) + util::stream_format(stream, "r%02x,r%02x", op1 & 0x7f, op2 & 0x7f); else - util::stream_format( stream, "r%02x,r%02x", op2 & 0x7f, op1 & 0x7f ); + util::stream_format(stream, "r%02x,r%02x", op2 & 0x7f, op1 & 0x7f); } break; - case _REG: - util::stream_format( stream, "r%02x", oprom[pos++] & 0x7f ); + case ARG_REG: + util::stream_format(stream, "r%02x", oprom[pos++] & 0x7f); break; - case _IRGREG: + case ARG_IRGREG: /* bit 6 = direction. 0 - regular, 1 - reverse */ op1 = oprom[pos++]; op2 = oprom[pos++]; - if ( op1 & 0x80 ) + if (op1 & 0x80) { - util::stream_format( stream, "(r%02x),0x%02x", 0x40 | ( op1 & 0x3f ), op2 ); + util::stream_format(stream, "(r%02x),0x%02x", 0x40 | (op1 & 0x3f), op2); } else { - if ( op2 & 0x80 ) - util::stream_format( stream, "(r%02x%s),r%02x", 0x40 | ( op1 & 0x3f ), (op1 & 0x40) ? ".r" : "", op2 & 0x7f ); + if (op2 & 0x80) + util::stream_format(stream, "(r%02x%s),r%02x", 0x40 | (op1 & 0x3f), (op1 & 0x40) ? ".r" : "", op2 & 0x7f); else - util::stream_format( stream, "r%02x,(r%02x%s)", op2 & 0x7f, 0x40 | ( op1 & 0x3f ), (op1 & 0x40) ? ".r" : "" ); + util::stream_format(stream, "r%02x,(r%02x%s)", op2 & 0x7f, 0x40 | (op1 & 0x3f), (op1 & 0x40) ? ".r" : ""); } break; - case _IRG: + case ARG_IRG: /* bit 6 = direction. 0 - regular, 1 - reverse */ op1 = oprom[pos++]; - util::stream_format( stream, "(r%02x%s)", 0x40 | ( op1 & 0x3f ), (op1 & 0x40) ? ".r" : "" ); - break; - case _F: - util::stream_format( stream, "F" ); - break; - case _CS: - util::stream_format( stream, "CS" ); - break; - case _DS: - util::stream_format( stream, "DS" ); - break; - case _SS: - util::stream_format( stream, "SS" ); - break; - case _PC: - util::stream_format( stream, "PC" ); - break; - case _SP: - util::stream_format( stream, "SP" ); - break; - case _I8: - util::stream_format( stream, "0x%02x", oprom[pos++] ); - break; - case _I16: - case _A16: - util::stream_format( stream, "0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _I64: - util::stream_format( stream, "0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _I80: - util::stream_format( stream, "0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _A24: - util::stream_format( stream, "0x%02x:", oprom[pos++] ); - util::stream_format( stream, "0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _ILR: + util::stream_format(stream, "(r%02x%s)", 0x40 | (op1 & 0x3f), (op1 & 0x40) ? ".r" : ""); + break; + case ARG_F: + util::stream_format(stream, "F"); + break; + case ARG_CS: + util::stream_format(stream, "CS"); + break; + case ARG_DS: + util::stream_format(stream, "DS"); + break; + case ARG_SS: + util::stream_format(stream, "SS"); + break; + case ARG_PC: + util::stream_format(stream, "PC"); + break; + case ARG_SP: + util::stream_format(stream, "SP"); + break; + case ARG_I8: + util::stream_format(stream, "0x%02x", oprom[pos++]); + break; + case ARG_I16: + case ARG_A16: + util::stream_format(stream, "0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_I64: + util::stream_format(stream, "0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_I80: + util::stream_format(stream, "0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_A24: + util::stream_format(stream, "0x%02x:", oprom[pos++]); + util::stream_format(stream, "0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_ILR: op1 = oprom[pos++]; op2 = oprom[pos++]; - if ( ( op1 & 0x80 ) || ( op2 & 0x80 ) ) + if ((op1 & 0x80) || (op2 & 0x80)) { /* (lar),reg */ - util::stream_format( stream, "(%slar%s),r%02x", (op1 & 0x20) ? ( (op1 & 0x40) ? "--" : "++" ) : "", (op1 & 0x20) ? "" : ( (op1 & 0x40) ? "--" : "++" ), op2 & 0x7f ); + util::stream_format(stream, "(%slar%s),r%02x", (op1 & 0x20) ? ((op1 & 0x40) ? "--" : "++") : "", (op1 & 0x20) ? "" : ((op1 & 0x40) ? "--" : "++"), op2 & 0x7f); } else { /* reg,(lar) */ - util::stream_format( stream, "r%02x,(%slar%s)", op2 & 0x7f, (op1 & 0x20) ? ( (op1 & 0x40) ? "--" : "++" ) : "", (op1 & 0x20) ? "" : ( (op1 & 0x40) ? "--" : "++" ) ); + util::stream_format(stream, "r%02x,(%slar%s)", op2 & 0x7f, (op1 & 0x20) ? ((op1 & 0x40) ? "--" : "++") : "", (op1 & 0x20) ? "" : ((op1 & 0x40) ? "--" : "++")); } break; - case _LAR: - util::stream_format( stream, "lar" ); + case ARG_LAR: + util::stream_format(stream, "lar"); break; - case _DSZ: - util::stream_format( stream, "dsize" ); + case ARG_DSZ: + util::stream_format(stream, "dsize"); break; - case _TIM: - util::stream_format( stream, "TIM?" ); + case ARG_TIM: + util::stream_format(stream, "TIM?"); break; - case _KLO: - util::stream_format( stream, "KOL" ); + case ARG_KLO: + util::stream_format(stream, "KOL"); break; - case _KHI: - util::stream_format( stream, "KOH" ); + case ARG_KHI: + util::stream_format(stream, "KOH"); break; default: break; } - switch( inst->arg2 ) + switch(inst->arg2) { - case _REG: - util::stream_format( stream, ",r%02x", oprom[pos++] & 0x7f ); - break; - case _F: - util::stream_format( stream, ",F" ); - break; - case _CS: - util::stream_format( stream, ",CS" ); - break; - case _DS: - util::stream_format( stream, ",DS" ); - break; - case _SS: - util::stream_format( stream, ",SS" ); - break; - case _PC: - util::stream_format( stream, ",PC" ); - break; - case _SP: - util::stream_format( stream, ",SP" ); - break; - case _I8: - util::stream_format( stream, ",0x%02x", oprom[pos++] ); - break; - case _I16: - case _A16: - util::stream_format( stream, ",0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _I64: - util::stream_format( stream, ",0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _I80: - util::stream_format( stream, ",0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _A24: - util::stream_format( stream, ",0x%02x:", oprom[pos++] ); - util::stream_format( stream, "0x%02x", oprom[pos++] ); - util::stream_format( stream, "%02x", oprom[pos++] ); - break; - case _ILR: - /* Implemented by _ILR section for arg1 */ - break; - case _LAR: - util::stream_format( stream, ",lar" ); - break; - case _DSZ: - util::stream_format( stream, ",dsize" ); - break; - case _TIM: - util::stream_format( stream, ",TIM?" ); - break; - case _KI: - util::stream_format( stream, ",KI" ); - break; - case _4: - util::stream_format( stream, ",4" ); + case ARG_REG: + util::stream_format(stream, ",r%02x", oprom[pos++] & 0x7f); + break; + case ARG_F: + util::stream_format(stream, ",F"); + break; + case ARG_CS: + util::stream_format(stream, ",CS"); + break; + case ARG_DS: + util::stream_format(stream, ",DS"); + break; + case ARG_SS: + util::stream_format(stream, ",SS"); + break; + case ARG_PC: + util::stream_format(stream, ",PC"); + break; + case ARG_SP: + util::stream_format(stream, ",SP"); + break; + case ARG_I8: + util::stream_format(stream, ",0x%02x", oprom[pos++]); + break; + case ARG_I16: + case ARG_A16: + util::stream_format(stream, ",0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_I64: + util::stream_format(stream, ",0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_I80: + util::stream_format(stream, ",0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_A24: + util::stream_format(stream, ",0x%02x:", oprom[pos++]); + util::stream_format(stream, "0x%02x", oprom[pos++]); + util::stream_format(stream, "%02x", oprom[pos++]); + break; + case ARG_ILR: + /* Implemented by ARG_ILR section for arg1 */ + break; + case ARG_LAR: + util::stream_format(stream, ",lar"); + break; + case ARG_DSZ: + util::stream_format(stream, ",dsize"); + break; + case ARG_TIM: + util::stream_format(stream, ",TIM?"); + break; + case ARG_KI: + util::stream_format(stream, ",KI"); + break; + case ARG_4: + util::stream_format(stream, ",4"); break; default: break; diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp index a15b7cc907c..fcc61b40fe7 100644 --- a/src/devices/cpu/hmcs40/hmcs40.cpp +++ b/src/devices/cpu/hmcs40/hmcs40.cpp @@ -78,56 +78,56 @@ ADDRESS_MAP_END // device definitions -hmcs43_cpu_device::hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname) +hmcs43_cpu_device::hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname) : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, HMCS40_FAMILY_HMCS43, polarity, 3 /* stack levels */, 10 /* pc width */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1k), 7 /* data width */, ADDRESS_MAP_NAME(data_80x4), shortname, __FILE__) { } -hd38750_device::hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38750_device::hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs43_cpu_device(mconfig, HD38750, "HD38750", tag, owner, clock, IS_PMOS, "hd38750") { } -hd38755_device::hd38755_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38755_device::hd38755_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs43_cpu_device(mconfig, HD38755, "HD38755", tag, owner, clock, IS_PMOS, "hd38755") { } -hd44750_device::hd44750_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44750_device::hd44750_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs43_cpu_device(mconfig, HD44750, "HD44750", tag, owner, clock, IS_CMOS, "hd44750") { } -hd44758_device::hd44758_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44758_device::hd44758_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs43_cpu_device(mconfig, HD44758, "HD44758", tag, owner, clock, IS_CMOS, "hd44758") { } -hmcs44_cpu_device::hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname) +hmcs44_cpu_device::hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname) : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, HMCS40_FAMILY_HMCS44, polarity, 4, 11, 12, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) { } -hd38800_device::hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38800_device::hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs44_cpu_device(mconfig, HD38800, "HD38800", tag, owner, clock, IS_PMOS, "hd38800") { } -hd38805_device::hd38805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38805_device::hd38805_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs44_cpu_device(mconfig, HD38805, "HD38805", tag, owner, clock, IS_PMOS, "hd38805") { } -hd44801_device::hd44801_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44801_device::hd44801_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs44_cpu_device(mconfig, HD44801, "HD44801", tag, owner, clock, IS_CMOS, "hd44801") { } -hd44808_device::hd44808_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44808_device::hd44808_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs44_cpu_device(mconfig, HD44808, "HD44808", tag, owner, clock, IS_CMOS, "hd44808") { } -hmcs45_cpu_device::hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname) +hmcs45_cpu_device::hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname) : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, HMCS40_FAMILY_HMCS45, polarity, 4, 11, 12, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) { } -hd38820_device::hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38820_device::hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs45_cpu_device(mconfig, HD38820, "HD38820", tag, owner, clock, IS_PMOS, "hd38820") { } -hd38825_device::hd38825_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd38825_device::hd38825_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs45_cpu_device(mconfig, HD38825, "HD38825", tag, owner, clock, IS_PMOS, "hd38825") { } -hd44820_device::hd44820_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44820_device::hd44820_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs45_cpu_device(mconfig, HD44820, "HD44820", tag, owner, clock, IS_CMOS, "hd44820") { } -hd44828_device::hd44828_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +hd44828_device::hd44828_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : hmcs45_cpu_device(mconfig, HD44828, "HD44828", tag, owner, clock, IS_CMOS, "hd44828") { } @@ -148,7 +148,7 @@ void hmcs40_cpu_device::state_string_export(const device_state_entry &entry, std } } -offs_t hmcs40_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t hmcs40_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(hmcs40); return CPU_DISASSEMBLE_NAME(hmcs40)(this, stream, pc, oprom, opram, options); @@ -306,10 +306,10 @@ void hmcs40_cpu_device::device_reset() // i/o handling //------------------------------------------------- -uint8_t hmcs40_cpu_device::read_r(int index) +u8 hmcs40_cpu_device::read_r(int index) { index &= 7; - uint8_t inp = 0; + u8 inp = 0; switch (index) { @@ -329,7 +329,7 @@ uint8_t hmcs40_cpu_device::read_r(int index) return (inp | m_r[index]) & 0xf; } -void hmcs40_cpu_device::write_r(int index, uint8_t data) +void hmcs40_cpu_device::write_r(int index, u8 data) { index &= 7; data &= 0xf; @@ -371,7 +371,7 @@ void hmcs40_cpu_device::write_d(int index, int state) // R0 is input-only, R1 is i/o, R2,R3 are output-only, no R4-R7 // D0-D3 are i/o, D4-D15 are output-only -uint8_t hmcs43_cpu_device::read_r(int index) +u8 hmcs43_cpu_device::read_r(int index) { index &= 7; @@ -381,7 +381,7 @@ uint8_t hmcs43_cpu_device::read_r(int index) return hmcs40_cpu_device::read_r(index); } -void hmcs43_cpu_device::write_r(int index, uint8_t data) +void hmcs43_cpu_device::write_r(int index, u8 data) { index &= 7; @@ -405,7 +405,7 @@ int hmcs43_cpu_device::read_d(int index) // R0-R3 are i/o, R4,R5 are extra registers, no R6,R7 // D0-D15 are i/o -uint8_t hmcs44_cpu_device::read_r(int index) +u8 hmcs44_cpu_device::read_r(int index) { index &= 7; @@ -415,7 +415,7 @@ uint8_t hmcs44_cpu_device::read_r(int index) return hmcs40_cpu_device::read_r(index); } -void hmcs44_cpu_device::write_r(int index, uint8_t data) +void hmcs44_cpu_device::write_r(int index, u8 data) { index &= 7; @@ -429,7 +429,7 @@ void hmcs44_cpu_device::write_r(int index, uint8_t data) // R0-R5 are i/o, R6 is output-only, no R7 // D0-D15 are i/o -uint8_t hmcs45_cpu_device::read_r(int index) +u8 hmcs45_cpu_device::read_r(int index) { index &= 7; @@ -439,7 +439,7 @@ uint8_t hmcs45_cpu_device::read_r(int index) return hmcs40_cpu_device::read_r(index); } -void hmcs45_cpu_device::write_r(int index, uint8_t data) +void hmcs45_cpu_device::write_r(int index, u8 data) { index &= 7; @@ -553,8 +553,8 @@ void hmcs40_cpu_device::increment_tc() inline void hmcs40_cpu_device::increment_pc() { // PC lower bits is a LFSR identical to TI TMS1000 - uint8_t mask = 0x3f; - uint8_t low = m_pc & mask; + u8 mask = 0x3f; + u8 low = m_pc & mask; int fb = (low << 1 & 0x20) == (low & 0x20); if (low == (mask >> 1)) diff --git a/src/devices/cpu/hmcs40/hmcs40.h b/src/devices/cpu/hmcs40/hmcs40.h index 38a6d20169d..1eaed0bab37 100644 --- a/src/devices/cpu/hmcs40/hmcs40.h +++ b/src/devices/cpu/hmcs40/hmcs40.h @@ -16,15 +16,15 @@ // max 8 4-bit R ports #define MCFG_HMCS40_READ_R_CB(R, _devcb) \ - hmcs40_cpu_device::set_read_r##R##_callback(*device, DEVCB_##_devcb); + devcb = &hmcs40_cpu_device::set_read_r##R##_callback(*device, DEVCB_##_devcb); #define MCFG_HMCS40_WRITE_R_CB(R, _devcb) \ - hmcs40_cpu_device::set_write_r##R##_callback(*device, DEVCB_##_devcb); + devcb = &hmcs40_cpu_device::set_write_r##R##_callback(*device, DEVCB_##_devcb); // 16-bit discrete #define MCFG_HMCS40_READ_D_CB(_devcb) \ - hmcs40_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); + devcb = &hmcs40_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); #define MCFG_HMCS40_WRITE_D_CB(_devcb) \ - hmcs40_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); + devcb = &hmcs40_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); enum { @@ -116,7 +116,7 @@ class hmcs40_cpu_device : public cpu_device { public: // construction/destruction - hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int family, uint16_t polarity, int stack_levels, int pcwidth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int family, u16 polarity, int stack_levels, int pcwidth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_LITTLE, 16, prgwidth, -1, program) , m_data_config("data", ENDIANNESS_LITTLE, 8, datawidth, 0, data) @@ -160,11 +160,11 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle - virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 4); } // " - virtual uint32_t execute_min_cycles() const override { return 1; } - virtual uint32_t execute_max_cycles() const override { return 2; } - virtual uint32_t execute_input_lines() const override { return 2+1; } // 3rd one is internal + virtual u64 execute_clocks_to_cycles(u64 clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle + virtual u64 execute_cycles_to_clocks(u64 cycles) const override { return (cycles * 4); } // " + virtual u32 execute_min_cycles() const override { return 1; } + virtual u32 execute_max_cycles() const override { return 2; } + virtual u32 execute_input_lines() const override { return 2+1; } // 3rd one is internal virtual void execute_set_input(int line, int state) override; virtual void execute_run() override; @@ -172,9 +172,9 @@ protected: 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 2; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 2; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual u32 disasm_min_opcode_bytes() const override { return 2; } + virtual u32 disasm_max_opcode_bytes() const override { return 2; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; @@ -182,46 +182,46 @@ protected: address_space *m_program; address_space *m_data; - int m_pcwidth; // Program Counter bit-width + int m_pcwidth; // Program Counter bit-width int m_prgwidth; int m_datawidth; int m_pcmask; int m_prgmask; int m_datamask; - int m_family; // MCU family (42-47) - uint16_t m_polarity; // i/o polarity (pmos vs cmos) - int m_stack_levels; // number of callstack levels - uint16_t m_stack[4]; // max 4 - uint16_t m_op; // current opcode - uint16_t m_prev_op; - uint8_t m_i; // 4-bit immediate opcode param - int m_eint_line; // which input_line caused an interrupt + int m_family; // MCU family (42-47) + u16 m_polarity; // i/o polarity (pmos vs cmos) + int m_stack_levels; // number of callstack levels + u16 m_stack[4]; // max 4 + u16 m_op; // current opcode + u16 m_prev_op; + u8 m_i; // 4-bit immediate opcode param + int m_eint_line; // which input_line caused an interrupt emu_timer *m_timer; - int m_halt; // internal HLT state + int m_halt; // internal HLT state attotime m_timer_halted_remain; int m_icount; - uint16_t m_pc; // Program Counter - uint16_t m_prev_pc; - uint8_t m_page; // LPU prepared page - uint8_t m_a; // 4-bit Accumulator - uint8_t m_b; // 4-bit B register - uint8_t m_x; // 1/3/4-bit X register - uint8_t m_spx; // 1/3/4-bit SPX register - uint8_t m_y; // 4-bit Y register - uint8_t m_spy; // 4-bit SPY register - uint8_t m_s; // Status F/F (F/F = flip-flop) - uint8_t m_c; // Carry F/F - uint8_t m_tc; // Timer/Counter - uint8_t m_cf; // CF F/F (timer mode or counter mode) - uint8_t m_ie; // I/E(Interrupt Enable) F/F - uint8_t m_iri; // external interrupt pending I/RI F/F - uint8_t m_irt; // timer interrupt pending I/RT F/F - uint8_t m_if[2]; // external interrupt mask IF0,1 F/F - uint8_t m_tf; // timer interrupt mask TF F/F - uint8_t m_int[2]; // INT0/1 pins state - uint8_t m_r[8]; // R outputs state - uint16_t m_d; // D pins state + u16 m_pc; // Program Counter + u16 m_prev_pc; + u8 m_page; // LPU prepared page + u8 m_a; // 4-bit Accumulator + u8 m_b; // 4-bit B register + u8 m_x; // 1/3/4-bit X register + u8 m_spx; // 1/3/4-bit SPX register + u8 m_y; // 4-bit Y register + u8 m_spy; // 4-bit SPY register + u8 m_s; // Status F/F (F/F = flip-flop) + u8 m_c; // Carry F/F + u8 m_tc; // Timer/Counter + u8 m_cf; // CF F/F (timer mode or counter mode) + u8 m_ie; // I/E(Interrupt Enable) F/F + u8 m_iri; // external interrupt pending I/RI F/F + u8 m_irt; // timer interrupt pending I/RT F/F + u8 m_if[2]; // external interrupt mask IF0,1 F/F + u8 m_tf; // timer interrupt mask TF F/F + u8 m_int[2]; // INT0/1 pins state + u8 m_r[8]; // R outputs state + u16 m_d; // D pins state // i/o handlers devcb_read8 m_read_r0, m_read_r1, m_read_r2, m_read_r3, m_read_r4, m_read_r5, m_read_r6, m_read_r7; @@ -232,13 +232,13 @@ protected: // misc internal helpers void increment_pc(); - uint8_t ram_r(); - void ram_w(uint8_t data); + u8 ram_r(); + void ram_w(u8 data); void pop_stack(); void push_stack(); - virtual uint8_t read_r(int index); - virtual void write_r(int index, uint8_t data); + virtual u8 read_r(int index); + virtual void write_r(int index, u8 data); virtual int read_d(int index); virtual void write_d(int index, int state); @@ -349,109 +349,109 @@ protected: class hmcs43_cpu_device : public hmcs40_cpu_device { public: - hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname); + hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname); protected: // overrides - virtual uint8_t read_r(int index) override; - virtual void write_r(int index, uint8_t data) override; + virtual u8 read_r(int index) override; + virtual void write_r(int index, u8 data) override; virtual int read_d(int index) override; }; class hd38750_device : public hmcs43_cpu_device { public: - hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd38755_device : public hmcs43_cpu_device { public: - hd38755_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38755_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44750_device : public hmcs43_cpu_device { public: - hd44750_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44750_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44758_device : public hmcs43_cpu_device { public: - hd44758_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44758_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hmcs44_cpu_device : public hmcs40_cpu_device { public: - hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname); + hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname); protected: // overrides - virtual uint8_t read_r(int index) override; - virtual void write_r(int index, uint8_t data) override; + virtual u8 read_r(int index) override; + virtual void write_r(int index, u8 data) override; }; class hd38800_device : public hmcs44_cpu_device { public: - hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd38805_device : public hmcs44_cpu_device { public: - hd38805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38805_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44801_device : public hmcs44_cpu_device { public: - hd44801_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44801_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44808_device : public hmcs44_cpu_device { public: - hd44808_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44808_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hmcs45_cpu_device : public hmcs40_cpu_device { public: - hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint16_t polarity, const char *shortname); + hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u16 polarity, const char *shortname); protected: // overrides - virtual uint8_t read_r(int index) override; - virtual void write_r(int index, uint8_t data) override; + virtual u8 read_r(int index) override; + virtual void write_r(int index, u8 data) override; }; class hd38820_device : public hmcs45_cpu_device { public: - hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd38825_device : public hmcs45_cpu_device { public: - hd38825_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd38825_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44820_device : public hmcs45_cpu_device { public: - hd44820_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44820_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class hd44828_device : public hmcs45_cpu_device { public: - hd44828_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hd44828_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/hmcs40/hmcs40d.cpp b/src/devices/cpu/hmcs40/hmcs40d.cpp index 867972d82db..0b05d8b3f76 100644 --- a/src/devices/cpu/hmcs40/hmcs40d.cpp +++ b/src/devices/cpu/hmcs40/hmcs40d.cpp @@ -46,7 +46,7 @@ static const char *const s_mnemonics[] = }; // number of bits per opcode parameter, 99 means (XY) parameter, negative means reversed bit-order -static const int8_t s_bits[] = +static const s8 s_bits[] = { 0, 0, 0, 0, 0, 0, 4, @@ -65,7 +65,7 @@ static const int8_t s_bits[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t s_flags[] = +static const u32 s_flags[] = { 0, 0, 0, 0, 0, 0, 0, @@ -82,7 +82,7 @@ static const uint32_t s_flags[] = }; // next program counter in sequence (relative) -static const int8_t s_next_pc[0x40] = +static const s8 s_next_pc[0x40] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32+0x40 /* rollback */, @@ -91,7 +91,7 @@ static const int8_t s_next_pc[0x40] = }; -static const uint8_t hmcs40_mnemonic[0x400] = +static const u8 hmcs40_mnemonic[0x400] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0x000 */ @@ -186,9 +186,9 @@ static const uint8_t hmcs40_mnemonic[0x400] = CPU_DISASSEMBLE(hmcs40) { - uint16_t op = (oprom[0] | oprom[1] << 8) & 0x3ff; - uint8_t instr = hmcs40_mnemonic[op]; - int8_t bits = s_bits[instr]; + u16 op = (oprom[0] | oprom[1] << 8) & 0x3ff; + u8 instr = hmcs40_mnemonic[op]; + s8 bits = s_bits[instr]; // special case for (XY) opcode if (bits == 99) @@ -207,7 +207,7 @@ CPU_DISASSEMBLE(hmcs40) // opcode parameter if (bits != 0) { - uint8_t param = op; + u8 param = op; // reverse bits if (bits < 0) diff --git a/src/devices/cpu/hmcs40/hmcs40op.cpp b/src/devices/cpu/hmcs40/hmcs40op.cpp index 31a74d76905..da89ff44fe7 100644 --- a/src/devices/cpu/hmcs40/hmcs40op.cpp +++ b/src/devices/cpu/hmcs40/hmcs40op.cpp @@ -8,15 +8,15 @@ // internal helpers -inline uint8_t hmcs40_cpu_device::ram_r() +inline u8 hmcs40_cpu_device::ram_r() { - uint8_t address = (m_x << 4 | m_y) & m_datamask; + u8 address = (m_x << 4 | m_y) & m_datamask; return m_data->read_byte(address) & 0xf; } -inline void hmcs40_cpu_device::ram_w(uint8_t data) +inline void hmcs40_cpu_device::ram_w(u8 data) { - uint8_t address = (m_x << 4 | m_y) & m_datamask; + u8 address = (m_x << 4 | m_y) & m_datamask; m_data->write_byte(address, data & 0xf); } @@ -81,7 +81,7 @@ void hmcs40_cpu_device::op_xamr() // XAMR m: Exchange A and MR(m) // determine MR(Memory Register) location - uint8_t address = m_op & 0xf; + u8 address = m_op & 0xf; // HMCS42: MR0 on file 0, MR4-MR15 on file 4 (there is no file 1-3) // HMCS43: MR0-MR3 on file 0-3, MR4-MR15 on file 4 @@ -93,7 +93,7 @@ void hmcs40_cpu_device::op_xamr() address |= 0xf0; address &= m_datamask; - uint8_t old_a = m_a; + u8 old_a = m_a; m_a = m_data->read_byte(address) & 0xf; m_data->write_byte(address, old_a & 0xf); } @@ -160,13 +160,13 @@ void hmcs40_cpu_device::op_xsp() // XSP (XY): Exchange X and SPX, Y and SPY, or NOP if 0 if (m_op & 1) { - uint8_t old_x = m_x; + u8 old_x = m_x; m_x = m_spx; m_spx = old_x; } if (m_op & 2) { - uint8_t old_y = m_y; + u8 old_y = m_y; m_y = m_spy; m_spy = old_y; } @@ -192,7 +192,7 @@ void hmcs40_cpu_device::op_lbm() void hmcs40_cpu_device::op_xma() { // XMA (XY): Exchange Memory and A - uint8_t old_a = m_a; + u8 old_a = m_a; m_a = ram_r(); ram_w(old_a); op_xsp(); @@ -201,7 +201,7 @@ void hmcs40_cpu_device::op_xma() void hmcs40_cpu_device::op_xmb() { // XMB (XY): Exchange Memory and B - uint8_t old_b = m_b; + u8 old_b = m_b; m_b = ram_r(); ram_w(old_b); op_xsp(); @@ -357,7 +357,7 @@ void hmcs40_cpu_device::op_rotl() void hmcs40_cpu_device::op_rotr() { // ROTR: Rotate Right A with Carry - uint8_t c = m_a & 1; + u8 c = m_a & 1; m_a = m_a >> 1 | m_c << 3; m_c = c; } @@ -470,7 +470,7 @@ void hmcs40_cpu_device::op_lpu() void hmcs40_cpu_device::op_tbr() { // TBR p: Table Branch - uint16_t address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f); + u16 address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f); m_pc = address & m_pcmask; } @@ -661,8 +661,8 @@ void hmcs40_cpu_device::op_p() { // P p: Pattern Generation m_icount--; - uint16_t address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f); - uint16_t o = m_program->read_word((address & m_prgmask) << 1); + u16 address = m_a | m_b << 4 | m_c << 8 | (m_op & 7) << 9 | (m_pc & ~0x3f); + u16 o = m_program->read_word((address & m_prgmask) << 1); // destination is determined by the 2 highest bits if (o & 0x100) diff --git a/src/devices/cpu/hphybrid/hphybrid.h b/src/devices/cpu/hphybrid/hphybrid.h index c4f85f196b5..62e4724139a 100644 --- a/src/devices/cpu/hphybrid/hphybrid.h +++ b/src/devices/cpu/hphybrid/hphybrid.h @@ -77,7 +77,7 @@ // PA changed callback #define MCFG_HPHYBRID_PA_CHANGED(_devcb) \ - hp_hybrid_cpu_device::set_pa_changed_func(*device , DEVCB_##_devcb); + devcb = &hp_hybrid_cpu_device::set_pa_changed_func(*device , DEVCB_##_devcb); class hp_hybrid_cpu_device : public cpu_device { diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h index c4abab31915..ca299b6cf1d 100644 --- a/src/devices/cpu/i386/i386.h +++ b/src/devices/cpu/i386/i386.h @@ -20,7 +20,7 @@ #define MCFG_I386_SMIACT(_devcb) \ - i386_device::set_smiact(*device, DEVCB_##_devcb); + devcb = &i386_device::set_smiact(*device, DEVCB_##_devcb); #define X86_NUM_CPUS 4 diff --git a/src/devices/cpu/i8085/i8085.h b/src/devices/cpu/i8085/i8085.h index 71074291d1a..46f6e1eee0b 100644 --- a/src/devices/cpu/i8085/i8085.h +++ b/src/devices/cpu/i8085/i8085.h @@ -34,19 +34,19 @@ enum /* STATUS changed callback */ #define MCFG_I8085A_STATUS(_devcb) \ - i8085a_cpu_device::set_out_status_func(*device, DEVCB_##_devcb); + devcb = &i8085a_cpu_device::set_out_status_func(*device, DEVCB_##_devcb); /* INTE changed callback */ #define MCFG_I8085A_INTE(_devcb) \ - i8085a_cpu_device::set_out_inte_func(*device, DEVCB_##_devcb); + devcb = &i8085a_cpu_device::set_out_inte_func(*device, DEVCB_##_devcb); /* SID changed callback (8085A only) */ #define MCFG_I8085A_SID(_devcb) \ - i8085a_cpu_device::set_in_sid_func(*device, DEVCB_##_devcb); + devcb = &i8085a_cpu_device::set_in_sid_func(*device, DEVCB_##_devcb); /* SOD changed callback (8085A only) */ #define MCFG_I8085A_SOD(_devcb) \ - i8085a_cpu_device::set_out_sod_func(*device, DEVCB_##_devcb); + devcb = &i8085a_cpu_device::set_out_sod_func(*device, DEVCB_##_devcb); class i8085a_cpu_device : public cpu_device diff --git a/src/devices/cpu/i8089/i8089.h b/src/devices/cpu/i8089/i8089.h index 4354ceffdf2..81c84089300 100644 --- a/src/devices/cpu/i8089/i8089.h +++ b/src/devices/cpu/i8089/i8089.h @@ -23,10 +23,10 @@ i8089_device::set_databus_width(*device, _databus_width); #define MCFG_I8089_SINTR1(_sintr1) \ - downcast<i8089_device *>(device)->set_sintr1_callback(DEVCB_##_sintr1); + devcb = &downcast<i8089_device *>(device)->set_sintr1_callback(DEVCB_##_sintr1); #define MCFG_I8089_SINTR2(_sintr2) \ - downcast<i8089_device *>(device)->set_sintr2_callback(DEVCB_##_sintr2); + devcb = &downcast<i8089_device *>(device)->set_sintr2_callback(DEVCB_##_sintr2); //************************************************************************** @@ -47,8 +47,8 @@ public: i8089_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // callbacks - template<class _sintr1> void set_sintr1_callback(_sintr1 sintr1) { m_write_sintr1.set_callback(sintr1); } - template<class _sintr2> void set_sintr2_callback(_sintr2 sintr2) { m_write_sintr2.set_callback(sintr2); } + template<class _sintr1> devcb_base &set_sintr1_callback(_sintr1 sintr1) { return m_write_sintr1.set_callback(sintr1); } + template<class _sintr2> devcb_base &set_sintr2_callback(_sintr2 sintr2) { return m_write_sintr2.set_callback(sintr2); } // static configuration helpers static void set_databus_width(device_t &device, uint8_t databus_width) { downcast<i8089_device &>(device).m_databus_width = databus_width; } diff --git a/src/devices/cpu/lh5801/lh5801.h b/src/devices/cpu/lh5801/lh5801.h index 4b693c1961c..d48c8661e01 100644 --- a/src/devices/cpu/lh5801/lh5801.h +++ b/src/devices/cpu/lh5801/lh5801.h @@ -61,7 +61,7 @@ enum #define MCFG_LH5801_IN(_devcb) \ - lh5801_cpu_device::set_in_func(*device, DEVCB_##_devcb); + devcb = &lh5801_cpu_device::set_in_func(*device, DEVCB_##_devcb); class lh5801_cpu_device : public cpu_device diff --git a/src/devices/cpu/lr35902/lr35902.h b/src/devices/cpu/lr35902/lr35902.h index ad032fbebba..b1b511db760 100644 --- a/src/devices/cpu/lr35902/lr35902.h +++ b/src/devices/cpu/lr35902/lr35902.h @@ -7,7 +7,7 @@ #define MCFG_LR35902_TIMER_CB(_devcb) \ - lr35902_cpu_device::set_timer_cb(*device, DEVCB_##_devcb); + devcb = &lr35902_cpu_device::set_timer_cb(*device, DEVCB_##_devcb); // The first release of this CPU has a bug where the programcounter // is not incremented properly after an interrupt after the halt opcode. @@ -19,7 +19,7 @@ // a 16-bit register in the $fe** region. // note: oldval is in hiword, newval is in loword #define MCFG_LR35902_INCDEC16_CB(_devcb) \ - lr35902_cpu_device::set_incdec16_cb(*device, DEVCB_##_devcb); + devcb = &lr35902_cpu_device::set_incdec16_cb(*device, DEVCB_##_devcb); enum diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h index c81f98c6fb3..df58ecd27c6 100644 --- a/src/devices/cpu/m6800/m6800.h +++ b/src/devices/cpu/m6800/m6800.h @@ -67,9 +67,9 @@ enum #define MCFG_M6801_SC2(_devcb) \ - m6800_cpu_device::set_out_sc2_func(*device, DEVCB_##_devcb); + devcb = &m6800_cpu_device::set_out_sc2_func(*device, DEVCB_##_devcb); #define MCFG_M6801_SER_TX(_devcb) \ - m6800_cpu_device::set_out_sertx_func(*device, DEVCB_##_devcb); + devcb = &m6800_cpu_device::set_out_sertx_func(*device, DEVCB_##_devcb); class m6800_cpu_device : public cpu_device { diff --git a/src/devices/cpu/m6805/6805dasm.cpp b/src/devices/cpu/m6805/6805dasm.cpp index 010840061e2..e8cca5bf4e3 100644 --- a/src/devices/cpu/m6805/6805dasm.cpp +++ b/src/devices/cpu/m6805/6805dasm.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /* * A quick-hack 68(7)05 disassembler * @@ -18,7 +18,7 @@ namespace { enum class md { - IMP, // implicit + INH, // inherent BTR, // bit test and relative BIT, // bit set/clear REL, // relative @@ -30,138 +30,96 @@ enum class md { IX2 // indexed + word offset }; -enum op_names { - adca=0, adda, anda, asl, asla, aslx, asr, asra, +enum class lvl { + HMOS, + CMOS, + HC +}; + +enum class op_names { + adca, adda, anda, asl, asla, aslx, asr, asra, asrx, bcc, bclr, bcs, beq, bhcc, bhcs, bhi, - bih, bil, bita, bls, bmc, bmi, bms, bne, + bih, bil, bit, bls, bmc, bmi, bms, bne, bpl, bra, brclr, brn, brset, bset, bsr, clc, cli, clr, clra, clrx, cmpa, com, coma, comx, cpx, dec, deca, decx, eora, ill, inc, inca, incx, jmp, jsr, lda, ldx, lsr, lsra, lsrx, - neg, nega, negx, nop, ora, rol, rola, rolx, - ror, rora, rorx, rsp, rti, rts, sbca, sec, - sei, sta, stx, suba, swi, tax, tst, tsta, - tstx, txa -}; - -char const *const op_name_str[] = { - "adca", "adda", "anda", "asl", "asla", "aslx", "asr", "asra", - "asrx", "bcc", "bclr", "bcs", "beq", "bhcc", "bhcs", "bhi", - "bih", "bil", "bita", "bls", "bmc", "bmi", "bms", "bne", - "bpl", "bra", "brclr","brn", "brset","bset", "bsr", "clc", - "cli", "clr", "clra", "clrx", "cmpa", "com", "coma", "comx", - "cpx", "dec", "deca", "decx", "eora", "*ill", "inc", "inca", - "incx", "jmp", "jsr", "lda", "ldx", "lsr", "lsra", "lsrx", - "neg", "nega", "negx", "nop", "ora", "rol", "rola", "rolx", - "ror", "rora", "rorx", "rsp", "rti", "rts", "sbca", "sec", - "sei", "sta", "stx", "suba", "swi", "tax", "tst", "tsta", - "tstx", "txa" + mul, neg, nega, negx, nop, ora, rol, rola, + rolx, ror, rora, rorx, rsp, rti, rts, sbca, + sec, sei, sta, stop, stx, suba, swi, tax, + tst, tsta, tstx, txa, wait }; -struct { u8 op; md mode; } const disasm[0x100] = { - {brset,md::BTR}, {brclr,md::BTR}, {brset,md::BTR}, {brclr,md::BTR}, // 00 - {brset,md::BTR}, {brclr,md::BTR}, {brset,md::BTR}, {brclr,md::BTR}, - {brset,md::BTR}, {brclr,md::BTR}, {brset,md::BTR}, {brclr,md::BTR}, - {brset,md::BTR}, {brclr,md::BTR}, {brset,md::BTR}, {brclr,md::BTR}, - {bset, md::BIT}, {bclr, md::BIT}, {bset, md::BIT}, {bclr, md::BIT}, // 10 - {bset, md::BIT}, {bclr, md::BIT}, {bset, md::BIT}, {bclr, md::BIT}, - {bset, md::BIT}, {bclr, md::BIT}, {bset, md::BIT}, {bclr, md::BIT}, - {bset, md::BIT}, {bclr, md::BIT}, {bset, md::BIT}, {bclr, md::BIT}, - {bra, md::REL}, {brn, md::REL}, {bhi, md::REL}, {bls, md::REL}, // 20 - {bcc, md::REL}, {bcs, md::REL}, {bne, md::REL}, {beq, md::REL}, - {bhcc, md::REL}, {bhcs, md::REL}, {bpl, md::REL}, {bmi, md::REL}, - {bmc, md::REL}, {bms, md::REL}, {bil, md::REL}, {bih, md::REL}, - {neg, md::DIR}, {ill, md::IMP}, {ill, md::IMP}, {com, md::DIR}, // 30 - {lsr, md::DIR}, {ill, md::IMP}, {ror, md::DIR}, {asr, md::DIR}, - {asl, md::DIR}, {rol, md::DIR}, {dec, md::DIR}, {ill, md::IMP}, - {inc, md::DIR}, {tst, md::DIR}, {ill, md::IMP}, {clr, md::DIR}, - {nega, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {coma, md::IMP}, // 40 - {lsra, md::IMP}, {ill, md::IMP}, {rora, md::IMP}, {asra, md::IMP}, - {asla, md::IMP}, {rola, md::IMP}, {deca, md::IMP}, {ill, md::IMP}, - {inca, md::IMP}, {tsta, md::IMP}, {ill, md::IMP}, {clra, md::IMP}, - {negx, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {comx, md::IMP}, // 50 - {lsrx, md::IMP}, {ill, md::IMP}, {rorx, md::IMP}, {asrx, md::IMP}, - {aslx, md::IMP}, {rolx, md::IMP}, {decx, md::IMP}, {ill, md::IMP}, - {incx, md::IMP}, {tstx, md::IMP}, {ill, md::IMP}, {clrx, md::IMP}, - {neg, md::IX1}, {ill, md::IMP}, {ill, md::IMP}, {com, md::IX1}, // 60 - {lsr, md::IX1}, {ill, md::IMP}, {ror, md::IX1}, {asr, md::IX1}, - {asl, md::IX1}, {rol, md::IX1}, {dec, md::IX1}, {ill, md::IMP}, - {inc, md::IX1}, {tst, md::IX1}, {jmp, md::IX1}, {clr, md::IX1}, - {neg, md::IDX}, {ill, md::IMP}, {ill, md::IMP}, {com, md::IDX}, // 70 - {lsr, md::IDX}, {ill, md::IMP}, {ror, md::IDX}, {asr, md::IDX}, - {asl, md::IDX}, {rol, md::IDX}, {dec, md::IDX}, {ill, md::IMP}, - {inc, md::IDX}, {tst, md::IDX}, {jmp, md::IDX}, {clr, md::IDX}, - {rti, md::IMP}, {rts, md::IMP}, {ill, md::IMP}, {swi, md::IMP}, // 80 - {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, - {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, - {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, - {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, // 90 - {ill, md::IMP}, {ill, md::IMP}, {ill, md::IMP}, {tax, md::IMP}, - {clc, md::IMP}, {sec, md::IMP}, {cli, md::IMP}, {sei, md::IMP}, - {rsp, md::IMP}, {nop, md::IMP}, {ill, md::IMP}, {txa, md::IMP}, - {suba, md::IMM}, {cmpa, md::IMM}, {sbca, md::IMM}, {cpx, md::IMM}, // a0 - {anda, md::IMM}, {bita, md::IMM}, {lda, md::IMM}, {ill, md::IMP}, - {eora, md::IMM}, {adca, md::IMM}, {ora, md::IMM}, {adda, md::IMM}, - {ill, md::IMP}, {bsr, md::REL}, {ldx, md::IMM}, {ill, md::IMP}, - {suba, md::DIR}, {cmpa, md::DIR}, {sbca, md::DIR}, {cpx, md::DIR}, // b0 - {anda, md::DIR}, {bita, md::DIR}, {lda, md::DIR}, {sta, md::DIR}, - {eora, md::DIR}, {adca, md::DIR}, {ora, md::DIR}, {adda, md::DIR}, - {jmp, md::DIR}, {jsr, md::DIR}, {ldx, md::DIR}, {stx, md::DIR}, - {suba, md::EXT}, {cmpa, md::EXT}, {sbca, md::EXT}, {cpx, md::EXT}, // c0 - {anda, md::EXT}, {bita, md::EXT}, {lda, md::EXT}, {sta, md::EXT}, - {eora, md::EXT}, {adca, md::EXT}, {ora, md::EXT}, {adda, md::EXT}, - {jmp, md::EXT}, {jsr, md::EXT}, {ldx, md::EXT}, {stx, md::EXT}, - {suba, md::IX2}, {cmpa, md::IX2}, {sbca, md::IX2}, {cpx, md::IX2}, // d0 - {anda, md::IX2}, {bita, md::IX2}, {lda, md::IX2}, {sta, md::IX2}, - {eora, md::IX2}, {adca, md::IX2}, {ora, md::IX2}, {adda, md::IX2}, - {jmp, md::IX2}, {jsr, md::IX2}, {ldx, md::IX2}, {stx, md::IX2}, - {suba, md::IX1}, {cmpa, md::IX1}, {sbca, md::IX1}, {cpx, md::IX1}, // e0 - {anda, md::IX1}, {bita, md::IX1}, {lda, md::IX1}, {sta, md::IX1}, - {eora, md::IX1}, {adca, md::IX1}, {ora, md::IX1}, {adda, md::IX1}, - {jmp, md::IX1}, {jsr, md::IX1}, {ldx, md::IX1}, {stx, md::IX1}, - {suba, md::IDX}, {cmpa, md::IDX}, {sbca, md::IDX}, {cpx, md::IDX}, // f0 - {anda, md::IDX}, {bita, md::IDX}, {lda, md::IDX}, {sta, md::IDX}, - {eora, md::IDX}, {adca, md::IDX}, {ora, md::IDX}, {adda, md::IDX}, - {jmp, md::IDX}, {jsr, md::IDX}, {ldx, md::IDX}, {stx, md::IDX} -}; - -#if 0 -char const *const opcode_strings[0x0100] = -{ - "brset0", "brclr0", "brset1", "brclr1", "brset2", "brclr2", "brset3", "brclr3", /*00*/ - "brset4", "brclr4", "brset5", "brclr5", "brset6", "brclr6", "brset7", "brclr7", - "bset0", "bclr0", "bset1", "bclr1", "bset2", "bclr2", "bset3", "bclr3", /*10*/ - "bset4", "bclr4", "bset5", "bclr5", "bset6", "bclr6", "bset7", "bclr7", - "bra", "brn", "bhi", "bls", "bcc", "bcs", "bne", "beq", /*20*/ - "bhcc", "bhcs", "bpl", "bmi", "bmc", "bms", "bil", "bih", - "neg_di", "illegal", "illegal", "com_di", "lsr_di", "illegal", "ror_di", "asr_di", /*30*/ - "asl_di", "rol_di", "dec_di", "illegal", "inc_di", "tst_di", "illegal", "clr_di", - "nega", "illegal", "illegal", "coma", "lsra", "illegal", "rora", "asra", /*40*/ - "asla", "rola", "deca", "illegal", "inca", "tsta", "illegal", "clra", - "negx", "illegal", "illegal", "comx", "lsrx", "illegal", "rorx", "asrx", /*50*/ - "aslx", "rolx", "decx", "illegal", "incx", "tstx", "illegal", "clrx", - "neg_ix1", "illegal", "illegal", "com_ix1", "lsr_ix1", "illegal", "ror_ix1", "asr_ix1", /*60*/ - "asl_ix1", "rol_ix1", "dec_ix1", "illegal", "inc_ix1", "tst_ix1", "jmp_ix1", "clr_ix1", - "neg_ix", "illegal", "illegal", "com_ix", "lsr_ix", "illegal", "ror_ix", "asr_ix", /*70*/ - "asl_ix", "rol_ix", "dec_ix", "illegal", "inc_ix", "tst_ix", "jmp_ix", "clr_ix", - "rti", "rts", "illegal", "swi", "illegal", "illegal", "illegal", "illegal", /*80*/ - "illegal", "illegal", "illegal", "illegal", "illegal", "illegal", "illegal", "illegal", - "illegal", "illegal", "illegal", "illegal", "illegal", "illegal", "illegal", "tax", /*90*/ - "clc", "sec", "cli", "sei", "rsp", "nop", "illegal", "txa", - "suba_im", "cmpa_im", "sbca_im", "cpx_im", "anda_im", "bita_im", "lda_im", "illegal", /*A0*/ - "eora_im", "adca_im", "ora_im", "adda_im", "illegal", "bsr", "ldx_im", "illegal", - "suba_di", "cmpa_di", "sbca_di", "cpx_di", "anda_di", "bita_di", "lda_di", "sta_di", /*B0*/ - "eora_di", "adca_di", "ora_di", "adda_di", "jmp_di", "jsr_di", "ldx_di", "stx_di", - "suba_ex", "cmpa_ex", "sbca_ex", "cpx_ex", "anda_ex", "bita_ex", "lda_ex", "sta_ex", /*C0*/ - "eora_ex", "adca_ex", "ora_ex", "adda_ex", "jmp_ex", "jsr_ex", "ldx_ex", "stx_ex", - "suba_ix2", "cmpa_ix2", "sbca_ix2", "cpx_ix2", "anda_ix2", "bita_ix2", "lda_ix2", "sta_ix2", /*D0*/ - "eora_ix2", "adca_ix2", "ora_ix2", "adda_ix2", "jmp_ix2", "jsr_ix2", "ldx_ix2", "stx_ix2", - "suba_ix1", "cmpa_ix1", "sbca_ix1", "cpx_ix1", "anda_ix1", "bita_ix1", "lda_ix1", "sta_ix1", /*E0*/ - "eora_ix1", "adca_ix1", "ora_ix1", "adda_ix1", "jmp_ix1", "jsr_ix1", "ldx_ix1", "stx_ix1", - "suba_ix", "cmpa_ix", "sbca_ix", "cpx_ix", "anda_ix", "bita_ix", "lda_ix", "sta_ix", /*F0*/ - "eora_ix", "adca_ix", "ora_ix", "adda_ix", "jmp_ix", "jsr_ix", "ldx_ix", "stx_ix" +#define OP(name, mode) { op_names::name, #name, md::mode, lvl::HMOS } +#define OPC(name, mode) { op_names::name, #name, md::mode, lvl::CMOS } +#define OPHC(name, mode) { op_names::name, #name, md::mode, lvl::HC } +#define ILLEGAL { op_names::ill, nullptr, md::INH, lvl::HMOS } +struct { op_names op; char const *name; md mode; lvl level; } const disasm[0x100] = { + OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR), // 00 + OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR), + OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR), + OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR), + OP (bset, BIT), OP (bclr, BIT), OP (bset, BIT), OP (bclr, BIT), // 10 + OP (bset, BIT), OP (bclr, BIT), OP (bset, BIT), OP (bclr, BIT), + OP (bset, BIT), OP (bclr, BIT), OP (bset, BIT), OP (bclr, BIT), + OP (bset, BIT), OP (bclr, BIT), OP (bset, BIT), OP (bclr, BIT), + OP (bra, REL), OP (brn, REL), OP (bhi, REL), OP (bls, REL), // 20 + OP (bcc, REL), OP (bcs, REL), OP (bne, REL), OP (beq, REL), + OP (bhcc, REL), OP (bhcs, REL), OP (bpl, REL), OP (bmi, REL), + OP (bmc, REL), OP (bms, REL), OP (bil, REL), OP (bih, REL), + OP (neg, DIR), ILLEGAL , ILLEGAL , OP (com, DIR), // 30 + OP (lsr, DIR), ILLEGAL , OP (ror, DIR), OP (asr, DIR), + OP (asl, DIR), OP (rol, DIR), OP (dec, DIR), ILLEGAL , + OP (inc, DIR), OP (tst, DIR), ILLEGAL , OP (clr, DIR), + OP (nega, INH), ILLEGAL , OPHC(mul, INH), OP (coma, INH), // 40 + OP (lsra, INH), ILLEGAL , OP (rora, INH), OP (asra, INH), + OP (asla, INH), OP (rola, INH), OP (deca, INH), ILLEGAL , + OP (inca, INH), OP (tsta, INH), ILLEGAL , OP (clra, INH), + OP (negx, INH), ILLEGAL , ILLEGAL , OP (comx, INH), // 50 + OP (lsrx, INH), ILLEGAL , OP (rorx, INH), OP (asrx, INH), + OP (aslx, INH), OP (rolx, INH), OP (decx, INH), ILLEGAL , + OP (incx, INH), OP (tstx, INH), ILLEGAL , OP (clrx, INH), + OP (neg, IX1), ILLEGAL , ILLEGAL , OP (com, IX1), // 60 + OP (lsr, IX1), ILLEGAL , OP (ror, IX1), OP (asr, IX1), + OP (asl, IX1), OP (rol, IX1), OP (dec, IX1), ILLEGAL , + OP (inc, IX1), OP (tst, IX1), OP (jmp, IX1), OP (clr, IX1), + OP (neg, IDX), ILLEGAL , ILLEGAL , OP (com, IDX), // 70 + OP (lsr, IDX), ILLEGAL , OP (ror, IDX), OP (asr, IDX), + OP (asl, IDX), OP (rol, IDX), OP (dec, IDX), ILLEGAL , + OP (inc, IDX), OP (tst, IDX), OP (jmp, IDX), OP (clr, IDX), + OP (rti, INH), OP (rts, INH), ILLEGAL , OP (swi, INH), // 80 + ILLEGAL , ILLEGAL , ILLEGAL , ILLEGAL , + ILLEGAL , ILLEGAL , ILLEGAL , ILLEGAL , + ILLEGAL , ILLEGAL , OPC (stop, INH), OPC (wait, INH), + ILLEGAL , ILLEGAL , ILLEGAL , ILLEGAL , // 90 + ILLEGAL , ILLEGAL , ILLEGAL , OP (tax, INH), + OP (clc, INH), OP (sec, INH), OP (cli, INH), OP (sei, INH), + OP (rsp, INH), OP (nop, INH), ILLEGAL , OP (txa, INH), + OP (suba, IMM), OP (cmpa, IMM), OP (sbca, IMM), OP (cpx, IMM), // a0 + OP (anda, IMM), OP (bit, IMM), OP (lda, IMM), ILLEGAL , + OP (eora, IMM), OP (adca, IMM), OP (ora, IMM), OP (adda, IMM), + ILLEGAL , OP (bsr, REL), OP (ldx, IMM), ILLEGAL , + OP (suba, DIR), OP (cmpa, DIR), OP (sbca, DIR), OP (cpx, DIR), // b0 + OP (anda, DIR), OP (bit, DIR), OP (lda, DIR), OP (sta, DIR), + OP (eora, DIR), OP (adca, DIR), OP (ora, DIR), OP (adda, DIR), + OP (jmp, DIR), OP (jsr, DIR), OP (ldx, DIR), OP (stx, DIR), + OP (suba, EXT), OP (cmpa, EXT), OP (sbca, EXT), OP (cpx, EXT), // c0 + OP (anda, EXT), OP (bit, EXT), OP (lda, EXT), OP (sta, EXT), + OP (eora, EXT), OP (adca, EXT), OP (ora, EXT), OP (adda, EXT), + OP (jmp, EXT), OP (jsr, EXT), OP (ldx, EXT), OP (stx, EXT), + OP (suba, IX2), OP (cmpa, IX2), OP (sbca, IX2), OP (cpx, IX2), // d0 + OP (anda, IX2), OP (bit, IX2), OP (lda, IX2), OP (sta, IX2), + OP (eora, IX2), OP (adca, IX2), OP (ora, IX2), OP (adda, IX2), + OP (jmp, IX2), OP (jsr, IX2), OP (ldx, IX2), OP (stx, IX2), + OP (suba, IX1), OP (cmpa, IX1), OP (sbca, IX1), OP (cpx, IX1), // e0 + OP (anda, IX1), OP (bit, IX1), OP (lda, IX1), OP (sta, IX1), + OP (eora, IX1), OP (adca, IX1), OP (ora, IX1), OP (adda, IX1), + OP (jmp, IX1), OP (jsr, IX1), OP (ldx, IX1), OP (stx, IX1), + OP (suba, IDX), OP (cmpa, IDX), OP (sbca, IDX), OP (cpx, IDX), // f0 + OP (anda, IDX), OP (bit, IDX), OP (lda, IDX), OP (sta, IDX), + OP (eora, IDX), OP (adca, IDX), OP (ora, IDX), OP (adda, IDX), + OP (jmp, IDX), OP (jsr, IDX), OP (ldx, IDX), OP (stx, IDX) }; -#endif template <typename T> @@ -182,90 +140,142 @@ void format_address( util::stream_format(stream, "$%0*X", 2 * sizeof(T), address); } -} // anonymous namespace - -offs_t CPU_DISASSEMBLE_NAME(m6805)( +offs_t disassemble( cpu_device *device, std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, int options, + lvl level, std::pair<u16, char const *> const symbols[], std::size_t symbol_count) { u8 const code = oprom[0]; - u32 flags = 0; - switch (disasm[code].op) + if (!disasm[code].name || (disasm[code].level > level)) { - case bsr: - case jsr: - flags = DASMFLAG_STEP_OVER; - break; - case rts: - case rti: - flags = DASMFLAG_STEP_OUT; - break; + util::stream_format(stream, "%-6s$%02X", "fcb", code); + return 1 | DASMFLAG_SUPPORTED; } + else + { + u32 flags; + switch (disasm[code].op) + { + case op_names::bsr: + case op_names::jsr: + flags = DASMFLAG_STEP_OVER; + break; + case op_names::rts: + case op_names::rti: + flags = DASMFLAG_STEP_OUT; + break; + default: + flags = 0; + } - util::stream_format(stream, "%-6s", op_name_str[disasm[code].op]); + util::stream_format(stream, "%-6s", disasm[code].name); - int bit; - u16 ea; - switch (disasm[code].mode) - { - case md::IMP: // implicit - return 1 | flags | DASMFLAG_SUPPORTED; + int bit; + u16 ea; + switch (disasm[code].mode) + { + case md::INH: // inherent + return 1 | flags | DASMFLAG_SUPPORTED; - case md::BTR: // bit test and relative branch - bit = (code >> 1) & 7; - util::stream_format(stream, "%d,", bit); - format_address(stream, opram[1], symbols, symbol_count); - util::stream_format(stream, ",$%03X", pc + 3 + s8(opram[2])); - return 3 | flags | DASMFLAG_SUPPORTED; + case md::BTR: // bit test and relative branch + bit = (code >> 1) & 7; + util::stream_format(stream, "%d,", bit); + format_address(stream, opram[1], symbols, symbol_count); + util::stream_format(stream, ",$%03X", pc + 3 + s8(opram[2])); + return 3 | flags | DASMFLAG_SUPPORTED; - case md::BIT: // bit test - bit = (code >> 1) & 7; - util::stream_format(stream, "%d,", bit); - format_address(stream, opram[1], symbols, symbol_count); - return 2 | flags | DASMFLAG_SUPPORTED; + case md::BIT: // bit test + bit = (code >> 1) & 7; + util::stream_format(stream, "%d,", bit); + format_address(stream, opram[1], symbols, symbol_count); + return 2 | flags | DASMFLAG_SUPPORTED; - case md::REL: // relative - util::stream_format(stream, "$%03X", pc + 2 + s8(opram[1])); - return 2 | flags | DASMFLAG_SUPPORTED; + case md::REL: // relative + util::stream_format(stream, "$%03X", pc + 2 + s8(opram[1])); + return 2 | flags | DASMFLAG_SUPPORTED; - case md::IMM: // immediate - util::stream_format(stream, "#$%02X", opram[1]); - return 2 | flags | DASMFLAG_SUPPORTED; + case md::IMM: // immediate + util::stream_format(stream, "#$%02X", opram[1]); + return 2 | flags | DASMFLAG_SUPPORTED; - case md::DIR: // direct (zero page address) - format_address(stream, opram[1], symbols, symbol_count); - return 2 | flags | DASMFLAG_SUPPORTED; + case md::DIR: // direct (zero page address) + format_address(stream, opram[1], symbols, symbol_count); + return 2 | flags | DASMFLAG_SUPPORTED; - case md::EXT: // extended (16 bit address) - ea = (opram[1] << 8) + opram[2]; - format_address(stream, ea, symbols, symbol_count); - return 3 | flags | DASMFLAG_SUPPORTED; + case md::EXT: // extended (16 bit address) + ea = (opram[1] << 8) + opram[2]; + format_address(stream, ea, symbols, symbol_count); + return 3 | flags | DASMFLAG_SUPPORTED; - case md::IDX: // indexed - util::stream_format(stream, "(x)"); - return 1 | flags | DASMFLAG_SUPPORTED; + case md::IDX: // indexed + util::stream_format(stream, "(x)"); + return 1 | flags | DASMFLAG_SUPPORTED; - case md::IX1: // indexed + byte (zero page) - util::stream_format(stream, "(x+$%02X)", opram[1]); - return 2 | flags | DASMFLAG_SUPPORTED; + case md::IX1: // indexed + byte (zero page) + util::stream_format(stream, "(x+$%02X)", opram[1]); + return 2 | flags | DASMFLAG_SUPPORTED; - case md::IX2: // indexed + word (16 bit address) - ea = (opram[1] << 8) + opram[2]; - util::stream_format(stream, "(x+$%04X)", ea); - return 3 | flags | DASMFLAG_SUPPORTED; + case md::IX2: // indexed + word (16 bit address) + ea = (opram[1] << 8) + opram[2]; + util::stream_format(stream, "(x+$%04X)", ea); + return 3 | flags | DASMFLAG_SUPPORTED; + } + + // if we fall off the switch statement something is very wrong + throw false; } +} + +} // anonymous namespace + - // if we fall off the switch statement something is very wrong - throw false; +offs_t CPU_DISASSEMBLE_NAME(m6805)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const symbols[], + std::size_t symbol_count) +{ + return disassemble(device, stream, pc, oprom, opram, options, lvl::HMOS, symbols, symbol_count); +} + +offs_t CPU_DISASSEMBLE_NAME(m146805)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const symbols[], + std::size_t symbol_count) +{ + return disassemble(device, stream, pc, oprom, opram, options, lvl::CMOS, symbols, symbol_count); } +offs_t CPU_DISASSEMBLE_NAME(m68hc05)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const symbols[], + std::size_t symbol_count) +{ + return disassemble(device, stream, pc, oprom, opram, options, lvl::HC, symbols, symbol_count); +} -CPU_DISASSEMBLE(m6805) { return CPU_DISASSEMBLE_NAME(m6805)(device, stream, pc, oprom, opram, options, nullptr, 0); } +CPU_DISASSEMBLE(m6805) { return CPU_DISASSEMBLE_NAME(m6805) (device, stream, pc, oprom, opram, options, nullptr, 0); } +CPU_DISASSEMBLE(m146805) { return CPU_DISASSEMBLE_NAME(m146805)(device, stream, pc, oprom, opram, options, nullptr, 0); } +CPU_DISASSEMBLE(m68hc05) { return CPU_DISASSEMBLE_NAME(m68hc05)(device, stream, pc, oprom, opram, options, nullptr, 0); } diff --git a/src/devices/cpu/m6805/6805ops.hxx b/src/devices/cpu/m6805/6805ops.hxx index 88e3ae5da8c..f69183a77ed 100644 --- a/src/devices/cpu/m6805/6805ops.hxx +++ b/src/devices/cpu/m6805/6805ops.hxx @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /* HNZC @@ -14,1794 +14,834 @@ HNZC */ -#define OP_HANDLER(_name) void m6805_base_device::_name() -#define DERIVED_OP_HANDLER(_arch,_name) void _arch##_device::_name() +#define OP_HANDLER(name) void m6805_base_device::name() +#define OP_HANDLER_BIT(name) template <unsigned B> void m6805_base_device::name() +#define OP_HANDLER_BRA(name) template <bool C> void m6805_base_device::name() +#define OP_HANDLER_MODE(name) template <m6805_base_device::addr_mode M> void m6805_base_device::name() + +#define DERIVED_OP_HANDLER(arch, name) void arch##_device::name() -#define OP_HANDLER_BIT(_name) void m6805_base_device::_name(uint8_t bit) OP_HANDLER( illegal ) { logerror("M6805: illegal opcode\n"); } -/* $00/$02/$04/$06/$08/$0A/$0C/$0E BRSET direct,relative ---- */ +// $00/$02/$04/$06/$08/$0A/$0C/$0E BRSET direct,relative ---* OP_HANDLER_BIT( brset ) { - uint8_t t,r; + u8 t, r; DIRBYTE(r); - IMMBYTE(t); - + immbyte(t); CLC; - - if (r&bit) { - SEC; - PC+=SIGNED(t); - } + if (BIT(r, B)) { SEC; PC += SIGNED(t); } } -/* $01/$03/$05/$07/$09/$0B/$0D/$0F BRCLR direct,relative ---- */ +// $01/$03/$05/$07/$09/$0B/$0D/$0F BRCLR direct,relative ---* OP_HANDLER_BIT( brclr ) { - uint8_t t,r; + u8 t, r; DIRBYTE(r); - IMMBYTE(t); - + immbyte(t); SEC; - - if (!(r&bit)) { - CLC; - PC+=SIGNED(t); - } + if (!BIT(r, B)) { CLC; PC += SIGNED(t); } } -/* $10/$12/$14/$16/$18/$1A/$1C/$1E BSET direct ---- */ +// $10/$12/$14/$16/$18/$1A/$1C/$1E BSET direct ---- OP_HANDLER_BIT( bset ) { - uint8_t t,r; - DIRBYTE(t); r=t|bit; - WM(EAD,r); -} - -/* $11/$13/$15/$17/$19/$1B/$1D/$1F BCLR direct ---- */ -OP_HANDLER_BIT( bclr) -{ - uint8_t t,r; - DIRBYTE(t); r=t&(~bit); - WM(EAD,r); -} - -/* $20 BRA relative ---- */ -OP_HANDLER( bra ) -{ - uint8_t t; - IMMBYTE(t); - PC+=SIGNED(t); -} - -/* $21 BRN relative ---- */ -OP_HANDLER( brn ) -{ - SKIPBYTE(); -} - -/* $22 BHI relative ---- */ -OP_HANDLER( bhi ) -{ - BRANCH( !(CC&(CFLAG|ZFLAG)) ); -} - -/* $23 BLS relative ---- */ -OP_HANDLER( bls ) -{ - BRANCH( CC&(CFLAG|ZFLAG) ); -} - -/* $24 BCC relative ---- */ -OP_HANDLER( bcc ) -{ - BRANCH( !(CC&CFLAG) ); -} - -/* $25 BCS relative ---- */ -OP_HANDLER( bcs ) -{ - BRANCH( CC&CFLAG ); + u8 t; + DIRBYTE(t); + wm(EAD, t | (u8(1) << B)); } -/* $26 BNE relative ---- */ -OP_HANDLER( bne ) +// $11/$13/$15/$17/$19/$1B/$1D/$1F BCLR direct ---- +OP_HANDLER_BIT( bclr ) { - BRANCH( !(CC&ZFLAG) ); + u8 t; + DIRBYTE(t); + wm(EAD, t & ~(u8(1) << B)); } -/* $27 BEQ relative ---- */ -OP_HANDLER( beq ) -{ - BRANCH( CC&ZFLAG ); -} +// $20 BRA relative ---- +// $21 BRN relative ---- +OP_HANDLER_BRA( bra ) { BRANCH( true ); } -/* $28 BHCC relative ---- */ -OP_HANDLER( bhcc ) -{ - BRANCH( !(CC&HFLAG) ); -} +// $22 BHI relative ---- +// $23 BLS relative ---- +OP_HANDLER_BRA( bhi ) { BRANCH( !(CC & (CFLAG | ZFLAG)) ); } -/* $29 BHCS relative ---- */ -OP_HANDLER( bhcs ) -{ - BRANCH( CC&HFLAG ); -} +// $24 BCC relative ---- +// $25 BCS relative ---- +OP_HANDLER_BRA( bcc ) { BRANCH( !(CC & CFLAG) ); } -/* $2a BPL relative ---- */ -OP_HANDLER( bpl ) -{ - BRANCH( !(CC&NFLAG) ); -} +// $26 BNE relative ---- +// $27 BEQ relative ---- +OP_HANDLER_BRA( bne ) { BRANCH( !(CC & ZFLAG) ); } -/* $2b BMI relative ---- */ -OP_HANDLER( bmi ) -{ - BRANCH( CC&NFLAG ); -} +// $28 BHCC relative ---- +// $29 BHCS relative ---- +OP_HANDLER_BRA( bhcc ) { BRANCH( !(CC & HFLAG) ); } -/* $2c BMC relative ---- */ -OP_HANDLER( bmc ) -{ - BRANCH( !(CC&IFLAG) ); -} +// $2a BPL relative ---- +// $2b BMI relative ---- +OP_HANDLER_BRA( bpl ) { BRANCH( !(CC & NFLAG) ); } -/* $2d BMS relative ---- */ -OP_HANDLER( bms ) -{ - BRANCH( CC&IFLAG ); -} +// $2c BMC relative ---- +// $2d BMS relative ---- +OP_HANDLER_BRA( bmc ) { BRANCH( !(CC & IFLAG) ); } -/* $2e BIL relative ---- */ +// $2e BIL relative ---- OP_HANDLER( bil ) { - BRANCH(m_irq_state[M6805_IRQ_LINE] != CLEAR_LINE); + bool const C = true; + BRANCH( m_irq_state[M6805_IRQ_LINE] != CLEAR_LINE ); } DERIVED_OP_HANDLER( hd63705, bil ) { - BRANCH(m_nmi_state != CLEAR_LINE); + bool const C = true; + BRANCH( m_nmi_state != CLEAR_LINE ); } -/* $2f BIH relative ---- */ +// $2f BIH relative ---- OP_HANDLER( bih ) { - BRANCH(m_irq_state[M6805_IRQ_LINE] == CLEAR_LINE); + bool const C = false; + BRANCH( m_irq_state[M6805_IRQ_LINE] != CLEAR_LINE ); } DERIVED_OP_HANDLER( hd63705, bih ) { - BRANCH(m_nmi_state == CLEAR_LINE); + bool const C = false; + BRANCH( m_nmi_state != CLEAR_LINE ); } -/* $30 NEG direct -*** */ -OP_HANDLER( neg_di ) +// $30 NEG direct -*** +// $60 NEG indexed, 1 byte offset -*** +// $70 NEG indexed -*** +OP_HANDLER_MODE( neg ) { - uint8_t t; - uint16_t r; - DIRBYTE(t); - r=-t; - CLR_NZC; - SET_FLAGS8(0,t,r); - WM(EAD,r); + u8 t; + ARGBYTE(t); + u16 const r = -t; + clr_nzc(); + set_nzc8(r); + wm(EAD, r); } -/* $31 ILLEGAL */ +// $31 ILLEGAL +// $61 ILLEGAL +// $71 ILLEGAL -/* $32 ILLEGAL */ +// $32 ILLEGAL +// $62 ILLEGAL +// $72 ILLEGAL -/* $33 COM direct -**1 */ -OP_HANDLER( com_di ) +// $33 COM direct -**1 +// $63 COM indexed, 1 byte offset -**1 +// $73 COM indexed -**1 +OP_HANDLER_MODE( com ) { - uint8_t t; - DIRBYTE(t); + u8 t; + ARGBYTE(t); t = ~t; - CLR_NZ; - SET_NZ8(t); + clr_nz(); + set_nz8(t); SEC; - WM(EAD,t); + wm(EAD, t); } -/* $34 LSR direct -0** */ -OP_HANDLER( lsr_di ) +// $34 LSR direct -0** +// $64 LSR indexed, 1 byte offset -0** +// $74 LSR indexed -0** +OP_HANDLER_MODE( lsr ) { - uint8_t t; - DIRBYTE(t); - CLR_NZC; - CC |= (t&0x01); + u8 t; + ARGBYTE(t); + clr_nzc(); + CC |= BIT(t, 0); t >>= 1; - SET_Z8(t); - WM(EAD,t); + set_z8(t); + wm(EAD, t); } -/* $35 ILLEGAL */ +// $35 ILLEGAL +// $65 ILLEGAL +// $75 ILLEGAL -/* $36 ROR direct -*** */ -OP_HANDLER( ror_di ) +// $36 ROR direct -*** +// $66 ROR indexed, 1 byte offset -*** +// $76 ROR indexed -*** +OP_HANDLER_MODE( ror ) { - uint8_t t,r; - DIRBYTE(t); - r = (CC & 0x01) << 7; - CLR_NZC; - CC |= (t & 0x01); - r |= t>>1; - SET_NZ8(r); - WM(EAD,r); + u8 t; + ARGBYTE(t); + u8 r = BIT(CC, 0) << 7; + clr_nzc(); + CC |= BIT(t, 0); + r |= t >> 1; + set_nz8(r); + wm(EAD, r); } -/* $37 ASR direct ?*** */ -OP_HANDLER( asr_di ) +// $37 ASR direct -*** +// $67 ASR indexed, 1 byte offset -*** +// $77 ASR indexed -*** +OP_HANDLER_MODE( asr ) { - uint8_t t; - DIRBYTE(t); - CLR_NZC; CC|=(t&0x01); - t>>=1; t|=((t&0x40)<<1); - SET_NZ8(t); - WM(EAD,t); + u8 t; + ARGBYTE(t); + clr_nzc(); + CC |= BIT(t, 0); + t = (t >> 1) | (t & 0x80); + set_nz8(t); + wm(EAD, t); } -/* $38 LSL direct ?*** */ -OP_HANDLER( lsl_di ) +// $38 LSL direct -*** +// $68 LSL indexed, 1 byte offset -*** +// $78 LSL indexed -*** +OP_HANDLER_MODE( lsl ) { - uint8_t t; - uint16_t r; - DIRBYTE(t); - r = t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); - WM(EAD,r); + u8 t; + ARGBYTE(t); + u16 const r = u16(t) << 1; + clr_nzc(); + set_nzc8(r); + wm(EAD, r); } -/* $39 ROL direct -*** */ -OP_HANDLER( rol_di ) +// $39 ROL direct -*** +// $69 ROL indexed, 1 byte offset -*** +// $79 ROL indexed -*** +OP_HANDLER_MODE( rol ) { - uint16_t t,r; - DIRBYTE(t); - r = CC & 0x01; - r |= t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); - WM(EAD,r); + u16 t; + ARGBYTE(t); + u16 const r = BIT(CC, 0) | (t << 1); + clr_nzc(); + set_nzc8(r); + wm(EAD, r); } -/* $3a DEC direct -**- */ -OP_HANDLER( dec_di ) +// $3a DEC direct -**- +// $6a DEC indexed, 1 byte offset -**- +OP_HANDLER_MODE( dec ) { - uint8_t t; - DIRBYTE(t); + u8 t; + ARGBYTE(t); --t; - CLR_NZ; SET_FLAGS8D(t); - WM(EAD,t); + clr_nz(); + set_nz8(t); + wm(EAD, t); } -/* $3b ILLEGAL */ +// $3b ILLEGAL +// $6b ILLEGAL +// $7b ILLEGAL -/* $3c INC direct -**- */ -OP_HANDLER( inc_di ) +// $3c INC direct -**- +// $6c INC indexed, 1 byte offset -**- +// $7c INC indexed -**- +OP_HANDLER_MODE( inc ) { - uint8_t t; - DIRBYTE(t); + u8 t; + ARGBYTE(t); ++t; - CLR_NZ; SET_FLAGS8I(t); - WM(EAD,t); + clr_nz(); + set_nz8(t); + wm(EAD, t); } -/* $3d TST direct -**- */ -OP_HANDLER( tst_di ) +// $3d TST direct -**- +// $6d TST indexed, 1 byte offset -**- +// $7d TST indexed -**- +OP_HANDLER_MODE( tst ) { - uint8_t t; - DIRBYTE(t); - CLR_NZ; SET_NZ8(t); + u8 t; + ARGBYTE(t); + clr_nz(); + set_nz8(t); } -/* $3e ILLEGAL */ +// $3e ILLEGAL +// $6e ILLEGAL +// $7e ILLEGAL -/* $3f CLR direct -0100 */ -OP_HANDLER( clr_di ) +// $3f CLR direct -01- +// $6f CLR indexed, 1 byte offset -01- +// $7f CLR indexed -01- +OP_HANDLER_MODE( clr ) { - DIRECT; - CLR_NZ; SEZ; - WM(EAD,0); + ARGADDR; + clr_nz(); + SEZ; + wm(EAD, 0); } -/* $40 NEGA inherent ?*** */ +// $40 NEGA inherent -*** OP_HANDLER( nega ) { - uint16_t r; - r = -A; - CLR_NZC; SET_FLAGS8(0,A,r); + u16 const r = -A; + clr_nzc(); + set_nzc8(r); A = r; } -/* $41 ILLEGAL */ +// $41 ILLEGAL -/* $42 ILLEGAL */ +// $42 MUL inherent 0--0 +OP_HANDLER( mul ) +{ + u16 const r = u16(A) * X; + clr_hc(); + X = u8(r >> 8); + A = u8(r); +} -/* $43 COMA inherent -**1 */ +// $43 COMA inherent -**1 OP_HANDLER( coma ) { A = ~A; - CLR_NZ; - SET_NZ8(A); + clr_nz(); + set_nz8(A); SEC; } -/* $44 LSRA inherent -0** */ +// $44 LSRA inherent -0** OP_HANDLER( lsra ) { - CLR_NZC; - CC |= (A & 0x01); + clr_nzc(); + CC |= BIT(A, 0); A >>= 1; - SET_Z8(A); + set_z8(A); } -/* $45 ILLEGAL */ +// $45 ILLEGAL -/* $46 RORA inherent -*** */ +// $46 RORA inherent -*** OP_HANDLER( rora ) { - uint8_t r; - r = (CC & 0x01) << 7; - CLR_NZC; - CC |= (A & 0x01); + u8 r = BIT(CC, 0) << 7; + clr_nzc(); + CC |= BIT(A, 0); r |= A >> 1; - SET_NZ8(r); + set_nz8(r); A = r; } -/* $47 ASRA inherent ?*** */ +// $47 ASRA inherent -*** OP_HANDLER( asra ) { - CLR_NZC; - CC |= (A & 0x01); + clr_nzc(); + CC |= BIT(A, 0); A = (A & 0x80) | (A >> 1); - SET_NZ8(A); + set_nz8(A); } -/* $48 LSLA inherent ?*** */ +// $48 LSLA inherent -*** OP_HANDLER( lsla ) { - uint16_t r; - r = A << 1; - CLR_NZC; - SET_FLAGS8(A,A,r); + u16 const r = u16(A) << 1; + clr_nzc(); + set_nzc8(r); A = r; } -/* $49 ROLA inherent -*** */ +// $49 ROLA inherent -*** OP_HANDLER( rola ) { - uint16_t t,r; - t = A; - r = CC & 0x01; - r |= t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); + u16 const t = A; + u16 const r = BIT(CC, 0) | (t << 1); + clr_nzc(); + set_nzc8(r); A = r; } -/* $4a DECA inherent -**- */ +// $4a DECA inherent -**- OP_HANDLER( deca ) { --A; - CLR_NZ; - SET_FLAGS8D(A); + clr_nz(); + set_nz8(A); } -/* $4b ILLEGAL */ +// $4b ILLEGAL -/* $4c INCA inherent -**- */ +// $4c INCA inherent -**- OP_HANDLER( inca ) { ++A; - CLR_NZ; - SET_FLAGS8I(A); + clr_nz(); + set_nz8(A); } -/* $4d TSTA inherent -**- */ +// $4d TSTA inherent -**- OP_HANDLER( tsta ) { - CLR_NZ; - SET_NZ8(A); + clr_nz(); + set_nz8(A); } -/* $4e ILLEGAL */ +// $4e ILLEGAL -/* $4f CLRA inherent -010 */ +// $4f CLRA inherent -01- OP_HANDLER( clra ) { A = 0; - CLR_NZ; + clr_nz(); SEZ; } -/* $50 NEGX inherent ?*** */ +// $50 NEGX inherent -*** OP_HANDLER( negx ) { - uint16_t r; - r = -X; - CLR_NZC; - SET_FLAGS8(0,X,r); + u16 const r = -X; + clr_nzc(); + set_nzc8(r); X = r; } -/* $51 ILLEGAL */ +// $51 ILLEGAL -/* $52 ILLEGAL */ +// $52 ILLEGAL -/* $53 COMX inherent -**1 */ +// $53 COMX inherent -**1 OP_HANDLER( comx ) { X = ~X; - CLR_NZ; - SET_NZ8(X); + clr_nz(); + set_nz8(X); SEC; } -/* $54 LSRX inherent -0** */ +// $54 LSRX inherent -0** OP_HANDLER( lsrx ) { - CLR_NZC; - CC |= (X & 0x01); + clr_nzc(); + CC |= BIT(X, 0); X >>= 1; - SET_Z8(X); + set_z8(X); } -/* $55 ILLEGAL */ +// $55 ILLEGAL -/* $56 RORX inherent -*** */ +// $56 RORX inherent -*** OP_HANDLER( rorx ) { - uint8_t r; - r = (CC & 0x01) << 7; - CLR_NZC; - CC |= (X & 0x01); - r |= X>>1; - SET_NZ8(r); + u8 r = BIT(CC, 0) << 7; + clr_nzc(); + CC |= BIT(X, 0); + r |= X >> 1; + set_nz8(r); X = r; } -/* $57 ASRX inherent ?*** */ +// $57 ASRX inherent -*** OP_HANDLER( asrx ) { - CLR_NZC; - CC |= (X & 0x01); + clr_nzc(); + CC |= BIT(X, 0); X = (X & 0x80) | (X >> 1); - SET_NZ8(X); + set_nz8(X); } -/* $58 ASLX inherent ?*** */ -OP_HANDLER( aslx ) +// $58 LSLX inherent -*** +OP_HANDLER( lslx ) { - uint16_t r; - r = X << 1; - CLR_NZC; - SET_FLAGS8(X,X,r); + u16 r = u16(X) << 1; + clr_nzc(); + set_nzc8(r); X = r; } -/* $59 ROLX inherent -*** */ +// $59 ROLX inherent -*** OP_HANDLER( rolx ) { - uint16_t t,r; - t = X; - r = CC & 0x01; - r |= t<<1; - CLR_NZC; - SET_FLAGS8(t,t,r); + u16 const t = X; + u16 const r = BIT(CC, 0) | (t << 1); + clr_nzc(); + set_nzc8(r); X = r; } -/* $5a DECX inherent -**- */ +// $5a DECX inherent -**- OP_HANDLER( decx ) { --X; - CLR_NZ; - SET_FLAGS8D(X); + clr_nz(); + set_nz8(X); } -/* $5b ILLEGAL */ +// $5b ILLEGAL -/* $5c INCX inherent -**- */ +// $5c INCX inherent -**- OP_HANDLER( incx ) { ++X; - CLR_NZ; - SET_FLAGS8I(X); + clr_nz(); + set_nz8(X); } -/* $5d TSTX inherent -**- */ +// $5d TSTX inherent -**- OP_HANDLER( tstx ) { - CLR_NZ; - SET_NZ8(X); + clr_nz(); + set_nz8(X); } -/* $5e ILLEGAL */ +// $5e ILLEGAL -/* $5f CLRX inherent -010 */ +// $5f CLRX inherent -01- OP_HANDLER( clrx ) { X = 0; - CLR_NZC; + clr_nzc(); SEZ; } -/* $60 NEG indexed, 1 byte offset -*** */ -OP_HANDLER( neg_ix1 ) -{ - uint8_t t; - uint16_t r; - IDX1BYTE(t); r=-t; - CLR_NZC; SET_FLAGS8(0,t,r); - WM(EAD,r); -} - -/* $61 ILLEGAL */ - -/* $62 ILLEGAL */ - -/* $63 COM indexed, 1 byte offset -**1 */ -OP_HANDLER( com_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); t = ~t; - CLR_NZ; SET_NZ8(t); SEC; - WM(EAD,t); -} - -/* $64 LSR indexed, 1 byte offset -0** */ -OP_HANDLER( lsr_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); - CLR_NZC; - CC |= (t & 0x01); - t >>= 1; - SET_Z8(t); - WM(EAD,t); -} - -/* $65 ILLEGAL */ - -/* $66 ROR indexed, 1 byte offset -*** */ -OP_HANDLER( ror_ix1 ) -{ - uint8_t t,r; - IDX1BYTE(t); - r = (CC & 0x01) << 7; - CLR_NZC; - CC |= (t & 0x01); - r |= t>>1; - SET_NZ8(r); - WM(EAD,r); -} - -/* $67 ASR indexed, 1 byte offset ?*** */ -OP_HANDLER( asr_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); - CLR_NZC; CC|=(t&0x01); - t>>=1; t|=((t&0x40)<<1); - SET_NZ8(t); - WM(EAD,t); -} - -/* $68 LSL indexed, 1 byte offset ?*** */ -OP_HANDLER( lsl_ix1 ) -{ - uint8_t t; - uint16_t r; - IDX1BYTE(t); - r = t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); - WM(EAD,r); -} - -/* $69 ROL indexed, 1 byte offset -*** */ -OP_HANDLER( rol_ix1 ) -{ - uint16_t t,r; - IDX1BYTE(t); - r = CC & 0x01; - r |= t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); - WM(EAD,r); -} - -/* $6a DEC indexed, 1 byte offset -**- */ -OP_HANDLER( dec_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); - --t; - CLR_NZ; SET_FLAGS8D(t); - WM(EAD,t); -} - -/* $6b ILLEGAL */ - -/* $6c INC indexed, 1 byte offset -**- */ -OP_HANDLER( inc_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); - ++t; - CLR_NZ; SET_FLAGS8I(t); - WM(EAD,t); -} - -/* $6d TST indexed, 1 byte offset -**- */ -OP_HANDLER( tst_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); - CLR_NZ; SET_NZ8(t); -} - -/* $6e ILLEGAL */ - -/* $6f CLR indexed, 1 byte offset -0100 */ -OP_HANDLER( clr_ix1 ) -{ - INDEXED1; - CLR_NZC; SEZ; - WM(EAD,0); -} - -/* $70 NEG indexed -*** */ -OP_HANDLER( neg_ix ) -{ - uint8_t t; - uint16_t r; - IDXBYTE(t); r=-t; - CLR_NZC; SET_FLAGS8(0,t,r); - WM(EAD,r); -} - -/* $71 ILLEGAL */ - -/* $72 ILLEGAL */ - -/* $73 COM indexed -**1 */ -OP_HANDLER( com_ix ) -{ - uint8_t t; - IDXBYTE(t); t = ~t; - CLR_NZ; SET_NZ8(t); SEC; - WM(EAD,t); -} - -/* $74 LSR indexed -0** */ -OP_HANDLER( lsr_ix ) -{ - uint8_t t; - IDXBYTE(t); - CLR_NZC; - CC |= (t & 0x01); - t >>= 1; - SET_Z8(t); - WM(EAD,t); -} - -/* $75 ILLEGAL */ - -/* $76 ROR indexed -*** */ -OP_HANDLER( ror_ix ) -{ - uint8_t t,r; - IDXBYTE(t); - r = (CC & 0x01) << 7; - CLR_NZC; - CC |= (t & 0x01); - r |= t >> 1; - SET_NZ8(r); - WM(EAD,r); -} - -/* $77 ASR indexed ?*** */ -OP_HANDLER( asr_ix ) -{ - uint8_t t; - IDXBYTE(t); - CLR_NZC; - CC |= (t & 0x01); - t = (t & 0x80) | (t >> 1); - SET_NZ8(t); - WM(EAD,t); -} - -/* $78 LSL indexed ?*** */ -OP_HANDLER( lsl_ix ) -{ - uint8_t t; - uint16_t r; - IDXBYTE(t); r=t<<1; - CLR_NZC; SET_FLAGS8(t,t,r); - WM(EAD,r); -} - -/* $79 ROL indexed -*** */ -OP_HANDLER( rol_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = CC & 0x01; - r |= t << 1; - CLR_NZC; - SET_FLAGS8(t,t,r); - WM(EAD,r); -} - -/* $7a DEC indexed -**- */ -OP_HANDLER( dec_ix ) -{ - uint8_t t; - IDXBYTE(t); - --t; - CLR_NZ; SET_FLAGS8D(t); - WM(EAD,t); -} - -/* $7b ILLEGAL */ - -/* $7c INC indexed -**- */ -OP_HANDLER( inc_ix ) -{ - uint8_t t; - IDXBYTE(t); - ++t; - CLR_NZ; SET_FLAGS8I(t); - WM(EAD,t); -} - -/* $7d TST indexed -**- */ -OP_HANDLER( tst_ix ) -{ - uint8_t t; - IDXBYTE(t); - CLR_NZ; SET_NZ8(t); -} - -/* $7e ILLEGAL */ - -/* $7f CLR indexed -0100 */ -OP_HANDLER( clr_ix ) -{ - INDEXED; - CLR_NZC; SEZ; - WM(EAD,0); -} - -/* $80 RTI inherent #### */ +// $80 RTI inherent #### OP_HANDLER( rti ) { - PULLBYTE(CC); - PULLBYTE(A); - PULLBYTE(X); - PULLWORD(m_pc); -#if IRQ_LEVEL_DETECT - if( m_irq_state != CLEAR_LINE && (CC & IFLAG) == 0 ) - { - m_pending_interrupts |= M6805_INT_IRQ; - } -#endif + pullbyte(CC); + pullbyte(A); + pullbyte(X); + pullword(m_pc); } -/* $81 RTS inherent ---- */ +// $81 RTS inherent ---- OP_HANDLER( rts ) { - PULLWORD(m_pc); + pullword(m_pc); } -/* $82 ILLEGAL */ +// $82 ILLEGAL -/* $83 SWI absolute indirect ---- */ +// $83 SWI absolute indirect ---- OP_HANDLER( swi ) { - PUSHWORD(m_pc); - PUSHBYTE(m_x); - PUSHBYTE(m_a); - PUSHBYTE(m_cc); + pushword(m_pc); + pushbyte(m_x); + pushbyte(m_a); + pushbyte(m_cc); SEI; - RM16(0xfffc, &m_pc); + rm16(m_params.m_swi_vector, m_pc); } -DERIVED_OP_HANDLER( hd63705, swi ) -{ - PUSHWORD(m_pc); - PUSHBYTE(m_x); - PUSHBYTE(m_a); - PUSHBYTE(m_cc); - SEI; - RM16(0x1ffa, &m_pc); -} -/* $84 ILLEGAL */ - -/* $85 ILLEGAL */ - -/* $86 ILLEGAL */ +// $84 ILLEGAL -/* $87 ILLEGAL */ +// $85 ILLEGAL -/* $88 ILLEGAL */ +// $86 ILLEGAL -/* $89 ILLEGAL */ +// $87 ILLEGAL -/* $8A ILLEGAL */ - -/* $8B ILLEGAL */ - -/* $8C ILLEGAL */ - -/* $8D ILLEGAL */ - -/* $8E ILLEGAL */ - -/* $8F ILLEGAL */ - -/* $90 ILLEGAL */ - -/* $91 ILLEGAL */ - -/* $92 ILLEGAL */ - -/* $93 ILLEGAL */ - -/* $94 ILLEGAL */ - -/* $95 ILLEGAL */ - -/* $96 ILLEGAL */ - -/* $97 TAX inherent ---- */ -OP_HANDLER( tax ) -{ - X = A; -} - -/* $98 CLC */ - -/* $99 SEC */ - -/* $9A CLI */ - -/* $9B SEI */ - -/* $9C RSP inherent ---- */ -OP_HANDLER( rsp ) -{ - S = SP_MASK; -} - -/* $9D NOP inherent ---- */ -OP_HANDLER( nop ) -{ -} - -/* $9E ILLEGAL */ - -/* $9F TXA inherent ---- */ -OP_HANDLER( txa ) -{ - A = X; -} +// $88 ILLEGAL -/* $a0 SUBA immediate ?*** */ -OP_HANDLER( suba_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} +// $89 ILLEGAL -/* $a1 CMPA immediate ?*** */ -OP_HANDLER( cmpa_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} +// $8A ILLEGAL -/* $a2 SBCA immediate ?*** */ -OP_HANDLER( sbca_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} +// $8B ILLEGAL -/* $a3 CPX immediate -*** */ -OP_HANDLER( cpx_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); -} +// $8C ILLEGAL -/* $a4 ANDA immediate -**- */ -OP_HANDLER( anda_im ) -{ - uint8_t t; - IMMBYTE(t); - A &= t; - CLR_NZ; - SET_NZ8(A); -} +// $8D ILLEGAL -/* $a5 BITA immediate -**- */ -OP_HANDLER( bita_im ) +// $8E STOP inherent ---- +OP_HANDLER( stop ) { - uint8_t t,r; - IMMBYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); + fatalerror("m6805[%s]: unimplemented STOP", tag()); } -/* $a6 LDA immediate -**- */ -OP_HANDLER( lda_im ) +// $8F WAIT inherent ---- +OP_HANDLER( wait ) { - IMMBYTE(A); - CLR_NZ; - SET_NZ8(A); + fatalerror("m6805[%s]: unimplemented WAIT", tag()); } -/* $a7 ILLEGAL */ -/* $a8 EORA immediate -**- */ -OP_HANDLER( eora_im ) -{ - uint8_t t; - IMMBYTE(t); - A ^= t; - CLR_NZ; - SET_NZ8(A); -} +// $90 ILLEGAL -/* $a9 ADCA immediate **** */ -OP_HANDLER( adca_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} +// $91 ILLEGAL -/* $aa ORA immediate -**- */ -OP_HANDLER( ora_im ) -{ - uint8_t t; - IMMBYTE(t); - A |= t; - CLR_NZ; - SET_NZ8(A); -} +// $92 ILLEGAL -/* $ab ADDA immediate **** */ -OP_HANDLER( adda_im ) -{ - uint16_t t,r; - IMMBYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} +// $93 ILLEGAL -/* $ac ILLEGAL */ +// $94 ILLEGAL -/* $ad BSR ---- */ -OP_HANDLER( bsr ) -{ - uint8_t t; - IMMBYTE(t); - PUSHWORD(m_pc); - PC += SIGNED(t); -} +// $95 ILLEGAL -/* $ae LDX immediate -**- */ -OP_HANDLER( ldx_im ) -{ - IMMBYTE(X); - CLR_NZ; - SET_NZ8(X); -} +// $96 ILLEGAL -/* $af ILLEGAL */ +// $97 TAX inherent ---- +OP_HANDLER( tax ) { X = A; } -/* $b0 SUBA direct ?*** */ -OP_HANDLER( suba_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} +// $98 CLC +OP_HANDLER( clc ) { CLC; } -/* $b1 CMPA direct ?*** */ -OP_HANDLER( cmpa_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} +// $99 SEC +OP_HANDLER( sec ) { SEC; } -/* $b2 SBCA direct ?*** */ -OP_HANDLER( sbca_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} +// $9A CLI +OP_HANDLER( cli ) { CLI; } -/* $b3 CPX direct -*** */ -OP_HANDLER( cpx_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); -} +// $9B SEI +OP_HANDLER( sei ) { SEI; } // TODO: check behaviour if edge-triggered interrupt was pending when this happens -/* $b4 ANDA direct -**- */ -OP_HANDLER( anda_di ) -{ - uint8_t t; - DIRBYTE(t); - A &= t; - CLR_NZ; - SET_NZ8(A); -} +// $9C RSP inherent ---- +OP_HANDLER( rsp ) { S = SP_MASK; } -/* $b5 BITA direct -**- */ -OP_HANDLER( bita_di ) -{ - uint8_t t,r; - DIRBYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); -} +// $9D NOP inherent ---- +OP_HANDLER( nop ) { } -/* $b6 LDA direct -**- */ -OP_HANDLER( lda_di ) -{ - DIRBYTE(A); - CLR_NZ; - SET_NZ8(A); -} +// $9E ILLEGAL -/* $b7 STA direct -**- */ -OP_HANDLER( sta_di ) -{ - CLR_NZ; - SET_NZ8(A); - DIRECT; - WM(EAD,A); -} - -/* $b8 EORA direct -**- */ -OP_HANDLER( eora_di ) -{ - uint8_t t; - DIRBYTE(t); - A ^= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $b9 ADCA direct **** */ -OP_HANDLER( adca_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $ba ORA direct -**- */ -OP_HANDLER( ora_di ) -{ - uint8_t t; - DIRBYTE(t); - A |= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $bb ADDA direct **** */ -OP_HANDLER( adda_di ) -{ - uint16_t t,r; - DIRBYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $bc JMP direct -*** */ -OP_HANDLER( jmp_di ) -{ - DIRECT; - PC = EA; -} - -/* $bd JSR direct ---- */ -OP_HANDLER( jsr_di ) -{ - DIRECT; - PUSHWORD(m_pc); - PC = EA; -} - -/* $be LDX direct -**- */ -OP_HANDLER( ldx_di ) -{ - DIRBYTE(X); - CLR_NZ; - SET_NZ8(X); -} - -/* $bf STX direct -**- */ -OP_HANDLER( stx_di ) -{ - CLR_NZ; - SET_NZ8(X); - DIRECT; - WM(EAD,X); -} - -/* $c0 SUBA extended ?*** */ -OP_HANDLER( suba_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $c1 CMPA extended ?*** */ -OP_HANDLER( cmpa_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} - -/* $c2 SBCA extended ?*** */ -OP_HANDLER( sbca_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $c3 CPX extended -*** */ -OP_HANDLER( cpx_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); -} - -/* $c4 ANDA extended -**- */ -OP_HANDLER( anda_ex ) -{ - uint8_t t; - EXTBYTE(t); - A &= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $c5 BITA extended -**- */ -OP_HANDLER( bita_ex ) -{ - uint8_t t,r; - EXTBYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); -} - -/* $c6 LDA extended -**- */ -OP_HANDLER( lda_ex ) -{ - EXTBYTE(A); - CLR_NZ; - SET_NZ8(A); -} - -/* $c7 STA extended -**- */ -OP_HANDLER( sta_ex ) -{ - CLR_NZ; - SET_NZ8(A); - EXTENDED; - WM(EAD,A); -} - -/* $c8 EORA extended -**- */ -OP_HANDLER( eora_ex ) -{ - uint8_t t; - EXTBYTE(t); - A ^= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $c9 ADCA extended **** */ -OP_HANDLER( adca_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $ca ORA extended -**- */ -OP_HANDLER( ora_ex ) -{ - uint8_t t; - EXTBYTE(t); - A |= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $cb ADDA extended **** */ -OP_HANDLER( adda_ex ) -{ - uint16_t t,r; - EXTBYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $cc JMP extended -*** */ -OP_HANDLER( jmp_ex ) -{ - EXTENDED; - PC = EA; -} - -/* $cd JSR extended ---- */ -OP_HANDLER( jsr_ex ) -{ - EXTENDED; - PUSHWORD(m_pc); - PC = EA; -} - -/* $ce LDX extended -**- */ -OP_HANDLER( ldx_ex ) -{ - EXTBYTE(X); - CLR_NZ; - SET_NZ8(X); -} - -/* $cf STX extended -**- */ -OP_HANDLER( stx_ex ) -{ - CLR_NZ; - SET_NZ8(X); - EXTENDED; - WM(EAD,X); -} - -/* $d0 SUBA indexed, 2 byte offset ?*** */ -OP_HANDLER( suba_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $d1 CMPA indexed, 2 byte offset ?*** */ -OP_HANDLER( cmpa_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} - -/* $d2 SBCA indexed, 2 byte offset ?*** */ -OP_HANDLER( sbca_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $d3 CPX indexed, 2 byte offset -*** */ -OP_HANDLER( cpx_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); -} - -/* $d4 ANDA indexed, 2 byte offset -**- */ -OP_HANDLER( anda_ix2 ) -{ - uint8_t t; - IDX2BYTE(t); - A &= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $d5 BITA indexed, 2 byte offset -**- */ -OP_HANDLER( bita_ix2 ) -{ - uint8_t t,r; - IDX2BYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); -} - -/* $d6 LDA indexed, 2 byte offset -**- */ -OP_HANDLER( lda_ix2 ) -{ - IDX2BYTE(A); - CLR_NZ; - SET_NZ8(A); -} - -/* $d7 STA indexed, 2 byte offset -**- */ -OP_HANDLER( sta_ix2 ) -{ - CLR_NZ; - SET_NZ8(A); - INDEXED2; - WM(EAD,A); -} - -/* $d8 EORA indexed, 2 byte offset -**- */ -OP_HANDLER( eora_ix2 ) -{ - uint8_t t; - IDX2BYTE(t); - A ^= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $d9 ADCA indexed, 2 byte offset **** */ -OP_HANDLER( adca_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $da ORA indexed, 2 byte offset -**- */ -OP_HANDLER( ora_ix2 ) -{ - uint8_t t; - IDX2BYTE(t); - A |= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $db ADDA indexed, 2 byte offset **** */ -OP_HANDLER( adda_ix2 ) -{ - uint16_t t,r; - IDX2BYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $dc JMP indexed, 2 byte offset -*** */ -OP_HANDLER( jmp_ix2 ) -{ - INDEXED2; - PC = EA; -} - -/* $dd JSR indexed, 2 byte offset ---- */ -OP_HANDLER( jsr_ix2 ) -{ - INDEXED2; - PUSHWORD(m_pc); - PC = EA; -} - -/* $de LDX indexed, 2 byte offset -**- */ -OP_HANDLER( ldx_ix2 ) -{ - IDX2BYTE(X); - CLR_NZ; - SET_NZ8(X); -} - -/* $df STX indexed, 2 byte offset -**- */ -OP_HANDLER( stx_ix2 ) +// $9F TXA inherent ---- +OP_HANDLER( txa ) { - CLR_NZ; - SET_NZ8(X); - INDEXED2; - WM(EAD,X); + A = X; } -/* $e0 SUBA indexed, 1 byte offset ?*** */ -OP_HANDLER( suba_ix1 ) +// $a0 SUBA immediate -*** +// $b0 SUBA direct -*** +// $c0 SUBA extended -*** +// $d0 SUBA indexed, 2 byte offset -*** +// $e0 SUBA indexed, 1 byte offset -*** +// $f0 SUBA indexed -*** +OP_HANDLER_MODE( suba ) { - uint16_t t,r; - IDX1BYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); + u16 t; + ARGBYTE(t); + u16 const r = A - t; + clr_nzc(); + set_nzc8(r); A = r; } -/* $e1 CMPA indexed, 1 byte offset ?*** */ -OP_HANDLER( cmpa_ix1 ) -{ - uint16_t t,r; - IDX1BYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} - -/* $e2 SBCA indexed, 1 byte offset ?*** */ -OP_HANDLER( sbca_ix1 ) -{ - uint16_t t,r; - IDX1BYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); +// $a1 CMPA immediate -*** +// $b1 CMPA direct -*** +// $c1 CMPA extended -*** +// $d1 CMPA indexed, 2 byte offset -*** +// $e1 CMPA indexed, 1 byte offset -*** +// $f1 CMPA indexed -*** +OP_HANDLER_MODE( cmpa ) +{ + u16 t; + ARGBYTE(t); + u16 const r = A - t; + clr_nzc(); + set_nzc8(r); +} + +// $a2 SBCA immediate -*** +// $b2 SBCA direct -*** +// $c2 SBCA extended -*** +// $d2 SBCA indexed, 2 byte offset -*** +// $e2 SBCA indexed, 1 byte offset -*** +// $f2 SBCA indexed -*** +OP_HANDLER_MODE( sbca ) +{ + u16 t; + ARGBYTE(t); + u16 const r = A - t - BIT(CC, 0); + clr_nzc(); + set_nzc8(r); A = r; } -/* $e3 CPX indexed, 1 byte offset -*** */ -OP_HANDLER( cpx_ix1 ) +// $a3 CPX immediate -*** +// $b3 CPX direct -*** +// $c3 CPX extended -*** +// $d3 CPX indexed, 2 byte offset -*** +// $e3 CPX indexed, 1 byte offset -*** +// $f3 CPX indexed -*** +OP_HANDLER_MODE( cpx ) { - uint16_t t,r; - IDX1BYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); + u16 t; + ARGBYTE(t); + u16 const r = X - t; + clr_nzc(); + set_nzc8(r); } -/* $e4 ANDA indexed, 1 byte offset -**- */ -OP_HANDLER( anda_ix1 ) +// $a4 ANDA immediate -**- +// $b4 ANDA direct -**- +// $c4 ANDA extended -**- +// $d4 ANDA indexed, 2 byte offset -**- +// $e4 ANDA indexed, 1 byte offset -**- +// $f4 ANDA indexed -**- +OP_HANDLER_MODE( anda ) { - uint8_t t; - IDX1BYTE(t); + u8 t; + ARGBYTE(t); A &= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $e5 BITA indexed, 1 byte offset -**- */ -OP_HANDLER( bita_ix1 ) -{ - uint8_t t,r; - IDX1BYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); -} - -/* $e6 LDA indexed, 1 byte offset -**- */ -OP_HANDLER( lda_ix1 ) -{ - IDX1BYTE(A); - CLR_NZ; - SET_NZ8(A); -} - -/* $e7 STA indexed, 1 byte offset -**- */ -OP_HANDLER( sta_ix1 ) -{ - CLR_NZ; - SET_NZ8(A); - INDEXED1; - WM(EAD,A); -} - -/* $e8 EORA indexed, 1 byte offset -**- */ -OP_HANDLER( eora_ix1 ) -{ - uint8_t t; - IDX1BYTE(t); + clr_nz(); + set_nz8(A); +} + +// $a5 BITA immediate -**- +// $b5 BITA direct -**- +// $c5 BITA extended -**- +// $d5 BITA indexed, 2 byte offset -**- +// $e5 BITA indexed, 1 byte offset -**- +// $f5 BITA indexed -**- +OP_HANDLER_MODE( bita ) +{ + u8 t; + ARGBYTE(t); + u8 const r = A & t; + clr_nz(); + set_nz8(r); +} + +// $a6 LDA immediate -**- +// $b6 LDA direct -**- +// $c6 LDA extended -**- +// $d6 LDA indexed, 2 byte offset -**- +// $e6 LDA indexed, 1 byte offset -**- +// $f6 LDA indexed -**- +OP_HANDLER_MODE( lda ) +{ + ARGBYTE(A); + clr_nz(); + set_nz8(A); +} + +// $a7 ILLEGAL +// $b7 STA direct -**- +// $c7 STA extended -**- +// $d7 STA indexed, 2 byte offset -**- +// $e7 STA indexed, 1 byte offset -**- +// $f7 STA indexed -**- +OP_HANDLER_MODE( sta ) +{ + clr_nz(); + set_nz8(A); + ARGADDR; + wm(EAD, A); +} + +// $a8 EORA immediate -**- +// $b8 EORA direct -**- +// $c8 EORA extended -**- +// $d8 EORA indexed, 2 byte offset -**- +// $e8 EORA indexed, 1 byte offset -**- +// $f8 EORA indexed -**- +OP_HANDLER_MODE( eora ) +{ + u8 t; + ARGBYTE(t); A ^= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $e9 ADCA indexed, 1 byte offset **** */ -OP_HANDLER( adca_ix1 ) -{ - uint16_t t,r; - IDX1BYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); + clr_nz(); + set_nz8(A); +} + +// $a9 ADCA immediate **** +// $b9 ADCA direct **** +// $c9 ADCA extended **** +// $d9 ADCA indexed, 2 byte offset **** +// $e9 ADCA indexed, 1 byte offset **** +// $f9 ADCA indexed **** +OP_HANDLER_MODE( adca ) +{ + u16 t; + ARGBYTE(t); + u16 const r = A + t + BIT(CC, 0); + clr_hnzc(); + set_hnzc8(A, t, r); A = r; } -/* $ea ORA indexed, 1 byte offset -**- */ -OP_HANDLER( ora_ix1 ) +// $aa ORA immediate -**- +// $ba ORA direct -**- +// $ca ORA extended -**- +// $da ORA indexed, 2 byte offset -**- +// $ea ORA indexed, 1 byte offset -**- +// $fa ORA indexed -**- +OP_HANDLER_MODE( ora ) { - uint8_t t; - IDX1BYTE(t); + u8 t; + ARGBYTE(t); A |= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $eb ADDA indexed, 1 byte offset **** */ -OP_HANDLER( adda_ix1 ) -{ - uint16_t t,r; - IDX1BYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); + clr_nz(); + set_nz8(A); +} + +// $ab ADDA immediate **** +// $bb ADDA direct **** +// $cb ADDA extended **** +// $db ADDA indexed, 2 byte offset **** +// $eb ADDA indexed, 1 byte offset **** +// $fb ADDA indexed **** +OP_HANDLER_MODE( adda ) +{ + u16 t; + ARGBYTE(t); + u16 const r = A + t; + clr_hnzc(); + set_hnzc8(A, t, r); A = r; } -/* $ec JMP indexed, 1 byte offset -*** */ -OP_HANDLER( jmp_ix1 ) -{ - INDEXED1; - PC = EA; -} - -/* $ed JSR indexed, 1 byte offset ---- */ -OP_HANDLER( jsr_ix1 ) +// $ac ILLEGAL +// $bc JMP direct -*** +// $cc JMP extended -*** +// $dc JMP indexed, 2 byte offset -*** +// $ec JMP indexed, 1 byte offset -*** +// $fc JMP indexed -*** +OP_HANDLER_MODE( jmp ) { - INDEXED1; - PUSHWORD(m_pc); + ARGADDR; PC = EA; } -/* $ee LDX indexed, 1 byte offset -**- */ -OP_HANDLER( ldx_ix1 ) -{ - IDX1BYTE(X); - CLR_NZ; - SET_NZ8(X); -} - -/* $ef STX indexed, 1 byte offset -**- */ -OP_HANDLER( stx_ix1 ) -{ - CLR_NZ; - SET_NZ8(X); - INDEXED1; - WM(EAD,X); -} - -/* $f0 SUBA indexed ?*** */ -OP_HANDLER( suba_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $f1 CMPA indexed ?*** */ -OP_HANDLER( cmpa_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = A - t; - CLR_NZC; - SET_FLAGS8(A,t,r); -} - -/* $f2 SBCA indexed ?*** */ -OP_HANDLER( sbca_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = A - t - (CC & 0x01); - CLR_NZC; - SET_FLAGS8(A,t,r); - A = r; -} - -/* $f3 CPX indexed -*** */ -OP_HANDLER( cpx_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = X - t; - CLR_NZC; - SET_FLAGS8(X,t,r); -} - -/* $f4 ANDA indexed -**- */ -OP_HANDLER( anda_ix ) -{ - uint8_t t; - IDXBYTE(t); - A &= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $f5 BITA indexed -**- */ -OP_HANDLER( bita_ix ) -{ - uint8_t t,r; - IDXBYTE(t); - r = A & t; - CLR_NZ; - SET_NZ8(r); -} - -/* $f6 LDA indexed -**- */ -OP_HANDLER( lda_ix ) -{ - IDXBYTE(A); - CLR_NZ; - SET_NZ8(A); -} - -/* $f7 STA indexed -**- */ -OP_HANDLER( sta_ix ) -{ - CLR_NZ; - SET_NZ8(A); - INDEXED; - WM(EAD,A); -} - -/* $f8 EORA indexed -**- */ -OP_HANDLER( eora_ix ) -{ - uint8_t t; - IDXBYTE(t); - A ^= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $f9 ADCA indexed **** */ -OP_HANDLER( adca_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = A + t + (CC & 0x01); - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $fa ORA indexed -**- */ -OP_HANDLER( ora_ix ) -{ - uint8_t t; - IDXBYTE(t); - A |= t; - CLR_NZ; - SET_NZ8(A); -} - -/* $fb ADDA indexed **** */ -OP_HANDLER( adda_ix ) -{ - uint16_t t,r; - IDXBYTE(t); - r = A + t; - CLR_HNZC; - SET_FLAGS8(A,t,r); - SET_H(A,t,r); - A = r; -} - -/* $fc JMP indexed -*** */ -OP_HANDLER( jmp_ix ) +// $ad BSR ---- +OP_HANDLER( bsr ) { - INDEXED; - PC = EA; + u8 t; + immbyte(t); + pushword(m_pc); + PC += SIGNED(t); } -/* $fd JSR indexed ---- */ -OP_HANDLER( jsr_ix ) +// $bd JSR direct ---- +// $cd JSR extended ---- +// $dd JSR indexed, 2 byte offset ---- +// $ed JSR indexed, 1 byte offset ---- +// $fd JSR indexed ---- +OP_HANDLER_MODE( jsr ) { - INDEXED; - PUSHWORD(m_pc); + ARGADDR; + pushword(m_pc); PC = EA; } -/* $fe LDX indexed -**- */ -OP_HANDLER( ldx_ix ) +// $ae LDX immediate -**- +// $be LDX direct -**- +// $ce LDX extended -**- +// $de LDX indexed, 2 byte offset -**- +// $ee LDX indexed, 1 byte offset -**- +// $fe LDX indexed -**- +OP_HANDLER_MODE( ldx ) { - IDXBYTE(X); - CLR_NZ; - SET_NZ8(X); + ARGBYTE(X); + clr_nz(); + set_nz8(X); } -/* $ff STX indexed -**- */ -OP_HANDLER( stx_ix ) +// $af ILLEGAL +// $bf STX direct -**- +// $cf STX extended -**- +// $df STX indexed, 2 byte offset -**- +// $ef STX indexed, 1 byte offset -**- +// $ff STX indexed -**- +OP_HANDLER_MODE( stx ) { - CLR_NZ; - SET_NZ8(X); - INDEXED; - WM(EAD,X); + clr_nz(); + set_nz8(X); + ARGADDR; + wm(EAD, X); } diff --git a/src/devices/cpu/m6805/m6805.cpp b/src/devices/cpu/m6805/m6805.cpp index bc1844f5bbf..4cb9301151b 100644 --- a/src/devices/cpu/m6805/m6805.cpp +++ b/src/devices/cpu/m6805/m6805.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /*** m6805: Portable 6805 emulator ****************************************** m6805.c (Also supports hd68705 and hd63705 variants) @@ -40,56 +40,135 @@ #include <algorithm> -#define IRQ_LEVEL_DETECT 0 - -const uint8_t m6805_base_device::m_flags8i[256]= /* increment */ -{ - 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04 +#define OP(name) (&m6805_base_device::name) +#define OP_T(name) (&m6805_base_device::name<true>) +#define OP_F(name) (&m6805_base_device::name<false>) +#define OP_IM(name) (&m6805_base_device::name<addr_mode::IM>) +#define OP_DI(name) (&m6805_base_device::name<addr_mode::DI>) +#define OP_EX(name) (&m6805_base_device::name<addr_mode::EX>) +#define OP_IX(name) (&m6805_base_device::name<addr_mode::IX>) +#define OP_IX1(name) (&m6805_base_device::name<addr_mode::IX1>) +#define OP_IX2(name) (&m6805_base_device::name<addr_mode::IX2>) + +const m6805_base_device::op_handler_table m6805_base_device::s_hmos_ops = +{ + /* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */ + /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>), + OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>), + /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>), + OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>), + /* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne), + OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP(bil), OP(bih), + /* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr), + OP_DI(lsl), OP_DI(rol), OP_DI(dec), OP(illegal), OP_DI(inc), OP_DI(tst), OP(illegal), OP_DI(clr), + /* 4 */ OP(nega), OP(illegal), OP(illegal), OP(coma), OP(lsra), OP(illegal), OP(rora), OP(asra), + OP(lsla), OP(rola), OP(deca), OP(illegal), OP(inca), OP(tsta), OP(illegal), OP(clra), + /* 5 */ OP(negx), OP(illegal), OP(illegal), OP(comx), OP(lsrx), OP(illegal), OP(rorx), OP(asrx), + OP(lslx), OP(rolx), OP(decx), OP(illegal), OP(incx), OP(tstx), OP(illegal), OP(clrx), + /* 6 */ OP_IX1(neg), OP(illegal), OP(illegal), OP_IX1(com), OP_IX1(lsr), OP(illegal), OP_IX1(ror), OP_IX1(asr), + OP_IX1(lsl), OP_IX1(rol), OP_IX1(dec), OP(illegal), OP_IX1(inc), OP_IX1(tst), OP(illegal), OP_IX1(clr), + /* 7 */ OP_IX(neg), OP(illegal), OP(illegal), OP_IX(com), OP_IX(lsr), OP(illegal), OP_IX(ror), OP_IX(asr), + OP_IX(lsl), OP_IX(rol), OP_IX(dec), OP(illegal), OP_IX(inc), OP_IX(tst), OP(illegal), OP_IX(clr), + /* 8 */ OP(rti), OP(rts), OP(illegal), OP(swi), OP(illegal), OP(illegal), OP(illegal), OP(illegal), + OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), + /* 9 */ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(tax), + OP(clc), OP(sec), OP(cli), OP(sei), OP(rsp), OP(nop), OP(illegal), OP(txa), + /* A */ OP_IM(suba), OP_IM(cmpa), OP_IM(sbca), OP_IM(cpx), OP_IM(anda), OP_IM(bita), OP_IM(lda), OP(illegal), + OP_IM(eora), OP_IM(adca), OP_IM(ora), OP_IM(adda), OP(illegal), OP(bsr), OP_IM(ldx), OP(illegal), + /* B */ OP_DI(suba), OP_DI(cmpa), OP_DI(sbca), OP_DI(cpx), OP_DI(anda), OP_DI(bita), OP_DI(lda), OP_DI(sta), + OP_DI(eora), OP_DI(adca), OP_DI(ora), OP_DI(adda), OP_DI(jmp), OP_DI(jsr), OP_DI(ldx), OP_DI(stx), + /* C */ OP_EX(suba), OP_EX(cmpa), OP_EX(sbca), OP_EX(cpx), OP_EX(anda), OP_EX(bita), OP_EX(lda), OP_EX(sta), + OP_EX(eora), OP_EX(adca), OP_EX(ora), OP_EX(adda), OP_EX(jmp), OP_EX(jsr), OP_EX(ldx), OP_EX(stx), + /* D */ OP_IX2(suba),OP_IX2(cmpa),OP_IX2(sbca),OP_IX2(cpx), OP_IX2(anda),OP_IX2(bita),OP_IX2(lda), OP_IX2(sta), + OP_IX2(eora),OP_IX2(adca),OP_IX2(ora), OP_IX2(adda),OP_IX2(jmp), OP_IX2(jsr), OP_IX2(ldx), OP_IX2(stx), + /* E */ OP_IX1(suba),OP_IX1(cmpa),OP_IX1(sbca),OP_IX1(cpx), OP_IX1(anda),OP_IX1(bita),OP_IX1(lda), OP_IX1(sta), + OP_IX1(eora),OP_IX1(adca),OP_IX1(ora), OP_IX1(adda),OP_IX1(jmp), OP_IX1(jsr), OP_IX1(ldx), OP_IX1(stx), + /* F */ OP_IX(suba), OP_IX(cmpa), OP_IX(sbca), OP_IX(cpx), OP_IX(anda), OP_IX(bita), OP_IX(lda), OP_IX(sta), + OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx) }; -const uint8_t m6805_base_device::m_flags8d[256]= /* decrement */ -{ - 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04 +const m6805_base_device::op_handler_table m6805_base_device::s_cmos_ops = +{ + /* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */ + /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>), + OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>), + /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>), + OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>), + /* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne), + OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP(bil), OP(bih), + /* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr), + OP_DI(lsl), OP_DI(rol), OP_DI(dec), OP(illegal), OP_DI(inc), OP_DI(tst), OP(illegal), OP_DI(clr), + /* 4 */ OP(nega), OP(illegal), OP(illegal), OP(coma), OP(lsra), OP(illegal), OP(rora), OP(asra), + OP(lsla), OP(rola), OP(deca), OP(illegal), OP(inca), OP(tsta), OP(illegal), OP(clra), + /* 5 */ OP(negx), OP(illegal), OP(illegal), OP(comx), OP(lsrx), OP(illegal), OP(rorx), OP(asrx), + OP(lslx), OP(rolx), OP(decx), OP(illegal), OP(incx), OP(tstx), OP(illegal), OP(clrx), + /* 6 */ OP_IX1(neg), OP(illegal), OP(illegal), OP_IX1(com), OP_IX1(lsr), OP(illegal), OP_IX1(ror), OP_IX1(asr), + OP_IX1(lsl), OP_IX1(rol), OP_IX1(dec), OP(illegal), OP_IX1(inc), OP_IX1(tst), OP(illegal), OP_IX1(clr), + /* 7 */ OP_IX(neg), OP(illegal), OP(illegal), OP_IX(com), OP_IX(lsr), OP(illegal), OP_IX(ror), OP_IX(asr), + OP_IX(lsl), OP_IX(rol), OP_IX(dec), OP(illegal), OP_IX(inc), OP_IX(tst), OP(illegal), OP_IX(clr), + /* 8 */ OP(rti), OP(rts), OP(illegal), OP(swi), OP(illegal), OP(illegal), OP(illegal), OP(illegal), + OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(stop), OP(wait), + /* 9 */ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(tax), + OP(clc), OP(sec), OP(cli), OP(sei), OP(rsp), OP(nop), OP(illegal), OP(txa), + /* A */ OP_IM(suba), OP_IM(cmpa), OP_IM(sbca), OP_IM(cpx), OP_IM(anda), OP_IM(bita), OP_IM(lda), OP(illegal), + OP_IM(eora), OP_IM(adca), OP_IM(ora), OP_IM(adda), OP(illegal), OP(bsr), OP_IM(ldx), OP(illegal), + /* B */ OP_DI(suba), OP_DI(cmpa), OP_DI(sbca), OP_DI(cpx), OP_DI(anda), OP_DI(bita), OP_DI(lda), OP_DI(sta), + OP_DI(eora), OP_DI(adca), OP_DI(ora), OP_DI(adda), OP_DI(jmp), OP_DI(jsr), OP_DI(ldx), OP_DI(stx), + /* C */ OP_EX(suba), OP_EX(cmpa), OP_EX(sbca), OP_EX(cpx), OP_EX(anda), OP_EX(bita), OP_EX(lda), OP_EX(sta), + OP_EX(eora), OP_EX(adca), OP_EX(ora), OP_EX(adda), OP_EX(jmp), OP_EX(jsr), OP_EX(ldx), OP_EX(stx), + /* D */ OP_IX2(suba),OP_IX2(cmpa),OP_IX2(sbca),OP_IX2(cpx), OP_IX2(anda),OP_IX2(bita),OP_IX2(lda), OP_IX2(sta), + OP_IX2(eora),OP_IX2(adca),OP_IX2(ora), OP_IX2(adda),OP_IX2(jmp), OP_IX2(jsr), OP_IX2(ldx), OP_IX2(stx), + /* E */ OP_IX1(suba),OP_IX1(cmpa),OP_IX1(sbca),OP_IX1(cpx), OP_IX1(anda),OP_IX1(bita),OP_IX1(lda), OP_IX1(sta), + OP_IX1(eora),OP_IX1(adca),OP_IX1(ora), OP_IX1(adda),OP_IX1(jmp), OP_IX1(jsr), OP_IX1(ldx), OP_IX1(stx), + /* F */ OP_IX(suba), OP_IX(cmpa), OP_IX(sbca), OP_IX(cpx), OP_IX(anda), OP_IX(bita), OP_IX(lda), OP_IX(sta), + OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx) }; -/* what they say it is ... */ -const uint8_t m6805_base_device::m_cycles1[] = +const m6805_base_device::op_handler_table m6805_base_device::s_hc_ops = +{ + /* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */ + /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>), + OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>), + /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>), + OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>), + /* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne), + OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP(bil), OP(bih), + /* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr), + OP_DI(lsl), OP_DI(rol), OP_DI(dec), OP(illegal), OP_DI(inc), OP_DI(tst), OP(illegal), OP_DI(clr), + /* 4 */ OP(nega), OP(illegal), OP(mul), OP(coma), OP(lsra), OP(illegal), OP(rora), OP(asra), + OP(lsla), OP(rola), OP(deca), OP(illegal), OP(inca), OP(tsta), OP(illegal), OP(clra), + /* 5 */ OP(negx), OP(illegal), OP(illegal), OP(comx), OP(lsrx), OP(illegal), OP(rorx), OP(asrx), + OP(lslx), OP(rolx), OP(decx), OP(illegal), OP(incx), OP(tstx), OP(illegal), OP(clrx), + /* 6 */ OP_IX1(neg), OP(illegal), OP(illegal), OP_IX1(com), OP_IX1(lsr), OP(illegal), OP_IX1(ror), OP_IX1(asr), + OP_IX1(lsl), OP_IX1(rol), OP_IX1(dec), OP(illegal), OP_IX1(inc), OP_IX1(tst), OP(illegal), OP_IX1(clr), + /* 7 */ OP_IX(neg), OP(illegal), OP(illegal), OP_IX(com), OP_IX(lsr), OP(illegal), OP_IX(ror), OP_IX(asr), + OP_IX(lsl), OP_IX(rol), OP_IX(dec), OP(illegal), OP_IX(inc), OP_IX(tst), OP(illegal), OP_IX(clr), + /* 8 */ OP(rti), OP(rts), OP(illegal), OP(swi), OP(illegal), OP(illegal), OP(illegal), OP(illegal), + OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(stop), OP(wait), + /* 9 */ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(tax), + OP(clc), OP(sec), OP(cli), OP(sei), OP(rsp), OP(nop), OP(illegal), OP(txa), + /* A */ OP_IM(suba), OP_IM(cmpa), OP_IM(sbca), OP_IM(cpx), OP_IM(anda), OP_IM(bita), OP_IM(lda), OP(illegal), + OP_IM(eora), OP_IM(adca), OP_IM(ora), OP_IM(adda), OP(illegal), OP(bsr), OP_IM(ldx), OP(illegal), + /* B */ OP_DI(suba), OP_DI(cmpa), OP_DI(sbca), OP_DI(cpx), OP_DI(anda), OP_DI(bita), OP_DI(lda), OP_DI(sta), + OP_DI(eora), OP_DI(adca), OP_DI(ora), OP_DI(adda), OP_DI(jmp), OP_DI(jsr), OP_DI(ldx), OP_DI(stx), + /* C */ OP_EX(suba), OP_EX(cmpa), OP_EX(sbca), OP_EX(cpx), OP_EX(anda), OP_EX(bita), OP_EX(lda), OP_EX(sta), + OP_EX(eora), OP_EX(adca), OP_EX(ora), OP_EX(adda), OP_EX(jmp), OP_EX(jsr), OP_EX(ldx), OP_EX(stx), + /* D */ OP_IX2(suba),OP_IX2(cmpa),OP_IX2(sbca),OP_IX2(cpx), OP_IX2(anda),OP_IX2(bita),OP_IX2(lda), OP_IX2(sta), + OP_IX2(eora),OP_IX2(adca),OP_IX2(ora), OP_IX2(adda),OP_IX2(jmp), OP_IX2(jsr), OP_IX2(ldx), OP_IX2(stx), + /* E */ OP_IX1(suba),OP_IX1(cmpa),OP_IX1(sbca),OP_IX1(cpx), OP_IX1(anda),OP_IX1(bita),OP_IX1(lda), OP_IX1(sta), + OP_IX1(eora),OP_IX1(adca),OP_IX1(ora), OP_IX1(adda),OP_IX1(jmp), OP_IX1(jsr), OP_IX1(ldx), OP_IX1(stx), + /* F */ OP_IX(suba), OP_IX(cmpa), OP_IX(sbca), OP_IX(cpx), OP_IX(anda), OP_IX(bita), OP_IX(lda), OP_IX(sta), + OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx) +}; + + +const m6805_base_device::cycle_count_table m6805_base_device::s_hmos_cycles = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /*0*/ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, /*1*/ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - /*2*/ 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - /*3*/ 6, 0, 0, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0, 6, 6, 0, + /*2*/ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + /*3*/ 6, 0, 0, 6, 6, 0, 6, 6, 6, 6, 6, 0, 6, 6, 0, 6, /*4*/ 4, 0, 0, 4, 4, 0, 4, 4, 4, 4, 4, 0, 4, 4, 0, 4, /*5*/ 4, 0, 0, 4, 4, 0, 4, 4, 4, 4, 4, 0, 4, 4, 0, 4, /*6*/ 7, 0, 0, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, 0, 7, @@ -104,175 +183,83 @@ const uint8_t m6805_base_device::m_cycles1[] = /*F*/ 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 3, 7, 4, 5 }; - -void m6805_base_device::rd_s_handler_b(uint8_t *b) +const m6805_base_device::cycle_count_table m6805_base_device::s_cmos_cycles = { - SP_INC; - *b = RM( S ); -} - -void m6805_base_device::rd_s_handler_w(PAIR *p) -{ - CLEAR_PAIR(p); - SP_INC; - p->b.h = RM( S ); - SP_INC; - p->b.l = RM( S ); -} - -void m6805_base_device::wr_s_handler_b(uint8_t *b) -{ - WM( S, *b ); - SP_DEC; -} - -void m6805_base_device::wr_s_handler_w(PAIR *p) -{ - WM( S, p->b.l ); - SP_DEC; - WM( S, p->b.h ); - SP_DEC; -} - -void m6805_base_device::RM16(uint32_t addr, PAIR *p) -{ - CLEAR_PAIR(p); - p->b.h = RM(addr); - ++addr; -// if( ++addr > AMASK ) addr = 0; - p->b.l = RM(addr); -} - -void m6805_base_device::interrupt_vector() -{ - RM16(0xffff - 5, &m_pc); -} - -void m68hc05eg_device::interrupt_vector() -{ - if ((m_pending_interrupts & (1 << M68HC05EG_INT_IRQ)) != 0) - { - m_pending_interrupts &= ~(1 << M68HC05EG_INT_IRQ); - RM16(0x1ffa, &m_pc); - } - else if((m_pending_interrupts & (1 << M68HC05EG_INT_TIMER)) != 0) - { - m_pending_interrupts &= ~(1 << M68HC05EG_INT_TIMER); - RM16(0x1ff8, &m_pc); - } - else if((m_pending_interrupts & (1 << M68HC05EG_INT_CPI)) != 0) - { - m_pending_interrupts &= ~(1 << M68HC05EG_INT_CPI); - RM16(0x1ff6, &m_pc); - } -} - -void hd63705_device::interrupt_vector() -{ - /* Need to add emulation of other interrupt sources here KW-2/4/99 */ - /* This is just a quick patch for Namco System 2 operation */ - - if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_IRQ1); - RM16(0x1ff8, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_IRQ2)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_IRQ2); - RM16(0x1fec, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_ADCONV)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_ADCONV); - RM16(0x1fea, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER1)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_TIMER1); - RM16(0x1ff6, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER2)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_TIMER2); - RM16(0x1ff4, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER3)) != 0) - { - m_pending_interrupts &= ~(1<<HD63705_INT_TIMER3); - RM16(0x1ff2, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_PCI)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_PCI); - RM16(0x1ff0, &m_pc); - } - else if ((m_pending_interrupts & (1 << HD63705_INT_SCI)) != 0) - { - m_pending_interrupts &= ~(1 << HD63705_INT_SCI); - RM16(0x1fee, &m_pc); - } -} + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /*0*/ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /*1*/ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /*2*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /*3*/ 5, 0, 0, 5, 5, 0, 5, 5, 5, 5, 5, 0, 5, 4, 0, 5, + /*4*/ 3, 0, 0, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, 0, 3, + /*5*/ 3, 0, 0, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, 0, 3, + /*6*/ 6, 0, 0, 6, 6, 0, 6, 6, 6, 6, 6, 0, 6, 5, 0, 6, + /*7*/ 5, 0, 0, 5, 5, 0, 5, 5, 5, 5, 5, 0, 5, 4, 0, 5, + /*8*/ 9, 6, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, + /*9*/ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, + /*A*/ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 6, 2, 0, + /*B*/ 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 2, 5, 3, 4, + /*C*/ 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 3, 6, 4, 5, + /*D*/ 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 4, 7, 5, 6, + /*E*/ 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 3, 6, 4, 5, + /*F*/ 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 2, 5, 3, 4 +}; -/* Generate interrupts */ -void m6805_base_device::interrupt() +const m6805_base_device::cycle_count_table m6805_base_device::s_hc_cycles = { - /* the 6805 latches interrupt requests internally, so we don't clear */ - /* pending_interrupts until the interrupt is taken, no matter what the */ - /* external IRQ pin does. */ - - if ((m_pending_interrupts & (1 << HD63705_INT_NMI)) != 0) - { - PUSHWORD(m_pc); - PUSHBYTE(m_x); - PUSHBYTE(m_a); - PUSHBYTE(m_cc); - SEI; - /* no vectors supported, just do the callback to clear irq_state if needed */ - standard_irq_callback(0); - - RM16(0x1ffc, &m_pc); - m_pending_interrupts &= ~(1 << HD63705_INT_NMI); - - m_icount -= 11; - burn_cycles(11); - } - else if((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | HD63705_INT_MASK)) != 0) - { - if ((CC & IFLAG) == 0) - { - /* standard IRQ */ - PUSHWORD(m_pc); - PUSHBYTE(m_x); - PUSHBYTE(m_a); - PUSHBYTE(m_cc); - SEI; - /* no vectors supported, just do the callback to clear irq_state if needed */ - standard_irq_callback(0); - - interrupt_vector(); - - m_pending_interrupts &= ~(1 << M6805_IRQ_LINE); - } - m_icount -= 11; - burn_cycles(11); - } -} + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /*0*/ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /*1*/ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /*2*/ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /*3*/ 5, 0, 0, 5, 5, 0, 5, 5, 5, 5, 5, 0, 5, 4, 0, 5, + /*4*/ 3, 0,11, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, 0, 3, + /*5*/ 3, 0, 0, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, 0, 3, + /*6*/ 6, 0, 0, 6, 6, 0, 6, 6, 6, 6, 6, 0, 6, 5, 0, 6, + /*7*/ 5, 0, 0, 5, 5, 0, 5, 5, 5, 5, 5, 0, 5, 4, 0, 5, + /*8*/ 9, 6, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, + /*9*/ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, + /*A*/ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 6, 2, 0, + /*B*/ 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 2, 5, 3, 4, + /*C*/ 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 3, 6, 4, 5, + /*D*/ 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 4, 7, 5, 6, + /*E*/ 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 3, 6, 4, 5, + /*F*/ 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 2, 5, 3, 4 +}; //------------------------------------------------- // m6809_base_device - constructor //------------------------------------------------- -m6805_base_device::m6805_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const device_type type, const char *name, uint32_t addr_width, const char *shortname, const char *source) +m6805_base_device::m6805_base_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + uint32_t clock, + device_type const type, + char const *name, + configuration_params const ¶ms, + char const *shortname, + char const *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) - , m_program_config("program", ENDIANNESS_BIG, 8, addr_width) + , m_params(params) + , m_program_config("program", ENDIANNESS_BIG, 8, params.m_addr_width) { } -m6805_base_device::m6805_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const device_type type, const char *name, uint32_t addr_width, address_map_delegate internal_map, const char *shortname, const char *source) +m6805_base_device::m6805_base_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + uint32_t clock, + device_type const type, + char const *name, + configuration_params const ¶ms, + address_map_delegate internal_map, + char const *shortname, + char const *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) - , m_program_config("program", ENDIANNESS_BIG, 8, addr_width, 0, internal_map) + , m_params(params) + , m_program_config("program", ENDIANNESS_BIG, 8, params.m_addr_width, 0, internal_map) { } @@ -298,8 +285,6 @@ void m6805_base_device::device_start() // register for savestates save_item(NAME(EA)); - save_item(NAME(SP_MASK)); - save_item(NAME(SP_LOW)); save_item(NAME(A)); save_item(NAME(PC)); save_item(NAME(S)); @@ -312,13 +297,9 @@ void m6805_base_device::device_start() std::fill(std::begin(m_irq_state), std::end(m_irq_state), 0); } - - void m6805_base_device::device_reset() { m_ea.w.l = 0; - m_sp_mask = 0x07f; - m_sp_low = 0x060; m_pc.w.l = 0; m_s.w.l = SP_MASK; m_a = 0; @@ -334,7 +315,7 @@ void m6805_base_device::device_reset() /* IRQ disabled */ SEI; - RM16(0xfffe, &m_pc); + rm16(0xfffe, m_pc); } @@ -347,10 +328,9 @@ void m6805_base_device::device_reset() const address_space_config *m6805_base_device::memory_space_config(address_spacenum spacenum) const { if (spacenum == AS_PROGRAM) - { return &m_program_config; - } - return nullptr; + else + return nullptr; } @@ -363,17 +343,69 @@ void m6805_base_device::state_string_export(const device_state_entry &entry, std { switch (entry.index()) { - case STATE_GENFLAGS: - str = string_format("%c%c%c%c%c%c%c%c", - (m_cc & 0x80) ? '?' : '.', - (m_cc & 0x40) ? '?' : '.', - (m_cc & 0x20) ? '?' : '.', - (m_cc & 0x10) ? 'H' : '.', - (m_cc & 0x08) ? 'I' : '.', - (m_cc & 0x04) ? 'N' : '.', - (m_cc & 0x02) ? 'Z' : '.', - (m_cc & 0x01) ? 'C' : '.'); - break; + case STATE_GENFLAGS: + str = string_format("%c%c%c%c%c%c%c%c", + (m_cc & 0x80) ? '?' : '.', + (m_cc & 0x40) ? '?' : '.', + (m_cc & 0x20) ? '?' : '.', + (m_cc & 0x10) ? 'H' : '.', + (m_cc & 0x08) ? 'I' : '.', + (m_cc & 0x04) ? 'N' : '.', + (m_cc & 0x02) ? 'Z' : '.', + (m_cc & 0x01) ? 'C' : '.'); + break; + } +} + + +void m6805_base_device::interrupt_vector() +{ + rm16(0xfffa, m_pc); +} + +/* Generate interrupts */ +void m6805_base_device::interrupt() +{ + /* the 6805 latches interrupt requests internally, so we don't clear */ + /* pending_interrupts until the interrupt is taken, no matter what the */ + /* external IRQ pin does. */ + + if ((m_pending_interrupts & (1 << HD63705_INT_NMI)) != 0) + { + pushword(m_pc); + pushbyte(m_x); + pushbyte(m_a); + pushbyte(m_cc); + SEI; + /* no vectors supported, just do the callback to clear irq_state if needed */ + standard_irq_callback(0); + + rm16(0x1ffc, m_pc); + m_pending_interrupts &= ~(1 << HD63705_INT_NMI); + + m_icount -= 11; + burn_cycles(11); + } + else if ((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | HD63705_INT_MASK)) != 0) + { + if ((CC & IFLAG) == 0) + { + /* standard IRQ */ + pushword(m_pc); + pushbyte(m_x); + pushbyte(m_a); + pushbyte(m_cc); + SEI; + /* no vectors supported, just do the callback to clear irq_state if needed */ + standard_irq_callback(0); + + interrupt_vector(); + + m_pending_interrupts &= ~(1 << M6805_IRQ_LINE); + + m_icount -= 11; + burn_cycles(11); + } } } @@ -407,26 +439,10 @@ uint32_t m6805_base_device::disasm_max_opcode_bytes() const offs_t m6805_base_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { - extern CPU_DISASSEMBLE( m6805 ); return CPU_DISASSEMBLE_NAME(m6805)(this, stream, pc, oprom, opram, options); } -void m6805_device::execute_set_input(int inputnum, int state) -{ - /* Basic 6805 only has one IRQ line */ - /* See HD63705 specific version */ - if (m_irq_state[0] != state) - { - m_irq_state[0] = state; - - if (state != CLEAR_LINE) - { - m_pending_interrupts |= 1 << M6805_IRQ_LINE; - } - } -} - #include "6805ops.hxx" //------------------------------------------------- @@ -458,7 +474,12 @@ uint64_t m6805_base_device::execute_cycles_to_clocks(uint64_t cycles) const uint32_t m6805_base_device::execute_min_cycles() const { - return 2; + // get the minimum not including the zero placeholders for illegal instructions + u32 const result(*std::min_element( + std::begin(m_params.m_cycles), + std::end(m_params.m_cycles), + [] (u8 x, u8 y) { return u8(x - 1) < u8(y - 1); })); + return result; } @@ -469,7 +490,8 @@ uint32_t m6805_base_device::execute_min_cycles() const uint32_t m6805_base_device::execute_max_cycles() const { - return 10; + u32 const result(*std::max_element(std::begin(m_params.m_cycles), std::end(m_params.m_cycles))); + return result; } @@ -487,8 +509,6 @@ uint32_t m6805_base_device::execute_input_lines() const /* execute instructions on this CPU until icount expires */ void m6805_base_device::execute_run() { - uint8_t ireg; - S = SP_ADJUST( S ); /* Taken from CPU_SET_CONTEXT when pointer'afying */ do @@ -500,288 +520,68 @@ void m6805_base_device::execute_run() debugger_instruction_hook(this, PC); - ireg = M_RDOP(PC++); + u8 const ireg = rdop(PC++); + + (this->*m_params.m_ops[ireg])(); + m_icount -= m_params.m_cycles[ireg]; + burn_cycles(m_params.m_cycles[ireg]); + } + while (m_icount > 0); +} + + +void m6805_device::execute_set_input(int inputnum, int state) +{ + /* Basic 6805 only has one IRQ line */ + /* See HD63705 specific version */ + if (m_irq_state[0] != state) + { + m_irq_state[0] = state; - switch (ireg) + if (state != CLEAR_LINE) { - case 0x00: brset(0x01); break; - case 0x01: brclr(0x01); break; - case 0x02: brset(0x02); break; - case 0x03: brclr(0x02); break; - case 0x04: brset(0x04); break; - case 0x05: brclr(0x04); break; - case 0x06: brset(0x08); break; - case 0x07: brclr(0x08); break; - case 0x08: brset(0x10); break; - case 0x09: brclr(0x10); break; - case 0x0A: brset(0x20); break; - case 0x0B: brclr(0x20); break; - case 0x0C: brset(0x40); break; - case 0x0D: brclr(0x40); break; - case 0x0E: brset(0x80); break; - case 0x0F: brclr(0x80); break; - case 0x10: bset(0x01); break; - case 0x11: bclr(0x01); break; - case 0x12: bset(0x02); break; - case 0x13: bclr(0x02); break; - case 0x14: bset(0x04); break; - case 0x15: bclr(0x04); break; - case 0x16: bset(0x08); break; - case 0x17: bclr(0x08); break; - case 0x18: bset(0x10); break; - case 0x19: bclr(0x10); break; - case 0x1a: bset(0x20); break; - case 0x1b: bclr(0x20); break; - case 0x1c: bset(0x40); break; - case 0x1d: bclr(0x40); break; - case 0x1e: bset(0x80); break; - case 0x1f: bclr(0x80); break; - case 0x20: bra(); break; - case 0x21: brn(); break; - case 0x22: bhi(); break; - case 0x23: bls(); break; - case 0x24: bcc(); break; - case 0x25: bcs(); break; - case 0x26: bne(); break; - case 0x27: beq(); break; - case 0x28: bhcc(); break; - case 0x29: bhcs(); break; - case 0x2a: bpl(); break; - case 0x2b: bmi(); break; - case 0x2c: bmc(); break; - case 0x2d: bms(); break; - case 0x2e: bil(); break; - case 0x2f: bih(); break; - case 0x30: neg_di(); break; - case 0x31: illegal(); break; - case 0x32: illegal(); break; - case 0x33: com_di(); break; - case 0x34: lsr_di(); break; - case 0x35: illegal(); break; - case 0x36: ror_di(); break; - case 0x37: asr_di(); break; - case 0x38: lsl_di(); break; - case 0x39: rol_di(); break; - case 0x3a: dec_di(); break; - case 0x3b: illegal(); break; - case 0x3c: inc_di(); break; - case 0x3d: tst_di(); break; - case 0x3e: illegal(); break; - case 0x3f: clr_di(); break; - case 0x40: nega(); break; - case 0x41: illegal(); break; - case 0x42: illegal(); break; - case 0x43: coma(); break; - case 0x44: lsra(); break; - case 0x45: illegal(); break; - case 0x46: rora(); break; - case 0x47: asra(); break; - case 0x48: lsla(); break; - case 0x49: rola(); break; - case 0x4a: deca(); break; - case 0x4b: illegal(); break; - case 0x4c: inca(); break; - case 0x4d: tsta(); break; - case 0x4e: illegal(); break; - case 0x4f: clra(); break; - case 0x50: negx(); break; - case 0x51: illegal(); break; - case 0x52: illegal(); break; - case 0x53: comx(); break; - case 0x54: lsrx(); break; - case 0x55: illegal(); break; - case 0x56: rorx(); break; - case 0x57: asrx(); break; - case 0x58: aslx(); break; - case 0x59: rolx(); break; - case 0x5a: decx(); break; - case 0x5b: illegal(); break; - case 0x5c: incx(); break; - case 0x5d: tstx(); break; - case 0x5e: illegal(); break; - case 0x5f: clrx(); break; - case 0x60: neg_ix1(); break; - case 0x61: illegal(); break; - case 0x62: illegal(); break; - case 0x63: com_ix1(); break; - case 0x64: lsr_ix1(); break; - case 0x65: illegal(); break; - case 0x66: ror_ix1(); break; - case 0x67: asr_ix1(); break; - case 0x68: lsl_ix1(); break; - case 0x69: rol_ix1(); break; - case 0x6a: dec_ix1(); break; - case 0x6b: illegal(); break; - case 0x6c: inc_ix1(); break; - case 0x6d: tst_ix1(); break; - case 0x6e: illegal(); break; - case 0x6f: clr_ix1(); break; - case 0x70: neg_ix(); break; - case 0x71: illegal(); break; - case 0x72: illegal(); break; - case 0x73: com_ix(); break; - case 0x74: lsr_ix(); break; - case 0x75: illegal(); break; - case 0x76: ror_ix(); break; - case 0x77: asr_ix(); break; - case 0x78: lsl_ix(); break; - case 0x79: rol_ix(); break; - case 0x7a: dec_ix(); break; - case 0x7b: illegal(); break; - case 0x7c: inc_ix(); break; - case 0x7d: tst_ix(); break; - case 0x7e: illegal(); break; - case 0x7f: clr_ix(); break; - case 0x80: rti(); break; - case 0x81: rts(); break; - case 0x82: illegal(); break; - case 0x83: swi(); break; - case 0x84: illegal(); break; - case 0x85: illegal(); break; - case 0x86: illegal(); break; - case 0x87: illegal(); break; - case 0x88: illegal(); break; - case 0x89: illegal(); break; - case 0x8a: illegal(); break; - case 0x8b: illegal(); break; - case 0x8c: illegal(); break; - case 0x8d: illegal(); break; - case 0x8e: illegal(); break; - case 0x8f: illegal(); break; - case 0x90: illegal(); break; - case 0x91: illegal(); break; - case 0x92: illegal(); break; - case 0x93: illegal(); break; - case 0x94: illegal(); break; - case 0x95: illegal(); break; - case 0x96: illegal(); break; - case 0x97: tax(); break; - case 0x98: CLC; break; - case 0x99: SEC; break; -#if IRQ_LEVEL_DETECT - case 0x9a: CLI; if (m_irq_state != CLEAR_LINE) m_pending_interrupts |= 1 << M6805_IRQ_LINE; break; -#else - case 0x9a: CLI; break; -#endif - case 0x9b: SEI; break; - case 0x9c: rsp(); break; - case 0x9d: nop(); break; - case 0x9e: illegal(); break; - case 0x9f: txa(); break; - case 0xa0: suba_im(); break; - case 0xa1: cmpa_im(); break; - case 0xa2: sbca_im(); break; - case 0xa3: cpx_im(); break; - case 0xa4: anda_im(); break; - case 0xa5: bita_im(); break; - case 0xa6: lda_im(); break; - case 0xa7: illegal(); break; - case 0xa8: eora_im(); break; - case 0xa9: adca_im(); break; - case 0xaa: ora_im(); break; - case 0xab: adda_im(); break; - case 0xac: illegal(); break; - case 0xad: bsr(); break; - case 0xae: ldx_im(); break; - case 0xaf: illegal(); break; - case 0xb0: suba_di(); break; - case 0xb1: cmpa_di(); break; - case 0xb2: sbca_di(); break; - case 0xb3: cpx_di(); break; - case 0xb4: anda_di(); break; - case 0xb5: bita_di(); break; - case 0xb6: lda_di(); break; - case 0xb7: sta_di(); break; - case 0xb8: eora_di(); break; - case 0xb9: adca_di(); break; - case 0xba: ora_di(); break; - case 0xbb: adda_di(); break; - case 0xbc: jmp_di(); break; - case 0xbd: jsr_di(); break; - case 0xbe: ldx_di(); break; - case 0xbf: stx_di(); break; - case 0xc0: suba_ex(); break; - case 0xc1: cmpa_ex(); break; - case 0xc2: sbca_ex(); break; - case 0xc3: cpx_ex(); break; - case 0xc4: anda_ex(); break; - case 0xc5: bita_ex(); break; - case 0xc6: lda_ex(); break; - case 0xc7: sta_ex(); break; - case 0xc8: eora_ex(); break; - case 0xc9: adca_ex(); break; - case 0xca: ora_ex(); break; - case 0xcb: adda_ex(); break; - case 0xcc: jmp_ex(); break; - case 0xcd: jsr_ex(); break; - case 0xce: ldx_ex(); break; - case 0xcf: stx_ex(); break; - case 0xd0: suba_ix2(); break; - case 0xd1: cmpa_ix2(); break; - case 0xd2: sbca_ix2(); break; - case 0xd3: cpx_ix2(); break; - case 0xd4: anda_ix2(); break; - case 0xd5: bita_ix2(); break; - case 0xd6: lda_ix2(); break; - case 0xd7: sta_ix2(); break; - case 0xd8: eora_ix2(); break; - case 0xd9: adca_ix2(); break; - case 0xda: ora_ix2(); break; - case 0xdb: adda_ix2(); break; - case 0xdc: jmp_ix2(); break; - case 0xdd: jsr_ix2(); break; - case 0xde: ldx_ix2(); break; - case 0xdf: stx_ix2(); break; - case 0xe0: suba_ix1(); break; - case 0xe1: cmpa_ix1(); break; - case 0xe2: sbca_ix1(); break; - case 0xe3: cpx_ix1(); break; - case 0xe4: anda_ix1(); break; - case 0xe5: bita_ix1(); break; - case 0xe6: lda_ix1(); break; - case 0xe7: sta_ix1(); break; - case 0xe8: eora_ix1(); break; - case 0xe9: adca_ix1(); break; - case 0xea: ora_ix1(); break; - case 0xeb: adda_ix1(); break; - case 0xec: jmp_ix1(); break; - case 0xed: jsr_ix1(); break; - case 0xee: ldx_ix1(); break; - case 0xef: stx_ix1(); break; - case 0xf0: suba_ix(); break; - case 0xf1: cmpa_ix(); break; - case 0xf2: sbca_ix(); break; - case 0xf3: cpx_ix(); break; - case 0xf4: anda_ix(); break; - case 0xf5: bita_ix(); break; - case 0xf6: lda_ix(); break; - case 0xf7: sta_ix(); break; - case 0xf8: eora_ix(); break; - case 0xf9: adca_ix(); break; - case 0xfa: ora_ix(); break; - case 0xfb: adda_ix(); break; - case 0xfc: jmp_ix(); break; - case 0xfd: jsr_ix(); break; - case 0xfe: ldx_ix(); break; - case 0xff: stx_ix(); break; + m_pending_interrupts |= 1 << M6805_IRQ_LINE; } - m_icount -= m_cycles1[ireg]; - burn_cycles(m_cycles1[ireg]); } - while (m_icount > 0); +} + + +m6805_device::m6805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : m6805_base_device( + mconfig, + tag, + owner, + clock, + M6805, + "M6805", + { s_hmos_ops, s_hmos_cycles, 12, 0x007f, 0x0060, 0xfffc }, + "m6805", + __FILE__) +{ } /**************************************************************************** * M68HC05EG section ****************************************************************************/ +m68hc05eg_device::m68hc05eg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : m6805_base_device( + mconfig, + tag, + owner, + clock, + M68HC05EG, + "M68HC05EG", + { s_hmos_ops, s_hmos_cycles, 13, 0x00ff, 0x00c0, 0xfffc }, // completely wrong, but it preserves existing behaviour + "m68hc05eg", + __FILE__) +{ +} + void m68hc05eg_device::device_reset() { m6805_base_device::device_reset(); - m_sp_mask = 0xff; - m_sp_low = 0xc0; - - RM16(0x1ffe, &m_pc); + rm16(0x1ffe, m_pc); } void m68hc05eg_device::execute_set_input(int inputnum, int state) @@ -797,19 +597,49 @@ void m68hc05eg_device::execute_set_input(int inputnum, int state) } } +void m68hc05eg_device::interrupt_vector() +{ + if ((m_pending_interrupts & (1 << M68HC05EG_INT_IRQ)) != 0) + { + m_pending_interrupts &= ~(1 << M68HC05EG_INT_IRQ); + rm16(0x1ffa, m_pc); + } + else if((m_pending_interrupts & (1 << M68HC05EG_INT_TIMER)) != 0) + { + m_pending_interrupts &= ~(1 << M68HC05EG_INT_TIMER); + rm16(0x1ff8, m_pc); + } + else if((m_pending_interrupts & (1 << M68HC05EG_INT_CPI)) != 0) + { + m_pending_interrupts &= ~(1 << M68HC05EG_INT_CPI); + rm16(0x1ff6, m_pc); + } +} + /**************************************************************************** * HD63705 section ****************************************************************************/ +hd63705_device::hd63705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : m6805_base_device(mconfig, + tag, + owner, + clock, + HD63705, + "HD63705", + { s_hmos_ops, s_hmos_cycles, 16, 0x017f, 0x0100, 0x1ffa }, + "hd63705", + __FILE__) +{ +} + void hd63705_device::device_reset() { m6805_base_device::device_reset(); - m_sp_mask = 0x17f; - m_sp_low = 0x100; m_s.w.l = SP_MASK; - RM16(0x1ffe, &m_pc); + rm16(0x1ffe, m_pc); } void hd63705_device::execute_set_input(int inputnum, int state) @@ -840,6 +670,54 @@ void hd63705_device::execute_set_input(int inputnum, int state) } } +void hd63705_device::interrupt_vector() +{ + /* Need to add emulation of other interrupt sources here KW-2/4/99 */ + /* This is just a quick patch for Namco System 2 operation */ + + if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_IRQ1); + rm16(0x1ff8, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_IRQ2)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_IRQ2); + rm16(0x1fec, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_ADCONV)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_ADCONV); + rm16(0x1fea, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER1)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_TIMER1); + rm16(0x1ff6, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER2)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_TIMER2); + rm16(0x1ff4, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER3)) != 0) + { + m_pending_interrupts &= ~(1<<HD63705_INT_TIMER3); + rm16(0x1ff2, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_PCI)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_PCI); + rm16(0x1ff0, m_pc); + } + else if ((m_pending_interrupts & (1 << HD63705_INT_SCI)) != 0) + { + m_pending_interrupts &= ~(1 << HD63705_INT_SCI); + rm16(0x1fee, m_pc); + } +} + + const device_type M6805 = &device_creator<m6805_device>; const device_type M68HC05EG = &device_creator<m68hc05eg_device>; const device_type HD63705 = &device_creator<hd63705_device>; diff --git a/src/devices/cpu/m6805/m6805.h b/src/devices/cpu/m6805/m6805.h index 5d0dfede083..3aa8e08bc99 100644 --- a/src/devices/cpu/m6805/m6805.h +++ b/src/devices/cpu/m6805/m6805.h @@ -21,12 +21,92 @@ extern const device_type HD63705; // Used by core CPU interface class m6805_base_device : public cpu_device { -public: - // construction/destruction - m6805_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const device_type type, const char *name, uint32_t addr_width, const char *shortname, const char *source); - protected: - m6805_base_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const device_type type, const char *name, uint32_t addr_width, address_map_delegate internal_map, const char *shortname, const char *source); + // addressing mode selector for opcode handler templates + enum class addr_mode { IM, DI, EX, IX, IX1, IX2 }; + + // state index constants + enum + { + M6805_PC = 1, + M6805_S, + M6805_CC, + M6805_A, + M6805_X, + M6805_IRQ_STATE + }; + + // CC masks H INZC + // 7654 3210 + enum + { + CFLAG = 0x01, + ZFLAG = 0x02, + NFLAG = 0x04, + IFLAG = 0x08, + HFLAG = 0x10 + }; + + typedef void (m6805_base_device::*op_handler_func)(); + typedef op_handler_func const op_handler_table[256]; + typedef u8 const cycle_count_table[256]; + + struct configuration_params + { + configuration_params( + op_handler_table &ops, + cycle_count_table &cycles, + u32 addr_width, + u32 sp_mask, + u32 sp_floor, + u16 swi_vector) + : m_ops(ops) + , m_cycles(cycles) + , m_addr_width(addr_width) + , m_sp_mask(sp_mask) + , m_sp_floor(sp_floor) + , m_swi_vector(swi_vector) + { + } + + op_handler_table &m_ops; + cycle_count_table &m_cycles; + u32 m_addr_width; + u32 m_sp_mask; + u32 m_sp_floor; + u16 m_swi_vector; + }; + + // opcode tables + static op_handler_table s_hmos_ops; + static op_handler_table s_cmos_ops; + static op_handler_table s_hc_ops; + static cycle_count_table s_hmos_cycles; + static cycle_count_table s_cmos_cycles; + static cycle_count_table s_hc_cycles; + + // construction/destruction + m6805_base_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + uint32_t clock, + device_type const type, + char const *name, + configuration_params const ¶ms, + char const *shortname, + char const *source); + m6805_base_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + uint32_t clock, + device_type const type, + char const *name, + configuration_params const ¶ms, + address_map_delegate internal_map, + char const *shortname, + char const *source); // device-level overrides virtual void device_start() override; @@ -55,65 +135,70 @@ protected: // for devices with timing-sensitive peripherals virtual void burn_cycles(unsigned count) { } -private: - // opcode/condition tables - static const uint8_t m_flags8i[256]; - static const uint8_t m_flags8d[256]; - static const uint8_t m_cycles1[256]; - -protected: - enum - { - M6805_PC = 1, - M6805_S, - M6805_CC, - M6805_A, - M6805_X, - M6805_IRQ_STATE - }; - - void rd_s_handler_b(uint8_t *b); - void rd_s_handler_w(PAIR *p); - void wr_s_handler_b(uint8_t *b); - void wr_s_handler_w(PAIR *p); - void RM16(uint32_t addr, PAIR *p); - - void brset(uint8_t bit); - void brclr(uint8_t bit); - void bset(uint8_t bit); - void bclr(uint8_t bit); - - void bra(); - void brn(); - void bhi(); - void bls(); - void bcc(); - void bcs(); - void bne(); - void beq(); - void bhcc(); - void bhcs(); - void bpl(); - void bmi(); - void bmc(); - void bms(); + void clr_nz() { m_cc &= ~(NFLAG | ZFLAG); } + void clr_nzc() { m_cc &= ~(NFLAG | ZFLAG | CFLAG); } + void clr_hc() { m_cc &= ~(HFLAG | CFLAG); } + void clr_hnzc() { m_cc &= ~(HFLAG | NFLAG | ZFLAG | CFLAG); } + + // macros for CC -- CC bits affected should be reset before calling + void set_z8(u8 a) { if (!a) m_cc |= ZFLAG; } + void set_n8(u8 a) { m_cc |= (a & 0x80) >> 5; } + void set_h(u8 a, u8 b, u8 r) { m_cc |= (a ^ b ^ r) & 0x10; } + void set_c8(u16 a) { m_cc |= BIT(a, 8); } + + // combos + void set_nz8(u8 a) { set_n8(a); set_z8(a); } + void set_nzc8(u16 a) { set_nz8(a); set_c8(a); } + void set_hnzc8(u8 a, u8 b, u16 r) { set_h(a, b, r); set_nzc8(r); } + + unsigned rdmem(u32 addr) { return unsigned(m_program->read_byte(addr)); } + void wrmem(u32 addr, u8 value) { m_program->write_byte(addr, value); } + unsigned rdop(u32 addr) { return unsigned(m_direct->read_byte(addr)); } + unsigned rdop_arg(u32 addr) { return unsigned(m_direct->read_byte(addr)); } + + unsigned rm(u32 addr) { return rdmem(addr); } + void rm16(u32 addr, PAIR &p); + void wm(u32 addr, u8 value) { wrmem(addr, value); } + + void pushbyte(u8 b); + void pushword(PAIR const &p); + void pullbyte(u8 &b); + void pullword(PAIR &p); + + template <typename T> void immbyte(T &b); + void immword(PAIR &w); + void skipbyte(); + + template <unsigned B> void brset(); + template <unsigned B> void brclr(); + template <unsigned B> void bset(); + template <unsigned B> void bclr(); + + template <bool C> void bra(); + template <bool C> void bhi(); + template <bool C> void bcc(); + template <bool C> void bne(); + template <bool C> void bhcc(); + template <bool C> void bpl(); + template <bool C> void bmc(); virtual void bil(); virtual void bih(); void bsr(); - void neg_di(); - void com_di(); - void lsr_di(); - void ror_di(); - void asr_di(); - void lsl_di(); - void rol_di(); - void dec_di(); - void inc_di(); - void tst_di(); - void clr_di(); + template <addr_mode M> void neg(); + template <addr_mode M> void com(); + template <addr_mode M> void lsr(); + template <addr_mode M> void ror(); + template <addr_mode M> void asr(); + template <addr_mode M> void lsl(); + template <addr_mode M> void rol(); + template <addr_mode M> void dec(); + template <addr_mode M> void inc(); + template <addr_mode M> void tst(); + template <addr_mode M> void clr(); void nega(); + void mul(); void coma(); void lsra(); void rora(); @@ -130,162 +215,65 @@ protected: void lsrx(); void rorx(); void asrx(); - void aslx(); -// void lslx(); + void lslx(); void rolx(); void decx(); void incx(); void tstx(); void clrx(); - void neg_ix1(); - void com_ix1(); - void lsr_ix1(); - void ror_ix1(); - void asr_ix1(); - void lsl_ix1(); - void rol_ix1(); - void dec_ix1(); - void inc_ix1(); - void tst_ix1(); - void clr_ix1(); - - void neg_ix(); - void com_ix(); - void lsr_ix(); - void ror_ix(); - void asr_ix(); - void lsl_ix(); - void rol_ix(); - void dec_ix(); - void inc_ix(); - void tst_ix(); - void clr_ix(); - void rti(); void rts(); - virtual void swi(); + void swi(); + void stop(); + void wait(); void tax(); void txa(); + void clc(); + void sec(); + void cli(); + void sei(); + void rsp(); void nop(); - void suba_im(); - void cmpa_im(); - void sbca_im(); - void cpx_im(); - void anda_im(); - void bita_im(); - void lda_im(); - void eora_im(); - void adca_im(); - void ora_im(); - void adda_im(); - - void ldx_im(); - void suba_di(); - void cmpa_di(); - void sbca_di(); - void cpx_di(); - void anda_di(); - void bita_di(); - void lda_di(); - void sta_di(); - void eora_di(); - void adca_di(); - void ora_di(); - void adda_di(); - void jmp_di(); - void jsr_di(); - void ldx_di(); - void stx_di(); - void suba_ex(); - void cmpa_ex(); - void sbca_ex(); - void cpx_ex(); - void anda_ex(); - void bita_ex(); - void lda_ex(); - void sta_ex(); - void eora_ex(); - void adca_ex(); - void ora_ex(); - void adda_ex(); - void jmp_ex(); - void jsr_ex(); - void ldx_ex(); - void stx_ex(); - void suba_ix2(); - void cmpa_ix2(); - void sbca_ix2(); - void cpx_ix2(); - void anda_ix2(); - void bita_ix2(); - void lda_ix2(); - void sta_ix2(); - void eora_ix2(); - void adca_ix2(); - void ora_ix2(); - void adda_ix2(); - void jmp_ix2(); - void jsr_ix2(); - void ldx_ix2(); - void stx_ix2(); - void suba_ix1(); - void cmpa_ix1(); - void sbca_ix1(); - void cpx_ix1(); - void anda_ix1(); - void bita_ix1(); - void lda_ix1(); - void sta_ix1(); - void eora_ix1(); - void adca_ix1(); - void ora_ix1(); - void adda_ix1(); - void jmp_ix1(); - void jsr_ix1(); - void ldx_ix1(); - void stx_ix1(); - void suba_ix(); - void cmpa_ix(); - void sbca_ix(); - void cpx_ix(); - void anda_ix(); - void bita_ix(); - void lda_ix(); - void sta_ix(); - void eora_ix(); - void adca_ix(); - void ora_ix(); - void adda_ix(); - void jmp_ix(); - void jsr_ix(); - void ldx_ix(); - void stx_ix(); + template <addr_mode M> void suba(); + template <addr_mode M> void cmpa(); + template <addr_mode M> void sbca(); + template <addr_mode M> void cpx(); + template <addr_mode M> void anda(); + template <addr_mode M> void bita(); + template <addr_mode M> void lda(); + template <addr_mode M> void sta(); + template <addr_mode M> void eora(); + template <addr_mode M> void adca(); + template <addr_mode M> void ora(); + template <addr_mode M> void adda(); + template <addr_mode M> void jmp(); + template <addr_mode M> void jsr(); + template <addr_mode M> void ldx(); + template <addr_mode M> void stx(); void illegal(); virtual void interrupt(); virtual void interrupt_vector(); - const char *m_tag; + configuration_params const m_params; // address spaces - const address_space_config m_program_config; + address_space_config const m_program_config; // CPU registers - PAIR m_ea; /* effective address */ + PAIR m_ea; // effective address (should really be a temporary in opcode handlers) - uint32_t m_sp_mask; /* Stack pointer address mask */ - uint32_t m_sp_low; /* Stack pointer low water mark (or floor) */ - PAIR m_pc; /* Program counter */ - PAIR m_s; /* Stack pointer */ - uint8_t m_a; /* Accumulator */ - uint8_t m_x; /* Index register */ - uint8_t m_cc; /* Condition codes */ + PAIR m_pc; // Program counter + PAIR m_s; // Stack pointer + u8 m_a; // Accumulator + u8 m_x; // Index register + u8 m_cc; // Condition codes uint16_t m_pending_interrupts; /* MB */ @@ -307,8 +295,7 @@ class m6805_device : public m6805_base_device { public: // construction/destruction - m6805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m6805_base_device(mconfig, tag, owner, clock, M6805, "M6805", 12, "m6805", __FILE__) { } + m6805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: virtual void execute_set_input(int inputnum, int state) override; @@ -321,8 +308,7 @@ class m68hc05eg_device : public m6805_base_device { public: // construction/destruction - m68hc05eg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m6805_base_device(mconfig, tag, owner, clock, M68HC05EG, "M68HC05EG", 13, "m68hc05eg", __FILE__) { } + m68hc05eg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -339,8 +325,7 @@ class hd63705_device : public m6805_base_device { public: // construction/destruction - hd63705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m6805_base_device(mconfig, tag, owner, clock, HD63705, "HD63705", 16, "hd63705", __FILE__) { } + hd63705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -353,7 +338,6 @@ protected: // opcodes virtual void bil() override; virtual void bih() override; - virtual void swi() override; }; #define M6805_IRQ_LINE 0 @@ -393,5 +377,7 @@ protected: #define HD63705_INT_NMI 0x08 CPU_DISASSEMBLE( m6805 ); +CPU_DISASSEMBLE( m146805 ); +CPU_DISASSEMBLE( m68hc05 ); #endif // MAME_CPU_M6805_M6805_H diff --git a/src/devices/cpu/m6805/m6805defs.h b/src/devices/cpu/m6805/m6805defs.h index 2fc83194500..670beda2683 100644 --- a/src/devices/cpu/m6805/m6805defs.h +++ b/src/devices/cpu/m6805/m6805defs.h @@ -5,101 +5,72 @@ #pragma once -/****************************************************************************/ -/* Read a byte from given memory location */ -/****************************************************************************/ -#define M6805_RDMEM(addr) ((unsigned)m_program->read_byte(addr)) - -/****************************************************************************/ -/* Write a byte to given memory location */ -/****************************************************************************/ -#define M6805_WRMEM(addr, value) (m_program->write_byte(addr, value)) - -/****************************************************************************/ -/* M6805_RDOP() is identical to M6805_RDMEM() except it is used for reading */ -/* opcodes. In case of system with memory mapped I/O, this function can be */ -/* used to greatly speed up emulation */ -/****************************************************************************/ -#define M6805_RDOP(addr) ((unsigned)m_direct->read_byte(addr)) - -/****************************************************************************/ -/* M6805_RDOP_ARG() is identical to M6805_RDOP() but it's used for reading */ -/* opcode arguments. This difference can be used to support systems that */ -/* use different encoding mechanisms for opcodes and opcode arguments */ -/****************************************************************************/ -#define M6805_RDOP_ARG(addr) ((unsigned)m_direct->read_byte(addr)) - -#define SP_MASK m_sp_mask /* stack pointer mask */ -#define SP_LOW m_sp_low /* stack pointer low water mark */ -#define PC m_pc.w.l /* program counter lower word */ -#define S m_s.w.l /* stack pointer lower word */ -#define A m_a /* accumulator */ -#define X m_x /* index register */ -#define CC m_cc /* condition codes */ - -#define EAD m_ea.d -#define EA m_ea.w.l - - -/* DS -- THESE ARE RE-DEFINED IN m6805.h TO RAM, ROM or FUNCTIONS IN cpuintrf.c */ -#define RM(addr) M6805_RDMEM(addr) -#define WM(addr, value) M6805_WRMEM(addr, value) -#define M_RDOP(addr) M6805_RDOP(addr) -#define M_RDOP_ARG(addr) M6805_RDOP_ARG(addr) +#define SP_MASK m_params.m_sp_mask // stack pointer mask +#define SP_LOW m_params.m_sp_floor // stack pointer low water mark +#define PC m_pc.w.l // program counter lower word +#define S m_s.w.l // stack pointer lower word +#define A m_a // accumulator +#define X m_x // index register +#define CC m_cc // condition codes + +#define EAD m_ea.d +#define EA m_ea.w.l + +// pre-clear a PAIR union; clearing h2 and h3 only might be faster? +inline void clear_pair(PAIR &p) { p.d = 0; } /* macros to tweak the PC and SP */ -#define SP_INC if( ++S > SP_MASK) S = SP_LOW -#define SP_DEC if( --S < SP_LOW) S = SP_MASK -#define SP_ADJUST(s) ( ( (s) & SP_MASK ) | SP_LOW ) +#define SP_INC if (++S > SP_MASK) S = SP_LOW +#define SP_DEC if (--S < SP_LOW) S = SP_MASK +#define SP_ADJUST(s) (((s) & SP_MASK) | SP_LOW) + +inline void m6805_base_device::rm16(u32 addr, PAIR &p) +{ + clear_pair(p); + p.b.h = rm(addr); + p.b.l = rm(addr + 1); +} + +inline void m6805_base_device::pushbyte(u8 b) +{ + wm(S, b); + SP_DEC; +} + +inline void m6805_base_device::pushword(PAIR const &p) +{ + pushbyte(p.b.l); + pushbyte(p.b.h); +} + +inline void m6805_base_device::pullbyte(u8 &b) +{ + SP_INC; + b = rm(S); +} + +inline void m6805_base_device::pullword(PAIR &p) +{ + clear_pair(p); + pullbyte(p.b.h); + pullbyte(p.b.l); +} /* macros to access memory */ -#define IMMBYTE(b) {b = M_RDOP_ARG(PC++);} -#define IMMWORD(w) {w.d = 0; w.b.h = M_RDOP_ARG(PC); w.b.l = M_RDOP_ARG(PC+1); PC+=2;} -#define SKIPBYTE() {M_RDOP_ARG(PC++);} - -#define PUSHBYTE(b) wr_s_handler_b(&b) -#define PUSHWORD(w) wr_s_handler_w(&w) -#define PULLBYTE(b) rd_s_handler_b(&b) -#define PULLWORD(w) rd_s_handler_w(&w) - -/* CC masks H INZC - 7654 3210 */ -#define CFLAG 0x01 -#define ZFLAG 0x02 -#define NFLAG 0x04 -#define IFLAG 0x08 -#define HFLAG 0x10 - -#define CLR_NZ CC&=~(NFLAG|ZFLAG) -#define CLR_HNZC CC&=~(HFLAG|NFLAG|ZFLAG|CFLAG) -#define CLR_Z CC&=~(ZFLAG) -#define CLR_NZC CC&=~(NFLAG|ZFLAG|CFLAG) -#define CLR_ZC CC&=~(ZFLAG|CFLAG) - -/* macros for CC -- CC bits affected should be reset before calling */ -#define SET_Z(a) if(!a)SEZ -#define SET_Z8(a) SET_Z((uint8_t)a) -#define SET_N8(a) CC|=((a&0x80)>>5) -#define SET_H(a,b,r) CC|=((a^b^r)&0x10) -#define SET_C8(a) CC|=((a&0x100)>>8) - -#define SET_FLAGS8I(a) {CC |= m_flags8i[(a) & 0xff];} -#define SET_FLAGS8D(a) {CC |= m_flags8d[(a) & 0xff];} - -/* combos */ -#define SET_NZ8(a) {SET_N8(a); SET_Z(a);} -#define SET_FLAGS8(a,b,r) {SET_N8(r); SET_Z8(r); SET_C8(r);} +template <typename T> inline void m6805_base_device::immbyte(T &b) { b = rdop_arg(PC++); } +inline void m6805_base_device::immword(PAIR &w) { w.d = 0; immbyte(w.b.h); immbyte(w.b.l); } +inline void m6805_base_device::skipbyte() { rdop_arg(PC++); } /* for treating an unsigned uint8_t as a signed int16_t */ -#define SIGNED(b) ((int16_t)(b & 0x80 ? b | 0xff00 : b)) +#define SIGNED(b) (int16_t(b & 0x80 ? b | 0xff00 : b)) /* Macros for addressing modes */ -#define DIRECT EAD=0; IMMBYTE(m_ea.b.l) -#define IMM8 EA = PC++ -#define EXTENDED IMMWORD(m_ea) -#define INDEXED EA = X -#define INDEXED1 {EAD = 0; IMMBYTE(m_ea.b.l); EA += X;} -#define INDEXED2 {IMMWORD(m_ea); EA += X;} +#define DIRECT do { EAD=0; immbyte(m_ea.b.l); } while (false) +#define IMM8 do { EA = PC++; } while (false) +#define EXTENDED immword(m_ea) +#define INDEXED do { EA = X; } while (false) +#define INDEXED1 do { EAD = 0; immbyte(m_ea.b.l); EA += X; } while (false) +#define INDEXED2 do { immword(m_ea); EA += X;} while (false) /* macros to set status flags */ #if defined(SEC) @@ -117,16 +88,53 @@ #define CLI CC &=~ IFLAG /* macros for convenience */ -#define DIRBYTE(b) {DIRECT; b = RM(EAD);} -#define EXTBYTE(b) {EXTENDED; b = RM(EAD);} -#define IDXBYTE(b) {INDEXED; b = RM(EAD);} -#define IDX1BYTE(b) {INDEXED1; b = RM(EAD);} -#define IDX2BYTE(b) {INDEXED2; b = RM(EAD);} +#define ARGADDR \ + do { switch (M) { \ + case addr_mode::IM: static_assert(addr_mode::IM != M, "invalid mode for this instruction"); break; \ + case addr_mode::DI: DIRECT; break; \ + case addr_mode::EX: EXTENDED; break; \ + case addr_mode::IX: INDEXED; break; \ + case addr_mode::IX1: INDEXED1; break; \ + case addr_mode::IX2: INDEXED2; break; \ + } } while (false) +#define DIRBYTE(b) do { DIRECT; b = rm(EAD); } while (false) +#define EXTBYTE(b) do { EXTENDED; b = rm(EAD); } while (false) +#define IDXBYTE(b) do { INDEXED; b = rm(EAD); } while (false) +#define IDX1BYTE(b) do { INDEXED1; b = rm(EAD); } while (false) +#define IDX2BYTE(b) do { INDEXED2; b = rm(EAD); } while (false) +#define ARGBYTE(b) \ + do { switch (M) { \ + case addr_mode::IM: immbyte(b); break; \ + case addr_mode::DI: DIRBYTE(b); break; \ + case addr_mode::EX: EXTBYTE(b); break; \ + case addr_mode::IX: IDXBYTE(b); break; \ + case addr_mode::IX1: IDX1BYTE(b); break; \ + case addr_mode::IX2: IDX2BYTE(b); break; \ + default: b = 0; break; \ + } } while (false) + /* Macros for branch instructions */ -#define BRANCH(f) { uint8_t t; IMMBYTE(t); if(f) { PC += SIGNED(t); } } +#define BRANCH(f) do { u8 t; immbyte(t); if (bool(f) == bool(C)) PC += SIGNED(t); } while (false) -/* pre-clear a PAIR union; clearing h2 and h3 only might be faster? */ -#define CLEAR_PAIR(p) p->d = 0 +offs_t CPU_DISASSEMBLE_NAME(m146805)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const symbols[], + std::size_t symbol_count); + +offs_t CPU_DISASSEMBLE_NAME(m68hc05)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const symbols[], + std::size_t symbol_count); offs_t CPU_DISASSEMBLE_NAME(m6805)( cpu_device *device, @@ -151,4 +159,30 @@ inline offs_t CPU_DISASSEMBLE_NAME(m6805)( return CPU_DISASSEMBLE_NAME(m6805)(device, stream, pc, oprom, opram, options, symbols, N); } +template <size_t N> +inline offs_t CPU_DISASSEMBLE_NAME(m146805)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const (&symbols)[N]) +{ + return CPU_DISASSEMBLE_NAME(m146805)(device, stream, pc, oprom, opram, options, symbols, N); +} + +template <size_t N> +inline offs_t CPU_DISASSEMBLE_NAME(m68hc05)( + cpu_device *device, + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + int options, + std::pair<u16, char const *> const (&symbols)[N]) +{ + return CPU_DISASSEMBLE_NAME(m68hc05)(device, stream, pc, oprom, opram, options, symbols, N); +} + #endif // MAME_CPU_M6805_M6805DEFS_H diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp index b678954e386..bcb2d1a858b 100644 --- a/src/devices/cpu/m6805/m68705.cpp +++ b/src/devices/cpu/m6805/m68705.cpp @@ -1,7 +1,29 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb #include "emu.h" #include "m68705.h" #include "m6805defs.h" +/**************************************************************************** + * Configurable logging + ****************************************************************************/ + +#define LOG_GENERAL (1U << 0) +#define LOG_INT (1U << 1) +#define LOG_IOPORT (1U << 2) +#define LOG_TIMER (1U << 3) +#define LOG_EPROM (1U << 4) + +//#define VERBOSE (LOG_GENERAL | LOG_IOPORT | LOG_TIMER | LOG_EPROM) +//#define LOG_OUTPUT_FUNC printf +#include "logmacro.h" + +#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__) +#define LOGIOPORT(...) LOGMASKED(LOG_IOPORT, __VA_ARGS__) +#define LOGTIMER(...) LOGMASKED(LOG_TIMER, __VA_ARGS__) +#define LOGEPROM(...) LOGMASKED(LOG_EPROM, __VA_ARGS__) + + namespace { std::pair<u16, char const *> const m68705p_syms[] = { @@ -41,7 +63,7 @@ ROM_END ROM_START( m68705r3 ) ROM_REGION(0x0078, "bootstrap", 0) - ROM_LOAD("bootstrap.bin", 0x0000, 0x0078, CRC(5946479b) SHA1(834ea00aef5de12dbcd6421a6e21d5ea96cfbf37) BAD_DUMP) + ROM_LOAD("bootstrap.bin", 0x0000, 0x0078, CRC(5946479b) SHA1(834ea00aef5de12dbcd6421a6e21d5ea96cfbf37)) ROM_END ROM_START( m68705u3 ) @@ -49,90 +71,30 @@ ROM_START( m68705u3 ) ROM_LOAD("bootstrap.bin", 0x0000, 0x0078, CRC(5946479b) SHA1(834ea00aef5de12dbcd6421a6e21d5ea96cfbf37)) ROM_END -} // anonymous namespace +constexpr u16 M68705_VECTOR_BOOTSTRAP = 0xfff6; +constexpr u16 M68705_VECTOR_TIMER = 0xfff8; +//constexpr u16 M68705_VECTOR_INT2 = 0xfff8; +constexpr u16 M68705_VECTOR_INT = 0xfffa; +constexpr u16 M68705_VECTOR_SWI = 0xfffc; +constexpr u16 M68705_VECTOR_RESET = 0xfffe; +constexpr u16 M68705_INT_MASK = 0x03; -device_type const M68705 = &device_creator<m68705_device>; -device_type const M68705P3 = &device_creator<m68705p3_device>; -device_type const M68705P5 = &device_creator<m68705p5_device>; -device_type const M68705R3 = &device_creator<m68705r3_device>; -device_type const M68705U3 = &device_creator<m68705u3_device>; +} // anonymous namespace /**************************************************************************** - * M68705 device (no peripherals) + * Global variables ****************************************************************************/ -m68705_device::m68705_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) - : m6805_base_device(mconfig, tag, owner, clock, M68705, "M68705", 12, "m68705", __FILE__) -{ -} - -m68705_device::m68705_device( - machine_config const &mconfig, - char const *tag, - device_t *owner, - u32 clock, - device_type type, - char const *name, - u32 addr_width, - address_map_delegate internal_map, - char const *shortname, - char const *source) - : m6805_base_device(mconfig, tag, owner, clock, type, name, addr_width, internal_map, shortname, source) -{ -} - -/* Generate interrupt - m68705 version */ -void m68705_device::interrupt() -{ - if ((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | M68705_INT_MASK)) != 0 ) - { - if ((CC & IFLAG) == 0) - { - PUSHWORD(m_pc); - PUSHBYTE(m_x); - PUSHBYTE(m_a); - PUSHBYTE(m_cc); - SEI; - standard_irq_callback(0); - - if ((m_pending_interrupts & (1 << M68705_IRQ_LINE)) != 0 ) - { - m_pending_interrupts &= ~(1 << M68705_IRQ_LINE); - RM16(0xfffa, &m_pc); - } - else if ((m_pending_interrupts & (1 << M68705_INT_TIMER)) != 0) - { - m_pending_interrupts &= ~(1 << M68705_INT_TIMER); - RM16(0xfff8, &m_pc); - } - } - m_icount -= 11; - } -} - -void m68705_device::device_reset() -{ - m6805_base_device::device_reset(); - - RM16(0xfffe, &m_pc); -} - -void m68705_device::execute_set_input(int inputnum, int state) -{ - if (m_irq_state[inputnum] != state) - { - m_irq_state[inputnum] = (state == ASSERT_LINE) ? ASSERT_LINE : CLEAR_LINE; - - if (state != CLEAR_LINE) - m_pending_interrupts |= 1 << inputnum; - } -} +device_type const M68705P3 = &device_creator<m68705p3_device>; +device_type const M68705P5 = &device_creator<m68705p5_device>; +device_type const M68705R3 = &device_creator<m68705r3_device>; +device_type const M68705U3 = &device_creator<m68705u3_device>; /**************************************************************************** - * M68705 "new" device + * M68705 base device ****************************************************************************/ /* @@ -223,7 +185,7 @@ Ux Parts: */ -m68705_new_device::m68705_new_device( +m68705_device::m68705_device( machine_config const &mconfig, char const *tag, device_t *owner, @@ -234,7 +196,17 @@ m68705_new_device::m68705_new_device( address_map_delegate internal_map, char const *shortname, char const *source) - : m68705_device(mconfig, tag, owner, clock, type, name, addr_width, internal_map, shortname, source) + : m6805_base_device( + mconfig, + tag, + owner, + clock, + type, + name, + { s_hmos_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, M68705_VECTOR_SWI }, + internal_map, + shortname, + source) , device_nvram_interface(mconfig, *this) , m_user_rom(*this, DEVICE_SELF, u32(1) << addr_width) , m_port_open_drain{ false, false, false, false } @@ -254,14 +226,20 @@ m68705_new_device::m68705_new_device( { } -template <offs_t B> READ8_MEMBER(m68705_new_device::eprom_r) +template <offs_t B> READ8_MEMBER(m68705_device::eprom_r) { + if (pcr_vpon() && !pcr_ple()) + LOGEPROM("read EPROM %04X prevented when Vpp high and /PLE = 0\n", B + offset); + // read locked out when /VPON and /PLE are asserted return (!pcr_vpon() || !pcr_ple()) ? m_user_rom[B + offset] : 0xff; } -template <offs_t B> WRITE8_MEMBER(m68705_new_device::eprom_w) +template <offs_t B> WRITE8_MEMBER(m68705_device::eprom_w) { + LOGEPROM("EPROM programming latch write%s%s: %04X = %02\n", + !pcr_vpon() ? " [Vpp low]" : "", !pcr_ple() ? " [disabled]" : "", B + offset, data); + // programming latch enabled when /VPON and /PLE are asserted if (pcr_vpon() && pcr_ple()) { @@ -273,70 +251,85 @@ template <offs_t B> WRITE8_MEMBER(m68705_new_device::eprom_w) else { // this causes undefined behaviour, which is bad when EPROM programming is involved - logerror("warning: write to EPROM when /PGE = 0 (%x = %x)\n", B + offset, data); + logerror("warning: write to EPROM when /PGE = 0 (%04X = %02X)\n", B + offset, data); } } } -template <std::size_t N> void m68705_new_device::set_port_open_drain(bool value) +template <std::size_t N> void m68705_device::set_port_open_drain(bool value) { m_port_open_drain[N] = value; } -template <std::size_t N> void m68705_new_device::set_port_mask(u8 mask) +template <std::size_t N> void m68705_device::set_port_mask(u8 mask) { + if (configured() || started()) + throw emu_fatalerror("Attempt to set physical port mask after configuration"); m_port_mask[N] = mask; } -template <std::size_t N> READ8_MEMBER(m68705_new_device::port_r) +template <std::size_t N> READ8_MEMBER(m68705_device::port_r) { - if (!m_port_cb_r[N].isnull()) m_port_input[N] = m_port_cb_r[N](space, 0, ~m_port_ddr[N]); + if (!m_port_cb_r[N].isnull()) + { + u8 const newval(m_port_cb_r[N](space, 0, ~m_port_ddr[N] & ~m_port_mask[N]) & ~m_port_mask[N]); + if (newval != m_port_input[N]) + { + LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n", + char('A' + N), newval, ~m_port_ddr[N] & ~m_port_mask[N], m_port_input[N]); + } + m_port_input[N] = newval; + } return m_port_mask[N] | (m_port_latch[N] & m_port_ddr[N]) | (m_port_input[N] & ~m_port_ddr[N]); } -template <std::size_t N> WRITE8_MEMBER(m68705_new_device::port_latch_w) +template <std::size_t N> WRITE8_MEMBER(m68705_device::port_latch_w) { data &= ~m_port_mask[N]; u8 const diff = m_port_latch[N] ^ data; + if (diff) + LOGIOPORT("write PORT%c latch: %02X & %02X (was %02X)\n", char('A' + N), data, m_port_ddr[N], m_port_latch[N]); m_port_latch[N] = data; if (diff & m_port_ddr[N]) port_cb_w<N>(); } -template <std::size_t N> WRITE8_MEMBER(m68705_new_device::port_ddr_w) +template <std::size_t N> WRITE8_MEMBER(m68705_device::port_ddr_w) { data &= ~m_port_mask[N]; if (data != m_port_ddr[N]) { + LOGIOPORT("write DDR%c: %02X (was %02X)\n", char('A' + N), data, m_port_ddr[N]); m_port_ddr[N] = data; port_cb_w<N>(); } } -template <std::size_t N> void m68705_new_device::port_cb_w() +template <std::size_t N> void m68705_device::port_cb_w() { u8 const data(m_port_open_drain[N] ? m_port_latch[N] | ~m_port_ddr[N] : m_port_latch[N]); u8 const mask(m_port_open_drain[N] ? (~m_port_latch[N] & m_port_ddr[N]) : m_port_ddr[N]); m_port_cb_w[N](space(AS_PROGRAM), 0, data, mask); } -READ8_MEMBER(m68705_new_device::tdr_r) +READ8_MEMBER(m68705_device::tdr_r) { return m_tdr; } -WRITE8_MEMBER(m68705_new_device::tdr_w) +WRITE8_MEMBER(m68705_device::tdr_w) { + LOGTIMER("write TDR: %02X * (1 << %u)\n", data, tcr_ps()); m_tdr = data; } -READ8_MEMBER(m68705_new_device::tcr_r) +READ8_MEMBER(m68705_device::tcr_r) { // in MOR controlled mode, only TIR, TIM and TOPT are visible return m_tcr | (tcr_topt() ? 0x37 : 0x00); } -WRITE8_MEMBER(m68705_new_device::tcr_w) +WRITE8_MEMBER(m68705_device::tcr_w) { // 7 TIR RW Timer Interrupt Request Status // 6 TIM RW Timer Interrupt Mask @@ -363,39 +356,42 @@ WRITE8_MEMBER(m68705_new_device::tcr_w) if (tcr_topt()) { - m_tcr = (m_tcr & 0x3f) | (data & 0xc0); + LOGTIMER("write TCR: TIR=%u (%s) TIM=%u\n", + BIT(data, 7), (tcr_tir() && !BIT(data, 7)) ? "cleared" : "unaffected", BIT(data, 6)); + m_tcr = (m_tcr & ((data & 0x80) | 0x3f)) | (data & 0x40); } else { + LOGTIMER("write TCR: TIR=%u (%s) TIM=%u TIN=%u TIE=%u PSC=%u PS=(1 << %u)\n", + BIT(data, 7), (tcr_tir() && !BIT(data, 7)) ? "cleared" : "unaffected", BIT(data, 6), + BIT(data, 5), BIT(data, 4), + BIT(data, 3), data & 0x07); if (BIT(data, 3)) m_prescaler = 0; - m_tcr = (m_tcr & 0x08) | (data & 0xf7); + m_tcr = (m_tcr & ((data & 0x80) | 0x08)) | (data & 0x77); } - // TODO: this is tied up with /INT2 on R/U devices - if (tcr_tir() && !tcr_tim()) - set_input_line(M68705_INT_TIMER, ASSERT_LINE); - else - set_input_line(M68705_INT_TIMER, CLEAR_LINE); + // this is a level-sensitive interrupt (unlike the edge-triggered inputs) + execute_set_input(M68705_INT_TIMER, (tcr_tir() && !tcr_tim()) ? ASSERT_LINE : CLEAR_LINE); } -READ8_MEMBER(m68705_new_device::misc_r) +READ8_MEMBER(m68705_device::misc_r) { logerror("unsupported read MISC\n"); return 0xff; } -WRITE8_MEMBER(m68705_new_device::misc_w) +WRITE8_MEMBER(m68705_device::misc_w) { logerror("unsupported write MISC = %02X\n", data); } -READ8_MEMBER(m68705_new_device::pcr_r) +READ8_MEMBER(m68705_device::pcr_r) { return m_pcr; } -WRITE8_MEMBER(m68705_new_device::pcr_w) +WRITE8_MEMBER(m68705_device::pcr_w) { // 7 1 // 6 1 @@ -406,23 +402,30 @@ WRITE8_MEMBER(m68705_new_device::pcr_w) // 1 /PGE RW Program Enable // 0 /PLE RW Programming Latch Enable + LOGEPROM("write PCR: /PGE=%u%s /PLE=%u\n", BIT(data, 1), BIT(data, 0) ? " [inhibited]" : "", BIT(data, 0)); + // lock out /PGE if /PLE is not asserted data |= ((data & 0x01) << 1); // write EPROM if /PGE is asserted (erase requires UV so don't clear bits) - if (pcr_vpon() && !pcr_pge() && !BIT(data, 1)) - m_user_rom[m_pl_addr] |= m_pl_data; + if (!pcr_pge() && !BIT(data, 1)) + { + LOGEPROM("write EPROM%s: %04X = %02X | %02X\n", + pcr_vpon() ? "" : " prevented when Vpp low", m_pl_addr, m_pl_data, m_user_rom[m_pl_addr]); + if (pcr_vpon()) + m_user_rom[m_pl_addr] |= m_pl_data; + } m_pcr = (m_pcr & 0xfc) | (data & 0x03); } -READ8_MEMBER(m68705_new_device::acr_r) +READ8_MEMBER(m68705_device::acr_r) { logerror("unsupported read ACR\n"); return 0xff; } -WRITE8_MEMBER(m68705_new_device::acr_w) +WRITE8_MEMBER(m68705_device::acr_w) { // 7 conversion complete // 6 @@ -450,20 +453,20 @@ WRITE8_MEMBER(m68705_new_device::acr_w) logerror("unsupported write ACR = %02X\n", data); } -READ8_MEMBER(m68705_new_device::arr_r) +READ8_MEMBER(m68705_device::arr_r) { logerror("unsupported read ARR\n"); return 0xff; } -WRITE8_MEMBER(m68705_new_device::arr_w) +WRITE8_MEMBER(m68705_device::arr_w) { logerror("unsupported write ARR = %02X\n", data); } -void m68705_new_device::device_start() +void m68705_device::device_start() { - m68705_device::device_start(); + m6805_base_device::device_start(); save_item(NAME(m_port_input)); save_item(NAME(m_port_latch)); @@ -496,9 +499,9 @@ void m68705_new_device::device_start() m_pl_addr = 0xffff; } -void m68705_new_device::device_reset() +void m68705_device::device_reset() { - m68705_device::device_reset(); + m6805_base_device::device_reset(); // reset digital I/O port_ddr_w<0>(space(AS_PROGRAM), 0, 0x00, 0xff); @@ -516,10 +519,18 @@ void m68705_new_device::device_reset() m_pcr |= 0xfb; // b2 (/VPON) is driven by external input and hence unaffected by reset if (CLEAR_LINE != m_vihtp) - RM16(0xfff6, &m_pc); + { + LOG("loading bootstrap vector\n"); + rm16(M68705_VECTOR_BOOTSTRAP, m_pc); + } + else + { + LOG("loading reset vector\n"); + rm16(M68705_VECTOR_RESET, m_pc); + } } -void m68705_new_device::execute_set_input(int inputnum, int state) +void m68705_device::execute_set_input(int inputnum, int state) { switch (inputnum) { @@ -531,25 +542,67 @@ void m68705_new_device::execute_set_input(int inputnum, int state) m_vihtp = (ASSERT_LINE == state) ? ASSERT_LINE : CLEAR_LINE; break; default: - m68705_device::execute_set_input(inputnum, state); + if (m_irq_state[inputnum] != state) + { + m_irq_state[inputnum] = (state == ASSERT_LINE) ? ASSERT_LINE : CLEAR_LINE; + + if (state != CLEAR_LINE) + m_pending_interrupts |= 1 << inputnum; + else if (M68705_INT_TIMER == inputnum) + m_pending_interrupts &= ~(1 << inputnum); // this one's is level-sensitive + } } } -void m68705_new_device::nvram_default() +void m68705_device::nvram_default() { } -void m68705_new_device::nvram_read(emu_file &file) +void m68705_device::nvram_read(emu_file &file) { file.read(&m_user_rom[0], m_user_rom.bytes()); } -void m68705_new_device::nvram_write(emu_file &file) +void m68705_device::nvram_write(emu_file &file) { file.write(&m_user_rom[0], m_user_rom.bytes()); } -void m68705_new_device::burn_cycles(unsigned count) +void m68705_device::interrupt() +{ + if (m_pending_interrupts & M68705_INT_MASK) + { + if ((CC & IFLAG) == 0) + { + pushword(m_pc); + pushbyte(m_x); + pushbyte(m_a); + pushbyte(m_cc); + SEI; + standard_irq_callback(0); + + if (BIT(m_pending_interrupts, M68705_IRQ_LINE)) + { + LOGINT("servicing /INT interrupt\n"); + m_pending_interrupts &= ~(1 << M68705_IRQ_LINE); + rm16(M68705_VECTOR_INT, m_pc); + } + else if (BIT(m_pending_interrupts, M68705_INT_TIMER)) + { + LOGINT("servicing timer/counter interrupt\n"); + rm16(M68705_VECTOR_TIMER, m_pc); + } + else + { + throw emu_fatalerror("Unknown pending interrupt"); + } + m_icount -= 11; + burn_cycles(11); + } + } +} + +void m68705_device::burn_cycles(unsigned count) { // handle internal timer/counter source if (!tcr_tin()) // TODO: check tcr_tie() and gate on TIMER if appropriate @@ -560,6 +613,7 @@ void m68705_new_device::burn_cycles(unsigned count) if (decrements && (decrements >= m_tdr)) { + LOGTIMER("timer/counter expired%s%s\n", tcr_tir() ? " [overrun]" : "", tcr_tim() ? " [masked]" : ""); m_tcr |= 0x80; if (!tcr_tim()) set_input_line(M68705_INT_TIMER, ASSERT_LINE); @@ -569,6 +623,30 @@ void m68705_new_device::burn_cycles(unsigned count) } } +template <std::size_t N> void m68705_device::add_port_latch_state() +{ + state_add(M68705_LATCHA + N, util::string_format("LATCH%c", 'A' + N).c_str(), m_port_latch[N]).mask(~m_port_mask[N] & 0xff); +} + +template <std::size_t N> void m68705_device::add_port_ddr_state() +{ + state_add(M68705_DDRA + N, util::string_format("DDR%c", 'A' + N).c_str(), m_port_ddr[N]).mask(~m_port_mask[N] & 0xff); +} + +void m68705_device::add_timer_state() +{ + state_add(M68705_PS, "PS", m_prescaler).mask(0x7f); + state_add(M68705_TDR, "TDR", m_tdr).mask(0xff); + state_add(M68705_TCR, "TCR", m_tcr).mask(0xff); +} + +void m68705_device::add_eprom_state() +{ + state_add(M68705_PCR, "PCR", m_pcr).mask(0xff); + state_add(M68705_PLA, "PLA", m_pl_addr).mask(0xffff); + state_add(M68705_PLD, "PLD", m_pl_data).mask(0xff); +} + /**************************************************************************** * M68705Px family @@ -606,13 +684,28 @@ m68705p_device::m68705p_device( char const *name, char const *shortname, char const *source) - : m68705_new_device(mconfig, tag, owner, clock, type, name, 11, address_map_delegate(FUNC(m68705p_device::p_map), this), shortname, source) + : m68705_device(mconfig, tag, owner, clock, type, name, 11, address_map_delegate(FUNC(m68705p_device::p_map), this), shortname, source) { set_port_open_drain<0>(true); // Port A is open drain with internal pull-ups set_port_mask<2>(0xf0); // Port C is four bits wide set_port_mask<3>(0xff); // Port D isn't present } +void m68705p_device::device_start() +{ + m68705_device::device_start(); + + add_port_latch_state<0>(); + add_port_latch_state<1>(); + add_port_latch_state<2>(); + add_port_ddr_state<0>(); + add_port_ddr_state<1>(); + add_port_ddr_state<2>(); + add_timer_state(); + add_eprom_state(); + state_add(M68705_MOR, "MOR", get_user_rom()[0x0784]).mask(0xff); +} + offs_t m68705p_device::disasm_disassemble( std::ostream &stream, offs_t pc, @@ -662,7 +755,7 @@ m68705u_device::m68705u_device( address_map_delegate internal_map, char const *shortname, char const *source) - : m68705_new_device(mconfig, tag, owner, clock, type, name, 12, internal_map, shortname, source) + : m68705_device(mconfig, tag, owner, clock, type, name, 12, internal_map, shortname, source) { set_port_open_drain<0>(true); // Port A is open drain with internal pull-ups } @@ -680,6 +773,24 @@ m68705u_device::m68705u_device( { } +void m68705u_device::device_start() +{ + m68705_device::device_start(); + + add_port_latch_state<0>(); + add_port_latch_state<1>(); + add_port_latch_state<2>(); + add_port_latch_state<3>(); + add_port_ddr_state<0>(); + add_port_ddr_state<1>(); + add_port_ddr_state<2>(); + add_timer_state(); + add_eprom_state(); + state_add(M68705_MOR, "MOR", get_user_rom()[0x0f38]).mask(0xff); + + // TODO: MISC register +} + offs_t m68705u_device::disasm_disassemble( std::ostream &stream, offs_t pc, @@ -734,6 +845,13 @@ m68705r_device::m68705r_device( { } +void m68705r_device::device_start() +{ + m68705u_device::device_start(); + + // TODO: ADC +} + offs_t m68705r_device::disasm_disassemble( std::ostream &stream, offs_t pc, @@ -801,7 +919,7 @@ tiny_rom_entry const *m68705r3_device::device_rom_region() const u8 m68705r3_device::get_mask_options() const { - return get_user_rom()[0x0784] & 0xf7; // no SNM bit + return get_user_rom()[0x0f38] & 0xf7; // no SNM bit } @@ -821,5 +939,5 @@ tiny_rom_entry const *m68705u3_device::device_rom_region() const u8 m68705u3_device::get_mask_options() const { - return get_user_rom()[0x0784] & 0xf7; // no SNM bit + return get_user_rom()[0x0f38] & 0xf7; // no SNM bit } diff --git a/src/devices/cpu/m6805/m68705.h b/src/devices/cpu/m6805/m68705.h index e89517e5735..6241079f912 100644 --- a/src/devices/cpu/m6805/m68705.h +++ b/src/devices/cpu/m6805/m68705.h @@ -7,11 +7,11 @@ #include "m6805.h" + //************************************************************************** // GLOBAL VARIABLES //************************************************************************** -extern device_type const M68705; extern device_type const M68705P3; extern device_type const M68705P5; extern device_type const M68705R3; @@ -24,80 +24,74 @@ extern device_type const M68705U3; // ======================> m68705_device -class m68705_device : public m6805_base_device -{ -public: - m68705_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); - -protected: - enum - { - M68705_A = M6805_A, - M68705_PC = M6805_PC, - M68705_S = M6805_S, - M68705_X = M6805_X, - M68705_CC = M6805_CC, - M68705_IRQ_STATE = M6805_IRQ_STATE - }; - - m68705_device( - machine_config const &mconfig, - char const *tag, - device_t *owner, - u32 clock, - device_type type, - char const *name, - u32 addr_width, - address_map_delegate internal_map, - char const *shortname, - char const *source); - - virtual void device_reset() override; - virtual void execute_set_input(int inputnum, int state) override; - virtual void interrupt() override; -}; - - -// ======================> m68705_new_device - #define MCFG_M68705_PORTA_R_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_r<0>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_r<0>(*device, DEVCB_##obj); #define MCFG_M68705_PORTB_R_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_r<1>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_r<1>(*device, DEVCB_##obj); #define MCFG_M68705_PORTC_R_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_r<2>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_r<2>(*device, DEVCB_##obj); #define MCFG_M68705_PORTD_R_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_r<3>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_r<3>(*device, DEVCB_##obj); #define MCFG_M68705_PORTA_W_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_w<0>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_w<0>(*device, DEVCB_##obj); #define MCFG_M68705_PORTB_W_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_w<1>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_w<1>(*device, DEVCB_##obj); #define MCFG_M68705_PORTC_W_CB(obj) \ - devcb = &m68705_new_device::set_port_cb_w<2>(*device, DEVCB_##obj); + devcb = &m68705_device::set_port_cb_w<2>(*device, DEVCB_##obj); -class m68705_new_device : public m68705_device, public device_nvram_interface +class m68705_device : public m6805_base_device, public device_nvram_interface { public: // static configuration helpers template<std::size_t N, typename Object> static devcb_base &set_port_cb_r(device_t &device, Object &&obj) - { return downcast<m68705_new_device &>(device).m_port_cb_r[N].set_callback(std::forward<Object>(obj)); } + { return downcast<m68705_device &>(device).m_port_cb_r[N].set_callback(std::forward<Object>(obj)); } template<std::size_t N, typename Object> static devcb_base &set_port_cb_w(device_t &device, Object &&obj) - { return downcast<m68705_new_device &>(device).m_port_cb_w[N].set_callback(std::forward<Object>(obj)); } + { return downcast<m68705_device &>(device).m_port_cb_w[N].set_callback(std::forward<Object>(obj)); } protected: + // state index constants + enum + { + M68705_A = M6805_A, + M68705_PC = M6805_PC, + M68705_S = M6805_S, + M68705_X = M6805_X, + M68705_CC = M6805_CC, + M68705_IRQ_STATE = M6805_IRQ_STATE, + + M68705_LATCHA = 0x10, + M68705_LATCHB, + M68705_LATCHC, + M68705_LATCHD, + M68705_DDRA, + M68705_DDRB, + M68705_DDRC, + M68705_DDRD, + + M68705_PS, + M68705_TDR, + M68705_TCR, + + M68705_PCR, + M68705_PLD, + M68705_PLA, + + M68705_MOR + }; + enum { PORT_COUNT = 4 }; - m68705_new_device( + m68705_device( machine_config const &mconfig, char const *tag, device_t *owner, @@ -143,11 +137,17 @@ protected: virtual void nvram_read(emu_file &file) override; virtual void nvram_write(emu_file &file) override; + virtual void interrupt() override; virtual void burn_cycles(unsigned count) override; u8 *const get_user_rom() const { return &m_user_rom[0]; } virtual u8 get_mask_options() const = 0; + template <std::size_t N> void add_port_latch_state(); + template <std::size_t N> void add_port_ddr_state(); + void add_timer_state(); + void add_eprom_state(); + private: bool tcr_tir() const { return BIT(m_tcr, 7); } bool tcr_tim() const { return BIT(m_tcr, 6); } @@ -186,7 +186,7 @@ private: // ======================> m68705p_device -class m68705p_device : public m68705_new_device +class m68705p_device : public m68705_device { public: DECLARE_WRITE8_MEMBER(pa_w) { port_input_w<0>(space, offset, data, mem_mask); } @@ -206,6 +206,8 @@ protected: char const *shortname, char const *source); + virtual void device_start() override; + virtual offs_t disasm_disassemble( std::ostream &stream, offs_t pc, @@ -217,7 +219,7 @@ protected: // ======================> m68705u_device -class m68705u_device : public m68705_new_device +class m68705u_device : public m68705_device { public: DECLARE_WRITE8_MEMBER(pa_w) { port_input_w<0>(space, offset, data, mem_mask); } @@ -248,6 +250,8 @@ protected: char const *shortname, char const *source); + virtual void device_start() override; + virtual offs_t disasm_disassemble( std::ostream &stream, offs_t pc, @@ -277,6 +281,8 @@ protected: char const *shortname, char const *source); + virtual void device_start() override; + virtual offs_t disasm_disassemble( std::ostream &stream, offs_t pc, @@ -346,7 +352,6 @@ protected: * 68705 section ****************************************************************************/ -#define M68705_INT_MASK 0x03 #define M68705_IRQ_LINE (M6805_IRQ_LINE + 0) #define M68705_INT_TIMER (M6805_IRQ_LINE + 1) #define M68705_VPP_LINE (M6805_IRQ_LINE + 2) diff --git a/src/devices/cpu/m6805/m68hc05.cpp b/src/devices/cpu/m6805/m68hc05.cpp new file mode 100644 index 00000000000..c1821965736 --- /dev/null +++ b/src/devices/cpu/m6805/m68hc05.cpp @@ -0,0 +1,961 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/* +High-speed CMOS 6805-compatible microcontrollers + +The M68HC05 family uses the M6805 instruction set with a few additions +but runs at two clocks per machine cycle, and has incompatible on-board +peripherals. It comes in mask ROM (M68HC05), EPROM (M68HC705) and +EEPROM (M68HC805) variants. The suffix gives some indication of the +memory sizes and on-board peripherals, but there's not a lot of +consistency across the ROM/EPROM/EEPROM variants. + +All devices in this family have a 16-bit free-running counter fed from +the internal clock. The counter value can be captured on an input edge, +and an output can be automatically set when the counter reaches a +certain value. +*/ +#include "emu.h" +#include "m68hc05.h" +#include "m6805defs.h" + + +/**************************************************************************** + * Configurable logging + ****************************************************************************/ + +#define LOG_GENERAL (1U << 0) +#define LOG_INT (1U << 1) +#define LOG_IOPORT (1U << 2) +#define LOG_TIMER (1U << 3) +#define LOG_COP (1U << 4) + +//#define VERBOSE (LOG_GENERAL | LOG_INT | LOG_IOPORT | LOG_TIMER | LOG_COP) +//#define LOG_OUTPUT_FUNC printf +#include "logmacro.h" + +#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__) +#define LOGIOPORT(...) LOGMASKED(LOG_IOPORT, __VA_ARGS__) +#define LOGTIMER(...) LOGMASKED(LOG_TIMER, __VA_ARGS__) +#define LOGCOP(...) LOGMASKED(LOG_COP, __VA_ARGS__) + + +namespace { + +std::pair<u16, char const *> const m68hc05c4_syms[] = { + { 0x0000, "PORTA" }, { 0x0001, "PORTB" }, { 0x0002, "PORTC" }, { 0x0003, "PORTD" }, + { 0x0004, "DDRA" }, { 0x0005, "DDRB" }, { 0x0006, "DDRC" }, + { 0x000a, "SPCR" }, { 0x000b, "SPSR" }, { 0x000c, "SPDR" }, + { 0x000d, "BAUD" }, { 0x000e, "SCCR1" }, { 0x000f, "SCCR2" }, { 0x0010, "SCSR" }, { 0x0011, "SCDR" }, + { 0x0012, "TCR" }, { 0x0013, "TSR" }, + { 0x0014, "ICRH" }, { 0x0015, "ICRL" }, { 0x0016, "OCRH" }, { 0x0017, "OCRL" }, + { 0x0018, "TRH" }, { 0x0019, "TRL" }, { 0x001a, "ATRH" }, { 0x001b, "ATRL" } }; + +std::pair<u16, char const *> const m68hc705c8a_syms[] = { + { 0x0000, "PORTA" }, { 0x0001, "PORTB" }, { 0x0002, "PORTC" }, { 0x0003, "PORTD" }, + { 0x0004, "DDRA" }, { 0x0005, "DDRB" }, { 0x0006, "DDRC" }, + { 0x000a, "SPCR" }, { 0x000b, "SPSR" }, { 0x000c, "SPDR" }, + { 0x000d, "BAUD" }, { 0x000e, "SCCR1" }, { 0x000f, "SCCR2" }, { 0x0010, "SCSR" }, { 0x0011, "SCDR" }, + { 0x0012, "TCR" }, { 0x0013, "TSR" }, + { 0x0014, "ICRH" }, { 0x0015, "ICRL" }, { 0x0016, "OCRH" }, { 0x0017, "OCRL" }, + { 0x0018, "TRH" }, { 0x0019, "TRL" }, { 0x001a, "ATRH" }, { 0x001b, "ATRL" }, + { 0x001c, "PROG" }, + { 0x001d, "COPRST" }, { 0x001e, "COPCR" } }; + + +ROM_START( m68hc705c8a ) + ROM_REGION(0x00f0, "bootstrap", 0) + ROM_LOAD("bootstrap.bin", 0x0000, 0x00f0, NO_DUMP) +ROM_END + + +//constexpr u16 M68HC05_VECTOR_SPI = 0xfff4; +//constexpr u16 M68HC05_VECTOR_SCI = 0xfff6; +constexpr u16 M68HC05_VECTOR_TIMER = 0xfff8; +constexpr u16 M68HC05_VECTOR_IRQ = 0xfffa; +constexpr u16 M68HC05_VECTOR_SWI = 0xfffc; +//constexpr u16 M68HC05_VECTOR_RESET = 0xfffe; + +constexpr u16 M68HC05_INT_IRQ = u16(1) << 0; +constexpr u16 M68HC05_INT_TIMER = u16(1) << 1; + +constexpr u16 M68HC05_INT_MASK = M68HC05_INT_IRQ | M68HC05_INT_TIMER; + +} // anonymous namespace + + + +/**************************************************************************** + * Global variables + ****************************************************************************/ + +device_type const M68HC05C4 = &device_creator<m68hc05c4_device>; +device_type const M68HC05C8 = &device_creator<m68hc05c8_device>; +device_type const M68HC705C8A = &device_creator<m68hc705c8a_device>; + + + +/**************************************************************************** + * M68HC05 base device + ****************************************************************************/ + +m68hc05_device::m68hc05_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + u32 clock, + device_type type, + char const *name, + address_map_delegate internal_map, + char const *shortname, + char const *source) + : m6805_base_device( + mconfig, + tag, + owner, + clock, + type, + name, + { s_hc_ops, s_hc_cycles, 13, 0x00ff, 0x00c0, M68HC05_VECTOR_SWI }, + internal_map, + shortname, + source) + , m_port_cb_r{ *this, *this, *this, *this } + , m_port_cb_w{ *this, *this, *this, *this } + , m_port_bits{ 0xff, 0xff, 0xff, 0xff } + , m_port_interrupt{ 0x00, 0x00, 0x00, 0x00 } + , m_port_input{ 0xff, 0xff, 0xff, 0xff } + , m_port_latch{ 0xff, 0xff, 0xff, 0xff } + , m_port_ddr{ 0x00, 0x00, 0x00, 0x00 } + , m_port_irq_state(false) + , m_irq_line_state(false) + , m_irq_latch(0) + , m_tcmp_cb(*this) + , m_tcap_state(false) + , m_tcr(0x00) + , m_tsr(0x00), m_tsr_seen(0x00) + , m_prescaler(0x00) + , m_counter(0xfffc), m_icr(0x0000), m_ocr(0x0000) + , m_inhibit_cap(false), m_inhibit_cmp(false) + , m_trl_buf{ 0xfc, 0xfc } + , m_trl_latched{ false, false } + , m_pcop_cnt(0) + , m_ncop_cnt(0) + , m_coprst(0x00) + , m_copcr(0x00) + , m_ncope(0) +{ +} + + +void m68hc05_device::set_port_bits(std::array<u8, PORT_COUNT> const &bits) +{ + if (configured() || started()) + throw emu_fatalerror("Attempt to set physical port bits after configuration"); + + for (unsigned i = 0; PORT_COUNT > i; ++i) + m_port_bits[i] = bits[i]; +} + +void m68hc05_device::set_port_interrupt(std::array<u8, PORT_COUNT> const &interrupt) +{ + u8 diff(0x00); + for (unsigned i = 0; PORT_COUNT > i; ++i) + { + diff |= (m_port_interrupt[i] ^ interrupt[i]) & ~m_port_ddr[i]; + m_port_interrupt[i] = interrupt[i]; + if (interrupt[i] && !m_port_cb_r[i].isnull()) + logerror("PORT%c has interrupts enabled with pulled inputs, behaviour may be incorrect\n", 'A' + i); + } + if (diff) update_port_irq(); +} + +READ8_MEMBER(m68hc05_device::port_r) +{ + offset &= PORT_COUNT - 1; + if (!space.debugger_access() && !m_port_cb_r[offset].isnull()) + { + u8 const newval(m_port_cb_r[offset](space, 0, ~m_port_ddr[offset] & m_port_bits[offset]) & m_port_bits[offset]); + u8 const diff(newval ^ m_port_input[offset]); + if (diff) + { + LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n", + char('A' + offset), newval, ~m_port_ddr[offset] & m_port_bits[offset], m_port_input[offset]); + } + m_port_input[offset] = newval; + if (diff & m_port_interrupt[offset] & ~m_port_ddr[offset]) + update_port_irq(); + } + return port_value(offset); +} + +WRITE8_MEMBER(m68hc05_device::port_latch_w) +{ + offset &= PORT_COUNT - 1; + data &= m_port_bits[offset]; + u8 const diff = m_port_latch[offset] ^ data; + if (diff) + { + LOGIOPORT("write PORT%c latch: %02X & %02X (was %02X)\n", + char('A' + offset), data, m_port_ddr[offset], m_port_latch[offset]); + } + m_port_latch[offset] = data; + if (diff & m_port_ddr[offset]) + m_port_cb_w[offset](space, 0, port_value(offset), m_port_ddr[offset]); +} + +READ8_MEMBER(m68hc05_device::port_ddr_r) +{ + return m_port_ddr[offset & (PORT_COUNT - 1)]; +} + +WRITE8_MEMBER(m68hc05_device::port_ddr_w) +{ + offset &= PORT_COUNT - 1; + data &= m_port_bits[offset]; + u8 const diff(data ^ m_port_ddr[offset]); + if (diff) + { + LOGIOPORT("write DDR%c: %02X (was %02X)\n", char('A' + offset), data, m_port_ddr[offset]); + m_port_ddr[offset] = data; + if (diff & m_port_interrupt[offset]) + { + if (!m_port_cb_r[offset].isnull()) + { + u8 const newval(m_port_cb_r[offset](space, 0, ~m_port_ddr[offset] & m_port_bits[offset]) & m_port_bits[offset]); + u8 const diff(newval ^ m_port_input[offset]); + if (diff) + { + LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n", + char('A' + offset), newval, ~m_port_ddr[offset] & m_port_bits[offset], m_port_input[offset]); + } + m_port_input[offset] = newval; + } + update_port_irq(); + } + m_port_cb_w[offset](space, 0, port_value(offset), m_port_ddr[offset]); + } +} + + +READ8_MEMBER(m68hc05_device::tcr_r) +{ + return m_tcr; +} + +WRITE8_MEMBER(m68hc05_device::tcr_w) +{ + data &= 0xe3; + LOGTIMER("write TCR: ICIE=%u OCIE=%u TOIE=%u IEDG=%u OLVL=%u\n", + BIT(data, 7), BIT(data, 6), BIT(data, 5), BIT(data, 1), BIT(data, 0)); + m_tcr = data; + if (m_tcr & m_tsr & 0xe0) + m_pending_interrupts |= M68HC05_INT_TIMER; + else + m_pending_interrupts &= ~M68HC05_INT_TIMER; +} + +READ8_MEMBER(m68hc05_device::tsr_r) +{ + if (!space.debugger_access()) + { + u8 const events(m_tsr & ~m_tsr_seen); + if (events) + { + LOGTIMER("read TSR: seen%s%s%s\n", + BIT(events, 7) ? " ICF" : "", BIT(events, 6) ? " OCF" : "", BIT(events, 5) ? " TOF" : ""); + } + m_tsr_seen = m_tsr; + } + return m_tsr; +} + +READ8_MEMBER(m68hc05_device::icr_r) +{ + // reading IRCH inhibits capture until ICRL is read + // reading ICRL after reading TCR with ICF set clears ICF + + u8 const low(BIT(offset, 0)); + if (!space.debugger_access()) + { + if (low) + { + if (BIT(m_tsr_seen, 7)) + { + LOGTIMER("read ICRL, clear ICF\n"); + m_tsr &= 0x7f; + m_tsr_seen &= 0x7f; + if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER; + } + if (m_inhibit_cap) LOGTIMER("read ICRL, enable capture\n"); + m_inhibit_cap = false; + } + else + { + if (!m_inhibit_cap) LOGTIMER("read ICRH, inhibit capture\n"); + m_inhibit_cap = true; + } + } + return u8(m_icr >> (low ? 0 : 8)); +} + +READ8_MEMBER(m68hc05_device::ocr_r) +{ + // reading OCRL after reading TCR with OCF set clears OCF + + u8 const low(BIT(offset, 0)); + if (!space.debugger_access() && low && BIT(m_tsr_seen, 6)) + { + LOGTIMER("read OCRL, clear OCF\n"); + m_tsr &= 0xbf; + m_tsr_seen &= 0xbf; + if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER; + } + return u8(m_ocr >> (low ? 0 : 8)); +} + +WRITE8_MEMBER(m68hc05_device::ocr_w) +{ + // writing ORCH inhibits compare until OCRL is written + // writing OCRL after reading TCR with OCF set clears OCF + + u8 const low(BIT(offset, 0)); + if (!space.debugger_access()) + { + if (low) + { + if (BIT(m_tsr_seen, 6)) + { + LOGTIMER("write OCRL, clear OCF\n"); + m_tsr &= 0xbf; + m_tsr_seen &= 0xbf; + if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER; + } + if (m_inhibit_cmp) LOGTIMER("write OCRL, enable compare\n"); + m_inhibit_cmp = false; + } + else + { + if (!m_inhibit_cmp) LOGTIMER("write OCRH, inhibit compare\n"); + m_inhibit_cmp = true; + } + } + m_ocr = (m_ocr & (low ? 0xff00 : 0x00ff)) | (u16(data) << (low ? 0 : 8)); +} + +READ8_MEMBER(m68hc05_device::timer_r) +{ + // reading [A]TRH returns current counter MSB and latches [A]TRL buffer + // reading [A]TRL returns current [A]TRL buffer and completes read sequence + // reading TRL after reading TSR with TOF set clears TOF + // reading ATRL doesn't affect TOF + + u8 const low(BIT(offset, 0)); + u8 const alt(BIT(offset, 1)); + if (low) + { + if (!space.debugger_access()) + { + if (m_trl_latched[alt]) LOGTIMER("read %sTRL, read sequence complete\n", alt ? "A" : ""); + m_trl_latched[alt] = false; + if (!alt && BIT(m_tsr_seen, 5)) + { + LOGTIMER("read TRL, clear TOF\n"); + m_tsr &= 0xdf; + m_tsr_seen &= 0xdf; + if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER; + } + } + return m_trl_buf[alt]; + } + else + { + if (!space.debugger_access() && !m_trl_latched[alt]) + { + LOGTIMER("read %sTRH, latch %sTRL\n", alt ? "A" : "", alt ? "A" : ""); + m_trl_latched[alt] = true; + m_trl_buf[alt] = u8(m_counter); + } + return u8(m_counter >> 8); + } +} + + +WRITE8_MEMBER(m68hc05_device::coprst_w) +{ + LOGCOP("write COPRST=%02x%s\n", data, ((0xaa == data) && (0x55 == m_coprst)) ? ", reset" : ""); + if (0x55 == data) + { + m_coprst = data; + } + else if (0xaa == data) + { + if (0x55 == m_coprst) m_pcop_cnt &= 0x00007fff; + m_coprst = data; + } +} + +READ8_MEMBER(m68hc05_device::copcr_r) +{ + if (copcr_copf()) LOGCOP("read COPCR, clear COPF\n"); + u8 const result(m_copcr); + m_copcr &= 0xef; + return result; +} + +WRITE8_MEMBER(m68hc05_device::copcr_w) +{ + LOGCOP("write COPCR: CME=%u PCOPE=%u [%s] CM=%u\n", + BIT(data, 3), BIT(data, 2), (!copcr_pcope() && BIT(data, 2)) ? "set" : "ignored", data & 0x03); + m_copcr = (m_copcr & 0xf4) | (data & 0x0f); // PCOPE is set-only, hence the mask overlap +} + +WRITE8_MEMBER(m68hc05_device::copr_w) +{ + LOGCOP("write COPR: COPC=%u\n", BIT(data, 0)); + if (!BIT(data, 0)) m_ncop_cnt = 0; +} + + +void m68hc05_device::device_start() +{ + m6805_base_device::device_start(); + + // resolve callbacks + for (devcb_read8 &cb : m_port_cb_r) cb.resolve(); + for (devcb_write8 &cb : m_port_cb_w) cb.resolve_safe(); + m_tcmp_cb.resolve_safe(); + + // save digital I/O + save_item(NAME(m_port_interrupt)); + save_item(NAME(m_port_input)); + save_item(NAME(m_port_latch)); + save_item(NAME(m_port_ddr)); + save_item(NAME(m_port_irq_state)); + save_item(NAME(m_irq_line_state)); + save_item(NAME(m_irq_latch)); + + // save timer/counter + save_item(NAME(m_tcap_state)); + save_item(NAME(m_tcr)); + save_item(NAME(m_tsr)); + save_item(NAME(m_tsr_seen)); + save_item(NAME(m_prescaler)); + save_item(NAME(m_counter)); + save_item(NAME(m_icr)); + save_item(NAME(m_ocr)); + save_item(NAME(m_inhibit_cap));; + save_item(NAME(m_inhibit_cmp)); + save_item(NAME(m_trl_buf)); + save_item(NAME(m_trl_latched)); + + // save COP watchdogs + save_item(NAME(m_pcop_cnt)); + save_item(NAME(m_ncop_cnt)); + save_item(NAME(m_coprst)); + save_item(NAME(m_copcr)); + save_item(NAME(m_ncope)); + + // digital I/O state unaffected by reset + std::fill(std::begin(m_port_interrupt), std::end(m_port_interrupt), 0x00); + std::fill(std::begin(m_port_input), std::end(m_port_input), 0xff); + std::fill(std::begin(m_port_latch), std::end(m_port_latch), 0xff); + m_irq_line_state = false; + + // timer state unaffected by reset + m_tcap_state = false; + m_tcr = 0x00; + m_tsr = 0x00; + m_icr = 0x0000; + m_ocr = 0x0000; + + // COP watchdog state unaffected by reset + m_pcop_cnt = 0; + m_coprst = 0x00; + m_copcr = 0x00; + m_ncope = 0; + + // expose most basic state to debugger + state_add(M68HC05_IRQLATCH, "IRQLATCH", m_irq_latch).mask(0x01); +} + +void m68hc05_device::device_reset() +{ + m6805_base_device::device_reset(); + + // digital I/O reset + std::fill(std::begin(m_port_ddr), std::end(m_port_ddr), 0x00); + m_irq_latch = 0; + update_port_irq(); + + // timer reset + m_tcr &= 0x02; + m_tsr_seen = 0x00; + m_prescaler = 0; + m_counter = 0xfffc; + m_inhibit_cap = m_inhibit_cmp = false; + m_trl_buf[0] = m_trl_buf[1] = u8(m_counter); + m_trl_latched[0] = m_trl_latched[1] = false; + + // COP watchdog reset + m_ncop_cnt = 0; + m_copcr &= 0x10; +} + + +void m68hc05_device::execute_set_input(int inputnum, int state) +{ + switch (inputnum) + { + case M68HC05_IRQ_LINE: + if ((CLEAR_LINE != state) && !m_irq_line_state) + { + LOGINT("/IRQ edge%s\n", (m_port_irq_state || m_irq_latch) ? "" : ", set IRQ latch"); + if (!m_port_irq_state) + { + m_irq_latch = 1; + m_pending_interrupts |= M68HC05_INT_IRQ; + } + } + m_irq_line_state = ASSERT_LINE == state; + break; + case M68HC05_TCAP_LINE: + if ((bool(state) != m_tcap_state) && (bool(state) == tcr_iedg())) + { + LOGTIMER("input capture %04X%s\n", m_counter, m_inhibit_cap ? " [inhibited]" : ""); + if (!m_inhibit_cap) + { + m_tsr |= 0x80; + m_icr = m_counter; + if (m_tcr & m_tsr & 0xe0) m_pending_interrupts |= M68HC05_INT_TIMER; + } + } + m_tcap_state = bool(state); + break; + default: + fatalerror("m68hc05[%s]: unknown input line %d", tag(), inputnum); + } +} + +u64 m68hc05_device::execute_clocks_to_cycles(u64 clocks) const +{ + return (clocks + 1) / 2; +} + +u64 m68hc05_device::execute_cycles_to_clocks(u64 cycles) const +{ + return cycles * 2; +} + + +offs_t m68hc05_device::disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) +{ + return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options); +} + + +void m68hc05_device::interrupt() +{ + if ((m_pending_interrupts & M68HC05_INT_MASK) && !(CC & IFLAG)) + { + pushword(m_pc); + pushbyte(m_x); + pushbyte(m_a); + pushbyte(m_cc); + SEI; + standard_irq_callback(0); + + if (m_pending_interrupts & M68HC05_INT_IRQ) + { + LOGINT("servicing external interrupt\n"); + m_irq_latch = 0; + m_pending_interrupts &= ~M68HC05_INT_IRQ; + rm16(M68HC05_VECTOR_IRQ, m_pc); + } + else if (m_pending_interrupts & M68HC05_INT_TIMER) + { + LOGINT("servicing timer interrupt\n"); + rm16(M68HC05_VECTOR_TIMER, m_pc); + } + else + { + fatalerror("m68hc05[%s]: unknown pending interrupt(s) %x", tag(), m_pending_interrupts); + } + m_icount -= 10; + burn_cycles(10); + } +} + +void m68hc05_device::burn_cycles(unsigned count) +{ + // calculate new timer values (fixed prescaler of four) + unsigned const ps_opt(4); + unsigned const ps_mask((1 << ps_opt) - 1); + unsigned const increments((count + (m_prescaler & ps_mask)) >> ps_opt); + u32 const new_counter(u32(m_counter) + increments); + bool const timer_rollover((0x010000 > m_counter) && (0x010000 <= new_counter)); + bool const output_compare_match((m_ocr > m_counter) && (m_ocr <= new_counter)); + m_prescaler = (count + m_prescaler) & ps_mask; + m_counter = u16(new_counter); + if (timer_rollover) + { + LOGTIMER("timer rollover\n"); + m_tsr |= 0x20; + } + if (output_compare_match) + { + LOGTIMER("output compare match %s\n", m_inhibit_cmp ? " [inhibited]" : ""); + if (!m_inhibit_cmp) + { + m_tsr |= 0x40; + m_tcmp_cb(tcr_olvl() ? 1 : 0); + } + } + if (m_tcr & m_tsr & 0xe0) m_pending_interrupts |= M68HC05_INT_TIMER; + + // run programmable COP + u32 const pcop_timeout(u32(1) << ((copcr_cm() << 1) + 15)); + if (copcr_pcope() && (pcop_timeout <= ((m_pcop_cnt & (pcop_timeout - 1)) + count))) + { + LOGCOP("PCOP reset\n"); + m_copcr |= 0x10; + set_input_line(INPUT_LINE_RESET, PULSE_LINE); + } + m_pcop_cnt = (m_pcop_cnt + count) & ((u32(1) << 21) - 1); + + // run non-programmable COP + m_ncop_cnt += count; + if ((u32(1) << 17) <= m_ncop_cnt) + { + set_input_line(INPUT_LINE_RESET, PULSE_LINE); + LOGCOP("NCOP reset\n"); + } + m_ncop_cnt &= (u32(1) << 17) - 1; +} + + +void m68hc05_device::add_port_state(std::array<bool, PORT_COUNT> const &ddr) +{ + for (unsigned i = 0; PORT_COUNT > i; ++i) + { + if (m_port_bits[i]) + state_add(M68HC05_LATCHA + i, util::string_format("LATCH%c", 'A' + i).c_str(), m_port_latch[i]).mask(m_port_bits[i]); + } + for (unsigned i = 0; PORT_COUNT > i; ++i) + { + if (ddr[i] && m_port_bits[i]) + state_add(M68HC05_DDRA + i, util::string_format("DDR%c", 'A' + i).c_str(), m_port_ddr[i]).mask(m_port_bits[i]); + } +} + +void m68hc05_device::add_timer_state() +{ + state_add(M68HC05_TCR, "TCR", m_tcr).mask(0x7f); + state_add(M68HC05_TSR, "TSR", m_tsr).mask(0xff); + state_add(M68HC05_ICR, "ICR", m_icr).mask(0xffff); + state_add(M68HC05_OCR, "OCR", m_ocr).mask(0xffff); + state_add(M68HC05_PS, "PS", m_prescaler).mask(0x03); + state_add(M68HC05_TR, "TR", m_counter).mask(0xffff); +} + +void m68hc05_device::add_pcop_state() +{ + state_add(M68HC05_COPRST, "COPRST", m_coprst).mask(0xff); + state_add(M68HC05_COPCR, "COPCR", m_copcr).mask(0x1f); + state_add(M68HC05_PCOP, "PCOP", m_pcop_cnt).mask(0x001fffff); +} + +void m68hc05_device::add_ncop_state() +{ + state_add(M68HC05_NCOPE, "NCOPE", m_ncope).mask(0x01); + state_add(M68HC05_NCOP, "NCOP", m_ncop_cnt).mask(0x0001ffff); +} + + +u8 m68hc05_device::port_value(unsigned offset) const +{ + return (m_port_latch[offset] & m_port_ddr[offset]) | (m_port_input[offset] & ~m_port_ddr[offset]); +} + +void m68hc05_device::update_port_irq() +{ + u8 state(0x00); + for (unsigned i = 0; i < PORT_COUNT; ++i) + state |= m_port_interrupt[i] & ~m_port_ddr[i] & ~m_port_input[i]; + + if (bool(state) != m_port_irq_state) + { + LOGINT("I/O port IRQ state now %u%s\n", + state ? 1 : 0, (!m_irq_line_state && state && !m_irq_latch) ? ", set IRQ latch" : ""); + m_port_irq_state = bool(state); + if (!m_irq_line_state && state) + { + m_irq_latch = 1; + m_pending_interrupts |= M68HC05_INT_IRQ; + } + } +} + + + +/**************************************************************************** + * M68HC705 base device + ****************************************************************************/ + +m68hc705_device::m68hc705_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + u32 clock, + device_type type, + char const *name, + address_map_delegate internal_map, + char const *shortname, + char const *source) + : m68hc05_device(mconfig, tag, owner, clock, type, name, internal_map, shortname, source) +{ +} + + + +/**************************************************************************** + * MC68HC05C4 device + ****************************************************************************/ + +DEVICE_ADDRESS_MAP_START( c4_map, 8, m68hc05c4_device ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w) + // 0x0007-0x0009 unused + // 0x000a SPCR + // 0x000b SPSR + // 0x000c SPDR + // 0x000d BAUD + // 0x000e SCCR1 + // 0x000f SCCR2 + // 0x0010 SCSR + // 0x0011 SCDR + AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w) + AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r) + AM_RANGE(0x0014, 0x0015) AM_READ(icr_r) + AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w) + AM_RANGE(0x0018, 0x001b) AM_READ(timer_r) + // 0x001c-0x001f unused + AM_RANGE(0x0020, 0x004f) AM_ROM // user ROM + AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack + AM_RANGE(0x0100, 0x10ff) AM_ROM // user ROM + // 0x1100-0x1eff unused + AM_RANGE(0x1f00, 0x1fef) AM_ROM // self-check + // 0x1ff0-0x1ff3 unused + AM_RANGE(0x1ff4, 0x1fff) AM_ROM // user vectors +ADDRESS_MAP_END + + +m68hc05c4_device::m68hc05c4_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : m68hc05_device( + mconfig, + tag, + owner, + clock, + M68HC05C4, + "MC68HC05C4", + address_map_delegate(FUNC(m68hc05c4_device::c4_map), this), + "m68hc05c4", + __FILE__) +{ + set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }}); +} + + + +void m68hc05c4_device::device_start() +{ + m68hc05_device::device_start(); + + add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }}); + add_timer_state(); +} + + +offs_t m68hc05c4_device::disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) +{ + return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc05c4_syms); +} + + + +/**************************************************************************** + * MC68HC05C8 device + ****************************************************************************/ + +DEVICE_ADDRESS_MAP_START( c8_map, 8, m68hc05c8_device ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w) + // 0x0007-0x0009 unused + // 0x000a SPCR + // 0x000b SPSR + // 0x000c SPDR + // 0x000d BAUD + // 0x000e SCCR1 + // 0x000f SCCR2 + // 0x0010 SCSR + // 0x0011 SCDR + AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w) + AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r) + AM_RANGE(0x0014, 0x0015) AM_READ(icr_r) + AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w) + AM_RANGE(0x0018, 0x001b) AM_READ(timer_r) + // 0x001c-0x001f unused + AM_RANGE(0x0020, 0x004f) AM_ROM // user ROM + AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack + AM_RANGE(0x0100, 0x1eff) AM_ROM // user ROM + AM_RANGE(0x1f00, 0x1fef) AM_ROM // self-check + // 0x1ff0-0x1ff3 unused + AM_RANGE(0x1ff4, 0x1fff) AM_ROM // user vectors +ADDRESS_MAP_END + + +m68hc05c8_device::m68hc05c8_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : m68hc05_device( + mconfig, + tag, + owner, + clock, + M68HC05C8, + "MC68HC05C8", + address_map_delegate(FUNC(m68hc05c8_device::c8_map), this), + "m68hc05c8", + __FILE__) +{ + set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }}); +} + + +void m68hc05c8_device::device_start() +{ + m68hc05_device::device_start(); + + add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }}); + add_timer_state(); +} + + +offs_t m68hc05c8_device::disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) +{ + // same I/O registers as MC68HC05C4 + return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc05c4_syms); +} + + + +/**************************************************************************** + * MC68HC705C8A device + ****************************************************************************/ + +DEVICE_ADDRESS_MAP_START( c8a_map, 8, m68hc705c8a_device ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w) + // 0x0007-0x0009 unused + // 0x000a SPCR + // 0x000b SPSR + // 0x000c SPDR + // 0x000d BAUD + // 0x000e SCCR1 + // 0x000f SCCR2 + // 0x0010 SCSR + // 0x0011 SCDR + AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w) + AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r) + AM_RANGE(0x0014, 0x0015) AM_READ(icr_r) + AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w) + AM_RANGE(0x0018, 0x001b) AM_READ(timer_r) + // 0x001c PROG + AM_RANGE(0x001d, 0x001d) AM_WRITE(coprst_w) + AM_RANGE(0x001e, 0x001e) AM_READWRITE(copcr_r, copcr_w) + // 0x001f unused + AM_RANGE(0x0020, 0x004f) AM_ROM // user PROM FIXME: banked with RAM + AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack + AM_RANGE(0x0100, 0x015f) AM_ROM // user PROM FIXME: banked with RAM + AM_RANGE(0x0160, 0x1eff) AM_ROM // user PROM + AM_RANGE(0x1f00, 0x1fde) AM_ROM AM_REGION("bootstrap", 0x0000) // bootloader + // 0x1fdf option register FIXME: controls banking + AM_RANGE(0x1fe0, 0x1fef) AM_ROM AM_REGION("bootstrap", 0x00e0) // boot ROM vectors + AM_RANGE(0x1ff0, 0x1ff0) AM_WRITE(copr_w) + AM_RANGE(0x1ff0, 0x1fff) AM_ROM // user vectors +ADDRESS_MAP_END + + +m68hc705c8a_device::m68hc705c8a_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : m68hc705_device( + mconfig, + tag, + owner, + clock, + M68HC705C8A, + "MC68HC705C8A", + address_map_delegate(FUNC(m68hc705c8a_device::c8a_map), this), + "m68hc705c8a", + __FILE__) +{ + set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }}); +} + + +tiny_rom_entry const *m68hc705c8a_device::device_rom_region() const +{ + return ROM_NAME(m68hc705c8a); +} + + +void m68hc705c8a_device::device_start() +{ + m68hc705_device::device_start(); + + add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }}); + add_timer_state(); + add_pcop_state(); + add_ncop_state(); +} + +void m68hc705c8a_device::device_reset() +{ + m68hc705_device::device_reset(); + + // latch MOR registers on reset + set_port_interrupt(std::array<u8, PORT_COUNT>{{ 0x00, u8(rdmem(0xfff0)), 0x00, 0x00 }}); + set_ncope(BIT(rdmem(0xfff1), 0)); +} + + +offs_t m68hc705c8a_device::disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) +{ + return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc705c8a_syms); +} diff --git a/src/devices/cpu/m6805/m68hc05.h b/src/devices/cpu/m6805/m68hc05.h new file mode 100644 index 00000000000..cd0de3a31c0 --- /dev/null +++ b/src/devices/cpu/m6805/m68hc05.h @@ -0,0 +1,298 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#ifndef MAME_CPU_M6805_M68HC05_H +#define MAME_CPU_M6805_M68HC05_H + +#pragma once + +#include "m6805.h" + +#include <array> + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +extern device_type const M68HC05C4; +extern device_type const M68HC05C8; +extern device_type const M68HC705C8A; + + +//************************************************************************** +// TYPE DECLARATIONS +//************************************************************************** + +// ======================> m68hc05_device + +#define MCFG_M68HC05_PORTA_R_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_r<0>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTB_R_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_r<1>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTC_R_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_r<2>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTD_R_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_r<3>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTA_W_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_w<0>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTB_W_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_w<1>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTC_W_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_w<2>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_PORTD_W_CB(obj) \ + devcb = &m68hc05_device::set_port_cb_w<3>(*device, DEVCB_##obj); + +#define MCFG_M68HC05_TCMP_CB(obj) \ + devcb = &m68hc05_device::set_tcmp_cb(*device, DEVCB_##obj); + + +class m68hc05_device : public m6805_base_device +{ +public: + // static configuration helpers + template<std::size_t N, typename Object> static devcb_base &set_port_cb_r(device_t &device, Object &&obj) + { return downcast<m68hc05_device &>(device).m_port_cb_r[N].set_callback(std::forward<Object>(obj)); } + template<std::size_t N, typename Object> static devcb_base &set_port_cb_w(device_t &device, Object &&obj) + { return downcast<m68hc05_device &>(device).m_port_cb_w[N].set_callback(std::forward<Object>(obj)); } + template<typename Object> static devcb_base &set_tcmp_cb(device_t &device, Object &&obj) + { return downcast<m68hc05_device &>(device).m_tcmp_cb.set_callback(std::forward<Object>(obj)); } + +protected: + // state index constants + enum + { + M68HC05_A = M6805_A, + M68HC05_PC = M6805_PC, + M68HC05_S = M6805_S, + M68HC05_X = M6805_X, + M68HC05_CC = M6805_CC, + M68HC05_IRQ_STATE = M6805_IRQ_STATE, + + M68HC05_IRQLATCH = 0x10, + + M68HC05_LATCHA, + M68HC05_LATCHB, + M68HC05_LATCHC, + M68HC05_LATCHD, + M68HC05_DDRA, + M68HC05_DDRB, + M68HC05_DDRC, + M68HC05_DDRD, + + M68HC05_TCR, + M68HC05_TSR, + M68HC05_ICR, + M68HC05_OCR, + M68HC05_PS, + M68HC05_TR, + + M68HC05_COPRST, + M68HC05_COPCR, + M68HC05_PCOP, + M68HC05_NCOPE, + M68HC05_NCOP + }; + + enum { PORT_COUNT = 4 }; + + m68hc05_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + u32 clock, + device_type type, + char const *name, + address_map_delegate internal_map, + char const *shortname, + char const *source); + + void set_port_bits(std::array<u8, PORT_COUNT> const &bits); + void set_port_interrupt(std::array<u8, PORT_COUNT> const &interrupt); + DECLARE_READ8_MEMBER(port_r); + DECLARE_WRITE8_MEMBER(port_latch_w); + DECLARE_READ8_MEMBER(port_ddr_r); + DECLARE_WRITE8_MEMBER(port_ddr_w); + + DECLARE_READ8_MEMBER(tcr_r); + DECLARE_WRITE8_MEMBER(tcr_w); + DECLARE_READ8_MEMBER(tsr_r); + DECLARE_READ8_MEMBER(icr_r); + DECLARE_READ8_MEMBER(ocr_r); + DECLARE_WRITE8_MEMBER(ocr_w); + DECLARE_READ8_MEMBER(timer_r); + + void set_ncope(bool state) { m_ncope = state ? 1 : 0; } + DECLARE_WRITE8_MEMBER(coprst_w); + DECLARE_READ8_MEMBER(copcr_r); + DECLARE_WRITE8_MEMBER(copcr_w); + DECLARE_WRITE8_MEMBER(copr_w); + + virtual void device_start() override; + virtual void device_reset() override; + + virtual void execute_set_input(int inputnum, int state) override; + virtual u64 execute_clocks_to_cycles(u64 clocks) const override; + virtual u64 execute_cycles_to_clocks(u64 cycles) const override; + + virtual offs_t disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const uint8_t *opram, + u32 options) override; + + virtual void interrupt() override; + virtual void burn_cycles(unsigned count) override; + + void add_port_state(std::array<bool, PORT_COUNT> const &ddr); + void add_timer_state(); + void add_pcop_state(); + void add_ncop_state(); + +private: + u8 port_value(unsigned offset) const; + void update_port_irq(); + + bool tcr_icie() const { return BIT(m_tcr, 7); } + bool tcr_ocie() const { return BIT(m_tcr, 6); } + bool tcr_toie() const { return BIT(m_tcr, 5); } + bool tcr_iedg() const { return BIT(m_tcr, 1); } + bool tcr_olvl() const { return BIT(m_tcr, 0); } + + bool tsr_icf() const { return BIT(m_tsr, 7); } + bool tsr_ocf() const { return BIT(m_tsr, 6); } + bool tsr_tof() const { return BIT(m_tsr, 5); } + + bool copcr_copf() const { return BIT(m_copcr, 4); } + bool copcr_cme() const { return BIT(m_copcr, 3); } + bool copcr_pcope() const { return BIT(m_copcr, 2); } + u8 copcr_cm() const { return m_copcr & 0x03; } + + // digital I/O + devcb_read8 m_port_cb_r[PORT_COUNT]; + devcb_write8 m_port_cb_w[PORT_COUNT]; + u8 m_port_bits[PORT_COUNT]; + u8 m_port_interrupt[PORT_COUNT]; + u8 m_port_input[PORT_COUNT]; + u8 m_port_latch[PORT_COUNT]; + u8 m_port_ddr[PORT_COUNT]; + bool m_port_irq_state, m_irq_line_state; + u8 m_irq_latch; + + // timer/counter + devcb_write_line m_tcmp_cb; + bool m_tcap_state; + u8 m_tcr; + u8 m_tsr, m_tsr_seen; + u8 m_prescaler; + u16 m_counter, m_icr, m_ocr; + bool m_inhibit_cap, m_inhibit_cmp; + u8 m_trl_buf[2]; + bool m_trl_latched[2]; + + // COP watchdogs + u32 m_pcop_cnt, m_ncop_cnt; + u8 m_coprst, m_copcr; + u8 m_ncope; +}; + + +// ======================> m68hc705_device + +class m68hc705_device : public m68hc05_device +{ +protected: + m68hc705_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + u32 clock, + device_type type, + char const *name, + address_map_delegate internal_map, + char const *shortname, + char const *source); +}; + + +// ======================> m68hc05c4_device + +class m68hc05c4_device : public m68hc05_device +{ +public: + m68hc05c4_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + +protected: + DECLARE_ADDRESS_MAP(c4_map, 8); + + virtual void device_start() override; + + virtual offs_t disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) override; +}; + + +// ======================> m68hc05c8_device + +class m68hc05c8_device : public m68hc05_device +{ +public: + m68hc05c8_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + +protected: + DECLARE_ADDRESS_MAP(c8_map, 8); + + virtual void device_start() override; + + virtual offs_t disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) override; +}; + + +// ======================> m68hc705c8a_device + +class m68hc705c8a_device : public m68hc705_device +{ +public: + m68hc705c8a_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + +protected: + DECLARE_ADDRESS_MAP(c8a_map, 8); + + virtual tiny_rom_entry const *device_rom_region() const override; + + virtual void device_start() override; + virtual void device_reset() override; + + virtual offs_t disasm_disassemble( + std::ostream &stream, + offs_t pc, + const u8 *oprom, + const u8 *opram, + u32 options) override; +}; + + +/**************************************************************************** + * 68HC05 section + ****************************************************************************/ + +#define M68HC05_IRQ_LINE (M6805_IRQ_LINE + 0) +#define M68HC05_TCAP_LINE (M6805_IRQ_LINE + 1) + +#endif // MAME_CPU_M6805_M68HC05_H diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h index 73f8477d51e..96f245cc535 100644 --- a/src/devices/cpu/m6809/m6809.h +++ b/src/devices/cpu/m6809/m6809.h @@ -310,7 +310,7 @@ public: // ======================> m6809e_device #define MCFG_M6809E_LIC_CB(_devcb) \ - m6809e_device::set_lic_cb(*device, DEVCB_##_devcb); + devcb = &m6809e_device::set_lic_cb(*device, DEVCB_##_devcb); class m6809e_device : public m6809_base_device diff --git a/src/devices/cpu/mb86233/mb86233.h b/src/devices/cpu/mb86233/mb86233.h index 135227a2524..65a2c370b07 100644 --- a/src/devices/cpu/mb86233/mb86233.h +++ b/src/devices/cpu/mb86233/mb86233.h @@ -41,10 +41,14 @@ enum }; -#define MCFG_MB86233_FIFO_READ_CB(_devcb) mb86233_cpu_device::set_fifo_read_cb(*device, DEVCB_##_devcb); -#define MCFG_MB86233_FIFO_READ_OK_CB(_devcb) mb86233_cpu_device::set_fifo_read_ok_cb(*device, DEVCB_##_devcb); -#define MCFG_MB86233_FIFO_WRITE_CB(_devcb) mb86233_cpu_device::set_fifo_write_cb(*device, DEVCB_##_devcb); -#define MCFG_MB86233_TABLE_REGION(_region) mb86233_cpu_device::set_tablergn(*device, _region); +#define MCFG_MB86233_FIFO_READ_CB(_devcb) \ + devcb = &mb86233_cpu_device::set_fifo_read_cb(*device, DEVCB_##_devcb); +#define MCFG_MB86233_FIFO_READ_OK_CB(_devcb) \ + devcb = &mb86233_cpu_device::set_fifo_read_ok_cb(*device, DEVCB_##_devcb); +#define MCFG_MB86233_FIFO_WRITE_CB(_devcb) \ + devcb = &mb86233_cpu_device::set_fifo_write_cb(*device, DEVCB_##_devcb); +#define MCFG_MB86233_TABLE_REGION(_region) \ + mb86233_cpu_device::set_tablergn(*device, _region); class mb86233_cpu_device : public cpu_device diff --git a/src/devices/cpu/melps4/melps4.h b/src/devices/cpu/melps4/melps4.h index d3b84a01aa5..3605cd441f2 100644 --- a/src/devices/cpu/melps4/melps4.h +++ b/src/devices/cpu/melps4/melps4.h @@ -16,37 +16,37 @@ // K input or A/D input port, up to 16 pins #define MCFG_MELPS4_READ_K_CB(_devcb) \ - melps4_cpu_device::set_read_k_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_read_k_callback(*device, DEVCB_##_devcb); // D discrete I/O port, up to 16 pins - offset 0-15 for bit, 16 for all pins clear #define MCFG_MELPS4_READ_D_CB(_devcb) \ - melps4_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); #define MCFG_MELPS4_WRITE_D_CB(_devcb) \ - melps4_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); // 8-bit S generic I/O port #define MCFG_MELPS4_READ_S_CB(_devcb) \ - melps4_cpu_device::set_read_s_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_read_s_callback(*device, DEVCB_##_devcb); #define MCFG_MELPS4_WRITE_S_CB(_devcb) \ - melps4_cpu_device::set_write_s_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_s_callback(*device, DEVCB_##_devcb); // 4-bit F generic I/O port #define MCFG_MELPS4_READ_F_CB(_devcb) \ - melps4_cpu_device::set_read_f_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_read_f_callback(*device, DEVCB_##_devcb); #define MCFG_MELPS4_WRITE_F_CB(_devcb) \ - melps4_cpu_device::set_write_f_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_f_callback(*device, DEVCB_##_devcb); // 4-bit G generic output port #define MCFG_MELPS4_WRITE_G_CB(_devcb) \ - melps4_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); // 1-bit U generic output port #define MCFG_MELPS4_WRITE_U_CB(_devcb) \ - melps4_cpu_device::set_write_u_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_u_callback(*device, DEVCB_##_devcb); // T timer I/O pin (use execute_set_input for reads) #define MCFG_MELPS4_WRITE_T_CB(_devcb) \ - melps4_cpu_device::set_write_t_callback(*device, DEVCB_##_devcb); + devcb = &melps4_cpu_device::set_write_t_callback(*device, DEVCB_##_devcb); #define MELPS4_PORTD_CLR 16 diff --git a/src/devices/cpu/mn10200/mn10200.h b/src/devices/cpu/mn10200/mn10200.h index cfa5c53457e..4eb0947ab2b 100644 --- a/src/devices/cpu/mn10200/mn10200.h +++ b/src/devices/cpu/mn10200/mn10200.h @@ -13,9 +13,9 @@ // port setup #define MCFG_MN10200_READ_PORT_CB(X, _devcb) \ - mn10200_device::set_read_port##X##_callback(*device, DEVCB_##_devcb); + devcb = &mn10200_device::set_read_port##X##_callback(*device, DEVCB_##_devcb); #define MCFG_MN10200_WRITE_PORT_CB(X, _devcb) \ - mn10200_device::set_write_port##X##_callback(*device, DEVCB_##_devcb); + devcb = &mn10200_device::set_write_port##X##_callback(*device, DEVCB_##_devcb); enum { diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.h b/src/devices/cpu/nanoprocessor/nanoprocessor.h index fb112d647e0..56bf23dbf72 100644 --- a/src/devices/cpu/nanoprocessor/nanoprocessor.h +++ b/src/devices/cpu/nanoprocessor/nanoprocessor.h @@ -63,12 +63,12 @@ // DC0 is in bit 0, DC1 in bit 1 and so on. // Keep in mind that DC7 usually masks the interrupt signal. #define MCFG_HP_NANO_DC_CHANGED(_devcb) \ - hp_nanoprocessor_device::set_dc_changed_func(*device , DEVCB_##_devcb); + devcb = &hp_nanoprocessor_device::set_dc_changed_func(*device , DEVCB_##_devcb); // Callback to read the input state of DC lines // All lines that are not in input are to be reported at "1" #define MCFG_HP_NANO_READ_DC_CB(_devcb) \ - hp_nanoprocessor_device::set_read_dc_func(*device , DEVCB_##_devcb); + devcb = &hp_nanoprocessor_device::set_read_dc_func(*device , DEVCB_##_devcb); class hp_nanoprocessor_device : public cpu_device { diff --git a/src/devices/cpu/pic16c5x/pic16c5x.h b/src/devices/cpu/pic16c5x/pic16c5x.h index ef0f7dbbbd4..e675489ff41 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.h +++ b/src/devices/cpu/pic16c5x/pic16c5x.h @@ -27,25 +27,25 @@ enum // port a, 4 bits, 2-way #define MCFG_PIC16C5x_READ_A_CB(_devcb) \ - pic16c5x_device::set_read_a_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_read_a_callback(*device, DEVCB_##_devcb); #define MCFG_PIC16C5x_WRITE_A_CB(_devcb) \ - pic16c5x_device::set_write_a_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_write_a_callback(*device, DEVCB_##_devcb); // port b, 8 bits, 2-way #define MCFG_PIC16C5x_READ_B_CB(_devcb) \ - pic16c5x_device::set_read_b_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_read_b_callback(*device, DEVCB_##_devcb); #define MCFG_PIC16C5x_WRITE_B_CB(_devcb) \ - pic16c5x_device::set_write_b_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_write_b_callback(*device, DEVCB_##_devcb); // port c, 8 bits, 2-way #define MCFG_PIC16C5x_READ_C_CB(_devcb) \ - pic16c5x_device::set_read_c_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_read_c_callback(*device, DEVCB_##_devcb); #define MCFG_PIC16C5x_WRITE_C_CB(_devcb) \ - pic16c5x_device::set_write_c_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_write_c_callback(*device, DEVCB_##_devcb); // T0 pin (readline) #define MCFG_PIC16C5x_T0_CB(_devcb) \ - pic16c5x_device::set_t0_callback(*device, DEVCB_##_devcb); + devcb = &pic16c5x_device::set_t0_callback(*device, DEVCB_##_devcb); // CONFIG register #define MCFG_PIC16C5x_SET_CONFIG(_data) \ diff --git a/src/devices/cpu/sh4/sh4.cpp b/src/devices/cpu/sh4/sh4.cpp index 72ceae2c0a2..17c8b0a7459 100644 --- a/src/devices/cpu/sh4/sh4.cpp +++ b/src/devices/cpu/sh4/sh4.cpp @@ -2556,21 +2556,7 @@ inline void sh34_base_device::PREFM(const uint16_t opcode) * OPCODE DISPATCHERS *****************************************************************************/ - - - - - - - - - - - - - - - +// TODO: current SZ=1(64bit) FMOVs correct for SH4 in LE mode only /* FMOV.S @Rm+,FRn PR=0 SZ=0 1111nnnnmmmm1001 */ /* FMOV @Rm+,DRn PR=0 SZ=1 1111nnn0mmmm1001 */ @@ -2580,33 +2566,34 @@ inline void sh34_base_device::FMOVMRIFR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ - n = n & 14; - m_ea = m_r[m]; - m_r[m] += 8; - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(m_ea ); - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(m_ea+4 ); - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (n & 1) { - n = n & 14; - m_ea = m_r[m]; - m_xf[n] = RL(m_ea ); - m_r[m] += 4; - m_xf[n+1] = RL(m_ea+4 ); - m_r[m] += 4; - } else { - m_ea = m_r[m]; - m_fr[n] = RL(m_ea ); - m_r[m] += 4; - m_fr[n+1] = RL(m_ea+4 ); - m_r[m] += 4; - } - } else { /* SZ = 0 */ + if (m_fpu_sz) { /* SZ = 1 */ + if (n & 1) { + n &= 14; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif + m_ea = m_r[m]; + m_xf[n] = RL(m_ea ); + m_r[m] += 4; + m_xf[n^1] = RL(m_ea+4 ); + m_r[m] += 4; + } else { +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif m_ea = m_r[m]; m_fr[n] = RL(m_ea ); m_r[m] += 4; + m_fr[n^1] = RL(m_ea+4 ); + m_r[m] += 4; } + } else { /* SZ = 0 */ + m_ea = m_r[m]; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif + m_fr[n] = RL(m_ea ); + m_r[m] += 4; } } @@ -2618,27 +2605,29 @@ inline void sh34_base_device::FMOVFRMR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ - m= m & 14; - m_ea = m_r[n]; - WL(m_ea,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] ); - WL(m_ea+4,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] ); - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (m & 1) { - m= m & 14; - m_ea = m_r[n]; - WL(m_ea,m_xf[m] ); - WL(m_ea+4,m_xf[m+1] ); - } else { - m_ea = m_r[n]; - WL(m_ea,m_fr[m] ); - WL(m_ea+4,m_fr[m+1] ); - } - } else { /* SZ = 0 */ + if (m_fpu_sz) { /* SZ = 1 */ + if (m & 1) { + m &= 14; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + m_ea = m_r[n]; + WL(m_ea,m_xf[m] ); + WL(m_ea+4,m_xf[m^1] ); + } else { +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif m_ea = m_r[n]; WL(m_ea,m_fr[m] ); + WL(m_ea+4,m_fr[m^1] ); } + } else { /* SZ = 0 */ + m_ea = m_r[n]; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + WL(m_ea,m_fr[m] ); } } @@ -2650,31 +2639,32 @@ inline void sh34_base_device::FMOVFRMDR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ - m= m & 14; - m_r[n] -= 8; - m_ea = m_r[n]; - WL(m_ea,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] ); - WL(m_ea+4,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] ); - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (m & 1) { - m= m & 14; - m_r[n] -= 8; - m_ea = m_r[n]; - WL(m_ea,m_xf[m] ); - WL(m_ea+4,m_xf[m+1] ); - } else { - m_r[n] -= 8; - m_ea = m_r[n]; - WL(m_ea,m_fr[m] ); - WL(m_ea+4,m_fr[m+1] ); - } - } else { /* SZ = 0 */ - m_r[n] -= 4; + if (m_fpu_sz) { /* SZ = 1 */ + if (m & 1) { + m &= 14; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + m_r[n] -= 8; + m_ea = m_r[n]; + WL(m_ea,m_xf[m] ); + WL(m_ea+4,m_xf[m^1] ); + } else { +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + m_r[n] -= 8; m_ea = m_r[n]; WL(m_ea,m_fr[m] ); + WL(m_ea+4,m_fr[m^1] ); } + } else { /* SZ = 0 */ + m_r[n] -= 4; + m_ea = m_r[n]; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + WL(m_ea,m_fr[m] ); } } @@ -2686,27 +2676,29 @@ inline void sh34_base_device::FMOVFRS0(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ - m= m & 14; - m_ea = m_r[0] + m_r[n]; - WL(m_ea,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] ); - WL(m_ea+4,m_xf[m+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] ); - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (m & 1) { - m= m & 14; - m_ea = m_r[0] + m_r[n]; - WL(m_ea,m_xf[m] ); - WL(m_ea+4,m_xf[m+1] ); - } else { - m_ea = m_r[0] + m_r[n]; - WL(m_ea,m_fr[m] ); - WL(m_ea+4,m_fr[m+1] ); - } - } else { /* SZ = 0 */ + if (m_fpu_sz) { /* SZ = 1 */ + if (m & 1) { + m &= 14; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + m_ea = m_r[0] + m_r[n]; + WL(m_ea,m_xf[m] ); + WL(m_ea+4,m_xf[m^1] ); + } else { +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif m_ea = m_r[0] + m_r[n]; WL(m_ea,m_fr[m] ); + WL(m_ea+4,m_fr[m^1] ); } + } else { /* SZ = 0 */ + m_ea = m_r[0] + m_r[n]; +#ifdef LSB_FIRST + m ^= m_fpu_pr; +#endif + WL(m_ea,m_fr[m] ); } } @@ -2718,27 +2710,29 @@ inline void sh34_base_device::FMOVS0FR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ - n= n & 14; - m_ea = m_r[0] + m_r[m]; - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(m_ea ); - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(m_ea+4 ); - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (n & 1) { - n= n & 14; - m_ea = m_r[0] + m_r[m]; - m_xf[n] = RL(m_ea ); - m_xf[n+1] = RL(m_ea+4 ); - } else { - m_ea = m_r[0] + m_r[m]; - m_fr[n] = RL(m_ea ); - m_fr[n+1] = RL(m_ea+4 ); - } - } else { /* SZ = 0 */ + if (m_fpu_sz) { /* SZ = 1 */ + if (n & 1) { + n &= 14; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif + m_ea = m_r[0] + m_r[m]; + m_xf[n] = RL(m_ea ); + m_xf[n^1] = RL(m_ea+4 ); + } else { +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif m_ea = m_r[0] + m_r[m]; m_fr[n] = RL(m_ea ); + m_fr[n^1] = RL(m_ea+4 ); } + } else { /* SZ = 0 */ + m_ea = m_r[0] + m_r[m]; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif + m_fr[n] = RL(m_ea ); } } @@ -2751,35 +2745,29 @@ inline void sh34_base_device::FMOVMRFR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if (m_fpu_pr) { /* PR = 1 */ + if (m_fpu_sz) { /* SZ = 1 */ if (n & 1) { - n= n & 14; + n &= 14; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif m_ea = m_r[m]; - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(m_ea ); - m_xf[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(m_ea+4 ); + m_xf[n] = RL(m_ea ); + m_xf[n^1] = RL(m_ea+4 ); } else { - n= n & 14; - m_ea = m_r[m]; - m_fr[n+NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = RL(m_ea ); - m_fr[n+NATIVE_ENDIAN_VALUE_LE_BE(0,1)] = RL(m_ea+4 ); - } - } else { /* PR = 0 */ - if (m_fpu_sz) { /* SZ = 1 */ - if (n & 1) { - n= n & 14; - m_ea = m_r[m]; - m_xf[n] = RL(m_ea ); - m_xf[n+1] = RL(m_ea+4 ); - } else { - n= n & 14; - m_ea = m_r[m]; - m_fr[n] = RL(m_ea ); - m_fr[n+1] = RL(m_ea+4 ); - } - } else { /* SZ = 0 */ +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif m_ea = m_r[m]; m_fr[n] = RL(m_ea ); + m_fr[n^1] = RL(m_ea+4 ); } + } else { /* SZ = 0 */ + m_ea = m_r[m]; +#ifdef LSB_FIRST + n ^= m_fpu_pr; +#endif + m_fr[n] = RL(m_ea ); } } @@ -2792,9 +2780,14 @@ inline void sh34_base_device::FMOVFR(const uint16_t opcode) { uint32_t m = Rm; uint32_t n = Rn; - if ((m_fpu_sz == 0) && (m_fpu_pr == 0)) /* SZ = 0 */ + if (m_fpu_sz == 0) { /* SZ = 0 */ +#ifdef LSB_FIRST + n ^= m_fpu_pr; + m ^= m_fpu_pr; +#endif m_fr[n] = m_fr[m]; - else { /* SZ = 1 or PR = 1 */ + } + else { /* SZ = 1 */ if (m & 1) { if (n & 1) { m_xf[n & 14] = m_xf[m & 14]; @@ -2818,25 +2811,41 @@ inline void sh34_base_device::FMOVFR(const uint16_t opcode) /* FLDI1 FRn 1111nnnn10011101 */ inline void sh34_base_device::FLDI1(const uint16_t opcode) { +#ifdef LSB_FIRST + m_fr[Rn ^ m_fpu_pr] = 0x3F800000; +#else m_fr[Rn] = 0x3F800000; +#endif } /* FLDI0 FRn 1111nnnn10001101 */ inline void sh34_base_device::FLDI0(const uint16_t opcode) { +#ifdef LSB_FIRST + m_fr[Rn ^ m_fpu_pr] = 0; +#else m_fr[Rn] = 0; +#endif } /* FLDS FRm,FPUL 1111mmmm00011101 */ inline void sh34_base_device:: FLDS(const uint16_t opcode) { +#ifdef LSB_FIRST + m_fpul = m_fr[Rn ^ m_fpu_pr]; +#else m_fpul = m_fr[Rn]; +#endif } /* FSTS FPUL,FRn 1111nnnn00001101 */ inline void sh34_base_device:: FSTS(const uint16_t opcode) { +#ifdef LSB_FIRST + m_fr[Rn ^ m_fpu_pr] = m_fpul; +#else m_fr[Rn] = m_fpul; +#endif } /* FRCHG 1111101111111101 */ diff --git a/src/devices/cpu/sm510/kb1013vk1-2.h b/src/devices/cpu/sm510/kb1013vk1-2.h index 56896c940ac..031fa1d6bcf 100644 --- a/src/devices/cpu/sm510/kb1013vk1-2.h +++ b/src/devices/cpu/sm510/kb1013vk1-2.h @@ -23,10 +23,10 @@ class kb1013vk12_device : public sm500_device { public: - kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void execute_one() override; // opcode handlers diff --git a/src/devices/cpu/sm510/kb1013vk1-2core.cpp b/src/devices/cpu/sm510/kb1013vk1-2core.cpp index b7286e97401..a6848bb7696 100644 --- a/src/devices/cpu/sm510/kb1013vk1-2core.cpp +++ b/src/devices/cpu/sm510/kb1013vk1-2core.cpp @@ -28,13 +28,13 @@ static ADDRESS_MAP_START(data_5x13x4, AS_DATA, 8, sm510_base_device) ADDRESS_MAP_END // device definitions -kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : sm500_device(mconfig, KB1013VK12, "KB1013VK1-2", tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_8k), 7 /* data width */, ADDRESS_MAP_NAME(data_5x13x4), "kb1013vk1-2", __FILE__) { } // disasm -offs_t kb1013vk12_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t kb1013vk12_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(kb1013vk12); return CPU_DISASSEMBLE_NAME(kb1013vk12)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/sm510/sm500.h b/src/devices/cpu/sm510/sm500.h index 262c75fc29b..8c6cc5bd4e5 100644 --- a/src/devices/cpu/sm510/sm500.h +++ b/src/devices/cpu/sm510/sm500.h @@ -46,11 +46,11 @@ O36 48 | * | 13 K2 class sm500_device : public sm510_base_device { public: - sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void execute_one() override; virtual void get_opcode_param() override; diff --git a/src/devices/cpu/sm510/sm500core.cpp b/src/devices/cpu/sm510/sm500core.cpp index 84c1c557eb6..370a4c14ebd 100644 --- a/src/devices/cpu/sm510/sm500core.cpp +++ b/src/devices/cpu/sm510/sm500core.cpp @@ -28,17 +28,17 @@ ADDRESS_MAP_END // device definitions -sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : sm510_base_device(mconfig, SM500, "SM500", tag, owner, clock, 1 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_2k), 6 /* data width */, ADDRESS_MAP_NAME(data_4x10x4), "sm500", __FILE__) { } -sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : sm510_base_device(mconfig, type, name, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data, shortname, source) { } // disasm -offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(sm500); return CPU_DISASSEMBLE_NAME(sm500)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/sm510/sm510.cpp b/src/devices/cpu/sm510/sm510.cpp index decfcce4e56..6fcd0fe21b5 100644 --- a/src/devices/cpu/sm510/sm510.cpp +++ b/src/devices/cpu/sm510/sm510.cpp @@ -148,13 +148,13 @@ void sm510_base_device::device_reset() // lcd driver //------------------------------------------------- -inline uint16_t sm510_base_device::get_lcd_row(int column, uint8_t* ram) +inline u16 sm510_base_device::get_lcd_row(int column, u8* ram) { // output 0 if lcd blackpate/bleeder is off, or in case row doesn't exist if (ram == nullptr || m_bc || !m_bp) return 0; - uint16_t rowdata = 0; + u16 rowdata = 0; for (int i = 0; i < 0x10; i++) rowdata |= (ram[i] >> column & 1) << i; @@ -172,7 +172,7 @@ TIMER_CALLBACK_MEMBER(sm510_base_device::lcd_timer_cb) m_write_segc(h | SM510_PORT_SEGC, get_lcd_row(h, m_lcd_ram_c), 0xffff); // bs output from L/X and Y regs - uint8_t bs = (m_l >> h & 1) | ((m_x*2) >> h & 2); + u8 bs = (m_l >> h & 1) | ((m_x*2) >> h & 2); m_write_segbs(h | SM510_PORT_SEGBS, (m_bc || !m_bp) ? 0 : bs, 0xffff); } @@ -200,7 +200,7 @@ void sm510_base_device::clock_melody() // tone cycle table (SM511/SM512 datasheet fig.5) // cmd 0 = cmd, 1 = stop, > 13 = illegal(unknown) - static const uint8_t lut_tone_cycles[4*16] = + static const u8 lut_tone_cycles[4*16] = { 0, 0, 7, 8, 8, 9, 9, 10,11,11,12,13,14,14, 7*2, 8*2, 0, 0, 8, 8, 9, 9, 10,11,11,12,13,13,14,15, 8*2, 8*2, @@ -208,8 +208,8 @@ void sm510_base_device::clock_melody() 0, 0, 8, 9, 9, 10,10,11,11,12,13,14,14,15, 8*2, 9*2 }; - uint8_t cmd = m_melody_rom[m_melody_address] & 0x3f; - uint8_t out = 0; + u8 cmd = m_melody_rom[m_melody_address] & 0x3f; + u8 out = 0; // clock duty cycle if tone is active if ((cmd & 0xf) > 1) @@ -234,7 +234,7 @@ void sm510_base_device::clock_melody() // clock time base on F8(d7) if ((m_div & 0x7f) == 0) { - uint8_t mask = (cmd & 0x20) ? 0x1f : 0x0f; + u8 mask = (cmd & 0x20) ? 0x1f : 0x0f; m_melody_step_count = (m_melody_step_count + 1) & mask; if (m_melody_step_count == 0) @@ -257,7 +257,7 @@ void sm510_base_device::init_melody() // verify melody rom for (int i = 0; i < 0x100; i++) { - uint8_t data = m_melody_rom[i]; + u8 data = m_melody_rom[i]; if (data & 0xc0 || (data & 0x0f) > 13) logerror("%s unknown melody ROM data $%02X at $%02X\n", tag(), data, i); } diff --git a/src/devices/cpu/sm510/sm510.h b/src/devices/cpu/sm510/sm510.h index c60b0395af2..fe9e01484d1 100644 --- a/src/devices/cpu/sm510/sm510.h +++ b/src/devices/cpu/sm510/sm510.h @@ -16,38 +16,38 @@ // 4-bit K input port (pull-down) #define MCFG_SM510_READ_K_CB(_devcb) \ - sm510_base_device::set_read_k_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_read_k_callback(*device, DEVCB_##_devcb); // when in halt state, any K input going High can wake up the CPU, // driver is required to use execute_set_input(SM510_INPUT_LINE_K, state) #define SM510_INPUT_LINE_K 0 // 1-bit BA(aka alpha) input pin (pull-up) #define MCFG_SM510_READ_BA_CB(_devcb) \ - sm510_base_device::set_read_ba_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_read_ba_callback(*device, DEVCB_##_devcb); // 1-bit B(beta) input pin (pull-up) #define MCFG_SM510_READ_B_CB(_devcb) \ - sm510_base_device::set_read_b_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_read_b_callback(*device, DEVCB_##_devcb); // 8-bit S strobe output port #define MCFG_SM510_WRITE_S_CB(_devcb) \ - sm510_base_device::set_write_s_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_s_callback(*device, DEVCB_##_devcb); // 2-bit R melody output port #define MCFG_SM510_WRITE_R_CB(_devcb) \ - sm510_base_device::set_write_r_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_r_callback(*device, DEVCB_##_devcb); // LCD segment outputs: H1-4 as offset(low), a/b/c 1-16 as data d0-d15 #define MCFG_SM510_WRITE_SEGA_CB(_devcb) \ - sm510_base_device::set_write_sega_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_sega_callback(*device, DEVCB_##_devcb); #define MCFG_SM510_WRITE_SEGB_CB(_devcb) \ - sm510_base_device::set_write_segb_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_segb_callback(*device, DEVCB_##_devcb); #define MCFG_SM510_WRITE_SEGC_CB(_devcb) \ - sm510_base_device::set_write_segc_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_segc_callback(*device, DEVCB_##_devcb); // LCD bs output: same as above, but only up to 2 bits used #define MCFG_SM510_WRITE_SEGBS_CB(_devcb) \ - sm510_base_device::set_write_segbs_callback(*device, DEVCB_##_devcb); + devcb = &sm510_base_device::set_write_segbs_callback(*device, DEVCB_##_devcb); enum { @@ -92,7 +92,7 @@ class sm510_base_device : public cpu_device { public: // construction/destruction - sm510_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + sm510_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_LITTLE, 8, prgwidth, 0, program) , m_data_config("data", ENDIANNESS_LITTLE, 8, datawidth, 0, data) @@ -126,11 +126,11 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 2 - 1) / 2; } // default 2 cycles per machine cycle - virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 2); } // " - virtual uint32_t execute_min_cycles() const override { return 1; } - virtual uint32_t execute_max_cycles() const override { return 2; } - virtual uint32_t execute_input_lines() const override { return 1; } + virtual u64 execute_clocks_to_cycles(u64 clocks) const override { return (clocks + 2 - 1) / 2; } // default 2 cycles per machine cycle + virtual u64 execute_cycles_to_clocks(u64 cycles) const override { return (cycles * 2); } // " + virtual u32 execute_min_cycles() const override { return 1; } + virtual u32 execute_max_cycles() const override { return 2; } + virtual u32 execute_input_lines() const override { return 1; } virtual void execute_set_input(int line, int state) override; virtual void execute_run() override; virtual void execute_one() { } // -> child class @@ -139,8 +139,8 @@ protected: 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 1; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 0x40; } // actually 2, but debugger doesn't like non-linear pc + virtual u32 disasm_min_opcode_bytes() const override { return 1; } + virtual u32 disasm_max_opcode_bytes() const override { return 0x40; } // actually 2, but debugger doesn't like non-linear pc address_space_config m_program_config; address_space_config m_data_config; @@ -152,51 +152,51 @@ protected: int m_prgmask; int m_datamask; - uint16_t m_pc, m_prev_pc; - uint16_t m_op, m_prev_op; - uint8_t m_param; + u16 m_pc, m_prev_pc; + u16 m_op, m_prev_op; + u8 m_param; int m_stack_levels; - uint16_t m_stack[2]; + u16 m_stack[2]; int m_icount; - uint8_t m_acc; - uint8_t m_bl; - uint8_t m_bm; + u8 m_acc; + u8 m_bl; + u8 m_bm; bool m_sbm; - uint8_t m_c; + u8 m_c; bool m_skip; - uint8_t m_w; - uint8_t m_r; + u8 m_w; + u8 m_r; bool m_k_active; bool m_halt; // lcd driver - optional_shared_ptr<uint8_t> m_lcd_ram_a, m_lcd_ram_b, m_lcd_ram_c; + optional_shared_ptr<u8> m_lcd_ram_a, m_lcd_ram_b, m_lcd_ram_c; devcb_write16 m_write_sega, m_write_segb, m_write_segc, m_write_segbs; emu_timer *m_lcd_timer; - uint8_t m_l, m_x; - uint8_t m_y; + u8 m_l, m_x; + u8 m_y; bool m_bp; bool m_bc; - uint16_t get_lcd_row(int column, uint8_t* ram); + u16 get_lcd_row(int column, u8* ram); TIMER_CALLBACK_MEMBER(lcd_timer_cb); virtual void init_lcd_driver(); // melody controller - optional_region_ptr<uint8_t> m_melody_rom; - uint8_t m_melody_rd; - uint8_t m_melody_step_count; - uint8_t m_melody_duty_count; - uint8_t m_melody_duty_index; - uint8_t m_melody_address; + optional_region_ptr<u8> m_melody_rom; + u8 m_melody_rd; + u8 m_melody_step_count; + u8 m_melody_duty_count; + u8 m_melody_duty_index; + u8 m_melody_address; void clock_melody(); void init_melody(); // interrupt/divider emu_timer *m_div_timer; - uint16_t m_div; + u16 m_div; bool m_1s; bool wake_me_up(); @@ -215,12 +215,12 @@ protected: virtual void get_opcode_param() { } virtual void update_w_latch() { } - uint8_t ram_r(); - void ram_w(uint8_t data); + u8 ram_r(); + void ram_w(u8 data); void pop_stack(); void push_stack(); - void do_branch(uint8_t pu, uint8_t pm, uint8_t pl); - uint8_t bitmask(uint16_t param); + void do_branch(u8 pu, u8 pm, u8 pl); + u8 bitmask(u16 param); // opcode handlers virtual void op_lb(); @@ -295,10 +295,10 @@ protected: class sm510_device : public sm510_base_device { public: - sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void execute_one() override; virtual void get_opcode_param() override; @@ -309,11 +309,11 @@ protected: class sm511_device : public sm510_base_device { public: - sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - sm511_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + sm511_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void execute_one() override; virtual void get_opcode_param() override; }; @@ -321,7 +321,7 @@ protected: class sm512_device : public sm511_device { public: - sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/sm510/sm510core.cpp b/src/devices/cpu/sm510/sm510core.cpp index de503fcbc54..c886c178cfa 100644 --- a/src/devices/cpu/sm510/sm510core.cpp +++ b/src/devices/cpu/sm510/sm510core.cpp @@ -30,13 +30,13 @@ ADDRESS_MAP_END // device definitions -sm510_device::sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +sm510_device::sm510_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : sm510_base_device(mconfig, SM510, "SM510", tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, ADDRESS_MAP_NAME(program_2_7k), 7 /* data width */, ADDRESS_MAP_NAME(data_96_32x4), "sm510", __FILE__) { } // disasm -offs_t sm510_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t sm510_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(sm510); return CPU_DISASSEMBLE_NAME(sm510)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/sm510/sm510d.cpp b/src/devices/cpu/sm510/sm510d.cpp index 3929c52a82f..030b2157f63 100644 --- a/src/devices/cpu/sm510/sm510d.cpp +++ b/src/devices/cpu/sm510/sm510d.cpp @@ -69,7 +69,7 @@ static const char *const s_mnemonics[] = }; // number of bits per opcode parameter, 8 or larger means 2-byte opcode -static const uint8_t s_bits[] = +static const u8 s_bits[] = { 0, 8, 4, 8, 0, 0, 0, 0, @@ -99,7 +99,7 @@ static const uint8_t s_bits[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t s_flags[] = +static const u32 s_flags[] = { 0, 0, 0, 0, 0, 0, 0, 0, @@ -127,7 +127,7 @@ static const uint32_t s_flags[] = }; // next program counter in sequence (relative) -static const int8_t s_next_pc[0x40] = +static const s8 s_next_pc[0x40] = { 32, -1 /* rollback */, -1, 30, 30, -3, -3, 28, 28, -5, -5, 26, 26, -7, -7, 24, 24, -9, -9, 22, 22, -11, -11, 20, 20, -13, -13, 18, 18, -15, -15, 16, @@ -139,16 +139,16 @@ static const int8_t s_next_pc[0x40] = // common disasm -static offs_t sm510_common_disasm(const uint8_t *lut_mnemonic, const uint8_t *lut_extended, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram) +static offs_t sm510_common_disasm(const u8 *lut_mnemonic, const u8 *lut_extended, std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram) { // get raw opcode - uint8_t op = oprom[0]; - uint8_t instr = lut_mnemonic[op]; + u8 op = oprom[0]; + u8 instr = lut_mnemonic[op]; int len = 1; int bits = s_bits[instr]; - uint8_t mask = op & ((1 << (bits & 7)) - 1); - uint16_t param = mask; + u8 mask = op & ((1 << (bits & 7)) - 1); + u16 param = mask; if (bits >= 8) { // note: disasm view shows correct parameter, but raw view does not @@ -180,7 +180,7 @@ static offs_t sm510_common_disasm(const uint8_t *lut_mnemonic, const uint8_t *lu } else { - uint16_t address = (param << 4 & 0xc00) | (mask << 6 & 0x3c0) | (param & 0x03f); + u16 address = (param << 4 & 0xc00) | (mask << 6 & 0x3c0) | (param & 0x03f); util::stream_format(stream, "$%03X", address); } @@ -195,7 +195,7 @@ static offs_t sm510_common_disasm(const uint8_t *lut_mnemonic, const uint8_t *lu // SM510 disasm -static const uint8_t sm510_mnemonic[0x100] = +static const u8 sm510_mnemonic[0x100] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ mSKIP, mATBP, mSBM, mATPL, mRM, mRM, mRM, mRM, mADD, mADD11,mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0 @@ -227,7 +227,7 @@ CPU_DISASSEMBLE(sm510) // SM511 disasm -static const uint8_t sm511_mnemonic[0x100] = +static const u8 sm511_mnemonic[0x100] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ mROT, mDTA, mSBM, mATPL, mRM, mRM, mRM, mRM, mADD, mADD11,mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0 @@ -251,7 +251,7 @@ static const uint8_t sm511_mnemonic[0x100] = mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM, mTM // F }; -static const uint8_t sm511_extended[0x10] = +static const u8 sm511_extended[0x10] = { mRME, mSME, mTMEL, mATFC, mBDC, mATBP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 60 3 }; @@ -259,7 +259,7 @@ static const uint8_t sm511_extended[0x10] = CPU_DISASSEMBLE(sm511) { // create extended opcode table - uint8_t ext[0x100]; + u8 ext[0x100]; memset(ext, 0, 0x100); memcpy(ext + 0x30, sm511_extended, 0x10); @@ -269,7 +269,7 @@ CPU_DISASSEMBLE(sm511) // SM500 disasm -static const uint8_t sm500_mnemonic[0x100] = +static const u8 sm500_mnemonic[0x100] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ mSKIP, mATR, mEXKSA,mATBP, mRM, mRM, mRM, mRM, mADD, mADDC, mCOMA, mEXBLA,mSM, mSM, mSM, mSM, // 0 @@ -293,7 +293,7 @@ static const uint8_t sm500_mnemonic[0x100] = mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS, mTRS // F }; -static const uint8_t sm500_extended[0x10] = +static const u8 sm500_extended[0x10] = { mCEND, 0, 0, 0, mDTA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 5E 0 }; @@ -301,7 +301,7 @@ static const uint8_t sm500_extended[0x10] = CPU_DISASSEMBLE(sm500) { // create extended opcode table - uint8_t ext[0x100]; + u8 ext[0x100]; memset(ext, 0, 0x100); memcpy(ext + 0x00, sm500_extended, 0x10); @@ -311,7 +311,7 @@ CPU_DISASSEMBLE(sm500) // KB1013VK1-2 disasm -static const uint8_t kb1013vk12_mnemonic[0x100] = +static const u8 kb1013vk12_mnemonic[0x100] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ mNOP, mOAR, mBS1, mEN, mBM0, mBM0, mBM0, mBM0, mAM, mAC, mCOM, mXL, mBM1, mBM1, mBM1, mBM1, // 0 @@ -335,7 +335,7 @@ static const uint8_t kb1013vk12_mnemonic[0x100] = mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR, mCBR // F }; -static const uint8_t kb1013vk12_extended[0x10] = +static const u8 kb1013vk12_extended[0x10] = { mHLT, 0, 0, 0, mLDF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 5E 0 }; @@ -343,7 +343,7 @@ static const uint8_t kb1013vk12_extended[0x10] = CPU_DISASSEMBLE(kb1013vk12) { // create extended opcode table - uint8_t ext[0x100]; + u8 ext[0x100]; memset(ext, 0, 0x100); memcpy(ext + 0x00, kb1013vk12_extended, 0x10); diff --git a/src/devices/cpu/sm510/sm510op.cpp b/src/devices/cpu/sm510/sm510op.cpp index a18e39bac67..01ab9eee9d9 100644 --- a/src/devices/cpu/sm510/sm510op.cpp +++ b/src/devices/cpu/sm510/sm510op.cpp @@ -8,17 +8,17 @@ // internal helpers -inline uint8_t sm510_base_device::ram_r() +inline u8 sm510_base_device::ram_r() { int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM - uint8_t address = (bmh | m_bm << 4 | m_bl) & m_datamask; + u8 address = (bmh | m_bm << 4 | m_bl) & m_datamask; return m_data->read_byte(address) & 0xf; } -inline void sm510_base_device::ram_w(uint8_t data) +inline void sm510_base_device::ram_w(u8 data) { int bmh = (m_sbm) ? (1 << (m_datawidth-1)) : 0; // from SBM - uint8_t address = (bmh | m_bm << 4 | m_bl) & m_datamask; + u8 address = (bmh | m_bm << 4 | m_bl) & m_datamask; m_data->write_byte(address, data & 0xf); } @@ -36,13 +36,13 @@ void sm510_base_device::push_stack() m_stack[0] = m_pc; } -void sm510_base_device::do_branch(uint8_t pu, uint8_t pm, uint8_t pl) +void sm510_base_device::do_branch(u8 pu, u8 pm, u8 pl) { // set new PC(Pu/Pm/Pl) m_pc = ((pu << 10 & 0xc00) | (pm << 6 & 0x3c0) | (pl & 0x03f)) & m_prgmask; } -inline uint8_t sm510_base_device::bitmask(uint16_t param) +inline u8 sm510_base_device::bitmask(u16 param) { // bitmask from immediate opcode param return 1 << (param & 3); @@ -64,7 +64,7 @@ void sm510_base_device::op_lb() m_bl = (m_op >> 2 & 3); // bl(high) is still unclear, official doc is confusing - uint8_t hi = 0; + u8 hi = 0; switch (m_bl) { case 0: hi = 0; break; @@ -90,7 +90,7 @@ void sm510_base_device::op_sbm() void sm510_base_device::op_exbla() { // EXBLA: exchange BL with ACC - uint8_t a = m_acc; + u8 a = m_acc; m_acc = m_bl; m_bl = a; } @@ -155,7 +155,7 @@ void sm510_base_device::op_tm() // TM x: indirect subroutine call, pointers(IDX) are in page 0 m_icount--; push_stack(); - uint8_t idx = m_program->read_byte(m_op & 0x3f); + u8 idx = m_program->read_byte(m_op & 0x3f); do_branch(idx >> 6 & 3, 4, idx & 0x3f); } @@ -166,7 +166,7 @@ void sm510_base_device::op_tm() void sm510_base_device::op_exc() { // EXC x: exchange ACC with RAM, xor BM with x - uint8_t a = m_acc; + u8 a = m_acc; m_acc = ram_r(); ram_w(a); m_bm ^= (m_op & 3); @@ -304,7 +304,7 @@ void sm510_base_device::op_coma() void sm510_base_device::op_rot() { // ROT: rotate ACC right through carry - uint8_t c = m_acc & 1; + u8 c = m_acc & 1; m_acc = m_acc >> 1 | m_c << 3; m_c = c; } diff --git a/src/devices/cpu/sm510/sm511core.cpp b/src/devices/cpu/sm510/sm511core.cpp index ce134b24588..a241ef09b52 100644 --- a/src/devices/cpu/sm510/sm511core.cpp +++ b/src/devices/cpu/sm510/sm511core.cpp @@ -35,7 +35,7 @@ ADDRESS_MAP_END // disasm -offs_t sm511_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t sm511_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(sm511); return CPU_DISASSEMBLE_NAME(sm511)(this, stream, pc, oprom, opram, options); @@ -43,15 +43,15 @@ offs_t sm511_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u // device definitions -sm511_device::sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +sm511_device::sm511_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : sm510_base_device(mconfig, SM511, "SM511", tag, owner, clock, 2 /* stack levels */, 12 /* prg width */, ADDRESS_MAP_NAME(program_4k), 7 /* data width */, ADDRESS_MAP_NAME(data_96_32x4), "sm511", __FILE__) { } -sm511_device::sm511_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +sm511_device::sm511_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : sm510_base_device(mconfig, type, name, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data, shortname, source) { } -sm512_device::sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +sm512_device::sm512_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : sm511_device(mconfig, SM512, "SM512", tag, owner, clock, 2, 12, ADDRESS_MAP_NAME(program_4k), 7, ADDRESS_MAP_NAME(data_80_48x4), "sm512", __FILE__) { } diff --git a/src/devices/cpu/sm8500/sm8500.h b/src/devices/cpu/sm8500/sm8500.h index eb0c1f9f703..5baeed1cd66 100644 --- a/src/devices/cpu/sm8500/sm8500.h +++ b/src/devices/cpu/sm8500/sm8500.h @@ -6,10 +6,10 @@ #define __SM8500_H__ #define MCFG_SM8500_DMA_CB(_devcb) \ - sm8500_cpu_device::set_dma_cb(*device, DEVCB_##_devcb); + devcb = &sm8500_cpu_device::set_dma_cb(*device, DEVCB_##_devcb); #define MCFG_SM8500_TIMER_CB(_devcb) \ - sm8500_cpu_device::set_timer_cb(*device, DEVCB_##_devcb); + devcb = &sm8500_cpu_device::set_timer_cb(*device, DEVCB_##_devcb); enum { diff --git a/src/devices/cpu/superfx/superfx.h b/src/devices/cpu/superfx/superfx.h index 7f04f44171c..13dd042ffea 100644 --- a/src/devices/cpu/superfx/superfx.h +++ b/src/devices/cpu/superfx/superfx.h @@ -87,7 +87,7 @@ enum #define MCFG_SUPERFX_OUT_IRQ(_devcb) \ - superfx_device::set_out_irq_func(*device, DEVCB_##_devcb); + devcb = &superfx_device::set_out_irq_func(*device, DEVCB_##_devcb); class superfx_device : public cpu_device diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h index bad743a7645..a25f35f1a17 100644 --- a/src/devices/cpu/t11/t11.h +++ b/src/devices/cpu/t11/t11.h @@ -32,7 +32,7 @@ enum t11_device::set_initial_mode(*device, _mode); #define MCFG_T11_RESET(_devcb) \ - t11_device::set_out_reset_func(*device, DEVCB_##_devcb); + devcb = &t11_device::set_out_reset_func(*device, DEVCB_##_devcb); class t11_device : public cpu_device { diff --git a/src/devices/cpu/tlcs900/tlcs900.h b/src/devices/cpu/tlcs900/tlcs900.h index 12e6f8f1914..6c922ce66dc 100644 --- a/src/devices/cpu/tlcs900/tlcs900.h +++ b/src/devices/cpu/tlcs900/tlcs900.h @@ -615,22 +615,38 @@ protected: void _F0(); }; -#define MCFG_TMP95C061_PORT1_READ( _port_read ) tmp95c061_device::set_port1_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORT1_WRITE( _port_write ) tmp95c061_device::set_port1_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT2_WRITE( _port_write ) tmp95c061_device::set_port2_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT5_READ( _port_read ) tmp95c061_device::set_port5_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORT5_WRITE( _port_write ) tmp95c061_device::set_port5_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT6_READ( _port_read ) tmp95c061_device::set_port6_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORT6_WRITE( _port_write ) tmp95c061_device::set_port6_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT7_READ( _port_read ) tmp95c061_device::set_port7_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORT7_WRITE( _port_write ) tmp95c061_device::set_port7_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT8_READ( _port_read ) tmp95c061_device::set_port8_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORT8_WRITE( _port_write ) tmp95c061_device::set_port8_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORT9_READ( _port_read ) tmp95c061_device::set_port9_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORTA_READ( _port_read ) tmp95c061_device::set_porta_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORTA_WRITE( _port_write ) tmp95c061_device::set_porta_write( *device, DEVCB_##_port_write ); -#define MCFG_TMP95C061_PORTB_READ( _port_read ) tmp95c061_device::set_portb_read( *device, DEVCB_##_port_read ); -#define MCFG_TMP95C061_PORTB_WRITE( _port_write ) tmp95c061_device::set_portb_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT1_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port1_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORT1_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_port1_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT2_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_port2_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT5_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port5_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORT5_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_port5_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT6_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port6_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORT6_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_port6_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT7_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port7_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORT7_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_port7_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT8_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port8_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORT8_WRITE( _port_write ) \ + devcb = &mp95c061_device::set_port8_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORT9_READ( _port_read ) \ + devcb = &tmp95c061_device::set_port9_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORTA_READ( _port_read ) \ + devcb = &tmp95c061_device::set_porta_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORTA_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_porta_write( *device, DEVCB_##_port_write ); +#define MCFG_TMP95C061_PORTB_READ( _port_read ) \ + devcb = &tmp95c061_device::set_portb_read( *device, DEVCB_##_port_read ); +#define MCFG_TMP95C061_PORTB_WRITE( _port_write ) \ + devcb = &tmp95c061_device::set_portb_write( *device, DEVCB_##_port_write ); class tmp95c061_device : public tlcs900h_device { diff --git a/src/devices/cpu/tms1000/tms0270.cpp b/src/devices/cpu/tms1000/tms0270.cpp index edb9512518d..8c09fa49bea 100644 --- a/src/devices/cpu/tms1000/tms0270.cpp +++ b/src/devices/cpu/tms1000/tms0270.cpp @@ -32,7 +32,7 @@ ADDRESS_MAP_END // device definitions -tms0270_cpu_device::tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms0270_cpu_device::tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0980_cpu_device(mconfig, TMS0270, "TMS0270", tag, owner, clock, 16 /* o pins */, 16 /* r pins */, 7 /* pc bits */, 9 /* byte width */, 4 /* x width */, 12 /* prg width */, ADDRESS_MAP_NAME(program_11bit_9), 8 /* data width */, ADDRESS_MAP_NAME(data_144x4), "tms0270", __FILE__) , m_read_ctl(*this) , m_write_ctl(*this) @@ -145,14 +145,14 @@ void tms0270_cpu_device::dynamic_output() } } -uint8_t tms0270_cpu_device::read_k_input() +u8 tms0270_cpu_device::read_k_input() { // external: TMS5100 CTL port via SEG G,B,C,D if (m_chipsel) return (m_ctl_dir) ? m_ctl_out : m_read_ctl(0, 0xff) & 0xf; // standard K-input otherwise - uint8_t k = m_read_k(0, 0xff) & 0x1f; + u8 k = m_read_k(0, 0xff) & 0x1f; return (k & 0x10) ? 0xf : k; // the TMS0270 KF line asserts all K-inputs } diff --git a/src/devices/cpu/tms1000/tms0270.h b/src/devices/cpu/tms1000/tms0270.h index 77f596cda84..b60395c6329 100644 --- a/src/devices/cpu/tms1000/tms0270.h +++ b/src/devices/cpu/tms1000/tms0270.h @@ -14,19 +14,19 @@ // TMS0270 was designed to interface with TMS5100, set it up at driver level #define MCFG_TMS0270_READ_CTL_CB(_devcb) \ - tms0270_cpu_device::set_read_ctl_callback(*device, DEVCB_##_devcb); + devcb = &tms0270_cpu_device::set_read_ctl_callback(*device, DEVCB_##_devcb); #define MCFG_TMS0270_WRITE_CTL_CB(_devcb) \ - tms0270_cpu_device::set_write_ctl_callback(*device, DEVCB_##_devcb); + devcb = &tms0270_cpu_device::set_write_ctl_callback(*device, DEVCB_##_devcb); #define MCFG_TMS0270_WRITE_PDC_CB(_devcb) \ - tms0270_cpu_device::set_write_pdc_callback(*device, DEVCB_##_devcb); + devcb = &tms0270_cpu_device::set_write_pdc_callback(*device, DEVCB_##_devcb); class tms0270_cpu_device : public tms0980_cpu_device { public: - tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // static configuration helpers template<class _Object> static devcb_base &set_read_ctl_callback(device_t &device, _Object object) { return downcast<tms0270_cpu_device &>(device).m_read_ctl.set_callback(object); } @@ -40,8 +40,8 @@ protected: virtual machine_config_constructor device_mconfig_additions() const override; - virtual void write_o_output(uint8_t index) override { tms1k_base_device::write_o_output(index); } - virtual uint8_t read_k_input() override; + virtual void write_o_output(u8 index) override { tms1k_base_device::write_o_output(index); } + virtual u8 read_k_input() override; virtual void dynamic_output() override; virtual void op_setr() override; @@ -50,15 +50,15 @@ protected: private: // state specific to interface with TMS5100 - uint16_t m_r_prev; - uint8_t m_chipsel; - uint8_t m_ctl_out; - uint8_t m_ctl_dir; - int m_pdc; - - uint8_t m_o_latch_low; - uint8_t m_o_latch; - uint8_t m_o_latch_prev; + u16 m_r_prev; + u8 m_chipsel; + u8 m_ctl_out; + u8 m_ctl_dir; + int m_pdc; + + u8 m_o_latch_low; + u8 m_o_latch; + u8 m_o_latch_prev; devcb_read8 m_read_ctl; devcb_write8 m_write_ctl; diff --git a/src/devices/cpu/tms1000/tms0970.cpp b/src/devices/cpu/tms1000/tms0970.cpp index b24f1ba6774..0f67ffa4055 100644 --- a/src/devices/cpu/tms1000/tms0970.cpp +++ b/src/devices/cpu/tms1000/tms0970.cpp @@ -36,19 +36,19 @@ ADDRESS_MAP_END // device definitions -tms0970_cpu_device::tms0970_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms0970_cpu_device::tms0970_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS0970, "TMS0970", tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 2 /* x width */, 10 /* prg width */, ADDRESS_MAP_NAME(program_10bit_8), 6 /* data width */, ADDRESS_MAP_NAME(data_64x4), "tms0970", __FILE__) { } -tms0970_cpu_device::tms0970_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms0970_cpu_device::tms0970_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms1000_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms0950_cpu_device::tms0950_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms0950_cpu_device::tms0950_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0970_cpu_device(mconfig, TMS0950, "TMS0950", tag, owner, clock, 8, 11, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_10bit_8), 6, ADDRESS_MAP_NAME(data_64x4), "tms0950", __FILE__) { } -tms1990_cpu_device::tms1990_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1990_cpu_device::tms1990_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0970_cpu_device(mconfig, TMS1990, "TMS1990", tag, owner, clock, 8, 11, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_10bit_8), 6, ADDRESS_MAP_NAME(data_64x4), "tms1990", __FILE__) { } @@ -97,9 +97,9 @@ void tms0970_cpu_device::device_reset() // pre-decode instructionset m_fixed_decode.resize(0x100); - memset(&m_fixed_decode[0], 0, 0x100*sizeof(uint32_t)); + memset(&m_fixed_decode[0], 0, 0x100*sizeof(u32)); m_micro_decode.resize(0x100); - memset(&m_micro_decode[0], 0, 0x100*sizeof(uint32_t)); + memset(&m_micro_decode[0], 0, 0x100*sizeof(u32)); for (int op = 0; op < 0x100; op++) { @@ -108,26 +108,26 @@ void tms0970_cpu_device::device_reset() m_fixed_decode[op] = (op & 0x40) ? F_CALL: F_BR; // 5 output bits select a microinstruction index - uint32_t imask = m_ipla->read(op); - uint8_t msel = imask & 0x1f; + u32 imask = m_ipla->read(op); + u8 msel = imask & 0x1f; // but if (from bottom to top) term 1 is active and output bit 5 is 0, R2,R4-R7 directly select a microinstruction index if (imask & 0x40 && (imask & 0x20) == 0) msel = (op & 0xf) | (op >> 1 & 0x10); msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed - uint32_t mmask = m_mpla->read(msel); + u32 mmask = m_mpla->read(msel); mmask ^= 0x09fe; // invert active-negative - // _____ _____ _____ _____ ______ _____ ______ _____ _____ - const uint32_t md[15] = { M_CKM, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_CIN, M_AUTA, M_AUTY, M_STO }; + // _____ _____ _____ _____ ______ _____ ______ _____ _____ + const u32 md[15] = { M_CKM, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_CIN, M_AUTA, M_AUTY, M_STO }; for (int bit = 0; bit < 15; bit++) if (mmask & (1 << bit)) m_micro_decode[op] |= md[bit]; // the other ipla terms each select a fixed instruction - const uint32_t id[8] = { F_LDP, F_TDO, F_COMX, F_LDX, F_SBIT, F_RBIT, F_SETR, F_RETN }; + const u32 id[8] = { F_LDP, F_TDO, F_COMX, F_LDX, F_SBIT, F_RBIT, F_SETR, F_RETN }; for (int bit = 0; bit < 8; bit++) if (imask & (0x80 << bit)) @@ -137,7 +137,7 @@ void tms0970_cpu_device::device_reset() // i/o handling -void tms0970_cpu_device::write_o_output(uint8_t index) +void tms0970_cpu_device::write_o_output(u8 index) { m_o_index = index; m_o = m_spla->read(index); @@ -150,7 +150,7 @@ void tms0970_cpu_device::op_setr() { // SETR: set output register // DDIG line is a coincidence between the selected output pla row(s) and segment pla row(s) - int ddig = (m_opla->read(m_a) & m_o) ? 1 : 0; + int ddig = (~m_opla->read(m_a) & m_o) ? 0 : 1; m_r = (m_r & ~(1 << m_y)) | (ddig << m_y); } diff --git a/src/devices/cpu/tms1000/tms0970.h b/src/devices/cpu/tms1000/tms0970.h index 360e30a42cb..ca436163374 100644 --- a/src/devices/cpu/tms1000/tms0970.h +++ b/src/devices/cpu/tms1000/tms0970.h @@ -15,15 +15,15 @@ class tms0970_cpu_device : public tms1000_cpu_device { public: - tms0970_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms0970_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms0970_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms0970_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: // overrides virtual void device_reset() override; virtual machine_config_constructor device_mconfig_additions() const override; - virtual void write_o_output(uint8_t index) override; + virtual void write_o_output(u8 index) override; virtual void op_setr() override; virtual void op_tdo() override; @@ -32,7 +32,7 @@ protected: class tms0950_cpu_device : public tms0970_cpu_device { public: - tms0950_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms0950_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // overrides @@ -46,7 +46,7 @@ protected: class tms1990_cpu_device : public tms0970_cpu_device { public: - tms1990_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1990_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/tms1000/tms0980.cpp b/src/devices/cpu/tms1000/tms0980.cpp index 5e9ea00d178..cb4a00adbde 100644 --- a/src/devices/cpu/tms1000/tms0980.cpp +++ b/src/devices/cpu/tms1000/tms0980.cpp @@ -40,15 +40,15 @@ ADDRESS_MAP_END // device definitions -tms0980_cpu_device::tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms0980_cpu_device::tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0970_cpu_device(mconfig, TMS0980, "TMS0980", tag, owner, clock, 8 /* o pins */, 9 /* r pins */, 7 /* pc bits */, 9 /* byte width */, 4 /* x width */, 12 /* prg width */, ADDRESS_MAP_NAME(program_11bit_9), 8 /* data width */, ADDRESS_MAP_NAME(data_144x4), "tms0980", __FILE__) { } -tms0980_cpu_device::tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms0980_cpu_device::tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms0970_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms1980_cpu_device::tms1980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1980_cpu_device::tms1980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0980_cpu_device(mconfig, TMS1980, "TMS1980", tag, owner, clock, 7, 10, 7, 9, 4, 12, ADDRESS_MAP_NAME(program_11bit_9), 8, ADDRESS_MAP_NAME(data_144x4), "tms1980", __FILE__) { } @@ -90,7 +90,7 @@ machine_config_constructor tms1980_cpu_device::device_mconfig_additions() const // disasm -offs_t tms0980_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t tms0980_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(tms0980); return CPU_DISASSEMBLE_NAME(tms0980)(this, stream, pc, oprom, opram, options); @@ -98,13 +98,13 @@ offs_t tms0980_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, c // device_reset -uint32_t tms0980_cpu_device::decode_fixed(uint16_t op) +u32 tms0980_cpu_device::decode_fixed(u16 op) { - uint32_t decode = 0; - uint32_t mask = m_ipla->read(op); + u32 decode = 0; + u32 mask = m_ipla->read(op); // 1 line per PLA row, no OR-mask - const uint32_t id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC }; + const u32 id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC }; for (int bit = 0; bit < 15; bit++) if (mask & (0x80 << bit)) @@ -113,17 +113,17 @@ uint32_t tms0980_cpu_device::decode_fixed(uint16_t op) return decode; } -uint32_t tms0980_cpu_device::decode_micro(uint8_t sel) +u32 tms0980_cpu_device::decode_micro(u8 sel) { - uint32_t decode = 0; + u32 decode = 0; sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed - uint32_t mask = m_mpla->read(sel); + u32 mask = m_mpla->read(sel); mask ^= 0x43fc3; // invert active-negative // M_RSTR is specific to TMS02x0/TMS1980, it redirects to F_RSTR // M_UNK1 is specific to TMS0270, unknown/unused yet and apparently not connected on every TMS0270 - // _______ ______ _____ _____ _____ _____ ______ _____ ______ _____ _____ - const uint32_t md[22] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO, M_RSTR, M_UNK1 }; + // _______ ______ _____ _____ _____ _____ ______ _____ ______ _____ _____ + const u32 md[22] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO, M_RSTR, M_UNK1 }; for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++) if (mask & (1 << bit)) @@ -139,11 +139,11 @@ void tms0980_cpu_device::device_reset() // pre-decode instructionset m_fixed_decode.resize(0x200); - memset(&m_fixed_decode[0], 0, 0x200*sizeof(uint32_t)); + memset(&m_fixed_decode[0], 0, 0x200*sizeof(u32)); m_micro_decode.resize(0x200); - memset(&m_micro_decode[0], 0, 0x200*sizeof(uint32_t)); + memset(&m_micro_decode[0], 0, 0x200*sizeof(u32)); - for (uint16_t op = 0; op < 0x200; op++) + for (u16 op = 0; op < 0x200; op++) { // upper half of the opcodes is always branch/call if (op & 0x100) @@ -159,7 +159,7 @@ void tms0980_cpu_device::device_reset() // like on TMS0970, one of the terms directly select a microinstruction index (via R4-R8), // but it can't be pre-determined when it's active m_micro_direct.resize(0x40); - memset(&m_micro_decode[0], 0, 0x40*sizeof(uint32_t)); + memset(&m_micro_decode[0], 0, 0x40*sizeof(u32)); for (int op = 0; op < 0x40; op++) m_micro_direct[op] = decode_micro(op); @@ -167,7 +167,7 @@ void tms0980_cpu_device::device_reset() // program counter/opcode decode -uint32_t tms0980_cpu_device::read_micro() +u32 tms0980_cpu_device::read_micro() { // if ipla term 0 is active, R4-R8 directly select a microinstruction index when R0 or R0^BL is 0 int r0 = m_opcode >> 8 & 1; @@ -195,10 +195,10 @@ void tms0980_cpu_device::read_opcode() // i/o handling -uint8_t tms0980_cpu_device::read_k_input() +u8 tms0980_cpu_device::read_k_input() { - uint8_t k = m_read_k(0, 0xff) & 0x1f; - uint8_t k3 = (k & 0x10) ? 3: 0; // the TMS0980 K3 line is simply K1|K2 + u8 k = m_read_k(0, 0xff) & 0x1f; + u8 k3 = (k & 0x10) ? 3: 0; // the TMS0980 K3 line is simply K1|K2 return (k & 0xf) | k3; } diff --git a/src/devices/cpu/tms1000/tms0980.h b/src/devices/cpu/tms1000/tms0980.h index afbcaa3647d..24ef6c000ad 100644 --- a/src/devices/cpu/tms1000/tms0980.h +++ b/src/devices/cpu/tms1000/tms0980.h @@ -15,24 +15,24 @@ class tms0980_cpu_device : public tms0970_cpu_device { public: - tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms0980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms0980_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: // overrides - virtual uint32_t decode_fixed(uint16_t op); - virtual uint32_t decode_micro(uint8_t sel); + virtual u32 decode_fixed(u16 op); + virtual u32 decode_micro(u8 sel); virtual void device_reset() override; virtual machine_config_constructor device_mconfig_additions() const override; - virtual uint32_t disasm_min_opcode_bytes() const override { return 2; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 2; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual u32 disasm_min_opcode_bytes() const override { return 2; } + virtual u32 disasm_max_opcode_bytes() const override { return 2; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; - virtual uint8_t read_k_input() override; + virtual u8 read_k_input() override; virtual void set_cki_bus() override; - virtual uint32_t read_micro(); + virtual u32 read_micro(); virtual void read_opcode() override; virtual void op_comx() override; @@ -41,14 +41,14 @@ protected: class tms1980_cpu_device : public tms0980_cpu_device { public: - tms1980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1980_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // overrides virtual machine_config_constructor device_mconfig_additions() const override; - virtual void write_o_output(uint8_t index) override { tms1k_base_device::write_o_output(index); } - virtual uint8_t read_k_input() override { return tms1k_base_device::read_k_input(); } + virtual void write_o_output(u8 index) override { tms1k_base_device::write_o_output(index); } + virtual u8 read_k_input() override { return tms1k_base_device::read_k_input(); } virtual void op_setr() override { tms1k_base_device::op_setr(); } virtual void op_tdo() override; diff --git a/src/devices/cpu/tms1000/tms1000.cpp b/src/devices/cpu/tms1000/tms1000.cpp index 05ff12e03c6..a971b3e01b8 100644 --- a/src/devices/cpu/tms1000/tms1000.cpp +++ b/src/devices/cpu/tms1000/tms1000.cpp @@ -47,31 +47,31 @@ ADDRESS_MAP_END // device definitions -tms1000_cpu_device::tms1000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1000_cpu_device::tms1000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1k_base_device(mconfig, TMS1000, "TMS1000", tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 2 /* x width */, 10 /* prg width */, ADDRESS_MAP_NAME(program_10bit_8), 6 /* data width */, ADDRESS_MAP_NAME(data_64x4), "tms1000", __FILE__) { } -tms1000_cpu_device::tms1000_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms1000_cpu_device::tms1000_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms1k_base_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms1070_cpu_device::tms1070_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1070_cpu_device::tms1070_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1070, "TMS1070", tag, owner, clock, 8, 11, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_10bit_8), 6, ADDRESS_MAP_NAME(data_64x4), "tms1070", __FILE__) { } -tms1040_cpu_device::tms1040_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1040_cpu_device::tms1040_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1040, "TMS1040", tag, owner, clock, 8, 11, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_10bit_8), 6, ADDRESS_MAP_NAME(data_64x4), "tms1040", __FILE__) { } -tms1200_cpu_device::tms1200_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1200_cpu_device::tms1200_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1200, "TMS1200", tag, owner, clock, 8, 13, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_10bit_8), 6, ADDRESS_MAP_NAME(data_64x4), "tms1200", __FILE__) { } -tms1700_cpu_device::tms1700_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1700_cpu_device::tms1700_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1700, "TMS1700", tag, owner, clock, 8, 9, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_9bit_8), 6, ADDRESS_MAP_NAME(data_32x4), "tms1700", __FILE__) { } -tms1730_cpu_device::tms1730_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1730_cpu_device::tms1730_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1730, "TMS1730", tag, owner, clock, 8, 9, 6, 8, 2, 10, ADDRESS_MAP_NAME(program_9bit_8), 6, ADDRESS_MAP_NAME(data_32x4), "tms1730", __FILE__) { } @@ -93,7 +93,7 @@ machine_config_constructor tms1000_cpu_device::device_mconfig_additions() const // disasm -offs_t tms1000_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t tms1000_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(tms1000); return CPU_DISASSEMBLE_NAME(tms1000)(this, stream, pc, oprom, opram, options); @@ -108,15 +108,15 @@ void tms1000_cpu_device::device_reset() // pre-decode instructionset m_fixed_decode.resize(0x100); - memset(&m_fixed_decode[0], 0, 0x100*sizeof(uint32_t)); + memset(&m_fixed_decode[0], 0, 0x100*sizeof(u32)); m_micro_decode.resize(0x100); - memset(&m_micro_decode[0], 0, 0x100*sizeof(uint32_t)); + memset(&m_micro_decode[0], 0, 0x100*sizeof(u32)); for (int op = 0; op < 0x100; op++) { - // _____ _____ ______ _____ ______ _____ _____ _____ _____ - const uint32_t md[16] = { M_STSL, M_AUTY, M_AUTA, M_CIN, M_C8, M_NE, M_CKN, M_15TN, M_MTN, M_NATN, M_ATN, M_MTP, M_YTP, M_CKP, M_CKM, M_STO }; - uint16_t mask = m_mpla->read(op); + // _____ _____ ______ _____ ______ _____ _____ _____ _____ + const u32 md[16] = { M_STSL, M_AUTY, M_AUTA, M_CIN, M_C8, M_NE, M_CKN, M_15TN, M_MTN, M_NATN, M_ATN, M_MTP, M_YTP, M_CKP, M_CKM, M_STO }; + u16 mask = m_mpla->read(op); mask ^= 0x3fc8; // invert active-negative for (int bit = 0; bit < 16; bit++) diff --git a/src/devices/cpu/tms1000/tms1000.h b/src/devices/cpu/tms1000/tms1000.h index 049b24873fd..7e2ac9c0822 100644 --- a/src/devices/cpu/tms1000/tms1000.h +++ b/src/devices/cpu/tms1000/tms1000.h @@ -15,8 +15,8 @@ class tms1000_cpu_device : public tms1k_base_device { public: - tms1000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms1000_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms1000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms1000_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: // overrides @@ -24,39 +24,39 @@ protected: virtual machine_config_constructor device_mconfig_additions() const override; - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; }; class tms1070_cpu_device : public tms1000_cpu_device { public: - tms1070_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1070_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1040_cpu_device : public tms1000_cpu_device { public: - tms1040_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1040_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1200_cpu_device : public tms1000_cpu_device { public: - tms1200_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1200_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1700_cpu_device : public tms1000_cpu_device { public: - tms1700_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1700_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1730_cpu_device : public tms1000_cpu_device { public: - tms1730_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1730_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/tms1000/tms1100.cpp b/src/devices/cpu/tms1000/tms1100.cpp index 93c7c07a69c..f896f60d9eb 100644 --- a/src/devices/cpu/tms1000/tms1100.cpp +++ b/src/devices/cpu/tms1000/tms1100.cpp @@ -27,29 +27,29 @@ ADDRESS_MAP_END // device definitions -tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1000_cpu_device(mconfig, TMS1100, "TMS1100", tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 3 /* x width */, 11 /* prg width */, ADDRESS_MAP_NAME(program_11bit_8), 7 /* data width */, ADDRESS_MAP_NAME(data_128x4), "tms1100", __FILE__) { } -tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms1000_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms1170_cpu_device::tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1170_cpu_device::tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1100_cpu_device(mconfig, TMS1170, "TMS1170", tag, owner, clock, 8, 11, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1170", __FILE__) { } -tms1300_cpu_device::tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1300_cpu_device::tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1100_cpu_device(mconfig, TMS1300, "TMS1300", tag, owner, clock, 8, 16, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1300", __FILE__) { } -tms1370_cpu_device::tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1370_cpu_device::tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1100_cpu_device(mconfig, TMS1370, "TMS1370", tag, owner, clock, 8, 16, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1370", __FILE__) { } // disasm -offs_t tms1100_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t tms1100_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(tms1100); return CPU_DISASSEMBLE_NAME(tms1100)(this, stream, pc, oprom, opram, options); diff --git a/src/devices/cpu/tms1000/tms1100.h b/src/devices/cpu/tms1000/tms1100.h index b5df68e40cc..be0b6a70f10 100644 --- a/src/devices/cpu/tms1000/tms1100.h +++ b/src/devices/cpu/tms1000/tms1100.h @@ -15,14 +15,14 @@ class tms1100_cpu_device : public tms1000_cpu_device { public: - tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms1100_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms1100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms1100_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: // overrides virtual void device_reset() override; - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual void op_setr() override; virtual void op_rstr() override; @@ -31,19 +31,19 @@ protected: class tms1170_cpu_device : public tms1100_cpu_device { public: - tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1300_cpu_device : public tms1100_cpu_device { public: - tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1370_cpu_device : public tms1100_cpu_device { public: - tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/tms1000/tms1400.cpp b/src/devices/cpu/tms1000/tms1400.cpp index 550911a9752..d8f12700289 100644 --- a/src/devices/cpu/tms1000/tms1400.cpp +++ b/src/devices/cpu/tms1000/tms1400.cpp @@ -36,28 +36,28 @@ ADDRESS_MAP_END // device definitions -tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1100_cpu_device(mconfig, TMS1400, "TMS1400", tag, owner, clock, 8 /* o pins */, 11 /* r pins */, 6 /* pc bits */, 8 /* byte width */, 3 /* x width */, 12 /* prg width */, ADDRESS_MAP_NAME(program_12bit_8), 7 /* data width */, ADDRESS_MAP_NAME(data_128x4), "tms1400", __FILE__) { } -tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms1100_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms1470_cpu_device::tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1470_cpu_device::tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1400_cpu_device(mconfig, TMS1470, "TMS1470", tag, owner, clock, 8, 10, 6, 8, 3, 12, ADDRESS_MAP_NAME(program_12bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1470", __FILE__) { } -tms1600_cpu_device::tms1600_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1600_cpu_device::tms1600_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1400_cpu_device(mconfig, TMS1600, "TMS1600", tag, owner, clock, 8, 16, 6, 8, 3, 12, ADDRESS_MAP_NAME(program_12bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1600", __FILE__) { } -tms1600_cpu_device::tms1600_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) +tms1600_cpu_device::tms1600_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : tms1400_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } -tms1670_cpu_device::tms1670_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1670_cpu_device::tms1670_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1600_cpu_device(mconfig, TMS1670, "TMS1670", tag, owner, clock, 8, 16, 6, 8, 3, 12, ADDRESS_MAP_NAME(program_12bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1670", __FILE__) { } diff --git a/src/devices/cpu/tms1000/tms1400.h b/src/devices/cpu/tms1000/tms1400.h index 1bfb59a821e..af8498ad28b 100644 --- a/src/devices/cpu/tms1000/tms1400.h +++ b/src/devices/cpu/tms1000/tms1400.h @@ -15,8 +15,8 @@ class tms1400_cpu_device : public tms1100_cpu_device { public: - tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); protected: // overrides @@ -34,21 +34,21 @@ protected: class tms1470_cpu_device : public tms1400_cpu_device { public: - tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class tms1600_cpu_device : public tms1400_cpu_device { public: - tms1600_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms1600_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + tms1600_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms1600_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); }; class tms1670_cpu_device : public tms1600_cpu_device { public: - tms1670_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1670_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/tms1000/tms1k_base.cpp b/src/devices/cpu/tms1000/tms1k_base.cpp index b8afaa75246..8caa62493c7 100644 --- a/src/devices/cpu/tms1000/tms1k_base.cpp +++ b/src/devices/cpu/tms1000/tms1k_base.cpp @@ -220,6 +220,8 @@ void tms1k_base_device::device_reset() m_eac = 0; m_bl = 0; m_add = 0; + m_status = 0; + m_clatch = 0; m_opcode = 0; m_micro = 0; @@ -274,7 +276,7 @@ void tms1k_base_device::read_opcode() // i/o handling //------------------------------------------------- -void tms1k_base_device::write_o_output(uint8_t index) +void tms1k_base_device::write_o_output(u8 index) { // a hardcoded table is supported if the output pla is unknown m_o_index = index; @@ -282,7 +284,7 @@ void tms1k_base_device::write_o_output(uint8_t index) m_write_o(0, m_o & m_o_mask, 0xffff); } -uint8_t tms1k_base_device::read_k_input() +u8 tms1k_base_device::read_k_input() { // K1,2,4,8 (KC test pin is not emulated) return m_read_k(0, 0xff) & 0xf; @@ -343,7 +345,7 @@ void tms1k_base_device::op_call() // CALL/CALLL: conditional call if (m_status) { - uint8_t prev_pa = m_pa; + u8 prev_pa = m_pa; if (m_clatch == 0) { diff --git a/src/devices/cpu/tms1000/tms1k_base.h b/src/devices/cpu/tms1000/tms1k_base.h index 39ccbf31ea1..2363bccabca 100644 --- a/src/devices/cpu/tms1000/tms1k_base.h +++ b/src/devices/cpu/tms1000/tms1k_base.h @@ -18,11 +18,11 @@ // K input pins #define MCFG_TMS1XXX_READ_K_CB(_devcb) \ - tms1k_base_device::set_read_k_callback(*device, DEVCB_##_devcb); + devcb = &tms1k_base_device::set_read_k_callback(*device, DEVCB_##_devcb); // O/Segment output pins #define MCFG_TMS1XXX_WRITE_O_CB(_devcb) \ - tms1k_base_device::set_write_o_callback(*device, DEVCB_##_devcb); + devcb = &tms1k_base_device::set_write_o_callback(*device, DEVCB_##_devcb); // Use this if the output PLA is unknown: // If the microinstructions (or other) PLA is unknown, try using one from another romset. @@ -31,11 +31,11 @@ // R output pins (also called D on some chips) #define MCFG_TMS1XXX_WRITE_R_CB(_devcb) \ - tms1k_base_device::set_write_r_callback(*device, DEVCB_##_devcb); + devcb = &tms1k_base_device::set_write_r_callback(*device, DEVCB_##_devcb); // OFF request on TMS0980 and up #define MCFG_TMS1XXX_POWER_OFF_CB(_devcb) \ - tms1k_base_device::set_power_off_callback(*device, DEVCB_##_devcb); + devcb = &tms1k_base_device::set_power_off_callback(*device, DEVCB_##_devcb); // pinout reference @@ -84,7 +84,7 @@ class tms1k_base_device : public cpu_device { public: // construction/destruction - tms1k_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t o_pins, uint8_t r_pins, uint8_t pc_bits, uint8_t byte_bits, uint8_t x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + tms1k_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 o_pins, u8 r_pins, u8 pc_bits, u8 byte_bits, u8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, byte_bits > 8 ? 16 : 8, prgwidth, 0, program) , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data) @@ -109,9 +109,9 @@ public: template<class _Object> static devcb_base &set_write_o_callback(device_t &device, _Object object) { return downcast<tms1k_base_device &>(device).m_write_o.set_callback(object); } template<class _Object> static devcb_base &set_write_r_callback(device_t &device, _Object object) { return downcast<tms1k_base_device &>(device).m_write_r.set_callback(object); } template<class _Object> static devcb_base &set_power_off_callback(device_t &device, _Object object) { return downcast<tms1k_base_device &>(device).m_power_off.set_callback(object); } - static void set_output_pla(device_t &device, const uint16_t *output_pla) { downcast<tms1k_base_device &>(device).m_output_pla_table = output_pla; } + static void set_output_pla(device_t &device, const u16 *output_pla) { downcast<tms1k_base_device &>(device).m_output_pla_table = output_pla; } - uint8_t debug_peek_o_index() { return m_o_index; } // get output PLA index, for debugging (don't use in emulation) + u8 debug_peek_o_index() { return m_o_index; } // get output PLA index, for debugging (don't use in emulation) // microinstructions enum @@ -177,25 +177,25 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint32_t execute_min_cycles() const override { return 1; } - virtual uint32_t execute_max_cycles() const override { return 6; } - virtual uint32_t execute_input_lines() const override { return 1; } + virtual u32 execute_min_cycles() const override { return 1; } + virtual u32 execute_max_cycles() const override { return 6; } + virtual u32 execute_input_lines() const override { return 1; } virtual void execute_run() override; // 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 1; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 1; } + virtual u32 disasm_min_opcode_bytes() const override { return 1; } + virtual u32 disasm_max_opcode_bytes() const override { return 1; } // device_state_interface overrides virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; void next_pc(); - virtual void write_o_output(uint8_t index); - virtual uint8_t read_k_input(); + virtual void write_o_output(u8 index); + virtual u8 read_k_input(); virtual void set_cki_bus(); virtual void dynamic_output() { ; } // not used by default virtual void read_opcode(); @@ -232,70 +232,70 @@ protected: optional_device<pla_device> m_opla; optional_device<pla_device> m_spla; - uint8_t m_pc; // 6 or 7-bit program counter - uint32_t m_sr; // 6 or 7-bit subroutine return register(s) - uint8_t m_pa; // 4-bit page address register - uint8_t m_pb; // 4-bit page buffer register - uint16_t m_ps; // 4-bit page subroutine register(s) - uint8_t m_a; // 4-bit accumulator - uint8_t m_x; // 2,3,or 4-bit RAM X register - uint8_t m_y; // 4-bit RAM Y register - uint8_t m_ca; // chapter address register - uint8_t m_cb; // chapter buffer register - uint16_t m_cs; // chapter subroutine register(s) - uint16_t m_r; - uint16_t m_o; - uint8_t m_cki_bus; - uint8_t m_c4; - uint8_t m_p; // 4-bit adder p(lus)-input - uint8_t m_n; // 4-bit adder n(egative)-input - uint8_t m_adder_out; // adder result - uint8_t m_carry_in; // adder carry-in bit - uint8_t m_carry_out; // adder carry-out bit - uint8_t m_status; - uint8_t m_status_latch; - uint8_t m_eac; // end around carry bit - uint8_t m_clatch; // call latch bit(s) - uint8_t m_add; // add latch bit - uint8_t m_bl; // branch latch bit - - uint8_t m_ram_in; - uint8_t m_dam_in; - int m_ram_out; // signed! - uint8_t m_ram_address; - uint16_t m_rom_address; - uint16_t m_opcode; - uint32_t m_fixed; - uint32_t m_micro; - int m_subcycle; - int m_icount; - uint8_t m_o_index; - - uint8_t m_o_pins; // how many O pins - uint8_t m_r_pins; // how many R pins - uint8_t m_pc_bits; // how many program counter bits - uint8_t m_byte_bits; // how many bits per 'byte' - uint8_t m_x_bits; // how many X register bits + u8 m_pc; // 6 or 7-bit program counter + u32 m_sr; // 6 or 7-bit subroutine return register(s) + u8 m_pa; // 4-bit page address register + u8 m_pb; // 4-bit page buffer register + u16 m_ps; // 4-bit page subroutine register(s) + u8 m_a; // 4-bit accumulator + u8 m_x; // 2,3,or 4-bit RAM X register + u8 m_y; // 4-bit RAM Y register + u8 m_ca; // chapter address register + u8 m_cb; // chapter buffer register + u16 m_cs; // chapter subroutine register(s) + u16 m_r; + u16 m_o; + u8 m_cki_bus; + u8 m_c4; + u8 m_p; // 4-bit adder p(lus)-input + u8 m_n; // 4-bit adder n(egative)-input + u8 m_adder_out; // adder result + u8 m_carry_in; // adder carry-in bit + u8 m_carry_out; // adder carry-out bit + u8 m_status; + u8 m_status_latch; + u8 m_eac; // end around carry bit + u8 m_clatch; // call latch bit(s) + u8 m_add; // add latch bit + u8 m_bl; // branch latch bit + + u8 m_ram_in; + u8 m_dam_in; + int m_ram_out; // signed! + u8 m_ram_address; + u16 m_rom_address; + u16 m_opcode; + u32 m_fixed; + u32 m_micro; + int m_subcycle; + int m_icount; + u8 m_o_index; + + u8 m_o_pins; // how many O pins + u8 m_r_pins; // how many R pins + u8 m_pc_bits; // how many program counter bits + u8 m_byte_bits; // how many bits per 'byte' + u8 m_x_bits; // how many X register bits address_space *m_program; address_space *m_data; - const uint16_t *m_output_pla_table; + const u16 *m_output_pla_table; devcb_read8 m_read_k; devcb_write16 m_write_o; devcb_write16 m_write_r; devcb_write_line m_power_off; - uint32_t m_o_mask; - uint32_t m_r_mask; - uint32_t m_k_mask; - uint32_t m_pc_mask; - uint32_t m_x_mask; + u32 m_o_mask; + u32 m_r_mask; + u32 m_k_mask; + u32 m_pc_mask; + u32 m_x_mask; // lookup tables - std::vector<uint32_t> m_fixed_decode; - std::vector<uint32_t> m_micro_decode; - std::vector<uint32_t> m_micro_direct; + std::vector<u32> m_fixed_decode; + std::vector<u32> m_micro_decode; + std::vector<u32> m_micro_direct; }; diff --git a/src/devices/cpu/tms1000/tms1k_dasm.cpp b/src/devices/cpu/tms1000/tms1k_dasm.cpp index 8987a666726..f0afd660470 100644 --- a/src/devices/cpu/tms1000/tms1k_dasm.cpp +++ b/src/devices/cpu/tms1000/tms1k_dasm.cpp @@ -39,7 +39,7 @@ static const char *const s_mnemonic[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t s_flags[] = +static const u32 s_flags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _OVER, 0, @@ -57,7 +57,7 @@ enum e_addressing zB0 = 0, zI2, zI3, zI4, zB7 }; -static const uint8_t s_addressing[] = +static const u8 s_addressing[] = { zB0, zB0, zB0, zB0, zI4, zI4, zI4, zI4, zB0, zB0, zB7, zB7, zB0, @@ -73,7 +73,7 @@ static const uint8_t s_addressing[] = // opcode luts -static const uint8_t tms1000_mnemonic[256] = +static const u8 tms1000_mnemonic[256] = { /* 0x00 */ zCOMX, zA8AAC, zYNEA, zTAM, zTAMZA, zA10AAC, zA6AAC, zDAN, zTKA, zKNEZ, zTDO, zCLO, zRSTR, zSETR, zIA, zRETN, // 0 @@ -97,7 +97,7 @@ static const uint8_t tms1000_mnemonic[256] = }; -static const uint8_t tms1100_mnemonic[256] = +static const u8 tms1100_mnemonic[256] = { /* 0x00 */ zMNEA, zALEM, zYNEA, zXMA, zDYN, zIYC, zAMAAC, zDMAN, zTKA, zCOMX, zTDO, zCOMC, zRSTR, zSETR, zKNEZ, zRETN, // 0 @@ -121,7 +121,7 @@ static const uint8_t tms1100_mnemonic[256] = }; -static const uint8_t tms0980_mnemonic[512] = +static const u8 tms0980_mnemonic[512] = { /* 0x000 */ zCOMX, zALEM, zYNEA, zXMA, zDYN, zIYC, zCLA, zDMAN, zTKA, zMNEA, zTKM, 0, 0, zSETR, zKNEZ, 0, // 0 @@ -163,7 +163,7 @@ static const uint8_t tms0980_mnemonic[512] = }; -static const uint8_t tp0320_mnemonic[512] = +static const u8 tp0320_mnemonic[512] = { /* 0x000 */ 0, zALEM, zYNEA, zXMA, zDYN, zIYC, zCLA, zDMAN, zTKA, zMNEA, zTKM, 0, 0, zSETR, zKNEZ, 0, // 0 @@ -208,31 +208,31 @@ static const uint8_t tp0320_mnemonic[512] = // disasm -static const uint8_t i2_value[4] = +static const u8 i2_value[4] = { 0, 2, 1, 3 }; -static const uint8_t i3_value[8] = +static const u8 i3_value[8] = { 0, 4, 2, 6, 1, 5, 3, 7 }; -static const uint8_t i4_value[16] = +static const u8 i4_value[16] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf }; -static offs_t tms1k_dasm(std::ostream &stream, const uint8_t *oprom, const uint8_t *lut_mnemonic, uint16_t opcode_mask) +static offs_t tms1k_dasm(std::ostream &stream, const u8 *oprom, const u8 *lut_mnemonic, u16 opcode_mask) { // get current opcode int pos = 0; - uint16_t op = oprom[pos++]; + u16 op = oprom[pos++]; if (opcode_mask & 0x100) op = (op << 8 | oprom[pos++]) & 0x1ff; // convert to mnemonic/param - uint16_t instr = lut_mnemonic[op]; + u16 instr = lut_mnemonic[op]; util::stream_format(stream, "%-8s ", s_mnemonic[instr]); switch( s_addressing[instr] ) diff --git a/src/devices/cpu/tms1000/tp0320.cpp b/src/devices/cpu/tms1000/tp0320.cpp index cf427cda589..03c66c87e7f 100644 --- a/src/devices/cpu/tms1000/tp0320.cpp +++ b/src/devices/cpu/tms1000/tp0320.cpp @@ -36,7 +36,7 @@ ADDRESS_MAP_END // device definitions -tp0320_cpu_device::tp0320_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tp0320_cpu_device::tp0320_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms0980_cpu_device(mconfig, TP0320, "TP0320", tag, owner, clock, 7 /* o pins */, 10 /* r pins */, 7 /* pc bits */, 9 /* byte width */, 4 /* x width */, 12 /* prg width */, ADDRESS_MAP_NAME(program_11bit_9), 8 /* data width */, ADDRESS_MAP_NAME(data_192x4), "tp0320", __FILE__) { } @@ -58,7 +58,7 @@ machine_config_constructor tp0320_cpu_device::device_mconfig_additions() const // disasm -offs_t tp0320_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t tp0320_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(tp0320); return CPU_DISASSEMBLE_NAME(tp0320)(this, stream, pc, oprom, opram, options); @@ -66,16 +66,16 @@ offs_t tp0320_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, co // device_reset -uint32_t tp0320_cpu_device::decode_micro(uint8_t sel) +u32 tp0320_cpu_device::decode_micro(u8 sel) { - uint32_t decode = 0; + u32 decode = 0; sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed - uint32_t mask = m_mpla->read(sel); + u32 mask = m_mpla->read(sel); mask ^= 0x0bff0; // invert active-negative - // _____ _______ ______ _____ _____ ______ _____ _____ ______ _____ _____ - const uint32_t md[22] = { M_AUTA, M_AUTY, M_SSS, M_STO, M_YTP, M_NDMTP, M_DMTP, M_MTP, M_CKP, M_15TN, M_CKN, M_MTN, M_NATN, M_ATN, M_CME, M_CIN, M_SSE, M_CKM, M_NE, M_C8, M_SETR, M_RSTR }; + // _____ _______ ______ _____ _____ ______ _____ _____ ______ _____ _____ + const u32 md[22] = { M_AUTA, M_AUTY, M_SSS, M_STO, M_YTP, M_NDMTP, M_DMTP, M_MTP, M_CKP, M_15TN, M_CKN, M_MTN, M_NATN, M_ATN, M_CME, M_CIN, M_SSE, M_CKM, M_NE, M_C8, M_SETR, M_RSTR }; for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++) if (mask & (1 << bit)) diff --git a/src/devices/cpu/tms1000/tp0320.h b/src/devices/cpu/tms1000/tp0320.h index fcff112a900..d5675f0e011 100644 --- a/src/devices/cpu/tms1000/tp0320.h +++ b/src/devices/cpu/tms1000/tp0320.h @@ -15,16 +15,16 @@ class tp0320_cpu_device : public tms0980_cpu_device { public: - tp0320_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tp0320_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // overrides //virtual void device_start() override; - virtual uint32_t decode_fixed(uint16_t op) override { return 0; } // not yet - virtual uint32_t decode_micro(uint8_t sel) override; + virtual u32 decode_fixed(u16 op) override { return 0; } // not yet + virtual u32 decode_micro(u8 sel) override; virtual void device_reset() override; - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; virtual machine_config_constructor device_mconfig_additions() const override; }; diff --git a/src/devices/cpu/ucom4/ucom4.cpp b/src/devices/cpu/ucom4/ucom4.cpp index 7b804c4c4f3..aca4996b5fa 100644 --- a/src/devices/cpu/ucom4/ucom4.cpp +++ b/src/devices/cpu/ucom4/ucom4.cpp @@ -58,19 +58,19 @@ ADDRESS_MAP_END // device definitions -upd553_cpu_device::upd553_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +upd553_cpu_device::upd553_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : ucom4_cpu_device(mconfig, NEC_D553, "uPD553", tag, owner, clock, NEC_UCOM43, 3 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_2k), 7 /* data width */, ADDRESS_MAP_NAME(data_96x4), "upd553", __FILE__) { } -upd557l_cpu_device::upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +upd557l_cpu_device::upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : ucom4_cpu_device(mconfig, NEC_D557L, "uPD557L", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd557l", __FILE__) { } -upd650_cpu_device::upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +upd650_cpu_device::upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : ucom4_cpu_device(mconfig, NEC_D650, "uPD650", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd650", __FILE__) { } -upd552_cpu_device::upd552_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +upd552_cpu_device::upd552_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : ucom4_cpu_device(mconfig, NEC_D552, "uPD552", tag, owner, clock, NEC_UCOM44, 1, 10, ADDRESS_MAP_NAME(program_1k), 6, ADDRESS_MAP_NAME(data_64x4), "upd552", __FILE__) { } @@ -95,7 +95,7 @@ void ucom4_cpu_device::state_string_export(const device_state_entry &entry, std: } } -offs_t ucom4_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t ucom4_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { extern CPU_DISASSEMBLE(ucom4); return CPU_DISASSEMBLE_NAME(ucom4)(this, stream, pc, oprom, opram, options); @@ -220,10 +220,10 @@ void ucom4_cpu_device::device_reset() // default: // A,B are inputs, C,D are input/output, E,F,G,H,I are output -uint8_t ucom4_cpu_device::input_r(int index) +u8 ucom4_cpu_device::input_r(int index) { index &= 0xf; - uint8_t inp = 0; + u8 inp = 0; switch (index) { @@ -240,7 +240,7 @@ uint8_t ucom4_cpu_device::input_r(int index) return inp & 0xf; } -void ucom4_cpu_device::output_w(int index, uint8_t data) +void ucom4_cpu_device::output_w(int index, u8 data) { index &= 0xf; data &= 0xf; @@ -266,7 +266,7 @@ void ucom4_cpu_device::output_w(int index, uint8_t data) // uPD557L: // ports B,H,I are stripped, port G is reduced to 1 pin -uint8_t upd557l_cpu_device::input_r(int index) +u8 upd557l_cpu_device::input_r(int index) { index &= 0xf; @@ -278,7 +278,7 @@ uint8_t upd557l_cpu_device::input_r(int index) return 0; } -void upd557l_cpu_device::output_w(int index, uint8_t data) +void upd557l_cpu_device::output_w(int index, u8 data) { index &= 0xf; data &= 0xf; diff --git a/src/devices/cpu/ucom4/ucom4.h b/src/devices/cpu/ucom4/ucom4.h index ca0701734fb..0dcd43df7f5 100644 --- a/src/devices/cpu/ucom4/ucom4.h +++ b/src/devices/cpu/ucom4/ucom4.h @@ -14,35 +14,35 @@ // I/O ports setup #define MCFG_UCOM4_READ_A_CB(_devcb) \ - ucom4_cpu_device::set_read_a_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_read_a_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_READ_B_CB(_devcb) \ - ucom4_cpu_device::set_read_b_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_read_b_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_READ_C_CB(_devcb) \ - ucom4_cpu_device::set_read_c_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_read_c_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_C_CB(_devcb) \ - ucom4_cpu_device::set_write_c_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_c_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_READ_D_CB(_devcb) \ - ucom4_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_read_d_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_D_CB(_devcb) \ - ucom4_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_E_CB(_devcb) \ - ucom4_cpu_device::set_write_e_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_e_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_F_CB(_devcb) \ - ucom4_cpu_device::set_write_f_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_f_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_G_CB(_devcb) \ - ucom4_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_g_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_H_CB(_devcb) \ - ucom4_cpu_device::set_write_h_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_h_callback(*device, DEVCB_##_devcb); #define MCFG_UCOM4_WRITE_I_CB(_devcb) \ - ucom4_cpu_device::set_write_i_callback(*device, DEVCB_##_devcb); + devcb = &ucom4_cpu_device::set_write_i_callback(*device, DEVCB_##_devcb); enum { @@ -100,7 +100,7 @@ class ucom4_cpu_device : public cpu_device { public: // construction/destruction - ucom4_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int family, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + ucom4_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, int family, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program) , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data) @@ -141,11 +141,11 @@ protected: virtual void device_reset() override; // device_execute_interface overrides - virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle - virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 4); } // " - virtual uint32_t execute_min_cycles() const override { return 1; } - virtual uint32_t execute_max_cycles() const override { return 2; } - virtual uint32_t execute_input_lines() const override { return 1; } + virtual u64 execute_clocks_to_cycles(u64 clocks) const override { return (clocks + 4 - 1) / 4; } // 4 cycles per machine cycle + virtual u64 execute_cycles_to_clocks(u64 cycles) const override { return (cycles * 4); } // " + virtual u32 execute_min_cycles() const override { return 1; } + virtual u32 execute_max_cycles() const override { return 2; } + virtual u32 execute_input_lines() const override { return 1; } virtual void execute_set_input(int line, int state) override; virtual void execute_run() override; @@ -153,9 +153,9 @@ protected: 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); } // device_disasm_interface overrides - virtual uint32_t disasm_min_opcode_bytes() const override { return 1; } - virtual uint32_t disasm_max_opcode_bytes() const override { return 2; } - virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; + virtual u32 disasm_min_opcode_bytes() const override { return 1; } + virtual u32 disasm_max_opcode_bytes() const override { return 2; } + virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override; // device_state_interface overrides virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; @@ -169,30 +169,30 @@ protected: int m_datawidth; int m_prgmask; int m_datamask; - int m_family; // MCU family (43/44/45) - int m_stack_levels; // number of callstack levels - uint16_t m_stack[3]; // max 3 - uint8_t m_port_out[0x10]; // last value written to output port - uint8_t m_op; - uint8_t m_prev_op; // previous opcode - uint8_t m_arg; // opcode argument for 2-byte opcodes - uint8_t m_bitmask; // opcode bit argument - bool m_skip; // skip next opcode + int m_family; // MCU family (43/44/45) + int m_stack_levels; // number of callstack levels + u16 m_stack[3]; // max 3 + u8 m_port_out[0x10]; // last value written to output port + u8 m_op; + u8 m_prev_op; // previous opcode + u8 m_arg; // opcode argument for 2-byte opcodes + u8 m_bitmask; // opcode bit argument + bool m_skip; // skip next opcode int m_icount; emu_timer *m_timer; - uint16_t m_pc; // program counter - uint16_t m_prev_pc; - uint8_t m_acc; // 4-bit accumulator - uint8_t m_dpl; // 4-bit data pointer low (RAM x) - uint8_t m_dph; // 4-bit(?) data pointer high (RAM y) - uint8_t m_dph_mask; - uint8_t m_carry_f; // carry flag - uint8_t m_carry_s_f; // carry save flag - uint8_t m_timer_f; // timer out flag - uint8_t m_int_f; // interrupt flag - uint8_t m_inte_f; // interrupt enable flag - int m_int_line; // interrupt pin state + u16 m_pc; // program counter + u16 m_prev_pc; + u8 m_acc; // 4-bit accumulator + u8 m_dpl; // 4-bit data pointer low (RAM x) + u8 m_dph; // 4-bit(?) data pointer high (RAM y) + u8 m_dph_mask; + u8 m_carry_f; // carry flag + u8 m_carry_s_f; // carry save flag + u8 m_timer_f; // timer out flag + u8 m_int_f; // interrupt flag + u8 m_inte_f; // interrupt enable flag + int m_int_line; // interrupt pin state // i/o handlers devcb_read8 m_read_a; @@ -208,23 +208,23 @@ protected: devcb_write8 m_write_h; devcb_write8 m_write_i; - virtual uint8_t input_r(int index); - virtual void output_w(int index, uint8_t data); + virtual u8 input_r(int index); + virtual void output_w(int index, u8 data); // misc internal helpers void increment_pc(); void fetch_arg(); void do_interrupt(); - uint8_t ram_r(); - void ram_w(uint8_t data); + u8 ram_r(); + void ram_w(u8 data); void pop_stack(); void push_stack(); bool check_op_43(); TIMER_CALLBACK_MEMBER( simple_timer_cb ); - uint8_t ucom43_reg_r(int index); - void ucom43_reg_w(int index, uint8_t data); + u8 ucom43_reg_r(int index); + void ucom43_reg_w(int index, u8 data); // opcode handlers void op_illegal(); @@ -316,32 +316,32 @@ protected: class upd553_cpu_device : public ucom4_cpu_device { public: - upd553_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + upd553_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class upd557l_cpu_device : public ucom4_cpu_device { public: - upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual uint8_t input_r(int index) override; - virtual void output_w(int index, uint8_t data) override; + virtual u8 input_r(int index) override; + virtual void output_w(int index, u8 data) override; }; class upd650_cpu_device : public ucom4_cpu_device { public: - upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; class upd552_cpu_device : public ucom4_cpu_device { public: - upd552_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + upd552_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/cpu/ucom4/ucom4d.cpp b/src/devices/cpu/ucom4/ucom4d.cpp index 4b29439b5e9..f83801813ee 100644 --- a/src/devices/cpu/ucom4/ucom4d.cpp +++ b/src/devices/cpu/ucom4/ucom4d.cpp @@ -38,7 +38,7 @@ static const char *const s_mnemonics[] = }; // number of bits per opcode parameter, 2 digits means opcode is 2 bytes -static const uint8_t s_bits[] = +static const u8 s_bits[] = { 4, 0, 2, 80, 4, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, @@ -54,7 +54,7 @@ static const uint8_t s_bits[] = #define _OVER DASMFLAG_STEP_OVER #define _OUT DASMFLAG_STEP_OUT -static const uint32_t s_flags[] = +static const u32 s_flags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -68,7 +68,7 @@ static const uint32_t s_flags[] = }; -static const uint8_t ucom4_mnemonic[0x100] = +static const u8 ucom4_mnemonic[0x100] = { /* 0x00 */ mNOP, mDI, mS, mTIT, mTC, mTTM, mDAA, mTAL, @@ -116,8 +116,8 @@ static const uint8_t ucom4_mnemonic[0x100] = CPU_DISASSEMBLE(ucom4) { int pos = 0; - uint8_t op = oprom[pos++]; - uint8_t instr = ucom4_mnemonic[op]; + u8 op = oprom[pos++]; + u8 instr = ucom4_mnemonic[op]; util::stream_format(stream,"%-4s ", s_mnemonics[instr]); @@ -125,10 +125,10 @@ CPU_DISASSEMBLE(ucom4) int bits = s_bits[instr]; if (bits) { - uint16_t param = op & ((1 << (bits % 10)) - 1); + u16 param = op & ((1 << (bits % 10)) - 1); if (bits / 10) { - uint8_t op2 = oprom[pos++]; + u8 op2 = oprom[pos++]; param = (param << (bits / 10)) | (op2 & ((1 << (bits / 10)) - 1)); bits = (bits % 10) + (bits / 10); } diff --git a/src/devices/cpu/ucom4/ucom4op.cpp b/src/devices/cpu/ucom4/ucom4op.cpp index 8c8e69f9ed4..67d12a95dad 100644 --- a/src/devices/cpu/ucom4/ucom4op.cpp +++ b/src/devices/cpu/ucom4/ucom4op.cpp @@ -8,15 +8,15 @@ // internal helpers -inline uint8_t ucom4_cpu_device::ram_r() +inline u8 ucom4_cpu_device::ram_r() { - uint16_t address = m_dph << 4 | m_dpl; + u16 address = m_dph << 4 | m_dpl; return m_data->read_byte(address & m_datamask) & 0xf; } -inline void ucom4_cpu_device::ram_w(uint8_t data) +inline void ucom4_cpu_device::ram_w(u8 data) { - uint16_t address = m_dph << 4 | m_dpl; + u16 address = m_dph << 4 | m_dpl; m_data->write_byte(address & m_datamask, data & 0xf); } @@ -105,7 +105,7 @@ void ucom4_cpu_device::op_tla() void ucom4_cpu_device::op_xm() { // XM X: Exchange ACC with RAM, xor DPh with X - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = ram_r(); ram_w(old_acc); m_dph ^= (m_op & 0x03); @@ -468,12 +468,12 @@ enum UCOM43_F }; -inline uint8_t ucom4_cpu_device::ucom43_reg_r(int index) +inline u8 ucom4_cpu_device::ucom43_reg_r(int index) { return m_data->read_byte(m_datamask - index) & 0xf; } -inline void ucom4_cpu_device::ucom43_reg_w(int index, uint8_t data) +inline void ucom4_cpu_device::ucom43_reg_w(int index, u8 data) { m_data->write_byte(m_datamask - index, data & 0xf); } @@ -527,7 +527,7 @@ void ucom4_cpu_device::op_xaw() // XAW: Exchange ACC with W m_icount--; - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = ucom43_reg_r(UCOM43_W); ucom43_reg_w(UCOM43_W, old_acc); } @@ -538,7 +538,7 @@ void ucom4_cpu_device::op_xaz() // XAZ: Exchange ACC with Z m_icount--; - uint8_t old_acc = m_acc; + u8 old_acc = m_acc; m_acc = ucom43_reg_r(UCOM43_Z); ucom43_reg_w(UCOM43_Z, old_acc); } @@ -549,7 +549,7 @@ void ucom4_cpu_device::op_xhr() // XHR: Exchange DPh with R m_icount--; - uint8_t old_dph = m_dph; + u8 old_dph = m_dph; m_dph = ucom43_reg_r(UCOM43_R); ucom43_reg_w(UCOM43_R, old_dph); } @@ -560,7 +560,7 @@ void ucom4_cpu_device::op_xhx() // XHX: Exchange DPh with X m_icount--; - uint8_t old_dph = m_dph; + u8 old_dph = m_dph; m_dph = ucom43_reg_r(UCOM43_X); ucom43_reg_w(UCOM43_X, old_dph); } @@ -571,7 +571,7 @@ void ucom4_cpu_device::op_xls() // XLS: Exchange DPl with S m_icount--; - uint8_t old_dpl = m_dpl; + u8 old_dpl = m_dpl; m_dpl = ucom43_reg_r(UCOM43_S); ucom43_reg_w(UCOM43_S, old_dpl); } @@ -582,7 +582,7 @@ void ucom4_cpu_device::op_xly() // XLY: Exchange DPl with Y m_icount--; - uint8_t old_dpl = m_dpl; + u8 old_dpl = m_dpl; m_dpl = ucom43_reg_r(UCOM43_Y); ucom43_reg_w(UCOM43_Y, old_dpl); } @@ -592,7 +592,7 @@ void ucom4_cpu_device::op_xc() if (!check_op_43()) return; // XC: Exchange Carry F/F with Carry Save F/F - uint8_t c = m_carry_f; + u8 c = m_carry_f; m_carry_f = m_carry_s_f; m_carry_s_f = c; } @@ -644,7 +644,7 @@ void ucom4_cpu_device::op_rar() if (!check_op_43()) return; // RAR: Rotate ACC Right through Carry F/F - uint8_t c = m_acc & 1; + u8 c = m_acc & 1; m_acc = m_acc >> 1 | m_carry_f << 3; m_carry_f = c; } @@ -657,7 +657,7 @@ void ucom4_cpu_device::op_inm() if (!check_op_43()) return; // INM: Increment RAM, skip next on carry - uint8_t val = (ram_r() + 1) & 0xf; + u8 val = (ram_r() + 1) & 0xf; ram_w(val); m_skip = (val == 0); } @@ -667,7 +667,7 @@ void ucom4_cpu_device::op_dem() if (!check_op_43()) return; // DEM: Decrement RAM, skip next on carry - uint8_t val = (ram_r() - 1) & 0xf; + u8 val = (ram_r() - 1) & 0xf; ram_w(val); m_skip = (val == 0xf); } diff --git a/src/devices/cpu/upd7810/upd7810.h b/src/devices/cpu/upd7810/upd7810.h index 8880be1c1bb..05919e8100c 100644 --- a/src/devices/cpu/upd7810/upd7810.h +++ b/src/devices/cpu/upd7810/upd7810.h @@ -51,43 +51,43 @@ enum #define MCFG_UPD7810_TO(_devcb) \ - upd7810_device::set_to_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_to_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_CO0(_devcb) \ - upd7810_device::set_co0_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_co0_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_CO1(_devcb) \ - upd7810_device::set_co1_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_co1_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_TXD(_devcb) \ - upd7810_device::set_txd_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_txd_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_RXD(_devcb) \ - upd7810_device::set_rxd_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_rxd_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN0(_devcb) \ - upd7810_device::set_an0_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an0_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN1(_devcb) \ - upd7810_device::set_an1_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an1_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN2(_devcb) \ - upd7810_device::set_an2_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an2_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN3(_devcb) \ - upd7810_device::set_an3_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an3_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN4(_devcb) \ - upd7810_device::set_an4_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an4_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN5(_devcb) \ - upd7810_device::set_an5_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an5_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN6(_devcb) \ - upd7810_device::set_an6_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an6_func(*device, DEVCB_##_devcb); #define MCFG_UPD7810_AN7(_devcb) \ - upd7810_device::set_an7_func(*device, DEVCB_##_devcb); + devcb = &upd7810_device::set_an7_func(*device, DEVCB_##_devcb); class upd7810_device : public cpu_device diff --git a/src/devices/machine/40105.h b/src/devices/machine/40105.h index 47a8ce0b1ab..04495bfa352 100644 --- a/src/devices/machine/40105.h +++ b/src/devices/machine/40105.h @@ -32,13 +32,13 @@ ///************************************************************************* #define MCFG_40105_DATA_IN_READY_CB(_dir) \ - downcast<cmos_40105_device *>(device)->set_dir_callback(DEVCB_##_dir); + devcb = &downcast<cmos_40105_device *>(device)->set_dir_callback(DEVCB_##_dir); #define MCFG_40105_DATA_OUT_READY_CB(_dor) \ - downcast<cmos_40105_device *>(device)->set_dor_callback(DEVCB_##_dor); + devcb = &downcast<cmos_40105_device *>(device)->set_dor_callback(DEVCB_##_dor); #define MCFG_40105_DATA_OUT_CB(_out) \ - downcast<cmos_40105_device *>(device)->set_data_out_callback(DEVCB_##_out); + devcb = &downcast<cmos_40105_device *>(device)->set_data_out_callback(DEVCB_##_out); @@ -54,9 +54,9 @@ public: // construction/destruction cmos_40105_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - template<class _dir> void set_dir_callback(_dir dir) { m_write_dir.set_callback(dir); } - template<class _dor> void set_dor_callback(_dor dor) { m_write_dor.set_callback(dor); } - template<class _out> void set_data_out_callback(_out out) { m_write_q.set_callback(out); } + template<class _dir> devcb_base &set_dir_callback(_dir dir) { return m_write_dir.set_callback(dir); } + template<class _dor> devcb_base &set_dor_callback(_dor dor) { return m_write_dor.set_callback(dor); } + template<class _out> devcb_base &set_data_out_callback(_out out) { return m_write_q.set_callback(out); } u8 read(); void write(u8 data); diff --git a/src/devices/machine/6522via.cpp b/src/devices/machine/6522via.cpp index 2949b77c594..79085eecbca 100644 --- a/src/devices/machine/6522via.cpp +++ b/src/devices/machine/6522via.cpp @@ -31,7 +31,15 @@ PARAMETERS ***************************************************************************/ -#define TRACE_VIA 0 +#define LOG_SETUP (1U << 1) +#define LOG_SHIFT (1U << 2) + +#define VERBOSE 0 // (LOG_SETUP|LOG_SHIFT) +#define LOG_OUTPUT_FUNC printf +#include "logmacro.h" + +#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) +#define LOGSHIFT(...) LOGMASKED(LOG_SHIFT, __VA_ARGS__) /*************************************************************************** @@ -310,10 +318,7 @@ void via6522_device::set_int(int data) output_irq(); - if (TRACE_VIA) - { - logerror("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr); - } + LOG("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr); } } @@ -330,10 +335,7 @@ void via6522_device::clear_int(int data) output_irq(); - if (TRACE_VIA) - { - logerror("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr); - } + LOG("%s:6522VIA chip %s: IFR = %02X\n", machine().describe_context(), tag(), m_ifr); } } @@ -344,14 +346,16 @@ void via6522_device::clear_int(int data) void via6522_device::shift_out() { + LOGSHIFT("Shift Out SR: %02x->", m_sr); m_out_cb2 = (m_sr >> 7) & 1; m_sr = (m_sr << 1) | m_out_cb2; + LOGSHIFT("%02x\n", m_sr); m_cb2_handler(m_out_cb2); if (!SO_T2_RATE(m_acr)) { - m_shift_counter = (m_shift_counter + 1) % 8; + m_shift_counter = (m_shift_counter - 1) & 7; if (m_shift_counter == 0) { @@ -362,9 +366,11 @@ void via6522_device::shift_out() void via6522_device::shift_in() { + LOGSHIFT("Shift In SR: %02x->", m_sr); m_sr = (m_sr << 1) | (m_in_cb2 & 1); + LOGSHIFT("%02x\n", m_sr); - m_shift_counter = (m_shift_counter + 1) % 8; + m_shift_counter = (m_shift_counter - 1) & 7; if (m_shift_counter == 0) { @@ -378,31 +384,34 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para switch (id) { case TIMER_SHIFT: - m_out_cb1 = 0; + LOGSHIFT("SHIFT timer event\n"); + m_out_cb1 ^= 1; m_cb1_handler(m_out_cb1); - if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr)) + if (m_out_cb1 & 1) // raising flank { - shift_out(); + if (SI_T2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr)) + { + shift_in(); + } } - - m_out_cb1 = 1; - m_cb1_handler(m_out_cb1); - - if (SI_T2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr)) + else // falling flank { - shift_in(); + if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr)) + { + shift_out(); + } } if (SO_T2_RATE(m_acr) || m_shift_counter) { if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr)) { - m_shift_timer->adjust(clocks_to_attotime(2)); + m_shift_timer->adjust(clocks_to_attotime(1)); } else { - m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); + m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); } } break; @@ -615,17 +624,28 @@ READ8_MEMBER( via6522_device::read ) break; case VIA_SR: + LOGSHIFT("Read SR: %02x ", m_sr); val = m_sr; - m_shift_counter=0; + m_out_cb1 = 1; + m_shift_counter = 8; clear_int(INT_SR); + LOGSHIFT("ACR: %02x ", m_acr); if (SI_O2_CONTROL(m_acr)) { - m_shift_timer->adjust(clocks_to_attotime(2)); + m_shift_timer->adjust(clocks_to_attotime(1)); + LOGSHIFT("SI_O2 starts timer "); + } + else if (SI_T2_CONTROL(m_acr)) + { + m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); + LOGSHIFT("SI_T2 starts timer "); } - if (SI_T2_CONTROL(m_acr)) + else if (! (SO_O2_CONTROL(m_acr) || SO_T2_CONTROL(m_acr) || SO_T2_RATE(m_acr))) { - m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); + m_shift_timer->adjust(attotime::never); + LOGSHIFT("Timer stops"); } + LOGSHIFT("\n"); break; case VIA_PCR: @@ -656,6 +676,8 @@ WRITE8_MEMBER( via6522_device::write ) { offset &=0x0f; + LOGSETUP(" * %s Reg %02x <- %02x \n", tag(), offset, data); + switch (offset) { case VIA_PB: @@ -776,25 +798,33 @@ WRITE8_MEMBER( via6522_device::write ) case VIA_SR: m_sr = data; - m_shift_counter=0; + LOGSHIFT("Write SR: %02x\n", m_sr); + m_out_cb1 = 1; + m_shift_counter = 8; clear_int(INT_SR); + LOGSHIFT("ACR: %02x ", m_acr); if (SO_O2_CONTROL(m_acr)) { - m_shift_timer->adjust(clocks_to_attotime(2)); + m_shift_timer->adjust(clocks_to_attotime(1)); + LOGSHIFT("SO_O2 starts timer"); + } + else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr)) + { + m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); + LOGSHIFT("SO_T2 starts timer"); } - if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr)) + else if (! (SI_O2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))) { - m_shift_timer->adjust(clocks_to_attotime((m_t2ll + 2)*2)); + m_shift_timer->adjust(attotime::never); // In case we change mode before counter expire + LOGSHIFT("Timer stops"); } + LOGSHIFT("\n"); break; case VIA_PCR: m_pcr = data; - if (TRACE_VIA) - { - logerror("%s:6522VIA chip %s: PCR = %02X\n", machine().describe_context(), tag(), data); - } + LOG("%s:6522VIA chip %s: PCR = %02X\n", machine().describe_context(), tag(), data); if (CA2_FIX_OUTPUT(data) && m_out_ca2 != CA2_OUTPUT_LEVEL(data)) { @@ -813,14 +843,32 @@ WRITE8_MEMBER( via6522_device::write ) { uint16_t counter1 = get_counter1_value(); m_acr = data; + LOGSHIFT("Write ACR: %02x ", m_acr); output_pb(); - if (T1_CONTINUOUS(data)) + LOGSHIFT("Shift mode [%02x]: ", (m_acr >> 2) & 7); + if (SR_DISABLED(m_acr)) LOGSHIFT("Disabled"); + if (SI_T2_CONTROL(m_acr)) LOGSHIFT("IN on T2"); + if (SI_O2_CONTROL(m_acr)) LOGSHIFT("IN on O2"); + if (SI_EXT_CONTROL(m_acr)) LOGSHIFT("IN on EXT"); + if (SO_T2_RATE(m_acr)) LOGSHIFT("OUT on continous T2"); + if (SO_T2_CONTROL(m_acr)) LOGSHIFT("OUT on T2"); + if (SO_O2_CONTROL(m_acr)) LOGSHIFT("OUT on O2"); + if (SO_EXT_CONTROL(m_acr)) LOGSHIFT("OUT on EXT"); + + if (SR_DISABLED(m_acr) || SI_EXT_CONTROL(m_acr) || SO_EXT_CONTROL(m_acr)) + { + m_shift_timer->adjust(attotime::never); + LOGSHIFT(" Timer stops"); + } + + if (T1_CONTINUOUS(m_acr)) { m_t1->adjust(clocks_to_attotime(counter1 + IFR_DELAY)); m_t1_active = 1; } + LOGSHIFT("\n"); } break; @@ -870,8 +918,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 ) { m_in_ca1 = state; - if (TRACE_VIA) - logerror("%s:6522VIA chip %s: CA1 = %02X\n", machine().describe_context(), tag(), m_in_ca1); + LOG("%s:6522VIA chip %s: CA1 = %02X\n", machine().describe_context(), tag(), m_in_ca1); if ((m_in_ca1 && CA1_LOW_TO_HIGH(m_pcr)) || (!m_in_ca1 && CA1_HIGH_TO_LOW(m_pcr))) { @@ -942,12 +989,12 @@ WRITE_LINE_MEMBER( via6522_device::write_cb1 ) m_latch_b = input_pb(); } - if (SO_EXT_CONTROL(m_acr)) + if (!state && SO_EXT_CONTROL(m_acr)) { shift_out(); } - if (SI_EXT_CONTROL(m_acr)) + if (state && SI_EXT_CONTROL(m_acr)) { shift_in(); } @@ -960,6 +1007,18 @@ WRITE_LINE_MEMBER( via6522_device::write_cb1 ) m_cb2_handler(1); } } + else // shift is not controlled by m_pcr + { + if (!state && SO_EXT_CONTROL(m_acr)) + { + shift_out(); + } + + if (state && SI_EXT_CONTROL(m_acr)) + { + shift_in(); + } + } } } diff --git a/src/devices/machine/68153bim.cpp b/src/devices/machine/68153bim.cpp index a5ee8d17542..d7e4fc0f375 100644 --- a/src/devices/machine/68153bim.cpp +++ b/src/devices/machine/68153bim.cpp @@ -2,13 +2,13 @@ // copyright-holders: Joakim Larsson Edstrom /*************************************************************************** - 68153 BIM Bus Interrupter Module + 68153 BIM Bus Interrupter Module - The Bus Interrupter Module (BIM) provides an interface between interrupting devices and a system bus such as - the VMEbus or VERSAbus™. It generates a maximum of 7 bus interrupts on the IRQ1-IRQ7 outputs and responds to - interrupt acknowledge cycles for up to 4 independent slaves. The BIM can also supply an interrupt vector - during an interrupt acknowledge cycle. Moreover, it sits in the interrupt acknowledge daisychain which allows - for multiple interrupts on the level acknowledged. + The Bus Interrupter Module (BIM) provides an interface between interrupting devices and a system bus such as + the VMEbus or VERSAbus™. It generates a maximum of 7 bus interrupts on the IRQ1-IRQ7 outputs and responds to + interrupt acknowledge cycles for up to 4 independent slaves. The BIM can also supply an interrupt vector + during an interrupt acknowledge cycle. Moreover, it sits in the interrupt acknowledge daisychain which allows + for multiple interrupts on the level acknowledged. ----- Features ---------------------------------------------------------- x 4 channels @@ -19,7 +19,7 @@ Full functionality is implemented ------------------------------------------------------------------------- - Level of implementation: x = done p = partial + Level of implementation: x = done p = partial ------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ //************************************************************************** // device type definition const device_type MC68153_CHANNEL = &device_creator<bim68153_channel>; -const device_type MC68153 = &device_creator<bim68153_device>; +const device_type MC68153 = &device_creator<bim68153_device>; const device_type EI68C153 = &device_creator<ei68c153_device>; //------------------------------------------------- @@ -185,14 +185,14 @@ IRQ_CALLBACK_MEMBER(bim68153_device::iack) { int vec = M68K_INT_ACK_AUTOVECTOR; int found = 0; - // int level = 0; + // int level = 0; int ch = -1; LOGIACK("%s %s()\n", tag(), FUNCNAME); - /* 1. No further action required — This occurs if IACKIN is not asserted. Asserting IACKN only starts the BIM activity. - * If the daisy chain signal never reaches the BIM (IACKIN is not asserted), another interrupter has responded to the - * IACK cycle. The cycle will end, the IACK is negated, and no additional action is required. */ + /* 1. No further action required — This occurs if IACKIN is not asserted. Asserting IACKN only starts the BIM activity. + * If the daisy chain signal never reaches the BIM (IACKIN is not asserted), another interrupter has responded to the + * IACK cycle. The cycle will end, the IACK is negated, and no additional action is required. */ if (m_iackin == CLEAR_LINE) { m_out_iackout_cb(CLEAR_LINE); @@ -205,15 +205,15 @@ IRQ_CALLBACK_MEMBER(bim68153_device::iack) if (elem->m_int_state == bim68153_channel::PENDING && elem->m_control & bim68153_channel::REG_CNTRL_INT_ENABLE) { // and the level matches if ((elem->m_control & bim68153_channel::REG_CNTRL_INT_LVL_MSK) == irqline) - { // then remember it + { // then remember it ch = get_channel_index(elem); } found = 1; } } - /* 2. Pass on the interrupt daisy chain — For this case, IACKIN input is asserted by the preceding daisy chain interrupter, - * and IACKOUT output is in turn asserted. The daisy chain signal is passed on when no interrupts are pending on a matching - * level or when any possible interrupts are disabled. The Interrupt Enable (IRE) bit of a control register can disable any + /* 2. Pass on the interrupt daisy chain — For this case, IACKIN input is asserted by the preceding daisy chain interrupter, + * and IACKOUT output is in turn asserted. The daisy chain signal is passed on when no interrupts are pending on a matching + * level or when any possible interrupts are disabled. The Interrupt Enable (IRE) bit of a control register can disable any * interrupt requests, and in turn, any possible matches */ if (found == 0) { @@ -226,10 +226,10 @@ IRQ_CALLBACK_MEMBER(bim68153_device::iack) if ((m_chn[ch]->m_control & bim68153_channel::REG_CNTRL_INT_EXT) == 0) { - /* 3. Respond internally - For this case, IACKIN is asserted and a match is found. The BIM completes the IACK cycle by - * supplying an interrupt vector from the proper vector register followed by a DTACK signal asserted because the interrupt - * acknowledge cycle is completed by this device. For the BIM to respond in this mode of operation, the EXTERNAL/INTERNAl - * control register bit (X/IN) must be zero. For each source of interrupt request, the associated control register determines + /* 3. Respond internally - For this case, IACKIN is asserted and a match is found. The BIM completes the IACK cycle by + * supplying an interrupt vector from the proper vector register followed by a DTACK signal asserted because the interrupt + * acknowledge cycle is completed by this device. For the BIM to respond in this mode of operation, the EXTERNAL/INTERNAl + * control register bit (X/IN) must be zero. For each source of interrupt request, the associated control register determines * the BIM response to an IACK cycle, and the X/IN bit sets this response either internally (X/IN = 0 ) or externally (X/IN = 1). */ vec = m_chn[ch]->m_vector; // Internal vector @@ -237,8 +237,8 @@ IRQ_CALLBACK_MEMBER(bim68153_device::iack) else { /* 4. Respond externally — For the final case, IACKIN is also asserted, a match is found and the associated control register has - * X/IN bit set to one. The BIM does not assert IACKOUT and does assert INTAE low.INTAE signals that the requesting device must - * complete the IACK cycle (supplying a vector and DTACK) and that the 2-bit code contained on outputs INTALO and INTAL1 shows + * X/IN bit set to one. The BIM does not assert IACKOUT and does assert INTAE low.INTAE signals that the requesting device must + * complete the IACK cycle (supplying a vector and DTACK) and that the 2-bit code contained on outputs INTALO and INTAL1 shows * which interrupt source is being acknowledged*/ vec = m_chn[ch]->m_out_iack_cb(); // External vector @@ -255,7 +255,7 @@ IRQ_CALLBACK_MEMBER(bim68153_device::iack) m_chn[ch]->m_control &= ~bim68153_channel::REG_CNTRL_INT_ENABLE; } - // This is not explicitly said in the 68153 datasheet but what would a flag be used for otherwise? + // This is not explicitly said in the 68153 datasheet but what would a flag be used for otherwise? m_chn[ch]->m_control &= ~bim68153_channel::REG_CNTRL_INT_FLAG; m_out_iackout_cb(CLEAR_LINE); @@ -291,7 +291,7 @@ void bim68153_device::trigger_interrupt(int ch) m_out_iackout_cb(ASSERT_LINE); // Set flag - // This is not explicitly said in the 68153 datasheet but what would a flag be used for otherwise? + // This is not explicitly said in the 68153 datasheet but what would a flag be used for otherwise? m_chn[ch]->m_control |= bim68153_channel::REG_CNTRL_INT_FLAG; // assert interrupt @@ -306,7 +306,7 @@ READ8_MEMBER( bim68153_device::read ) int vc = offset & REG_VECTOR; int ch = offset & CHN_MSK; - LOGR(" * %s %d Reg %s -> %02x \n", m_owner->tag(), ch, vc ? "vector" : "control", + LOGR(" * %s %d Reg %s -> %02x \n", m_owner->tag(), ch, vc ? "vector" : "control", vc ? m_chn[ch]->do_bimreg_vector_r() : m_chn[ch]->do_bimreg_control_r()); return vc ? m_chn[ch]->do_bimreg_vector_r() : m_chn[ch]->do_bimreg_control_r(); @@ -404,10 +404,10 @@ void bim68153_channel::do_bimreg_control_w(uint8_t data) LOG("%s ch %d set control to %02x\n", FUNCNAME, m_index, data); LOGSETUP(" - Lev:%d Auto Disable:%d Int Enable:%d Vector:%d Auto Clear:%d Flag:%d\n", data & REG_CNTRL_INT_LVL_MSK, - data & REG_CNTRL_INT_AUT_DIS ? 1 : 0, - data & REG_CNTRL_INT_ENABLE ? 1 : 0, - data & REG_CNTRL_INT_EXT ? 1 : 0, - data & REG_CNTRL_INT_AUT_CLR ? 1 : 0, + data & REG_CNTRL_INT_AUT_DIS ? 1 : 0, + data & REG_CNTRL_INT_ENABLE ? 1 : 0, + data & REG_CNTRL_INT_EXT ? 1 : 0, + data & REG_CNTRL_INT_AUT_CLR ? 1 : 0, data & REG_CNTRL_INT_FLAG ? 1 : 0); m_control = data; diff --git a/src/devices/machine/68153bim.h b/src/devices/machine/68153bim.h index 414abebf1b6..f9df8a1b1e1 100644 --- a/src/devices/machine/68153bim.h +++ b/src/devices/machine/68153bim.h @@ -10,11 +10,11 @@ * CS* 3 | | 38 A1 * DTACK* 4 | | 37 D7 * IACK* 5 | | 36 D6 -* IACKIN* 6 | | 35 D5 -* IACKOUT* 7 | | 34 D4 -* IRQ1* 8 | | 33 D3 -* GND 9 | | 32 D2 -* GND 10 | | 31 GND +* IACKIN* 6 | | 35 D5 +* IACKOUT* 7 | | 34 D4 +* IRQ1* 8 | | 33 D3 +* GND 9 | | 32 D2 +* GND 10 | | 31 GND * Vcc 11 | | 30 VCC * IRQ2* 12 | MC68153 | 29 D1 * IRQ3* 13 | EI68C153 | 28 D0 @@ -206,7 +206,7 @@ protected: devcb_write_line m_out_intal1_cb; // Daisy chain signals - devcb_read8 m_out_iackout_cb; + devcb_read8 m_out_iackout_cb; int m_iackin; int m_irq_level; }; diff --git a/src/devices/machine/6821pia.cpp b/src/devices/machine/6821pia.cpp index 41d205870cf..ab71db7bfa6 100644 --- a/src/devices/machine/6821pia.cpp +++ b/src/devices/machine/6821pia.cpp @@ -16,7 +16,7 @@ #define LOG_GENERAL 0x01 #define LOG_SETUP 0x02 #define LOG_PRINTF 0x04 -#define LOG_CA1 0x08 +#define LOG_CA1 0x08 #define VERBOSE 0 //(LOG_PRINTF | LOG_SETUP | LOG_GENERAL) diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp index 2e03051727a..32b79ccc5a9 100644 --- a/src/devices/machine/68230pit.cpp +++ b/src/devices/machine/68230pit.cpp @@ -31,7 +31,7 @@ #define LOG_DR 0x20 #define LOG_INT 0x40 -#define VERBOSE 0 // (LOG_PRINTF | LOG_SETUP | LOG_GENERAL | LOG_INT | LOG_BIT | LOG_DR) +#define VERBOSE 0 //(LOG_PRINTF | LOG_SETUP | LOG_GENERAL | LOG_INT | LOG_BIT | LOG_DR) #define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) #define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) @@ -142,19 +142,30 @@ pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag, //------------------------------------------------- void pit68230_device::device_start () { - LOG("%s\n", FUNCNAME); + LOGSETUP("%s\n", FUNCNAME); - // resolve callbacks + // NOTE: + // Not using resolve_safe for the m_px_in_cb's is a temporary way to be able to check + // if a handler is installed with isnull(). The safe function installs a dummy default + // handler which disable the isnull() test. TODO: Need a better fix? + + // resolve callbacks Port A m_pa_out_cb.resolve_safe(); m_pa_in_cb.resolve(); + + // resolve callbacks Port B m_pb_out_cb.resolve_safe(); m_pb_in_cb.resolve(); + + // resolve callbacks Port C m_pc_out_cb.resolve_safe(); - m_pc_in_cb.resolve(); // A temporary way to check if handler is installed with isnull(). TODO: Need better fix. + m_pc_in_cb.resolve(); + m_h1_out_cb.resolve_safe(); m_h2_out_cb.resolve_safe(); m_h3_out_cb.resolve_safe(); m_h4_out_cb.resolve_safe(); + m_tirq_out_cb.resolve_safe(); m_pirq_out_cb.resolve_safe(); @@ -186,7 +197,7 @@ void pit68230_device::device_start () //------------------------------------------------- void pit68230_device::device_reset () { - LOG("%s %s \n",tag(), FUNCNAME); + LOGSETUP("%s %s \n",tag(), FUNCNAME); m_pgcr = 0; m_psrr = 0; @@ -203,6 +214,7 @@ void pit68230_device::device_reset () m_tcr = 0; m_tivr = 0x0f; m_tirq_out_cb(CLEAR_LINE); m_tsr = 0; + LOGSETUP("%s %s DONE!\n",tag(), FUNCNAME); } /* @@ -280,9 +292,60 @@ void pit68230_device::device_timer (emu_timer &timer, device_timer_id id, int32_ } } -void pit68230_device::h1_set (uint8_t state) +WRITE_LINE_MEMBER( pit68230_device::h1_w ) +{ + LOGBIT("%s %s H1 set to %d\n", tag(), FUNCNAME, state); + + // Set the direct level in PSR + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H1L) : (m_psr | REG_PSR_H1L)); + + // Set the programmed assert level in PSR + if (m_pgcr & REG_PGCR_H1_SENSE) + m_psr = ((state != 0) ? (m_psr & ~REG_PSR_H1S) : (m_psr | REG_PSR_H1S)); + else + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H1S) : (m_psr | REG_PSR_H1S)); +} + +WRITE_LINE_MEMBER( pit68230_device::h2_w ) +{ + LOGBIT("%s %s H2 set to %d\n", tag(), FUNCNAME, state); + + // Set the direct level in PSR + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H2L) : (m_psr | REG_PSR_H2L)); + + // Set the programmed assert level in PSR + if (m_pgcr & REG_PGCR_H2_SENSE) + m_psr = ((state != 0) ? (m_psr & ~REG_PSR_H2S) : (m_psr | REG_PSR_H2S)); + else + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H2S) : (m_psr | REG_PSR_H2S)); +} + +WRITE_LINE_MEMBER( pit68230_device::h3_w ) +{ + LOGBIT("%s %s H3 set to %d\n", tag(), FUNCNAME, state); + + // Set the direct level in PSR + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H3L) : (m_psr | REG_PSR_H3L)); + + // Set the programmed assert level in PSR + if (m_pgcr & REG_PGCR_H3_SENSE) + m_psr = ((state != 0) ? (m_psr & ~REG_PSR_H3S) : (m_psr | REG_PSR_H3S)); + else + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H3S) : (m_psr | REG_PSR_H3S)); +} + +WRITE_LINE_MEMBER( pit68230_device::h4_w ) { - if (state) m_psr |= 1; else m_psr &= ~1; + LOGBIT("%s %s H4 set to %d\n", tag(), FUNCNAME, state); + + // Set the direct level in PSR + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H4L) : (m_psr | REG_PSR_H4L)); + + // Set the programmed assert level in PSR + if (m_pgcr & REG_PGCR_H4_SENSE) + m_psr = ((state != 0) ? (m_psr & ~REG_PSR_H4S) : (m_psr | REG_PSR_H4S)); + else + m_psr = ((state == 0) ? (m_psr & ~REG_PSR_H4S) : (m_psr | REG_PSR_H4S)); } // TODO: remove this method and replace it with a call to pb_update_bit() in force68k.cpp @@ -293,7 +356,7 @@ void pit68230_device::portb_setbit(uint8_t bit, uint8_t state) void pit68230_device::pa_update_bit(uint8_t bit, uint8_t state) { - LOGBIT("%s %s bit %d to %d\n",tag(), FUNCNAME, bit, state); + LOGBIT("%s %s bit %d to %d\n", tag(), FUNCNAME, bit, state); // Check if requested bit is an output bit and can't be affected if (m_paddr & (1 << bit)) { @@ -848,7 +911,7 @@ uint8_t pit68230_device::rr_pitreg_pcdr() { m_pcdr |= (m_pcil & ~m_pcddr); } - + if (m_pcdr != 0) { LOGDR("%s %s <- %02x\n",tag(), FUNCNAME, m_pcdr); } return m_pcdr; @@ -860,9 +923,8 @@ the instantaneous pin level is read and no input latching is performed except at data bus interface. Writes to this address are answered with DTACK, but the data is ignored.*/ uint8_t pit68230_device::rr_pitreg_paar() { - // NOTE: no side effect emulated so using ..padr uint8_t ret; - ret = m_pa_in_cb(); + ret = m_pa_in_cb.isnull() ? 0 : m_pa_in_cb(); LOGR("%s %s <- %02x\n",tag(), FUNCNAME, ret); return ret; } @@ -873,9 +935,8 @@ the instantaneous pin level is read and no input latching is performed except at data bus interface.Writes to this address are answered with DTACK, but the data is ignored.*/ uint8_t pit68230_device::rr_pitreg_pbar() { - // NOTE: no side effect emulated so using ..pbdr uint8_t ret; - ret = m_pb_in_cb(); + ret = m_pb_in_cb.isnull() ? 0 : m_pb_in_cb(); LOGR("%s %s <- %02x\n",tag(), FUNCNAME, ret); return ret; } diff --git a/src/devices/machine/68230pit.h b/src/devices/machine/68230pit.h index 79c30aa0b2a..396ba854891 100644 --- a/src/devices/machine/68230pit.h +++ b/src/devices/machine/68230pit.h @@ -131,7 +131,8 @@ class pit68230_device : public device_t//, public device_execute_interface DECLARE_WRITE8_MEMBER (write); DECLARE_READ8_MEMBER (read); - void h1_set (uint8_t state); + // TODO: remove these methods and replace it with a call to methods below in force68k.cpp + void h1_set (uint8_t state){ if (state) m_psr |= 1; else m_psr &= ~1; } void portb_setbit (uint8_t bit, uint8_t state); // Bit updaters @@ -140,6 +141,11 @@ class pit68230_device : public device_t//, public device_execute_interface void pc_update_bit(uint8_t bit, uint8_t state); void update_tin(uint8_t); + DECLARE_WRITE_LINE_MEMBER( h1_w ); + DECLARE_WRITE_LINE_MEMBER( h2_w ); + DECLARE_WRITE_LINE_MEMBER( h3_w ); + DECLARE_WRITE_LINE_MEMBER( h4_w ); + DECLARE_WRITE_LINE_MEMBER( pa0_w ){ pa_update_bit(0, state); } DECLARE_WRITE_LINE_MEMBER( pa1_w ){ pa_update_bit(1, state); } DECLARE_WRITE_LINE_MEMBER( pa2_w ){ pa_update_bit(2, state); } @@ -270,6 +276,17 @@ protected: }; enum { + REG_PSR_H1S = 0x01, + REG_PSR_H2S = 0x02, + REG_PSR_H3S = 0x04, + REG_PSR_H4S = 0x08, + REG_PSR_H1L = 0x10, + REG_PSR_H2L = 0x20, + REG_PSR_H3L = 0x40, + REG_PSR_H4L = 0x80, + }; + + enum { REG_TCR_TIMER_ENABLE = 0x01 }; diff --git a/src/devices/machine/68561mpcc.cpp b/src/devices/machine/68561mpcc.cpp index 7ee3880877c..ff4c1bb1882 100644 --- a/src/devices/machine/68561mpcc.cpp +++ b/src/devices/machine/68561mpcc.cpp @@ -1,481 +1,1195 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/********************************************************************* +// license:BSD-3-Clause copyright-holders: Joakim Larsson Edstrom +/*************************************************************************** - 68561mpcc.c + MPCC Multi-Protocol Communications Controller emulation + + The MPCC was introduced in the late 80:ies by Rockwell + + The variants in the MPCC family are as follows: + + - 68560 with an 8 bit data bus + - 68560A with an 8 bit data bus and some enhancements + - 68561 with a 16 bit data bus + - 68561A with a 16 bit data bus and some enhancements + +FEATURES +------------------------------------------------------------------ + * Full duplex synchronous/asynchronous receiver and transmitter + * Implements IBM Binary Synchronous Communications (BSC) in two coding formats: ASCII and EBCDIC + * Supports other synchronous character -oriented protocols (COP), such as six -bit BSC, X3.28k. ISO IS1745, ECMA-16, etc. + * Supports synchronous bit oriented protocols (BOP), such as SDLC, HDLC, X.25, etc. + * Asynchronous and isochronous modes + * Modem handshake interface + * High speed serial data rate (DC to 4 MHz) + * Internal oscillator and baud rate generator with programmable data rate + * Crystal or TTL level clock input and buffered clock output (8 MHz) + * Direct interface to 68008/68000 asynchronous bus + * Eight -character receiver and transmitter buffer registers + * 22 directly addressable registers for flexible option selection, complete status reporting, and data transfer + * Three separate programmable interrupt vector numbers for receiver, transmitter and serial interface + * Maskable interrupt conditions for receiver, transmitter and serial interface + * Programmable microprocessor bus data transfer; polled, interrupt and two -channel DMA transfer compatible with MC68440/MC68450 + * Clock control register for receiver clock divisor and receiver and transmitter clock routing + * Selectable full/half duplex, autoecho and local loop -back modes + * Selectable parity (enable, odd, even) and CRC (control field enable, CRC -16, CCITT V.41, VRC/LRC) + *------------------------------------------------------------------------------------------- + * x = Features that has been implemented p = partly n = features that will not + *------------------------------------------------------------------------------------------- +*/ - Rockwell 68561 MPCC (Multi Protocol Communications Controller) +#include "emu.h" +#include "68561mpcc.h" - skeleton driver, just enough for besta.c console to work +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** +#define LOG_GENERAL 0x001 +#define LOG_SETUP 0x002 +#define LOG_PRINTF 0x004 +#define LOG_READ 0x008 +#define LOG_INT 0x010 +#define LOG_CMD 0x020 +#define LOG_TX 0x040 +#define LOG_RCV 0x080 +#define LOG_CTS 0x100 +#define LOG_DCD 0x200 +#define LOG_SYNC 0x400 +#define LOG_CHAR 0x800 +#define LOG_RX 0x1000 + +#define VERBOSE 0 // (LOG_PRINTF | LOG_SETUP | LOG_GENERAL) + +#define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) +#define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) + +#define LOG(...) LOGMASK(LOG_GENERAL, __VA_ARGS__) +#define LOGSETUP(...) LOGMASK(LOG_SETUP, __VA_ARGS__) +#define LOGR(...) LOGMASK(LOG_READ, __VA_ARGS__) +#define LOGINT(...) LOGMASK(LOG_INT, __VA_ARGS__) +#define LOGCMD(...) LOGMASK(LOG_CMD, __VA_ARGS__) +#define LOGTX(...) LOGMASK(LOG_TX, __VA_ARGS__) +#define LOGRCV(...) LOGMASK(LOG_RCV, __VA_ARGS__) +#define LOGCTS(...) LOGMASK(LOG_CTS, __VA_ARGS__) +#define LOGDCD(...) LOGMASK(LOG_DCD, __VA_ARGS__) +#define LOGSYNC(...) LOGMASK(LOG_SYNC, __VA_ARGS__) +#define LOGCHAR(...) LOGMASK(LOG_CHAR, __VA_ARGS__) +#define LOGRX(...) LOGMASK(LOG_RX, __VA_ARGS__) + +#if VERBOSE & LOG_PRINTF +#define logerror printf +#endif -*********************************************************************/ +#ifdef _MSC_VER +#define FUNCNAME __func__ +#define LLFORMAT "%I64d" +#else +#define FUNCNAME __PRETTY_FUNCTION__ +#define LLFORMAT "%lld" +#endif +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** +// device type definition +const device_type MPCC = &device_creator<mpcc_device>; +const device_type MPCC68560 = &device_creator<mpcc68560_device>; +const device_type MPCC68560A = &device_creator<mpcc68560A_device>; +const device_type MPCC68561 = &device_creator<mpcc68561_device>; +const device_type MPCC68561A = &device_creator<mpcc68561A_device>; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +mpcc_device::mpcc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_serial_interface(mconfig, *this), + m_variant(variant), + m_rxc(0), + m_txc(0), + m_brg_rate(0), + m_rcv(0), + m_rxd(0), + m_tra(0), + m_out_txd_cb(*this), + m_out_dtr_cb(*this), + m_out_rts_cb(*this), + m_out_rtxc_cb(*this), + m_out_trxc_cb(*this), + m_out_int_cb(*this), + m_rsr(0), + m_rcr(0), + m_rdr(0), + m_rivnr(0), + m_rier(0), + m_tsr(0), + m_tcr(0), + m_tdr(0), + m_tivnr(0), + m_tier(0), + m_sisr(0), + m_sicr(0), + m_sivnr(0), + m_sier(0), + m_psr1(0), + m_psr2(0), + m_ar1(0), + m_ar2(0), + m_brdr1(0), + m_brdr2(0), + m_ccr(0), + m_ecr(0) +{ + for (auto & elem : m_int_state) + elem = 0; +} -#include "emu.h" -#include "68561mpcc.h" +mpcc_device::mpcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MPCC, "Rockwell MPCC", tag, owner, clock, "mpcc", __FILE__), + device_serial_interface(mconfig, *this), + m_variant(TYPE_MPCC), + m_rxc(0), + m_txc(0), + m_brg_rate(0), + m_rcv(0), + m_rxd(0), + m_tra(0), + m_out_txd_cb(*this), + m_out_dtr_cb(*this), + m_out_rts_cb(*this), + m_out_rtxc_cb(*this), + m_out_trxc_cb(*this), + m_out_int_cb(*this), + m_rsr(0), + m_rcr(0), + m_rdr(0), + m_rivnr(0), + m_rier(0), + m_tsr(0), + m_tcr(0), + m_tdr(0), + m_tivnr(0), + m_tier(0), + m_sisr(0), + m_sicr(0), + m_sivnr(0), + m_sier(0), + m_psr1(0), + m_psr2(0), + m_ar1(0), + m_ar2(0), + m_brdr1(0), + m_brdr2(0), + m_ccr(0), + m_ecr(0) +{ + for (auto & elem : m_int_state) + elem = 0; +} -const device_type MPCC68561 = &device_creator<mpcc68561_t>; +mpcc68560_device::mpcc68560_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mpcc_device(mconfig, MPCC68560, "MPCC 68560", tag, owner, clock, TYPE_MPCC68560, "mpcc68560", __FILE__){ } +mpcc68560A_device::mpcc68560A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mpcc_device(mconfig, MPCC68560A, "MPCC 68560A", tag, owner, clock, TYPE_MPCC68560A, "mpcc68560A", __FILE__){ } -/*************************************************************************** - PARAMETERS -***************************************************************************/ +mpcc68561_device::mpcc68561_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mpcc_device(mconfig, MPCC68561, "MPCC 68561", tag, owner, clock, TYPE_MPCC68561, "mpcc68561", __FILE__){ } -#define LOG_MPCC (1) +mpcc68561A_device::mpcc68561A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mpcc_device(mconfig, MPCC68561A, "MPCC 68561A", tag, owner, clock, TYPE_MPCC68561A, "mpcc68561A", __FILE__){ } -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void mpcc_device::device_start() +{ + LOGSETUP("%s\n", FUNCNAME); + + // resolve callbacks + m_out_txd_cb.resolve_safe(); + m_out_dtr_cb.resolve_safe(); + m_out_rts_cb.resolve_safe(); + m_out_rtxc_cb.resolve_safe(); + m_out_trxc_cb.resolve_safe(); + m_out_int_cb.resolve_safe(); + + // state saving + save_item(NAME(m_int_state)); + save_item(NAME(m_rsr)); + save_item(NAME(m_rcr)); + save_item(NAME(m_rdr)); + save_item(NAME(m_rivnr)); + save_item(NAME(m_rier)); + save_item(NAME(m_tsr)); + save_item(NAME(m_tcr)); + save_item(NAME(m_tdr)); + save_item(NAME(m_tivnr)); + save_item(NAME(m_tier)); + save_item(NAME(m_sisr)); + save_item(NAME(m_sicr)); + save_item(NAME(m_sivnr)); + save_item(NAME(m_sier)); + save_item(NAME(m_psr1)); + save_item(NAME(m_psr2)); + save_item(NAME(m_ar1)); + save_item(NAME(m_ar2)); + save_item(NAME(m_brdr1)); + save_item(NAME(m_brdr2)); + save_item(NAME(m_ccr)); + save_item(NAME(m_ecr)); + LOG(" - MPCC variant %02x\n", m_variant); + + device_serial_interface::register_save_state(machine().save(), this); +} -mpcc68561_t::mpcc68561_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, MPCC68561, "Rockwell 68561 MPCC", tag, owner, clock, "mpcc68561", __FILE__), mode(0), reg(0), status(0), IRQV(0), MasterIRQEnable(0), lastIRQStat(0), IRQType(), - intrq_cb(*this) +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- +void mpcc_device::device_reset() { + LOGSETUP("%s %s \n",tag(), FUNCNAME); + + // Reset RS232 emulation + receive_register_reset(); + transmit_register_reset(); + + // Device reset values + m_rsr = 0x00; + m_rcr = 0x01; + m_rivnr = 0x0f; + m_rier = 0x00; + m_tsr = 0x80; + m_tcr = 0x01; + m_tivnr = 0x0f; + m_tier = 0x00; + m_sisr = 0x00; + m_sicr = 0x00; + m_sivnr = 0x0f; + m_sier = 0x00; + m_psr1 = 0x00; + m_psr2 = 0x00; + m_ar1 = 0x00; + m_ar2 = 0x00; + m_brdr1 = 0x01; + m_brdr2 = 0x00; + m_ccr = 0x00; + m_ecr = 0x04; + + // Clear fifos + m_tx_data_fifo.clear(); + m_rx_data_fifo.clear(); + + // Init out callbacks to known inactive state + m_out_txd_cb(1); + m_out_dtr_cb(1); + m_out_rts_cb(1); + m_out_rtxc_cb(1); + m_out_trxc_cb(1); + m_out_int_cb(1); } -/*------------------------------------------------- - mpcc_updateirqs --------------------------------------------------*/ +/* + * Serial device implementation + */ -void mpcc68561_t::updateirqs() +void mpcc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int irqstat; + device_serial_interface::device_timer(timer, id, param, ptr); +} - irqstat = 0; - if (MasterIRQEnable) +WRITE_LINE_MEMBER(mpcc_device::cts_w) +{ + if (state == CLEAR_LINE) { - if ((channel[0].txIRQEnable) && (channel[0].txIRQPending)) - { - IRQType = IRQ_B_TX; - irqstat = 1; - } - else if ((channel[1].txIRQEnable) && (channel[1].txIRQPending)) + uint8_t old_sisr = m_sisr; + + m_sisr &= ~REG_SISR_CTSLVL; + if ( (old_sisr & REG_SISR_CTSLVL) && + (m_sicr & REG_SICR_RTSLVL) && + (m_tcr & REG_TCR_TEN)) { - IRQType = IRQ_A_TX; - irqstat = 1; + m_sisr |= REG_SISR_CTST; + if (m_sier & REG_SIER_CTS) + { + // TODO: make sure interrupt is issued with the next negative transition of TxC + trigger_interrupt(INT_SR_CTS); + // TODO: Make sure TxC has negative transition after CTS goes inactive before INT can be reset in SISR7 + } } - else if ((channel[0].extIRQEnable) && (channel[0].extIRQPending)) + } + else + m_sisr |= REG_SISR_CTSLVL; +} + +WRITE_LINE_MEMBER(mpcc_device::dsr_w) +{ + if (state == ASSERT_LINE) + { + uint8_t old_sisr = m_sisr; + + m_sisr |= REG_SISR_DSRLVL; + if ( !(old_sisr & REG_SISR_DSRLVL) && + !(m_rcr & REG_RCR_RRES)) { - IRQType = IRQ_B_EXT; - irqstat = 1; + m_sisr |= REG_SISR_DSRT; + if (m_sier & REG_SIER_DSR) + { + // TODO: make sure interrupt is issued with the next negative transition of RxC + trigger_interrupt(INT_SR_DSR); + // TODO: Make sure RxC has negative transition after DSR goes inactive before INT can be reset in SISR6 + } } - else if ((channel[1].extIRQEnable) && (channel[1].extIRQPending)) + } + else + m_sisr &= ~REG_SISR_DSRLVL; +} + +WRITE_LINE_MEMBER(mpcc_device::dcd_w) +{ + if (state == CLEAR_LINE) + { + uint8_t old_sisr = m_sisr; + + m_sisr &= ~REG_SISR_DCDLVL; + if ( (old_sisr & REG_SISR_DCDLVL) && + !(m_rcr & REG_RCR_RRES)) { - IRQType = IRQ_A_EXT; - irqstat = 1; + m_sisr |= REG_SISR_DCDT; + if (m_sier & REG_SIER_DCD) + { + // TODO: make sure interrupt is issued with the next negative transition of RxC + trigger_interrupt(INT_SR_DCD); + // TODO: Make sure RxC has negative transition before INT can be reset in SISR5 + } } } else + m_sisr |= REG_SISR_DCDLVL; +} + +//------------------------------------------------- +// get_brg_rate - helper function +//------------------------------------------------- +uint32_t mpcc_device::get_brg_rate() +{ + uint32_t rate; + uint32_t brg_const; + + brg_const = (m_brdr1 | m_brdr2 << 8); // Baud rate divider + brg_const += (m_ccr & REG_CCR_PSCDIV) ? 3 : 2; // Add prescaler factor + brg_const += (m_psr2 & REG_PSR2_PSEL_MSK) == REG_PSR2_PSEL_ASCII ? 2 : 1; // Add K factor + rate = clock() / brg_const; + + return rate; +} + +//------------------------------------------------- +// get_tx_rate - helper function +//------------------------------------------------- +uint32_t mpcc_device::get_tx_rate() +{ + uint32_t rate; + + // Check if TxC is an input and use it instead of the BRG + if ((m_ccr & REG_CCR_TCLO) == 0) + { + rate = m_txc; + } + else { - IRQType = IRQ_NONE; + rate = get_brg_rate(); } -// printf("mpcc: irqstat %d, last %d\n", irqstat, lastIRQStat); -// printf("ch0: en %d pd %d ch1: en %d pd %d\n", channel[0].txIRQEnable, channel[0].txIRQPending, channel[1].txIRQEnable, channel[1].txIRQPending); + return rate; +} - // don't spam the driver with unnecessary transitions - if (irqstat != lastIRQStat) - { - lastIRQStat = irqstat; +//------------------------------------------------- +// get_clock_div - helper function +//------------------------------------------------- +uint32_t mpcc_device::get_clock_div() +{ + uint32_t clk_div = 1; - // tell the driver the new IRQ line status if possible -#if LOG_MPCC - printf("mpcc68561 IRQ status => %d\n", irqstat); -#endif - if(!intrq_cb.isnull()) - intrq_cb(irqstat); + switch (m_ccr & REG_CCR_CLKDIV_MSK) + { + case REG_CCR_CLKDIV_X1 : clk_div = 1; break; + case REG_CCR_CLKDIV_X16: clk_div = 16; break; + case REG_CCR_CLKDIV_X32: clk_div = 32; break; + case REG_CCR_CLKDIV_X64: clk_div = 64; break; } + + return clk_div; } -/*------------------------------------------------- - mpcc_initchannel --------------------------------------------------*/ -void mpcc68561_t::initchannel(int ch) +//------------------------------------------------- +// get_rx_rate - helper function +//------------------------------------------------- +uint32_t mpcc_device::get_rx_rate() { - channel[ch].syncHunt = 1; + uint32_t rate; + + // Check if TxC is an input and use it instead of the BRG + if ((m_ccr & REG_CCR_RCLKIN) == 0) + { + rate = m_rxc / get_clock_div(); + } + else + { + rate = get_brg_rate(); + } + + return rate; } -/*------------------------------------------------- - mpcc_resetchannel --------------------------------------------------*/ -void mpcc68561_t::resetchannel(int ch) +//------------------------------------------------- +// get_word_length - get word length +//------------------------------------------------- +uint32_t mpcc_device::get_word_length() { - emu_timer *timersave = channel[ch].baudtimer; + int bits = 5; + + switch (m_psr2 & REG_PSR2_CHLN_MSK) + { + case REG_PSR2_CHLN_5: bits = 5; break; + case REG_PSR2_CHLN_6: bits = 6; break; + case REG_PSR2_CHLN_7: bits = 7; break; + case REG_PSR2_CHLN_8: bits = 8; break; + } - memset(&channel[ch], 0, sizeof(Chan)); + return bits; +} - channel[ch].txUnderrun = 1; - channel[ch].baudtimer = timersave; +//------------------------------------------------- +// get_stop_bits - translate stop bit settings for serial interface +//------------------------------------------------- +device_serial_interface::stop_bits_t mpcc_device::get_stop_bits() +{ + switch (m_psr2 & REG_PSR2_STP_MSK) + { + case REG_PSR2_STP_1: return STOP_BITS_1; + case REG_PSR2_STP_1_5: return STOP_BITS_1_5; + case REG_PSR2_STP_2: return STOP_BITS_2; + } - channel[ch].baudtimer->adjust(attotime::never, ch); + return STOP_BITS_0; } -/*------------------------------------------------- - mpcc68561_baud_expire - baud rate timer expiry --------------------------------------------------*/ +//------------------------------------------------- +// get_parity - translate parity settings for serial interface +//------------------------------------------------- +device_serial_interface::parity_t mpcc_device::get_parity() +{ + parity_t parity; + + if (m_ecr & REG_ECR_PAREN) + { + if (m_ecr & REG_ECR_ODDPAR) + parity = PARITY_ODD; + else + parity = PARITY_EVEN; + } + else + { + parity = PARITY_NONE; + } + return parity; +} -void mpcc68561_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +//------------------------------------------------- +// update_serial - +//------------------------------------------------- +void mpcc_device::update_serial() { - Chan *pChan = &channel[id]; - int brconst = pChan->reg_val[13]<<8 | pChan->reg_val[14]; - int rate; + int data_bits = get_word_length(); + stop_bits_t stop_bits = get_stop_bits(); + parity_t parity = get_parity(); - if (brconst) + LOGSETUP(" %s() %s Setting data frame %d+%d%c%s\n", FUNCNAME, m_owner->tag(), 1, + data_bits, parity == PARITY_NONE ? 'N' : parity == PARITY_EVEN ? 'E' : 'O', + stop_bits == STOP_BITS_1 ? "1" : (stop_bits == STOP_BITS_2 ? "2" : "1.5")); + + set_data_frame(1, data_bits, parity, stop_bits); + + // Setup the Receiver + // check if the receiver is in reset mode + if (m_rcr & REG_RCR_RRES) { - rate = clock() / brconst; + LOGSETUP("- Rx in reset\n"); + set_rcv_rate(0); } + // Rx is running else { - rate = 0; + LOGSETUP("- Rx enabled\n"); + m_brg_rate = get_rx_rate(); + + LOGSETUP("- BRG rate %d\n", m_brg_rate); + set_rcv_rate(m_brg_rate); } - // is baud counter IRQ enabled on this channel? - // always flag pending in case it's enabled after this - pChan->baudIRQPending = 1; - if (pChan->baudIRQEnable) + // Setup the Transmitter + // check if Rx is in reset + if (m_tcr & REG_TCR_TRES) + { + LOGSETUP("- Tx in reset\n"); + set_tra_rate(0); + } + // Tx is running + else { - if (pChan->extIRQEnable) + // Check that Tx is enabled + if (m_tcr & REG_TCR_TEN) + { + LOGSETUP("- Tx enabled\n"); + m_brg_rate = get_tx_rate(); + + LOGSETUP("- BRG rate %d\n", m_brg_rate); + set_tra_rate(m_brg_rate); + } + else { - pChan->extIRQPending = 1; - pChan->baudIRQPending = 0; - updateirqs(); + LOGSETUP("- Tx disabled\n"); + set_tra_rate(0); } } +} - // reset timer according to current register values - if (rate) +//------------------------------------------------- +// tra_callback - is called for each bit that needs to be transmitted +//------------------------------------------------- +void mpcc_device::tra_callback() +{ + // Check if transmitter is idle as in disabled + if (!(m_tcr & REG_TCR_TEN)) + { + // transmit idle TODO: Support TCR TICS bit + LOGTX("%s idle bit\n", FUNCNAME); + m_out_txd_cb(1); + } +#if 0 + // Check if we are transmitting break TODO: Figure out Break support + else if (...) { - timer.adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + // transmit break + m_out_txd_cb(0); } +#endif + // Check if there is more bits to send + else if (!is_transmit_register_empty()) + { + // Get the next bit + int db = transmit_register_get_data_bit(); + LOGTX("%s bit: %d\n", FUNCNAME, db ? 1 : 0); + + // transmit data + m_out_txd_cb(db); + } + // Otherwise we don't know why we are called... else { - timer.adjust(attotime::never, 0, attotime::never); + logerror("%s %s Failed to transmit\n", FUNCNAME, m_owner->tag()); } } -/*------------------------------------------------- - device_start - device-specific startup --------------------------------------------------*/ +//------------------------------------------------- +// tra_complete - is called when the transmitter shift register has sent the last bit +//------------------------------------------------- +void mpcc_device::tra_complete() +{ + // check if transmitter is enabled and we are not sending BREAK level + if ((m_tcr & REG_TCR_TEN) && !(m_tcr & REG_TCR_TICS)) + { // check if there are more data in the fifo + if (!m_tx_data_fifo.empty()) + { + transmit_register_setup(m_tx_data_fifo.dequeue()); // Reload the shift register + m_tsr |= REG_TSR_TDRA; // Mark fifo as having room for more data + } + else + { + m_out_rts_cb(CLEAR_LINE); // TODO: respect the RTSLV bit + m_sicr &= ~REG_SICR_RTSLVL; + } + + // Check if Tx interrupts are enabled + if (m_tier & REG_TIER_TDRA) + { + // TODO: Check circumstances, eg int on first or every character etc + trigger_interrupt(INT_TX_TDRA); + } + } // Check if sending BREAK + else if (m_tcr & REG_TCR_TICS) + { + // TODO: Should transmit content of AR2, needs investigation + m_out_txd_cb(0); + } + else + { + // transmit mark + m_out_txd_cb(1); + } +} -void mpcc68561_t::device_start() +//------------------------------------------------- +// rcv_callback - called when it is time to sample incomming data bit +//------------------------------------------------- +void mpcc_device::rcv_callback() { - intrq_cb.resolve_safe(); + // Check if the Receiver is enabled + if (!(m_rcr & REG_RCR_RRES)) + { + receive_register_update_bit(m_rxd); + } +} - memset(channel, 0, sizeof(channel)); +//------------------------------------------------- +// rcv_complete - +//------------------------------------------------- +void mpcc_device::rcv_complete() +{ + uint8_t data; - mode = 0; - reg = 0; - status = 0; - IRQV = 0; - MasterIRQEnable = 0; - lastIRQStat = 0; - IRQType = IRQ_NONE; + receive_register_extract(); + data = get_received_char(); + LOGRX("%s %02x [%c]\n", FUNCNAME, isascii(data) ? data : ' ', data); - channel[0].baudtimer = timer_alloc(0); + // receive_data(data); + if (m_rx_data_fifo.full()) + { + // receive overrun error detected, new data is lost + m_rsr |= REG_RSR_ROVRN; + // interrupt if rx overrun interrupt is enabled + if (m_rier & REG_RIER_ROVRN) + { + trigger_interrupt(INT_RX_ROVRN); + } + } + else + { + m_rx_data_fifo.enqueue(data); + m_rsr |= REG_RSR_RDA; + // interrupt if rx data availble is enabled + if (m_rier & REG_RIER_RDA) + { + trigger_interrupt(INT_RX_RDA); + } + } } - -/*------------------------------------------------- - device_reset - device-specific reset --------------------------------------------------*/ -void mpcc68561_t::device_reset() +//------------------------------------------------- +// write_rx - called by terminal through rs232/diserial +// when character is sent to board +//------------------------------------------------- +WRITE_LINE_MEMBER(mpcc_device::write_rx) { - IRQType = IRQ_NONE; - MasterIRQEnable = 0; - IRQV = 0; + LOGRCV("%s(%d)\n", FUNCNAME, state); + m_rxd = state; - initchannel(0); - resetchannel(0); + //only use rx_w when self-clocked + if(m_rxc != 0 || m_brg_rate != 0) + device_serial_interface::rx_w(state); } -/*------------------------------------------------- - mpcc_set_status --------------------------------------------------*/ -void mpcc68561_t::set_status(int _status) +/* + * Interrupts + */ +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- +void mpcc_device::check_interrupts() { - status = _status; -} + int state = 0; + LOGINT("%s %s \n",tag(), FUNCNAME); -/*------------------------------------------------- - mpcc_acknowledge --------------------------------------------------*/ + // loop over all interrupt sources + for (auto & elem : m_int_state) + { + state |= elem; + } -void mpcc68561_t::acknowledge() -{ - if(!intrq_cb.isnull()) - intrq_cb(0); + // update IRQ line + // If we are not serving any interrupt the IRQ is asserted already and we need to do nothing + if ((state & INT_ACK) == 0) + { + // If there is a new interrupt not yet acknowledged IRQ needs to be asserted + if (state & INT_REQ) + { + m_out_int_cb(ASSERT_LINE); + } + // Otherwise we just clear the IRQ line allowing other devices to interrupt + else + { + m_out_int_cb(CLEAR_LINE); + } + } } -/*------------------------------------------------- - mpcc_getreg --------------------------------------------------*/ +//------------------------------------------------- +// reset_interrupts - +//------------------------------------------------- -uint8_t mpcc68561_t::getreg() +void mpcc_device::reset_interrupts() { - /* Not yet implemented */ - #if LOG_MPCC - printf("mpcc: port A reg %d read 0x%02x\n", reg, channel[0].reg_val[reg]); - #endif - - if (reg == 0) + LOGINT("%s %s \n",tag(), FUNCNAME); + // reset internal interrupt sources + for (auto & elem : m_int_state) { - uint8_t rv = 0; - - Chan *ourCh = &channel[0]; + elem = 0; + } - rv |= (ourCh->txUnderrun) ? 0x40 : 0; - rv |= (ourCh->syncHunt) ? 0x10 : 0; - rv |= channel[0].reg_val[0] & 0x05; // pick up TXBE and RXBF bits + // check external interrupt sources + check_interrupts(); +} - return rv; - } - else if (reg == 10) +//----------------------------------------------------------------------- +// trigger_interrupt - called when a potential interrupt condition occurs +//------------------------------------------------- +void mpcc_device::trigger_interrupt(int source) +{ + LOGINT("%s %s: %02x\n",FUNCNAME, tag(), source); + switch(source) { - return 0; + case INT_TX_TDRA: + case INT_TX_TFC: + case INT_TX_TUNRN: + case INT_TX_TFERR: + m_int_state[TX_INT_PRIO] = INT_REQ; + break; + case INT_RX_RDA: + case INT_RX_EOF: + case INT_RX_CPERR: + case INT_RX_FRERR: + case INT_RX_ROVRN: + case INT_RX_RAB: + m_int_state[RX_INT_PRIO] = INT_REQ; + break; + case INT_SR_CTS: + case INT_SR_DSR: + case INT_SR_DCD: + m_int_state[SR_INT_PRIO] = INT_REQ; + break; } - return channel[0].reg_val[reg]; + check_interrupts(); } -/*------------------------------------------------- - mpcc_putreg --------------------------------------------------*/ - -void mpcc68561_t::putreg(int ch, uint8_t data) +//------------------------------------------------- +// Read register +//------------------------------------------------- +READ8_MEMBER( mpcc_device::read ) { - Chan *pChan = &channel[ch]; + uint8_t data = 0; - channel[ch].reg_val[reg] = data; - #if LOG_MPCC - printf("mpcc: port %c reg %d write 0x%02x\n", 'A'+ch, reg, data); - #endif + switch(offset) + { + case 0x00: data = do_rsr(); break; + case 0x01: data = do_rcr(); break; + case 0x02: data = do_rdr(); break; + case 0x04: data = m_rivnr; logerror("MPCC: Reg RIVNR not implemented\n"); break; + case 0x05: data = do_rier(); break; + case 0x08: data = m_tsr; break; logerror("MPCC: Reg TSR not implemented\n"); break; + case 0x09: data = do_tcr(); break; + //case 0x0a: data = m_tdr; break; // TDR is a write only register + case 0x0c: data = do_tivnr(); break; + case 0x0d: data = do_tier(); break; + case 0x10: data = do_sisr(); break; + case 0x11: data = do_sicr(); break; + case 0x14: data = m_sivnr; logerror("MPCC: Reg SIVNR not implemented\n"); break; + case 0x15: data = do_sier(); break; + case 0x18: data = do_psr1(); break; + case 0x19: data = do_psr2(); break; + case 0x1a: data = m_ar1; logerror("MPCC: Reg AR1 not implemented\n"); break; + case 0x1b: data = m_ar2; logerror("MPCC: Reg AR2 not implemented\n"); break; + case 0x1c: data = do_brdr1(); break; + case 0x1d: data = do_brdr2(); break; + case 0x1e: data = do_ccr(); break; + case 0x1f: data = do_ecr(); break; + default: logerror("%s invalid register accessed: %02x\n", m_owner->tag(), offset); + } + LOGR(" * %s Reg %02x -> %02x \n", m_owner->tag(), offset, data); + return data; +} - switch (reg) +//------------------------------------------------- +// Write register +//------------------------------------------------- +WRITE8_MEMBER( mpcc_device::write ) +{ + LOGSETUP(" * %s Reg %02x <- %02x \n", m_owner->tag(), offset, data); + switch(offset) { - case 0: // command register - switch ((data >> 3) & 7) - { - case 1: // select high registers (handled elsewhere) - break; - - case 2: // reset external and status IRQs - pChan->syncHunt = 0; - break; - - case 5: // ack Tx IRQ - pChan->txIRQPending = 0; - updateirqs(); - break; - - case 0: // nothing - case 3: // send SDLC abort - case 4: // enable IRQ on next Rx byte - case 6: // reset errors - case 7: // reset highest IUS - // we don't handle these yet - break; + case 0x00: do_rsr(data); break; + case 0x01: do_rcr(data); break; + //case 0x02: m_rdr = data; break; // RDR is a read only register + case 0x04: m_rivnr = data; logerror("MPCC: Reg RIVNR not implemented\n"); break; + case 0x05: do_rier(data); break; + case 0x08: m_tsr = data; logerror("MPCC: Reg TSR not implemented\n"); break; + case 0x09: do_tcr(data); break; + case 0x0a: m_tdr = data; LOGCHAR("*%c", data); do_tdr(data); break; + case 0x0c: do_tivnr(data); break; + case 0x0d: do_tier(data); break; + case 0x10: do_sisr(data); break; + case 0x11: do_sicr(data); break; + case 0x14: m_sivnr = data; logerror("MPCC: Reg SIVNR not implemented\n"); break; + case 0x15: do_sier(data); break; + case 0x18: do_psr1(data); break; + case 0x19: do_psr2(data); break; + case 0x1a: m_ar1 = data; logerror("MPCC: Reg AR1 not implemented\n"); break; + case 0x1b: m_ar2 = data; logerror("MPCC: Reg AR2 not implemented\n"); break; + case 0x1c: do_brdr1(data); break; + case 0x1d: do_brdr2(data); break; + case 0x1e: do_ccr(data); break; + case 0x1f: do_ecr(data); break; + default: logerror("%s invalid register accessed: %02x\n", m_owner->tag(), offset); + } +} - } - break; +void mpcc_device::do_rsr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_rsr = data; +} - case 1: // Tx/Rx IRQ and data transfer mode defintion - pChan->extIRQEnable = (data & 1); - pChan->txIRQEnable = (data & 2) ? 1 : 0; - pChan->rxIRQEnable = (data >> 3) & 3; - updateirqs(); - break; +uint8_t mpcc_device::do_rsr() +{ + uint8_t data = m_rsr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - case 2: // IRQ vector - IRQV = data; - break; +void mpcc_device::do_rcr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_rcr = data; + LOGSETUP(" - Rx DMA : %s\n", (m_rcr & REG_RCR_RDSREN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx DONE out : %s\n", (m_rcr & REG_RCR_DONEEN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx RSYN out : %s\n", (m_rcr & REG_RCR_RSYNEN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx strip SYN: %s\n", (m_rcr & REG_RCR_STRSYN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx Abort : %s\n", (m_rcr & REG_RCR_RABTEN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx Mode : %s\n", (m_rcr & REG_RCR_RRES ) ? "reset" : "normal"); + + update_serial(); +} - case 3: // Rx parameters and controls - pChan->rxEnable = (data & 1); - pChan->syncHunt = (data & 0x10) ? 1 : 0; - break; +uint8_t mpcc_device::do_rcr() +{ + uint8_t data = m_rcr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - case 5: // Tx parameters and controls -// printf("ch %d TxEnable = %d [%02x]\n", ch, data & 8, data); - pChan->txEnable = data & 8; +uint8_t mpcc_device::do_rdr() +{ + uint8_t data = 0; - if (pChan->txEnable) - { - pChan->reg_val[0] |= 0x04; // Tx empty - } - break; + if (!m_rx_data_fifo.empty()) + { + // load data from the FIFO + data = m_rx_data_fifo.dequeue(); + } + else + { + LOGRX("data_read: Attempt to read out character from empty FIFO\n"); + logerror("data_read: Attempt to read out character from empty FIFO\n"); + } - case 4: // Tx/Rx misc parameters and modes - case 6: // sync chars/SDLC address field - case 7: // sync char/SDLC flag - break; + LOGRX("%s <- %02x [%c]\n", FUNCNAME, isascii(data) ? data : ' ', data); + return data; +} - case 9: // master IRQ control - MasterIRQEnable = (data & 8) ? 1 : 0; - updateirqs(); - // channel reset command - switch ((data>>6) & 3) - { - case 0: // do nothing - break; +void mpcc_device::do_rier(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_rier = data; + LOGSETUP(" - Rx INT on Rx data available : %s\n", (m_rier & REG_RIER_RDA) ? "enabled" : "disabled"); + LOGSETUP(" - Rx INT on End of Frame : %s\n", (m_rier & REG_RIER_EOF) ? "enabled" : "disabled"); + LOGSETUP(" - Rx INT on CRC/Parity error : %s\n", (m_rier & REG_RIER_CPERR) ? "enabled" : "disabled"); + LOGSETUP(" - Rx INT on Frame error : %s\n", (m_rier & REG_RIER_FRERR) ? "enabled" : "disabled"); + LOGSETUP(" - Rx INT on Receiver overrun : %s\n", (m_rier & REG_RIER_ROVRN) ? "enabled" : "disabled"); + LOGSETUP(" - Rx INT on Abort/Break : %s\n", (m_rier & REG_RIER_RAB) ? "enabled" : "disabled"); +} - case 1: // reset channel B - resetchannel(0); - break; +uint8_t mpcc_device::do_rier() +{ + uint8_t data = m_rier; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - case 3: // force h/w reset (entire chip) - IRQType = IRQ_NONE; - MasterIRQEnable = 0; - IRQV = 0; +void mpcc_device::do_tdr(uint8_t data) +{ + LOG("%s -> %d [%c]\n", FUNCNAME, data, isprint(data) ? data : ' '); + // Check of Tx fifo has room + if (m_tx_data_fifo.full()) + { + logerror("- TX FIFO is full, discarding data\n"); + LOGTX("- TX FIFO is full, discarding data\n"); + } + else // ..there is still room + { + m_tx_data_fifo.enqueue(data); + if (m_tx_data_fifo.full()) + { + m_tsr &= ~REG_TSR_TDRA; // Mark fifo as full + } + } - initchannel(0); - resetchannel(0); + // Check if Tx is enabled + if (m_tcr & REG_TCR_TEN) + { + LOGTX("- TX is enabled\n"); + if (is_transmit_register_empty()) // Is the shift register loaded? + { + LOGTX("- Setting up transmitter\n"); + transmit_register_setup(m_tx_data_fifo.dequeue()); // Load the shift register, reload is done in tra_complete() + m_tsr |= REG_TSR_TDRA; // Now there is a slot in the FIFO available again + } + else + { + LOGTX("- Transmitter not empty\n"); + } + } +} - // make sure we stop yanking the IRQ line if we were - updateirqs(); - break; +void mpcc_device::do_tcr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_tcr = data; + LOGSETUP(" - Tx : %s\n", (m_tcr & REG_TCR_TEN) ? "enabled" : "disabled"); + LOGSETUP(" - Tx DMA : %s\n", (m_tcr & REG_TCR_TDSREN) ? "enabled" : "disabled"); + LOGSETUP(" - Tx Idle character : %s\n", (m_tcr & REG_TCR_TICS) ? "AR2" : "high"); + LOGSETUP(" - Tx Half Word next : %s\n", (m_tcr & REG_TCR_THW) ? "yes" : "no"); + LOGSETUP(" - Tx Last character : %s\n", (m_tcr & REG_TCR_TLAST) ? "yes" : "no"); + LOGSETUP(" - Tx SYN : %s\n", (m_tcr & REG_TCR_TSYN) ? "enabled" : "disabled"); + LOGSETUP(" - Tx Abort command : %s\n", (m_tcr & REG_TCR_TABT) ? "active" : "inactive"); + LOGSETUP(" - Tx Mode : %s\n", (m_tcr & REG_TCR_TRES) ? "reset" : "normal"); + + update_serial(); +} - } - break; +uint8_t mpcc_device::do_tcr() +{ + uint8_t data = m_tcr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - case 10: // misc transmitter/receiver control bits - case 11: // clock mode control - case 12: // lower byte of baud rate gen - case 13: // upper byte of baud rate gen - break; +void mpcc_device::do_tivnr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_tivnr = data; + LOGSETUP(" - Tx Int vector: %02x\n", m_tivnr); +} - case 14: // misc control bits - if (data & 0x01) // baud rate generator enable? - { - int brconst = pChan->reg_val[13]<<8 | pChan->reg_val[14]; - int rate = clock() / brconst; +uint8_t mpcc_device::do_tivnr() +{ + uint8_t data = m_tivnr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - pChan->baudtimer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); - } - break; +void mpcc_device::do_tier(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_tier = data; + LOGSETUP(" - Tx INT on FIFO slot available : %s\n", (m_tier & REG_TIER_TDRA) ? "enabled" : "disabled"); + LOGSETUP(" - Tx INT on Frame complete : %s\n", (m_tier & REG_TIER_TFC ) ? "enabled" : "disabled"); + LOGSETUP(" - Tx INT on Underrun : %s\n", (m_tier & REG_TIER_TUNRN) ? "enabled" : "disabled"); + LOGSETUP(" - Tx INT on Frame error : %s\n", (m_tier & REG_TIER_TFERR) ? "enabled" : "disabled"); +} - case 15: // external/status interrupt control - pChan->baudIRQEnable = (data & 2) ? 1 : 0; - pChan->DCDEnable = (data & 8) ? 1 : 0; - pChan->CTSEnable = (data & 0x20) ? 1 : 0; - pChan->txUnderrunEnable = (data & 0x40) ? 1 : 0; - break; - } +uint8_t mpcc_device::do_tier() +{ + uint8_t data = m_tier; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; } -/*------------------------------------------------- - mpcc68561_get_reg_a --------------------------------------------------*/ +void mpcc_device::do_sisr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + if (data & REG_SISR_CTST) m_sisr &= ~REG_SISR_CTST; + if (data & REG_SISR_DSRT) m_sisr &= ~REG_SISR_DSRT; + if (data & REG_SISR_DCDT) m_sisr &= ~REG_SISR_DCDT; + + LOGSETUP(" - CTS %d transitioned: %d\n", (m_sisr & REG_SISR_CTSLVL) ? 1 :0, (m_sisr & REG_SISR_CTST) ? 1 : 0); + LOGSETUP(" - DSR %d transitioned: %d\n", (m_sisr & REG_SISR_DSRLVL) ? 1 :0, (m_sisr & REG_SISR_DSRT) ? 1 : 0); + LOGSETUP(" - DCD %d transitioned: %d\n", (m_sisr & REG_SISR_DCDLVL) ? 1 :0, (m_sisr & REG_SISR_DCDT) ? 1 : 0); +} -uint8_t mpcc68561_t::get_reg_a(int reg) +uint8_t mpcc_device::do_sisr() { - return channel[0].reg_val[reg]; + uint8_t data = m_sisr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; } +void mpcc_device::do_sicr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + + // If RTS is activated the RTS output latch can only be reset by an empty FIFO. + if ( !(m_sicr & REG_SICR_RTSLVL) && + (data & REG_SICR_RTSLVL)) + { + m_out_rts_cb(ASSERT_LINE); // TODO: respect the RTSLV bit + } + + m_sicr = data; + if (m_sicr & REG_SICR_DTRLVL) + { + m_out_dtr_cb(ASSERT_LINE); + } + else + { + m_out_dtr_cb(CLEAR_LINE); + } -/*------------------------------------------------- - mpcc68561_set_reg_a --------------------------------------------------*/ + LOGSETUP(" - RTS level : %s\n", (m_sicr & REG_SICR_RTSLVL) ? "high" : "low"); + LOGSETUP(" - DTR level : %s\n", (m_sicr & REG_SICR_DTRLVL) ? "high" : "low"); + LOGSETUP(" - Echo Mode : %s\n", (m_sicr & REG_SICR_ECHO) ? "enabled" : "disabled"); + LOGSETUP(" - Test Mode : %s\n", (m_sicr & REG_SICR_TEST) ? "enabled" : "disabled"); +} -void mpcc68561_t::set_reg_a(int reg, uint8_t data) +uint8_t mpcc_device::do_sicr() { - channel[0].reg_val[reg] = data; + uint8_t data = m_sicr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; } +void mpcc_device::do_sier(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_sier = data; + LOGSETUP(" - Serial interface INT on CTS: %s\n", (m_sier & REG_SIER_CTS) ? "enabled" : "disabled"); + LOGSETUP(" - Serial interface INT on DSR: %s\n", (m_sier & REG_SIER_DSR) ? "enabled" : "disabled"); + LOGSETUP(" - Serial interface INT on DCD: %s\n", (m_sier & REG_SIER_DCD) ? "enabled" : "disabled"); +} +uint8_t mpcc_device::do_sier() +{ + uint8_t data = m_sier; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} -/*------------------------------------------------- - mpcc68561_r --------------------------------------------------*/ +void mpcc_device::do_psr1(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_psr1 = data; + LOGSETUP(" - Zero Address option: %s\n", (m_psr1 & REG_PSR1_ADRZ) ? "enabled" : "disabled" ); + LOGSETUP(" - IPARS option : %s\n", (m_psr1 & REG_PSR1_IPARS) ? "enabled" : "disabled" ); + LOGSETUP(" - Control Field Width: %s\n", (m_psr1 & REG_PSR1_CTLEX) ? "16 bit" : "8 bit" ); + LOGSETUP(" - Address Extend : %s\n", (m_psr1 & REG_PSR1_ADDEX) ? "enabled" : "disabled" ); + + update_serial(); +} -READ8_MEMBER( mpcc68561_t::reg_r) +uint8_t mpcc_device::do_psr1() { - uint8_t result = 0; + uint8_t data = m_psr1; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - offset %= 4; +void mpcc_device::do_psr2(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_psr2 = data; + LOGSETUP(" - %s data bus\n", (m_psr2 & REG_PSR2_WDBYT) ? "16 bit (not implemented)" : "8 bit" ); + LOGSETUP(" - %s stop bits\n",(m_psr2 & REG_PSR2_STP_MSK) == REG_PSR2_STP_1 ? "1" : + ( (m_psr2 & REG_PSR2_STP_MSK) == REG_PSR2_STP_1_5 ? "1.5" : + ( (m_psr2 & REG_PSR2_STP_MSK) == REG_PSR2_STP_2 ? "2" : "Unknown"))); + LOGSETUP(" - %d bit characters\n", 5 + ((m_psr2 & REG_PSR2_CHLN_MSK) >> 3)); + LOGSETUP(" - Protocol %d %s\n", m_psr2 & REG_PSR2_PSEL_MSK, (m_psr2 & REG_PSR2_PSEL_MSK) != REG_PSR2_PSEL_ASCII ? "(not implemented)" : ""); + + update_serial(); +} - switch(offset) - { - case 1: - /* Channel A (Modem Port) Control */ - if (mode == 1) - mode = 0; - else - reg = 0; +uint8_t mpcc_device::do_psr2() +{ + uint8_t data = m_psr2; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - result = getreg(); - break; +/* + * Clocks and Baud Rates + */ +void mpcc_device::do_brdr1(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_brdr1 = data; + LOGSETUP(" - Baudrate Divider 1: %02x\n", m_brdr1); - case 3: - /* Channel A (Modem Port) Data */ - return channel[0].rxData; - break; - } - return result; + update_serial(); } +uint8_t mpcc_device::do_brdr1() +{ + uint8_t data = m_brdr1; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} +void mpcc_device::do_brdr2(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_brdr2 = data; + LOGSETUP(" - Baudrate Divider 2: %02x\n", m_brdr2); -/*------------------------------------------------- - mpcc68561_w --------------------------------------------------*/ + update_serial(); +} -WRITE8_MEMBER( mpcc68561_t::reg_w ) +uint8_t mpcc_device::do_brdr2() { - Chan *pChan; - - offset &= 3; + uint8_t data = m_brdr2; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} -// printf(" mode %d data %x offset %d \n", mode, data, offset); +void mpcc_device::do_ccr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_ccr = data; + LOGSETUP(" - Prescaler: x%d\n", (m_ccr & REG_CCR_PSCDIV) ? 3 : 2); + LOGSETUP(" - TxC used as: %s\n", (m_ccr & REG_CCR_TCLO) ? "output" : "input"); + LOGSETUP(" - RxC taken from: %s source, (ASYNC mode only)\n", (m_ccr & REG_CCR_TCLO) ? "internal" : "external"); + LOGSETUP(" - External RxC divisor: x%d\n",(m_ccr & REG_CCR_CLKDIV_MSK) == REG_CCR_CLKDIV_X1 ? 1 : + ( (m_ccr & REG_CCR_CLKDIV_MSK) == REG_CCR_CLKDIV_X16 ? 16 : + ( (m_ccr & REG_CCR_CLKDIV_MSK) == REG_CCR_CLKDIV_X32 ? 32 : 64))); + + update_serial(); +} - switch(offset) - { - case 1: - /* Channel A (Modem Port) Control */ - if (mode == 0) - { - if((data & 0xf0) == 0) // not a reset command - { - mode = 1; - reg = data & 0x0f; -// putareg(data & 0xf0); - } - else if (data == 0x10) - { - pChan = &channel[0]; - // clear ext. interrupts - pChan->extIRQPending = 0; - pChan->baudIRQPending = 0; - updateirqs(); - } - } - else - { - mode = 0; - putreg(0, data); - } - break; +uint8_t mpcc_device::do_ccr() +{ + uint8_t data = m_ccr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; +} - case 3: - /* Channel A (Modem Port) Data */ - pChan = &channel[0]; +void mpcc_device::do_ecr(uint8_t data) +{ + LOG("%s -> %02x\n", FUNCNAME, data); + m_ecr = data; + LOGSETUP(" - Parity : %s\n", (m_ecr & REG_ECR_PAREN) ? "enabled" : "disabled"); + LOGSETUP(" - Parity : %s\n", (m_ecr & REG_ECR_ODDPAR) ? "odd" : "even"); + LOGSETUP(" - CRC : %s\n", (m_ecr & REG_ECR_CFCRC) ? "enabled" : "disabled"); + LOGSETUP(" - CRC Polynominal: %s\n", (m_ecr & REG_ECR_CRCSEL_MSK) == REG_ECR_CRCSEL_V41 ? "CCITT V.41 (BOP)" : + ( (m_ecr & REG_ECR_CRCSEL_MSK) == REG_ECR_CRCSEL_C16 ? "CRC-16 (BSC)" : + ( (m_ecr & REG_ECR_CRCSEL_MSK) == REG_ECR_CRCSEL_VRC ? "VRC/LRC (BSC, ASCII, non-transp)" : + "Not used"))); + + update_serial(); +} - if (pChan->txEnable) - { - pChan->txData = data; - // local loopback? - if (pChan->reg_val[14] & 0x10) - { - pChan->rxData = data; - pChan->reg_val[0] |= 0x01; // Rx character available - } - pChan->reg_val[1] |= 0x01; // All sent - pChan->reg_val[0] |= 0x04; // Tx empty - pChan->txUnderrun = 1; - pChan->txIRQPending = 1; - updateirqs(); - } - break; - } +uint8_t mpcc_device::do_ecr() +{ + uint8_t data = m_ecr; + LOG("%s <- %02x\n", FUNCNAME, data); + return data; } diff --git a/src/devices/machine/68561mpcc.h b/src/devices/machine/68561mpcc.h index ed38b7bdb01..2a3b654a50b 100644 --- a/src/devices/machine/68561mpcc.h +++ b/src/devices/machine/68561mpcc.h @@ -1,102 +1,461 @@ // license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/********************************************************************* +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + + MPCC Multi-Protocol Communications Controller emulation + +**************************************************************************** + _____ _____ + UDS* 1|* \_/ |48 IACK* + DTACK* 2| |47 LDS* + RxD 3| |46 DTC* + D10 4| |45 D9 _____ _____ + DTR* 5| |44 CS* A0 1|* \_/ |40 IACK* + DSR* 6| |43 DACK* DTACK* 2| |39 DS* + DCD* 7| |42 GND RxD* 3| |38 DTC* + D11 8| |41 D0 DTR* 4| |37 CS* + RDSR* 9| |40 D8 DSR* 5| |36 DACK* + A1 10| |39 D1 DCD* 6| |35 GND + GND 11| |38 D2 RDSR* 7| |34 D0 + A4 12| |37 D3 A1 8| |33 D1 + A2 13| R68561 |36 D4 GND 9| R68560 |32 D2 + A3 14| R68561A |35 D5 A4 10| R68560A |31 D3 + RxC 15| |34 D6 A2 11| |30 D4 + D12 16| |33 D15 A3 12| |29 D5 + TxC 17| |32 D7 RxC 13| |28 D6 + BCLK 18| |31 RESET* TxC 14| |27 D7 + EXTAL 19| |30 CTS* BCLK 15| |26 RESET* + XTAL 20| |29 Vcc EXTAL 16| |25 CTS* + D13 21| |28 D14 XTAL 17| |24 Vcc + R/W* 22| |27 DONE* R/W* 18| |23 DONE* + IRQ* 23| |26 TxD IRQ* 19| |22 TxD + RTS* 24|_____________|25 TDSR* RTS* 20|_____________|21 TDSR* + 16 bit data bus 8 bit data bus + Also in 68 pin PLCE Also in 44 pin PLCE + +***************************************************************************/ + +#ifndef MPCC68561_H +#define MPCC68561_H + +#include "emu.h" + +/* Variant ADD macros - use the right one to enable the right feature set! */ +#define MCFG_MPCC68560_ADD(_tag, _clock, _rx, _tx) \ + MCFG_DEVICE_ADD(_tag, MPCC68560, _clock) \ + MCFG_MPCC_CLOCK(_rx, _tx) + +#define MCFG_MPCC68560A_ADD(_tag, _clock, _rx, _tx) \ + MCFG_DEVICE_ADD(_tag, MPCC68560A, _clock) \ + MCFG_MPCC_CLOCK(_rx, _tx) - 68561mpcc.h +#define MCFG_MPCC68561_ADD(_tag, _clock, _rx, _tx) \ + MCFG_DEVICE_ADD(_tag, MPCC68561, _clock) \ + MCFG_MPCC_CLOCK(_rx, _tx) - Rockwell 68561 MPCC (Multi Protocol Communications Controller) +#define MCFG_MPCC68561A_ADD(_tag, _clock, _rx, _tx) \ + MCFG_DEVICE_ADD(_tag, MPCC68561A, _clock) \ + MCFG_MPCC_CLOCK(_rx, _tx) - skeleton driver +/* Generic ADD macro - Avoid using it directly, see above for correct variant instead */ +#define MCFG_MPCC_ADD(_tag, _clock, _rxa, _txa, _rxb, _txb) \ + MCFG_DEVICE_ADD(_tag, MPCC, _clock) \ + MCFG_MPCC_CLOCK(_rx, _tx) -*********************************************************************/ +/* Generic macros */ +#define MCFG_MPCC_CLOCK(_rx, _tx) \ + mpcc_device::configure_clocks(*device, _rx, _tx); -#ifndef __68561MPCC_H__ -#define __68561MPCC_H__ +/* Callbacks to be called by us for signals driven by the MPCC */ +#define MCFG_MPCC_OUT_TXD_CB(_devcb) \ + devcb = &mpcc_device::set_out_txd_callback(*device, DEVCB_##_devcb); -#define MCFG_MPCC68561_INTRQ_CALLBACK(_write) \ - devcb = &mpcc68561_t::set_intrq_wr_callback(*device, DEVCB_##_write); +#define MCFG_MPCC_OUT_DTR_CB(_devcb) \ + devcb = &mpcc_device::set_out_dtr_callback(*device, DEVCB_##_devcb); -class mpcc68561_t : public device_t +#define MCFG_MPCC_OUT_RTS_CB(_devcb) \ + devcb = &mpcc_device::set_out_rts_callback(*device, DEVCB_##_devcb); + +#define MCFG_MPCC_OUT_TRXC_CB(_devcb) \ + devcb = &mpcc_device::set_out_trxc_callback(*device, DEVCB_##_devcb); + +#define MCFG_MPCC_OUT_RTXC_CB(_devcb) \ + devcb = &mpcc_device::set_out_rtxc_callback(*device, DEVCB_##_devcb); + +#define MCFG_MPCC_OUT_INT_CB(_devcb) \ + devcb = &mpcc_device::set_out_int_callback(*device, DEVCB_##_devcb); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** +class mpcc_device : public device_t, + public device_serial_interface { public: - enum IRQType_t { - IRQ_NONE, - IRQ_A_RX, - IRQ_A_RX_SPECIAL, - IRQ_B_RX, - IRQ_B_RX_SPECIAL, - IRQ_A_TX, - IRQ_B_TX, - IRQ_A_EXT, - IRQ_B_EXT - }; + // construction/destruction + mpcc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source); + mpcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - mpcc68561_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template<class _Object> static devcb_base &set_out_txd_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_txd_cb.set_callback(object); } + template<class _Object> static devcb_base &set_out_dtr_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_dtr_cb.set_callback(object); } + template<class _Object> static devcb_base &set_out_rts_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_rts_cb.set_callback(object); } + template<class _Object> static devcb_base &set_out_rtxc_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_rtxc_cb.set_callback(object); } + template<class _Object> static devcb_base &set_out_trxc_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_trxc_cb.set_callback(object); } - template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<mpcc68561_t &>(device).intrq_cb.set_callback(object); } + template<class _Object> static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast<mpcc_device &>(device).m_out_int_cb.set_callback(object); } - uint8_t get_reg_a(int reg); - void set_reg_a(int reg, uint8_t data); + static void configure_clocks(device_t &device, int rxc, int txc) + { + mpcc_device &dev = downcast<mpcc_device &>(device); + dev.m_rxc = rxc; + dev.m_txc = txc; + } - void set_status(int status); + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER(reg_r); - DECLARE_WRITE8_MEMBER(reg_w); + // interrupt acknowledge + DECLARE_READ8_MEMBER( iack ); + + /* Callbacks to be called by others for signals driven by connected devices */ + DECLARE_WRITE_LINE_MEMBER( write_rx ); + DECLARE_WRITE_LINE_MEMBER( cts_w ); + DECLARE_WRITE_LINE_MEMBER( dsr_w ); + DECLARE_WRITE_LINE_MEMBER( dcd_w ); + DECLARE_WRITE_LINE_MEMBER( rxc_w ) {} // { m_chanA->rxc_w(state); } + DECLARE_WRITE_LINE_MEMBER( txc_w ) {} // { m_chanA->txc_w(state); } 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: - struct Chan { - bool txIRQEnable; - bool rxIRQEnable; - bool extIRQEnable; - bool baudIRQEnable; - bool txIRQPending; - bool rxIRQPending; - bool extIRQPending; - bool baudIRQPending; - bool txEnable; - bool rxEnable; - bool txUnderrun; - bool txUnderrunEnable; - bool syncHunt; - bool DCDEnable; - bool CTSEnable; - uint8_t rxData; - uint8_t txData; - - emu_timer *baudtimer; - - uint8_t reg_val[22]; - }; - - int mode; - int reg; - int status; - int IRQV; - int MasterIRQEnable; - int lastIRQStat; - IRQType_t IRQType; - - Chan channel[2]; - - devcb_write_line intrq_cb; - - void updateirqs(); - void initchannel(int ch); - void resetchannel(int ch); - void acknowledge(); - uint8_t getreg(); - void putreg(int ch, uint8_t data); -}; + // device_serial_interface overrides + virtual void tra_callback() override; + virtual void tra_complete() override; + virtual void rcv_callback() override; + virtual void rcv_complete() override; -/*************************************************************************** - MACROS -***************************************************************************/ + // serial device setup helpers + uint32_t get_brg_rate(); + uint32_t get_tx_rate(); + uint32_t get_rx_rate(); + uint32_t get_clock_div(); + uint32_t get_word_length(); + stop_bits_t get_stop_bits(); + parity_t get_parity(); + void update_serial(); + + /* + * Interrupts + */ + void check_interrupts(); + void reset_interrupts(); + void trigger_interrupt(int source); + enum + { + INT_TX_TDRA, // Tx char available + INT_TX_TFC, // Tx frame complete + INT_TX_TUNRN, // Tx underrun detected + INT_TX_TFERR, // Tx frame error detected + INT_RX_RDA, // Rx interrupt on Receiver Data Available + INT_RX_EOF, // Rx interrupt on End of frame + INT_RX_CPERR, // Rx interrupt on CRC or Parity error + INT_RX_FRERR, // Rx interrupt on Frame error + INT_RX_ROVRN, // Rx interrupt on Receiver overrun + INT_RX_RAB, // Rx interrupt on Abort/Break + INT_SR_CTS, // Serial interface interrupt on CTS asserted + INT_SR_DSR, // Serial interface interrupt on DSR asserted + INT_SR_DCD, // Serial interface interrupt on DCD asserted + }; + + enum + { + RX_INT_PRIO = 0x00, // Highest interrupt priority + TX_INT_PRIO = 0x01, + SR_INT_PRIO = 0x02 // Lowest interrupt priority + }; + + enum + { + INT_REQ = 0x01, // Interrupt requested + INT_ACK = 0x02 // Interrupt acknowledged + }; + + // Variants in the MPCC family + enum + { + TYPE_MPCC = 0x001, + TYPE_MPCC68560 = 0x002, + TYPE_MPCC68560A = 0x004, + TYPE_MPCC68561 = 0x008, + TYPE_MPCC68561A = 0x010, + }; + +#define SET_TYPE_A ( mpcc_device::TYPE_MPCC68560A | mpcc_device::TYPE_MPCC68561A ) + + // State variables + int m_variant; + int m_rxc; + int m_txc; + int m_brg_rate; + int m_rcv; + int m_rxd; + int m_tra; + int m_int_state[3]; // Three priority levels Rx, Tx and Serial interface + + // Callbacks + devcb_write_line m_out_txd_cb; + devcb_write_line m_out_dtr_cb; + devcb_write_line m_out_rts_cb; + devcb_write_line m_out_rtxc_cb; + devcb_write_line m_out_trxc_cb; + + devcb_write_line m_out_int_cb; + + /* + * Register handling + */ + // RSR - Rx Status Register + uint8_t m_rsr; + uint8_t do_rsr(); + void do_rsr(uint8_t data); + enum + { + REG_RSR_RDA = 0x80, // Rx Data available + REG_RSR_EOF = 0x40, // End of frame detected (BOP and BSC modes) + REG_RSR_RHW = 0x20, // Odd number of frame data bytes reeived in 16 bit mode. + REG_RSR_CPERR = 0x10, // CRC or parity error detected + REG_RSR_FRERR = 0x08, // Frame error detected + REG_RSR_ROVRN = 0x04, // Rx overrun detected + REG_RSR_RAB = 0x02, // Rx Abort break detected + REG_RSR_RIDLE = 0x01, // Rx idle detcted (15+ high consecutive bits accounted for) + }; + + // RCR - Rx Control Register + uint8_t m_rcr; + uint8_t do_rcr(); + void do_rcr(uint8_t data); + enum + { + REG_RCR_RDSREN = 0x40, // Rx Data Service Request Enable (DMA) + REG_RCR_DONEEN = 0x20, // DONE output enable + REG_RCR_RSYNEN = 0x10, // RSYNEN output enable + REG_RCR_STRSYN = 0x08, // STRIP SYN character (COP mode) + REG_RCR_RABTEN = 0x02, // Receiver Abort Enable (BOP mode) + REG_RCR_RRES = 0x01, // Receiver Reset command/Enable + }; + + uint8_t m_rdr; + uint8_t do_rdr(); + // TODO: investigate if 4 x 16 bit wide FIFO is needed for 16 bit mode + util::fifo<uint8_t, 8> m_rx_data_fifo; + + uint8_t m_rivnr; + + // RIER - Rx Interrupt Enable Register + uint8_t m_rier; + uint8_t do_rier(); + void do_rier(uint8_t data); + enum { + REG_RIER_RDA = 0x80, // Rx interrupt on Receiver Data Available + REG_RIER_EOF = 0x40, // Rx interrupt on End of frame + REG_RIER_CPERR = 0x10, // Rx interrupt on CRC or Parity error + REG_RIER_FRERR = 0x08, // Rx interrupt on Frame error + REG_RIER_ROVRN = 0x04, // Rx interrupt on Receiver overrun + REG_RIER_RAB = 0x02, // Rx interrupt on Abort/Break + }; + + // TSR - Tx Status Register + uint8_t m_tsr; + uint8_t do_tsr(); + void do_tsr(uint8_t data); + enum + { + REG_TSR_TDRA = 0x80, // Tx Fifo Full or not + REG_TSR_TFC = 0x40, // Tx Frame Complete + REG_TSR_TUNRN = 0x04, // Tx underrun + REG_TSR_TFERR = 0x02, // Tx Frame Error + }; + + // TCR - Tx Control Register + uint8_t m_tcr; + uint8_t do_tcr(); + void do_tcr(uint8_t data); + enum + { + REG_TCR_TEN = 0x80, // Tx enable + REG_TCR_TDSREN = 0x40, // DMA enable + REG_TCR_TICS = 0x20, // Tx Idle Char Select, 'A' variant differs + REG_TCR_THW = 0x10, // Indicates that last 16 bit word has only 8 bits, in 16 bits mode only + REG_TCR_TLAST = 0x08, // Indicates the last byte to be written in to TDR (BOP, BCS or COP) + REG_TCR_TSYN = 0x04, // SYN enable (BCS or COP) + REG_TCR_TABT = 0x02, // Abort command (BOP) + REG_TCR_TRES = 0x01, // Tx Reset command + }; + + // TDR - Tx Data Register (write only) + uint8_t m_tdr; + void do_tdr(uint8_t data); + // TODO: investigate if 4 x 16 bit wide FIFO is needed for 16 bit mode + util::fifo<uint8_t, 8> m_tx_data_fifo; + + // TIVNR - Tx Interrupt Vector Number Register + uint8_t m_tivnr; + uint8_t do_tivnr(); + void do_tivnr(uint8_t data); + + // TIER - Tx Interrupt Enable Register + uint8_t m_tier; + uint8_t do_tier(); + void do_tier(uint8_t data); + enum + { + REG_TIER_TDRA = 0x80, // TX Character available interrupt + REG_TIER_TFC = 0x40, // TX Frame complete interrupt + REG_TIER_TUNRN = 0x04, // TX Underrun interrupt + REG_TIER_TFERR = 0x02, // TX Frame error interrupt + }; + + // SISR - Serial Interface Status Register + uint8_t m_sisr; + uint8_t do_sisr(); + void do_sisr(uint8_t data); + enum + { + REG_SISR_CTST = 0x80, // Clear To Send Transition Status + REG_SISR_DSRT = 0x40, // Data Set Ready Transition Status + REG_SISR_DCDT = 0x20, // Data Carrier Detect Transition Status + REG_SISR_CTSLVL = 0x10, // Clear To Send Level + REG_SISR_DSRLVL = 0x08, // Data Set Ready Level + REG_SISR_DCDLVL = 0x04, // Data Carrier Detect Level + }; + + // SICR - Serial Interface Control Register + uint8_t m_sicr; + uint8_t do_sicr(); + void do_sicr(uint8_t data); + enum + { + REG_SICR_RTSLVL = 0x80, // RTS level + REG_SICR_DTRLVL = 0x40, // DTR level + REG_SICR_ECHO = 0x04, // Echo Mode + REG_SICR_TEST = 0x02, // Test Mode + }; + + uint8_t m_sivnr; + // SIER - Serial interface Interrupt Enable + uint8_t m_sier; + uint8_t do_sier(); + void do_sier(uint8_t data); + enum + { + REG_SIER_CTS = 0x80, + REG_SIER_DSR = 0x40, + REG_SIER_DCD = 0x20, + }; + + // PSR1 Protocol Selection Register 1 + uint8_t m_psr1; + uint8_t do_psr1(); + void do_psr1(uint8_t data); + enum + { + REG_PSR1_ADRZ = 0x08, // Zero adress option (BOP) (A models only) + REG_PSR1_IPARS = 0x04, // IPARS option (COP) + REG_PSR1_CTLEX = 0x02, // Control field width 8/16 bit (BOP) (A models only) + REG_PSR1_ADDEX = 0x01, // Address extend option (BOP) (A models only) + }; + + // PSR2 Protocol Selection Register 2 + uint8_t m_psr2; + uint8_t do_psr2(); + void do_psr2(uint8_t data); + enum + { + REG_PSR2_WDBYT = 0x80, // 8/16 bit data bus selector + REG_PSR2_STP_MSK = 0x60, // Stop bits selection field + REG_PSR2_STP_1 = 0x00, // 1 Stop bits + REG_PSR2_STP_1_5 = 0x20, // 1.5 Stop bits + REG_PSR2_STP_2 = 0x40, // 2 Stop bits + REG_PSR2_CHLN_MSK = 0x18, // char len selection field + REG_PSR2_CHLN_5 = 0x00, // 5 bit char len + REG_PSR2_CHLN_6 = 0x08, // 6 bit char len + REG_PSR2_CHLN_7 = 0x10, // 7 bit char len + REG_PSR2_CHLN_8 = 0x18, // 8 bit char len + REG_PSR2_PSEL_MSK = 0x07, // Protocol selection field + REG_PSR2_PSEL_BOPP = 0x00, // Protocol selection BOP Primary + REG_PSR2_PSEL_BOPS = 0x01, // Protocol selection BOP Secondary + REG_PSR2_PSEL_RSV = 0x02, // Protocol selection Reserved + REG_PSR2_PSEL_COP = 0x03, // Protocol selection COP + REG_PSR2_PSEL_BCSE = 0x04, // Protocol selection BCS EBCDIC + REG_PSR2_PSEL_BCSA = 0x05, // Protocol selection BCS ASCII + REG_PSR2_PSEL_ASCII = 0x06, // Protocol selection ASYNC + REG_PSR2_PSEL_ISOC = 0x07, // Protocol selection ISOC + }; + + uint8_t m_ar1; + uint8_t m_ar2; + + + // BRDR1 - Baud Rate Divisor Register 1 (Lo) + uint8_t m_brdr1; + uint8_t do_brdr1(); + void do_brdr1(uint8_t data); + + // BRDR2 - Baud Rate Divisor Register 2 (Hi) + uint8_t m_brdr2; + uint8_t do_brdr2(); + void do_brdr2(uint8_t data); + + // CCR - Clock Control Register + uint8_t m_ccr; + uint8_t do_ccr(); + void do_ccr(uint8_t data); + enum + { + REG_CCR_PSCDIV = 0x10, // Internal prescaler Divider x2 or x3 + REG_CCR_TCLO = 0x08, // TxC input/output selection + REG_CCR_RCLKIN = 0x04, // RxC from internal/external source selection + REG_CCR_CLKDIV_MSK = 0x03, // External RxC prescaler Divider + REG_CCR_CLKDIV_X1 = 0x00, // x1 - ISOC only + REG_CCR_CLKDIV_X16 = 0x01, // x16 - ASYNC only + REG_CCR_CLKDIV_X32 = 0x02, // x32 - ASYNC only + REG_CCR_CLKDIV_X64 = 0x03, // x64 - ASYNC only + }; + + // ECR - Error Control Regsiter + uint8_t m_ecr; + uint8_t do_ecr(); + void do_ecr(uint8_t data); + enum + { + REG_ECR_PAREN = 0x80, // Parity Enable + REG_ECR_ODDPAR = 0x40, // Odd/Even Parity + REG_ECR_CFCRC = 0x08, // CRC Enable + REG_ECR_CRCPRE = 0x04, // CRC Preset 0 (BSC) or 1 (BOP) + REG_ECR_CRCSEL_MSK = 0x03, // CRC Polynominal Selection Mask + REG_ECR_CRCSEL_V41 = 0x00, // CCITT V.41 (BOP) CRC Polynomial + REG_ECR_CRCSEL_C16 = 0x01, // CRC-16 (BSC) CRC Polynomial + REG_ECR_CRCSEL_VRC = 0x02, // VRC/LRC (BSC, ASCII, non-transp) CRC Polynomial + }; + +}; + +// device type definition +extern const device_type MPCC; +extern const device_type MPCC68560; +extern const device_type MPCC68560A; extern const device_type MPCC68561; +extern const device_type MPCC68561A; + +class mpcc68560_device : public mpcc_device { public : mpcc68560_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class mpcc68560A_device : public mpcc_device { public : mpcc68560A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class mpcc68561_device : public mpcc_device { public : mpcc68561_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class mpcc68561A_device : public mpcc_device { public : mpcc68561A_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -#endif /* __68561MPCC_H__ */ +#endif // MPCC68561_H diff --git a/src/devices/sound/amiga.cpp b/src/devices/machine/8364_paula.cpp index accf0509705..561ca6738fa 100644 --- a/src/devices/sound/amiga.cpp +++ b/src/devices/machine/8364_paula.cpp @@ -1,13 +1,12 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles +// license: BSD-3-Clause +// copyright-holders: Aaron Giles, Dirk Best /*************************************************************************** - Amiga audio hardware + Commodore 8364 "Paula" ***************************************************************************/ -#include "amiga.h" -#include "includes/amiga.h" +#include "8364_paula.h" //************************************************************************** @@ -22,7 +21,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type AMIGA = &device_creator<amiga_sound_device>; +const device_type PAULA_8364 = &device_creator<paula_8364_device>; //************************************************************************* @@ -30,12 +29,14 @@ const device_type AMIGA = &device_creator<amiga_sound_device>; //************************************************************************** //------------------------------------------------- -// amiga_sound_device - constructor +// paula_8364_device - constructor //------------------------------------------------- -amiga_sound_device::amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, AMIGA, "Amiga Paula", tag, owner, clock, "amiga_paula", __FILE__), +paula_8364_device::paula_8364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, PAULA_8364, "8364 Paula", tag, owner, clock, "paula_8364", __FILE__), device_sound_interface(mconfig, *this), + m_mem_r(*this), m_int_w(*this), + m_dmacon(0), m_adkcon(0), m_stream(nullptr) { } @@ -44,8 +45,12 @@ amiga_sound_device::amiga_sound_device(const machine_config &mconfig, const char // device_start - device-specific startup //------------------------------------------------- -void amiga_sound_device::device_start() +void paula_8364_device::device_start() { + // resolve callbacks + m_mem_r.resolve_safe(0); + m_int_w.resolve_safe(); + // initialize channels for (int i = 0; i < 4; i++) { @@ -53,73 +58,120 @@ void amiga_sound_device::device_start() m_channel[i].curticks = 0; m_channel[i].manualmode = false; m_channel[i].curlocation = 0; - m_channel[i].irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amiga_sound_device::signal_irq), this)); + m_channel[i].irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(paula_8364_device::signal_irq), this)); } // create the stream m_stream = machine().sound().stream_alloc(*this, 0, 4, clock() / CLOCK_DIVIDER); } +//------------------------------------------------- +// update - stream updater +//------------------------------------------------- + +void paula_8364_device::update() +{ + m_stream->update(); +} + //************************************************************************* // IMPLEMENTATION //************************************************************************** -//------------------------------------------------- -// signal_irq - irq signaling -//------------------------------------------------- - -TIMER_CALLBACK_MEMBER( amiga_sound_device::signal_irq ) +READ16_MEMBER( paula_8364_device::reg_r ) { - amiga_state *state = machine().driver_data<amiga_state>(); + switch (offset) + { + case REG_DMACONR: + return m_dmacon; - state->custom_chip_w(REG_INTREQ, INTENA_SETCLR | (0x80 << param)); -} + case REG_ADKCONR: + return m_adkcon; + } -//------------------------------------------------- -// dma_reload -//------------------------------------------------- + return 0xffff; +} -void amiga_sound_device::dma_reload(audio_channel *chan) +WRITE16_MEMBER( paula_8364_device::reg_w ) { - amiga_state *state = machine().driver_data<amiga_state>(); + if (offset >= 0xa0 && offset <= 0xdf) + m_stream->update(); - chan->curlocation = CUSTOM_REG_LONG(REG_AUD0LCH + chan->index * 8); - chan->curlength = CUSTOM_REG(REG_AUD0LEN + chan->index * 8); - chan->irq_timer->adjust(attotime::from_hz(15750), chan->index); - - LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength)); + switch (offset) + { + case REG_DMACON: + m_stream->update(); + m_dmacon = (data & 0x8000) ? (m_dmacon | (data & 0x021f)) : (m_dmacon & ~(data & 0x021f)); // only bits 15, 9 and 5 to 0 + break; + + case REG_ADKCON: + m_stream->update(); + m_adkcon = (data & 0x8000) ? (m_adkcon | (data & 0x7fff)) : (m_adkcon & ~(data & 0x7fff)); + break; + + // to be moved + case REG_AUD0LCL: m_channel[CHAN_0].loc = (m_channel[CHAN_0].loc & 0xffff0000) | ((data & 0xfffe) << 0); break; // 15-bit + case REG_AUD0LCH: m_channel[CHAN_0].loc = (m_channel[CHAN_0].loc & 0x0000ffff) | ((data & 0x001f) << 16); break; // 3-bit on ocs, 5-bit ecs + case REG_AUD1LCL: m_channel[CHAN_1].loc = (m_channel[CHAN_1].loc & 0xffff0000) | ((data & 0xfffe) << 0); break; // 15-bit + case REG_AUD1LCH: m_channel[CHAN_1].loc = (m_channel[CHAN_1].loc & 0x0000ffff) | ((data & 0x001f) << 16); break; // 3-bit on ocs, 5-bit ecs + case REG_AUD2LCL: m_channel[CHAN_2].loc = (m_channel[CHAN_2].loc & 0xffff0000) | ((data & 0xfffe) << 0); break; // 15-bit + case REG_AUD2LCH: m_channel[CHAN_2].loc = (m_channel[CHAN_2].loc & 0x0000ffff) | ((data & 0x001f) << 16); break; // 3-bit on ocs, 5-bit ecs + case REG_AUD3LCL: m_channel[CHAN_3].loc = (m_channel[CHAN_3].loc & 0xffff0000) | ((data & 0xfffe) << 0); break; // 15-bit + case REG_AUD3LCH: m_channel[CHAN_3].loc = (m_channel[CHAN_3].loc & 0x0000ffff) | ((data & 0x001f) << 16); break; // 3-bit on ocs, 5-bit ecs + + // audio data + case REG_AUD0LEN: m_channel[CHAN_0].len = data; break; + case REG_AUD0PER: m_channel[CHAN_0].per = data; break; + case REG_AUD0VOL: m_channel[CHAN_0].vol = data; break; + case REG_AUD0DAT: m_channel[CHAN_0].dat = data; m_channel[CHAN_0].manualmode = true; break; + case REG_AUD1LEN: m_channel[CHAN_1].len = data; break; + case REG_AUD1PER: m_channel[CHAN_1].per = data; break; + case REG_AUD1VOL: m_channel[CHAN_1].vol = data; break; + case REG_AUD1DAT: m_channel[CHAN_1].dat = data; m_channel[CHAN_1].manualmode = true; break; + case REG_AUD2LEN: m_channel[CHAN_2].len = data; break; + case REG_AUD2PER: m_channel[CHAN_2].per = data; break; + case REG_AUD2VOL: m_channel[CHAN_2].vol = data; break; + case REG_AUD2DAT: m_channel[CHAN_2].dat = data; m_channel[CHAN_2].manualmode = true; break; + case REG_AUD3LEN: m_channel[CHAN_3].len = data; break; + case REG_AUD3PER: m_channel[CHAN_3].per = data; break; + case REG_AUD3VOL: m_channel[CHAN_3].vol = data; break; + case REG_AUD3DAT: m_channel[CHAN_3].dat = data; m_channel[CHAN_3].manualmode = true; break; + } } //------------------------------------------------- -// data_w - manual mode data writer +// signal_irq - irq signaling //------------------------------------------------- -void amiga_sound_device::data_w(int which, uint16_t data) +TIMER_CALLBACK_MEMBER( paula_8364_device::signal_irq ) { - m_channel[which].manualmode = true; + m_int_w(param); } //------------------------------------------------- -// update - stream updater +// dma_reload //------------------------------------------------- -void amiga_sound_device::update() +void paula_8364_device::dma_reload(audio_channel *chan) { - m_stream->update(); + chan->curlocation = chan->loc; + chan->curlength = chan->len; + chan->irq_timer->adjust(attotime::from_hz(15750), chan->index); // clock() / 227 + + LOG(("dma_reload(%d): offs=%05X len=%04X\n", chan->index, chan->curlocation, chan->curlength)); } //------------------------------------------------- // sound_stream_update - handle a stream update //------------------------------------------------- -void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void paula_8364_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { - amiga_state *state = machine().driver_data<amiga_state>(); int channum, sampoffs = 0; // if all DMA off, disable all channels - if (!(CUSTOM_REG(REG_DMACON) & 0x0200)) + if (BIT(m_dmacon, 9) == 0) { m_channel[0].dma_enabled = m_channel[1].dma_enabled = @@ -138,9 +190,10 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample for (channum = 0; channum < 4; channum++) { audio_channel *chan = &m_channel[channum]; - if (!chan->dma_enabled && ((CUSTOM_REG(REG_DMACON) >> channum) & 1)) + if (!chan->dma_enabled && ((m_dmacon >> channum) & 1)) dma_reload(chan); - chan->dma_enabled = (CUSTOM_REG(REG_DMACON) >> channum) & 1; + + chan->dma_enabled = BIT(m_dmacon, channum); } // loop until done @@ -163,9 +216,9 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample nextper = nextvol = -1; for (channum = 0; channum < 4; channum++) { - int volume = (nextvol == -1) ? CUSTOM_REG(REG_AUD0VOL + channum * 8) : nextvol; - int period = (nextper == -1) ? CUSTOM_REG(REG_AUD0PER + channum * 8) : nextper; audio_channel *chan = &m_channel[channum]; + int volume = (nextvol == -1) ? chan->vol : nextvol; + int period = (nextper == -1) ? chan->per : nextper; stream_sample_t sample; int i; @@ -174,18 +227,18 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample volume *= 4; // are we modulating the period of the next channel? - if ((CUSTOM_REG(REG_ADKCON) >> channum) & 0x10) + if ((m_adkcon >> channum) & 0x10) { - nextper = CUSTOM_REG(REG_AUD0DAT + channum * 8); + nextper = chan->dat; nextvol = -1; sample = 0; } // are we modulating the volume of the next channel? - else if ((CUSTOM_REG(REG_ADKCON) >> channum) & 0x01) + else if ((m_adkcon >> channum) & 0x01) { nextper = -1; - nextvol = CUSTOM_REG(REG_AUD0DAT + channum * 8); + nextvol = chan->dat; sample = 0; } @@ -214,7 +267,8 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample chan->curlocation++; if (chan->dma_enabled && !(chan->curlocation & 1)) { - CUSTOM_REG(REG_AUD0DAT + channum * 8) = state->chip_ram_r(chan->curlocation); + chan->dat = m_mem_r(chan->curlocation); + if (chan->curlength != 0) chan->curlength--; @@ -225,9 +279,9 @@ void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample // latch the next byte of the sample if (!(chan->curlocation & 1)) - chan->latched = CUSTOM_REG(REG_AUD0DAT + channum * 8) >> 8; + chan->latched = chan->dat >> 8; else - chan->latched = CUSTOM_REG(REG_AUD0DAT + channum * 8) >> 0; + chan->latched = chan->dat >> 0; // if we're in manual mode, signal an interrupt once we latch the low byte if (!chan->dma_enabled && chan->manualmode && (chan->curlocation & 1)) diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h new file mode 100644 index 00000000000..df5bfb5832e --- /dev/null +++ b/src/devices/machine/8364_paula.h @@ -0,0 +1,172 @@ +// license: BSD-3-Clause +// copyright-holders: Aaron Giles, Dirk Best +/*************************************************************************** + + Commodore 8364 "Paula" + + Multi-purpose chip that is part of the Amiga chipset. The name "Paula" + is derived from "Ports, Audio, UART and Logic". It features 4-channel + DMA driven audio, the floppy controller, a serial receiver/transmitter, + analog inputs and contains the interrupt controller. + + ____ ____ + D8 1 |* u | 48 D9 + D7 2 | | 47 D10 + D6 3 | | 46 D11 + D5 4 | | 45 D12 + D4 5 | | 44 D13 + D3 6 | | 43 D14 + D2 7 | | 42 D15 + GND 8 | | 41 RXD + D1 9 | | 40 TXD + D0 10 | | 39 DKWE + /RES 11 | | 38 /DKWD + DMAL 12 | | 37 /DKRD + /IPL0 13 | | 36 POT1Y + /IPL1 14 | | 35 POT1X + /IPL2 15 | | 34 ANAGND + /INT2 16 | | 33 POT0Y + /INT3 17 | | 32 POT0X + /INT6 18 | | 31 AUDL + RGA8 19 | | 30 AUDR + RGA7 20 | | 29 CCKQ + RGA6 21 | | 28 CCK + RGA5 22 | | 27 VCC + RGA4 23 | | 26 RGA1 + RGA3 24 |_________| 25 RGA2 + +***************************************************************************/ + +#pragma once + +#ifndef MAME_DEVICES_MACHINE_8364_PAULA_H +#define MAME_DEVICES_MACHINE_8364_PAULA_H + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_PAULA_MEM_READ_CB(_devcb) \ + devcb = &paula_8364_device::set_mem_r_callback(*device, DEVCB_##_devcb); + +#define MCFG_PAULA_INT_CB(_devcb) \ + devcb = &paula_8364_device::set_int_w_callback(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> paula_8364_device + +class paula_8364_device : public device_t, public device_sound_interface +{ +public: + paula_8364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + ~paula_8364_device() {} + + // configuration + template<class _Object> static devcb_base &set_mem_r_callback(device_t &device, _Object object) + { return downcast<paula_8364_device &>(device).m_mem_r.set_callback(object); } + + template<class _Object> static devcb_base &set_int_w_callback(device_t &device, _Object object) + { return downcast<paula_8364_device &>(device).m_int_w.set_callback(object); } + + DECLARE_READ16_MEMBER(reg_r); + DECLARE_WRITE16_MEMBER(reg_w); + + void update(); + +protected: + // device-level overrides + virtual void device_start() 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: + enum + { + CHAN_0 = 0, + CHAN_1 = 1, + CHAN_2 = 2, + CHAN_3 = 3 + }; + + enum + { + REG_DMACONR = 0x02/2, + REG_ADKCONR = 0x10/2, + REG_DMACON = 0x96/2, + REG_INTREQ = 0x9c/2, + REG_ADKCON = 0x9e/2, + REG_AUD0LCH = 0xa0/2, // to be moved, not part of paula + REG_AUD0LCL = 0xa2/2, // to be moved, not part of paula + REG_AUD0LEN = 0xa4/2, + REG_AUD0PER = 0xa6/2, + REG_AUD0VOL = 0xa8/2, + REG_AUD0DAT = 0xaa/2, + REG_AUD1LCH = 0xb0/2, // to be moved, not part of paula + REG_AUD1LCL = 0xb2/2, // to be moved, not part of paula + REG_AUD1LEN = 0xb4/2, + REG_AUD1PER = 0xb6/2, + REG_AUD1VOL = 0xb8/2, + REG_AUD1DAT = 0xba/2, + REG_AUD2LCH = 0xc0/2, // to be moved, not part of paula + REG_AUD2LCL = 0xc2/2, // to be moved, not part of paula + REG_AUD2LEN = 0xc4/2, + REG_AUD2PER = 0xc6/2, + REG_AUD2VOL = 0xc8/2, + REG_AUD2DAT = 0xca/2, + REG_AUD3LCH = 0xd0/2, // to be moved, not part of paula + REG_AUD3LCL = 0xd2/2, // to be moved, not part of paula + REG_AUD3LEN = 0xd4/2, + REG_AUD3PER = 0xd6/2, + REG_AUD3VOL = 0xd8/2, + REG_AUD3DAT = 0xda/2 + }; + + static const int CLOCK_DIVIDER = 16; + + struct audio_channel + { + emu_timer *irq_timer; + uint32_t curlocation; + uint16_t curlength; + uint16_t curticks; + uint8_t index; + bool dma_enabled; + bool manualmode; + int8_t latched; + + // custom chip registers + uint32_t loc; // to be moved, not part of paula + uint16_t len; + uint16_t per; + uint16_t vol; + uint16_t dat; + }; + + void dma_reload(audio_channel *chan); + + // callbacks + devcb_read16 m_mem_r; + devcb_write_line m_int_w; + + // internal state + uint16_t m_dmacon; + uint16_t m_adkcon; + + audio_channel m_channel[4]; + sound_stream *m_stream; + + TIMER_CALLBACK_MEMBER( signal_irq ); +}; + +// device type definition +extern const device_type PAULA_8364; + +#endif // MAME_DEVICES_MACHINE_8364_PAULA_H diff --git a/src/devices/machine/cs4031.h b/src/devices/machine/cs4031.h index 629f3ecd6c3..9a128f67913 100644 --- a/src/devices/machine/cs4031.h +++ b/src/devices/machine/cs4031.h @@ -45,31 +45,31 @@ cs4031_device::static_set_keybctag(*device, _keybctag); #define MCFG_CS4031_IOR(_ior) \ - downcast<cs4031_device *>(device)->set_ior_callback(DEVCB_##_ior); + devcb = &downcast<cs4031_device *>(device)->set_ior_callback(DEVCB_##_ior); #define MCFG_CS4031_IOW(_iow) \ - downcast<cs4031_device *>(device)->set_iow_callback(DEVCB_##_iow); + devcb = &downcast<cs4031_device *>(device)->set_iow_callback(DEVCB_##_iow); #define MCFG_CS4031_TC(_tc) \ - downcast<cs4031_device *>(device)->set_tc_callback(DEVCB_##_tc); + devcb = &downcast<cs4031_device *>(device)->set_tc_callback(DEVCB_##_tc); #define MCFG_CS4031_HOLD(_hold) \ - downcast<cs4031_device *>(device)->set_hold_callback(DEVCB_##_hold); + devcb = &downcast<cs4031_device *>(device)->set_hold_callback(DEVCB_##_hold); #define MCFG_CS4031_NMI(_nmi) \ - downcast<cs4031_device *>(device)->set_nmi_callback(DEVCB_##_nmi); + devcb = &downcast<cs4031_device *>(device)->set_nmi_callback(DEVCB_##_nmi); #define MCFG_CS4031_INTR(_intr) \ - downcast<cs4031_device *>(device)->set_intr_callback(DEVCB_##_intr); + devcb = &downcast<cs4031_device *>(device)->set_intr_callback(DEVCB_##_intr); #define MCFG_CS4031_CPURESET(_cpureset) \ - downcast<cs4031_device *>(device)->set_cpureset_callback(DEVCB_##_cpureset); + devcb = &downcast<cs4031_device *>(device)->set_cpureset_callback(DEVCB_##_cpureset); #define MCFG_CS4031_A20M(_a20m) \ - downcast<cs4031_device *>(device)->set_a20m_callback(DEVCB_##_a20m); + devcb = &downcast<cs4031_device *>(device)->set_a20m_callback(DEVCB_##_a20m); #define MCFG_CS4031_SPKR(_spkr) \ - downcast<cs4031_device *>(device)->set_spkr_callback(DEVCB_##_spkr); + devcb = &downcast<cs4031_device *>(device)->set_spkr_callback(DEVCB_##_spkr); //************************************************************************** @@ -88,15 +88,15 @@ public: virtual machine_config_constructor device_mconfig_additions() const override; // callbacks - template<class _ior> void set_ior_callback(_ior ior) { m_read_ior.set_callback(ior); } - template<class _iow> void set_iow_callback(_iow iow) { m_write_iow.set_callback(iow); } - template<class _tc> void set_tc_callback(_tc tc) { m_write_tc.set_callback(tc); } - template<class _hold> void set_hold_callback(_hold hold) { m_write_hold.set_callback(hold); } - template<class _cpureset> void set_cpureset_callback(_cpureset cpureset) { m_write_cpureset.set_callback(cpureset); } - template<class _nmi> void set_nmi_callback(_nmi nmi) { m_write_nmi.set_callback(nmi); } - template<class _intr> void set_intr_callback(_intr intr) { m_write_intr.set_callback(intr); } - template<class _a20m> void set_a20m_callback(_a20m a20m) { m_write_a20m.set_callback(a20m); } - template<class _spkr> void set_spkr_callback(_spkr spkr) { m_write_spkr.set_callback(spkr); } + template<class _ior> devcb_base &set_ior_callback(_ior ior) { return m_read_ior.set_callback(ior); } + template<class _iow> devcb_base &set_iow_callback(_iow iow) { return m_write_iow.set_callback(iow); } + template<class _tc> devcb_base &set_tc_callback(_tc tc) { return m_write_tc.set_callback(tc); } + template<class _hold> devcb_base &set_hold_callback(_hold hold) { return m_write_hold.set_callback(hold); } + template<class _cpureset> devcb_base &set_cpureset_callback(_cpureset cpureset) { return m_write_cpureset.set_callback(cpureset); } + template<class _nmi> devcb_base &set_nmi_callback(_nmi nmi) { return m_write_nmi.set_callback(nmi); } + template<class _intr> devcb_base &set_intr_callback(_intr intr) { return m_write_intr.set_callback(intr); } + template<class _a20m> devcb_base &set_a20m_callback(_a20m a20m) { return m_write_a20m.set_callback(a20m); } + template<class _spkr> devcb_base &set_spkr_callback(_spkr spkr) { return m_write_spkr.set_callback(spkr); } // not really public DECLARE_READ8_MEMBER( dma_read_byte ); diff --git a/src/devices/machine/fdc_pll.cpp b/src/devices/machine/fdc_pll.cpp index cf616468a12..ef93eda920d 100644 --- a/src/devices/machine/fdc_pll.cpp +++ b/src/devices/machine/fdc_pll.cpp @@ -23,11 +23,16 @@ void fdc_pll_t::set_clock(const attotime &_period) void fdc_pll_t::reset(const attotime &when) { + read_reset(when); + write_position = 0; + write_start_time = attotime::never; +} + +void fdc_pll_t::read_reset(const attotime &when) +{ ctime = when; phase_adjust = attotime::zero; freq_hist = 0; - write_position = 0; - write_start_time = attotime::never; } void fdc_pll_t::start_writing(const attotime &tm) @@ -55,8 +60,13 @@ void fdc_pll_t::commit(floppy_image_device *floppy, const attotime &tm) int fdc_pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit) { - attotime edge = floppy ? floppy->get_next_transition(ctime) : attotime::never; + attotime edge = floppy ? floppy->get_next_transition(ctime) : attotime::never; + return feed_read_data(tm , edge , limit); +} + +int fdc_pll_t::feed_read_data(attotime &tm, const attotime& edge, const attotime &limit) +{ attotime next = ctime + period + phase_adjust; #if 0 @@ -70,7 +80,7 @@ int fdc_pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const att ctime = next; tm = next; - if(edge.is_never() || edge >= next) { + if(edge.is_never() || edge > next) { // No transition in the window means 0 and pll in free run mode phase_adjust = attotime::zero; return 0; diff --git a/src/devices/machine/fdc_pll.h b/src/devices/machine/fdc_pll.h index 31eaae07d1b..16de4c0458f 100644 --- a/src/devices/machine/fdc_pll.h +++ b/src/devices/machine/fdc_pll.h @@ -21,7 +21,9 @@ public: void set_clock(const attotime &period); void reset(const attotime &when); + void read_reset(const attotime &when); int get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit); + int feed_read_data(attotime &tm, const attotime& edge, const attotime &limit); bool write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit); void start_writing(const attotime &tm); void commit(floppy_image_device *floppy, const attotime &tm); diff --git a/src/devices/machine/gen_latch.h b/src/devices/machine/gen_latch.h index 210dbc967fd..a61a8e141ef 100644 --- a/src/devices/machine/gen_latch.h +++ b/src/devices/machine/gen_latch.h @@ -63,7 +63,7 @@ protected: private: bool m_latch_written; - devcb_write_line m_data_pending_cb; + devcb_write_line m_data_pending_cb; }; diff --git a/src/devices/machine/i8251.cpp b/src/devices/machine/i8251.cpp index 2fc9ef798b6..2c33c6decb3 100644 --- a/src/devices/machine/i8251.cpp +++ b/src/devices/machine/i8251.cpp @@ -24,7 +24,7 @@ #define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG(...) do { if (VERBOSE) logerror(__VA_ARGS__); } while (0) //************************************************************************** // DEVICE DEFINITIONS @@ -33,12 +33,26 @@ const device_type I8251 = &device_creator<i8251_device>; const device_type V53_SCU = &device_creator<v53_scu_device>; +template class device_finder<i8251_device, false>; +template class device_finder<i8251_device, true>; +template class device_finder<v53_scu_device, false>; +template class device_finder<v53_scu_device, true>; + + //------------------------------------------------- // i8251_device - constructor //------------------------------------------------- -i8251_device::i8251_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname) - : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), +i8251_device::i8251_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) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_serial_interface(mconfig, *this), m_txd_handler(*this), m_dtr_handler(*this), @@ -56,25 +70,12 @@ i8251_device::i8251_device(const machine_config &mconfig, device_type type, cons } i8251_device::i8251_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, I8251, "8251 USART", tag, owner, clock, "i8251", __FILE__), - device_serial_interface(mconfig, *this), - m_txd_handler(*this), - m_dtr_handler(*this), - m_rts_handler(*this), - m_rxrdy_handler(*this), - m_txrdy_handler(*this), - m_txempty_handler(*this), - m_syndet_handler(*this), - m_cts(1), - m_dsr(1), - m_rxd(0), - m_rxc(0), - m_txc(0) + : i8251_device(mconfig, I8251, "8251 USART", tag, owner, clock, "i8251", __FILE__) { } v53_scu_device::v53_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : i8251_device(mconfig, V53_SCU, "V53 SCU", tag, owner, clock, "v53_scu") + : i8251_device(mconfig, V53_SCU, "V53 SCU", tag, owner, clock, "v53_scu", __FILE__) { } @@ -121,15 +122,11 @@ void i8251_device::device_start() void i8251_device::update_rx_ready() { - int state; - - state = m_status & I8251_STATUS_RX_READY; + int state = m_status & I8251_STATUS_RX_READY; - /* masked? */ - if ((m_command & (1<<2))==0) - { + // masked? + if (!BIT(m_command, 2)) state = 0; - } m_rxrdy_handler(state != 0); } @@ -142,19 +139,22 @@ void i8251_device::update_rx_ready() void i8251_device::receive_clock() { - m_rxc_count++; - - if (m_rxc_count == m_br_factor) - m_rxc_count = 0; - else - return; - /* receive enable? */ - if (m_command & (1<<2)) + if (BIT(m_command, 2)) { + const bool sync = is_receive_register_synchronized(); + if (sync) + { + --m_rxc_count; + if (m_rxc_count) + return; + } + //logerror("I8251\n"); /* get bit received from other side and update receive register */ receive_register_update_bit(m_rxd); + if (is_receive_register_synchronized()) + m_rxc_count = sync ? m_br_factor : (3 * m_br_factor / 2); if (is_receive_register_full()) { @@ -167,25 +167,24 @@ void i8251_device::receive_clock() /*------------------------------------------------- is_tx_enabled -------------------------------------------------*/ -bool i8251_device::is_tx_enabled(void) const +bool i8251_device::is_tx_enabled() const { - return BIT(m_command , 0) != 0 && m_cts == 0; + return BIT(m_command , 0) && !m_cts; } /*------------------------------------------------- check_for_tx_start -------------------------------------------------*/ -void i8251_device::check_for_tx_start(void) +void i8251_device::check_for_tx_start() { - if (is_tx_enabled() && (m_status & (I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY)) == I8251_STATUS_TX_EMPTY) { - start_tx(); - } + if (is_tx_enabled() && (m_status & (I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY)) == I8251_STATUS_TX_EMPTY) + start_tx(); } /*------------------------------------------------- start_tx -------------------------------------------------*/ -void i8251_device::start_tx(void) +void i8251_device::start_tx() { transmit_register_setup(m_tx_data); m_status &= ~I8251_STATUS_TX_EMPTY; @@ -199,23 +198,25 @@ void i8251_device::start_tx(void) void i8251_device::transmit_clock() { m_txc_count++; - - if (m_txc_count == m_br_factor) - m_txc_count = 0; - else + if (m_txc_count != m_br_factor) return; - if (is_transmit_register_empty()) { - if ((m_status & I8251_STATUS_TX_READY) == 0 && (is_tx_enabled() || (m_flags & I8251_DELAYED_TX_EN) != 0)) { + m_txc_count = 0; + + if (is_transmit_register_empty()) + { + if ((m_status & I8251_STATUS_TX_READY) == 0 && (is_tx_enabled() || (m_flags & I8251_DELAYED_TX_EN) != 0)) start_tx(); - } else { + else m_status |= I8251_STATUS_TX_EMPTY; - } + update_tx_ready(); update_tx_empty(); } + /* if diserial has bits to send, make them so */ - if (!is_transmit_register_empty()) { + if (!is_transmit_register_empty()) + { uint8_t data = transmit_register_get_data_bit(); m_txd_handler(data); } @@ -223,7 +224,7 @@ void i8251_device::transmit_clock() #if 0 /* hunt mode? */ /* after each bit has been shifted in, it is compared against the current sync byte */ - if (m_command & (1<<7)) + if (BIT(m_command, 7)) { /* data matches sync byte? */ if (m_data == m_sync_bytes[m_sync_byte_offset]) @@ -236,7 +237,7 @@ void i8251_device::transmit_clock() if (m_sync_byte_offset == m_sync_byte_count) { /* ent hunt mode */ - m_command &=~(1<<7); + m_command &= ~(1<<7); } } else @@ -295,7 +296,7 @@ void i8251_device::update_tx_empty() void i8251_device::device_reset() { - LOG(("I8251: Reset\n")); + LOG("I8251: Reset\n"); /* what is the default setup when the 8251 has been reset??? */ @@ -342,52 +343,34 @@ void i8251_device::device_reset() WRITE8_MEMBER(i8251_device::command_w) { /* command */ - LOG(("I8251: Command byte\n")); + LOG("I8251: Command byte\n"); m_command = data; - LOG(("Command byte: %02x\n", data)); + LOG("Command byte: %02x\n", data); - if (data & (1<<7)) - { - LOG(("hunt mode\n")); - } + if (BIT(data, 7)) + LOG("hunt mode\n"); - if (data & (1<<5)) - { - LOG(("/rts set to 0\n")); - } + if (BIT(data, 5)) + LOG("/rts set to 0\n"); else - { - LOG(("/rts set to 1\n")); - } + LOG("/rts set to 1\n"); - if (data & (1<<2)) - { - LOG(("receive enable\n")); - } + if (BIT(data, 2)) + LOG("receive enable\n"); else - { - LOG(("receive disable\n")); - } + LOG("receive disable\n"); - if (data & (1<<1)) - { - LOG(("/dtr set to 0\n")); - } + if (BIT(data, 1)) + LOG("/dtr set to 0\n"); else - { - LOG(("/dtr set to 1\n")); - } + LOG("/dtr set to 1\n"); - if (data & (1<<0)) - { - LOG(("transmit enable\n")); - } + if (BIT(data, 0)) + LOG("transmit enable\n"); else - { - LOG(("transmit disable\n")); - } + LOG("transmit disable\n"); /* bit 7: @@ -419,12 +402,10 @@ WRITE8_MEMBER(i8251_device::command_w) m_rts_handler(!BIT(data, 5)); m_dtr_handler(!BIT(data, 1)); - if (data & (1<<4)) - { + if (BIT(data, 4)) m_status &= ~(I8251_STATUS_PARITY_ERROR | I8251_STATUS_OVERRUN_ERROR | I8251_STATUS_FRAMING_ERROR); - } - if (data & (1<<6)) + if (BIT(data, 6)) { // datasheet says "returns to mode format", not // completely resets the chip. behavior of DEC Rainbow @@ -432,15 +413,15 @@ WRITE8_MEMBER(i8251_device::command_w) m_flags |= I8251_EXPECTING_MODE; } - check_for_tx_start(); + check_for_tx_start(); update_rx_ready(); update_tx_ready(); - update_tx_empty(); + update_tx_empty(); } WRITE8_MEMBER(i8251_device::mode_w) { - LOG(("I8251: Mode byte\n")); + LOG("I8251: Mode byte = %X\n", data); m_mode_byte = data; @@ -472,60 +453,56 @@ WRITE8_MEMBER(i8251_device::mode_w) 3 = x64 */ - LOG(("I8251: Asynchronous operation\n")); + LOG("I8251: Asynchronous operation\n"); - LOG(("Character length: %d\n", (((data >> 2) & 0x03) + 5))); + const int data_bits_count = ((data >> 2) & 0x03) + 5; + LOG("Character length: %d\n", data_bits_count); parity_t parity; - - if (data & (1 << 4)) + if (BIT(data, 4)) { - LOG(("enable parity checking\n")); - - if (data & (1 << 5)) + if (BIT(data, 5)) { - LOG(("even parity\n")); + LOG("enable parity checking (even parity)\n"); parity = PARITY_EVEN; } else { - LOG(("odd parity\n")); + LOG("enable parity checking (odd parity)\n"); parity = PARITY_ODD; } } else { - LOG(("parity check disabled\n")); + LOG("parity check disabled\n"); parity = PARITY_NONE; } stop_bits_t stop_bits; - switch ((data >> 6) & 0x03) { case 0: default: stop_bits = STOP_BITS_0; - LOG(("stop bit: inhibit\n")); + LOG("stop bit: inhibit\n"); break; case 1: stop_bits = STOP_BITS_1; - LOG(("stop bit: 1 bit\n")); + LOG("stop bit: 1 bit\n"); break; case 2: stop_bits = STOP_BITS_1_5; - LOG(("stop bit: 1.5 bits\n")); + LOG("stop bit: 1.5 bits\n"); break; case 3: stop_bits = STOP_BITS_2; - LOG(("stop bit: 2 bits\n")); + LOG("stop bit: 2 bits\n"); break; } - int data_bits_count = ((data >> 2) & 0x03) + 5; set_data_frame(1, data_bits_count, parity, stop_bits); receive_register_reset(); @@ -537,13 +514,13 @@ WRITE8_MEMBER(i8251_device::mode_w) case 3: m_br_factor = 64; break; } - m_rxc_count = m_txc_count = 0; + m_txc_count = 0; #if 0 /* data bits */ m_receive_char_length = (((data >> 2) & 0x03) + 5); - if (data & (1 << 4)) + if (BIT(data, 4)) { /* parity */ m_receive_char_length++; @@ -580,7 +557,7 @@ WRITE8_MEMBER(i8251_device::mode_w) 3 = 8 bits bit 1,0 = 0 */ - LOG(("I8251: Synchronous operation\n")); + LOG("I8251: Synchronous operation\n"); /* setup for sync byte(s) */ m_flags |= I8251_EXPECTING_SYNC_BYTE; @@ -603,9 +580,9 @@ WRITE8_MEMBER(i8251_device::control_w) { if (m_flags & I8251_EXPECTING_SYNC_BYTE) { - LOG(("I8251: Sync byte\n")); + LOG("I8251: Sync byte\n"); - LOG(("Sync byte: %02x\n", data)); + LOG("Sync byte: %02x\n", data); /* store sync byte written */ m_sync_bytes[m_sync_byte_offset] = data; m_sync_byte_offset++; @@ -639,7 +616,7 @@ READ8_MEMBER(i8251_device::status_r) { uint8_t status = (m_dsr << 7) | m_status; - LOG(("status: %02x\n", status)); + LOG("status: %02x\n", status); return status; } @@ -653,7 +630,7 @@ WRITE8_MEMBER(i8251_device::data_w) { m_tx_data = data; - LOG(("data_w %02x\n" , data)); + LOG("data_w %02x\n" , data); /* writing clears */ m_status &=~I8251_STATUS_TX_READY; @@ -687,9 +664,8 @@ void i8251_device::receive_character(uint8_t ch) /* char has not been read and another has arrived! */ if (m_status & I8251_STATUS_RX_READY) - { m_status |= I8251_STATUS_OVERRUN_ERROR; - } + m_status |= I8251_STATUS_RX_READY; update_rx_ready(); @@ -703,7 +679,7 @@ void i8251_device::receive_character(uint8_t ch) READ8_MEMBER(i8251_device::data_r) { - LOG(("read data: %02x, STATUS=%02x\n",m_rx_data,m_status)); + LOG("read data: %02x, STATUS=%02x\n",m_rx_data,m_status); /* reading clears */ m_status &= ~I8251_STATUS_RX_READY; @@ -728,9 +704,9 @@ WRITE_LINE_MEMBER(i8251_device::write_cts) { m_cts = state; - check_for_tx_start(); - update_tx_ready(); - update_tx_empty(); + check_for_tx_start(); + update_tx_ready(); + update_tx_empty(); } WRITE_LINE_MEMBER(i8251_device::write_dsr) diff --git a/src/devices/machine/i8251.h b/src/devices/machine/i8251.h index a556851beb7..82659caed11 100644 --- a/src/devices/machine/i8251.h +++ b/src/devices/machine/i8251.h @@ -8,8 +8,8 @@ *********************************************************************/ -#ifndef __I8251_H__ -#define __I8251_H__ +#ifndef MAME_DEVICES_MACHINE_I8251_H +#define MAME_DEVICES_MACHINE_I8251_H //************************************************************************** @@ -42,7 +42,6 @@ class i8251_device : public device_t, { public: // construction/destruction - i8251_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname); i8251_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration helpers @@ -82,6 +81,16 @@ public: }; protected: + i8251_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); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -92,9 +101,9 @@ protected: void update_tx_empty(); void transmit_clock(); void receive_clock(); - bool is_tx_enabled(void) const; - void check_for_tx_start(void); - void start_tx(void); + bool is_tx_enabled() const; + void check_for_tx_start(); + void start_tx(); enum @@ -155,5 +164,10 @@ public: extern const device_type I8251; extern const device_type V53_SCU; +extern template class device_finder<i8251_device, false>; +extern template class device_finder<i8251_device, true>; +extern template class device_finder<v53_scu_device, false>; +extern template class device_finder<v53_scu_device, true>; + -#endif /* __I8251_H__ */ +#endif // MAME_DEVICES_MACHINE_I8251_H diff --git a/src/devices/machine/ldv1000.h b/src/devices/machine/ldv1000.h index ea543159a33..a8cadf1f9a8 100644 --- a/src/devices/machine/ldv1000.h +++ b/src/devices/machine/ldv1000.h @@ -27,7 +27,7 @@ MCFG_DEVICE_ADD(_tag, PIONEER_LDV1000, 0) #define MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(_cb) \ - downcast<pioneer_ldv1000_device *>(device)->set_command_strobe_callback(DEVCB_##_cb); + devcb = &downcast<pioneer_ldv1000_device *>(device)->set_command_strobe_callback(DEVCB_##_cb); @@ -53,7 +53,7 @@ public: // construction/destruction pioneer_ldv1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _cmd_strobe_cb> void set_command_strobe_callback(_cmd_strobe_cb latch) { m_command_strobe_cb.set_callback(latch); } + template<class _cmd_strobe_cb> devcb_base &set_command_strobe_callback(_cmd_strobe_cb latch) { return m_command_strobe_cb.set_callback(latch); } // input and output void data_w(uint8_t data); diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp index 2f79b82da1b..7428929ab3c 100644 --- a/src/devices/machine/mc68681.cpp +++ b/src/devices/machine/mc68681.cpp @@ -1,7 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Mariusz Wojcieszek, R. Belmont /* - 2681 DUART + 2681 DUART 68681 DUART 28C94 QUART @@ -52,8 +52,8 @@ static const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, #define CHANA_TAG "cha" #define CHANB_TAG "chb" -#define CHANC_TAG "chc" -#define CHAND_TAG "chd" +#define CHANC_TAG "chc" +#define CHAND_TAG "chd" // device type definition const device_type MC68681 = &device_creator<mc68681_device>; @@ -357,12 +357,12 @@ READ8_MEMBER( sc28c94_device::read ) { uint8_t r = 0; offset &= 0x1f; - + if (offset < 0x10) { return mc68681_base_device::read(space, offset, mem_mask); } - + switch (offset) { case 0x10: /* MR1A/MR2C */ @@ -370,14 +370,14 @@ READ8_MEMBER( sc28c94_device::read ) case 0x13: /* Rx Holding Register C */ r = m_chanC->read_chan_reg(offset & 3); break; - + case 0x18: /* MR1D/MR2D */ case 0x19: /* SRD */ case 0x1b: /* RHRD */ r = m_chanD->read_chan_reg(offset & 3); break; } - + return r; } @@ -488,12 +488,12 @@ READ8_MEMBER( mc68681_base_device::read ) WRITE8_MEMBER( sc28c94_device::write ) { offset &= 0x1f; - + if (offset < 0x10) { mc68681_base_device::write(space, offset, data, mem_mask); } - + switch(offset) { case 0x10: /* MRC */ @@ -502,7 +502,7 @@ WRITE8_MEMBER( sc28c94_device::write ) case 0x13: /* THRC */ m_chanC->write_chan_reg(offset&3, data); break; - + case 0x18: /* MRC */ case 0x19: /* CSRC */ case 0x1a: /* CRC */ @@ -882,7 +882,7 @@ void mc68681_channel::tra_callback() if ((MR2&0xC0) != 0x80) { int bit = transmit_register_get_data_bit(); - //printf("%s ch %d transmit %d\n", tag(), m_ch, bit); + //printf("%s ch %d transmit %d\n", tag(), m_ch, bit); if (m_ch == 0) { m_uart->write_a_tx(bit); @@ -1254,7 +1254,7 @@ void mc68681_channel::write_TX(uint8_t data) printf("Write %02x to TX when TX not ready!\n", data); }*/ - //printf("%s ch %d Tx %02x\n", tag(), m_ch, data); + //printf("%s ch %d Tx %02x\n", tag(), m_ch, data); tx_ready = 0; SR &= ~STATUS_TRANSMITTER_READY; diff --git a/src/devices/machine/mc68681.h b/src/devices/machine/mc68681.h index b502a33db12..208a6b9f032 100644 --- a/src/devices/machine/mc68681.h +++ b/src/devices/machine/mc68681.h @@ -32,7 +32,7 @@ // SC28C94 specific callbacks #define MCFG_SC28C94_ADD(_tag, _clock) \ MCFG_DEVICE_ADD(_tag, SC28C94, _clock) - + #define MCFG_SC28C94_C_TX_CALLBACK(_cb) \ devcb = &sc28c94_device::set_c_tx_cb(*device, DEVCB_##_cb); @@ -182,9 +182,9 @@ private: void set_ISR_bits(int mask); void update_interrupts(); - int get_ch(mc68681_channel *ch) - { - if (ch == m_chanA) + int get_ch(mc68681_channel *ch) + { + if (ch == m_chanA) { return 0; } @@ -196,10 +196,10 @@ private: { return 2; } - + return 3; } - + mc68681_channel *get_channel(int chan); }; @@ -213,7 +213,7 @@ class sc28c94_device : public mc68681_base_device { public: sc28c94_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - + template<class _Object> static devcb_base &set_c_tx_cb(device_t &device, _Object object) { return downcast<mc68681_base_device &>(device).write_c_tx.set_callback(object); } template<class _Object> static devcb_base &set_d_tx_cb(device_t &device, _Object object) { return downcast<mc68681_base_device &>(device).write_d_tx.set_callback(object); } @@ -222,10 +222,10 @@ public: virtual DECLARE_READ8_MEMBER(read) override; virtual DECLARE_WRITE8_MEMBER(write) override; - + protected: virtual machine_config_constructor device_mconfig_additions() const override; - + private: }; diff --git a/src/devices/machine/mpu401.h b/src/devices/machine/mpu401.h index cf98056cc81..3717477a43c 100644 --- a/src/devices/machine/mpu401.h +++ b/src/devices/machine/mpu401.h @@ -13,7 +13,7 @@ MCFG_IRQ_FUNC(_irqf) #define MCFG_IRQ_FUNC(_irqf) \ - downcast<mpu401_device *>(device)->set_irqf(DEVCB_##_irqf); + devcb = &downcast<mpu401_device *>(device)->set_irqf(DEVCB_##_irqf); //************************************************************************** // TYPE DEFINITIONS @@ -30,9 +30,9 @@ public: required_device<m6801_cpu_device> m_ourcpu; - template<class _write> void set_irqf(_write wr) + template<class _write> devcb_base &set_irqf(_write wr) { - write_irq.set_callback(wr); + return write_irq.set_callback(wr); } devcb_write_line write_irq; diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 89f4cd017ae..19248d00dc5 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -29,7 +29,6 @@ const device_type NETLIST_SOUND = &device_creator<netlist_mame_sound_device_t>; const device_type NETLIST_ANALOG_INPUT = &device_creator<netlist_mame_analog_input_t>; const device_type NETLIST_INT_INPUT = &device_creator<netlist_mame_int_input_t>; -const device_type NETLIST_ROM_REGION = &device_creator<netlist_mame_rom_t>; const device_type NETLIST_RAM_POINTER = &device_creator<netlist_ram_pointer_t>; const device_type NETLIST_LOGIC_INPUT = &device_creator<netlist_mame_logic_input_t>; const device_type NETLIST_STREAM_INPUT = &device_creator<netlist_mame_stream_input_t>; @@ -39,6 +38,391 @@ const device_type NETLIST_ANALOG_OUTPUT = &device_creator<netlist_mame_analog_ou const device_type NETLIST_STREAM_OUTPUT = &device_creator<netlist_mame_stream_output_t>; // ---------------------------------------------------------------------------------------- +// Special netlist extension devices .... +// ---------------------------------------------------------------------------------------- + +class netlist_mame_device_t; + +class netlist_mame_t : public netlist::netlist_t +{ +public: + + netlist_mame_t(netlist_mame_device_t &parent, const pstring &aname) + : netlist::netlist_t(aname), + m_parent(parent) + {} + virtual ~netlist_mame_t() { }; + + inline running_machine &machine(); + + netlist_mame_device_t &parent() { return m_parent; } + +protected: + + void vlog(const plib::plog_level &l, const pstring &ls) const override; + +private: + netlist_mame_device_t &m_parent; +}; + + +// ---------------------------------------------------------------------------------------- +// analog_callback +// ---------------------------------------------------------------------------------------- + +class NETLIB_NAME(analog_callback) : public netlist::device_t +{ +public: + NETLIB_NAME(analog_callback)(netlist::netlist_t &anetlist, const pstring &name) + : device_t(anetlist, name) + , m_in(*this, "IN") + , m_cpu_device(nullptr) + , m_last(*this, "m_last", 0) + { + m_cpu_device = downcast<netlist_mame_cpu_device_t *>(&downcast<netlist_mame_t &>(netlist()).parent()); + } + + ATTR_COLD void reset() override + { + m_last = 0.0; + } + + ATTR_COLD void register_callback(netlist_analog_output_delegate callback) + { + m_callback = callback; + } + + NETLIB_UPDATEI() + { + nl_double cur = m_in(); + + // FIXME: make this a parameter + // avoid calls due to noise + if (std::fabs(cur - m_last) > 1e-6) + { + m_cpu_device->update_time_x(); + m_callback(cur, m_cpu_device->local_time()); + m_cpu_device->check_mame_abort_slice(); + m_last = cur; + } + } + +private: + netlist::analog_input_t m_in; + netlist_analog_output_delegate m_callback; + netlist_mame_cpu_device_t *m_cpu_device; + netlist::state_var<nl_double> m_last; +}; + +// ---------------------------------------------------------------------------------------- +// logic_callback +// ---------------------------------------------------------------------------------------- + +class NETLIB_NAME(logic_callback) : public netlist::device_t +{ +public: + NETLIB_NAME(logic_callback)(netlist::netlist_t &anetlist, const pstring &name) + : device_t(anetlist, name) + , m_in(*this, "IN") + , m_cpu_device(nullptr) + , m_last(*this, "m_last", 0) + { + m_cpu_device = downcast<netlist_mame_cpu_device_t *>(&downcast<netlist_mame_t &>(netlist()).parent()); + } + + ATTR_COLD void reset() override + { + m_last = 0; + } + + ATTR_COLD void register_callback(netlist_logic_output_delegate callback) + { + m_callback = callback; + } + + NETLIB_UPDATEI() + { + netlist_sig_t cur = m_in(); + + // FIXME: make this a parameter + // avoid calls due to noise + if (cur != m_last) + { + m_cpu_device->update_time_x(); + m_callback(cur, m_cpu_device->local_time()); + m_cpu_device->check_mame_abort_slice(); + m_last = cur; + } + } + +private: + netlist::logic_input_t m_in; + netlist_logic_output_delegate m_callback; + netlist_mame_cpu_device_t *m_cpu_device; + netlist::state_var<netlist_sig_t> m_last; +}; + +// ---------------------------------------------------------------------------------------- +// sound_out +// ---------------------------------------------------------------------------------------- + +class NETLIB_NAME(sound_out) : public netlist::device_t +{ +public: + NETLIB_NAME(sound_out)(netlist::netlist_t &anetlist, const pstring &name) + : netlist::device_t(anetlist, name) + , m_channel(*this, "CHAN", 0) + , m_mult(*this, "MULT", 1000.0) + , m_offset(*this, "OFFSET", 0.0) + , m_sample(netlist::netlist_time::from_hz(1)) //sufficiently big enough + , m_in(*this, "IN") + , m_last_buffer(*this, "m_last_buffer", netlist::netlist_time::zero()) + { + } + + static const int BUFSIZE = 2048; + + ATTR_COLD void reset() override + { + m_cur = 0.0; + m_last_pos = 0; + m_last_buffer = netlist::netlist_time::zero(); + } + + ATTR_HOT void sound_update(const netlist::netlist_time &upto) + { + int pos = (upto - m_last_buffer) / m_sample; + if (pos >= BUFSIZE) + netlist().log().fatal("sound {1}: exceeded BUFSIZE\n", name().c_str()); + while (m_last_pos < pos ) + { + m_buffer[m_last_pos++] = (stream_sample_t) m_cur; + } + } + + NETLIB_UPDATEI() + { + nl_double val = m_in() * m_mult() + m_offset(); + sound_update(netlist().time()); + /* ignore spikes */ + if (std::abs(val) < 32767.0) + m_cur = val; + else if (val > 0.0) + m_cur = 32767.0; + else + m_cur = -32767.0; + + } + +public: + ATTR_HOT void buffer_reset(const netlist::netlist_time &upto) + { + m_last_pos = 0; + m_last_buffer = upto; + m_cur = 0.0; + } + + netlist::param_int_t m_channel; + netlist::param_double_t m_mult; + netlist::param_double_t m_offset; + stream_sample_t *m_buffer; + netlist::netlist_time m_sample; + +private: + netlist::analog_input_t m_in; + double m_cur; + int m_last_pos; + netlist::state_var<netlist::netlist_time> m_last_buffer; +}; + +// ---------------------------------------------------------------------------------------- +// sound_in +// ---------------------------------------------------------------------------------------- + +class NETLIB_NAME(sound_in) : public netlist::device_t +{ +public: + NETLIB_NAME(sound_in)(netlist::netlist_t &anetlist, const pstring &name) + : netlist::device_t(anetlist, name) + , m_feedback(*this, "FB") // clock part + , m_Q(*this, "Q") + { + connect(m_feedback, m_Q); + m_inc = netlist::netlist_time::from_nsec(1); + + + for (int i = 0; i < MAX_INPUT_CHANNELS; i++) + { + m_param_name[i] = std::make_unique<netlist::param_str_t>(*this, plib::pfmt("CHAN{1}")(i), ""); + m_param_mult[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("MULT{1}")(i), 1.0); + m_param_offset[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("OFFSET{1}")(i), 0.0); + } + m_num_channel = 0; + } + + static const int MAX_INPUT_CHANNELS = 10; + + ATTR_COLD void reset() override + { + m_pos = 0; + for (auto & elem : m_buffer) + elem = nullptr; + } + + ATTR_COLD int resolve() + { + m_pos = 0; + for (int i = 0; i < MAX_INPUT_CHANNELS; i++) + { + if ((*m_param_name[i])() != pstring("")) + { + if (i != m_num_channel) + netlist().log().fatal("sound input numbering has to be sequential!"); + m_num_channel++; + m_param[i] = dynamic_cast<netlist::param_double_t *>(setup().find_param((*m_param_name[i])(), true)); + } + } + return m_num_channel; + } + + NETLIB_UPDATEI() + { + for (int i=0; i<m_num_channel; i++) + { + if (m_buffer[i] == nullptr) + break; // stop, called outside of stream_update + const nl_double v = m_buffer[i][m_pos]; + m_param[i]->setTo(v * (*m_param_mult[i])() + (*m_param_offset[i])()); + } + m_pos++; + m_Q.push(!m_Q.net().new_Q(), m_inc ); + } + +public: + ATTR_HOT void buffer_reset() + { + m_pos = 0; + } + + std::unique_ptr<netlist::param_str_t> m_param_name[MAX_INPUT_CHANNELS]; + netlist::param_double_t *m_param[MAX_INPUT_CHANNELS]; + stream_sample_t *m_buffer[MAX_INPUT_CHANNELS]; + std::unique_ptr<netlist::param_double_t> m_param_mult[MAX_INPUT_CHANNELS]; + std::unique_ptr<netlist::param_double_t> m_param_offset[MAX_INPUT_CHANNELS]; + netlist::netlist_time m_inc; + +private: + netlist::logic_input_t m_feedback; + netlist::logic_output_t m_Q; + + int m_pos; + int m_num_channel; +}; + +// ---------------------------------------------------------------------------------------- +// Extensions to interface netlist with MAME code .... +// ---------------------------------------------------------------------------------------- + +class netlist_source_memregion_t : public netlist::source_t +{ +public: + netlist_source_memregion_t(netlist::setup_t &setup, pstring name) + : netlist::source_t(setup), m_name(name) + { + } + + virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override; +private: + pstring m_name; +}; + +class netlist_data_memregions_t : public netlist::source_t +{ +public: + netlist_data_memregions_t(netlist::setup_t &setup); + + virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override; +}; + + +netlist::setup_t &netlist_mame_device_t::setup() +{ + return m_netlist->setup(); +} + +void netlist_mame_device_t::register_memregion_source(netlist::setup_t &setup, const char *name) +{ + setup.register_source(plib::make_unique_base<netlist::source_t, netlist_source_memregion_t>(setup, pstring(name, pstring::UTF8))); +} + +running_machine &netlist_mame_t::machine() +{ + return m_parent.machine(); +} + +void netlist_mame_analog_input_t::write(const double val) +{ + if (is_sound_device()) + { + update_to_current_time(); + m_param->setTo(val * m_mult + m_offset); + } + else + { + // FIXME: use device timer .... + m_param->setTo(val * m_mult + m_offset); + } +} + + + +void netlist_mame_int_input_t::write(const uint32_t val) +{ + const uint32_t v = (val >> m_shift) & m_mask; + if (v != (*m_param)()) + synchronize(0, v); +} + +void netlist_mame_logic_input_t::write(const uint32_t val) +{ + const uint32_t v = (val >> m_shift) & 1; + if (v != (*m_param)()) + synchronize(0, v); +} + +void netlist_mame_int_input_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (is_sound_device()) + update_to_current_time(); + m_param->setTo(param); +} + +void netlist_mame_logic_input_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (is_sound_device()) + update_to_current_time(); + m_param->setTo(param); +} + +void netlist_ram_pointer_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_data = (*m_param)(); +} + + +void netlist_mame_cpu_device_t::state_string_export(const device_state_entry &entry, std::string &str) const +{ + if (entry.index() >= 0) + { + if (entry.index() & 1) + str = string_format("%10.6f", *((double *)entry.dataptr())); + else + str = string_format("%d", *((netlist_sig_t *)entry.dataptr())); + } +} + + +// ---------------------------------------------------------------------------------------- // netlist_mame_analog_input_t // ---------------------------------------------------------------------------------------- @@ -68,11 +452,11 @@ void netlist_mame_analog_input_t::static_set_name(device_t &device, const char * void netlist_mame_analog_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::param_t *p = this->nl_owner().setup().find_param(m_param_name); + netlist::param_t *p = this->nl_owner().setup().find_param(pstring(m_param_name, pstring::UTF8)); m_param = dynamic_cast<netlist::param_double_t *>(p); if (m_param == nullptr) { - fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.c_str()); + fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name); } if (m_mult != 1.0 || m_offset != 0.0) { @@ -103,13 +487,14 @@ void netlist_mame_analog_output_t::static_set_params(device_t &device, const cha void netlist_mame_analog_output_t::custom_netlist_additions(netlist::setup_t &setup) { - pstring dname = "OUT_" + m_in; + const pstring pin(m_in, pstring::UTF8); + pstring dname = "OUT_" + pin; m_delegate.bind_relative_to(owner()->machine().root_device()); plib::owned_ptr<netlist::device_t> dev = plib::owned_ptr<netlist::device_t>::Create<NETLIB_NAME(analog_callback)>(setup.netlist(), setup.build_fqn(dname)); static_cast<NETLIB_NAME(analog_callback) *>(dev.get())->register_callback(m_delegate); setup.netlist().register_dev(std::move(dev)); - setup.register_link(dname + ".IN", m_in); + setup.register_link(dname + ".IN", pin); } void netlist_mame_analog_output_t::device_start() @@ -138,13 +523,14 @@ void netlist_mame_logic_output_t::static_set_params(device_t &device, const char void netlist_mame_logic_output_t::custom_netlist_additions(netlist::setup_t &setup) { - pstring dname = "OUT_" + m_in; + pstring pin(m_in, pstring::UTF8); + pstring dname = "OUT_" + pin; m_delegate.bind_relative_to(owner()->machine().root_device()); plib::owned_ptr<netlist::device_t> dev = plib::owned_ptr<netlist::device_t>::Create<NETLIB_NAME(logic_callback)>(setup.netlist(), setup.build_fqn(dname)); static_cast<NETLIB_NAME(logic_callback) *>(dev.get())->register_callback(m_delegate); setup.netlist().register_dev(std::move(dev)); - setup.register_link(dname + ".IN", m_in); + setup.register_link(dname + ".IN", pin); } void netlist_mame_logic_output_t::device_start() @@ -179,11 +565,11 @@ void netlist_mame_int_input_t::static_set_params(device_t &device, const char *p void netlist_mame_int_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name); + netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8)); m_param = dynamic_cast<netlist::param_int_t *>(p); if (m_param == nullptr) { - fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.c_str()); + fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name); } } @@ -211,49 +597,14 @@ void netlist_mame_logic_input_t::static_set_params(device_t &device, const char void netlist_mame_logic_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name); + netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8)); m_param = dynamic_cast<netlist::param_logic_t *>(p); if (m_param == nullptr) { - fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.c_str()); + fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name); } } -// ---------------------------------------------------------------------------------------- -// netlist_mame_rom_t -// ---------------------------------------------------------------------------------------- - -netlist_mame_rom_t::netlist_mame_rom_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, NETLIST_ROM_REGION, "Netlist ROM Region", tag, owner, clock, "netlist_rom_region", __FILE__) - , netlist_mame_sub_interface(*owner) - , m_name("") - , m_region_tag(nullptr) - , m_offset(0) - , m_size(0) -{ -} - -void netlist_mame_rom_t::static_set_params(device_t &device, const char *name, const char* region_tag, std::size_t offset, std::size_t size) -{ - netlist_mame_rom_t &r = downcast<netlist_mame_rom_t&>(device); - LOG_DEV_CALLS(("static_set_params %s\n", device.tag())); - r.m_name = name; - r.m_region_tag = region_tag; - r.m_offset = offset; - r.m_size = size; -} - -void netlist_mame_rom_t::custom_netlist_additions(netlist::setup_t &setup) -{ - if (memregion(m_region_tag) == nullptr) - fatalerror("device %s region %s not found\n", basetag(), m_region_tag); - setup.register_source(plib::make_unique_base<netlist::source_t, netlist_data_memregion_t>(setup, - m_name, memregion(m_region_tag)->base() + m_offset, m_size)); -} - -void netlist_mame_rom_t::device_start() -{ -} // ---------------------------------------------------------------------------------------- // netlist_ram_pointer_t @@ -278,11 +629,11 @@ void netlist_ram_pointer_t::static_set_params(device_t &device, const char *para void netlist_ram_pointer_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name); + netlist::param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(pstring(m_param_name, pstring::UTF8)); m_param = dynamic_cast<netlist::param_ptr_t *>(p); if (m_param == nullptr) { - fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.c_str()); + fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name); } m_data = (*m_param)(); @@ -318,7 +669,7 @@ void netlist_mame_stream_input_t::custom_netlist_additions(netlist::setup_t &set setup.register_dev("NETDEV_SOUND_IN", "STREAM_INPUT"); pstring sparam = plib::pfmt("STREAM_INPUT.CHAN{1}")(m_channel); - setup.register_param(sparam, m_param_name); + setup.register_param(sparam, pstring(m_param_name, pstring::UTF8)); sparam = plib::pfmt("STREAM_INPUT.MULT{1}")(m_channel); setup.register_param(sparam, m_mult); sparam = plib::pfmt("STREAM_INPUT.OFFSET{1}")(m_channel); @@ -360,7 +711,7 @@ void netlist_mame_stream_output_t::custom_netlist_additions(netlist::setup_t &se setup.register_param(sname + ".CHAN" , m_channel); setup.register_param(sname + ".MULT", m_mult); setup.register_param(sname + ".OFFSET", m_offset); - setup.register_link(sname + ".IN", m_out_name); + setup.register_link(sname + ".IN", pstring(m_out_name, pstring::UTF8)); } @@ -399,10 +750,6 @@ void netlist_mame_t::vlog(const plib::plog_level &l, const pstring &ls) const // netlist_mame_device_t // ---------------------------------------------------------------------------------------- -static ADDRESS_MAP_START(program_dummy, AS_PROGRAM, 8, netlist_mame_device_t) - AM_RANGE(0x000, 0x3ff) AM_ROM -ADDRESS_MAP_END - netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, NETLIST_CORE, "Netlist core device", tag, owner, clock, "netlist_core", __FILE__), m_icount(0), @@ -421,6 +768,11 @@ netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, devi { } +netlist_mame_device_t::~netlist_mame_device_t() +{ + pstring::resetmem(); +} + void netlist_mame_device_t::static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)) { LOG_DEV_CALLS(("static_set_constructor\n")); @@ -456,6 +808,9 @@ void netlist_mame_device_t::device_start() } } + /* add default data provider for roms */ + setup().register_source(plib::make_unique_base<netlist::source_t, netlist_data_memregions_t>(setup())); + m_setup_func(setup()); /* let sub-devices tweak the netlist */ @@ -598,7 +953,7 @@ netlist_mame_cpu_device_t::netlist_mame_cpu_device_t(const machine_config &mconf device_state_interface(mconfig, *this), device_disasm_interface(mconfig, *this), device_memory_interface(mconfig, *this), - m_program_config("program", ENDIANNESS_LITTLE, 8, 12, 0, ADDRESS_MAP_NAME(program_dummy)) + m_program_config("program", ENDIANNESS_LITTLE, 8, 12) // Interface is needed to keep debugger happy { } @@ -619,11 +974,11 @@ void netlist_mame_cpu_device_t::device_start() netlist::detail::net_t *n = netlist().m_nets[i].get(); if (n->is_logic()) { - state_add(i*2, n->name().c_str(), downcast<netlist::logic_net_t *>(n)->Q_state_ptr()); + state_add(i*2, n->name().c_str(), *downcast<netlist::logic_net_t *>(n)->Q_state_ptr()); } else { - state_add(i*2+1, n->name().c_str(), downcast<netlist::analog_net_t *>(n)->Q_Analog_state_ptr()).formatstr("%20s"); + state_add(i*2+1, n->name().c_str(), *downcast<netlist::analog_net_t *>(n)->Q_Analog_state_ptr()).formatstr("%20s"); } } @@ -791,11 +1146,24 @@ std::unique_ptr<plib::pistream> netlist_source_memregion_t::stream(const pstring return plib::make_unique_base<plib::pistream, plib::pimemstream>(mem->base(), mem->bytes()); } -std::unique_ptr<plib::pistream> netlist_data_memregion_t::stream(const pstring &name) +netlist_data_memregions_t::netlist_data_memregions_t(netlist::setup_t &setup) +: netlist::source_t(setup, netlist::source_t::DATA) +{ +} + +std::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring &name) { - if (name == m_name) - return plib::make_unique_base<plib::pistream, plib::pimemstream>(m_ptr, m_size); + memory_region *mem = downcast<netlist_mame_t &>(setup().netlist()).parent().memregion(name.c_str()); + //memory_region *mem = downcast<netlist_mame_t &>(setup().netlist()).machine().root_device().memregion(name.c_str()); + if (mem != nullptr) + { + return plib::make_unique_base<plib::pistream, plib::pimemstream>(mem->base(), mem->bytes()); + } else + { + // This should be the last data provider being called - last resort + fatalerror("data named %s not found in device rom regions\n", name.c_str()); return std::unique_ptr<plib::pistream>(nullptr); + } } diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index c3c58509089..7aab62b4de7 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -13,8 +13,17 @@ #include "emu.h" -#include "netlist/nl_base.h" -#include "netlist/nl_setup.h" +#include "netlist/nl_time.h" + +class netlist_mame_t; + +namespace netlist { + class setup_t; + class param_double_t; + class param_int_t; + class param_logic_t; + class param_ptr_t; +} // MAME specific configuration @@ -49,10 +58,6 @@ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_INT_INPUT, 0) \ netlist_mame_int_input_t::static_set_params(*device, _name, _mask, _shift); -#define MCFG_NETLIST_ROM_REGION(_basetag, _tag, _region, _name, _offset, _size) \ - MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ROM_REGION, 0) \ - netlist_mame_rom_t::static_set_params(*device, _name, ":" _region, _offset, _size); - #define MCFG_NETLIST_RAM_POINTER(_basetag, _tag, _name) \ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_RAM_POINTER, 0) \ netlist_ram_pointer_t::static_set_params(*device, _name ".m_RAM"); @@ -76,7 +81,7 @@ #define MEMREGION_SOURCE(_name) \ - setup.register_source(plib::make_unique_base<netlist::source_t, netlist_source_memregion_t>(setup, _name)); + netlist_mame_device_t::register_memregion_source(setup, _name); #define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \ void _name(const double data, const attotime &time) @@ -85,65 +90,6 @@ void _name(const int data, const attotime &time) -// ---------------------------------------------------------------------------------------- -// Extensions to interface netlist with MAME code .... -// ---------------------------------------------------------------------------------------- - -class netlist_source_memregion_t : public netlist::source_t -{ -public: - netlist_source_memregion_t(netlist::setup_t &setup, pstring name) - : netlist::source_t(setup), m_name(name) - { - } - - virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override; -private: - pstring m_name; -}; - -class netlist_data_memregion_t : public netlist::source_t -{ -public: - netlist_data_memregion_t(netlist::setup_t &setup, - pstring name, uint8_t *ptr, std::size_t size) - : netlist::source_t(setup, netlist::source_t::DATA) - , m_name(name) - , m_ptr(ptr) - , m_size(size) - { - } - - virtual std::unique_ptr<plib::pistream> stream(const pstring &name) override; -private: - pstring m_name; - uint8_t *m_ptr; - std::size_t m_size; -}; - -class netlist_mame_device_t; - -class netlist_mame_t : public netlist::netlist_t -{ -public: - - netlist_mame_t(netlist_mame_device_t &parent, const pstring &aname) - : netlist::netlist_t(aname), - m_parent(parent) - {} - virtual ~netlist_mame_t() { }; - - inline running_machine &machine(); - - netlist_mame_device_t &parent() { return m_parent; } - -protected: - - void vlog(const plib::plog_level &l, const pstring &ls) const override; - -private: - netlist_mame_device_t &m_parent; -}; // ---------------------------------------------------------------------------------------- // netlist_mame_device_t @@ -156,17 +102,19 @@ public: // construction/destruction netlist_mame_device_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); netlist_mame_device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *file); - virtual ~netlist_mame_device_t() { pstring::resetmem(); } + virtual ~netlist_mame_device_t(); static void static_set_constructor(device_t &device, void (*setup_func)(netlist::setup_t &)); - ATTR_HOT inline netlist::setup_t &setup() { return m_netlist->setup(); } + ATTR_HOT inline netlist::setup_t &setup(); ATTR_HOT inline netlist_mame_t &netlist() { return *m_netlist; } ATTR_HOT inline const netlist::netlist_time last_time_update() { return m_old; } ATTR_HOT void update_time_x(); ATTR_HOT void check_mame_abort_slice(); + static void register_memregion_source(netlist::setup_t &setup, const char *name); + int m_icount; protected: @@ -199,11 +147,6 @@ private: void (*m_setup_func)(netlist::setup_t &); }; -inline running_machine &netlist_mame_t::machine() -{ - return m_parent.machine(); -} - // ---------------------------------------------------------------------------------------- // netlist_mame_cpu_device_t // ---------------------------------------------------------------------------------------- @@ -261,16 +204,7 @@ protected: // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) const override - { - if (entry.index() >= 0) - { - if (entry.index() & 1) - str = string_format("%10.6f", *((double *)entry.dataptr())); - else - str = string_format("%d", *((netlist_sig_t *)entry.dataptr())); - } - } + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; private: @@ -380,19 +314,7 @@ public: static void static_set_name(device_t &device, const char *param_name); - inline void write(const double val) - { - if (is_sound_device()) - { - update_to_current_time(); - m_param->setTo(val * m_mult + m_offset); - } - else - { - // FIXME: use device timer .... - m_param->setTo(val * m_mult + m_offset); - } - } + void write(const double val); inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { @@ -414,7 +336,7 @@ protected: private: netlist::param_double_t *m_param; bool m_auto_port; - pstring m_param_name; + const char *m_param_name; }; // ---------------------------------------------------------------------------------------- @@ -440,7 +362,7 @@ protected: virtual void custom_netlist_additions(netlist::setup_t &setup) override; private: - pstring m_in; + const char *m_in; netlist_analog_output_delegate m_delegate; }; @@ -467,7 +389,7 @@ protected: virtual void custom_netlist_additions(netlist::setup_t &setup) override; private: - pstring m_in; + const char *m_in; netlist_logic_output_delegate m_delegate; }; @@ -486,12 +408,7 @@ public: static void static_set_params(device_t &device, const char *param_name, const uint32_t mask, const uint32_t shift); - inline void write(const uint32_t val) - { - const uint32_t v = (val >> m_shift) & m_mask; - if (v != (*m_param)()) - synchronize(0, v); - } + void write(const uint32_t val); inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); } DECLARE_WRITE_LINE_MEMBER(write_line) { write(state); } @@ -503,18 +420,13 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override - { - if (is_sound_device()) - update_to_current_time(); - m_param->setTo(param); - } + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: netlist::param_int_t *m_param; uint32_t m_mask; uint32_t m_shift; - pstring m_param_name; + const char *m_param_name; }; @@ -533,12 +445,7 @@ public: static void static_set_params(device_t &device, const char *param_name, const uint32_t shift); - inline void write(const uint32_t val) - { - const uint32_t v = (val >> m_shift) & 1; - if (v != (*m_param)()) - synchronize(0, v); - } + void write(const uint32_t val); inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); } DECLARE_WRITE_LINE_MEMBER(write_line) { write(state); } @@ -550,44 +457,12 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override - { - if (is_sound_device()) - update_to_current_time(); - m_param->setTo(param); - } + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: netlist::param_logic_t *m_param; uint32_t m_shift; - pstring m_param_name; -}; - -// ---------------------------------------------------------------------------------------- -// netlist_mame_rom_t -// ---------------------------------------------------------------------------------------- - -class netlist_mame_rom_t : public device_t, - public netlist_mame_sub_interface -{ -public: - - // construction/destruction - netlist_mame_rom_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual ~netlist_mame_rom_t() { } - - static void static_set_params(device_t &device, const char *name, const char* region_tag, std::size_t offset, std::size_t size); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void custom_netlist_additions(netlist::setup_t &setup) override; - -private: - pstring m_name; - const char* m_region_tag; - std::size_t m_offset; - std::size_t m_size; + const char *m_param_name; }; // ---------------------------------------------------------------------------------------- @@ -610,14 +485,11 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override - { - m_data = (*m_param)(); - } + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: netlist::param_ptr_t *m_param; - pstring m_param_name; + const char *m_param_name; uint8_t* m_data; }; @@ -642,7 +514,7 @@ protected: virtual void custom_netlist_additions(netlist::setup_t &setup) override; private: uint32_t m_channel; - pstring m_param_name; + const char *m_param_name; }; // ---------------------------------------------------------------------------------------- @@ -666,261 +538,9 @@ protected: virtual void custom_netlist_additions(netlist::setup_t &setup) override; private: uint32_t m_channel; - pstring m_out_name; -}; - -// ---------------------------------------------------------------------------------------- -// analog_callback -// ---------------------------------------------------------------------------------------- - -class NETLIB_NAME(analog_callback) : public netlist::device_t -{ -public: - NETLIB_NAME(analog_callback)(netlist::netlist_t &anetlist, const pstring &name) - : device_t(anetlist, name) - , m_in(*this, "IN") - , m_cpu_device(nullptr) - , m_last(*this, "m_last", 0) - { - m_cpu_device = downcast<netlist_mame_cpu_device_t *>(&downcast<netlist_mame_t &>(netlist()).parent()); - } - - ATTR_COLD void reset() override - { - m_last = 0.0; - } - - ATTR_COLD void register_callback(netlist_analog_output_delegate callback) - { - m_callback = callback; - } - - NETLIB_UPDATEI() - { - nl_double cur = m_in(); - - // FIXME: make this a parameter - // avoid calls due to noise - if (std::fabs(cur - m_last) > 1e-6) - { - m_cpu_device->update_time_x(); - m_callback(cur, m_cpu_device->local_time()); - m_cpu_device->check_mame_abort_slice(); - m_last = cur; - } - } - -private: - netlist::analog_input_t m_in; - netlist_analog_output_delegate m_callback; - netlist_mame_cpu_device_t *m_cpu_device; - netlist::state_var<nl_double> m_last; -}; - -// ---------------------------------------------------------------------------------------- -// logic_callback -// ---------------------------------------------------------------------------------------- - -class NETLIB_NAME(logic_callback) : public netlist::device_t -{ -public: - NETLIB_NAME(logic_callback)(netlist::netlist_t &anetlist, const pstring &name) - : device_t(anetlist, name) - , m_in(*this, "IN") - , m_cpu_device(nullptr) - , m_last(*this, "m_last", 0) - { - m_cpu_device = downcast<netlist_mame_cpu_device_t *>(&downcast<netlist_mame_t &>(netlist()).parent()); - } - - ATTR_COLD void reset() override - { - m_last = 0; - } - - ATTR_COLD void register_callback(netlist_logic_output_delegate callback) - { - m_callback = callback; - } - - NETLIB_UPDATEI() - { - netlist_sig_t cur = m_in(); - - // FIXME: make this a parameter - // avoid calls due to noise - if (cur != m_last) - { - m_cpu_device->update_time_x(); - m_callback(cur, m_cpu_device->local_time()); - m_cpu_device->check_mame_abort_slice(); - m_last = cur; - } - } - -private: - netlist::logic_input_t m_in; - netlist_logic_output_delegate m_callback; - netlist_mame_cpu_device_t *m_cpu_device; - netlist::state_var<netlist_sig_t> m_last; + const char *m_out_name; }; -// ---------------------------------------------------------------------------------------- -// sound_out -// ---------------------------------------------------------------------------------------- - -class NETLIB_NAME(sound_out) : public netlist::device_t -{ -public: - NETLIB_NAME(sound_out)(netlist::netlist_t &anetlist, const pstring &name) - : netlist::device_t(anetlist, name) - , m_channel(*this, "CHAN", 0) - , m_mult(*this, "MULT", 1000.0) - , m_offset(*this, "OFFSET", 0.0) - , m_sample(netlist::netlist_time::from_hz(1)) //sufficiently big enough - , m_in(*this, "IN") - , m_last_buffer(*this, "m_last_buffer", netlist::netlist_time::zero()) - { - } - - static const int BUFSIZE = 2048; - - ATTR_COLD void reset() override - { - m_cur = 0.0; - m_last_pos = 0; - m_last_buffer = netlist::netlist_time::zero(); - } - - ATTR_HOT void sound_update(const netlist::netlist_time &upto) - { - int pos = (upto - m_last_buffer) / m_sample; - if (pos >= BUFSIZE) - netlist().log().fatal("sound {1}: exceeded BUFSIZE\n", name().c_str()); - while (m_last_pos < pos ) - { - m_buffer[m_last_pos++] = (stream_sample_t) m_cur; - } - } - - NETLIB_UPDATEI() - { - nl_double val = m_in() * m_mult() + m_offset(); - sound_update(netlist().time()); - /* ignore spikes */ - if (std::abs(val) < 32767.0) - m_cur = val; - else if (val > 0.0) - m_cur = 32767.0; - else - m_cur = -32767.0; - - } - -public: - ATTR_HOT void buffer_reset(const netlist::netlist_time &upto) - { - m_last_pos = 0; - m_last_buffer = upto; - m_cur = 0.0; - } - - netlist::param_int_t m_channel; - netlist::param_double_t m_mult; - netlist::param_double_t m_offset; - stream_sample_t *m_buffer; - netlist::netlist_time m_sample; - -private: - netlist::analog_input_t m_in; - double m_cur; - int m_last_pos; - netlist::state_var<netlist::netlist_time> m_last_buffer; -}; - -// ---------------------------------------------------------------------------------------- -// sound_in -// ---------------------------------------------------------------------------------------- - -class NETLIB_NAME(sound_in) : public netlist::device_t -{ -public: - NETLIB_NAME(sound_in)(netlist::netlist_t &anetlist, const pstring &name) - : netlist::device_t(anetlist, name) - , m_feedback(*this, "FB") // clock part - , m_Q(*this, "Q") - { - connect(m_feedback, m_Q); - m_inc = netlist::netlist_time::from_nsec(1); - - - for (int i = 0; i < MAX_INPUT_CHANNELS; i++) - { - m_param_name[i] = std::make_unique<netlist::param_str_t>(*this, plib::pfmt("CHAN{1}")(i), ""); - m_param_mult[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("MULT{1}")(i), 1.0); - m_param_offset[i] = std::make_unique<netlist::param_double_t>(*this, plib::pfmt("OFFSET{1}")(i), 0.0); - } - m_num_channel = 0; - } - - static const int MAX_INPUT_CHANNELS = 10; - - ATTR_COLD void reset() override - { - m_pos = 0; - for (auto & elem : m_buffer) - elem = nullptr; - } - - ATTR_COLD int resolve() - { - m_pos = 0; - for (int i = 0; i < MAX_INPUT_CHANNELS; i++) - { - if ((*m_param_name[i])() != pstring("")) - { - if (i != m_num_channel) - netlist().log().fatal("sound input numbering has to be sequential!"); - m_num_channel++; - m_param[i] = dynamic_cast<netlist::param_double_t *>(setup().find_param((*m_param_name[i])(), true)); - } - } - return m_num_channel; - } - - NETLIB_UPDATEI() - { - for (int i=0; i<m_num_channel; i++) - { - if (m_buffer[i] == nullptr) - break; // stop, called outside of stream_update - const nl_double v = m_buffer[i][m_pos]; - m_param[i]->setTo(v * (*m_param_mult[i])() + (*m_param_offset[i])()); - } - m_pos++; - m_Q.push(!m_Q.net().new_Q(), m_inc ); - } - -public: - ATTR_HOT void buffer_reset() - { - m_pos = 0; - } - - std::unique_ptr<netlist::param_str_t> m_param_name[MAX_INPUT_CHANNELS]; - netlist::param_double_t *m_param[MAX_INPUT_CHANNELS]; - stream_sample_t *m_buffer[MAX_INPUT_CHANNELS]; - std::unique_ptr<netlist::param_double_t> m_param_mult[MAX_INPUT_CHANNELS]; - std::unique_ptr<netlist::param_double_t> m_param_offset[MAX_INPUT_CHANNELS]; - netlist::netlist_time m_inc; - -private: - netlist::logic_input_t m_feedback; - netlist::logic_output_t m_Q; - - int m_pos; - int m_num_channel; -}; // device type definition extern const device_type NETLIST_CORE; @@ -929,7 +549,6 @@ extern const device_type NETLIST_SOUND; extern const device_type NETLIST_ANALOG_INPUT; extern const device_type NETLIST_LOGIC_INPUT; extern const device_type NETLIST_INT_INPUT; -extern const device_type NETLIST_ROM_REGION; extern const device_type NETLIST_RAM_POINTER; extern const device_type NETLIST_LOGIC_OUTPUT; diff --git a/src/devices/machine/nscsi_cb.h b/src/devices/machine/nscsi_cb.h index 4fab2021fe1..1699de18f4b 100644 --- a/src/devices/machine/nscsi_cb.h +++ b/src/devices/machine/nscsi_cb.h @@ -7,22 +7,22 @@ #include "machine/nscsi_bus.h" #define MCFG_NSCSICB_RST_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_rst_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_rst_callback(DEVCB_##_line); #define MCFG_NSCSICB_ATN_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_atn_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_atn_callback(DEVCB_##_line); #define MCFG_NSCSICB_ACK_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_ack_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_ack_callback(DEVCB_##_line); #define MCFG_NSCSICB_REQ_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_req_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_req_callback(DEVCB_##_line); #define MCFG_NSCSICB_MSG_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_msg_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_msg_callback(DEVCB_##_line); #define MCFG_NSCSICB_IO_HANDLER(_line) \ - downcast<nscsi_callback_device *>(device)->set_io_callback(DEVCB_##_line); + devcb = &downcast<nscsi_callback_device *>(device)->set_io_callback(DEVCB_##_line); #define MCFG_NSCSICB_CD_HANDLER(_line) \ downcast<nscsi_callback_device *>(device)->set_cd_callback(DEVCB_##_line); @@ -38,15 +38,15 @@ class nscsi_callback_device : public nscsi_device public: nscsi_callback_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _line> void set_rst_callback(_line line) { m_write_rst.set_callback(line); } - template<class _line> void set_atn_callback(_line line) { m_write_atn.set_callback(line); } - template<class _line> void set_ack_callback(_line line) { m_write_ack.set_callback(line); } - template<class _line> void set_req_callback(_line line) { m_write_req.set_callback(line); } - template<class _line> void set_msg_callback(_line line) { m_write_msg.set_callback(line); } - template<class _line> void set_io_callback(_line line) { m_write_io.set_callback(line); } - template<class _line> void set_cd_callback(_line line) { m_write_cd.set_callback(line); } - template<class _line> void set_sel_callback(_line line) { m_write_sel.set_callback(line); } - template<class _line> void set_bsy_callback(_line line) { m_write_bsy.set_callback(line); } + template<class _line> devcb_base &set_rst_callback(_line line) { return m_write_rst.set_callback(line); } + template<class _line> devcb_base &set_atn_callback(_line line) { return m_write_atn.set_callback(line); } + template<class _line> devcb_base &set_ack_callback(_line line) { return m_write_ack.set_callback(line); } + template<class _line> devcb_base &set_req_callback(_line line) { return m_write_req.set_callback(line); } + template<class _line> devcb_base &set_msg_callback(_line line) { return m_write_msg.set_callback(line); } + template<class _line> devcb_base &set_io_callback(_line line) { return m_write_io.set_callback(line); } + template<class _line> devcb_base &set_cd_callback(_line line) { return m_write_cd.set_callback(line); } + template<class _line> devcb_base &set_sel_callback(_line line) { return m_write_sel.set_callback(line); } + template<class _line> devcb_base &set_bsy_callback(_line line) { return m_write_bsy.set_callback(line); } virtual void scsi_ctrl_changed() override; diff --git a/src/devices/machine/phi.cpp b/src/devices/machine/phi.cpp index f5b91929d9a..18166c068cc 100644 --- a/src/devices/machine/phi.cpp +++ b/src/devices/machine/phi.cpp @@ -2,28 +2,28 @@ // copyright-holders:F. Ulivi /********************************************************************* - phi.h + phi.h - HP PHI (Processor-to-Hpib-Interface) (1AA6-6x04) + HP PHI (Processor-to-Hpib-Interface) (1AA6-6x04) - PHI supports these features of HP-IB: - * SH1 - * AH1 - * T1/TE1 - * L1/LE1 - * SR1 - * RL2 - * PP1 - * DC1 - * DT1 - * C1,C2,C3,C4,C5 - * HP non-standard IDENTIFY sequence + PHI supports these features of HP-IB: + * SH1 + * AH1 + * T1/TE1 + * L1/LE1 + * SR1 + * RL2 + * PP1 + * DC1 + * DT1 + * C1,C2,C3,C4,C5 + * HP non-standard IDENTIFY sequence - Fun fact: PHI has no clock input, its FSMs are driven only by - changes in input signals and by a few internal monostables + Fun fact: PHI has no clock input, its FSMs are driven only by + changes in input signals and by a few internal monostables - Main reference for this ASIC: - HP 12009-90001, sep 82, HP12009A HP-IB Interface Reference Manual + Main reference for this ASIC: + HP 12009-90001, sep 82, HP12009A HP-IB Interface Reference Manual *********************************************************************/ @@ -33,6 +33,8 @@ // Debugging #define VERBOSE 1 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define VERBOSE_0 0 +#define LOG_0(x) do { if (VERBOSE_0) logerror x; } while (0) // Macros to clear/set single bits #define BIT_MASK(n) (1U << (n)) @@ -47,122 +49,122 @@ enum { // Register addresses enum { - REG_R_INT_COND = 0, // R 0: Interrupting conditions - REG_W_INT_COND = 0, // W 0: Interrupting conditions - REG_R_INT_MASK = 1, // R 1: Interrupt mask - REG_W_INT_MASK = 1, // W 1: Interrupt mask - REG_R_INBOUND_FIFO = 2, // R 2: Inbound FIFO + REG_R_INT_COND = 0, // R 0: Interrupting conditions + REG_W_INT_COND = 0, // W 0: Interrupting conditions + REG_R_INT_MASK = 1, // R 1: Interrupt mask + REG_W_INT_MASK = 1, // W 1: Interrupt mask + REG_R_INBOUND_FIFO = 2, // R 2: Inbound FIFO REG_W_OUTBOUND_FIFO = 2,// W 2: Outbound FIFO - REG_R_STATUS = 3, // R 3: Status - REG_W_STATUS = 3, // W 3: Status - REG_R_CONTROL = 4, // R 4: Control - REG_W_CONTROL = 4, // W 4: Control - REG_R_ADDRESS = 5, // R 5: HPIB address - REG_W_ADDRESS = 5, // W 5: HPIB address - REG_R_1ST_ID = 6, // R 6: 1st ID byte - REG_W_1ST_ID = 6, // W 6: 1st ID byte - REG_R_2ND_ID = 7, // R 7: 2nd ID byte - REG_W_2ND_ID = 7 // W 7: 2nd ID byte + REG_R_STATUS = 3, // R 3: Status + REG_W_STATUS = 3, // W 3: Status + REG_R_CONTROL = 4, // R 4: Control + REG_W_CONTROL = 4, // W 4: Control + REG_R_ADDRESS = 5, // R 5: HPIB address + REG_W_ADDRESS = 5, // W 5: HPIB address + REG_R_1ST_ID = 6, // R 6: 1st ID byte + REG_W_1ST_ID = 6, // W 6: 1st ID byte + REG_R_2ND_ID = 7, // R 7: 2nd ID byte + REG_W_2ND_ID = 7 // W 7: 2nd ID byte }; // All valid bits in registers -#define REG_ALL_MASK 0xc0ff +#define REG_ALL_MASK 0xc0ff // D0 & D1 bits -#define REG_D0D1_MASK 0xc000 // Mask of D0/D1 bits -#define REG_D0D1_SHIFT 14 // Position of D0/D1 bits +#define REG_D0D1_MASK 0xc000 // Mask of D0/D1 bits +#define REG_D0D1_SHIFT 14 // Position of D0/D1 bits // D8-D15 bits -#define REG_D08D15_MASK 0xff // Mask of D8:D15 bits +#define REG_D08D15_MASK 0xff // Mask of D8:D15 bits // Bits in INT_COND & INT_MASK -#define REG_INT_DEV_CLEAR_BIT 0 // Device clear -#define REG_INT_FIFO_IDLE_BIT 1 // FIFO idle -#define REG_INT_FIFO_AV_BIT 2 // FIFO bytes available -#define REG_INT_FIFO_ROOM_BIT 3 // FIFO room available -#define REG_INT_SRQ_BIT 4 // Service request -#define REG_INT_PP_RESPONSE_BIT 5 // PP response -#define REG_INT_PROC_ABORT_BIT 6 // Processor handshake abort -#define REG_INT_STATUS_CH_BIT 7 // Status change -#define REG_INT_PARITY_ERR_BIT 14 // Parity error -#define REG_INT_PENDING_BIT 15 // Interrupt pending -#define REG_INT_CLEARABLE_MASK 0x40c1 // Mask of clearable bits -#define REG_INT_STATE_MASK 0x803e // Mask of "state" bits +#define REG_INT_DEV_CLEAR_BIT 0 // Device clear +#define REG_INT_FIFO_IDLE_BIT 1 // FIFO idle +#define REG_INT_FIFO_AV_BIT 2 // FIFO bytes available +#define REG_INT_FIFO_ROOM_BIT 3 // FIFO room available +#define REG_INT_SRQ_BIT 4 // Service request +#define REG_INT_PP_RESPONSE_BIT 5 // PP response +#define REG_INT_PROC_ABORT_BIT 6 // Processor handshake abort +#define REG_INT_STATUS_CH_BIT 7 // Status change +#define REG_INT_PARITY_ERR_BIT 14 // Parity error +#define REG_INT_PENDING_BIT 15 // Interrupt pending +#define REG_INT_CLEARABLE_MASK 0x40c1 // Mask of clearable bits +#define REG_INT_STATE_MASK 0x803e // Mask of "state" bits // Bits in inbound FIFO -#define REG_IFIFO_NORMAL_MASK 0x0000 // Mask of D0/D1 bits for "normal" bytes -#define REG_IFIFO_CNT_EXP_MASK 0x8000 // Mask for a byte that caused byte count to expire -#define REG_IFIFO_LAST_MASK 0xc000 // Mask for last byte in a record -#define REG_IFIFO_2_ADDR_MASK 0x4000 // Mask for secondary addresses -#define REG_IFIFO_TALK_BIT 5 // Bit of "talk" flag +#define REG_IFIFO_NORMAL_MASK 0x0000 // Mask of D0/D1 bits for "normal" bytes +#define REG_IFIFO_CNT_EXP_MASK 0x8000 // Mask for a byte that caused byte count to expire +#define REG_IFIFO_LAST_MASK 0xc000 // Mask for last byte in a record +#define REG_IFIFO_2_ADDR_MASK 0x4000 // Mask for secondary addresses +#define REG_IFIFO_TALK_BIT 5 // Bit of "talk" flag // Bits in outbound FIFO -#define REG_OFIFO_SPECIAL_BIT 14 // Bit to discriminate between normal bytes and the rest -#define REG_OFIFO_END_BIT 15 // Bit of EOI -#define REG_OFIFO_IFCMD_MASK 0x4000 // Mask of interface commands -#define REG_OFIFO_UNCNT_MASK 0xc000 // Mask of uncounted transfer enable -#define REG_OFIFO_XFER_EN_MASK 0x0000 // Mask of byte transfer enable -#define REG_OFIFO_LF_INH_BIT 15 // Bit of LF detection inhibit +#define REG_OFIFO_SPECIAL_BIT 14 // Bit to discriminate between normal bytes and the rest +#define REG_OFIFO_END_BIT 15 // Bit of EOI +#define REG_OFIFO_IFCMD_MASK 0x4000 // Mask of interface commands +#define REG_OFIFO_UNCNT_MASK 0xc000 // Mask of uncounted transfer enable +#define REG_OFIFO_XFER_EN_MASK 0x0000 // Mask of byte transfer enable +#define REG_OFIFO_LF_INH_BIT 15 // Bit of LF detection inhibit // Bits in status register -#define REG_STATUS_DATA_FREEZE_BIT 0 // Outbound data freeze -#define REG_STATUS_LISTEN_BIT 1 // Addressed to listen -#define REG_STATUS_TALK_BIT 2 // Addressed to talk or identify -#define REG_STATUS_SYS_CTRL_BIT 3 // System controller -#define REG_STATUS_CONTROLLER_BIT 4 // Current controller -#define REG_STATUS_REMOTE_BIT 5 // Remote state -#define REG_STATUS_D0D1_BIT 6 // D0/D1 bit access -#define REG_STATUS_STATE_MASK 0x3e // Mask of "state" bits +#define REG_STATUS_DATA_FREEZE_BIT 0 // Outbound data freeze +#define REG_STATUS_LISTEN_BIT 1 // Addressed to listen +#define REG_STATUS_TALK_BIT 2 // Addressed to talk or identify +#define REG_STATUS_SYS_CTRL_BIT 3 // System controller +#define REG_STATUS_CONTROLLER_BIT 4 // Current controller +#define REG_STATUS_REMOTE_BIT 5 // Remote state +#define REG_STATUS_D0D1_BIT 6 // D0/D1 bit access +#define REG_STATUS_STATE_MASK 0x3e // Mask of "state" bits // Bits in control register -#define REG_CTRL_INIT_OFIFO_BIT 0 // Initialize outbound FIFO -#define REG_CTRL_DMA_FIFO_BIT 1 // DMA FIFO selection -#define REG_CTRL_SERVICE_REQ_BIT 2 // Request service -#define REG_CTRL_PP_RESPONSE_BIT 3 // Respond to PP -#define REG_CTRL_IFC_BIT 4 // IFC value -#define REG_CTRL_REN_BIT 5 // REN value -#define REG_CTRL_PAR_FREEZE_BIT 6 // Parity freeze -#define REG_CTRL_8BIT_PROC_BIT 7 // 8-bit processor +#define REG_CTRL_INIT_OFIFO_BIT 0 // Initialize outbound FIFO +#define REG_CTRL_DMA_FIFO_BIT 1 // DMA FIFO selection +#define REG_CTRL_SERVICE_REQ_BIT 2 // Request service +#define REG_CTRL_PP_RESPONSE_BIT 3 // Respond to PP +#define REG_CTRL_IFC_BIT 4 // IFC value +#define REG_CTRL_REN_BIT 5 // REN value +#define REG_CTRL_PAR_FREEZE_BIT 6 // Parity freeze +#define REG_CTRL_8BIT_PROC_BIT 7 // 8-bit processor // Bits in address register -#define REG_ADDR_HPIB_ADDR_BIT 0 // HPIB address -#define REG_ADDR_LA_BIT 5 // Listen always -#define REG_ADDR_TA_BIT 6 // Talk always -#define REG_ADDR_ONLINE_BIT 7 // Online +#define REG_ADDR_HPIB_ADDR_BIT 0 // HPIB address +#define REG_ADDR_LA_BIT 5 // Listen always +#define REG_ADDR_TA_BIT 6 // Talk always +#define REG_ADDR_ONLINE_BIT 7 // Online // Interface commands -#define IFCMD_MASK 0x7f // Mask of interface commands -#define IFCMD_DCL 0x14 // Device clear -#define IFCMD_GET 0x08 // Group execute trigger -#define IFCMD_GTL 0x01 // Go to local -#define IFCMD_LLO 0x11 // Local lock-out -#define IFCMD_AG_MASK 0x60 // Mask of bits identifying address group commands -#define IFCMD_ADDR_MASK 0x1f // Mask of address in AG commands -#define IFCMD_LAG_VALUE 0x20 // Value of LAG commands -#define IFCMD_TAG_VALUE 0x40 // Value of TAG commands -#define IFCMD_SCG_VALUE 0x60 // Value of SCG commands -#define IFCMD_PPC 0x05 // Parallel poll configure -#define IFCMD_PPX_MASK 0x70 // Mask of PPE/PPD commands -#define IFCMD_PPE_VALUE 0x60 // Parallel poll enable -#define IFCMD_PPE_S_BIT 3 // Position of "S" bit in PPE -#define IFCMD_PPE_PPR_MASK 7 // Mask in PPE of PPR msg no. -#define IFCMD_PPD_VALUE 0x70 // Parallel poll disable -#define IFCMD_PPU 0x15 // Parallel poll unconfigure -#define IFCMD_SDC 0x04 // Selected device clear -#define IFCMD_SPD 0x19 // Serial poll disable -#define IFCMD_SPE 0x18 // Serial poll enable -#define IFCMD_TCT 0x09 // Take control -#define IFCMD_UNL 0x3f // Unlisten -#define IFCMD_UNT 0x5f // Untalk +#define IFCMD_MASK 0x7f // Mask of interface commands +#define IFCMD_DCL 0x14 // Device clear +#define IFCMD_GET 0x08 // Group execute trigger +#define IFCMD_GTL 0x01 // Go to local +#define IFCMD_LLO 0x11 // Local lock-out +#define IFCMD_AG_MASK 0x60 // Mask of bits identifying address group commands +#define IFCMD_ADDR_MASK 0x1f // Mask of address in AG commands +#define IFCMD_LAG_VALUE 0x20 // Value of LAG commands +#define IFCMD_TAG_VALUE 0x40 // Value of TAG commands +#define IFCMD_SCG_VALUE 0x60 // Value of SCG commands +#define IFCMD_PPC 0x05 // Parallel poll configure +#define IFCMD_PPX_MASK 0x70 // Mask of PPE/PPD commands +#define IFCMD_PPE_VALUE 0x60 // Parallel poll enable +#define IFCMD_PPE_S_BIT 3 // Position of "S" bit in PPE +#define IFCMD_PPE_PPR_MASK 7 // Mask in PPE of PPR msg no. +#define IFCMD_PPD_VALUE 0x70 // Parallel poll disable +#define IFCMD_PPU 0x15 // Parallel poll unconfigure +#define IFCMD_SDC 0x04 // Selected device clear +#define IFCMD_SPD 0x19 // Serial poll disable +#define IFCMD_SPE 0x18 // Serial poll enable +#define IFCMD_TCT 0x09 // Take control +#define IFCMD_UNL 0x3f // Unlisten +#define IFCMD_UNT 0x5f // Untalk // Delays -#define DELAY_T1 2000 // T1: 2 us -#define DELAY_T7 500 // T7: 0.5 us -#define DELAY_T9 1500 // T9: 1.5 us -#define DELAY_T10 1500 // T10: 1.5 us +#define DELAY_T1 2000 // T1: 2 us +#define DELAY_T7 500 // T7: 0.5 us +#define DELAY_T9 1500 // T9: 1.5 us +#define DELAY_T10 1500 // T10: 1.5 us // Controller address -#define CONTROLLER_ADDR 0x1e // PHI always has this address when it's a controller +#define CONTROLLER_ADDR 0x1e // PHI always has this address when it's a controller // Device type definition const device_type PHI = &device_creator<phi_device>; @@ -250,7 +252,7 @@ void phi_device::set_ext_signal(phi_488_signal_t signal , int state) state = !state; if (m_ext_signals[ signal ] != state) { m_ext_signals[ signal ] = state; - LOG(("EXT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" , + LOG_0(("EXT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" , m_ext_signals[ PHI_488_EOI ] , m_ext_signals[ PHI_488_DAV ] , m_ext_signals[ PHI_488_NRFD ] , @@ -409,7 +411,7 @@ void phi_device::device_reset() void phi_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - LOG(("tmr %d enabled %d\n" , id , timer.enabled())); + LOG_0(("tmr %d enabled %d\n" , id , timer.enabled())); update_fsm(); } @@ -521,7 +523,7 @@ uint8_t phi_device::get_dio(void) void phi_device::set_dio(uint8_t data) { if (data != m_dio) { - LOG(("DIO=%02x\n" , data)); + LOG_0(("DIO=%02x\n" , data)); m_dio = data; if (!m_loopback) { m_dio_write_func(~data); @@ -542,7 +544,7 @@ void phi_device::set_signal(phi_488_signal_t signal , bool state) { if (state != m_signals[ signal ]) { m_signals[ signal ] = state; - LOG(("INT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" , + LOG_0(("INT EOI %d DAV %d NRFD %d NDAC %d IFC %d SRQ %d ATN %d REN %d\n" , m_signals[ PHI_488_EOI ] , m_signals[ PHI_488_DAV ] , m_signals[ PHI_488_NRFD ] , @@ -565,9 +567,16 @@ void phi_device::pon_msg(void) m_t_spms = false; m_l_state = PHI_L_LIDS; m_sr_state = PHI_SR_NPRS; - m_pp_state = PHI_PP_PPIS; m_pp_pacs = false; - m_ppr_msg = my_address(); + uint8_t addr = my_address(); + if (addr <= 7) { + // If address <= 7, PP is automatically enabled and configured for PPR = ~address + m_ppr_msg = addr ^ 7; + m_pp_state = PHI_PP_PPSS; + } else { + m_ppr_msg = 0; + m_pp_state = PHI_PP_PPIS; + } m_s_sense = true; m_c_state = PHI_C_CIDS; m_be_counter = 0; @@ -610,10 +619,10 @@ void phi_device::update_fsm(void) // TODO: RL FSM // Loop until all changes settle while (changed) { - LOG(("SH %d AH %d T %d SPMS %d L %d SR %d PP %d PACS %d PPR %u S %d C %d\n" , + LOG_0(("SH %d AH %d T %d SPMS %d L %d SR %d PP %d PACS %d PPR %u S %d C %d\n" , m_sh_state , m_ah_state , m_t_state , m_t_spms , m_l_state , m_sr_state , m_pp_state , m_pp_pacs , m_ppr_msg , m_s_sense , m_c_state)); - LOG(("O E/F=%d/%d I E/F=%d/%d\n" , m_fifo_out.empty() , m_fifo_out.full() , m_fifo_in.empty() , m_fifo_in.full())); + LOG_0(("O E/F=%d/%d I E/F=%d/%d\n" , m_fifo_out.empty() , m_fifo_out.full() , m_fifo_in.empty() , m_fifo_in.full())); changed = false; // SH FSM @@ -641,7 +650,7 @@ void phi_device::update_fsm(void) if ((m_nba_origin = nba_msg(new_byte , new_eoi)) != NBA_NONE) { m_sh_state = PHI_SH_SDYS; m_sh_dly_timer->adjust(attotime::from_nsec(DELAY_T1)); - LOG(("SH DLY enabled %d\n" , m_sh_dly_timer->enabled())); + LOG_0(("SH DLY enabled %d\n" , m_sh_dly_timer->enabled())); } break; @@ -653,6 +662,7 @@ void phi_device::update_fsm(void) case PHI_SH_STRS: if (!get_signal(PHI_488_NDAC)) { + LOG(("TX %02x/%d\n" , m_dio , m_signals[ PHI_488_EOI ])); m_sh_state = PHI_SH_SGNS; clear_nba((nba_origin_t)m_nba_origin); } @@ -669,15 +679,13 @@ void phi_device::update_fsm(void) // SH outputs // EOI is controlled by SH & C FSMs - bool eoi_signal; + bool eoi_signal = false; + uint8_t dio_byte = 0; set_signal(PHI_488_DAV , m_sh_state == PHI_SH_STRS); if (m_sh_state == PHI_SH_SDYS || m_sh_state == PHI_SH_STRS) { nba_msg(new_byte , new_eoi); - set_dio(new_byte); + dio_byte = new_byte; eoi_signal = new_eoi; - } else { - set_dio(0); - eoi_signal = false; } // AH FSM @@ -705,7 +713,7 @@ void phi_device::update_fsm(void) } // rdy is always true // } else if (!get_signal(PHI_488_ATN) && !rdy_msg()) { - // m_ah_state = PHI_AH_ANRS; + // m_ah_state = PHI_AH_ANRS; // } break; @@ -883,8 +891,9 @@ void phi_device::update_fsm(void) changed = true; } // PP outputs - if (m_pp_state == PHI_PP_PPAS && m_s_sense == !!BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT) && m_ppr_msg <= 7) { - set_dio(1 << m_ppr_msg); + if (m_pp_state == PHI_PP_PPAS && m_s_sense == !!BIT(m_reg_control , REG_CTRL_PP_RESPONSE_BIT)) { + LOG(("PP %u\n" , m_ppr_msg)); + dio_byte |= (1U << m_ppr_msg); } // C FSM @@ -913,11 +922,11 @@ void phi_device::update_fsm(void) m_sh_state != PHI_SH_STRS && m_sh_state != PHI_SH_SDYS) { if (!m_fifo_out.empty()) { // Possible cases - // D0/D1 Meaning of 1st word of OFIFO + // D0/D1 Meaning of 1st word of OFIFO // ===================================== - // x0 Counted transfer enable or byte to be sent - // 11 Uncounted transfer enable - // 01 Send interface command (already caught by nba_msg) + // x0 Counted transfer enable or byte to be sent + // 11 Uncounted transfer enable + // 01 Send interface command (already caught by nba_msg) m_c_state = PHI_C_CSBS; m_be_counter = 0; } else if (rpp_msg()) { @@ -988,6 +997,7 @@ void phi_device::update_fsm(void) m_c_state == PHI_C_CAWS || m_c_state == PHI_C_CTRS); eoi_signal = eoi_signal || m_c_state == PHI_C_CPWS || m_c_state == PHI_C_CPPS; set_signal(PHI_488_EOI , eoi_signal); + set_dio(dio_byte); } // Update status register @@ -1264,7 +1274,7 @@ bool phi_device::if_cmd_received(uint8_t byte) if (m_t_state == PHI_T_TADS) { BIT_SET(word, REG_IFIFO_TALK_BIT); } - m_fifo_in.enqueue(word); + rx_n_data_freeze(word); } } } @@ -1307,20 +1317,15 @@ bool phi_device::byte_received(uint8_t byte , bool eoi) if (m_l_state == PHI_L_LACS) { if (m_fifo_in.full() || BIT(m_reg_int_cond , REG_INT_DEV_CLEAR_BIT)) { // No room for received byte, stall handshake - LOG(("..stalled\n")); + LOG_0(("..stalled\n")); return false; } else { - m_fifo_in.enqueue(word); - LOG(("..OK\n")); - if (m_t_state != PHI_T_TACS && m_t_state != PHI_T_ID3 && - m_t_state != PHI_T_ID5 && m_t_state != PHI_T_SPAS) { - // If PHI didn't send this byte to itself, set data freeze - BIT_SET(m_reg_status, REG_STATUS_DATA_FREEZE_BIT); - } + LOG_0(("..OK\n")); + rx_n_data_freeze(word); } } if (end_of_transfer) { - LOG(("End of byte transfer enable\n")); + LOG_0(("End of byte transfer enable\n")); m_fifo_out.dequeue(); m_be_counter = 0; } else { @@ -1330,6 +1335,15 @@ bool phi_device::byte_received(uint8_t byte , bool eoi) return true; } +void phi_device::rx_n_data_freeze(uint16_t word) +{ + m_fifo_in.enqueue(word); + if (m_sh_state != PHI_SH_STRS) { + // If PHI didn't send this byte to itself, set data freeze + BIT_SET(m_reg_status, REG_STATUS_DATA_FREEZE_BIT); + } +} + bool phi_device::ton_msg(void) const { return BIT(m_reg_address , REG_ADDR_TA_BIT); diff --git a/src/devices/machine/phi.h b/src/devices/machine/phi.h index 84955d290af..bd1a0906143 100644 --- a/src/devices/machine/phi.h +++ b/src/devices/machine/phi.h @@ -2,9 +2,9 @@ // copyright-holders:F. Ulivi /********************************************************************* - phi.h + phi.h - HP PHI (Processor-to-Hpib-Interface) (1AA6-6x04) + HP PHI (Processor-to-Hpib-Interface) (1AA6-6x04) *********************************************************************/ @@ -12,45 +12,45 @@ #define _PHI_H_ // Set read and write callbacks to access DIO bus on IEEE-488 -#define MCFG_PHI_DIO_READWRITE_CB(_read , _write) \ - phi_device::set_dio_read_cb(*device , DEVCB_##_read); \ +#define MCFG_PHI_DIO_READWRITE_CB(_read , _write) \ + phi_device::set_dio_read_cb(*device , DEVCB_##_read); \ phi_device::set_dio_write_cb(*device , DEVCB_##_write); // Set write callbacks to access uniline signals on IEEE-488 -#define MCFG_PHI_EOI_WRITE_CB(_write) \ +#define MCFG_PHI_EOI_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_EOI , DEVCB_##_write); -#define MCFG_PHI_DAV_WRITE_CB(_write) \ +#define MCFG_PHI_DAV_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_DAV , DEVCB_##_write); -#define MCFG_PHI_NRFD_WRITE_CB(_write) \ +#define MCFG_PHI_NRFD_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_NRFD , DEVCB_##_write); -#define MCFG_PHI_NDAC_WRITE_CB(_write) \ +#define MCFG_PHI_NDAC_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_NDAC , DEVCB_##_write); -#define MCFG_PHI_IFC_WRITE_CB(_write) \ +#define MCFG_PHI_IFC_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_IFC , DEVCB_##_write); -#define MCFG_PHI_SRQ_WRITE_CB(_write) \ +#define MCFG_PHI_SRQ_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_SRQ , DEVCB_##_write); -#define MCFG_PHI_ATN_WRITE_CB(_write) \ +#define MCFG_PHI_ATN_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_ATN , DEVCB_##_write); -#define MCFG_PHI_REN_WRITE_CB(_write) \ +#define MCFG_PHI_REN_WRITE_CB(_write) \ phi_device::set_488_signal_write_cb(*device , phi_device::PHI_488_REN , DEVCB_##_write); // Set write callback for INT signal -#define MCFG_PHI_INT_WRITE_CB(_write) \ +#define MCFG_PHI_INT_WRITE_CB(_write) \ phi_device::set_int_write_cb(*device , DEVCB_##_write); // Set write callback for DMARQ signal -#define MCFG_PHI_DMARQ_WRITE_CB(_write) \ +#define MCFG_PHI_DMARQ_WRITE_CB(_write) \ phi_device::set_dmarq_write_cb(*device , DEVCB_##_write); // Depth of inbound/outbound FIFOs -#define PHI_FIFO_SIZE 8 +#define PHI_FIFO_SIZE 8 class phi_device : public device_t { @@ -102,22 +102,22 @@ public: // Mapping of PHI register bits: // Reg. bit PHI bit // ================= - // 15 0 - // 14 1 - // 13 =0= - // 12 =0= - // 11 =0= - // 10 =0= - // 9 =0= - // 8 =0= - // 7 8 - // 6 9 - // 5 10 - // 4 11 - // 3 12 - // 2 13 - // 1 14 - // 0 15 + // 15 0 + // 14 1 + // 13 =0= + // 12 =0= + // 11 =0= + // 10 =0= + // 9 =0= + // 8 =0= + // 7 8 + // 6 9 + // 5 10 + // 4 11 + // 3 12 + // 2 13 + // 1 14 + // 0 15 DECLARE_WRITE16_MEMBER(reg16_w); DECLARE_READ16_MEMBER(reg16_r); DECLARE_WRITE8_MEMBER(reg8_w); @@ -153,8 +153,8 @@ private: // SH (Source Handshake) states enum { - PHI_SH_SIDS, // & SIWS - PHI_SH_SGNS, // & SWNS + PHI_SH_SIDS, // & SIWS + PHI_SH_SGNS, // & SWNS PHI_SH_SDYS, PHI_SH_STRS }; @@ -167,7 +167,7 @@ private: PHI_AH_ANRS, PHI_AH_ACRS, PHI_AH_ACDS, - PHI_AH_ACDS_FROZEN, // Non-standard state: IF CMD rejected because of even parity + PHI_AH_ACDS_FROZEN, // Non-standard state: IF CMD rejected because of even parity PHI_AH_AWNS }; @@ -180,16 +180,16 @@ private: PHI_T_SPAS, PHI_T_TACS, // The following are non-standard states for IDENTIFY sequencing - PHI_T_ID1, // Untalked - PHI_T_ID2, // Addressed by secondary address - PHI_T_ID3, // Sending 1st byte - PHI_T_ID4, // Waiting to send 2nd byte - PHI_T_ID5, // Sending 2nd byte - PHI_T_ID6 // 2nd byte sent, end of sequence + PHI_T_ID1, // Untalked + PHI_T_ID2, // Addressed by secondary address + PHI_T_ID3, // Sending 1st byte + PHI_T_ID4, // Waiting to send 2nd byte + PHI_T_ID5, // Sending 2nd byte + PHI_T_ID6 // 2nd byte sent, end of sequence }; int m_t_state; - bool m_t_spms; // False: SPIS, true: SPMS + bool m_t_spms; // False: SPIS, true: SPMS // L (Listener) states enum { @@ -276,6 +276,7 @@ private: void clear_nba(nba_origin_t origin); bool if_cmd_received(uint8_t byte); bool byte_received(uint8_t byte , bool eoi); + void rx_n_data_freeze(uint16_t word); bool ton_msg(void) const; bool lon_msg(void) const; bool odd_parity(uint8_t byte) const; diff --git a/src/devices/machine/tms1024.cpp b/src/devices/machine/tms1024.cpp index d9a268a1280..a1d4cd551db 100644 --- a/src/devices/machine/tms1024.cpp +++ b/src/devices/machine/tms1024.cpp @@ -24,19 +24,19 @@ const device_type TMS1025 = &device_creator<tms1025_device>; // constructor //------------------------------------------------- -tms1024_device::tms1024_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1024_device::tms1024_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, TMS1024, "TMS1024 I/O Expander", tag, owner, clock, "tms1024", __FILE__), m_h(0), m_s(0), m_std(0), m_write_port1(*this), m_write_port2(*this), m_write_port3(*this), m_write_port4(*this), m_write_port5(*this), m_write_port6(*this), m_write_port7(*this) { } -tms1024_device::tms1024_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) +tms1024_device::tms1024_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), m_h(0), m_s(0), m_std(0), m_write_port1(*this), m_write_port2(*this), m_write_port3(*this), m_write_port4(*this), m_write_port5(*this), m_write_port6(*this), m_write_port7(*this) { } -tms1025_device::tms1025_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms1025_device::tms1025_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms1024_device(mconfig, TMS1025, "TMS1025 I/O Expander", tag, owner, clock, "tms1025", __FILE__) { } diff --git a/src/devices/machine/tms1024.h b/src/devices/machine/tms1024.h index 323b083e841..54524d27939 100644 --- a/src/devices/machine/tms1024.h +++ b/src/devices/machine/tms1024.h @@ -17,7 +17,7 @@ // 4-bit ports (3210 = DCBA) // valid ports: 4-7 for TMS1024, 1-7 for TMS1025 #define MCFG_TMS1024_WRITE_PORT_CB(X, _devcb) \ - tms1024_device::set_write_port##X##_callback(*device, DEVCB_##_devcb); + devcb = &tms1024_device::set_write_port##X##_callback(*device, DEVCB_##_devcb); enum { @@ -64,8 +64,8 @@ enum class tms1024_device : public device_t { public: - tms1024_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms1024_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); + tms1024_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms1024_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); // static configuration helpers template<class _Object> static devcb_base &set_write_port1_callback(device_t &device, _Object object) { return downcast<tms1024_device &>(device).m_write_port1.set_callback(object); } @@ -85,9 +85,9 @@ protected: virtual void device_start() override; virtual void device_reset() override; - uint8_t m_h; // 4-bit data latch - uint8_t m_s; // 3-bit port select - uint8_t m_std; // strobe pin + u8 m_h; // 4-bit data latch + u8 m_s; // 3-bit port select + u8 m_std; // strobe pin // callbacks devcb_write8 m_write_port1, m_write_port2, m_write_port3, m_write_port4, m_write_port5, m_write_port6, m_write_port7; @@ -98,7 +98,7 @@ protected: class tms1025_device : public tms1024_device { public: - tms1025_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tms1025_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); }; diff --git a/src/devices/machine/tms6100.cpp b/src/devices/machine/tms6100.cpp index fd28ffeae2d..6068a5865aa 100644 --- a/src/devices/machine/tms6100.cpp +++ b/src/devices/machine/tms6100.cpp @@ -27,7 +27,7 @@ const device_type TMS6100 = &device_creator<tms6100_device>; -tms6100_device::tms6100_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) +tms6100_device::tms6100_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), m_rom(*this, DEVICE_SELF), m_reverse_bits(false), @@ -35,7 +35,7 @@ tms6100_device::tms6100_device(const machine_config &mconfig, device_type type, { } -tms6100_device::tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tms6100_device::tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, TMS6100, "TMS6100", tag, owner, clock, "tms6100", __FILE__), m_rom(*this, DEVICE_SELF), m_reverse_bits(false), @@ -45,7 +45,7 @@ tms6100_device::tms6100_device(const machine_config &mconfig, const char *tag, d const device_type M58819 = &device_creator<m58819_device>; -m58819_device::m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +m58819_device::m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : tms6100_device(mconfig, M58819, "M58819S", tag, owner, clock, "m58819s", __FILE__) { } @@ -144,7 +144,7 @@ WRITE_LINE_MEMBER(tms6100_device::clk_w) if (m_cs) { // new command enabled on rising edge of m0/m1 - uint8_t m = m_m1 << 1 | m_m0; + u8 m = m_m1 << 1 | m_m0; if ((m & ~m_prev_m & 1) || (m & ~m_prev_m & 2)) handle_command(m); @@ -158,7 +158,7 @@ WRITE_LINE_MEMBER(tms6100_device::clk_w) // m0/m1 commands -void tms6100_device::handle_command(uint8_t cmd) +void tms6100_device::handle_command(u8 cmd) { enum { @@ -229,7 +229,7 @@ void tms6100_device::handle_command(uint8_t cmd) // the 8-step counter PLA is shared between LA and TB if (m_count < 4) { - const uint8_t shift = 4 * (m_count+1); + const u8 shift = 4 * (m_count+1); m_address = (m_address & ~(0xf << shift)) | (m_add << shift); } @@ -245,7 +245,7 @@ void tms6100_device::handle_command(uint8_t cmd) m_count = 0; // load new address bits (14 bits on TMS6100) - uint16_t rb = m_rom[m_address & m_rommask]; + u16 rb = m_rom[m_address & m_rommask]; m_address++; rb |= (m_rom[m_address & m_rommask] << 8); m_address = (m_address & ~0x3fff) | (rb & 0x3fff); diff --git a/src/devices/machine/tms6100.h b/src/devices/machine/tms6100.h index 93a4f06826f..e36cf12615e 100644 --- a/src/devices/machine/tms6100.h +++ b/src/devices/machine/tms6100.h @@ -94,8 +94,8 @@ class tms6100_device : public device_t { public: - tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - tms6100_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); + tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + tms6100_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); static void enable_4bit_mode(device_t &device) { downcast<tms6100_device &>(device).m_4bit_mode = true; } @@ -113,34 +113,34 @@ protected: // device-level overrides virtual void device_start() override; - void handle_command(uint8_t cmd); + void handle_command(u8 cmd); // internal state - required_region_ptr<uint8_t> m_rom; + required_region_ptr<u8> m_rom; bool m_reverse_bits; bool m_4bit_mode; - uint32_t m_rommask; - uint32_t m_address; // internal address + chipselect - uint8_t m_sa; // romdata shift register - uint8_t m_count; // TB/LA counter (-> PLA) - uint8_t m_prev_cmd; // previous handled command - uint8_t m_prev_m; // previous valid m0/m1 state + u32 m_rommask; + u32 m_address; // internal address + chipselect + u8 m_sa; // romdata shift register + u8 m_count; // TB/LA counter (-> PLA) + u8 m_prev_cmd; // previous handled command + u8 m_prev_m; // previous valid m0/m1 state - uint8_t m_add; // ADD/DATA pins input - uint8_t m_data; // ADD/DATA pins output + u8 m_add; // ADD/DATA pins input + u8 m_data; // ADD/DATA pins output int m_m0; int m_m1; - int m_cs; // chipselect pin - int m_clk; // CLK pin - int m_rck; // RCK pin (mask/gate to CLK?) + int m_cs; // chipselect pin + int m_clk; // CLK pin + int m_rck; // RCK pin (mask/gate to CLK?) }; class m58819_device : public tms6100_device { public: - m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h index 9da63ed2484..4120754a599 100644 --- a/src/devices/machine/upd765.h +++ b/src/devices/machine/upd765.h @@ -130,7 +130,7 @@ public: void tc_w(bool val) override; void ready_w(bool val); - DECLARE_WRITE_LINE_MEMBER(tc_line_w) { tc_w(state == ASSERT_LINE); } + DECLARE_WRITE_LINE_MEMBER(tc_line_w) { tc_w(state == ASSERT_LINE); } void set_rate(int rate); // rate in bps, to be used when the fdc is externally frequency-controlled diff --git a/src/devices/machine/wd7600.h b/src/devices/machine/wd7600.h index 8363018d30d..fa3a4323e0d 100644 --- a/src/devices/machine/wd7600.h +++ b/src/devices/machine/wd7600.h @@ -26,31 +26,31 @@ wd7600_device::static_set_keybctag(*device, _keybctag); #define MCFG_WD7600_IOR(_ior) \ - downcast<wd7600_device *>(device)->set_ior_callback(DEVCB_##_ior); + devcb = &downcast<wd7600_device *>(device)->set_ior_callback(DEVCB_##_ior); #define MCFG_WD7600_IOW(_iow) \ - downcast<wd7600_device *>(device)->set_iow_callback(DEVCB_##_iow); + devcb = &downcast<wd7600_device *>(device)->set_iow_callback(DEVCB_##_iow); #define MCFG_WD7600_TC(_tc) \ - downcast<wd7600_device *>(device)->set_tc_callback(DEVCB_##_tc); + devcb = &downcast<wd7600_device *>(device)->set_tc_callback(DEVCB_##_tc); #define MCFG_WD7600_HOLD(_hold) \ - downcast<wd7600_device *>(device)->set_hold_callback(DEVCB_##_hold); + devcb = &downcast<wd7600_device *>(device)->set_hold_callback(DEVCB_##_hold); #define MCFG_WD7600_NMI(_nmi) \ - downcast<wd7600_device *>(device)->set_nmi_callback(DEVCB_##_nmi); + devcb = &downcast<wd7600_device *>(device)->set_nmi_callback(DEVCB_##_nmi); #define MCFG_WD7600_INTR(_intr) \ - downcast<wd7600_device *>(device)->set_intr_callback(DEVCB_##_intr); + devcb = &downcast<wd7600_device *>(device)->set_intr_callback(DEVCB_##_intr); #define MCFG_WD7600_CPURESET(_cpureset) \ - downcast<wd7600_device *>(device)->set_cpureset_callback(DEVCB_##_cpureset); + devcb = &downcast<wd7600_device *>(device)->set_cpureset_callback(DEVCB_##_cpureset); #define MCFG_WD7600_A20M(_a20m) \ - downcast<wd7600_device *>(device)->set_a20m_callback(DEVCB_##_a20m); + devcb = &downcast<wd7600_device *>(device)->set_a20m_callback(DEVCB_##_a20m); #define MCFG_WD7600_SPKR(_spkr) \ - downcast<wd7600_device *>(device)->set_spkr_callback(DEVCB_##_spkr); + devcb = &downcast<wd7600_device *>(device)->set_spkr_callback(DEVCB_##_spkr); //************************************************************************** @@ -69,15 +69,15 @@ public: virtual machine_config_constructor device_mconfig_additions() const override; // callbacks - template<class _ior> void set_ior_callback(_ior ior) { m_read_ior.set_callback(ior); } - template<class _iow> void set_iow_callback(_iow iow) { m_write_iow.set_callback(iow); } - template<class _tc> void set_tc_callback(_tc tc) { m_write_tc.set_callback(tc); } - template<class _hold> void set_hold_callback(_hold hold) { m_write_hold.set_callback(hold); } - template<class _cpureset> void set_cpureset_callback(_cpureset cpureset) { m_write_cpureset.set_callback(cpureset); } - template<class _nmi> void set_nmi_callback(_nmi nmi) { m_write_nmi.set_callback(nmi); } - template<class _intr> void set_intr_callback(_intr intr) { m_write_intr.set_callback(intr); } - template<class _a20m> void set_a20m_callback(_a20m a20m) { m_write_a20m.set_callback(a20m); } - template<class _spkr> void set_spkr_callback(_spkr spkr) { m_write_spkr.set_callback(spkr); } + template<class _ior> devcb_base &set_ior_callback(_ior ior) { return m_read_ior.set_callback(ior); } + template<class _iow> devcb_base &set_iow_callback(_iow iow) { return m_write_iow.set_callback(iow); } + template<class _tc> devcb_base &set_tc_callback(_tc tc) { return m_write_tc.set_callback(tc); } + template<class _hold> devcb_base &set_hold_callback(_hold hold) { return m_write_hold.set_callback(hold); } + template<class _cpureset> devcb_base &set_cpureset_callback(_cpureset cpureset) { return m_write_cpureset.set_callback(cpureset); } + template<class _nmi> devcb_base &set_nmi_callback(_nmi nmi) { return m_write_nmi.set_callback(nmi); } + template<class _intr> devcb_base &set_intr_callback(_intr intr) { return m_write_intr.set_callback(intr); } + template<class _a20m> devcb_base &set_a20m_callback(_a20m a20m) { return m_write_a20m.set_callback(a20m); } + template<class _spkr> devcb_base &set_spkr_callback(_spkr spkr) { return m_write_spkr.set_callback(spkr); } // inline configuration static void static_set_cputag(device_t &device, const char *tag); diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index c08026c95c3..e2d4291b467 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -1,4 +1,5 @@ -// license:BSD-3-Clause copyright-holders: Joakim Larsson Edstrom +// license:BSD-3-Clause +// copyright-holders: Joakim Larsson Edstrom /*************************************************************************** Z80-SCC Serial Communications Controller emulation @@ -72,41 +73,41 @@ DONE (x) (p=partly) NMOS CMOS ESCC EMSCC #include "z80scc.h" + //************************************************************************** -// MACROS / CONSTANTS +// CONFIGURABLE LOGGING //************************************************************************** -#define LOG_GENERAL 0x001 -#define LOG_SETUP 0x002 -#define LOG_PRINTF 0x004 -#define LOG_READ 0x008 -#define LOG_INT 0x010 -#define LOG_CMD 0x020 -#define LOG_TX 0x040 -#define LOG_RCV 0x080 -#define LOG_CTS 0x100 -#define LOG_DCD 0x200 -#define LOG_SYNC 0x400 - -#define VERBOSE 0 // (LOG_PRINTF | LOG_SETUP | LOG_GENERAL) - -#define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) -#define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) - -#define LOG(...) LOGMASK(LOG_GENERAL, __VA_ARGS__) -#define LOGSETUP(...) LOGMASK(LOG_SETUP, __VA_ARGS__) -#define LOGR(...) LOGMASK(LOG_READ, __VA_ARGS__) -#define LOGINT(...) LOGMASK(LOG_INT, __VA_ARGS__) -#define LOGCMD(...) LOGMASK(LOG_CMD, __VA_ARGS__) -#define LOGTX(...) LOGMASK(LOG_TX, __VA_ARGS__) -#define LOGRCV(...) LOGMASK(LOG_RCV, __VA_ARGS__) -#define LOGCTS(...) LOGMASK(LOG_CTS, __VA_ARGS__) -#define LOGDCD(...) LOGMASK(LOG_DCD, __VA_ARGS__) -#define LOGSYNC(...) LOGMASK(LOG_SYNC, __VA_ARGS__) - -#if VERBOSE & LOG_PRINTF -#define logerror printf -#endif +#define LOG_GENERAL (1U << 0) +#define LOG_SETUP (1U << 1) +#define LOG_PRINTF (1U << 2) +#define LOG_READ (1U << 3) +#define LOG_INT (1U << 4) +#define LOG_CMD (1U << 5) +#define LOG_TX (1U << 6) +#define LOG_RCV (1U << 7) +#define LOG_CTS (1U << 8) +#define LOG_DCD (1U << 9) +#define LOG_SYNC (1U << 10) + +//#define VERBOSE (LOG_GENERAL | LOG_SETUP) +//#define LOG_OUTPUT_FUNC printf +#include "logmacro.h" + +#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) +#define LOGR(...) LOGMASKED(LOG_READ, __VA_ARGS__) +#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__) +#define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__) +#define LOGTX(...) LOGMASKED(LOG_TX, __VA_ARGS__) +#define LOGRCV(...) LOGMASKED(LOG_RCV, __VA_ARGS__) +#define LOGCTS(...) LOGMASKED(LOG_CTS, __VA_ARGS__) +#define LOGDCD(...) LOGMASKED(LOG_DCD, __VA_ARGS__) +#define LOGSYNC(...) LOGMASKED(LOG_SYNC, __VA_ARGS__) + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** #ifdef _MSC_VER #define FUNCNAME __func__ diff --git a/src/devices/sound/amiga.h b/src/devices/sound/amiga.h deleted file mode 100644 index b1b89e09cc5..00000000000 --- a/src/devices/sound/amiga.h +++ /dev/null @@ -1,65 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - Amiga audio hardware - -***************************************************************************/ - -#pragma once - -#ifndef __SOUND_AMIGA_H__ -#define __SOUND_AMIGA_H__ - -#include "emu.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> amiga_sound_device - -class amiga_sound_device : public device_t, public device_sound_interface -{ -public: - amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - ~amiga_sound_device() {} - - void update(); - void data_w(int which, uint16_t data); - -protected: - // device-level overrides - virtual void device_start() 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: - static const int CLOCK_DIVIDER = 16; - - struct audio_channel - { - emu_timer *irq_timer; - uint32_t curlocation; - uint16_t curlength; - uint16_t curticks; - uint8_t index; - bool dma_enabled; - bool manualmode; - int8_t latched; - }; - - void dma_reload(audio_channel *chan); - - // internal state - audio_channel m_channel[4]; - sound_stream *m_stream; - - TIMER_CALLBACK_MEMBER( signal_irq ); -}; - -extern const device_type AMIGA; - -#endif // __SOUND_AMIGA_H__ diff --git a/src/devices/sound/asc.h b/src/devices/sound/asc.h index 6363732d219..c9bbc7ae868 100644 --- a/src/devices/sound/asc.h +++ b/src/devices/sound/asc.h @@ -53,7 +53,7 @@ enum #define MCFG_ASC_TYPE(_type) \ asc_device::static_set_type(*device, _type); #define MCFG_IRQ_FUNC(_irqf) \ - downcast<asc_device *>(device)->set_irqf(DEVCB_##_irqf); + devcb = &downcast<asc_device *>(device)->set_irqf(DEVCB_##_irqf); //************************************************************************** // TYPE DEFINITIONS @@ -71,9 +71,9 @@ public: static void static_set_type(device_t &device, int type); - template<class _write> void set_irqf(_write wr) + template<class _write> devcb_base &set_irqf(_write wr) { - write_irq.set_callback(wr); + return write_irq.set_callback(wr); } devcb_write_line write_irq; diff --git a/src/mame/audio/dave.cpp b/src/devices/sound/dave.cpp index 69a7f2aec6f..69a7f2aec6f 100644 --- a/src/mame/audio/dave.cpp +++ b/src/devices/sound/dave.cpp diff --git a/src/mame/audio/dave.h b/src/devices/sound/dave.h index 95bcf38fe92..95bcf38fe92 100644 --- a/src/mame/audio/dave.h +++ b/src/devices/sound/dave.h diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp index e7f5aa1fd75..ec5a546bab2 100644 --- a/src/devices/sound/es8712.cpp +++ b/src/devices/sound/es8712.cpp @@ -7,9 +7,14 @@ * * Samples are currently looped, but whether they should and how, is unknown. * Interface to the chip is also not 100% clear. - * Should there be any status signals signifying busy, end of sample - etc? * - * Heavily borrowed from the OKI M6295 source + * This implementation, heavily borrowed from the OKI M6295 source, is based on + * almost certainly incorrect assumptions about the chip's nature. It seems + * that the ES8712 is actually a programmable counter which can stream ADPCM + * samples when hooked up to a ROM and a M5205 or M6585 (whose VCK signal can + * drive the counter). Neither of these seem to be used in conjunction with the + * ES8712 on Dream 9 and Dream 9 Final, which suggests it may have been used + * for an entirely different purpose there (perhaps to do with video timing). * **********************************************************************************************/ @@ -325,7 +330,7 @@ void es8712_device::play() * ***********************************************************************************************/ -WRITE8_MEMBER( es8712_device::es8712_w ) +WRITE8_MEMBER(es8712_device::write) { switch (offset) { @@ -347,3 +352,12 @@ WRITE8_MEMBER( es8712_device::es8712_w ) } m_start &= 0xfffff; m_end &= 0xfffff; } + +READ8_MEMBER(es8712_device::read) +{ + // busy state (other bits unknown) + if (offset == 0) + return m_playing ? 1 : 0; + + return 0; +} diff --git a/src/devices/sound/es8712.h b/src/devices/sound/es8712.h index a2f73209930..d56494f894f 100644 --- a/src/devices/sound/es8712.h +++ b/src/devices/sound/es8712.h @@ -40,7 +40,8 @@ protected: virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; public: - DECLARE_WRITE8_MEMBER( es8712_w ); + DECLARE_WRITE8_MEMBER(write); + DECLARE_READ8_MEMBER(read); public: void play(); diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp index 845e10737ac..9d84cae1dd4 100644 --- a/src/devices/sound/msm5205.cpp +++ b/src/devices/sound/msm5205.cpp @@ -61,28 +61,23 @@ const device_type MSM6585 = &device_creator<msm6585_device>; msm5205_device::msm5205_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, MSM5205, "MSM5205", tag, owner, clock, "msm5205", __FILE__), - device_sound_interface(mconfig, *this), - m_s1(false), - m_s2(false), - m_bitwidth(4), - m_vclk_cb(*this) + : msm5205_device(mconfig, MSM5205, "MSM5205", tag, owner, clock, "msm5205", __FILE__) { } msm5205_device::msm5205_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_sound_interface(mconfig, *this), - m_s1(false), - m_s2(false), - m_bitwidth(4), - m_vclk_cb(*this) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_sound_interface(mconfig, *this), + m_s1(false), + m_s2(false), + m_bitwidth(4), + m_vclk_cb(*this) { } msm6585_device::msm6585_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msm5205_device(mconfig, MSM6585, "MSM6585", tag, owner, clock, "msm6585", __FILE__) + : msm5205_device(mconfig, MSM6585, "MSM6585", tag, owner, clock, "msm6585", __FILE__) { } diff --git a/src/devices/sound/saa1099.cpp b/src/devices/sound/saa1099.cpp index 4ea28c6adcf..b43103ca73c 100644 --- a/src/devices/sound/saa1099.cpp +++ b/src/devices/sound/saa1099.cpp @@ -221,7 +221,7 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t * case 0: m_noise[ch].freq = m_master_clock/256.0 * 2; break; case 1: m_noise[ch].freq = m_master_clock/512.0 * 2; break; case 2: m_noise[ch].freq = m_master_clock/1024.0 * 2; break; - case 3: m_noise[ch].freq = m_channels[ch * 3].freq; break; + case 3: m_noise[ch].freq = m_channels[ch * 3].freq; break; // todo: this case will be m_master_clock/[ch*3's octave divisor, 0 is = 256*2, higher numbers are higher] * 2 if the tone generator phase reset bit (0x1c bit 1) is set. } } @@ -280,12 +280,14 @@ void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t * for (ch = 0; ch < 2; ch++) { - /* check the actual position in noise generator */ + /* update the state of the noise generator + * polynomial is x^18 + x^11 + x (i.e. 0x20400) and is a plain XOR, initial state is probably all 1s + * see http://www.vogons.org/viewtopic.php?f=9&t=51695 */ m_noise[ch].counter -= m_noise[ch].freq; while (m_noise[ch].counter < 0) { m_noise[ch].counter += m_sample_rate; - if( ((m_noise[ch].level & 0x4000) == 0) == ((m_noise[ch].level & 0x0040) == 0) ) + if( ((m_noise[ch].level & 0x20000) == 0) != ((m_noise[ch].level & 0x0400) == 0) ) m_noise[ch].level = (m_noise[ch].level << 1) | 1; else m_noise[ch].level <<= 1; diff --git a/src/devices/sound/saa1099.h b/src/devices/sound/saa1099.h index 58b29c58989..6863bd73e76 100644 --- a/src/devices/sound/saa1099.h +++ b/src/devices/sound/saa1099.h @@ -56,12 +56,12 @@ struct saa1099_noise saa1099_noise() : counter(0.0), freq(0.0), - level(0) {} + level(0xFFFFFFFF) {} /* vars to simulate the noise generator output */ double counter; double freq; - int level; /* noise polynomial shifter */ + uint32_t level; /* noise polynomial shifter */ }; diff --git a/src/devices/sound/t6721a.h b/src/devices/sound/t6721a.h index 784050ab553..8da6737c9ea 100644 --- a/src/devices/sound/t6721a.h +++ b/src/devices/sound/t6721a.h @@ -44,16 +44,16 @@ //************************************************************************** #define MCFG_T6721A_EOS_HANDLER(_eos) \ - downcast<t6721a_device *>(device)->set_eos_callback(DEVCB_##_eos); + devcb = &downcast<t6721a_device *>(device)->set_eos_callback(DEVCB_##_eos); #define MCFG_T6721A_PHI2_HANDLER(_phi2) \ - downcast<t6721a_device *>(device)->set_phi2_callback(DEVCB_##_phi2); + devcb = &downcast<t6721a_device *>(device)->set_phi2_callback(DEVCB_##_phi2); #define MCFG_T6721A_DTRD_HANDLER(_dtrd) \ - downcast<t6721a_device *>(device)->set_dtrd_callback(DEVCB_##_dtrd); + devcb = &downcast<t6721a_device *>(device)->set_dtrd_callback(DEVCB_##_dtrd); #define MCFG_T6721A_APD_HANDLER(_apd) \ - downcast<t6721a_device *>(device)->set_apd_callback(DEVCB_##_apd); + devcb = &downcast<t6721a_device *>(device)->set_apd_callback(DEVCB_##_apd); @@ -70,10 +70,10 @@ public: t6721a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration helpers - template<class _eos> void set_eos_callback(_eos eos) { m_write_eos.set_callback(eos); } - template<class _phi2> void set_phi2_callback(_phi2 phi2) { m_write_phi2.set_callback(phi2); } - template<class _dtrd> void set_dtrd_callback(_dtrd dtrd) { m_write_dtrd.set_callback(dtrd); } - template<class _apd> void set_apd_callback(_apd apd) { m_write_apd.set_callback(apd); } + template<class _eos> devcb_base &set_eos_callback(_eos eos) { return m_write_eos.set_callback(eos); } + template<class _phi2> devcb_base &set_phi2_callback(_phi2 phi2) { return m_write_phi2.set_callback(phi2); } + template<class _dtrd> devcb_base &set_dtrd_callback(_dtrd dtrd) { return m_write_dtrd.set_callback(dtrd); } + template<class _apd> devcb_base &set_apd_callback(_apd apd) { return m_write_apd.set_callback(apd); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp new file mode 100644 index 00000000000..eb9f6271c07 --- /dev/null +++ b/src/devices/video/hlcd0515.cpp @@ -0,0 +1,203 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Hughes HLCD 0515/0569 LCD Driver + + 0515: 25 columns(also size of buffer/ram) + 0569: 24 columns, no DATA OUT pin, display blank has no effect + + TODO: + - read mode is untested + - MAME bitmap update callback when needed + +*/ + +#include "video/hlcd0515.h" + + +const device_type HLCD0515 = &device_creator<hlcd0515_device>; +const device_type HLCD0569 = &device_creator<hlcd0569_device>; + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 colmax, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_colmax(colmax), m_write_cols(*this), m_write_data(*this) +{ +} + +hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : hlcd0515_device(mconfig, HLCD0515, "HLCD 0515 LCD Driver", tag, owner, clock, 25, "hlcd0515", __FILE__) +{ +} + +hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : hlcd0515_device(mconfig, HLCD0569, "HLCD 0569 LCD Driver", tag, owner, clock, 24, "hlcd0569", __FILE__) +{ +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hlcd0515_device::device_start() +{ + // resolve callbacks + m_write_cols.resolve_safe(); + m_write_data.resolve_safe(); + + // timer + m_lcd_timer = timer_alloc(); + m_lcd_timer->adjust(attotime::from_hz(clock() / 2), 0, attotime::from_hz(clock() / 2)); + + // zerofill + m_cs = 0; + m_clock = 0; + m_data = 0; + m_count = 0; + m_control = 0; + m_blank = false; + m_rowmax = 0; + m_rowout = 0; + m_rowsel = 0; + m_buffer = 0; + memset(m_ram, 0, sizeof(m_ram)); + + // register for savestates + save_item(NAME(m_cs)); + save_item(NAME(m_clock)); + save_item(NAME(m_data)); + save_item(NAME(m_count)); + save_item(NAME(m_control)); + save_item(NAME(m_blank)); + save_item(NAME(m_rowmax)); + save_item(NAME(m_rowout)); + save_item(NAME(m_rowsel)); + save_item(NAME(m_buffer)); + save_item(NAME(m_ram)); +} + + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void hlcd0515_device::device_reset() +{ +} + + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void hlcd0515_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (m_rowout > m_rowmax) + m_rowout = 0; + + // write to COL/ROW pins + m_write_cols(m_rowout, m_blank ? 0 : m_ram[m_rowout], 0xffffffff); + m_rowout++; +} + + + +//------------------------------------------------- +// handlers +//------------------------------------------------- + +void hlcd0515_device::set_control() +{ + // clock 0,1,2: row select + m_rowsel = m_control >> 2 & 7; + + // clock 3(,4): initialize + if (m_control & 2) + { + m_rowmax = m_rowsel; + m_blank = bool(~m_control & 1); + } + + // clock 4: read/write mode + m_buffer = (m_control & 1) ? m_ram[m_rowsel] : 0; +} + +void hlcd0569_device::set_control() +{ + hlcd0515_device::set_control(); + m_blank = false; // 0569 doesn't support display blanking +} + + +void hlcd0515_device::clock_data(int col) +{ + if (m_control & 1) + { + if (col < m_colmax) + m_buffer <<= 1; + + m_write_data(m_buffer >> m_colmax & 1); + } + else + { + if (col < m_colmax) + m_buffer >>= 1; + + // always write last column + u32 mask = 1 << (m_colmax - 1); + m_buffer = (m_buffer & ~mask) | (m_data ? mask : 0); + } +} + + +WRITE_LINE_MEMBER(hlcd0515_device::write_clock) +{ + state = (state) ? 1 : 0; + + // clock/shift data on falling edge + if (!m_cs && !state && m_clock) + { + if (m_count < 5) + { + // 5-bit mode/control + m_control = m_control << 1 | m_data; + if (m_count == 4) + set_control(); + } + + else + clock_data(m_count - 5); + + if (m_count < (m_colmax + 5)) + m_count++; + } + + m_clock = state; +} + + +WRITE_LINE_MEMBER(hlcd0515_device::write_cs) +{ + state = (state) ? 1 : 0; + + // finish serial sequence on rising edge + if (state && !m_cs) + { + // transfer to ram + if (~m_control & 1) + m_ram[m_rowsel] = m_buffer; + + m_count = 0; + m_control = 0; + } + + m_cs = state; +} diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h new file mode 100644 index 00000000000..a09af404b55 --- /dev/null +++ b/src/devices/video/hlcd0515.h @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Hughes HLCD 0515/0569 LCD Driver + +*/ + +#ifndef _HLCD0515_H_ +#define _HLCD0515_H_ + +#include "emu.h" + + +// COL/ROW pins (offset for ROW) +#define MCFG_HLCD0515_WRITE_COLS_CB(_devcb) \ + hlcd0515_device::set_write_cols_callback(*device, DEVCB_##_devcb); + +// DATA OUT pin, don't use on HLCD0569 +#define MCFG_HLCD0515_WRITE_DATA_CB(_devcb) \ + hlcd0515_device::set_write_data_callback(*device, DEVCB_##_devcb); + + +// pinout reference + +/* + ____ ____ + ROW0 1 |* \_/ | 40 VDD + ROW1 2 | | 39 OSC + ROW2 3 | | 38 CLOCK + ROW3 4 | | 37 DATA IN + ROW4 5 | | 36 _CS + ROW5 6 | | 35 DATA OUT + ROW6 7 | | 34 COL25 + ROW7 8 | | 33 COL24 + COL1 9 | | 32 COL23 + COL2 10 | HLCD 0515 | 31 COL22 + COL3 11 | | 30 COL21 + COL4 12 | | 29 COL20 + COL5 13 | | 28 COL19 + COL6 14 | | 27 COL18 + COL7 15 | | 26 COL17 + COL8 16 | | 25 COL16 + COL9 17 | | 24 COL15 + COL10 18 | | 23 COL14 + COL11 19 | | 22 COL13 + GND 20 |___________| 21 COL12 + + HLCD 0569 doesn't have DATA OUT, instead it has what seems like OSC OUT on pin 34. + + OSC is tied to a capacitor, the result frequency is 50000 * cap(in uF), eg. 0.01uF cap = 500Hz. + Internally, this is divided by 2, and by number of rows to get display refresh frequency. +*/ + +class hlcd0515_device : public device_t +{ +public: + hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + hlcd0515_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 colmax, const char *shortname, const char *source); + + // static configuration helpers + template<class _Object> static devcb_base &set_write_cols_callback(device_t &device, _Object object) { return downcast<hlcd0515_device &>(device).m_write_cols.set_callback(object); } + template<class _Object> static devcb_base &set_write_data_callback(device_t &device, _Object object) { return downcast<hlcd0515_device &>(device).m_write_data.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER(write_clock); + DECLARE_WRITE_LINE_MEMBER(write_cs); + DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; } + +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; + + virtual void set_control(); + void clock_data(int col); + + u8 m_colmax; // number of column pins + + int m_cs; // input pin state + int m_clock; // " + int m_data; // " + int m_count; + u8 m_control; + bool m_blank; // display blank/visible + u8 m_rowmax; // number of rows output by lcd (max 8) + u8 m_rowout; // current row for lcd output + u8 m_rowsel; // current row for data in/out + u32 m_buffer; // data in/out shift register + u32 m_ram[8]; // internal lcd ram, 8 rows + + emu_timer *m_lcd_timer; + + // callbacks + devcb_write32 m_write_cols; + devcb_write_line m_write_data; +}; + + +class hlcd0569_device : public hlcd0515_device +{ +public: + hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual void set_control() override; +}; + + + +extern const device_type HLCD0515; +extern const device_type HLCD0569; + + +#endif /* _HLCD0515_H_ */ diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp index ddd11783131..bc5d6357398 100644 --- a/src/devices/video/huc6261.cpp +++ b/src/devices/video/huc6261.cpp @@ -27,7 +27,10 @@ const device_type HUC6261 = &device_creator<huc6261_device>; huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock, "huc6261", __FILE__), - device_video_interface(mconfig, *this), m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_last_h(0), m_last_v(0), m_height(0), m_address(0), m_palette_latch(0), m_register(0), m_control(0), m_pixels_per_clock(0), m_pixel_data(0), m_pixel_clock(0), m_timer(nullptr), m_bmp(nullptr) + device_video_interface(mconfig, *this), + m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6272_tag(nullptr), + m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_huc6272(nullptr), + m_last_h(0), m_last_v(0), m_height(0), m_address(0), m_palette_latch(0), m_register(0), m_control(0), m_pixels_per_clock(0), m_pixel_data_a(0), m_pixel_data_b(0), m_pixel_clock(0), m_timer(nullptr), m_bmp(nullptr) { // Set up UV lookup table for ( int ur = 0; ur < 256; ur++ ) @@ -38,10 +41,10 @@ huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, d int32_t u = ur - 128; int32_t v = vr - 128; - r = - 1.13983 * v; + r = + 1.13983 * v; g = -0.35465 * u - 0.58060 * v; b = 2.03211 * u; - + m_uv_lookup[ ( ur << 8 ) | vr ][0] = r; m_uv_lookup[ ( ur << 8 ) | vr ][1] = g; m_uv_lookup[ ( ur << 8 ) | vr ][2] = b; @@ -53,8 +56,8 @@ huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, d inline uint32_t huc6261_device::yuv2rgb(uint32_t yuv) { int32_t r, g, b; - uint8_t y = yuv >> 16; - uint16_t uv = yuv & 0xffff; + uint8_t y = yuv >> 8; + uint16_t uv = ((yuv & 0xf0) << 8) | ((yuv & 0xf) << 4); r = y + m_uv_lookup[uv][0]; g = y + m_uv_lookup[uv][1]; @@ -70,6 +73,20 @@ inline uint32_t huc6261_device::yuv2rgb(uint32_t yuv) return ( r << 16 ) | ( g << 8 ) | b; } +void huc6261_device::apply_pal_offs(uint16_t *pix_data) +{ + // sprite + if(*pix_data & 0x100) + { + *pix_data &= 0xff; + *pix_data += ((m_palette_offset[0] & 0x7f00) >> 8) << 1; + } + else // background + *pix_data += (m_palette_offset[0] & 0x7f) << 1; + + *pix_data &= 0x1ff; +} + void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { int vpos = m_screen->vpos(); @@ -77,18 +94,26 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para int h = m_last_h; int v = m_last_v; uint32_t *bitmap_line = &m_bmp->pix32(v); - + while ( h != hpos || v != vpos ) { if ( m_pixel_clock == 0 ) { g_profiler.start( PROFILER_VIDEO ); /* Get next pixel information */ - m_pixel_data = m_huc6270_b->next_pixel( machine().dummy_space(), 0, 0xffff ); + m_pixel_data_a = m_huc6270_a->next_pixel( machine().dummy_space(), 0, 0xffff ); + m_pixel_data_b = m_huc6270_b->next_pixel( machine().dummy_space(), 0, 0xffff ); + apply_pal_offs(&m_pixel_data_a); + apply_pal_offs(&m_pixel_data_b); + g_profiler.stop(); } - bitmap_line[ h ] = yuv2rgb( ( ( m_palette[m_pixel_data] & 0xff00 ) << 8 ) | ( ( m_palette[m_pixel_data] & 0xf0 ) << 8 ) | ( ( m_palette[m_pixel_data] & 0x0f ) << 4 ) ); + bitmap_line[ h ] = yuv2rgb( m_palette[ m_pixel_data_a ] ); + // TODO: is mixing correct? + if((m_pixel_data_b & 0xff) != 0) + bitmap_line[ h ] = yuv2rgb( m_palette[ m_pixel_data_b ] ); + m_pixel_clock = ( m_pixel_clock + 1 ) % m_pixels_per_clock; h = ( h + 1 ) % HUC6261_WPF; @@ -267,21 +292,21 @@ WRITE16_MEMBER( huc6261_device::write ) switch( m_register ) { /* Control register */ - // -x-------------- Enable HuC6271: 0 - disabled, 1 - enabled - // --x------------- Enable HuC6272 BG3: 0 - disabled, 1 - enabled - // ---x------------ Enable HuC6272 BG2: 0 - disabled, 1 - enabled - // ----x----------- Enable Huc6272 BG1: 0 - disabled, 1 - enabled - // -----x---------- Enable HuC6272 BG0: 0 - disabled, 1 - enabled - // ------x--------- Enable HuC6270 SPR: 0 - disabled, 1 - enabled - // -------x-------- Enable HuC6270 BG: 0 - disabled, 1 - enabled - // --------x------- Number of SPR colors?: 0 - 16, 1 - 256 - // ---------x------ Number of BG colors?: 0 - 16, 1 - 256 - // ------------x--- Dot clock: 0 - 5MHz, 1 - 7MHz - // -------------x-- Synchronization: 0 - internal, 1 - external - // --------------xx Screen height: 00 - 262 lines, 01 - 263 lines, 10 - interlace, 11 - unknown/undefined + // -x-- ---- ---- ---- Enable HuC6271: 0 - disabled, 1 - enabled + // --x- ---- ---- ---- Enable HuC6272 BG3: 0 - disabled, 1 - enabled + // ---x ---- ---- ---- Enable HuC6272 BG2: 0 - disabled, 1 - enabled + // ---- x--- ---- ---- Enable Huc6272 BG1: 0 - disabled, 1 - enabled + // ---- -x-- ---- ---- Enable HuC6272 BG0: 0 - disabled, 1 - enabled + // ---- --x- ---- ---- Enable HuC6270 SPR: 0 - disabled, 1 - enabled + // ---- ---x ---- ---- Enable HuC6270 BG: 0 - disabled, 1 - enabled + // ---- ---- x--- ---- Number of SPR colors?: 0 - 16, 1 - 256 + // ---- ---- -x-- ---- Number of BG colors?: 0 - 16, 1 - 256 + // ---- ---- ---- x--- Dot clock: 0 - 5MHz, 1 - 7MHz + // ---- ---- ---- -x-- Synchronization: 0 - internal, 1 - external + // ---- ---- ---- --xx Screen height: 00 - 262 lines, 01 - 263 lines, 10 - interlace, 11 - unknown/undefined case 0x00: m_control = data; - m_pixels_per_clock = ( data & 0x04 ) ? 3 : 4; + m_pixels_per_clock = ( data & 0x08 ) ? 3 : 4; break; // Palette address @@ -297,20 +322,12 @@ WRITE16_MEMBER( huc6261_device::write ) m_address = ( m_address + 1 ) & 0x1FF; break; - // Palette offset 0 + // Palette offset 0-3 case 0x04: - break; - - // Palette offset 1 case 0x05: - break; - - // Palette offset 2 case 0x06: - break; - - // Palette offset 3 case 0x07: + m_palette_offset[m_register & 3] = data; break; // Priority 0 @@ -393,16 +410,19 @@ void huc6261_device::device_start() /* Make sure we are supplied all our mandatory tags */ assert( m_huc6270_a_tag != nullptr ); assert( m_huc6270_b_tag != nullptr ); + assert( m_huc6272_tag != nullptr ); m_timer = timer_alloc(); m_huc6270_a = machine().device<huc6270_device>(m_huc6270_a_tag); m_huc6270_b = machine().device<huc6270_device>(m_huc6270_b_tag); + m_huc6272 = machine().device<huc6272_device>(m_huc6272_tag); m_bmp = std::make_unique<bitmap_rgb32>(HUC6261_WPF, HUC6261_LPF ); /* We want to have valid devices */ assert( m_huc6270_a != nullptr ); assert( m_huc6270_b != nullptr ); + assert( m_huc6272 != nullptr ); save_item(NAME(m_last_h)); save_item(NAME(m_last_v)); @@ -414,7 +434,8 @@ void huc6261_device::device_start() save_item(NAME(m_control)); save_item(NAME(m_priority)); save_item(NAME(m_pixels_per_clock)); - save_item(NAME(m_pixel_data)); + save_item(NAME(m_pixel_data_a)); + save_item(NAME(m_pixel_data_b)); save_item(NAME(m_pixel_clock)); } diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h index a6f5b0f55a2..f1101397744 100644 --- a/src/devices/video/huc6261.h +++ b/src/devices/video/huc6261.h @@ -12,7 +12,7 @@ #include "emu.h" #include "video/huc6270.h" - +#include "video/huc6272.h" /* Screen timing stuff */ #define HUC6261_WPF 1365 /* width of a line in frame including blanking areas */ @@ -25,6 +25,9 @@ #define MCFG_HUC6261_VDC2(_tag) \ huc6261_device::set_vdc2_tag(*device, _tag); +#define MCFG_HUC6261_KING(_tag) \ + huc6261_device::set_king_tag(*device, _tag); + class huc6261_device : public device_t, public device_video_interface @@ -35,13 +38,12 @@ public: static void set_vdc1_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6270_a_tag = tag; } static void set_vdc2_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6270_b_tag = tag; } + static void set_king_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6272_tag = tag; } void video_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_READ16_MEMBER( read ); DECLARE_WRITE16_MEMBER( write ); - inline uint32_t yuv2rgb(uint32_t yuv); - protected: // device-level overrides virtual void device_start() override; @@ -51,9 +53,11 @@ protected: private: const char *m_huc6270_a_tag; const char *m_huc6270_b_tag; + const char *m_huc6272_tag; huc6270_device *m_huc6270_a; huc6270_device *m_huc6270_b; + huc6272_device *m_huc6272; int m_last_h; int m_last_v; int m_height; @@ -66,12 +70,16 @@ private: uint8_t m_priority[7]; uint8_t m_pixels_per_clock; /* Number of pixels to output per colour clock */ - uint16_t m_pixel_data; + uint16_t m_pixel_data_a; + uint16_t m_pixel_data_b; + uint16_t m_palette_offset[4]; uint8_t m_pixel_clock; emu_timer *m_timer; std::unique_ptr<bitmap_rgb32> m_bmp; int32_t m_uv_lookup[65536][3]; + inline uint32_t yuv2rgb(uint32_t yuv); + inline void apply_pal_offs(uint16_t *pix_data); }; diff --git a/src/devices/video/huc6271.cpp b/src/devices/video/huc6271.cpp new file mode 100644 index 00000000000..7cc4680f8a1 --- /dev/null +++ b/src/devices/video/huc6271.cpp @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Hudson/NEC HuC6271 "Rainbow" device + +***************************************************************************/ + +#include "emu.h" +#include "huc6271.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type huc6271 = &device_creator<huc6271_device>; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// huc6271_device - constructor +//------------------------------------------------- + +static ADDRESS_MAP_START( data_map, AS_DATA, 32, huc6271_device ) + AM_RANGE(0x000000, 0x0fffff) AM_RAM +ADDRESS_MAP_END + +huc6271_device::huc6271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, huc6271, "HuC6271 \"Rainbow\"", tag, owner, clock, "huc6271", __FILE__), + device_memory_interface(mconfig, *this), + m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(data_map)) +{ +} + + + +DEVICE_ADDRESS_MAP_START( regs, 16, huc6271_device ) + AM_RANGE(0x00, 0x01) AM_WRITENOP // hscroll + AM_RANGE(0x02, 0x03) AM_WRITENOP // control + AM_RANGE(0x04, 0x05) AM_WRITENOP // hsync + AM_RANGE(0x06, 0x07) AM_WRITENOP // base Y + AM_RANGE(0x08, 0x09) AM_WRITENOP // base U + AM_RANGE(0x0a, 0x0b) AM_WRITENOP // base V +ADDRESS_MAP_END + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void huc6271_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void huc6271_device::device_reset() +{ +} + +const address_space_config *huc6271_device::memory_space_config(address_spacenum spacenum) const +{ + switch(spacenum) + { +// case AS_PROGRAM: return &m_program_space_config; + case AS_DATA: return &m_data_space_config; + default: return nullptr; + } +} + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +#if 0 +void huc6271_device::data_transfer(uint32_t offset, uint32_t data) +{ + space(AS_DATA).write_dword(offset,data); +} +#endif diff --git a/src/devices/video/huc6271.h b/src/devices/video/huc6271.h new file mode 100644 index 00000000000..1197991160e --- /dev/null +++ b/src/devices/video/huc6271.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Hudson/NEC HuC6271 "Rainbow" device + +***************************************************************************/ + +#pragma once + +#ifndef __HUC6271DEV_H__ +#define __HUC6271DEV_H__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_HUC6271_ADD(_tag,_freq) \ + MCFG_DEVICE_ADD(_tag, huc6271, _freq) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> huc6271_device + +class huc6271_device : public device_t, + public device_memory_interface +{ +public: + // construction/destruction + huc6271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // I/O operations + DECLARE_ADDRESS_MAP(regs, 16); + //void data_transfer(uint32_t offset, uint32_t data); + +protected: + // device-level overrides +// virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start() override; + virtual void device_reset() override; + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_DATA) const override; + +private: + const address_space_config m_data_space_config; +}; + + +// device type definition +extern const device_type huc6271; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp index dce9cb7fe5c..d988e616905 100644 --- a/src/devices/video/huc6272.cpp +++ b/src/devices/video/huc6272.cpp @@ -1,12 +1,16 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, Angelo Salese /*************************************************************************** Hudson/NEC HuC6272 "King" device + TODO: + - Use NSCSI instead of legacy one! + ***************************************************************************/ #include "emu.h" + #include "video/huc6272.h" @@ -18,88 +22,116 @@ // device type definition const device_type huc6272 = &device_creator<huc6272_device>; -static ADDRESS_MAP_START( huc6272_vram, AS_0, 32, huc6272_device ) - AM_RANGE(0x000000, 0x0fffff) AM_RAM - AM_RANGE(0x100000, 0x1fffff) AM_RAM +static ADDRESS_MAP_START( microprg_map, AS_PROGRAM, 16, huc6272_device ) + AM_RANGE(0x00, 0x0f) AM_RAM AM_SHARE("microprg_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kram_map, AS_DATA, 32, huc6272_device ) + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("kram_page0") + AM_RANGE(0x100000, 0x1fffff) AM_RAM AM_SHARE("kram_page1") ADDRESS_MAP_END +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + //------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device +// huc6272_device - constructor //------------------------------------------------- -const address_space_config *huc6272_device::memory_space_config(address_spacenum spacenum) const +huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, huc6272, "HuC6272 \"King\"", tag, owner, clock, "huc6272", __FILE__), + device_memory_interface(mconfig, *this), + m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, nullptr, *ADDRESS_MAP_NAME(microprg_map)), + m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, nullptr, *ADDRESS_MAP_NAME(kram_map)), + m_microprg_ram(*this, "microprg_ram"), + m_kram_page0(*this, "kram_page0"), + m_kram_page1(*this, "kram_page1"), + m_scsibus(*this, "scsi"), + m_scsi_data_in(*this, "scsi_data_in"), + m_scsi_data_out(*this, "scsi_data_out"), + m_scsi_ctrl_in(*this, "scsi_ctrl_in"), + m_irq_changed_cb(*this) { - return (spacenum == AS_0) ? &m_space_config : nullptr; } -//************************************************************************** -// INLINE HELPERS -//************************************************************************** //------------------------------------------------- -// read_dword - read a dword at the given address +// device_validity_check - perform validity checks +// on this device //------------------------------------------------- -inline uint32_t huc6272_device::read_dword(offs_t address) +void huc6272_device::device_validity_check(validity_checker &valid) const { - return space().read_dword(address << 2); } //------------------------------------------------- -// write_dword - write a dword at the given address +// device_start - device-specific startup //------------------------------------------------- -inline void huc6272_device::write_dword(offs_t address, uint32_t data) +void huc6272_device::device_start() { - space().write_dword(address << 2, data); + m_irq_changed_cb.resolve_safe(); + + assert( m_huc6271_tag != nullptr ); + + m_huc6271 = machine().device<huc6271_device>(m_huc6271_tag); + } -//************************************************************************** -// LIVE DEVICE -//************************************************************************** //------------------------------------------------- -// huc6272_device - constructor +// device_reset - device-specific reset //------------------------------------------------- -huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, huc6272, "huc6272", tag, owner, clock, "huc6272", __FILE__), - device_memory_interface(mconfig, *this), - m_space_config("videoram", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(huc6272_vram)) +void huc6272_device::device_reset() { } - //------------------------------------------------- -// device_validity_check - perform validity checks -// on this device +// memory_space_config - return a description of +// any address spaces owned by this device //------------------------------------------------- -void huc6272_device::device_validity_check(validity_checker &valid) const +const address_space_config *huc6272_device::memory_space_config(address_spacenum spacenum) const { + switch(spacenum) + { + case AS_PROGRAM: return &m_program_space_config; + case AS_DATA: return &m_data_space_config; + default: return nullptr; + } } +//************************************************************************** +// INLINE HELPERS +//************************************************************************** //------------------------------------------------- -// device_start - device-specific startup +// read_dword - read a dword at the given address //------------------------------------------------- -void huc6272_device::device_start() +inline uint32_t huc6272_device::read_dword(offs_t address) { + return space(AS_DATA).read_dword(address << 2); } //------------------------------------------------- -// device_reset - device-specific reset +// write_dword - write a dword at the given address //------------------------------------------------- -void huc6272_device::device_reset() +inline void huc6272_device::write_dword(offs_t address, uint32_t data) { + space(AS_DATA).write_dword(address << 2, data); } +void huc6272_device::write_microprg_data(offs_t address, uint16_t data) +{ + space(AS_PROGRAM).write_word(address << 1, data); +} //************************************************************************** // READ/WRITE HANDLERS @@ -128,12 +160,22 @@ READ32_MEMBER( huc6272_device::read ) ---- ---- ---- ---- ---- ---- -xxx xxxx register read-back */ res = m_register & 0x7f; - res |= (0) << 16; + res |= (m_scsi_ctrl_in->read() & 0xff) << 16; } else { switch(m_register) { + case 0x00: // SCSI data in + res = m_scsi_data_in->read() & 0xff; + break; + + case 0x05: // SCSI bus status + res = m_scsi_ctrl_in->read() & 0xff; + res|= (m_scsi_data_in->read() << 8); + break; + + /* x--- ---- ---- ---- ---- */ @@ -145,9 +187,9 @@ READ32_MEMBER( huc6272_device::read ) res = (m_kram_addr_w & 0x3ffff) | ((m_kram_inc_w & 0x1ff) << 18) | ((m_kram_page_w & 1) << 31); break; - case 0x0e: + case 0x0e: // KRAM read data res = read_dword((m_kram_addr_r)|(m_kram_page_r<<18)); - m_kram_addr_r += (m_kram_inc_r & 0x100) ? ((m_kram_inc_r & 0xff) - 0x100) : (m_kram_inc_r & 0xff); + m_kram_addr_r += (m_kram_inc_r & 0x200) ? ((m_kram_inc_r & 0x1ff) - 0x200) : (m_kram_inc_r & 0x1ff); break; case 0x0f: @@ -165,36 +207,61 @@ WRITE32_MEMBER( huc6272_device::write ) if((offset & 1) == 0) m_register = data & 0x7f; else - { + { switch(m_register) { - case 0x09: // DMA addr - //printf("%08x DMA ADDR\n",data); + case 0x00: // SCSI data out + m_scsi_data_out->write(data & 0xff); + break; + case 0x01: // SCSI command + //m_scsibus->write_bsy(BIT(data, 0)); // bus? + m_scsibus->write_atn(BIT(data, 1)); + m_scsibus->write_sel(BIT(data, 2)); + m_scsibus->write_ack(BIT(data, 4)); + m_scsibus->write_rst(BIT(data, 7)); + + break; + + case 0x02: // SCSI mode break; - case 0x0a: // DMA size - //printf("%08x DMA SIZE\n",data); + + case 0x03: // SCSI target command + m_scsibus->write_io(BIT(data, 0)); + m_scsibus->write_cd(BIT(data, 1)); + m_scsibus->write_msg(BIT(data, 2)); + break; + + case 0x05: // SCSI bus status + // bits 7-0: SCSI DMA trigger? + m_scsi_data_out->write((data >> 8) & 0xff); break; - case 0x0b: // DMA status - //printf("%08x DMA STATUS\n",data); + + case 0x06: // SCSI input data + case 0x07: // SCSI DMA trigger + case 0x08: // SCSI subcode + case 0x09: // SCSI DMA start address + case 0x0a: // SCSI DMA size + case 0x0b: // SCSI DMA control break; /* ---- ---- ---- ---- ---- */ case 0x0c: // KRAM load address m_kram_addr_r = (data & 0x0003ffff); - m_kram_inc_r = (data & 0x07fc0000) >> 18; + m_kram_inc_r = (data & 0x0ffc0000) >> 18; m_kram_page_r = (data & 0x80000000) >> 31; break; case 0x0d: // KRAM write address m_kram_addr_w = (data & 0x0003ffff); - m_kram_inc_w = (data & 0x07fc0000) >> 18; + m_kram_inc_w = (data & 0x0ffc0000) >> 18; m_kram_page_w = (data & 0x80000000) >> 31; break; - case 0x0e: // KRAM write VRAM - write_dword((m_kram_addr_w)|(m_kram_page_w<<18),data); /* TODO: there are some 32-bits accesses during BIOS? */ - m_kram_addr_w += (m_kram_inc_w & 0x100) ? ((m_kram_inc_w & 0xff) - 0x100) : (m_kram_inc_w & 0xff); + case 0x0e: // KRAM write data + // TODO: handle non-dword cases? + write_dword((m_kram_addr_w)|(m_kram_page_w<<18),data); + m_kram_addr_w += (m_kram_inc_w & 0x200) ? ((m_kram_inc_w & 0x1ff) - 0x200) : (m_kram_inc_w & 0x1ff); break; /* @@ -223,27 +290,120 @@ WRITE32_MEMBER( huc6272_device::write ) // 1011 - 256 color palette block mode // others - unused/invalid case 0x10: - m_bgmode[0] = data & 0x0f; - m_bgmode[1] = ( data >> 4 ) & 0x0f; - m_bgmode[2] = ( data >> 8 ) & 0x0f; - m_bgmode[3] = ( data >> 12 ) & 0x0f; + for(int i=0;i<4;i++) + m_bg[i].mode = (data >> i*4) & 0x0f; + break; + /* + ---x ---- ---- ---- BG0 rotation enable + ---- xxx- ---- ---- BG3 priority + ---- ---x xx-- ---- BG2 priority + ---- ---- --xx x--- BG1 priority + ---- ---- ---- -xxx BG0 priority + */ + case 0x12: + for(int i=0;i<4;i++) + m_bg[i].priority = (data >> i*3) & 0x07; + + // TODO: rotation enable + break; + case 0x13: - m_micro_prg.addr = data & 0xf; + m_micro_prg.index = data & 0xf; break; case 0x14: - m_micro_prg.data[m_micro_prg.addr] = data & 0xffff; - m_micro_prg.addr++; - m_micro_prg.addr &= 0xf; + write_microprg_data(m_micro_prg.index,data & 0xffff); + m_micro_prg.index ++; + m_micro_prg.index &= 0xf; break; case 0x15: m_micro_prg.ctrl = data & 1; - break; + break; + + // case 0x16: wrap-around enable + + // BAT and CG address setters + case 0x20: m_bg[0].bat_address = data * 1024; break; + case 0x21: m_bg[0].cg_address = data * 1024; break; + case 0x22: m_bg0sub.bat_address = data * 1024; break; + case 0x23: m_bg0sub.cg_address = data * 1024; break; + case 0x24: m_bg[1].bat_address = data * 1024; break; + case 0x25: m_bg[1].cg_address = data * 1024; break; + case 0x26: m_bg[2].bat_address = data * 1024; break; + case 0x27: m_bg[2].cg_address = data * 1024; break; + case 0x28: m_bg[3].bat_address = data * 1024; break; + case 0x29: m_bg[3].cg_address = data * 1024; break; + + // Height & Width setters + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + { + uint8_t reg_offs = m_register & 3; + m_bg[reg_offs].height = 1 << (data & 0x000f); + m_bg[reg_offs].width = 1 << ((data & 0x00f0) >> 4); + if(reg_offs == 0) + { + m_bg0sub.height = 1 << ((data & 0x0f00) >> 8); + m_bg0sub.width = 1 << ((data & 0xf000) >> 12); + } + break; + } + + // X & Y scroll values + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + { + uint8_t reg_offs = (m_register & 6) >> 1; + + if(m_register & 1) + m_bg[reg_offs].yscroll = data & 0xffff; + else + m_bg[reg_offs].xscroll = data & 0xffff; + break; + } + //default: printf("%04x %04x %08x\n",m_register,data,mem_mask); } } } + +static MACHINE_CONFIG_FRAGMENT( king_scsi_intf ) + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSI_RST_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7)) + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit6)) + MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit5)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit4)) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2)) + MCFG_SCSI_SEL_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1)) + + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", "scsi") + MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_1) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor huc6272_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( king_scsi_intf ); +} diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h index 9a2e173f919..3fc71efd051 100644 --- a/src/devices/video/huc6272.h +++ b/src/devices/video/huc6272.h @@ -1,8 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, Angelo Salese /*************************************************************************** -Template for skeleton device + Hudson/NEC HuC6272 "King" device ***************************************************************************/ @@ -11,6 +11,9 @@ Template for skeleton device #ifndef __huc6272DEV_H__ #define __huc6272DEV_H__ +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" +#include "video/huc6271.h" //************************************************************************** @@ -20,6 +23,12 @@ Template for skeleton device #define MCFG_HUC6272_ADD(_tag,_freq) \ MCFG_DEVICE_ADD(_tag, huc6272, _freq) +#define MCFG_HUC6272_IRQ_CHANGED_CB(_devcb) \ + devcb = &huc6272_device::set_irq_changed_callback(*device, DEVCB_##_devcb); + +#define MCFG_HUC6272_RAINBOW(_tag) \ + huc6272_device::set_rainbow_tag(*device, _tag); + //************************************************************************** // TYPE DEFINITIONS @@ -34,38 +43,73 @@ public: // construction/destruction huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template<class _Object> static devcb_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6272_device &>(device).m_irq_changed_cb.set_callback(object); } + static void set_rainbow_tag(device_t &device, const char *tag) { downcast<huc6272_device &>(device).m_huc6271_tag = tag; } + // I/O operations DECLARE_WRITE32_MEMBER( write ); DECLARE_READ32_MEMBER( read ); - protected: // device-level overrides virtual void device_validity_check(validity_checker &valid) const override; virtual void device_start() override; virtual void device_reset() override; - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; + virtual machine_config_constructor device_mconfig_additions() const override; + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override; private: - inline uint32_t read_dword(offs_t address); - inline void write_dword(offs_t address, uint32_t data); + const char *m_huc6271_tag; + + huc6271_device *m_huc6271; + uint8_t m_register; uint32_t m_kram_addr_r, m_kram_addr_w; uint16_t m_kram_inc_r,m_kram_inc_w; uint8_t m_kram_page_r,m_kram_page_w; uint32_t m_page_setting; - uint8_t m_bgmode[4]; - + + struct{ + uint32_t bat_address; + uint32_t cg_address; + uint8_t mode; + uint16_t height; + uint16_t width; + uint16_t xscroll; + uint16_t yscroll; + uint8_t priority; + }m_bg[4]; + + struct{ + uint32_t bat_address; + uint32_t cg_address; + uint16_t height; + uint16_t width; + }m_bg0sub; + struct{ - uint8_t addr; + uint8_t index; uint8_t ctrl; - uint16_t data[16]; }m_micro_prg; - - const address_space_config m_space_config; + + const address_space_config m_program_space_config; + const address_space_config m_data_space_config; + required_shared_ptr<uint16_t> m_microprg_ram; + required_shared_ptr<uint32_t> m_kram_page0; + required_shared_ptr<uint32_t> m_kram_page1; + required_device<SCSI_PORT_DEVICE> m_scsibus; + required_device<input_buffer_device> m_scsi_data_in; + required_device<output_latch_device> m_scsi_data_out; + required_device<input_buffer_device> m_scsi_ctrl_in; + + /* Callback for when the irq line may have changed (mandatory) */ + devcb_write_line m_irq_changed_cb; + + uint32_t read_dword(offs_t address); + void write_dword(offs_t address, uint32_t data); + void write_microprg_data(offs_t address, uint16_t data); }; - // device type definition extern const device_type huc6272; diff --git a/src/mame/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index c86bed6c6fb..c86bed6c6fb 100644 --- a/src/mame/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp diff --git a/src/mame/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h index d426630eb64..d426630eb64 100644 --- a/src/mame/video/ppu2c0x.h +++ b/src/devices/video/ppu2c0x.h diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp index 2f77efb875a..b0553642316 100644 --- a/src/devices/video/tms9927.cpp +++ b/src/devices/video/tms9927.cpp @@ -214,7 +214,7 @@ WRITE8_MEMBER( tms9927_device::write ) case 0x0d: /* LOAD CURSOR ROW ADDRESS */ osd_printf_debug("Cursor address changed\n"); m_reg[offset - 0x0c + 7] = data; - /* Recomputing parameters here will break the scrollup on the Attachè + /* Recomputing parameters here will break the scrollup on the Attachè and probably other machines due to m_start_datarow being reset ! */ //recompute_parameters(false); break; diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h index ae95f47ff0d..58846d58512 100644 --- a/src/devices/video/v9938.h +++ b/src/devices/video/v9938.h @@ -51,7 +51,7 @@ MCFG_SCREEN_PALETTE(_v9938_tag":palette") #define MCFG_V99X8_INTERRUPT_CALLBACK(_irq) \ - downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq); + devcb = &downcast<v99x8_device *>(device)->set_interrupt_callback(DEVCB_##_irq); //************************************************************************** @@ -79,8 +79,8 @@ protected: v99x8_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, uint32_t clock); public: - template<class _irq> void set_interrupt_callback(_irq irq) { - m_int_callback.set_callback(irq); + template<class _irq> devcb_base &set_interrupt_callback(_irq irq) { + return m_int_callback.set_callback(irq); } int get_transpen(); bitmap_ind16 &get_bitmap() { return m_bitmap; } diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index aca1d3449bb..f77412c5846 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -1859,7 +1859,7 @@ void zeus2_renderer::render_poly_8bit(int32_t scanline, const extent_t& extent, int v1 = (v0 + 1); uint8_t texel0 = object.get_texel(texbase, v0, u0, texwidth); //if (texel0 == transcolor) - // continue; + // 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); @@ -1951,20 +1951,20 @@ std::string zeus2_device::tex_info(void) std::string retVal; switch (zeus_texbase) { // crusnexo - case 0x01fc00: retVal = "credits / insert coin"; break; - case 0x1dc000: retVal = "copywrite text"; break; - case 0x0e7400: retVal = "tire"; break; - case 0x0e8800: retVal = "star behind tire"; break; - case 0x0e6800: retVal = "crusn exotica text"; break; - case 0x02a400: retVal = "Yellow Letters / Numbers"; break; - case 0x1fd000: retVal = "Star burst in license plate screen"; break; - case 0x1e9800: retVal = "Red Letter in license plate screen"; break; - case 0x0c1c00: retVal = "Car parts"; break; - case 0x0006f000: retVal = "license plate background"; break; - case 0x0006f400: retVal = "blue on white license plate names"; break; - case 0x00047800: retVal = "baby body"; break; - case 0x000e7000: retVal = "crusn exotica yellow glow"; break; - case 0x0002b000: retVal = "blue crusn stencil behind leader list"; break; + case 0x01fc00: retVal = "credits / insert coin"; break; + case 0x1dc000: retVal = "copywrite text"; break; + case 0x0e7400: retVal = "tire"; break; + case 0x0e8800: retVal = "star behind tire"; break; + case 0x0e6800: retVal = "crusn exotica text"; break; + case 0x02a400: retVal = "Yellow Letters / Numbers"; break; + case 0x1fd000: retVal = "Star burst in license plate screen"; break; + case 0x1e9800: retVal = "Red Letter in license plate screen"; break; + case 0x0c1c00: retVal = "Car parts"; break; + case 0x0006f000: retVal = "license plate background"; break; + case 0x0006f400: retVal = "blue on white license plate names"; break; + case 0x00047800: retVal = "baby body"; break; + case 0x000e7000: retVal = "crusn exotica yellow glow"; break; + case 0x0002b000: retVal = "blue crusn stencil behind leader list"; break; case 0x001f4800: retVal = "number keypad"; break; case 0x001e7800: retVal = "register now logo"; break; case 0x001e5000: retVal = "blue start game / enter code / earn miles"; break; @@ -1995,43 +1995,43 @@ std::string zeus2_device::tex_info(void) // mwskinsa case 0x1fdf00: retVal = "Skins Tip Box, s=256"; break; - case 0x07f540: retVal = "Left main intro"; break; - case 0x081580: retVal = "Right main intro"; break; - case 0x14db00: retVal = "silver letter b, s=64"; break; - case 0x14d880: retVal = "letter a"; break; - case 0x14e000: retVal = "letter d"; break; - case 0x0014dd80: retVal = "silver letter c, s=64"; break; - case 0x0014fb80: retVal = "silver letter o, s=64"; break; - case 0x0014ec80: retVal = "silver letter i, s=64"; break; - case 0x0014f900: retVal = "silver letter n, s=64"; break; - case 0x00150580: retVal = "silver letter s, s=64"; break; - case 0x00150800: retVal = "silver letter t, s=64"; break; - case 0x00150300: retVal = "silver letter r, s=64"; break; - case 0x0014e780: retVal = "silver letter g, s=64"; break; - case 0x00153280: retVal = "silver letter C, s=64"; break; - case 0x0014e280: retVal = "silver letter e, s=64"; break; - case 0x0014b800: retVal = "silver letter O, s=64"; break; - case 0x00152d80: retVal = "silver letter A, s=64"; break; - case 0x0014f680: retVal = "silver letter m, s=64"; break; - case 0x00142b40: retVal = "black screen?"; break; - case 0x00004740: retVal = "picture bridge over water, s=256"; break; - case 0x00005c80: retVal = "picture water shore, s=256"; break; - case 0x000030c0: retVal = "left leaderboard background graphics, s=256"; break; - case 0x00003c00: retVal = "right leaderboard background graphics, s=256"; break; - case 0x00040bc0: retVal = "extreme mode, s=256"; break; - case 0x00091630: retVal = "photo wild eye guy, s=64"; break; - case 0x00159d80: retVal = "white M s=32, t=4"; break; - case 0x0015a080: retVal = "white 9 s=32, t=4"; break; - case 0x00159f00: retVal = "white P s=32, t=4"; break; - case 0x00145a40: retVal = "white crossbar? s=32, t=4"; break; - case 0x00145c40: retVal = "white crossbar2? s=32, t=4"; break; - case 0x00159300: retVal = "white _ s=32, t=4"; break; - case 0x00158d00: retVal = "white 1 s=32, t=4"; break; - case 0x00158e80: retVal = "white 4 s=32, t=4"; break; - case 0x0001c080: retVal = "maybe checkboard"; break; + case 0x07f540: retVal = "Left main intro"; break; + case 0x081580: retVal = "Right main intro"; break; + case 0x14db00: retVal = "silver letter b, s=64"; break; + case 0x14d880: retVal = "letter a"; break; + case 0x14e000: retVal = "letter d"; break; + case 0x0014dd80: retVal = "silver letter c, s=64"; break; + case 0x0014fb80: retVal = "silver letter o, s=64"; break; + case 0x0014ec80: retVal = "silver letter i, s=64"; break; + case 0x0014f900: retVal = "silver letter n, s=64"; break; + case 0x00150580: retVal = "silver letter s, s=64"; break; + case 0x00150800: retVal = "silver letter t, s=64"; break; + case 0x00150300: retVal = "silver letter r, s=64"; break; + case 0x0014e780: retVal = "silver letter g, s=64"; break; + case 0x00153280: retVal = "silver letter C, s=64"; break; + case 0x0014e280: retVal = "silver letter e, s=64"; break; + case 0x0014b800: retVal = "silver letter O, s=64"; break; + case 0x00152d80: retVal = "silver letter A, s=64"; break; + case 0x0014f680: retVal = "silver letter m, s=64"; break; + case 0x00142b40: retVal = "black screen?"; break; + case 0x00004740: retVal = "picture bridge over water, s=256"; break; + case 0x00005c80: retVal = "picture water shore, s=256"; break; + case 0x000030c0: retVal = "left leaderboard background graphics, s=256"; break; + case 0x00003c00: retVal = "right leaderboard background graphics, s=256"; break; + case 0x00040bc0: retVal = "extreme mode, s=256"; break; + case 0x00091630: retVal = "photo wild eye guy, s=64"; break; + case 0x00159d80: retVal = "white M s=32, t=4"; break; + case 0x0015a080: retVal = "white 9 s=32, t=4"; break; + case 0x00159f00: retVal = "white P s=32, t=4"; break; + case 0x00145a40: retVal = "white crossbar? s=32, t=4"; break; + case 0x00145c40: retVal = "white crossbar2? s=32, t=4"; break; + case 0x00159300: retVal = "white _ s=32, t=4"; break; + case 0x00158d00: retVal = "white 1 s=32, t=4"; break; + case 0x00158e80: retVal = "white 4 s=32, t=4"; break; + case 0x0001c080: retVal = "maybe checkboard"; break; // thegrid - //case 0x0001c080: retVal = "maybe checkboard"; break; + //case 0x0001c080: retVal = "maybe checkboard"; break; default: retVal = "Unknown"; break; } return retVal; diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index fc18b602e9d..35bb4f02f21 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -22,7 +22,7 @@ #define DUMP_WAVE_RAM 0 #define TRACK_REG_USAGE 0 -#define PRINT_TEX_INFO 0 +#define PRINT_TEX_INFO 0 #define WAVERAM0_WIDTH 1024 #define WAVERAM0_HEIGHT 2048 diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 5469670caa6..611912d4bae 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -136,6 +136,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_console.register_command("printf", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_printf, this, _1, _2, _3)); m_console.register_command("logerror", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_logerror, this, _1, _2, _3)); m_console.register_command("tracelog", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_tracelog, this, _1, _2, _3)); + m_console.register_command("tracesym", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_tracesym, this, _1, _2, _3)); m_console.register_command("quit", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_quit, this, _1, _2, _3)); m_console.register_command("exit", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_quit, this, _1, _2, _3)); m_console.register_command("do", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_do, this, _1, _2, _3)); @@ -725,6 +726,42 @@ void debugger_commands::execute_tracelog(int ref, int params, const char *param[ /*------------------------------------------------- + execute_tracesym - execute the tracesym command +-------------------------------------------------*/ + +void debugger_commands::execute_tracesym(int ref, int params, const char *param[]) +{ + // build a format string appropriate for the parameters and validate them + std::stringstream format; + u64 values[MAX_COMMAND_PARAMS]; + for (int i = 0; i < params; i++) + { + // find this symbol + symbol_entry *sym = m_cpu.get_visible_symtable()->find(param[i]); + if (!sym) + { + m_console.printf("Unknown symbol: %s\n", param[i]); + return; + } + + // build the format string + util::stream_format(format, "%s=%s ", + param[i], + sym->format().empty() ? "%16X" : sym->format()); + + // validate the parameter + if (!validate_number_parameter(param[i], &values[i])) + return; + } + + // then do a printf + char buffer[1024]; + if (mini_printf(buffer, format.str().c_str(), params, values)) + m_cpu.get_visible_cpu()->debug()->trace_printf("%s", buffer); +} + + +/*------------------------------------------------- execute_quit - execute the quit command -------------------------------------------------*/ @@ -2496,6 +2533,7 @@ void debugger_commands::execute_trace_internal(int ref, int params, const char * { const char *action = nullptr; bool detect_loops = true; + bool logerror = false; device_t *cpu; FILE *f = nullptr; const char *mode; @@ -2507,8 +2545,25 @@ void debugger_commands::execute_trace_internal(int ref, int params, const char * /* validate parameters */ if (!validate_cpu_parameter((params > 1) ? param[1] : nullptr, &cpu)) return; - if (!validate_boolean_parameter((params > 2) ? param[2] : nullptr, &detect_loops)) - return; + if (params > 2) + { + std::stringstream stream; + stream.str(param[2]); + + std::string flag; + while (std::getline(stream, flag, '|')) + { + if (!core_stricmp(flag.c_str(), "noloop")) + detect_loops = false; + else if (!core_stricmp(flag.c_str(), "logerror")) + logerror = true; + else + { + m_console.printf("Invalid flag '%s'\n", flag.c_str()); + return; + } + } + } if (!debug_command_parameter_command(action = (params > 3) ? param[3] : nullptr)) return; @@ -2533,7 +2588,7 @@ void debugger_commands::execute_trace_internal(int ref, int params, const char * } /* do it */ - cpu->debug()->trace(f, trace_over, detect_loops, action); + cpu->debug()->trace(f, trace_over, detect_loops, logerror, action); if (f) m_console.printf("Tracing CPU '%s' to file %s\n", cpu->tag(), filename.c_str()); else diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index ac57622abd5..02e8ceb5299 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -98,6 +98,7 @@ private: void execute_printf(int ref, int params, const char **param); void execute_logerror(int ref, int params, const char **param); void execute_tracelog(int ref, int params, const char **param); + void execute_tracesym(int ref, int params, const char **param); void execute_quit(int ref, int params, const char **param); void execute_do(int ref, int params, const char **param); void execute_step(int ref, int params, const char **param); diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 98fa6c9f038..5a36ecadfee 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -1668,10 +1668,10 @@ device_debug::device_debug(device_t &device) // add all registers into it std::string tempstr; - for (auto &entry : m_state->state_entries()) + for (const auto &entry : m_state->state_entries()) { strmakelower(tempstr.assign(entry->symbol())); - m_symtable.add(tempstr.c_str(), (void *)(uintptr_t)entry->index(), get_state, set_state); + m_symtable.add(tempstr.c_str(), (void *)(uintptr_t)entry->index(), get_state, set_state, entry->format_string()); } } @@ -1684,6 +1684,10 @@ device_debug::device_debug(device_t &device) if (m_state != nullptr && m_symtable.find("curpc") == nullptr) m_symtable.add("curpc", nullptr, get_current_pc); } + + // set up trace + using namespace std::placeholders; + m_device.machine().add_logerror_callback(std::bind(&device_debug::errorlog_write_line, this, _1)); } @@ -2623,14 +2627,14 @@ u32 device_debug::compute_opcode_crc32(offs_t pc) const // trace - trace execution of a given device //------------------------------------------------- -void device_debug::trace(FILE *file, bool trace_over, bool detect_loops, const char *action) +void device_debug::trace(FILE *file, bool trace_over, bool detect_loops, bool logerror, const char *action) { // delete any existing tracers m_trace = nullptr; // if we have a new file, make a new tracer if (file != nullptr) - m_trace = std::make_unique<tracer>(*this, *file, trace_over, detect_loops, action); + m_trace = std::make_unique<tracer>(*this, *file, trace_over, detect_loops, logerror, action); } @@ -3291,11 +3295,12 @@ bool device_debug::registerpoint::hit() // tracer - constructor //------------------------------------------------- -device_debug::tracer::tracer(device_debug &debug, FILE &file, bool trace_over, bool detect_loops, const char *action) +device_debug::tracer::tracer(device_debug &debug, FILE &file, bool trace_over, bool detect_loops, bool logerror, const char *action) : m_debug(debug) , m_file(file) , m_action((action != nullptr) ? action : "") , m_detect_loops(detect_loops) + , m_logerror(logerror) , m_loops(0) , m_nextdex(0) , m_trace_over(trace_over) @@ -3447,3 +3452,14 @@ device_debug::dasm_comment::dasm_comment(offs_t address, u32 crc, const char *te m_color(std::move(color)) { } + + +//------------------------------------------------- +// dasm_comment - constructor +//------------------------------------------------- + +void device_debug::errorlog_write_line(const char *line) +{ + if (m_trace && m_trace->logerror()) + trace_printf("%s", line); +} diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index c01cc0e0646..04cb6ac27e9 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -263,7 +263,7 @@ public: void track_mem_data_clear() { m_track_mem_set.clear(); } // tracing - void trace(FILE *file, bool trace_over, bool detect_loops, const char *action); + void trace(FILE *file, bool trace_over, bool detect_loops, bool logerror, const char *action); void trace_printf(const char *fmt, ...) ATTR_PRINTF(2,3); void trace_flush() { if (m_trace != nullptr) m_trace->flush(); } @@ -280,6 +280,7 @@ private: // internal helpers void prepare_for_step_overout(offs_t pc); u32 dasm_wrapped(std::string &buffer, offs_t pc); + void errorlog_write_line(const char *line); // breakpoint and watchpoint helpers void breakpoint_update_flags(); @@ -336,12 +337,13 @@ private: class tracer { public: - tracer(device_debug &debug, FILE &file, bool trace_over, bool detect_loops, const char *action); + tracer(device_debug &debug, FILE &file, bool trace_over, bool detect_loops, bool logerror, const char *action); ~tracer(); void update(offs_t pc); void vprintf(const char *format, va_list va); void flush(); + bool logerror() const { return m_logerror; } private: static const int TRACE_LOOPS = 64; @@ -351,6 +353,7 @@ private: std::string m_action; // action to perform during a trace offs_t m_history[TRACE_LOOPS]; // history of recent PCs bool m_detect_loops; // whether or not we should detect loops + bool m_logerror; // whether or not we should collect logerror output int m_loops; // number of instructions in a loop int m_nextdex; // next index bool m_trace_over; // true if we're tracing over diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index ded8cafb993..dd46472abb2 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -86,6 +86,7 @@ static const help_item static_help_list[] = " printf <format>[,<item>[,...]] -- prints one or more <item>s to the console using <format>\n" " logerror <format>[,<item>[,...]] -- outputs one or more <item>s to the error.log\n" " tracelog <format>[,<item>[,...]] -- outputs one or more <item>s to the trace file using <format>\n" + " tracesym <item>[,...]] -- outputs one or more <item>s to the trace file\n" " history [<cpu>,<length>] -- outputs a brief history of visited opcodes\n" " trackpc [<bool>,<cpu>,<bool>] -- visually track visited opcodes [boolean to turn on and off, for the given cpu, clear]\n" " trackmem [<bool>,<bool>] -- record which PC writes to each memory address [boolean to turn on and off, clear]\n" @@ -385,6 +386,22 @@ static const help_item static_help_list[] = " Outputs A=<aval>, B=<bval> on one line, and C=<a+bval> on a second line.\n" }, { + "tracesym", + "\n" + " tracesym <item>[,...]\n" + "\n" + "The tracesym command prints the specified symbols and routes the output to the currently open trace " + "file (see the 'trace' command for details). If no file is currently open, tracesym does nothing. " + "\n" + "Examples:\n" + "\n" + "tracelog pc\n" + " Outputs PC=<pcval> where <pcval> is displayed in the default format.\n" + "\n" + "printf a,b\n" + " Outputs A=<aval>, B=<bval> on one line.\n" + }, + { "trackpc", "\n" " trackpc [<bool>,<cpu>,<bool>]\n" @@ -818,14 +835,15 @@ static const help_item static_help_list[] = { "trace", "\n" - " trace {<filename>|OFF}[,<cpu>[,<detectloops>[,<action>]]]\n" + " trace {<filename>|OFF}[,<cpu>[,[noloop|logerror][,<action>]]]\n" "\n" "Starts or stops tracing of the execution of the specified <cpu>. If <cpu> is omitted, " "the currently active CPU is specified. When enabling tracing, specify the filename in the " "<filename> parameter. To disable tracing, substitute the keyword 'off' for <filename>. " - "<detectloops> should be either true or false. If <detectloops> is true or omitted, the trace " - "will have loops detected and condensed to a single line. If it is false, the trace will contain " - "every opcode as it is executed. If you " + "<detectloops> should be either true or false. If 'noloop' is omitted, the trace " + "will have loops detected and condensed to a single line. If 'noloop' is specified, the trace " + "will contain every opcode as it is executed. If 'logerror' is specified, logerror output " + "will augment the trace. If you " "wish to log additional information on each trace, you can append an <action> parameter which " "is a command that is executed before each trace is logged. Generally, this is used to include " "a 'tracelog' command. Note that you may need to embed the action within braces { } in order " @@ -840,16 +858,22 @@ static const help_item static_help_list[] = "trace dribling.tr,0\n" " Begin tracing the execution of CPU #0, logging output to dribling.tr.\n" "\n" - "trace starswep.tr,0,false\n" + "trace starswep.tr,0,noloop\n" " Begin tracing the execution of CPU #0, logging output to starswep.tr, with loop detection disabled.\n" "\n" + "trace starswep.tr,0,logerror\n" + " Begin tracing the execution of CPU #0, logging output (along with logerror output) to starswep.tr.\n" + "\n" + "trace starswep.tr,0,logerror|noloop\n" + " Begin tracing the execution of CPU #0, logging output (along with logerror output) to starswep.tr, with loop detection disabled.\n" + "\n" "trace >>pigskin.tr\n" " Begin tracing the currently active CPU, appending log output to pigskin.tr.\n" "\n" "trace off,0\n" " Turn off tracing on CPU #0.\n" "\n" - "trace asteroid.tr,0,true,{tracelog \"A=%02X \",a}\n" + "trace asteroid.tr,0,,{tracelog \"A=%02X \",a}\n" " Begin tracing the execution of CPU #0, logging output to asteroid.tr. Before each line, " "output A=<aval> to the tracelog.\n" }, diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index a9f9e38816f..6e3a6a65354 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -114,7 +114,7 @@ public: // construction/destruction integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr = nullptr); integer_symbol_entry(symbol_table &table, const char *name, u64 constval); - integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter); + integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format); // symbol access virtual bool is_lval() const override; @@ -203,11 +203,12 @@ const char *expression_error::code_string() const // symbol_entry - constructor //------------------------------------------------- -symbol_entry::symbol_entry(symbol_table &table, symbol_type type, const char *name, void *ref) +symbol_entry::symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format, void *ref) : m_next(nullptr), m_table(table), m_type(type), m_name(name), + m_format(format), m_ref(ref) { } @@ -232,7 +233,7 @@ symbol_entry::~symbol_entry() //------------------------------------------------- integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr) - : symbol_entry(table, SMT_INTEGER, name, (ptr == nullptr) ? &m_value : ptr), + : symbol_entry(table, SMT_INTEGER, name, "", (ptr == nullptr) ? &m_value : ptr), m_getter(internal_getter), m_setter((rw == symbol_table::READ_ONLY) ? nullptr : internal_setter), m_value(0) @@ -241,7 +242,7 @@ integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, u64 constval) - : symbol_entry(table, SMT_INTEGER, name, &m_value), + : symbol_entry(table, SMT_INTEGER, name, "", &m_value), m_getter(internal_getter), m_setter(nullptr), m_value(constval) @@ -249,8 +250,8 @@ integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name } -integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter) - : symbol_entry(table, SMT_INTEGER, name, ref), +integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format) + : symbol_entry(table, SMT_INTEGER, name, format, ref), m_getter(getter), m_setter(setter), m_value(0) @@ -323,7 +324,7 @@ void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, u6 //------------------------------------------------- function_symbol_entry::function_symbol_entry(symbol_table &table, const char *name, void *ref, int minparams, int maxparams, symbol_table::execute_func execute) - : symbol_entry(table, SMT_FUNCTION, name, ref), + : symbol_entry(table, SMT_FUNCTION, name, "", ref), m_minparams(minparams), m_maxparams(maxparams), m_execute(execute) @@ -434,10 +435,10 @@ void symbol_table::add(const char *name, u64 value) // add - add a new register symbol //------------------------------------------------- -void symbol_table::add(const char *name, void *ref, getter_func getter, setter_func setter) +void symbol_table::add(const char *name, void *ref, getter_func getter, setter_func setter, const std::string &format_string) { m_symlist.erase(name); - m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, ref, getter, setter)); + m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, ref, getter, setter, format_string)); } @@ -951,7 +952,18 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *& // if we have an 0b prefix, we must be a binary value case 'b': case 'B': - return parse_number(token, buffer.c_str() + 2, 2, expression_error::INVALID_NUMBER); + try + { + return parse_number(token, buffer.c_str() + 2, 2, expression_error::INVALID_NUMBER); + } + catch (expression_error const &err) + { + // this is really a hack, but 0B1234 could also hex depending on default base + if (expression_error::INVALID_NUMBER == err) + return parse_number(token, buffer.c_str(), DEFAULT_BASE, expression_error::INVALID_NUMBER); + else + throw; + } // TODO: for octal address spaces, treat 0123 as octal default: diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index b9ddde14501..e255ae7b0e2 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -116,13 +116,14 @@ protected: }; // construction/destruction - symbol_entry(symbol_table &table, symbol_type type, const char *name, void *ref); + symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format, void *ref); public: virtual ~symbol_entry(); // getters symbol_entry *next() const { return m_next; } const char *name() const { return m_name.c_str(); } + const std::string &format() const { return m_format; } // type checking bool is_function() const { return (m_type == SMT_FUNCTION); } @@ -138,6 +139,7 @@ protected: symbol_table & m_table; // pointer back to the owning table symbol_type m_type; // type of symbol std::string m_name; // name of the symbol + std::string m_format; // format of symbol (or empty if unspecified) void * m_ref; // internal reference }; @@ -181,7 +183,7 @@ public: // symbol access void add(const char *name, read_write rw, u64 *ptr = nullptr); void add(const char *name, u64 constvalue); - void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr); + void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr, const std::string &format_string = ""); void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute); symbol_entry *find(const char *name) const { if (name) { auto search = m_symlist.find(name); if (search != m_symlist.end()) return search->second.get(); else return nullptr; } else return nullptr; } symbol_entry *find_deep(const char *name); diff --git a/src/emu/distate.h b/src/emu/distate.h index e10cdd1c16a..22db6cc22af 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -65,6 +65,7 @@ public: bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); } bool divider() const { return m_flags & DSF_DIVIDER; } device_state_interface *parent_state() const {return m_device_state;} + const std::string &format_string() const { return m_format; } protected: // device state flags diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index b6463a99f9d..d74d6278eb4 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -205,9 +205,9 @@ const options_entry emu_options::s_option_entries[] = { OPTION_LANGUAGE ";lang", "English", OPTION_STRING, "display language" }, { nullptr, nullptr, OPTION_HEADER, "HTTP SERVER OPTIONS" }, - { OPTION_HTTP, "0", OPTION_BOOLEAN, "HTTP server enable" }, - { OPTION_HTTP_PORT, "8080", OPTION_INTEGER, "HTTP server port" }, - { OPTION_HTTP_ROOT, "web", OPTION_STRING, "HTTP server document root" }, + { OPTION_HTTP, "0", OPTION_BOOLEAN, "HTTP server enable" }, + { OPTION_HTTP_PORT, "8080", OPTION_INTEGER, "HTTP server port" }, + { OPTION_HTTP_ROOT, "web", OPTION_STRING, "HTTP server document root" }, { nullptr } }; diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 99b5463f540..c1114748900 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -190,7 +190,7 @@ #define OPTION_LANGUAGE "language" -#define OPTION_HTTP "http" +#define OPTION_HTTP "http" #define OPTION_HTTP_PORT "http_port" #define OPTION_HTTP_ROOT "http_root" diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 4d106912d7b..6ffff130915 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -1388,9 +1388,9 @@ ioport_field_live::ioport_field_live(ioport_field &field, analog_field *analog) if (field.type_class() == INPUT_CLASS_KEYBOARD && field.specific_name() == nullptr) { // loop through each character on the field - for (int which = 0; ; which++) + for (int which = 0; which < 4; which++) { - char32_t ch = field.keyboard_code(which); + char32_t const ch = field.keyboard_code(which); if (ch == 0) break; name.append(string_format("%-*s ", std::max(SPACE_COUNT - 1, 0), field.key_name(which))); diff --git a/src/emu/logmacro.h b/src/emu/logmacro.h new file mode 100644 index 00000000000..0f7860aec57 --- /dev/null +++ b/src/emu/logmacro.h @@ -0,0 +1,22 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#if defined(MAME_EMU_LOGMACRO_H) || !defined(__EMU_H__) +#error This file should only be included once per compilation unit after all other headers +#endif +#define MAME_EMU_LOGMACRO_H + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#ifndef LOG_OUTPUT_FUNC +#define LOG_OUTPUT_FUNC logerror +#endif + +#ifndef LOG_GENERAL +#define LOG_GENERAL (1U << 0) +#endif + +#define LOGMASKED(mask, ...) do { if (VERBOSE & (mask)) (LOG_OUTPUT_FUNC)(__VA_ARGS__); } while (false) + +#define LOG(...) LOGMASKED(LOG_GENERAL, __VA_ARGS__) diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index d528d9afd40..b32d94582b8 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -1184,7 +1184,7 @@ running_machine::logerror_callback_item::logerror_callback_item(logerror_callbac void running_machine::export_http_api() { if (!options().http()) return; - + m_manager.http_server()->on_get("/api/machine", [this](auto response, auto request) { rapidjson::StringBuffer s; @@ -1195,7 +1195,7 @@ void running_machine::export_http_api() writer.Key("devices"); writer.StartArray(); - + device_iterator iter(this->root_device()); for (device_t &device : iter) writer.String(device.tag()); diff --git a/src/emu/main.cpp b/src/emu/main.cpp index ea77d976b00..54890c5dff0 100644 --- a/src/emu/main.cpp +++ b/src/emu/main.cpp @@ -109,10 +109,10 @@ static std::string extension_to_type(const std::string& extension) return "text/plain"; } -machine_manager::machine_manager(emu_options& options, osd_interface& osd) - : m_osd(osd), - m_options(options), - m_machine(nullptr), +machine_manager::machine_manager(emu_options& options, osd_interface& osd) + : m_osd(osd), + m_options(options), + m_machine(nullptr), m_io_context(std::make_shared<asio::io_context>()) { } @@ -184,7 +184,7 @@ void machine_manager::start_http_server() *send_stream << "update_machine"; m_wsserver->send(connection, send_stream); }; - + m_server->on_upgrade = [this](auto socket, auto request) { auto connection = std::make_shared<webpp::ws_server::Connection>(socket); connection->method = std::move(request->method); diff --git a/src/emu/main.h b/src/emu/main.h index 3a5f5a5c689..9d6f0e01459 100644 --- a/src/emu/main.h +++ b/src/emu/main.h @@ -108,7 +108,7 @@ protected: std::shared_ptr<asio::io_context> m_io_context; std::unique_ptr<webpp::http_server> m_server; std::unique_ptr<webpp::ws_server> m_wsserver; - std::thread m_server_thread; + std::thread m_server_thread; }; diff --git a/src/emu/natkeyboard.cpp b/src/emu/natkeyboard.cpp index a5d856a20e9..e1921b7a21d 100644 --- a/src/emu/natkeyboard.cpp +++ b/src/emu/natkeyboard.cpp @@ -314,17 +314,18 @@ const char_info charinfo[] = //------------------------------------------------- natural_keyboard::natural_keyboard(running_machine &machine) - : m_machine(machine), - m_in_use(false), - m_bufbegin(0), - m_bufend(0), - m_status_keydown(false), - m_last_cr(false), - m_timer(nullptr), - m_current_rate(attotime::zero), - m_queue_chars(), - m_accept_char(), - m_charqueue_empty() + : m_machine(machine) + , m_in_use(false) + , m_bufbegin(0) + , m_bufend(0) + , m_fieldnum(0) + , m_status_keydown(false) + , m_last_cr(false) + , m_timer(nullptr) + , m_current_rate(attotime::zero) + , m_queue_chars() + , m_accept_char() + , m_charqueue_empty() { // try building a list of keycodes; if none are available, don't bother build_codes(machine.ioport()); @@ -571,48 +572,68 @@ void natural_keyboard::post_coded(const char *text, size_t length, const attotim void natural_keyboard::build_codes(ioport_manager &manager) { - // iterate over shift keys - ioport_field *shift[UCHAR_SHIFT_END + 1 - UCHAR_SHIFT_BEGIN] = { nullptr }; - for (int curshift = 0; curshift <= ARRAY_LENGTH(shift); curshift++) - if (curshift == 0 || shift[curshift - 1] != nullptr) - - // iterate over ports and fields - for (auto &port : manager.ports()) - for (ioport_field &field : port.second->fields()) - if (field.type() == IPT_KEYBOARD) - { - // fetch the code, ignoring 0 - char32_t code = field.keyboard_code(curshift); - if (code == 0) - continue; - - // is this a shifter key? - if (code >= UCHAR_SHIFT_BEGIN && code <= UCHAR_SHIFT_END) - shift[code - UCHAR_SHIFT_BEGIN] = &field; + // find all shfit keys + unsigned mask = 0; + ioport_field *shift[SHIFT_COUNT]; + std::fill(std::begin(shift), std::end(shift), nullptr); + for (auto const &port : manager.ports()) + { + for (ioport_field &field : port.second->fields()) + { + if (field.type() == IPT_KEYBOARD) + { + char32_t const code = field.keyboard_code(0); + if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END)) + { + mask |= 1U << (code - UCHAR_SHIFT_BEGIN); + shift[code - UCHAR_SHIFT_BEGIN] = &field; + } + } + } + } - // not a shifter key; record normally - else + // iterate over ports and fields + for (auto const &port : manager.ports()) + { + for (ioport_field &field : port.second->fields()) + { + if (field.type() == IPT_KEYBOARD) + { + // iterate over all shift states + for (unsigned curshift = 0; curshift < SHIFT_STATES; ++curshift) + { + if (!(curshift & ~mask)) + { + // fetch the code, ignoring 0 and shiters + char32_t const code = field.keyboard_code(curshift); + if (((code < UCHAR_SHIFT_BEGIN) || (code > UCHAR_SHIFT_END)) && (code != 0)) { keycode_map_entry newcode; - if (curshift == 0) - { - newcode.field[0] = &field; - newcode.field[1] = nullptr; - } - else + newcode.ch = code; + std::fill(std::begin(newcode.field), std::end(newcode.field), nullptr); + + unsigned fieldnum = 0; + for (unsigned i = 0, bits = curshift; (i < SHIFT_COUNT) && bits; ++i, bits >>= 1) { - newcode.field[0] = shift[curshift - 1]; - newcode.field[1] = &field; + if (BIT(bits, 0)) + newcode.field[fieldnum++] = shift[i]; } - newcode.ch = code; - m_keycode_map.push_back(newcode); + + assert(fieldnum < ARRAY_LENGTH(newcode.field)); + newcode.field[fieldnum] = &field; + m_keycode_map.push_back(std::move(newcode)); if (LOG_NATURAL_KEYBOARD) { - machine().logerror("natural_keyboard: code=%i (%s) port=%p field.name='%s'\n", int(code), unicode_to_string(code).c_str(), (void *)&port, field.name()); + machine().logerror("natural_keyboard: code=%u (%s) port=%p field.name='%s'\n", + code, unicode_to_string(code), (void *)&port, field.name()); } } } + } + } + } + } } @@ -692,7 +713,8 @@ void natural_keyboard::internal_post(char32_t ch) if (empty()) { m_timer->adjust(choose_delay(ch)); - m_status_keydown = 0; + m_fieldnum = 0; + m_status_keydown = false; } // add to the buffer, resizing if necessary @@ -710,9 +732,9 @@ void natural_keyboard::internal_post(char32_t ch) void natural_keyboard::timer(void *ptr, int param) { - // the driver has a queue_chars handler if (!m_queue_chars.isnull()) { + // the driver has a queue_chars handler while (!empty() && m_queue_chars(&m_buffer[m_bufbegin], 1)) { m_bufbegin = (m_bufbegin + 1) % m_buffer.size(); @@ -720,36 +742,46 @@ void natural_keyboard::timer(void *ptr, int param) break; } } - - // the driver does not have a queue_chars handler else { + // the driver does not have a queue_chars handler + // loop through this character's component codes - const bool new_keydown = !m_status_keydown; const keycode_map_entry *const code = find_code(m_buffer[m_bufbegin]); - if (code != nullptr) + bool advance; + if (code) { - for (int fieldnum = 0; fieldnum < ARRAY_LENGTH(code->field); fieldnum++) + do { - ioport_field *const field = code->field[fieldnum]; - if (field == nullptr) - break; + assert(m_fieldnum < ARRAY_LENGTH(code->field)); - // special handling for toggle fields - if (field->live().toggle) + ioport_field *const field = code->field[m_fieldnum]; + if (field) { - if (new_keydown) + // special handling for toggle fields + if (!field->live().toggle) + field->set_value(!m_status_keydown); + else if (!m_status_keydown) field->set_value(!field->digital_value()); } - else - field->set_value(new_keydown); } + while (code->field[m_fieldnum] && (++m_fieldnum < ARRAY_LENGTH(code->field)) && m_status_keydown); + advance = (m_fieldnum >= ARRAY_LENGTH(code->field)) || !code->field[m_fieldnum]; + } + else + { + advance = true; } - // proceed to next character when keydown expires - if (!new_keydown) - m_bufbegin = (m_bufbegin + 1) % m_buffer.size(); - m_status_keydown = new_keydown; + if (advance) + { + m_fieldnum = 0; + m_status_keydown = !m_status_keydown; + + // proceed to next character when keydown expires + if (!m_status_keydown) + m_bufbegin = (m_bufbegin + 1) % m_buffer.size(); + } } // need to make sure timerproc is called again if buffer not empty diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h index 74bc9ac72d5..e89d9b3f2ca 100644 --- a/src/emu/natkeyboard.h +++ b/src/emu/natkeyboard.h @@ -7,12 +7,11 @@ Natural keyboard input support. ***************************************************************************/ - -#pragma once - #ifndef EMU_NATKEYBOARD_H #define EMU_NATKEYBOARD_H +#pragma once + //************************************************************************** // TYPE DEFINITIONS @@ -57,11 +56,17 @@ public: std::string dump(); private: + enum + { + SHIFT_COUNT = UCHAR_SHIFT_END - UCHAR_SHIFT_BEGIN + 1, + SHIFT_STATES = 1 << SHIFT_COUNT + }; + // internal keyboard code information struct keycode_map_entry { - char32_t ch; - ioport_field * field[UCHAR_SHIFT_END + 1 - UCHAR_SHIFT_BEGIN]; + char32_t ch; + ioport_field * field[SHIFT_COUNT + 1]; }; // internal helpers @@ -80,6 +85,7 @@ private: u32 m_bufbegin; // index of starting character u32 m_bufend; // index of ending character std::vector<char32_t> m_buffer; // actual buffer + unsigned m_fieldnum; // current step in multi-key sequence bool m_status_keydown; // current keydown status bool m_last_cr; // was the last char a CR? emu_timer * m_timer; // timer for posting characters diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp index 2c758ed1020..606d1ec74f0 100644 --- a/src/frontend/mame/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -73,13 +73,19 @@ ***************************************************************************/ #include "emu.h" -#include "emuopts.h" +#include "cheat.h" + #include "mame.h" #include "ui/ui.h" #include "ui/menu.h" -#include "cheat.h" -#include "debug/debugcpu.h" + #include "debugger.h" +#include "emuopts.h" +#include "debug/debugcpu.h" + +#include <cstring> +#include <iterator> +#include <utility> #include <ctype.h> @@ -133,18 +139,18 @@ inline std::string number_and_format::format() const //------------------------------------------------- cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const ¶mnode) - : m_value(0) + : m_minval(number_and_format(paramnode.get_attribute_int("min", 0), paramnode.get_attribute_int_format("min"))) + , m_maxval(number_and_format(paramnode.get_attribute_int("max", 0), paramnode.get_attribute_int_format("max"))) + , m_stepval(number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step"))) + , m_value(0) + , m_curtext() + , m_itemlist() { - // read the core attributes - m_minval = number_and_format(paramnode.get_attribute_int("min", 0), paramnode.get_attribute_int_format("min")); - m_maxval = number_and_format(paramnode.get_attribute_int("max", 0), paramnode.get_attribute_int_format("max")); - m_stepval = number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step")); - // iterate over items 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) + if (!itemnode->get_value() || !itemnode->get_value()[0]) throw emu_fatalerror("%s.xml(%d): item is missing text\n", filename, itemnode->line); // check for non-existant value @@ -152,16 +158,14 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, throw emu_fatalerror("%s.xml(%d): item is value\n", filename, itemnode->line); // extract the parameters - uint64_t const value = itemnode->get_attribute_int("value", 0); - util::xml::data_node::int_format const format = itemnode->get_attribute_int_format("value"); + uint64_t const value(itemnode->get_attribute_int("value", 0)); + 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<item>(itemnode->get_value(), value, format); + item &curitem(*m_itemlist.emplace(m_itemlist.end(), itemnode->get_value(), value, format)); // ensure the maximum expands to suit - m_maxval = std::max(m_maxval, curitem->value()); - - m_itemlist.push_back(std::move(curitem)); + m_maxval = std::max(m_maxval, curitem.value()); } // add a variable to the symbol table for our value @@ -178,18 +182,20 @@ const char *cheat_parameter::text() // are we a value cheat? if (!has_itemlist()) { - m_curtext = string_format("%d (0x%X)", uint32_t(m_value), uint32_t(m_value)); + m_curtext = string_format("%u (0x%X)", uint64_t(m_value), uint64_t(m_value)); } else { // if not, we're an item cheat - m_curtext = string_format("??? (%d)", uint32_t(m_value)); - for (auto &curitem : m_itemlist) - if (curitem->value() == m_value) + m_curtext = string_format("??? (%u)", uint64_t(m_value)); + for (item const &curitem : m_itemlist) + { + if (curitem.value() == m_value) { - m_curtext.assign(curitem->text()); + m_curtext = curitem.text(); break; } + } } return m_curtext.c_str(); } @@ -204,9 +210,9 @@ void cheat_parameter::save(emu_file &cheatfile) const // output the parameter tag cheatfile.printf("\t\t<parameter"); - // if no items, just output min/max/step if (!has_itemlist()) { + // if no items, just output min/max/step if (m_minval != 0) cheatfile.printf(" min=\"%s\"", m_minval.format().c_str()); if (m_maxval != 0) @@ -215,13 +221,12 @@ void cheat_parameter::save(emu_file &cheatfile) const cheatfile.printf(" step=\"%s\"", m_stepval.format().c_str()); cheatfile.printf("/>\n"); } - - // iterate over items else { + // iterate over items cheatfile.printf(">\n"); - for (auto &curitem : m_itemlist) - cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format().c_str(), curitem->text()); + for (item const &curitem : m_itemlist) + cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem.value().format().c_str(), curitem.text()); cheatfile.printf("\t\t</parameter>\n"); } } @@ -233,12 +238,12 @@ void cheat_parameter::save(emu_file &cheatfile) const bool cheat_parameter::set_minimum_state() { - uint64_t origvalue = m_value; + uint64_t const origvalue(m_value); // set based on whether we have an item list - m_value = (!has_itemlist()) ? m_minval : m_itemlist.front()->value(); + m_value = !has_itemlist() ? m_minval : m_itemlist.front().value(); - return (m_value != origvalue); + return m_value != origvalue; } @@ -248,31 +253,26 @@ bool cheat_parameter::set_minimum_state() bool cheat_parameter::set_prev_state() { - uint64_t origvalue = m_value; + uint64_t const origvalue(m_value); - // are we a value cheat? if (!has_itemlist()) { - if (m_value < m_minval + m_stepval) + // are we a value cheat? + if (m_value < (m_minval + m_stepval)) m_value = m_minval; else m_value -= m_stepval; } - - // if not, we're an item cheat else { - item *previtem = nullptr; - for (auto &curitem : m_itemlist) { - if (curitem->value() == m_value) - break; - previtem = curitem.get(); - } - if (previtem != nullptr) - m_value = previtem->value(); + // if not, we're an item cheat + std::vector<item>::const_iterator it; + for (it = m_itemlist.begin(); (m_itemlist.end() != it) && (it->value() != m_value); ++it) { } + if (m_itemlist.begin() != it) + m_value = std::prev(it)->value(); } - return (m_value != origvalue); + return m_value != origvalue; } @@ -282,29 +282,26 @@ bool cheat_parameter::set_prev_state() bool cheat_parameter::set_next_state() { - uint64_t origvalue = m_value; + uint64_t const origvalue(m_value); - // are we a value cheat? if (!has_itemlist()) { + // are we a value cheat? if (m_value > m_maxval - m_stepval) m_value = m_maxval; else m_value += m_stepval; } - - // if not, we're an item cheat else { - std::vector<std::unique_ptr<item>>::iterator it; - for (it = m_itemlist.begin(); it != m_itemlist.end(); ++it) - if (it->get()->value() == m_value) - break; - if (it != m_itemlist.end() && (++it != m_itemlist.end())) - m_value = it->get()->value(); + // if not, we're an item cheat + std::vector<item>::const_iterator it; + for (it = m_itemlist.begin(); (m_itemlist.end() != it) && (it->value() != m_value); ++it) { } + if ((m_itemlist.end() != it) && (m_itemlist.end() != ++it)) + m_value = it->value(); } - return (m_value != origvalue); + return m_value != origvalue; } @@ -317,37 +314,33 @@ bool cheat_parameter::set_next_state() // cheat_script - constructor //------------------------------------------------- -cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode) +cheat_script::cheat_script( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &scriptnode) : m_state(SCRIPT_STATE_RUN) { // read the core attributes - const char *state = scriptnode.get_attribute_string("state", "run"); - if (strcmp(state, "on") == 0) + char const *const state(scriptnode.get_attribute_string("state", "run")); + if (!std::strcmp(state, "on")) m_state = SCRIPT_STATE_ON; - else if (strcmp(state, "off") == 0) + else if (!std::strcmp(state, "off")) m_state = SCRIPT_STATE_OFF; - else if (strcmp(state, "change") == 0) + else if (!std::strcmp(state, "change")) m_state = SCRIPT_STATE_CHANGE; - else if (strcmp(state, "run") != 0) + else if (std::strcmp(state, "run")) throw emu_fatalerror("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode.line, state); // iterate over nodes within the script 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) + if (!std::strcmp(entrynode->get_name(), "action")) // handle action nodes m_entrylist.push_back(std::make_unique<script_entry>(manager, symbols, filename, *entrynode, true)); - - // handle output nodes - else if (strcmp(entrynode->get_name(), "output") == 0) + else if (!std::strcmp(entrynode->get_name(), "output")) // handle output nodes m_entrylist.push_back(std::make_unique<script_entry>(manager, symbols, filename, *entrynode, false)); - - // anything else is ignored - else - { + else // anything else is ignored osd_printf_warning("%s.xml(%d): unknown script item '%s' will be lost if saved\n", filename, entrynode->line, entrynode->get_name()); - continue; - } } } @@ -378,11 +371,11 @@ void cheat_script::save(emu_file &cheatfile) const cheatfile.printf("\t\t<script"); switch (m_state) { - case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break; - case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break; - default: - case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break; - case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break; + case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break; + case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break; + default: + case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break; + case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break; } cheatfile.printf(">\n"); @@ -399,49 +392,54 @@ 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, util::xml::data_node const &entrynode, bool isaction) - : m_condition(&symbols), - m_expression(&symbols) +cheat_script::script_entry::script_entry( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &entrynode, + bool isaction) + : m_condition(&symbols) + , m_expression(&symbols) { - const char *expression = nullptr; + char const *expression(nullptr); try { // read the condition if present expression = entrynode.get_attribute_string("condition", nullptr); - if (expression != nullptr) + if (expression) m_condition.parse(expression); - // if this is an action, parse the expression if (isaction) { + // if this is an action, parse the expression expression = entrynode.get_value(); - if (expression == nullptr || expression[0] == 0) + if (!expression || !expression[0]) throw emu_fatalerror("%s.xml(%d): missing expression in action tag\n", filename, entrynode.line); m_expression.parse(expression); } - - // otherwise, parse the attributes and arguments else { + // otherwise, parse the attributes and arguments + // extract format - const char *format = entrynode.get_attribute_string("format", nullptr); - if (format == nullptr || format[0] == 0) + char const *const format(entrynode.get_attribute_string("format", nullptr)); + if (!format || !format[0]) throw emu_fatalerror("%s.xml(%d): missing format in output tag\n", filename, entrynode.line); - m_format.assign(format); + m_format = format; // extract other attributes m_line = entrynode.get_attribute_int("line", 0); m_justify = ui::text_layout::LEFT; - const char *align = entrynode.get_attribute_string("align", "left"); - if (strcmp(align, "center") == 0) + char const *const align(entrynode.get_attribute_string("align", "left")); + if (!std::strcmp(align, "center")) m_justify = ui::text_layout::CENTER; - else if (strcmp(align, "right") == 0) + else if (!std::strcmp(align, "right")) m_justify = ui::text_layout::RIGHT; - else if (strcmp(align, "left") != 0) + else if (std::strcmp(align, "left")) throw emu_fatalerror("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode.line, align); // then parse arguments - int totalargs = 0; + int totalargs(0); for (util::xml::data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument")) { auto curarg = std::make_unique<output_argument>(manager, symbols, filename, *argnode); @@ -458,7 +456,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s validate_format(filename, entrynode.line); } } - catch (expression_error &err) + catch (expression_error const &err) { throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode.line, expression, err.code_string()); } @@ -476,11 +474,11 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin { try { - uint64_t result = m_condition.execute(); - if (result == 0) + uint64_t const result(m_condition.execute()); + if (!result) return; } - catch (expression_error &err) + catch (expression_error const &err) { osd_printf_warning("Error executing conditional expression \"%s\": %s\n", m_condition.original_string(), err.code_string()); return; @@ -511,14 +509,14 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin // generate the astring manager.get_output_string(m_line, m_justify) = string_format(m_format, - (uint32_t)params[0], (uint32_t)params[1], (uint32_t)params[2], (uint32_t)params[3], - (uint32_t)params[4], (uint32_t)params[5], (uint32_t)params[6], (uint32_t)params[7], - (uint32_t)params[8], (uint32_t)params[9], (uint32_t)params[10], (uint32_t)params[11], - (uint32_t)params[12], (uint32_t)params[13], (uint32_t)params[14], (uint32_t)params[15], - (uint32_t)params[16], (uint32_t)params[17], (uint32_t)params[18], (uint32_t)params[19], - (uint32_t)params[20], (uint32_t)params[21], (uint32_t)params[22], (uint32_t)params[23], - (uint32_t)params[24], (uint32_t)params[25], (uint32_t)params[26], (uint32_t)params[27], - (uint32_t)params[28], (uint32_t)params[29], (uint32_t)params[30], (uint32_t)params[31]); + params[0], params[1], params[2], params[3], + params[4], params[5], params[6], params[7], + params[8], params[9], params[10], params[11], + params[12], params[13], params[14], params[15], + params[16], params[17], params[18], params[19], + params[20], params[21], params[22], params[23], + params[24], params[25], params[26], params[27], + params[28], params[29], params[30], params[31]); } } @@ -529,33 +527,36 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin void cheat_script::script_entry::save(emu_file &cheatfile) const { - // output an action if (m_format.empty()) { + // output an action cheatfile.printf("\t\t\t<action"); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(m_expression).c_str()); } - - // output an output else { + // output an output cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.c_str()); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); + if (m_line != 0) cheatfile.printf(" line=\"%d\"", m_line); + if (m_justify == ui::text_layout::CENTER) cheatfile.printf(" align=\"center\""); else if (m_justify == ui::text_layout::RIGHT) cheatfile.printf(" align=\"right\""); + if (m_arglist.size() == 0) + { cheatfile.printf(" />\n"); - - // output arguments + } else { + // output arguments cheatfile.printf(">\n"); for (auto &curarg : m_arglist) curarg->save(cheatfile); @@ -573,27 +574,20 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const void cheat_script::script_entry::validate_format(const char *filename, int line) { // first count arguments - int argsprovided = 0; + int argsprovided(0); for (auto &curarg : m_arglist) argsprovided += curarg->count(); // now scan the string for valid argument usage - const char *p = strchr(m_format.c_str(), '%'); int argscounted = 0; - while (p != nullptr) + for (char const *p = strchr(m_format.c_str(), '%'); p; ++argscounted, p = strchr(p, '%')) { // skip past any valid attributes - p++; - while (strchr("lh0123456789.-+ #", *p) != nullptr) - p++; + for (++p; strchr("lh0123456789.-+ #", *p); ++p) { } // look for a valid type - if (strchr("cdiouxX", *p) == nullptr) + if (!strchr("cdiouxX", *p)) throw emu_fatalerror("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, m_format.c_str()); - argscounted++; - - // look for the next one - p = strchr(p, '%'); } // did we match? @@ -608,16 +602,20 @@ 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, util::xml::data_node const &argnode) - : m_expression(&symbols), - m_count(0) +cheat_script::script_entry::output_argument::output_argument( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &argnode) + : m_expression(&symbols) + , m_count(0) { // first extract attributes m_count = argnode.get_attribute_int("count", 1); // read the expression - const char *expression = argnode.get_value(); - if (expression == nullptr || expression[0] == 0) + char const *const expression(argnode.get_value()); + if (!expression || !expression[0]) throw emu_fatalerror("%s.xml(%d): missing expression in argument tag\n", filename, argnode.line); // parse it @@ -625,7 +623,7 @@ cheat_script::script_entry::output_argument::output_argument(cheat_manager &mana { m_expression.parse(expression); } - catch (expression_error &err) + catch (expression_error const &err) { throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode.line, expression, err.code_string()); } @@ -645,7 +643,7 @@ int cheat_script::script_entry::output_argument::values(uint64_t &argindex, uint { result[argindex] = m_expression.execute(); } - catch (expression_error &err) + catch (expression_error const &err) { osd_printf_warning("Error executing argument expression \"%s\": %s\n", m_expression.original_string(), err.code_string()); } @@ -662,7 +660,7 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons { cheatfile.printf("\t\t\t\t<argument"); if (m_count != 1) - cheatfile.printf(" count=\"%d\"", (int)m_count); + cheatfile.printf(" count=\"%d\"", int(m_count)); cheatfile.printf(">%s</argument>\n", cheat_manager::quote_expression(m_expression).c_str()); } @@ -683,75 +681,64 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons , m_numtemp(DEFAULT_TEMP_VARIABLES) , m_argindex(0) { - // reset scripts - try + // pull the variable count out ahead of things + int const tempcount(cheatnode.get_attribute_int("tempvariables", DEFAULT_TEMP_VARIABLES)); + if (tempcount < 1) + throw emu_fatalerror("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode.line, tempcount); + + // allocate memory for the cheat + m_numtemp = tempcount; + + // get the description + char const *const description(cheatnode.get_attribute_string("desc", nullptr)); + if (!description || !description[0]) + throw emu_fatalerror("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode.line); + m_description = description; + + // create the symbol table + m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex); + for (int curtemp = 0; curtemp < tempcount; curtemp++) + m_symbols.add(string_format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE); + + // read the first comment node + util::xml::data_node const *const commentnode(cheatnode.get_child("comment")); + if (commentnode != nullptr) { - // pull the variable count out ahead of things - int tempcount = cheatnode.get_attribute_int("tempvariables", DEFAULT_TEMP_VARIABLES); - if (tempcount < 1) - throw emu_fatalerror("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode.line, tempcount); - - // allocate memory for the cheat - m_numtemp = tempcount; - - // get the description - const char *description = cheatnode.get_attribute_string("desc", nullptr); - if (description == nullptr || description[0] == 0) - throw emu_fatalerror("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode.line); - m_description = description; - - // create the symbol table - m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex); - for (int curtemp = 0; curtemp < tempcount; curtemp++) { - m_symbols.add(string_format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE); - } - - // read the first comment node - util::xml::data_node const *commentnode = cheatnode.get_child("comment"); - if (commentnode != nullptr) - { - // set the value if not nullptr - if (commentnode->get_value() != nullptr && commentnode->get_value()[0] != 0) - m_comment.assign(commentnode->get_value()); - - // only one comment is kept - commentnode = commentnode->get_next_sibling("comment"); - if (commentnode != nullptr) - osd_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, commentnode->line); - } - - // read the first parameter node - util::xml::data_node const *paramnode = cheatnode.get_child("parameter"); - if (paramnode != nullptr) - { - // load this parameter - m_parameter.reset(global_alloc(cheat_parameter(manager, m_symbols, filename, *paramnode))); - - // only one parameter allowed - paramnode = paramnode->get_next_sibling("parameter"); - if (paramnode != nullptr) - osd_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, paramnode->line); - } + // set the value if not nullptr + if (commentnode->get_value() && commentnode->get_value()[0]) + m_comment.assign(commentnode->get_value()); + + // only one comment is kept + util::xml::data_node const *const nextcomment(commentnode->get_next_sibling("comment")); + if (nextcomment) + osd_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, nextcomment->line); + } - // read the script nodes - 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)); + // read the first parameter node + util::xml::data_node const *const paramnode(cheatnode.get_child("parameter")); + if (paramnode != nullptr) + { + // load this parameter + m_parameter.reset(new cheat_parameter(manager, m_symbols, filename, *paramnode)); - // if we have a script already for this slot, it is an error - std::unique_ptr<cheat_script> &slot = script_for_state(curscript->state()); - if (slot != nullptr) - osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line); - else - slot.reset(curscript); - } + // only one parameter allowed + util::xml::data_node const *const nextparam(paramnode->get_next_sibling("parameter")); + if (nextparam) + osd_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, nextparam->line); } - catch (emu_fatalerror &) + + // read the script nodes + for (util::xml::data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script")) { - // call our destructor to clean up and re-throw - this->~cheat_entry(); - throw; + // load this entry + std::unique_ptr<cheat_script> curscript(new cheat_script(manager, m_symbols, filename, *scriptnode)); + + // if we have a script already for this slot, it is an error + std::unique_ptr<cheat_script> &slot = script_for_state(curscript->state()); + if (slot) + osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line); + else + slot = std::move(curscript); } } @@ -772,14 +759,17 @@ cheat_entry::~cheat_entry() void cheat_entry::save(emu_file &cheatfile) const { // determine if we have scripts - bool has_scripts = (m_off_script != nullptr || m_on_script != nullptr || m_run_script != nullptr || m_change_script != nullptr); + bool const has_scripts(m_off_script || m_on_script || m_run_script || m_change_script); // output the cheat tag cheatfile.printf("\t<cheat desc=\"%s\"", m_description.c_str()); if (m_numtemp != DEFAULT_TEMP_VARIABLES) cheatfile.printf(" tempvariables=\"%d\"", m_numtemp); - if (m_comment.empty() && m_parameter == nullptr && !has_scripts) + + if (m_comment.empty() && !m_parameter && !has_scripts) + { cheatfile.printf(" />\n"); + } else { cheatfile.printf(">\n"); @@ -789,18 +779,13 @@ void cheat_entry::save(emu_file &cheatfile) const cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.c_str()); // output the parameter, if present - if (m_parameter != nullptr) - m_parameter->save(cheatfile); + if (m_parameter) m_parameter->save(cheatfile); // output the script nodes - if (m_on_script != nullptr) - m_on_script->save(cheatfile); - if (m_off_script != nullptr) - m_off_script->save(cheatfile); - if (m_change_script != nullptr) - m_change_script->save(cheatfile); - if (m_run_script != nullptr) - m_run_script->save(cheatfile); + if (m_on_script) m_on_script->save(cheatfile); + if (m_off_script) m_off_script->save(cheatfile); + if (m_change_script) m_change_script->save(cheatfile); + if (m_run_script) m_run_script->save(cheatfile); // close the cheat tag cheatfile.printf("\t</cheat>\n"); @@ -814,23 +799,22 @@ void cheat_entry::save(emu_file &cheatfile) const bool cheat_entry::activate() { - bool changed = false; + bool changed(false); // if cheats have been toggled off no point in even trying to do anything if (!m_manager.enabled()) return changed; - // if we're a oneshot cheat, execute the "on" script and indicate change if (is_oneshot()) { + // if we're a oneshot cheat, execute the "on" script and indicate change execute_on_script(); changed = true; m_manager.machine().popmessage("Activated %s", m_description.c_str()); } - - // if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change - else if (is_oneshot_parameter() && m_state != SCRIPT_STATE_OFF) + else if (is_oneshot_parameter() && (m_state != SCRIPT_STATE_OFF)) { + // if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change execute_change_script(); changed = true; m_manager.machine().popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text()); @@ -847,15 +831,17 @@ bool cheat_entry::activate() bool cheat_entry::select_default_state() { - bool changed = false; + bool changed(false); - // if we're a oneshot cheat, there is no default state if (is_oneshot()) - ; - - // all other types switch to the "off" state + { + // if we're a oneshot cheat, there is no default state + } else + { + // all other types switch to the "off" state changed = set_state(SCRIPT_STATE_OFF); + } return changed; } @@ -868,22 +854,26 @@ bool cheat_entry::select_default_state() bool cheat_entry::select_previous_state() { - bool changed = false; + bool changed(false); - // if we're a oneshot, there is no previous state if (is_oneshot()) - ; - - // if we're on/off, toggle to off + { + // if we're a oneshot, there is no previous state + } else if (is_onoff()) + { + // if we're on/off, toggle to off changed = set_state(SCRIPT_STATE_OFF); - - // if we have a parameter, set the previous state + } else if (m_parameter != nullptr) { + // if we have a parameter, set the previous state + // if we're at our minimum, turn off if (m_parameter->is_minimum()) + { changed = set_state(SCRIPT_STATE_OFF); + } else { // if we changed, ensure we are in the running state and signal state change @@ -896,6 +886,7 @@ bool cheat_entry::select_previous_state() } } } + return changed; } @@ -907,34 +898,37 @@ bool cheat_entry::select_previous_state() bool cheat_entry::select_next_state() { - bool changed = false; + bool changed(false); - // if we're a oneshot, there is no next state if (is_oneshot()) - ; - - // if we're on/off, toggle to running state + { + // if we're a oneshot, there is no next state + } else if (is_onoff()) + { + // if we're on/off, toggle to running state changed = set_state(SCRIPT_STATE_RUN); - - // if we have a parameter, set the next state + } else if (m_parameter != nullptr) { - // if we're off, switch on to the minimum state + // if we have a parameter, set the next state if (m_state == SCRIPT_STATE_OFF) { + // if we're off, switch on to the minimum state changed = set_state(SCRIPT_STATE_RUN); m_parameter->set_minimum_state(); } - - // otherwise, switch to the next state else + { + // otherwise, switch to the next state changed = m_parameter->set_next_state(); + } // if we changed, signal a state change if (changed && !is_oneshot_parameter()) execute_change_script(); } + return changed; } @@ -947,44 +941,43 @@ bool cheat_entry::select_next_state() void cheat_entry::menu_text(std::string &description, std::string &state, uint32_t &flags) { // description is standard - description.assign(m_description); + description = m_description; state.clear(); flags = 0; - // some cheat entries are just text for display if (is_text_only()) { + // some cheat entries are just text for display if (!description.empty()) { strtrimspace(description); if (description.empty()) - description.assign(MENU_SEPARATOR_ITEM); + description = MENU_SEPARATOR_ITEM; } flags = ui::menu::FLAG_DISABLE; } - - // if we have no parameter and no run or off script, it's a oneshot cheat else if (is_oneshot()) - state.assign("Set"); - - // if we have no parameter, it's just on/off + { + // if we have no parameter and no run or off script, it's a oneshot cheat + state = "Set"; + } else if (is_onoff()) { - state.assign((m_state == SCRIPT_STATE_RUN) ? "On" : "Off"); + // if we have no parameter, it's just on/off + state = (m_state == SCRIPT_STATE_RUN) ? "On" : "Off"; flags = (m_state != 0) ? ui::menu::FLAG_LEFT_ARROW : ui::menu::FLAG_RIGHT_ARROW; } - - // if we have a value parameter, compute it else if (m_parameter != nullptr) { + // if we have a value parameter, compute it if (m_state == SCRIPT_STATE_OFF) { - state.assign(is_oneshot_parameter() ? "Set" : "Off"); + state = is_oneshot_parameter() ? "Set" : "Off"; flags = ui::menu::FLAG_RIGHT_ARROW; } else { - state.assign(m_parameter->text()); + state = m_parameter->text(); flags = ui::menu::FLAG_LEFT_ARROW; if (!m_parameter->is_maximum()) flags |= ui::menu::FLAG_RIGHT_ARROW; @@ -1007,8 +1000,9 @@ bool cheat_entry::set_state(script_state newstate) m_state = newstate; if (newstate == SCRIPT_STATE_OFF) execute_off_script(); - else if (newstate == SCRIPT_STATE_ON || newstate == SCRIPT_STATE_RUN) + else if ((newstate == SCRIPT_STATE_ON) || (newstate == SCRIPT_STATE_RUN)) execute_on_script(); + return true; } @@ -1022,11 +1016,11 @@ std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state) { switch (state) { - case SCRIPT_STATE_ON: return m_on_script; - case SCRIPT_STATE_OFF: return m_off_script; - case SCRIPT_STATE_CHANGE: return m_change_script; - default: - case SCRIPT_STATE_RUN: return m_run_script; + case SCRIPT_STATE_ON: return m_on_script; + case SCRIPT_STATE_OFF: return m_off_script; + case SCRIPT_STATE_CHANGE: return m_change_script; + default: + case SCRIPT_STATE_RUN: return m_run_script; } } @@ -1039,8 +1033,10 @@ std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state) bool cheat_entry::is_duplicate() const { for (auto &scannode : manager().entries()) - if (strcmp(scannode->description(), description()) == 0) + { + if (!std::strcmp(scannode->description(), description())) return true; + } return false; } @@ -1049,7 +1045,7 @@ bool cheat_entry::is_duplicate() const // CHEAT MANAGER //************************************************************************** -const int cheat_manager::CHEAT_VERSION; +constexpr int cheat_manager::CHEAT_VERSION; //------------------------------------------------- @@ -1057,16 +1053,16 @@ const int cheat_manager::CHEAT_VERSION; //------------------------------------------------- cheat_manager::cheat_manager(running_machine &machine) - : m_machine(machine), - m_disabled(true), - m_symtable(&machine) + : m_machine(machine) + , m_disabled(true) + , m_symtable(&machine) { // if the cheat engine is disabled, we're done if (!machine.options().cheat()) return; - m_output.resize(UI_TARGET_FONT_ROWS*2); - m_justify.resize(UI_TARGET_FONT_ROWS*2); + m_output.resize(UI_TARGET_FONT_ROWS * 2); + m_justify.resize(UI_TARGET_FONT_ROWS * 2); // request a callback machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(&cheat_manager::frame_update, this)); @@ -1105,25 +1101,30 @@ void cheat_manager::set_enable(bool enable) if (!machine().options().cheat()) return; - // if we're enabled currently and we don't want to be, turn things off if (!m_disabled && !enable) { + // if we're enabled currently and we don't want to be, turn things off + // iterate over running cheats and execute any OFF Scripts for (auto &cheat : m_cheatlist) + { if (cheat->state() == SCRIPT_STATE_RUN) cheat->execute_off_script(); + } machine().popmessage("Cheats Disabled"); m_disabled = true; } - - // if we're disabled currently and we want to be enabled, turn things on else if (m_disabled && enable) { + // if we're disabled currently and we want to be enabled, turn things on + // iterate over running cheats and execute any ON Scripts m_disabled = false; for (auto &cheat : m_cheatlist) + { if (cheat->state() == SCRIPT_STATE_RUN) cheat->execute_on_script(); + } machine().popmessage("Cheats Enabled"); } } @@ -1152,6 +1153,7 @@ void cheat_manager::reload() // load the cheat file, if it's a system that has a software list then try softlist_name/shortname.xml first, // if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml ) for (device_image_interface &image : image_interface_iterator(machine().root_device())) + { if (image.exists()) { // if we are loading through a software list, try to load softlist_name/shortname.xml @@ -1173,9 +1175,10 @@ void cheat_manager::reload() } } } + } // if we haven't found the cheats yet, load by basename - if (m_cheatlist.size() == 0) + if (m_cheatlist.empty()) load_cheats(machine().basename()); // temporary: save the file back out as output.xml for comparison @@ -1193,7 +1196,7 @@ bool cheat_manager::save_all(const char *filename) { // open the file with the proper name emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - osd_file::error filerr = cheatfile.open(filename, ".xml"); + osd_file::error const filerr(cheatfile.open(filename, ".xml")); // if that failed, return nothing if (filerr != osd_file::error::NONE) @@ -1215,10 +1218,9 @@ bool cheat_manager::save_all(const char *filename) cheatfile.printf("</mamecheat>\n"); return true; } - - // catch errors and cleanup - catch (emu_fatalerror &err) + catch (emu_fatalerror const &err) { + // catch errors and cleanup osd_printf_error("%s\n", err.string()); cheatfile.remove_on_close(); } @@ -1235,14 +1237,16 @@ void cheat_manager::render_text(mame_ui_manager &mui, render_container &containe { // render any text and free it along the way for (int linenum = 0; linenum < m_output.size(); linenum++) + { if (!m_output[linenum].empty()) { // output the text mui.draw_text_full(container, m_output[linenum].c_str(), - 0.0f, (float)linenum * mui.get_line_height(), 1.0f, + 0.0f, float(linenum) * mui.get_line_height(), 1.0f, m_justify[linenum], ui::text_layout::NEVER, mame_ui_manager::OPAQUE_, rgb_t::white(), rgb_t::black(), nullptr, nullptr); } + } } @@ -1256,17 +1260,16 @@ std::string &cheat_manager::get_output_string(int row, ui::text_layout::text_jus { // if the row is not specified, grab the next one if (row == 0) - row = (m_lastline >= 0) ? m_lastline + 1 : m_lastline - 1; + row = (m_lastline >= 0) ? (m_lastline + 1) : (m_lastline - 1); // remember the last request m_lastline = row; // invert if negative - row = (row < 0) ? m_numlines + row : row - 1; + row = (row < 0) ? (m_numlines + row) : (row - 1); // clamp within range - row = std::max(row, 0); - row = std::min(row, m_numlines - 1); + row = std::min(std::max(row, 0), m_numlines - 1); // return the appropriate string m_justify[row] = justify; @@ -1319,9 +1322,9 @@ std::string cheat_manager::quote_expression(const parsed_expression &expression) uint64_t cheat_manager::execute_frombcd(symbol_table &table, void *ref, int params, const uint64_t *param) { - uint64_t value = param[0]; - uint64_t multiplier = 1; - uint64_t result = 0; + uint64_t value(param[0]); + uint64_t multiplier(1); + uint64_t result(0); while (value != 0) { @@ -1339,9 +1342,9 @@ uint64_t cheat_manager::execute_frombcd(symbol_table &table, void *ref, int para uint64_t cheat_manager::execute_tobcd(symbol_table &table, void *ref, int params, const uint64_t *param) { - uint64_t value = param[0]; - uint64_t result = 0; - uint8_t shift = 0; + uint64_t value(param[0]); + uint64_t result(0); + uint8_t shift(0); while (value != 0) { @@ -1407,35 +1410,45 @@ void cheat_manager::load_cheats(const char *filename) throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message); // find the layout node - util::xml::data_node const *const 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); // validate the config data version - int version = mamecheatnode->get_attribute_int("version", 0); + int const version(mamecheatnode->get_attribute_int("version", 0)); if (version != CHEAT_VERSION) throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line); // parse all the elements 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<cheat_entry>(*this, m_symtable, filename, *cheatnode); - - // make sure we're not a duplicate - if (REMOVE_DUPLICATE_CHEATS && curcheat->is_duplicate()) + try { - osd_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath()); + // load this entry + auto curcheat = std::make_unique<cheat_entry>(*this, m_symtable, filename, *cheatnode); + + // make sure we're not a duplicate + if (REMOVE_DUPLICATE_CHEATS && curcheat->is_duplicate()) + { + osd_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath()); + } + else + { + // add to the end of the list + m_cheatlist.push_back(std::move(curcheat)); + } + } + catch (emu_fatalerror const &err) + { + // just move on to the next cheat + osd_printf_error("%s\n", err.string()); } - else // add to the end of the list - m_cheatlist.push_back(std::move(curcheat)); } } } - - // handle errors cleanly - catch (emu_fatalerror &err) + catch (emu_fatalerror const &err) { + // handle errors cleanly osd_printf_error("%s\n", err.string()); m_cheatlist.clear(); } diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h index eaba3650e7e..93b7d1ebfb8 100644 --- a/src/frontend/mame/cheat.h +++ b/src/frontend/mame/cheat.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_FRONTEND_CHEAT_H +#define MAME_FRONTEND_CHEAT_H -#ifndef __CHEAT_H__ -#define __CHEAT_H__ +#pragma once #include "debug/express.h" #include "debug/debugcpu.h" @@ -50,12 +50,20 @@ class number_and_format { public: // construction/destruction - number_and_format(uint64_t value = 0, util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL) + constexpr 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) { } + // copyable/movable + constexpr number_and_format(number_and_format const &) = default; + number_and_format(number_and_format &&) = default; + number_and_format &operator=(number_and_format const &) = default; + number_and_format &operator=(number_and_format &&) = default; + // pass-through to look like a regular number operator uint64_t &() { return m_value; } operator const uint64_t &() const { return m_value; } @@ -77,13 +85,17 @@ class cheat_parameter { public: // construction/destruction - cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const ¶mnode); + cheat_parameter( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const ¶mnode); // queries - const char *text(); - bool has_itemlist() const { return (m_itemlist.size() != 0); } - bool is_minimum() const { return (m_value == ((m_itemlist.size() == 0) ? m_minval : m_itemlist.front()->value())); } - bool is_maximum() const { return (m_value == ((m_itemlist.size() == 0) ? m_maxval : m_itemlist.back()->value())); } + char const *text(); + bool has_itemlist() const { return !m_itemlist.empty(); } + bool is_minimum() const { return (m_itemlist.empty() ? m_minval : m_itemlist.front().value()) == m_value; } + bool is_maximum() const { return (m_itemlist.empty() ? m_maxval : m_itemlist.back().value()) == m_value; } // state setters bool set_minimum_state(); @@ -102,25 +114,32 @@ private: item(const char *text, uint64_t value, util::xml::data_node::int_format valformat) : m_text(text) , m_value(value, valformat) - { } + { + } + + // copyable/movable + item(item const &) = default; + item(item &&) = default; + item &operator=(item const &) = default; + item &operator=(item &&) = default; // getters - const number_and_format &value() const { return m_value; } - const char *text() const { return m_text.c_str(); } + number_and_format const &value() const { return m_value; } + char const *text() const { return m_text.c_str(); } private: // internal state - std::string m_text; // name of the item - number_and_format m_value; // value of the item + std::string m_text; // name of the item + number_and_format m_value; // value of the item }; // internal state - number_and_format m_minval; // minimum value - number_and_format m_maxval; // maximum value - number_and_format m_stepval; // step value - uint64_t m_value; // live value of the parameter - std::string m_curtext; // holding for a value string - std::vector<std::unique_ptr<item>> m_itemlist; // list of items + number_and_format m_minval; // minimum value + number_and_format m_maxval; // maximum value + number_and_format m_stepval; // step value + uint64_t m_value; // live value of the parameter + std::string m_curtext; // holding for a value string + std::vector<item> m_itemlist; // list of items }; @@ -131,7 +150,11 @@ class cheat_script { public: // construction/destruction - cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode); + cheat_script( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &scriptnode); // getters script_state state() const { return m_state; } @@ -146,7 +169,12 @@ private: { public: // construction/destruction - script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction); + script_entry( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &entrynode, + bool isaction); // actions void execute(cheat_manager &manager, uint64_t &argindex); @@ -158,7 +186,11 @@ private: { public: // construction/destruction - output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode); + output_argument( + cheat_manager &manager, + symbol_table &symbols, + char const *filename, + util::xml::data_node const &argnode); // getters int count() const { return m_count; } @@ -169,28 +201,28 @@ private: private: // internal state - parsed_expression m_expression; // expression for argument - uint64_t m_count; // number of repetitions + parsed_expression m_expression; // expression for argument + uint64_t m_count; // number of repetitions }; // internal helpers - void validate_format(const char *filename, int line); + void validate_format(char const *filename, int line); // internal state - parsed_expression m_condition; // condition under which this is executed - parsed_expression m_expression; // expression to execute - std::string m_format; // string format to print - std::vector<std::unique_ptr<output_argument>> m_arglist; // list of arguments - int8_t m_line; // which line to print on - ui::text_layout::text_justify m_justify; // justification when printing + parsed_expression m_condition; // condition under which this is executed + parsed_expression m_expression; // expression to execute + std::string m_format; // string format to print + std::vector<std::unique_ptr<output_argument>> m_arglist; // list of arguments + int8_t m_line; // which line to print on + ui::text_layout::text_justify m_justify; // justification when printing // constants - static const int MAX_ARGUMENTS = 32; + static constexpr int MAX_ARGUMENTS = 32; }; // internal state - std::vector<std::unique_ptr<script_entry>> m_entrylist; // list of actions to perform - script_state m_state; // which state this script is for + std::vector<std::unique_ptr<script_entry>> m_entrylist; // list of actions to perform + script_state m_state; // which state this script is for }; @@ -250,21 +282,21 @@ private: std::unique_ptr<cheat_script> &script_for_state(script_state state); // internal state - cheat_manager & m_manager; // reference to our manager - std::string m_description; // string description/menu title - std::string m_comment; // comment data - std::unique_ptr<cheat_parameter> m_parameter; // parameter - std::unique_ptr<cheat_script> m_on_script; // script to run when turning on - std::unique_ptr<cheat_script> m_off_script; // script to run when turning off - std::unique_ptr<cheat_script> m_change_script; // script to run when value changes - std::unique_ptr<cheat_script> m_run_script; // script to run each frame when on - symbol_table m_symbols; // symbol table for this cheat - script_state m_state; // current cheat state - uint32_t m_numtemp; // number of temporary variables - uint64_t m_argindex; // argument index variable + cheat_manager & m_manager; // reference to our manager + std::string m_description; // string description/menu title + std::string m_comment; // comment data + std::unique_ptr<cheat_parameter> m_parameter; // parameter + std::unique_ptr<cheat_script> m_on_script; // script to run when turning on + std::unique_ptr<cheat_script> m_off_script; // script to run when turning off + std::unique_ptr<cheat_script> m_change_script; // script to run when value changes + std::unique_ptr<cheat_script> m_run_script; // script to run each frame when on + symbol_table m_symbols; // symbol table for this cheat + script_state m_state; // current cheat state + uint32_t m_numtemp; // number of temporary variables + uint64_t m_argindex; // argument index variable // constants - static const int DEFAULT_TEMP_VARIABLES = 10; + static constexpr int DEFAULT_TEMP_VARIABLES = 10; }; @@ -280,10 +312,10 @@ public: // getters running_machine &machine() const { return m_machine; } bool enabled() const { return !m_disabled; } - const std::vector<std::unique_ptr<cheat_entry>> &entries() const { return m_cheatlist; } + std::vector<std::unique_ptr<cheat_entry>> const &entries() const { return m_cheatlist; } // setters - void set_enable(bool enable = true); + void set_enable(bool enable); // actions void reload(); @@ -294,30 +326,30 @@ public: std::string &get_output_string(int row, ui::text_layout::text_justify justify); // global helpers - static std::string quote_expression(const parsed_expression &expression); - static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, const uint64_t *param); - static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, const uint64_t *param); + static std::string quote_expression(parsed_expression const &expression); + static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, uint64_t const *param); + static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, uint64_t const *param); private: // internal helpers void frame_update(); - void load_cheats(const char *filename); + void load_cheats(char const *filename); // internal state - running_machine & m_machine; // reference to our machine - std::vector<std::unique_ptr<cheat_entry>> m_cheatlist; // cheat list - uint64_t m_framecount; // frame count - std::vector<std::string> m_output; // array of output strings - std::vector<ui::text_layout::text_justify> m_justify; // justification for each string - uint8_t m_numlines; // number of lines available for output - int8_t m_lastline; // last line used for output - bool m_disabled; // true if the cheat engine is disabled - symbol_table m_symtable; // global symbol table - std::unique_ptr<debugger_cpu> m_cpu; // debugger interface for cpus/memory + running_machine & m_machine; // reference to our machine + std::vector<std::unique_ptr<cheat_entry>> m_cheatlist; // cheat list + uint64_t m_framecount; // frame count + std::vector<std::string> m_output; // array of output strings + std::vector<ui::text_layout::text_justify> m_justify; // justification for each string + uint8_t m_numlines; // number of lines available for output + int8_t m_lastline; // last line used for output + bool m_disabled; // true if the cheat engine is disabled + symbol_table m_symtable; // global symbol table + std::unique_ptr<debugger_cpu> m_cpu; // debugger interface for cpus/memory // constants static constexpr int CHEAT_VERSION = 1; }; -#endif /* __CHEAT_H__ */ +#endif /* MAME_FRONTEND_CHEAT_H */ diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index fd785ef8139..049b8fe10e8 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -30,6 +30,7 @@ #include "language.h" #include "pluginopts.h" +#include <algorithm> #include <new> #include <ctype.h> @@ -650,13 +651,6 @@ void cli_frontend::listsamples(const char *gamename) // referenced by a given game or set of games //------------------------------------------------- -int cli_frontend::compare_devices(const void *i1, const void *i2) -{ - device_t *dev1 = *(device_t **)i1; - device_t *dev2 = *(device_t **)i2; - return strcmp(dev1->tag(), dev2->tag()); -} - void cli_frontend::listdevices(const char *gamename) { // determine which drivers to output; return an error if none found @@ -680,7 +674,9 @@ void cli_frontend::listdevices(const char *gamename) device_list.push_back(&device); // sort them by tag - qsort(&device_list[0], device_list.size(), sizeof(device_list[0]), compare_devices); + std::sort(device_list.begin(), device_list.end(), [](device_t *dev1, device_t *dev2) { + return strcmp(dev1->tag(), dev2->tag()) < 0; + }); // dump the results for (auto device : device_list) diff --git a/src/frontend/mame/clifront.h b/src/frontend/mame/clifront.h index 4e3958cd5c3..544c2bbe15b 100644 --- a/src/frontend/mame/clifront.h +++ b/src/frontend/mame/clifront.h @@ -43,7 +43,6 @@ public: void listcrc(const char *gamename = "*"); void listroms(const char *gamename = "*"); void listsamples(const char *gamename = "*"); - static int compare_devices(const void *i1, const void *i2); void listdevices(const char *gamename = "*"); void listslots(const char *gamename = "*"); void listmedia(const char *gamename = "*"); diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 34d9c769338..a1ecf792d8e 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -769,6 +769,12 @@ void lua_engine::initialize() return sol::make_object(sol(), sol::nil); return sol::make_object(sol(), driver_list::driver(i)); }; + emu["wait"] = lua_CFunction([](lua_State *L) { + lua_engine *engine = mame_machine_manager::instance()->lua(); + luaL_argcheck(L, lua_isnumber(L, 1), 1, "waiting duration expected"); + engine->machine().scheduler().timer_set(attotime::from_double(lua_tonumber(L, 1)), timer_expired_delegate(FUNC(lua_engine::resume), engine), 0, L); + return lua_yield(L, 0); + }); emu.new_usertype<emu_file>("file", sol::call_constructor, sol::constructors<sol::types<const char *, uint32_t>>(), "read", [](emu_file &file, sol::buffer *buff) { buff->set_len(file.read(buff->get_ptr(), buff->get_len())); return buff; }, @@ -1709,6 +1715,17 @@ void lua_engine::close() lua_close(m_lua_state); } +void lua_engine::resume(void *ptr, int nparam) +{ + lua_State *L = static_cast<lua_State *>(ptr); + int stat = lua_resume(L, nullptr, 0); + if((stat != LUA_OK) && (stat != LUA_YIELD)) + { + osd_printf_error("[LUA ERROR] in resume: %s\n", lua_tostring(L, -1)); + lua_pop(L, 1); + } +} + void lua_engine::run(sol::load_result res) { if(res.valid()) diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index b03fabb1f8b..dfc860f21e5 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -120,6 +120,7 @@ private: void on_machine_resume(); void on_machine_frame(); + void resume(void *ptr, int nparam); void register_function(sol::function func, const char *id); bool execute_function(const char *id); sol::object call_plugin(const std::string &name, sol::object in); diff --git a/src/lib/formats/apd_dsk.cpp b/src/lib/formats/apd_dsk.cpp new file mode 100644 index 00000000000..3c972c25e49 --- /dev/null +++ b/src/lib/formats/apd_dsk.cpp @@ -0,0 +1,145 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************* + + formats/apd_dsk.c + + Archimedes Protected Disk Image format + +*********************************************************************/ + +#include <zlib.h> +#include "formats/apd_dsk.h" + +static const uint8_t APD_HEADER[8] = { 'A', 'P', 'D', 'X', '0', '0', '0', '1' }; +static const uint8_t GZ_HEADER[2] = { 0x1f, 0x8b }; + +apd_format::apd_format() +{ +} + +const char *apd_format::name() const +{ + return "apd"; +} + +const char *apd_format::description() const +{ + return "Archimedes Protected Disk Image"; +} + +const char *apd_format::extensions() const +{ + return "apd"; +} + +int apd_format::identify(io_generic *io, uint32_t form_factor) +{ + uint64_t size = io_generic_size(io); + std::vector<uint8_t> img(size); + io_generic_read(io, &img[0], 0, size); + + int err; + std::vector<uint8_t> gz_ptr(8); + z_stream d_stream; + + if (!memcmp(&img[0], GZ_HEADER, sizeof(GZ_HEADER))) { + d_stream.zalloc = nullptr; + d_stream.zfree = nullptr; + d_stream.opaque = nullptr; + d_stream.next_in = &img[0]; + d_stream.avail_in = size; + d_stream.next_out = &gz_ptr[0]; + d_stream.avail_out = 8; + + err = inflateInit2(&d_stream, MAX_WBITS | 16); + if (err != Z_OK) return 0; + + err = inflate(&d_stream, Z_SYNC_FLUSH); + if (err != Z_OK) return 0; + + err = inflateEnd(&d_stream); + if (err != Z_OK) return 0; + + img = gz_ptr; + } + + if (!memcmp(&img[0], APD_HEADER, sizeof(APD_HEADER))) { + return 100; + } + + return 0; +} + +bool apd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) +{ + uint64_t size = io_generic_size(io); + std::vector<uint8_t> img(size); + io_generic_read(io, &img[0], 0, size); + + int err; + std::vector<uint8_t> gz_ptr; + z_stream d_stream; + int inflate_size = (img[size - 1] << 24) | (img[size - 2] << 16) | (img[size - 3] << 8) | img[size - 4]; + uint8_t *in_ptr = &img[0]; + + if (!memcmp(&img[0], GZ_HEADER, sizeof(GZ_HEADER))) { + gz_ptr.resize(inflate_size); + + d_stream.zalloc = nullptr; + d_stream.zfree = nullptr; + d_stream.opaque = nullptr; + d_stream.next_in = in_ptr; + d_stream.avail_in = size; + d_stream.next_out = &gz_ptr[0]; + d_stream.avail_out = inflate_size; + + err = inflateInit2(&d_stream, MAX_WBITS | 16); + if (err != Z_OK) { + LOG_FORMATS("inflateInit2 error: %d\n", err); + return false; + } + err = inflate(&d_stream, Z_FINISH); + if (err != Z_STREAM_END && err != Z_OK) { + LOG_FORMATS("inflate error: %d\n", err); + return false; + } + err = inflateEnd(&d_stream); + if (err != Z_OK) { + LOG_FORMATS("inflateEnd error: %d\n", err); + return false; + } + size = inflate_size; + img = gz_ptr; + } + + int data = 0x7d0; + for (int track = 0; track < 166; track++) { + uint32_t sdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x0])); + uint32_t ddlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x4])); + uint32_t qdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x8])); + + if (sdlen > 0) { + generate_track_from_bitstream(track / 2, track % 2, &img[data], sdlen, image); + data += (sdlen + 7) >> 3; + } + if (ddlen > 0) { + generate_track_from_bitstream(track / 2, track % 2, &img[data], ddlen, image); + data += (ddlen + 7) >> 3; + } + if (qdlen > 0) { + generate_track_from_bitstream(track / 2, track % 2, &img[data], qdlen, image); + data += (qdlen + 7) >> 3; + } + } + image->set_variant(floppy_image::DSDD); + + return true; +} + +bool apd_format::supports_save() const +{ + return false; +} + +const floppy_format_type FLOPPY_APD_FORMAT = &floppy_image_format_creator<apd_format>; diff --git a/src/lib/formats/apd_dsk.h b/src/lib/formats/apd_dsk.h new file mode 100644 index 00000000000..3bf40055a7b --- /dev/null +++ b/src/lib/formats/apd_dsk.h @@ -0,0 +1,31 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************* + + formats/apd_dsk.h + + Archimedes Protected Disk Image format + +*********************************************************************/ + +#ifndef APD_DSK_H_ +#define APD_DSK_H_ + +#include "flopimg.h" + +class apd_format : public floppy_image_format_t { +public: + apd_format(); + + virtual const char *name() const override; + virtual const char *description() const override; + virtual const char *extensions() const override; + + virtual int identify(io_generic *io, uint32_t form_factor) override; + virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override; + virtual bool supports_save() const override; +}; + +extern const floppy_format_type FLOPPY_APD_FORMAT; + +#endif diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp index 748f0227c65..7f03be7977a 100644 --- a/src/lib/formats/tzx_cas.cpp +++ b/src/lib/formats/tzx_cas.cpp @@ -8,7 +8,6 @@ TODO: Add support for the remaining block types: case 0x15: Direct Recording case 0x18: CSW Recording - case 0x19: Generalized Data Block case 0x21: Group Start case 0x22: Group End case 0x23: Jump To Block @@ -31,7 +30,7 @@ Notes: TZX format specification lists 8064 pulses for a header block and 3220 for a data block -but the documentaiton on worldofspectrum lists +but the documentation on worldofspectrum lists 8063 pulses for a header block and 3223 for a data block see http://www.worldofspectrum.org/faq/reference/48kreference.htm#TapeDataStructure @@ -315,7 +314,6 @@ static int tzx_handle_direct(int16_t **buffer, const uint8_t *bytes, int pause, tzx_output_wave(buffer, samples); size += samples; - } } @@ -342,8 +340,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u uint8_t starttype = cursymb[0]; -// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp); - switch (starttype) { case 0x00: @@ -371,7 +367,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u for (int i = 0; i < maxp; i++) { uint16_t pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8); - // printf("pulse_length %04x\n", pulse_length); // shorter lists can be terminated with a pulse_length of 0 if (pulse_length != 0) @@ -380,7 +375,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u tzx_output_wave(buffer, samples); size += samples; toggle_wave_data(); - } else { @@ -390,8 +384,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u } } - //toggle_wave_data(); - return size; } @@ -405,7 +397,6 @@ static inline int stream_get_bit(const uint8_t *bytes, uint8_t &stream_bit, uint if (byte & 0x80) retbit = 1; - stream_bit++; if (stream_bit == 8) @@ -433,34 +424,26 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa { uint8_t symbol = table2[i + 0]; uint16_t repetitions = table2[i + 1] + (table2[i + 2] << 8); - //printf("symbol %02x repititions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once? + //printf("symbol %02x repetitions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once? for (int j = 0; j < repetitions; j++) { size += tzx_handle_symbol(buffer, symtable, symbol, npp); - // toggle_wave_data(); } - - } // advance to after this data bytes += ((2 * npp + 1)*asp) + totp * 3; } - else - { - printf("no pilot block\n"); - } if (totd > 0) { - printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd); + // printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd); const uint8_t *symtable = bytes; const uint8_t *table2 = bytes + (2 * npd + 1)*asd; int NB = ceil(compute_log2(asd)); // number of bits needed to represent each symbol - printf("NB is %d\n", NB); uint8_t stream_bit = 0; uint32_t stream_byte = 0; @@ -475,16 +458,8 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa } size += tzx_handle_symbol(buffer, symtable, symbol, npd); - - //toggle_wave_data(); } } - else - { - printf("no data block\n"); - } - - /* pause */ if (pause > 0) @@ -505,9 +480,7 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa static void ascii_block_common_log( const char *block_type_string, uint8_t block_type ) { - LOG_FORMATS("%s (type %02x) encountered.\n", block_type_string, block_type); - LOG_FORMATS("This block contains info on the .tzx file you are loading.\n"); - LOG_FORMATS("Please include the following info in your bug reports, if the image has issue in M.E.S.S.\n"); + LOG_FORMATS("%s (type %02x) encountered:\n", block_type_string, block_type); } static const char *const archive_ident[] = @@ -744,20 +717,18 @@ static int tzx_cas_do_work( int16_t **buffer ) { // having this missing is fatal // used crudely by batmanc in spectrum_cass list (which is just a redundant encoding of batmane ?) - printf("Unsupported block type (0x19 - Generalized Data Block) encountered.\n"); - data_size = cur_block[1] + (cur_block[2] << 8) + (cur_block[3] << 16) + (cur_block[4] << 24); pause_time= cur_block[5] + (cur_block[6] << 8); uint32_t totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24); int npp = cur_block[11]; int asp = cur_block[12]; - if (asp == 0) asp = 256; + if (asp == 0 && totp > 0) asp = 256; uint32_t totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24); int npd = cur_block[17]; int asd = cur_block[18]; - if (asd == 0) asd = 256; + if (asd == 0 && totd > 0) asd = 256; size += tzx_handle_generalized(buffer, &cur_block[19], pause_time, data_size, totp, npp, asp, totd, npd, asd); @@ -840,7 +811,7 @@ static int tap_cas_to_wav_size( const uint8_t *casdata, int caslen ) { int data_size = p[0] + (p[1] << 8); int pilot_length = (p[2] == 0x00) ? 8064 : 3220; /* TZX specification */ -// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ +// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ LOG_FORMATS("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size); p += 2; size += tzx_cas_handle_block(nullptr, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8); @@ -859,7 +830,7 @@ static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) { int data_size = bytes[0] + (bytes[1] << 8); int pilot_length = (bytes[2] == 0x00) ? 8064 : 3220; /* TZX specification */ -// int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ +// int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ LOG_FORMATS("tap_cas_fill_wave: Handling TAP block containing 0x%X bytes\n", data_size); bytes += 2; size += tzx_cas_handle_block(&p, bytes, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8); @@ -871,34 +842,34 @@ static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave = { tzx_cas_fill_wave, /* fill_wave */ - -1, /* chunk_size */ - 0, /* chunk_samples */ - tzx_cas_to_wav_size, /* chunk_sample_calc */ + -1, /* chunk_size */ + 0, /* chunk_samples */ + tzx_cas_to_wav_size, /* chunk_sample_calc */ TZX_WAV_FREQUENCY, /* sample_frequency */ - 0, /* header_samples */ - 0 /* trailer_samples */ + 0, /* header_samples */ + 0 /* trailer_samples */ }; static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave = { tap_cas_fill_wave, /* fill_wave */ - -1, /* chunk_size */ - 0, /* chunk_samples */ - tap_cas_to_wav_size, /* chunk_sample_calc */ + -1, /* chunk_size */ + 0, /* chunk_samples */ + tap_cas_to_wav_size, /* chunk_sample_calc */ TZX_WAV_FREQUENCY, /* sample_frequency */ - 0, /* header_samples */ - 0 /* trailer_samples */ + 0, /* header_samples */ + 0 /* trailer_samples */ }; static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave = { cdt_cas_fill_wave, /* fill_wave */ - -1, /* chunk_size */ - 0, /* chunk_samples */ - tzx_cas_to_wav_size, /* chunk_sample_calc */ + -1, /* chunk_size */ + 0, /* chunk_samples */ + tzx_cas_to_wav_size, /* chunk_sample_calc */ TZX_WAV_FREQUENCY, /* sample_frequency */ - 0, /* header_samples */ - 0 /* trailer_samples */ + 0, /* header_samples */ + 0 /* trailer_samples */ }; static cassette_image::error tzx_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) @@ -931,7 +902,7 @@ static cassette_image::error cdt_cassette_load( cassette_image *cassette ) return cassette_legacy_construct(cassette, &cdt_legacy_fill_wave); } -static const struct CassetteFormat tzx_cassette_format = +const struct CassetteFormat tzx_cassette_format = { "tzx", tzx_cassette_identify, diff --git a/src/lib/formats/tzx_cas.h b/src/lib/formats/tzx_cas.h index 8610fb0cdd4..2db31245310 100644 --- a/src/lib/formats/tzx_cas.h +++ b/src/lib/formats/tzx_cas.h @@ -12,6 +12,8 @@ #include "cassimg.h" +extern const struct CassetteFormat tzx_cassette_format; + CASSETTE_FORMATLIST_EXTERN(tzx_cassette_formats); CASSETTE_FORMATLIST_EXTERN(cdt_cassette_formats); diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp index 7f359ccaca3..9fa5814385f 100644 --- a/src/lib/formats/zx81_p.cpp +++ b/src/lib/formats/zx81_p.cpp @@ -34,6 +34,7 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain #include <assert.h> #include "zx81_p.h" +#include "tzx_cas.h" #define WAVEENTRY_LOW -32768 @@ -197,13 +198,13 @@ static int zx81_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) static const struct CassetteLegacyWaveFiller zx81_legacy_fill_wave = { - zx81_cassette_fill_wave, /* fill_wave */ - -1, /* chunk_size */ - 0, /* chunk_samples */ + zx81_cassette_fill_wave, /* fill_wave */ + -1, /* chunk_size */ + 0, /* chunk_samples */ zx81_cassette_calculate_size_in_samples, /* chunk_sample_calc */ - ZX81_WAV_FREQUENCY, /* sample_frequency */ - 0, /* header_samples */ - 0 /* trailer_samples */ + ZX81_WAV_FREQUENCY, /* sample_frequency */ + 0, /* header_samples */ + 0 /* trailer_samples */ }; static cassette_image::error zx81_p_identify(cassette_image *cassette, struct CassetteOptions *opts) @@ -233,6 +234,11 @@ CASSETTE_FORMATLIST_START(zx81_p_format) CASSETTE_FORMAT(zx81_p_image_format) CASSETTE_FORMATLIST_END +CASSETTE_FORMATLIST_START(zx81_cassette_formats) + CASSETTE_FORMAT(zx81_p_image_format) + CASSETTE_FORMAT(tzx_cassette_format) +CASSETTE_FORMATLIST_END + /* ZX-80 functions */ static int zx80_cassette_calculate_size_in_samples(const uint8_t *bytes, int length) @@ -265,11 +271,11 @@ static int zx80_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) static const struct CassetteLegacyWaveFiller zx80_legacy_fill_wave = { - zx80_cassette_fill_wave, /* fill_wave */ + zx80_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ zx80_cassette_calculate_size_in_samples, /* chunk_sample_calc */ - ZX81_WAV_FREQUENCY, /* sample_frequency */ + ZX81_WAV_FREQUENCY, /* sample_frequency */ 0, /* header_samples */ 0 /* trailer_samples */ }; diff --git a/src/lib/formats/zx81_p.h b/src/lib/formats/zx81_p.h index 16a1b22724d..36da808c989 100644 --- a/src/lib/formats/zx81_p.h +++ b/src/lib/formats/zx81_p.h @@ -14,6 +14,7 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(zx81_p_format); +CASSETTE_FORMATLIST_EXTERN(zx81_cassette_formats); CASSETTE_FORMATLIST_EXTERN(zx80_o_format); #endif /* ZX81_P_H */ diff --git a/src/lib/netlist/analog/nld_bjt.cpp b/src/lib/netlist/analog/nld_bjt.cpp index 0acd0887e74..e40fbfa366d 100644 --- a/src/lib/netlist/analog/nld_bjt.cpp +++ b/src/lib/netlist/analog/nld_bjt.cpp @@ -6,13 +6,16 @@ */ #include "solver/nld_solver.h" -#include "analog/nld_bjt.h" +#include "analog/nlid_twoterm.h" #include "nl_setup.h" +#include <cmath> + namespace netlist { namespace analog { + class diode { public: @@ -40,6 +43,240 @@ private: nl_double m_VT_inv; }; +// ----------------------------------------------------------------------------- +// nld_Q - Base classes +// ----------------------------------------------------------------------------- + + /*! Class representing the bjt model paramers. + * + * This is the model representation of the bjt model. Typically, SPICE uses + * the following parameters. A "Y" in the first column indicates that the + * parameter is actually used in netlist. + * + * | NL? | name | parameter | units | default | example | area | + * |:---:|------|-----------------------------------------------------------------------|-------|---------:|----------------:|:----:| + * | Y | IS | transport saturation current | A | 1E-016 | 1E-015 | * | + * | Y | BF | ideal maximum forward beta | - | 100 | 100 | | + * | Y | NF | forward current emission coefficient | - | 1 | 1 | | + * | | VAF | forward Early voltage | V | infinite | 200 | | + * | | IKF | corner for forward beta high current roll-off | A | infinite | 0.01 | * | + * | | ISE | B-E leakage saturation current | A | 0 | 0.0000000000001 | * | + * | | NE | B-E leakage emission coefficient | - | 1.5 | 2 | | + * | Y | BR | ideal maximum reverse beta | - | 1 | 0.1 | | + * | Y | NR | reverse current emission coefficient | - | 1 | 1 | | + * | | VAR | reverse Early voltage | V | infinite | 200 | | + * | | IKR | corner for reverse beta high current roll-off | A | infinite | 0.01 | * | + * | | ISC | leakage saturation current | A | 0 | 8 | | + * | | NC | leakage emission coefficient | - | 2 | 1.5 | | + * | | RB | zero bias base resistance | | 0 | 100 | * | + * | | IRB | current where base resistance falls halfway to its min value | A | infinte | 0.1 | * | + * | | RBM | minimum base resistance at high currents | | RB | 10 | * | + * | | RE | emitter resistance | | 0 | 1 | * | + * | | RC | collector resistance | | 0 | 10 | * | + * | | CJE | B-E zero-bias depletion capacitance | F | 0 | 2pF | * | + * | | VJE | B-E built-in potential | V | 0.75 | 0.6 | | + * | | MJE | B-E junction exponential factor | - | 0.33 | 0.33 | | + * | | TF | ideal forward transit time | sec | 0 | 0.1ns | | + * | | XTF | coefficient for bias dependence of TF | - | 0 | | | + * | | VTF | voltage describing VBC dependence of TF | V | infinite | | | + * | | ITF | high-current parameter for effect on TF | A | 0 | | * | + * | | PTF | excess phase at freq=1.0/(TF*2PI) Hz | deg | 0 | | | + * | | CJC | B-C zero-bias depletion capacitance | F | 0 | 2pF | * | + * | | VJC | B-C built-in potential | V | 0.75 | 0.5 | | + * | | MJC | B-C junction exponential factor | - | 0.33 | 0.5 | | + * | | XCJC | fraction of B-C depletion capacitance connected to internal base node | - | 1 | | | + * | | TR | ideal reverse transit time | sec | 0 | 10ns | | + * | | CJS | zero-bias collector-substrate capacitance | F | 0 | 2pF | * | + * | | VJS | substrate junction built-in potential | V | 0.75 | | | + * | | MJS | substrate junction exponential factor | - | 0 | 0.5 | | + * | | XTB | forward and reverse beta temperature exponent | - | 0 | | | + * | | EG | energy gap for temperature effect on IS | eV | 1.11 | | | + * | | XTI | temperature exponent for effect on IS | - | 3 | | | + * | | KF | flicker-noise coefficient | - | 0 | | | + * | | AF | flicker-noise exponent | - | 1 | | | + * | | FC | coefficient for forward-bias depletion capacitance formula | - | 0.5 | | | + * | | TNOM | Parameter measurement temperature | C | 27 | 50 | | */ + + class bjt_model_t : public param_model_t + { + public: + bjt_model_t(device_t &device, const pstring name, const pstring val) + : param_model_t(device, name, val) + , m_IS(*this, "IS") + , m_BF(*this, "BF") + , m_NF(*this, "NF") + , m_BR(*this, "BR") + , m_NR(*this, "NR") + {} + + value_t m_IS; //!< transport saturation current + value_t m_BF; //!< ideal maximum forward beta + value_t m_NF; //!< forward current emission coefficient + value_t m_BR; //!< ideal maximum reverse beta + value_t m_NR; //!< reverse current emission coefficient + }; + + // Have a common start for transistors + +NETLIB_OBJECT(Q) +{ +public: + enum q_type { + BJT_NPN, + BJT_PNP + }; + + NETLIB_CONSTRUCTOR(Q) + , m_model(*this, "MODEL", "") + , m_qtype(BJT_NPN) + { + } + + NETLIB_IS_DYNAMIC(true) + + //NETLIB_RESETI(); + NETLIB_UPDATEI(); + + inline q_type qtype() const { return m_qtype; } + inline bool is_qtype(q_type atype) const { return m_qtype == atype; } + inline void set_qtype(q_type atype) { m_qtype = atype; } +protected: + + bjt_model_t m_model; +private: + q_type m_qtype; +}; + +NETLIB_OBJECT_DERIVED(QBJT, Q) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(QBJT, Q) + { } + +protected: + +private: +}; + + + + +// ----------------------------------------------------------------------------- +// nld_QBJT_switch +// ----------------------------------------------------------------------------- + + +/* + * + - C + * B ----VVV----+ | + * | | + * Rb Rc + * Rb Rc + * Rb Rc + * | | + * +----+----+ + * | + * E + */ + +NETLIB_OBJECT_DERIVED(QBJT_switch, QBJT) +{ + NETLIB_CONSTRUCTOR_DERIVED(QBJT_switch, QBJT) + , m_RB(*this, "m_RB", true) + , m_RC(*this, "m_RC", true) + , m_BC_dummy(*this, "m_BC", true) + , m_gB(NETLIST_GMIN_DEFAULT) + , m_gC(NETLIST_GMIN_DEFAULT) + , m_V(0.0) + , m_state_on(*this, "m_state_on", 0) + { + register_subalias("B", m_RB.m_P); + register_subalias("E", m_RB.m_N); + register_subalias("C", m_RC.m_P); + //register_term("_E1", m_RC.m_N); + + //register_term("_B1", m_BC_dummy.m_P); + //register_term("_C1", m_BC_dummy.m_N); + + connect(m_RB.m_N, m_RC.m_N); + + connect(m_RB.m_P, m_BC_dummy.m_P); + connect(m_RC.m_P, m_BC_dummy.m_N); + } + + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI(); + NETLIB_UPDATE_TERMINALSI(); + + nld_twoterm m_RB; + nld_twoterm m_RC; + + // FIXME: this is needed so we have all terminals belong to one net list + + nld_twoterm m_BC_dummy; + +protected: + + + nl_double m_gB; // base conductance / switch on + nl_double m_gC; // collector conductance / switch on + nl_double m_V; // internal voltage source + state_var<unsigned> m_state_on; + +private: +}; + +// ----------------------------------------------------------------------------- +// nld_QBJT_EB +// ----------------------------------------------------------------------------- + + +NETLIB_OBJECT_DERIVED(QBJT_EB, QBJT) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(QBJT_EB, QBJT) + , m_gD_BC(*this, "m_D_BC") + , m_gD_BE(*this, "m_D_BE") + , m_D_CB(*this, "m_D_CB", true) + , m_D_EB(*this, "m_D_EB", true) + , m_D_EC(*this, "m_D_EC", true) + , m_alpha_f(0) + , m_alpha_r(0) + { + register_subalias("E", m_D_EB.m_P); // Cathode + register_subalias("B", m_D_EB.m_N); // Anode + + register_subalias("C", m_D_CB.m_P); // Cathode + //register_term("_B1", m_D_CB.m_N); // Anode + + //register_term("_E1", m_D_EC.m_P); + //register_term("_C1", m_D_EC.m_N); + + connect(m_D_EB.m_P, m_D_EC.m_P); + connect(m_D_EB.m_N, m_D_CB.m_N); + connect(m_D_CB.m_P, m_D_EC.m_N); + } + +protected: + + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI(); + NETLIB_UPDATE_TERMINALSI(); + + generic_diode m_gD_BC; + generic_diode m_gD_BE; + +private: + nld_twoterm m_D_CB; // gcc, gce - gcc, gec - gcc, gcc - gce | Ic + nld_twoterm m_D_EB; // gee, gec - gee, gce - gee, gee - gec | Ie + nld_twoterm m_D_EC; // 0, -gec, -gcc, 0 | 0 + + nl_double m_alpha_f; + nl_double m_alpha_r; + +}; // ---------------------------------------------------------------------------------------- @@ -122,8 +359,6 @@ NETLIB_UPDATE_TERMINALS(QBJT_switch) m_RB.set(gb, v, 0.0); m_RC.set(gc, 0.0, 0.0); - //m_RB.update_dev(); - //m_RC.update_dev(); m_state_on = new_state; } } @@ -166,11 +401,11 @@ NETLIB_UPDATE_TERMINALS(QBJT_EB) const nl_double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity; m_D_EB.set_mat( gee, gec - gee, -Ie, - gce - gee, gee - gec, Ie); + gce - gee, gee - gec, Ie); m_D_CB.set_mat( gcc, gce - gcc, -Ic, - gec - gcc, gcc - gce, Ic); + gec - gcc, gcc - gce, Ic); m_D_EC.set_mat( 0, -gec, 0, - -gce, 0, 0); + -gce, 0, 0); } @@ -192,5 +427,11 @@ NETLIB_UPDATE_PARAM(QBJT_EB) m_gD_BC.set_param(IS / m_alpha_r, NR, netlist().gmin()); } - } //namespace devices + } //namespace analog + + namespace devices { + NETLIB_DEVICE_IMPL_NS(analog, QBJT_EB) + NETLIB_DEVICE_IMPL_NS(analog, QBJT_switch) + } + } // namespace netlist diff --git a/src/lib/netlist/analog/nld_bjt.h b/src/lib/netlist/analog/nld_bjt.h index a4e163b13bc..5e40bd1ef36 100644 --- a/src/lib/netlist/analog/nld_bjt.h +++ b/src/lib/netlist/analog/nld_bjt.h @@ -8,8 +8,7 @@ #ifndef NLD_BJT_H_ #define NLD_BJT_H_ -#include "nl_base.h" -#include "nld_twoterm.h" +#include "nl_setup.h" // ----------------------------------------------------------------------------- // Macros @@ -23,249 +22,4 @@ NET_REGISTER_DEV(QBJT_EB, name) \ NETDEV_PARAMI(name, MODEL, model) - -namespace netlist -{ - namespace analog - { -// ----------------------------------------------------------------------------- -// nld_Q - Base classes -// ----------------------------------------------------------------------------- - - /* FIXME: Make table pretty */ - - /*! Class representing the bjt model paramers. - * This is the model representation of the bjt model. Typically, SPICE uses - * the following parameters. A "Y" in the first column indicates that the - * parameter is actually used in netlist. - * - * |NL? |name |parameter |units|default| example|area | - * |:--:|:-----|:--------------------------------|:----|------:|-------:|:----:| - * | Y |IS |transport saturation current|A |1E-016|1E-015|* | - * | Y |BF |ideal maximum forward beta|- |100|100| | - * | Y |NF |forward current emission coefficient|- |1|1| | - * | |VAF |forward Early voltage|V |infinite |200| | - * | |IKF |corner for forward beta high current roll-off|A |infinite |0.01|* | - * | |ISE |B-E leakage saturation current|A |0|0.0000000000001|* | - * | |NE |B-E leakage emission coefficient|- |1.5|2| | - * | Y |BR |ideal maximum reverse beta |- |1|0.1| | - * | Y |NR |reverse current emission coefficient|- |1|1| | - * | |VAR |reverse Early voltage|V |infinite |200| | - * | |IKR |corner for reverse beta high current roll-off|A |infinite |0.01|* | - * | |ISC |leakage saturation current|A |0|8| | - * | |NC |leakage emission coefficient|- |2|1.5| | - * | |RB |zero bias base resistance| |0|100|* | - * | |IRB |current where base resistance falls halfway to its min value|A |infinte |0.1|* | - * | |RBM |minimum base resistance at high currents| |RB |10|* | - * | |RE |emitter resistance| |0|1|* | - * | |RC |collector resistance | |0|10|* | - * | |CJE |B-E zero-bias depletion capacitance|F |0|2pF |* | - * | |VJE |B-E built-in potential|V |0.75|0.6| | - * | |MJE |B-E junction exponential factor |- |0.33|0.33| | - * | |TF |ideal forward transit time |sec |0|0.1ns | | - * | |XTF|coefficient for bias dependence of TF |- |0| | | - * | |VTF |voltage describing VBC dependence of TF |V |infinite | | | - * | |ITF |high-current parameter for effect on TF |A |0| |* | - * | |PTF |excess phase at freq=1.0/(TF*2PI) Hz |deg |0| | | - * | |CJC |B-C zero-bias depletion capacitance |F |0|2pF |* | - * | |VJC |B-C built-in potential |V |0.75|0.5| | - * | |MJC |B-C junction exponential factor |- |0.33|0.5| | - * | |XCJC |fraction of B-C depletion capacitance connected to internal base node |- |1| | | - * | |TR |ideal reverse transit time |sec |0|10ns | | - * | |CJS |zero-bias collector-substrate capacitance |F |0|2pF |* | - * | |VJS |substrate junction built-in potential |V |0.75| | | - * | |MJS |substrate junction exponential factor |- |0|0.5| | - * | |XTB |forward and reverse beta temperature exponent |- |0| | | - * | |EG|energy gap for temperature effect on IS |eV |1.11| | | - * | |XTI|temperature exponent for effect on IS |- |3| | | - * | |KF |flicker-noise coefficient |- |0| | | - * | |AF |flicker-noise exponent |- |1| | | - * | |FC |coefficient for forward-bias depletion capacitance formula |- |0.5| | | - * | |TNOM |Parameter measurement temperature |C |27|50| | - */ - - class bjt_model_t : public param_model_t - { - public: - bjt_model_t(device_t &device, const pstring name, const pstring val) - : param_model_t(device, name, val) - , m_IS(*this, "IS") - , m_BF(*this, "BF") - , m_NF(*this, "NF") - , m_BR(*this, "BR") - , m_NR(*this, "NR") - {} - - value_t m_IS; //!< transport saturation current - value_t m_BF; //!< ideal maximum forward beta - value_t m_NF; //!< forward current emission coefficient - value_t m_BR; //!< ideal maximum reverse beta - value_t m_NR; //!< reverse current emission coefficient - }; - - // Have a common start for transistors - -NETLIB_OBJECT(Q) -{ -public: - enum q_type { - BJT_NPN, - BJT_PNP - }; - - NETLIB_CONSTRUCTOR(Q) - , m_model(*this, "MODEL", "") - , m_qtype(BJT_NPN) - { - } - - NETLIB_IS_DYNAMIC() - - //NETLIB_RESETI(); - NETLIB_UPDATEI(); - - inline q_type qtype() const { return m_qtype; } - inline bool is_qtype(q_type atype) const { return m_qtype == atype; } - inline void set_qtype(q_type atype) { m_qtype = atype; } -protected: - - bjt_model_t m_model; -private: - q_type m_qtype; -}; - -NETLIB_OBJECT_DERIVED(QBJT, Q) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(QBJT, Q) - { } - -protected: - -private: -}; - - - - -// ----------------------------------------------------------------------------- -// nld_QBJT_switch -// ----------------------------------------------------------------------------- - - -/* - * + - C - * B ----VVV----+ | - * | | - * Rb Rc - * Rb Rc - * Rb Rc - * | | - * +----+----+ - * | - * E - */ - -NETLIB_OBJECT_DERIVED(QBJT_switch, QBJT) -{ - NETLIB_CONSTRUCTOR_DERIVED(QBJT_switch, QBJT) - , m_RB(*this, "m_RB", true) - , m_RC(*this, "m_RC", true) - , m_BC_dummy(*this, "m_BC", true) - , m_gB(NETLIST_GMIN_DEFAULT) - , m_gC(NETLIST_GMIN_DEFAULT) - , m_V(0.0) - , m_state_on(*this, "m_state_on", 0) - { - register_subalias("B", m_RB.m_P); - register_subalias("E", m_RB.m_N); - register_subalias("C", m_RC.m_P); - //register_term("_E1", m_RC.m_N); - - //register_term("_B1", m_BC_dummy.m_P); - //register_term("_C1", m_BC_dummy.m_N); - - connect(m_RB.m_N, m_RC.m_N); - - connect(m_RB.m_P, m_BC_dummy.m_P); - connect(m_RC.m_P, m_BC_dummy.m_N); - } - - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI(); - NETLIB_UPDATE_TERMINALSI(); - - nld_twoterm m_RB; - nld_twoterm m_RC; - - // FIXME: this is needed so we have all terminals belong to one net list - - nld_twoterm m_BC_dummy; - -protected: - - - nl_double m_gB; // base conductance / switch on - nl_double m_gC; // collector conductance / switch on - nl_double m_V; // internal voltage source - state_var<unsigned> m_state_on; - -private: -}; - -// ----------------------------------------------------------------------------- -// nld_QBJT_EB -// ----------------------------------------------------------------------------- - - -NETLIB_OBJECT_DERIVED(QBJT_EB, QBJT) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(QBJT_EB, QBJT) - , m_gD_BC(*this, "m_D_BC") - , m_gD_BE(*this, "m_D_BE") - , m_D_CB(*this, "m_D_CB", true) - , m_D_EB(*this, "m_D_EB", true) - , m_D_EC(*this, "m_D_EC", true) - , m_alpha_f(0) - , m_alpha_r(0) - { - register_subalias("E", m_D_EB.m_P); // Cathode - register_subalias("B", m_D_EB.m_N); // Anode - - register_subalias("C", m_D_CB.m_P); // Cathode - //register_term("_B1", m_D_CB.m_N); // Anode - - //register_term("_E1", m_D_EC.m_P); - //register_term("_C1", m_D_EC.m_N); - - connect(m_D_EB.m_P, m_D_EC.m_P); - connect(m_D_EB.m_N, m_D_CB.m_N); - connect(m_D_CB.m_P, m_D_EC.m_N); - } - -protected: - - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI(); - NETLIB_UPDATE_TERMINALSI(); - - generic_diode m_gD_BC; - generic_diode m_gD_BE; - -private: - nld_twoterm m_D_CB; // gcc, gce - gcc, gec - gcc, gcc - gce | Ic - nld_twoterm m_D_EB; // gee, gec - gee, gce - gee, gee - gec | Ie - nld_twoterm m_D_EC; // 0, -gec, -gcc, 0 | 0 - - nl_double m_alpha_f; - nl_double m_alpha_r; - -}; - - } //namespace devices -} // namespace netlist - #endif /* NLD_BJT_H_ */ diff --git a/src/lib/netlist/analog/nld_fourterm.h b/src/lib/netlist/analog/nld_fourterm.h index 0e4bcc03429..bd420b8cfa9 100644 --- a/src/lib/netlist/analog/nld_fourterm.h +++ b/src/lib/netlist/analog/nld_fourterm.h @@ -9,8 +9,7 @@ #define NLD_FOURTERM_H_ -#include "nl_base.h" -#include "nld_twoterm.h" +#include "nl_setup.h" // ---------------------------------------------------------------------------------------- // Macros @@ -28,204 +27,4 @@ #define LVCCS(name) \ NET_REGISTER_DEV(LVCCS, name) -namespace netlist -{ - namespace analog - { -// ---------------------------------------------------------------------------------------- -// nld_VCCS -// ---------------------------------------------------------------------------------------- - -/* - * Voltage controlled current source - * - * IP ---+ +------> OP - * | | - * RI I - * RI => G => I IOut = (V(IP)-V(IN)) * G - * RI I - * | | - * IN ---+ +------< ON - * - * G=1 ==> 1V ==> 1A - * - * RI = 1 / NETLIST_GMIN - * - */ - -NETLIB_OBJECT(VCCS) -{ -public: - NETLIB_CONSTRUCTOR(VCCS) - , m_G(*this, "G", 1.0) - , m_RI(*this, "RI", 1e9) - , m_OP(*this, "OP") - , m_ON(*this, "ON") - , m_IP(*this, "IP") - , m_IN(*this, "IN") - , m_OP1(*this, "_OP1") - , m_ON1(*this, "_ON1") - , m_gfac(1.0) - { - m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving... - m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving... - - m_OP.m_otherterm = &m_IP; - m_OP1.m_otherterm = &m_IN; - - m_ON.m_otherterm = &m_IP; - m_ON1.m_otherterm = &m_IN; - - connect(m_OP, m_OP1); - connect(m_ON, m_ON1); - m_gfac = NL_FCONST(1.0); - } - - param_double_t m_G; - param_double_t m_RI; - -protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI() - { - NETLIB_NAME(VCCS)::reset(); - } - - terminal_t m_OP; - terminal_t m_ON; - - terminal_t m_IP; - terminal_t m_IN; - - terminal_t m_OP1; - terminal_t m_ON1; - - nl_double m_gfac; -}; - -/* Limited Current source*/ - -NETLIB_OBJECT_DERIVED(LVCCS, VCCS) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(LVCCS, VCCS) - , m_cur_limit(*this, "CURLIM", 1000.0) - , m_vi(0.0) - { - } - - NETLIB_IS_DYNAMIC() - - param_double_t m_cur_limit; /* current limit */ - -protected: - NETLIB_UPDATEI(); - NETLIB_RESETI(); - NETLIB_UPDATE_PARAMI(); - NETLIB_UPDATE_TERMINALSI(); - - nl_double m_vi; -}; - -// ---------------------------------------------------------------------------------------- -// nld_CCCS -// ---------------------------------------------------------------------------------------- - -/* - * Current controlled current source - * - * IP ---+ +------> OP - * | | - * RI I - * RI => G => I IOut = (V(IP)-V(IN)) / RI * G - * RI I - * | | - * IN ---+ +------< ON - * - * G=1 ==> 1A ==> 1A - * - * RI = 1 - * - * This needs high levels of accuracy to work with 1 Ohm RI. - * - */ - -NETLIB_OBJECT_DERIVED(CCCS, VCCS) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(CCCS, VCCS) - , m_gfac(1.0) - { - m_gfac = NL_FCONST(1.0) / m_RI(); - } - -protected: - NETLIB_UPDATEI(); - NETLIB_RESETI(); - NETLIB_UPDATE_PARAMI(); - - nl_double m_gfac; -}; - - -// ---------------------------------------------------------------------------------------- -// nld_VCVS -// ---------------------------------------------------------------------------------------- - -/* - * Voltage controlled voltage source - * - * Parameters: - * G Default: 1 - * RO Default: 1 (would be typically 50 for an op-amp - * - * IP ---+ +--+---- OP - * | | | - * RI I RO - * RI => G => I RO V(OP) - V(ON) = (V(IP)-V(IN)) * G - * RI I RO - * | | | - * IN ---+ +--+---- ON - * - * G=1 ==> 1V ==> 1V - * - * RI = 1 / NETLIST_GMIN - * - * Internal GI = G / RO - * - */ - - -NETLIB_OBJECT_DERIVED(VCVS, VCCS) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(VCVS, VCCS) - , m_RO(*this, "RO", 1.0) - , m_OP2(*this, "_OP2") - , m_ON2(*this, "_ON2") - { - m_OP2.m_otherterm = &m_ON2; - m_ON2.m_otherterm = &m_OP2; - - connect(m_OP2, m_OP1); - connect(m_ON2, m_ON1); - } - - param_double_t m_RO; - -protected: - //NETLIB_UPDATEI(); - NETLIB_RESETI(); - //NETLIB_UPDATE_PARAMI(); - - terminal_t m_OP2; - terminal_t m_ON2; - -}; - - } //namespace devices -} // namespace netlist - - #endif /* NLD_FOURTERM_H_ */ diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp index e777ffb791c..64f6b1b6df9 100644 --- a/src/lib/netlist/analog/nld_opamps.cpp +++ b/src/lib/netlist/analog/nld_opamps.cpp @@ -6,9 +6,14 @@ */ #include "nld_opamps.h" -#include "devices/net_lib.h" +#include "nl_base.h" +#include "nl_errstr.h" +#include "nlid_twoterm.h" +#include "nlid_fourterm.h" +#include <cmath> + namespace netlist { namespace analog @@ -42,6 +47,61 @@ namespace netlist * * */ + /*! Class representing the opamp model parameters. + * The opamp model was designed based on designs from + * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm. + * Currently 2 different types are supported: Type 1 and Type 3. Type 1 + * is less complex and should run faster than Type 3. + * + * This is an extension to the traditional SPICE approach which + * assumes that you will be using an manufacturer model. These models may + * have copyrights incompatible with the netlist license. Thus they may not + * be suitable for certain implementations of netlist. + * + * For the typical use cases in low frequency (< 100 KHz) applications at + * which netlist is targeted, this model is certainly suitable. All parameters + * can be determined from a typical opamp datasheet. + * + * |Type|name |parameter |units|default| example| + * |:--:|:-----|:----------------------------------------------|:----|------:|-------:| + * | 3 |TYPE |Model Type, 1 and 3 are supported | | | | + * |1,3 |FPF |frequency of first pole |Hz | |100 | + * | 3 |SLEW |unity gain slew rate |V/s | | 1| + * |1,3 |RI |input resistance |Ohm | |1M | + * |1,3 |RO |output resistance |Ohm | |50 | + * |1,3 |UGF |unity gain frequency (transition frequency) |Hz | |1000 | + * | 3 |VLL |low output swing minus low supply rail |V | |1.5 | + * | 3 |VLH |high supply rail minus high output swing |V | |1.5 | + * | 3 |DAB |Differential Amp Bias - total quiescent current|A | |0.001 | + */ + + class opamp_model_t : public param_model_t + { + public: + opamp_model_t(device_t &device, const pstring name, const pstring val) + : param_model_t(device, name, val) + , m_TYPE(*this, "TYPE") + , m_FPF(*this, "FPF") + , m_SLEW(*this, "SLEW") + , m_RI(*this, "RI") + , m_RO(*this, "RO") + , m_UGF(*this, "UGF") + , m_VLL(*this, "VLL") + , m_VLH(*this, "VLH") + , m_DAB(*this, "DAB") + {} + + value_t m_TYPE; //!< Model Type, 1 and 3 are supported + value_t m_FPF; //!< frequency of first pole + value_t m_SLEW; //!< unity gain slew rate + value_t m_RI; //!< input resistance + value_t m_RO; //!< output resistance + value_t m_UGF; //!< unity gain frequency (transition frequency) + value_t m_VLL; //!< low output swing minus low supply rail + value_t m_VLH; //!< high supply rail minus high output swing + value_t m_DAB; //!< Differential Amp Bias - total quiescent current + }; + NETLIB_OBJECT(opamp) { @@ -99,7 +159,7 @@ namespace netlist connect("EBUF.IP", "RP1.1"); } else - netlist().log().fatal("Unknown opamp type: {1}", m_type); + log().fatal(MF_1_UNKNOWN_OPAMP_TYPE, m_type); } diff --git a/src/lib/netlist/analog/nld_opamps.h b/src/lib/netlist/analog/nld_opamps.h index b407bb2215e..31b883be688 100644 --- a/src/lib/netlist/analog/nld_opamps.h +++ b/src/lib/netlist/analog/nld_opamps.h @@ -10,10 +10,7 @@ #ifndef NLD_OPAMPS_H_ #define NLD_OPAMPS_H_ -#include "nl_base.h" #include "nl_setup.h" -#include "nld_twoterm.h" -#include "nld_fourterm.h" // ---------------------------------------------------------------------------------------- // Macros @@ -23,72 +20,5 @@ NET_REGISTER_DEV(OPAMP, name) \ NETDEV_PARAMI(name, MODEL, model) -// ---------------------------------------------------------------------------------------- -// Devices ... -// ---------------------------------------------------------------------------------------- - -namespace netlist -{ - namespace analog - { - - /*! Class representing the opamp model parameters. - * The opamp model was designed based on designs from - * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm. - * Currently 2 different types are supported: Type 1 and Type 3. Type 1 - * is less complex and should run faster than Type 3. - * - * This is an extension to the traditional SPICE approach which - * assumes that you will be using an manufacturer model. These models may - * have copyrights incompatible with the netlist license. Thus they may not - * be suitable for certain implementations of netlist. - * - * For the typical use cases in low frequency (< 100 KHz) applications at - * which netlist is targeted, this model is certainly suitable. All parameters - * can be determined from a typical opamp datasheet. - * - * |Type|name |parameter |units|default| example| - * |:--:|:-----|:----------------------------------------------|:----|------:|-------:| - * | 3 |TYPE |Model Type, 1 and 3 are supported | | | | - * |1,3 |FPF |frequency of first pole |Hz | |100 | - * | 3 |SLEW |unity gain slew rate |V/s | | 1| - * |1,3 |RI |input resistance |Ohm | |1M | - * |1,3 |RO |output resistance |Ohm | |50 | - * |1,3 |UGF |unity gain frequency (transition frequency) |Hz | |1000 | - * | 3 |VLL |low output swing minus low supply rail |V | |1.5 | - * | 3 |VLH |high supply rail minus high output swing |V | |1.5 | - * | 3 |DAB |Differential Amp Bias - total quiescent current|A | |0.001 | - */ - - class opamp_model_t : public param_model_t - { - public: - opamp_model_t(device_t &device, const pstring name, const pstring val) - : param_model_t(device, name, val) - , m_TYPE(*this, "TYPE") - , m_FPF(*this, "FPF") - , m_SLEW(*this, "SLEW") - , m_RI(*this, "RI") - , m_RO(*this, "RO") - , m_UGF(*this, "UGF") - , m_VLL(*this, "VLL") - , m_VLH(*this, "VLH") - , m_DAB(*this, "DAB") - {} - - value_t m_TYPE; //!< Model Type, 1 and 3 are supported - value_t m_FPF; //!< frequency of first pole - value_t m_SLEW; //!< unity gain slew rate - value_t m_RI; //!< input resistance - value_t m_RO; //!< output resistance - value_t m_UGF; //!< unity gain frequency (transition frequency) - value_t m_VLL; //!< low output swing minus low supply rail - value_t m_VLH; //!< high supply rail minus high output swing - value_t m_DAB; //!< Differential Amp Bias - total quiescent current - }; - - - } //namespace analog -} // namespace netlist #endif /* NLD_OPAMPS_H_ */ diff --git a/src/lib/netlist/analog/nld_switches.cpp b/src/lib/netlist/analog/nld_switches.cpp index 92afa752e86..bf92a8cf4f8 100644 --- a/src/lib/netlist/analog/nld_switches.cpp +++ b/src/lib/netlist/analog/nld_switches.cpp @@ -5,8 +5,9 @@ * */ -#include "nld_switches.h" -#include "nl_setup.h" +#include "nlid_twoterm.h" +#include "nl_base.h" +#include "nl_factory.h" #define R_OFF (1.0 / netlist().gmin()) #define R_ON 0.01 diff --git a/src/lib/netlist/analog/nld_switches.h b/src/lib/netlist/analog/nld_switches.h index d91cf775377..06af3fad0ca 100644 --- a/src/lib/netlist/analog/nld_switches.h +++ b/src/lib/netlist/analog/nld_switches.h @@ -10,8 +10,7 @@ #ifndef NLD_SWITCHES_H_ #define NLD_SWITCHES_H_ -#include "nl_base.h" -#include "nld_twoterm.h" +#include "nl_setup.h" // ---------------------------------------------------------------------------------------- // Macros @@ -23,5 +22,4 @@ #define SWITCH2(name) \ NET_REGISTER_DEV(SWITCH2, name) - #endif /* NLD_SWITCHES_H_ */ diff --git a/src/lib/netlist/analog/nld_twoterm.h b/src/lib/netlist/analog/nld_twoterm.h index 06325679dff..3ffbafd3b51 100644 --- a/src/lib/netlist/analog/nld_twoterm.h +++ b/src/lib/netlist/analog/nld_twoterm.h @@ -1,39 +1,10 @@ // license:GPL-2.0+ // copyright-holders:Couriersud -/* - * nld_twoterm.h - * - * Devices with two terminals ... - * - * - * (k) - * +-----T-----+ - * | | | - * | +--+--+ | - * | | | | - * | R | | - * | R | | - * | R I | - * | | I | Device n - * | V+ I | - * | V | | - * | V- | | - * | | | | - * | +--+--+ | - * | | | - * +-----T-----+ - * (l) - * - * This is a resistance in series to a voltage source and paralleled by a - * current source. This is suitable to model voltage sources, current sources, - * resistors, capacitors, inductances and diodes. - * - */ #ifndef NLD_TWOTERM_H_ #define NLD_TWOTERM_H_ -#include "nl_base.h" +#include "nl_setup.h" // ----------------------------------------------------------------------------- // Macros @@ -95,397 +66,4 @@ #define IND_P(ind) (static_cast<double>(ind) * 1e-12) #endif -// ----------------------------------------------------------------------------- -// Implementation -// ----------------------------------------------------------------------------- - -namespace netlist -{ - namespace analog - { -// ----------------------------------------------------------------------------- -// nld_twoterm -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT(twoterm) -{ - NETLIB_CONSTRUCTOR_EX(twoterm, bool terminals_owned = false) - , m_P(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "1") - , m_N(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "2") - { - m_P.m_otherterm = &m_N; - m_N.m_otherterm = &m_P; - } - - terminal_t m_P; - terminal_t m_N; - - //NETLIB_UPDATE_TERMINALSI() { } - //NETLIB_RESETI() { } - NETLIB_UPDATEI(); - -public: - /* inline */ void set(const nl_double G, const nl_double V, const nl_double I) - { - /* GO, GT, I */ - m_P.set( G, G, ( V) * G - I); - m_N.set( G, G, ( -V) * G + I); - } - - /* inline */ nl_double deltaV() const - { - return m_P.net().Q_Analog() - m_N.net().Q_Analog(); - } - - void set_mat(const nl_double a11, const nl_double a12, const nl_double r1, - const nl_double a21, const nl_double a22, const nl_double r2) - { - /* GO, GT, I */ - m_P.set(-a12, a11, r1); - m_N.set(-a21, a22, r2); - } - -private: - template <class C> - static core_device_t &bselect(bool b, C &d1, core_device_t &d2) - { - core_device_t *h = dynamic_cast<core_device_t *>(&d1); - return b ? *h : d2; - } -}; - - -// ----------------------------------------------------------------------------- -// nld_R -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(R_base, twoterm) -{ - NETLIB_CONSTRUCTOR_DERIVED(R_base, twoterm) - { - } - -public: - inline void set_R(const nl_double R) - { - const nl_double G = NL_FCONST(1.0) / R; - set_mat( G, -G, 0.0, - -G, G, 0.0); - } - -protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - -}; - -NETLIB_OBJECT_DERIVED(R, R_base) -{ - NETLIB_CONSTRUCTOR_DERIVED(R, R_base) - , m_R(*this, "R", 1e9) - { - } - - param_double_t m_R; - -protected: - - NETLIB_RESETI(); - //NETLIB_UPDATEI() { } - NETLIB_UPDATE_PARAMI(); - -private: - /* protect set_R ... it's a recipe to desaster when used to bypass the parameter */ - using NETLIB_NAME(R_base)::set_R; -}; - -// ----------------------------------------------------------------------------- -// nld_POT -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT(POT) -{ - NETLIB_CONSTRUCTOR(POT) - , m_R1(*this, "_R1") - , m_R2(*this, "_R2") - , m_R(*this, "R", 10000) - , m_Dial(*this, "DIAL", 0.5) - , m_DialIsLog(*this, "DIALLOG", 0) - { - register_subalias("1", m_R1.m_P); - register_subalias("2", m_R1.m_N); - register_subalias("3", m_R2.m_N); - - connect(m_R2.m_P, m_R1.m_N); - - } - - //NETLIB_UPDATEI(); - NETLIB_RESETI(); - NETLIB_UPDATE_PARAMI(); - -private: - NETLIB_SUB(R_base) m_R1; - NETLIB_SUB(R_base) m_R2; - - param_double_t m_R; - param_double_t m_Dial; - param_logic_t m_DialIsLog; -}; - -NETLIB_OBJECT(POT2) -{ - NETLIB_CONSTRUCTOR(POT2) - , m_R1(*this, "_R1") - , m_R(*this, "R", 10000) - , m_Dial(*this, "DIAL", 0.5) - , m_DialIsLog(*this, "DIALLOG", 0) - , m_Reverse(*this, "REVERSE", 0) - { - register_subalias("1", m_R1.m_P); - register_subalias("2", m_R1.m_N); - - } - - //NETLIB_UPDATEI(); - NETLIB_RESETI(); - NETLIB_UPDATE_PARAMI(); - -private: - NETLIB_SUB(R_base) m_R1; - - param_double_t m_R; - param_double_t m_Dial; - param_logic_t m_DialIsLog; - param_logic_t m_Reverse; -}; - - -// ----------------------------------------------------------------------------- -// nld_C -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(C, twoterm) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(C, twoterm) - , m_C(*this, "C", 1e-6) - , m_GParallel(0.0) - { - //register_term("1", m_P); - //register_term("2", m_N); - } - - NETLIB_IS_TIMESTEP() - NETLIB_TIMESTEPI(); - - param_double_t m_C; - -protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI(); - -private: - nl_double m_GParallel; - -}; - -// ----------------------------------------------------------------------------- -// nld_L -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(L, twoterm) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(L, twoterm) - , m_L(*this, "L", 1e-6) - , m_GParallel(0.0) - , m_G(0.0) - , m_I(0.0) - { - //register_term("1", m_P); - //register_term("2", m_N); - } - - NETLIB_IS_TIMESTEP() - NETLIB_TIMESTEPI(); - - param_double_t m_L; - -protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI(); - -private: - nl_double m_GParallel; - nl_double m_G; - nl_double m_I; -}; - -// ----------------------------------------------------------------------------- -// A generic diode model to be used in other devices (Diode, BJT ...) -// ----------------------------------------------------------------------------- - -class generic_diode -{ -public: - generic_diode(device_t &dev, pstring name); - - void update_diode(const nl_double nVd); - - void set_param(const nl_double Is, const nl_double n, nl_double gmin); - - inline nl_double I() const { return m_Id; } - inline nl_double G() const { return m_G; } - inline nl_double Ieq() const { return (m_Id - m_Vd * m_G); } - inline nl_double Vd() const { return m_Vd; } - - /* owning object must save those ... */ - -private: - state_var<nl_double> m_Vd; - state_var<nl_double> m_Id; - state_var<nl_double> m_G; - - nl_double m_Vt; - nl_double m_Is; - nl_double m_n; - nl_double m_gmin; - - nl_double m_VtInv; - nl_double m_Vcrit; -}; - -/*! Class representing the diode model paramers. - * This is the model representation of the diode model. Typically, SPICE uses - * the following parameters. A "Y" in the first column indicates that the - * parameter is actually used in netlist. - * - * |NL? |name |parameter |units|default| example|area | - * |:--:|:-----|:--------------------------------|:----|------:|-------:|:----:| - * | Y |IS |saturation current |A |1.0e-14| 1.0e-14| * | - * | |RS |ohmic resistanc |Ohm | 0| 10| * | - * | Y |N |emission coefficient |- | 1| 1| | - * | |TT |transit-time |sec | 0| 0.1ns| | - * | |CJO |zero-bias junction capacitance |F | 0| 2pF| * | - * | |VJ |junction potential |V | 1| 0.6| | - * | |M |grading coefficient |- | 0.5| 0.5| | - * | |EG |band-gap energy |eV | 1.11| 1.11 Si| | - * | |XTI |saturation-current temp.exp |- | 3|3.0 pn. 2.0 Schottky| | - * | |KF |flicker noise coefficient |- | 0| | | - * | |AF |flicker noise exponent |- | 1| | | - * | |FC |coefficient for forward-bias depletion capacitance formula|-|0.5|| | - * | |BV |reverse breakdown voltage |V |infinite| 40| | - * | |IBV |current at breakdown voltage |V | 0.001| | | - * | |TNOM |parameter measurement temperature|deg C| 27| 50| | - * - */ - -class diode_model_t : public param_model_t -{ -public: - diode_model_t(device_t &device, const pstring name, const pstring val) - : param_model_t(device, name, val) - , m_IS(*this, "IS") - , m_N(*this, "N") - {} - - value_t m_IS; //!< saturation current. - value_t m_N; //!< emission coefficient. -}; - - -// ----------------------------------------------------------------------------- -// nld_D -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(D, twoterm) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(D, twoterm) - , m_model(*this, "MODEL", "") - , m_D(*this, "m_D") - { - register_subalias("A", m_P); - register_subalias("K", m_N); - } - - template <class CLASS> - NETLIB_NAME(D)(CLASS &owner, const pstring name, const pstring model) - : NETLIB_NAME(twoterm)(owner, name) - , m_model(*this, "MODEL", model) - , m_D(*this, "m_D") - { - register_subalias("A", m_P); - register_subalias("K", m_N); - } - - - NETLIB_IS_DYNAMIC() - - NETLIB_UPDATE_TERMINALSI(); - - diode_model_t m_model; - -protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - NETLIB_UPDATE_PARAMI(); - - generic_diode m_D; -}; - - -// ----------------------------------------------------------------------------- -// nld_VS - Voltage source -// -// netlist voltage source must have inner resistance -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(VS, twoterm) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(VS, twoterm) - , m_R(*this, "R", 0.1) - , m_V(*this, "V", 0.0) - { - register_subalias("P", m_P); - register_subalias("N", m_N); - } - -protected: - NETLIB_UPDATEI(); - NETLIB_RESETI(); - - param_double_t m_R; - param_double_t m_V; -}; - -// ----------------------------------------------------------------------------- -// nld_CS - Current source -// ----------------------------------------------------------------------------- - -NETLIB_OBJECT_DERIVED(CS, twoterm) -{ -public: - NETLIB_CONSTRUCTOR_DERIVED(CS, twoterm) - , m_I(*this, "I", 1.0) - { - register_subalias("P", m_P); - register_subalias("N", m_N); - } - - NETLIB_UPDATEI(); - NETLIB_RESETI(); -protected: - - param_double_t m_I; -}; - - - } //namespace devices -} // namespace netlist - #endif /* NLD_TWOTERM_H_ */ diff --git a/src/lib/netlist/analog/nld_fourterm.cpp b/src/lib/netlist/analog/nlid_fourterm.cpp index 3707b2a74c4..493b22fe231 100644 --- a/src/lib/netlist/analog/nld_fourterm.cpp +++ b/src/lib/netlist/analog/nlid_fourterm.cpp @@ -6,13 +6,17 @@ */ #include "solver/nld_solver.h" -#include "nld_fourterm.h" +#include "nlid_fourterm.h" #include "nl_setup.h" +#include <cmath> + namespace netlist { namespace analog { + + // ---------------------------------------------------------------------------------------- // nld_VCCS // ---------------------------------------------------------------------------------------- @@ -119,5 +123,12 @@ NETLIB_RESET(VCVS) m_ON2.set(NL_FCONST(1.0) / m_RO()); } - } //namespace devices + } //namespace analog + + namespace devices { + NETLIB_DEVICE_IMPL_NS(analog, VCVS) + NETLIB_DEVICE_IMPL_NS(analog, VCCS) + NETLIB_DEVICE_IMPL_NS(analog, CCCS) + NETLIB_DEVICE_IMPL_NS(analog, LVCCS) + } } // namespace netlist diff --git a/src/lib/netlist/analog/nlid_fourterm.h b/src/lib/netlist/analog/nlid_fourterm.h new file mode 100644 index 00000000000..cfc8f30d751 --- /dev/null +++ b/src/lib/netlist/analog/nlid_fourterm.h @@ -0,0 +1,211 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nlid_fourterm.h + * + */ + +#ifndef NLID_FOURTERM_H_ +#define NLID_FOURTERM_H_ + +#include "nl_base.h" + +namespace netlist { + namespace analog { + + // ---------------------------------------------------------------------------------------- + // nld_VCCS + // ---------------------------------------------------------------------------------------- + + /* + * Voltage controlled current source + * + * IP ---+ +------> OP + * | | + * RI I + * RI => G => I IOut = (V(IP)-V(IN)) * G + * RI I + * | | + * IN ---+ +------< ON + * + * G=1 ==> 1V ==> 1A + * + * RI = 1 / NETLIST_GMIN + * + */ + + NETLIB_OBJECT(VCCS) + { + public: + NETLIB_CONSTRUCTOR(VCCS) + , m_G(*this, "G", 1.0) + , m_RI(*this, "RI", 1e9) + , m_OP(*this, "OP") + , m_ON(*this, "ON") + , m_IP(*this, "IP") + , m_IN(*this, "IN") + , m_OP1(*this, "_OP1") + , m_ON1(*this, "_ON1") + , m_gfac(1.0) + { + m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving... + m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving... + + m_OP.m_otherterm = &m_IP; + m_OP1.m_otherterm = &m_IN; + + m_ON.m_otherterm = &m_IP; + m_ON1.m_otherterm = &m_IN; + + connect(m_OP, m_OP1); + connect(m_ON, m_ON1); + m_gfac = NL_FCONST(1.0); + } + + param_double_t m_G; + param_double_t m_RI; + + protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI() + { + NETLIB_NAME(VCCS)::reset(); + } + + terminal_t m_OP; + terminal_t m_ON; + + terminal_t m_IP; + terminal_t m_IN; + + terminal_t m_OP1; + terminal_t m_ON1; + + nl_double m_gfac; + }; + + /* Limited Current source*/ + + NETLIB_OBJECT_DERIVED(LVCCS, VCCS) + { + public: + NETLIB_CONSTRUCTOR_DERIVED(LVCCS, VCCS) + , m_cur_limit(*this, "CURLIM", 1000.0) + , m_vi(0.0) + { + } + + NETLIB_IS_DYNAMIC(true) + + param_double_t m_cur_limit; /* current limit */ + + protected: + NETLIB_UPDATEI(); + NETLIB_RESETI(); + NETLIB_UPDATE_PARAMI(); + NETLIB_UPDATE_TERMINALSI(); + + nl_double m_vi; + }; + + // ---------------------------------------------------------------------------------------- + // nld_CCCS + // ---------------------------------------------------------------------------------------- + + /* + * Current controlled current source + * + * IP ---+ +------> OP + * | | + * RI I + * RI => G => I IOut = (V(IP)-V(IN)) / RI * G + * RI I + * | | + * IN ---+ +------< ON + * + * G=1 ==> 1A ==> 1A + * + * RI = 1 + * + * This needs high levels of accuracy to work with 1 Ohm RI. + * + */ + + NETLIB_OBJECT_DERIVED(CCCS, VCCS) + { + public: + NETLIB_CONSTRUCTOR_DERIVED(CCCS, VCCS) + , m_gfac(1.0) + { + m_gfac = NL_FCONST(1.0) / m_RI(); + } + + protected: + NETLIB_UPDATEI(); + NETLIB_RESETI(); + NETLIB_UPDATE_PARAMI(); + + nl_double m_gfac; + }; + + + // ---------------------------------------------------------------------------------------- + // nld_VCVS + // ---------------------------------------------------------------------------------------- + + /* + * Voltage controlled voltage source + * + * Parameters: + * G Default: 1 + * RO Default: 1 (would be typically 50 for an op-amp + * + * IP ---+ +--+---- OP + * | | | + * RI I RO + * RI => G => I RO V(OP) - V(ON) = (V(IP)-V(IN)) * G + * RI I RO + * | | | + * IN ---+ +--+---- ON + * + * G=1 ==> 1V ==> 1V + * + * RI = 1 / NETLIST_GMIN + * + * Internal GI = G / RO + * + */ + + + NETLIB_OBJECT_DERIVED(VCVS, VCCS) + { + public: + NETLIB_CONSTRUCTOR_DERIVED(VCVS, VCCS) + , m_RO(*this, "RO", 1.0) + , m_OP2(*this, "_OP2") + , m_ON2(*this, "_ON2") + { + m_OP2.m_otherterm = &m_ON2; + m_ON2.m_otherterm = &m_OP2; + + connect(m_OP2, m_OP1); + connect(m_ON2, m_ON1); + } + + param_double_t m_RO; + + protected: + //NETLIB_UPDATEI(); + NETLIB_RESETI(); + //NETLIB_UPDATE_PARAMI(); + + terminal_t m_OP2; + terminal_t m_ON2; + + }; + + } +} + +#endif /* NLD_FOURTERM_H_ */ diff --git a/src/lib/netlist/analog/nld_twoterm.cpp b/src/lib/netlist/analog/nlid_twoterm.cpp index a87e0c03f88..a9a4edb604a 100644 --- a/src/lib/netlist/analog/nld_twoterm.cpp +++ b/src/lib/netlist/analog/nlid_twoterm.cpp @@ -5,10 +5,12 @@ * */ -#include <solver/nld_solver.h> -#include <algorithm> +#include "solver/nld_solver.h" -#include "nld_twoterm.h" +#include "nlid_twoterm.h" +#include "nl_factory.h" + +#include <cmath> namespace netlist { @@ -23,7 +25,9 @@ generic_diode::generic_diode(device_t &dev, pstring name) , m_Id(dev, name + ".m_Id", 0.0) , m_G(dev, name + ".m_G", 1e-15) , m_Vt(0.0) + , m_Vmin(0.0) , m_Is(0.0) + , m_logIs(0.0) , m_n(0.0) , m_gmin(1e-15) , m_VtInv(0.0) @@ -36,10 +40,12 @@ void generic_diode::set_param(const nl_double Is, const nl_double n, nl_double g { static const double csqrt2 = std::sqrt(2.0); m_Is = Is; + m_logIs = std::log(Is); m_n = n; m_gmin = gmin; m_Vt = 0.0258 * m_n; + m_Vmin = -5.0 * m_Vt; m_Vcrit = m_Vt * std::log(m_Vt / m_Is / csqrt2); m_VtInv = 1.0 / m_Vt; @@ -47,8 +53,7 @@ void generic_diode::set_param(const nl_double Is, const nl_double n, nl_double g void generic_diode::update_diode(const nl_double nVd) { -#if 1 - if (nVd < NL_FCONST(-5.0) * m_Vt) + if (nVd < m_Vmin) { m_Vd = nVd; m_G = m_gmin; @@ -58,29 +63,20 @@ void generic_diode::update_diode(const nl_double nVd) { m_Vd = nVd; //m_Vd = m_Vd + 10.0 * m_Vt * std::tanh((nVd - m_Vd) / 10.0 / m_Vt); - const nl_double eVDVt = std::exp(m_Vd * m_VtInv); - m_Id = m_Is * (eVDVt - NL_FCONST(1.0)); - m_G = m_Is * m_VtInv * eVDVt + m_gmin; + //const double IseVDVt = m_Is * std::exp(m_Vd * m_VtInv); + const double IseVDVt = std::exp(m_logIs + m_Vd * m_VtInv); + m_Id = IseVDVt - m_Is; + m_G = IseVDVt * m_VtInv + m_gmin; } else { -#if 1 - const nl_double a = std::max((nVd - m_Vd) * m_VtInv, NL_FCONST(-0.99)); + const double a = std::max((nVd - m_Vd) * m_VtInv, NL_FCONST(-0.99)); m_Vd = m_Vd + std::log1p(a) * m_Vt; -#else - m_Vd = m_Vd + 10.0 * m_Vt * std::tanh((nVd - m_Vd) / 10.0 / m_Vt); -#endif - const nl_double eVDVt = std::exp(m_Vd * m_VtInv); - m_Id = m_Is * (eVDVt - NL_FCONST(1.0)); - - m_G = m_Is * m_VtInv * eVDVt + m_gmin; + //const double IseVDVt = m_Is * std::exp(m_Vd * m_VtInv); + const double IseVDVt = std::exp(m_logIs + m_Vd * m_VtInv); + m_Id = IseVDVt - m_Is; + m_G = IseVDVt * m_VtInv + m_gmin; } -#else - m_Vd = m_Vd + 20.0 * m_Vt * std::tanh((nVd - m_Vd) / 20.0 / m_Vt); - const nl_double eVDVt = std::exp(m_Vd * m_VtInv); - m_Id = m_Is * (eVDVt - NL_FCONST(1.0)); - m_G = m_Is * m_VtInv * eVDVt + m_gmin; -#endif } // ---------------------------------------------------------------------------------------- @@ -300,6 +296,13 @@ NETLIB_UPDATE(VS) NETLIB_NAME(twoterm)::update(); } +NETLIB_TIMESTEP(VS) +{ + this->set(1.0 / m_R(), + m_compiled.evaluate(std::vector<double>({netlist().time().as_double()})), + 0.0); +} + // ---------------------------------------------------------------------------------------- // nld_CS // ---------------------------------------------------------------------------------------- @@ -319,5 +322,24 @@ NETLIB_UPDATE(CS) NETLIB_NAME(twoterm)::update(); } - } //namespace devices +NETLIB_TIMESTEP(CS) +{ + const double I = m_compiled.evaluate(std::vector<double>({netlist().time().as_double()})); + set_mat(0.0, 0.0, -I, + 0.0, 0.0, I); +} + + } //namespace analog + + namespace devices { + NETLIB_DEVICE_IMPL_NS(analog, R) + NETLIB_DEVICE_IMPL_NS(analog, POT) + NETLIB_DEVICE_IMPL_NS(analog, POT2) + NETLIB_DEVICE_IMPL_NS(analog, C) + NETLIB_DEVICE_IMPL_NS(analog, L) + NETLIB_DEVICE_IMPL_NS(analog, D) + NETLIB_DEVICE_IMPL_NS(analog, VS) + NETLIB_DEVICE_IMPL_NS(analog, CS) + } + } // namespace netlist diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h new file mode 100644 index 00000000000..6166c707d2d --- /dev/null +++ b/src/lib/netlist/analog/nlid_twoterm.h @@ -0,0 +1,448 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_twoterm.h + * + * Devices with two terminals ... + * + * + * (k) + * +-----T-----+ + * | | | + * | +--+--+ | + * | | | | + * | R | | + * | R | | + * | R I | + * | | I | Device n + * | V+ I | + * | V | | + * | V- | | + * | | | | + * | +--+--+ | + * | | | + * +-----T-----+ + * (l) + * + * This is a resistance in series to a voltage source and paralleled by a + * current source. This is suitable to model voltage sources, current sources, + * resistors, capacitors, inductances and diodes. + * + */ + +#ifndef NLID_TWOTERM_H_ +#define NLID_TWOTERM_H_ + +#include "nl_base.h" +#include "plib/pfunction.h" + +// ----------------------------------------------------------------------------- +// Implementation +// ----------------------------------------------------------------------------- + +namespace netlist +{ + namespace analog + { +// ----------------------------------------------------------------------------- +// nld_twoterm +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT(twoterm) +{ + NETLIB_CONSTRUCTOR_EX(twoterm, bool terminals_owned = false) + , m_P(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "1") + , m_N(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "2") + { + m_P.m_otherterm = &m_N; + m_N.m_otherterm = &m_P; + } + + terminal_t m_P; + terminal_t m_N; + + //NETLIB_UPDATE_TERMINALSI() { } + //NETLIB_RESETI() { } + NETLIB_UPDATEI(); + +public: + /* inline */ void set(const nl_double G, const nl_double V, const nl_double I) + { + /* GO, GT, I */ + m_P.set( G, G, ( V) * G - I); + m_N.set( G, G, ( -V) * G + I); + } + + /* inline */ nl_double deltaV() const + { + return m_P.net().Q_Analog() - m_N.net().Q_Analog(); + } + + void set_mat(const nl_double a11, const nl_double a12, const nl_double r1, + const nl_double a21, const nl_double a22, const nl_double r2) + { + /* GO, GT, I */ + m_P.set(-a12, a11, r1); + m_N.set(-a21, a22, r2); + } + +private: + template <class C> + static core_device_t &bselect(bool b, C &d1, core_device_t &d2) + { + core_device_t *h = dynamic_cast<core_device_t *>(&d1); + return b ? *h : d2; + } +}; + + +// ----------------------------------------------------------------------------- +// nld_R +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(R_base, twoterm) +{ + NETLIB_CONSTRUCTOR_DERIVED(R_base, twoterm) + { + } + +public: + inline void set_R(const nl_double R) + { + const nl_double G = NL_FCONST(1.0) / R; + set_mat( G, -G, 0.0, + -G, G, 0.0); + } + +protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); + +}; + +NETLIB_OBJECT_DERIVED(R, R_base) +{ + NETLIB_CONSTRUCTOR_DERIVED(R, R_base) + , m_R(*this, "R", 1e9) + { + } + + param_double_t m_R; + +protected: + + NETLIB_RESETI(); + //NETLIB_UPDATEI() { } + NETLIB_UPDATE_PARAMI(); + +private: + /* protect set_R ... it's a recipe to desaster when used to bypass the parameter */ + using NETLIB_NAME(R_base)::set_R; +}; + +// ----------------------------------------------------------------------------- +// nld_POT +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT(POT) +{ + NETLIB_CONSTRUCTOR(POT) + , m_R1(*this, "_R1") + , m_R2(*this, "_R2") + , m_R(*this, "R", 10000) + , m_Dial(*this, "DIAL", 0.5) + , m_DialIsLog(*this, "DIALLOG", 0) + { + register_subalias("1", m_R1.m_P); + register_subalias("2", m_R1.m_N); + register_subalias("3", m_R2.m_N); + + connect(m_R2.m_P, m_R1.m_N); + + } + + //NETLIB_UPDATEI(); + NETLIB_RESETI(); + NETLIB_UPDATE_PARAMI(); + +private: + NETLIB_SUB(R_base) m_R1; + NETLIB_SUB(R_base) m_R2; + + param_double_t m_R; + param_double_t m_Dial; + param_logic_t m_DialIsLog; +}; + +NETLIB_OBJECT(POT2) +{ + NETLIB_CONSTRUCTOR(POT2) + , m_R1(*this, "_R1") + , m_R(*this, "R", 10000) + , m_Dial(*this, "DIAL", 0.5) + , m_DialIsLog(*this, "DIALLOG", 0) + , m_Reverse(*this, "REVERSE", 0) + { + register_subalias("1", m_R1.m_P); + register_subalias("2", m_R1.m_N); + + } + + //NETLIB_UPDATEI(); + NETLIB_RESETI(); + NETLIB_UPDATE_PARAMI(); + +private: + NETLIB_SUB(R_base) m_R1; + + param_double_t m_R; + param_double_t m_Dial; + param_logic_t m_DialIsLog; + param_logic_t m_Reverse; +}; + + +// ----------------------------------------------------------------------------- +// nld_C +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(C, twoterm) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(C, twoterm) + , m_C(*this, "C", 1e-6) + , m_GParallel(0.0) + { + //register_term("1", m_P); + //register_term("2", m_N); + } + + NETLIB_IS_TIMESTEP(true) + NETLIB_TIMESTEPI(); + + param_double_t m_C; + +protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI(); + +private: + nl_double m_GParallel; + +}; + +// ----------------------------------------------------------------------------- +// nld_L +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(L, twoterm) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(L, twoterm) + , m_L(*this, "L", 1e-6) + , m_GParallel(0.0) + , m_G(0.0) + , m_I(0.0) + { + //register_term("1", m_P); + //register_term("2", m_N); + } + + NETLIB_IS_TIMESTEP(true) + NETLIB_TIMESTEPI(); + + param_double_t m_L; + +protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI(); + +private: + nl_double m_GParallel; + nl_double m_G; + nl_double m_I; +}; + +// ----------------------------------------------------------------------------- +// A generic diode model to be used in other devices (Diode, BJT ...) +// ----------------------------------------------------------------------------- + +class generic_diode +{ +public: + generic_diode(device_t &dev, pstring name); + + void update_diode(const double nVd); + + void set_param(const double Is, const double n, double gmin); + + double I() const { return m_Id; } + double G() const { return m_G; } + double Ieq() const { return (m_Id - m_Vd * m_G); } + double Vd() const { return m_Vd; } + + /* owning object must save those ... */ + +private: + state_var<double> m_Vd; + state_var<double> m_Id; + state_var<double> m_G; + + double m_Vt; + double m_Vmin; + double m_Is; + double m_logIs; + double m_n; + double m_gmin; + + double m_VtInv; + double m_Vcrit; +}; + +/*! Class representing the diode model paramers. + * This is the model representation of the diode model. Typically, SPICE uses + * the following parameters. A "Y" in the first column indicates that the + * parameter is actually used in netlist. + * + * |NL? |name |parameter |units|default| example|area | + * |:--:|:-----|:--------------------------------|:----|------:|-------:|:----:| + * | Y |IS |saturation current |A |1.0e-14| 1.0e-14| * | + * | |RS |ohmic resistanc |Ohm | 0| 10| * | + * | Y |N |emission coefficient |- | 1| 1| | + * | |TT |transit-time |sec | 0| 0.1ns| | + * | |CJO |zero-bias junction capacitance |F | 0| 2pF| * | + * | |VJ |junction potential |V | 1| 0.6| | + * | |M |grading coefficient |- | 0.5| 0.5| | + * | |EG |band-gap energy |eV | 1.11| 1.11 Si| | + * | |XTI |saturation-current temp.exp |- | 3|3.0 pn. 2.0 Schottky| | + * | |KF |flicker noise coefficient |- | 0| | | + * | |AF |flicker noise exponent |- | 1| | | + * | |FC |coefficient for forward-bias depletion capacitance formula|-|0.5|| | + * | |BV |reverse breakdown voltage |V |infinite| 40| | + * | |IBV |current at breakdown voltage |V | 0.001| | | + * | |TNOM |parameter measurement temperature|deg C| 27| 50| | + * + */ + +class diode_model_t : public param_model_t +{ +public: + diode_model_t(device_t &device, const pstring name, const pstring val) + : param_model_t(device, name, val) + , m_IS(*this, "IS") + , m_N(*this, "N") + {} + + value_t m_IS; //!< saturation current. + value_t m_N; //!< emission coefficient. +}; + + +// ----------------------------------------------------------------------------- +// nld_D +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(D, twoterm) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(D, twoterm) + , m_model(*this, "MODEL", "") + , m_D(*this, "m_D") + { + register_subalias("A", m_P); + register_subalias("K", m_N); + } + + template <class CLASS> + NETLIB_NAME(D)(CLASS &owner, const pstring name, const pstring model) + : NETLIB_NAME(twoterm)(owner, name) + , m_model(*this, "MODEL", model) + , m_D(*this, "m_D") + { + register_subalias("A", m_P); + register_subalias("K", m_N); + } + + NETLIB_IS_DYNAMIC(true) + NETLIB_UPDATE_TERMINALSI(); + + diode_model_t m_model; + +protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); + NETLIB_UPDATE_PARAMI(); + + generic_diode m_D; +}; + + +// ----------------------------------------------------------------------------- +// nld_VS - Voltage source +// +// netlist voltage source must have inner resistance +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(VS, twoterm) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(VS, twoterm) + , m_R(*this, "R", 0.1) + , m_V(*this, "V", 0.0) + , m_func(*this,"FUNC", "") + { + register_subalias("P", m_P); + register_subalias("N", m_N); + if (m_func() != "") + m_compiled.compile_postfix(std::vector<pstring>({{"T"}}), m_func()); + } + + NETLIB_IS_TIMESTEP(m_func() != "") + NETLIB_TIMESTEPI(); + +protected: + NETLIB_UPDATEI(); + NETLIB_RESETI(); + + param_double_t m_R; + param_double_t m_V; + param_str_t m_func; + plib::pfunction m_compiled; +}; + +// ----------------------------------------------------------------------------- +// nld_CS - Current source +// ----------------------------------------------------------------------------- + +NETLIB_OBJECT_DERIVED(CS, twoterm) +{ +public: + NETLIB_CONSTRUCTOR_DERIVED(CS, twoterm) + , m_I(*this, "I", 1.0) + , m_func(*this,"FUNC", "") + { + register_subalias("P", m_P); + register_subalias("N", m_N); + if (m_func() != "") + m_compiled.compile_postfix(std::vector<pstring>({{"T"}}), m_func()); + } + + NETLIB_IS_TIMESTEP(m_func() != "") + NETLIB_TIMESTEPI(); +protected: + + NETLIB_UPDATEI(); + NETLIB_RESETI(); + + param_double_t m_I; + param_str_t m_func; + plib::pfunction m_compiled; +}; + + + } //namespace devices +} // namespace netlist + +#endif /* NLD_TWOTERM_H_ */ diff --git a/src/lib/netlist/build/doxygen.conf b/src/lib/netlist/build/doxygen.conf index adf69b30e54..9de9b691114 100644 --- a/src/lib/netlist/build/doxygen.conf +++ b/src/lib/netlist/build/doxygen.conf @@ -24,7 +24,7 @@ # for the list of possible encodings. # The default value is: UTF-8. -DOXYFILE_ENCODING = UTF-8 +DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the @@ -32,33 +32,33 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "My Project" +PROJECT_NAME = Netlist documentaton # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = +PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = doxy +OUTPUT_DIRECTORY = doxy # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -68,7 +68,7 @@ OUTPUT_DIRECTORY = doxy # performance problems for the file system. # The default value is: NO. -CREATE_SUBDIRS = NO +CREATE_SUBDIRS = NO # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII @@ -76,7 +76,7 @@ CREATE_SUBDIRS = NO # U+3044. # The default value is: NO. -ALLOW_UNICODE_NAMES = NO +ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this @@ -91,14 +91,14 @@ ALLOW_UNICODE_NAMES = NO # Ukrainian and Vietnamese. # The default value is: English. -OUTPUT_LANGUAGE = English +OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. -BRIEF_MEMBER_DESC = YES +BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description @@ -107,7 +107,7 @@ BRIEF_MEMBER_DESC = YES # brief descriptions will be completely suppressed. # The default value is: YES. -REPEAT_BRIEF = YES +REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found @@ -118,14 +118,14 @@ REPEAT_BRIEF = YES # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. -ALWAYS_DETAILED_SEC = NO +ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those @@ -133,14 +133,14 @@ ALWAYS_DETAILED_SEC = NO # operators of the base classes will not be shown. # The default value is: NO. -INLINE_INHERITED_MEMB = NO +INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. -FULL_PATH_NAMES = YES +FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand @@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = ../.. +STRIP_FROM_PATH = ../.. # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -161,14 +161,14 @@ STRIP_FROM_PATH = ../.. # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. -SHORT_NAMES = NO +SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief @@ -177,7 +177,7 @@ SHORT_NAMES = NO # description.) # The default value is: NO. -JAVADOC_AUTOBRIEF = YES +JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If @@ -185,7 +185,7 @@ JAVADOC_AUTOBRIEF = YES # requiring an explicit \brief command for a brief description.) # The default value is: NO. -QT_AUTOBRIEF = YES +QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as @@ -203,20 +203,20 @@ MULTILINE_CPP_IS_BRIEF = NO # documentation from any documented member that it re-implements. # The default value is: YES. -INHERIT_DOCS = YES +INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. -SEPARATE_MEMBER_PAGES = NO +SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. -TAB_SIZE = 4 +TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: @@ -228,13 +228,13 @@ TAB_SIZE = 4 # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. -ALIASES = +ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. -TCL_SUBST = +TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For @@ -242,7 +242,7 @@ TCL_SUBST = # members will be omitted, etc. # The default value is: NO. -OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored @@ -250,19 +250,19 @@ OPTIMIZE_OUTPUT_FOR_C = NO # qualified scopes will look different, etc. # The default value is: NO. -OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. -OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. -OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given @@ -281,7 +281,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. -EXTENSION_MAPPING = +EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable @@ -291,7 +291,7 @@ EXTENSION_MAPPING = # case of backward compatibilities issues. # The default value is: YES. -MARKDOWN_SUPPORT = YES +MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can @@ -299,7 +299,7 @@ MARKDOWN_SUPPORT = YES # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. -AUTOLINK_SUPPORT = YES +AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this @@ -309,13 +309,13 @@ AUTOLINK_SUPPORT = YES # diagrams that involve STL classes more complete and accurate. # The default value is: NO. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. -CPP_CLI_SUPPORT = NO +CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen @@ -323,7 +323,7 @@ CPP_CLI_SUPPORT = NO # of private inheritance when no explicit protection keyword is present. # The default value is: NO. -SIP_SUPPORT = NO +SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make @@ -333,7 +333,7 @@ SIP_SUPPORT = NO # should set this option to NO. # The default value is: YES. -IDL_PROPERTY_SUPPORT = YES +IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first @@ -341,7 +341,7 @@ IDL_PROPERTY_SUPPORT = YES # all members of a group must be documented explicitly. # The default value is: NO. -DISTRIBUTE_GROUP_DOC = NO +DISTRIBUTE_GROUP_DOC = NO # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option @@ -357,7 +357,7 @@ GROUP_NESTED_COMPOUNDS = NO # \nosubgrouping command. # The default value is: YES. -SUBGROUPING = YES +SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) @@ -378,7 +378,7 @@ INLINE_GROUPED_CLASSES = NO # Man pages) or section (for LaTeX and RTF). # The default value is: NO. -INLINE_SIMPLE_STRUCTS = NO +INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So @@ -389,7 +389,7 @@ INLINE_SIMPLE_STRUCTS = NO # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. -TYPEDEF_HIDES_STRUCT = NO +TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be @@ -402,7 +402,7 @@ TYPEDEF_HIDES_STRUCT = NO # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. -LOOKUP_CACHE_SIZE = 0 +LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options @@ -416,25 +416,25 @@ LOOKUP_CACHE_SIZE = 0 # normally produced when WARNINGS is set to YES. # The default value is: NO. -EXTRACT_ALL = NO +EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. -EXTRACT_PACKAGE = NO +EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. -EXTRACT_STATIC = NO +EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, @@ -442,7 +442,7 @@ EXTRACT_STATIC = NO # for Java sources. # The default value is: YES. -EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are @@ -450,7 +450,7 @@ EXTRACT_LOCAL_CLASSES = YES # included. # The default value is: NO. -EXTRACT_LOCAL_METHODS = NO +EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called @@ -459,7 +459,7 @@ EXTRACT_LOCAL_METHODS = NO # are hidden. # The default value is: NO. -EXTRACT_ANON_NSPACES = NO +EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these @@ -467,7 +467,7 @@ EXTRACT_ANON_NSPACES = NO # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. -HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_MEMBERS = YES # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set @@ -475,28 +475,28 @@ HIDE_UNDOC_MEMBERS = NO # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. -HIDE_UNDOC_CLASSES = NO +HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. -HIDE_FRIEND_COMPOUNDS = NO +HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. -HIDE_IN_BODY_DOCS = NO +HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. -INTERNAL_DOCS = NO +INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also @@ -505,53 +505,53 @@ INTERNAL_DOCS = NO # and Mac users are advised to set this option to NO. # The default value is: system dependent. -CASE_SENSE_NAMES = YES +CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. -HIDE_SCOPE_NAMES = NO +HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. -HIDE_COMPOUND_REFERENCE= NO +HIDE_COMPOUND_REFERENCE = NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. -SHOW_INCLUDE_FILES = YES +SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. -SHOW_GROUPED_MEMB_INC = NO +SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. -FORCE_LOCAL_INCLUDES = NO +FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. -INLINE_INFO = YES +INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. -SORT_MEMBER_DOCS = YES +SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member @@ -559,7 +559,7 @@ SORT_MEMBER_DOCS = YES # this will also influence the order of the classes in the class list. # The default value is: NO. -SORT_BRIEF_DOCS = NO +SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and @@ -578,7 +578,7 @@ SORT_MEMBERS_CTORS_1ST = NO # appear in their defined order. # The default value is: NO. -SORT_GROUP_NAMES = NO +SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will @@ -588,7 +588,7 @@ SORT_GROUP_NAMES = NO # list. # The default value is: NO. -SORT_BY_SCOPE_NAME = NO +SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between @@ -598,38 +598,38 @@ SORT_BY_SCOPE_NAME = NO # accept a match between prototype and implementation in such cases. # The default value is: NO. -STRICT_PROTO_MATCHING = NO +STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. -GENERATE_TODOLIST = YES +GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. -GENERATE_TESTLIST = YES +GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. -GENERATE_BUGLIST = YES +GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. -GENERATE_DEPRECATEDLIST= YES +GENERATE_DEPRECATEDLIST = YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if <section_label> ... \endif and \cond <section_label> # ... \endcond blocks. -ENABLED_SECTIONS = +ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the @@ -640,28 +640,28 @@ ENABLED_SECTIONS = # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. -MAX_INITIALIZER_LINES = 30 +MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. -SHOW_USED_FILES = YES +SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. -SHOW_FILES = YES +SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. -SHOW_NAMESPACES = YES +SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from @@ -671,7 +671,7 @@ SHOW_NAMESPACES = YES # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated @@ -684,7 +684,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = +LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib @@ -694,7 +694,7 @@ LAYOUT_FILE = # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. -CITE_BIB_FILES = +CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages @@ -705,7 +705,7 @@ CITE_BIB_FILES = # messages are off. # The default value is: NO. -QUIET = NO +QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES @@ -714,14 +714,14 @@ QUIET = NO # Tip: Turn warnings on while writing the documentation. # The default value is: YES. -WARNINGS = YES +WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. -WARN_IF_UNDOCUMENTED = YES +WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters @@ -729,7 +729,7 @@ WARN_IF_UNDOCUMENTED = YES # markup commands wrongly. # The default value is: YES. -WARN_IF_DOC_ERROR = YES +WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return @@ -737,13 +737,13 @@ WARN_IF_DOC_ERROR = YES # parameter documentation, but not about the absence of documentation. # The default value is: NO. -WARN_NO_PARAMDOC = NO +WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. -WARN_AS_ERROR = NO +WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which @@ -753,13 +753,13 @@ WARN_AS_ERROR = NO # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. -WARN_FORMAT = "$file:$line: $text" +WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files @@ -771,7 +771,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ".." "../analog" "../documentation" +INPUT = ".." "../analog" "../documentation" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -780,7 +780,7 @@ INPUT = ".." "../analog" "../documentation" # possible encodings. # The default value is: UTF-8. -INPUT_ENCODING = UTF-8 +INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and @@ -796,13 +796,13 @@ INPUT_ENCODING = UTF-8 # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, # *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. -FILE_PATTERNS = *.h *.cpp +FILE_PATTERNS = *.h *.cpp # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. -RECURSIVE = NO +RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a @@ -811,14 +811,14 @@ RECURSIVE = NO # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. -EXCLUDE_SYMLINKS = NO +EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude @@ -827,7 +827,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -838,33 +838,33 @@ EXCLUDE_PATTERNS = # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = +EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. -EXAMPLE_RECURSIVE = NO +EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = "../documentation" +IMAGE_PATH = "../documentation" # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -885,7 +885,7 @@ IMAGE_PATH = "../documentation" # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. -INPUT_FILTER = +INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the @@ -898,14 +898,14 @@ INPUT_FILTER = # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. -FILTER_PATTERNS = +FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. -FILTER_SOURCE_FILES = NO +FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and @@ -913,14 +913,14 @@ FILTER_SOURCE_FILES = NO # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. -FILTER_SOURCE_PATTERNS = +FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -933,20 +933,20 @@ USE_MDFILE_AS_MAINPAGE = # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = NO +SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. -INLINE_SOURCES = NO +INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. -STRIP_CODE_COMMENTS = YES +STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. @@ -958,7 +958,7 @@ REFERENCED_BY_RELATION = NO # all documented entities called/used by that function will be listed. # The default value is: NO. -REFERENCES_RELATION = NO +REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and @@ -976,7 +976,7 @@ REFERENCES_LINK_SOURCE = YES # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. -SOURCE_TOOLTIPS = YES +SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in @@ -998,7 +998,7 @@ SOURCE_TOOLTIPS = YES # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. -USE_HTAGS = NO +USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is @@ -1006,7 +1006,7 @@ USE_HTAGS = NO # See also: Section \class. # The default value is: YES. -VERBATIM_HEADERS = YES +VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the @@ -1025,7 +1025,7 @@ CLANG_ASSISTED_PARSING = NO # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. -CLANG_OPTIONS = +CLANG_OPTIONS = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index @@ -1036,14 +1036,14 @@ CLANG_OPTIONS = # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = YES +ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. -COLS_IN_ALPHA_INDEX = 5 +COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag @@ -1051,7 +1051,7 @@ COLS_IN_ALPHA_INDEX = 5 # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output @@ -1060,7 +1060,7 @@ IGNORE_PREFIX = # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. -GENERATE_HTML = YES +GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1068,14 +1068,14 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = html +HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FILE_EXTENSION = .html +HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a @@ -1095,7 +1095,7 @@ HTML_FILE_EXTENSION = .html # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_HEADER = +HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1105,7 +1105,7 @@ HTML_HEADER = # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = +HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of @@ -1117,7 +1117,7 @@ HTML_FOOTER = # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_STYLESHEET = +HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets @@ -1130,7 +1130,7 @@ HTML_STYLESHEET = # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = "../documentation/doc.css" +HTML_EXTRA_STYLESHEET = "../documentation/doc.css" # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note @@ -1140,7 +1140,7 @@ HTML_EXTRA_STYLESHEET = "../documentation/doc.css" # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_FILES = +HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to @@ -1151,7 +1151,7 @@ HTML_EXTRA_FILES = # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A @@ -1159,7 +1159,7 @@ HTML_COLORSTYLE_HUE = 220 # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 @@ -1170,7 +1170,7 @@ HTML_COLORSTYLE_SAT = 100 # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_GAMMA = 80 +HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this @@ -1179,7 +1179,7 @@ HTML_COLORSTYLE_GAMMA = 80 # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = NO +HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the @@ -1187,7 +1187,7 @@ HTML_TIMESTAMP = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_DYNAMIC_SECTIONS = NO +HTML_DYNAMIC_SECTIONS = YES # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand @@ -1214,7 +1214,7 @@ HTML_INDEX_NUM_ENTRIES = 100 # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_DOCSET = NO +GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider @@ -1222,7 +1222,7 @@ GENERATE_DOCSET = NO # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. -DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. @@ -1230,7 +1230,7 @@ DOCSET_FEEDNAME = "Doxygen generated docs" # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. -DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style @@ -1238,13 +1238,13 @@ DOCSET_BUNDLE_ID = org.doxygen.Project # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. -DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. -DOCSET_PUBLISHER_NAME = Publisher +DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The @@ -1262,14 +1262,14 @@ DOCSET_PUBLISHER_NAME = Publisher # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_HTMLHELP = NO +GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -CHM_FILE = +CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, @@ -1277,20 +1277,20 @@ CHM_FILE = # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -HHC_LOCATION = +HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -GENERATE_CHI = NO +GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -CHM_INDEX_ENCODING = +CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it @@ -1298,14 +1298,14 @@ CHM_INDEX_ENCODING = # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -BINARY_TOC = NO +BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -TOC_EXPAND = NO +TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that @@ -1314,14 +1314,14 @@ TOC_EXPAND = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_QHP = NO +GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. -QCH_FILE = +QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace @@ -1329,7 +1329,7 @@ QCH_FILE = # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_NAMESPACE = org.doxygen.Project +QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual @@ -1338,7 +1338,7 @@ QHP_NAMESPACE = org.doxygen.Project # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_VIRTUAL_FOLDER = doc +QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom @@ -1346,7 +1346,7 @@ QHP_VIRTUAL_FOLDER = doc # filters). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom @@ -1354,21 +1354,21 @@ QHP_CUST_FILTER_NAME = # filters). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_CUST_FILTER_ATTRS = +QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_SECT_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. -QHG_LOCATION = +QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To @@ -1380,7 +1380,7 @@ QHG_LOCATION = # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_ECLIPSEHELP = NO +GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this @@ -1388,7 +1388,7 @@ GENERATE_ECLIPSEHELP = NO # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. -ECLIPSE_DOC_ID = org.doxygen.Project +ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The @@ -1399,7 +1399,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -DISABLE_INDEX = NO +DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag @@ -1416,7 +1416,7 @@ DISABLE_INDEX = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. @@ -1426,21 +1426,21 @@ GENERATE_TREEVIEW = NO # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. -ENUM_VALUES_PER_LINE = 4 +ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. -TREEVIEW_WIDTH = 250 +TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -EXT_LINKS_IN_WINDOW = NO +EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful @@ -1449,7 +1449,7 @@ EXT_LINKS_IN_WINDOW = NO # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. -FORMULA_FONTSIZE = 10 +FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not @@ -1460,7 +1460,7 @@ FORMULA_FONTSIZE = 10 # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -FORMULA_TRANSPARENT = YES +FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering @@ -1471,7 +1471,7 @@ FORMULA_TRANSPARENT = YES # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -USE_MATHJAX = YES +USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: @@ -1481,7 +1481,7 @@ USE_MATHJAX = YES # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_FORMAT = HTML-CSS +MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory @@ -1494,14 +1494,14 @@ MATHJAX_FORMAT = HTML-CSS # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_EXTENSIONS = +MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site @@ -1509,7 +1509,7 @@ MATHJAX_EXTENSIONS = # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_CODEFILE = +MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and @@ -1530,7 +1530,7 @@ MATHJAX_CODEFILE = # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -SEARCHENGINE = YES +SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There @@ -1542,7 +1542,7 @@ SEARCHENGINE = YES # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. -SERVER_BASED_SEARCH = NO +SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file @@ -1558,7 +1558,7 @@ SERVER_BASED_SEARCH = NO # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. -EXTERNAL_SEARCH = NO +EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. @@ -1569,7 +1569,7 @@ EXTERNAL_SEARCH = NO # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. -SEARCHENGINE_URL = +SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the @@ -1577,7 +1577,7 @@ SEARCHENGINE_URL = # The default file is: searchdata.xml. # This tag requires that the tag SEARCHENGINE is set to YES. -SEARCHDATA_FILE = searchdata.xml +SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is @@ -1585,7 +1585,7 @@ SEARCHDATA_FILE = searchdata.xml # projects and redirect the results back to the right project. # This tag requires that the tag SEARCHENGINE is set to YES. -EXTERNAL_SEARCH_ID = +EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are @@ -1595,7 +1595,7 @@ EXTERNAL_SEARCH_ID = # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... # This tag requires that the tag SEARCHENGINE is set to YES. -EXTRA_SEARCH_MAPPINGS = +EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output @@ -1604,7 +1604,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = YES +GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1612,7 +1612,7 @@ GENERATE_LATEX = YES # The default directory is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_OUTPUT = latex +LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. @@ -1623,14 +1623,14 @@ LATEX_OUTPUT = latex # The default file is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_CMD_NAME = latex +LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. -MAKEINDEX_CMD_NAME = makeindex +MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some @@ -1638,7 +1638,7 @@ MAKEINDEX_CMD_NAME = makeindex # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. -COMPACT_LATEX = NO +COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used by the # printer. @@ -1647,7 +1647,7 @@ COMPACT_LATEX = NO # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. -PAPER_TYPE = a4 +PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. The package can be specified just @@ -1659,7 +1659,7 @@ PAPER_TYPE = a4 # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. -EXTRA_PACKAGES = +EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the # generated LaTeX document. The header should contain everything until the first @@ -1675,7 +1675,7 @@ EXTRA_PACKAGES = # to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_HEADER = +LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last @@ -1686,7 +1686,7 @@ LATEX_HEADER = # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_FOOTER = +LATEX_FOOTER = # The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined # LaTeX style sheets that are included after the standard style sheets created @@ -1697,7 +1697,7 @@ LATEX_FOOTER = # list). # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_STYLESHEET = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output @@ -1705,7 +1705,7 @@ LATEX_EXTRA_STYLESHEET = # markers available. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_EXTRA_FILES = +LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will @@ -1714,7 +1714,7 @@ LATEX_EXTRA_FILES = # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. -PDF_HYPERLINKS = YES +PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate # the PDF file directly from the LaTeX files. Set this option to YES, to get a @@ -1722,7 +1722,7 @@ PDF_HYPERLINKS = YES # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. -USE_PDFLATEX = YES +USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running @@ -1731,14 +1731,14 @@ USE_PDFLATEX = YES # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_BATCHMODE = NO +LATEX_BATCHMODE = NO # If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the # index chapters (such as File Index, Compound Index, etc.) in the output. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_HIDE_INDICES = NO +LATEX_HIDE_INDICES = NO # If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source # code with syntax highlighting in the LaTeX output. @@ -1748,7 +1748,7 @@ LATEX_HIDE_INDICES = NO # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_SOURCE_CODE = NO +LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See @@ -1756,7 +1756,7 @@ LATEX_SOURCE_CODE = NO # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_BIB_STYLE = plain +LATEX_BIB_STYLE = plain # If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated # page will contain the date and time when the page was generated. Setting this @@ -1764,7 +1764,7 @@ LATEX_BIB_STYLE = plain # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_TIMESTAMP = NO +LATEX_TIMESTAMP = NO #--------------------------------------------------------------------------- # Configuration options related to the RTF output @@ -1775,7 +1775,7 @@ LATEX_TIMESTAMP = NO # readers/editors. # The default value is: NO. -GENERATE_RTF = NO +GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1783,7 +1783,7 @@ GENERATE_RTF = NO # The default directory is: rtf. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_OUTPUT = rtf +RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF # documents. This may be useful for small projects and may help to save some @@ -1791,7 +1791,7 @@ RTF_OUTPUT = rtf # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. -COMPACT_RTF = NO +COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will # contain hyperlink fields. The RTF file will contain links (just like the HTML @@ -1803,7 +1803,7 @@ COMPACT_RTF = NO # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_HYPERLINKS = NO +RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's config # file, i.e. a series of assignments. You only have to provide replacements, @@ -1813,14 +1813,14 @@ RTF_HYPERLINKS = NO # default style sheet that doxygen normally uses. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_STYLESHEET_FILE = +RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is # similar to doxygen's config file. A template extensions file can be generated # using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_EXTENSIONS_FILE = +RTF_EXTENSIONS_FILE = # If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code # with syntax highlighting in the RTF output. @@ -1830,7 +1830,7 @@ RTF_EXTENSIONS_FILE = # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_SOURCE_CODE = NO +RTF_SOURCE_CODE = NO #--------------------------------------------------------------------------- # Configuration options related to the man page output @@ -1840,7 +1840,7 @@ RTF_SOURCE_CODE = NO # classes and files. # The default value is: NO. -GENERATE_MAN = NO +GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1849,7 +1849,7 @@ GENERATE_MAN = NO # The default directory is: man. # This tag requires that the tag GENERATE_MAN is set to YES. -MAN_OUTPUT = man +MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to the generated # man pages. In case the manual section does not start with a number, the number @@ -1858,14 +1858,14 @@ MAN_OUTPUT = man # The default value is: .3. # This tag requires that the tag GENERATE_MAN is set to YES. -MAN_EXTENSION = .3 +MAN_EXTENSION = .3 # The MAN_SUBDIR tag determines the name of the directory created within # MAN_OUTPUT in which the man pages are placed. If defaults to man followed by # MAN_EXTENSION with the initial . removed. # This tag requires that the tag GENERATE_MAN is set to YES. -MAN_SUBDIR = +MAN_SUBDIR = # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real @@ -1874,7 +1874,7 @@ MAN_SUBDIR = # The default value is: NO. # This tag requires that the tag GENERATE_MAN is set to YES. -MAN_LINKS = NO +MAN_LINKS = NO #--------------------------------------------------------------------------- # Configuration options related to the XML output @@ -1884,7 +1884,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = NO +GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1892,7 +1892,7 @@ GENERATE_XML = NO # The default directory is: xml. # This tag requires that the tag GENERATE_XML is set to YES. -XML_OUTPUT = xml +XML_OUTPUT = xml # If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to @@ -1901,7 +1901,7 @@ XML_OUTPUT = xml # The default value is: YES. # This tag requires that the tag GENERATE_XML is set to YES. -XML_PROGRAMLISTING = YES +XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output @@ -1911,7 +1911,7 @@ XML_PROGRAMLISTING = YES # that can be used to generate PDF. # The default value is: NO. -GENERATE_DOCBOOK = NO +GENERATE_DOCBOOK = NO # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in @@ -1919,7 +1919,7 @@ GENERATE_DOCBOOK = NO # The default directory is: docbook. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. -DOCBOOK_OUTPUT = docbook +DOCBOOK_OUTPUT = docbook # If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the # program listings (including syntax highlighting and cross-referencing @@ -1940,7 +1940,7 @@ DOCBOOK_PROGRAMLISTING = NO # still experimental and incomplete at the moment. # The default value is: NO. -GENERATE_AUTOGEN_DEF = NO +GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to the Perl module output @@ -1952,7 +1952,7 @@ GENERATE_AUTOGEN_DEF = NO # Note that this feature is still experimental and incomplete at the moment. # The default value is: NO. -GENERATE_PERLMOD = NO +GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI @@ -1960,7 +1960,7 @@ GENERATE_PERLMOD = NO # The default value is: NO. # This tag requires that the tag GENERATE_PERLMOD is set to YES. -PERLMOD_LATEX = NO +PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely # formatted so it can be parsed by a human reader. This is useful if you want to @@ -1970,7 +1970,7 @@ PERLMOD_LATEX = NO # The default value is: YES. # This tag requires that the tag GENERATE_PERLMOD is set to YES. -PERLMOD_PRETTY = YES +PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file are # prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful @@ -1978,7 +1978,7 @@ PERLMOD_PRETTY = YES # overwrite each other's variables. # This tag requires that the tag GENERATE_PERLMOD is set to YES. -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor @@ -1988,7 +1988,7 @@ PERLMOD_MAKEVAR_PREFIX = # C-preprocessor directives found in the sources and include files. # The default value is: YES. -ENABLE_PREPROCESSING = YES +ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be @@ -1997,7 +1997,7 @@ ENABLE_PREPROCESSING = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and @@ -2005,21 +2005,21 @@ MACRO_EXPANSION = NO # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -SEARCH_INCLUDES = YES +SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. -INCLUDE_PATH = +INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the @@ -2027,7 +2027,7 @@ INCLUDE_PATH = # used. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -INCLUDE_FILE_PATTERNS = +INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that are # defined before the preprocessor is started (similar to the -D option of e.g. @@ -2037,7 +2037,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2046,7 +2046,7 @@ PREDEFINED = # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have @@ -2056,7 +2056,7 @@ EXPAND_AS_DEFINED = # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -SKIP_FUNCTION_MACROS = YES +SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration options related to external references @@ -2075,40 +2075,40 @@ SKIP_FUNCTION_MACROS = YES # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. -TAGFILES = +TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. -GENERATE_TAGFILE = +GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES, all external class will be listed in # the class index. If set to NO, only the inherited external classes will be # listed. # The default value is: NO. -ALLEXTERNALS = NO +ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed # in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. -EXTERNAL_GROUPS = YES +EXTERNAL_GROUPS = YES # If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. -EXTERNAL_PAGES = YES +EXTERNAL_PAGES = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of 'which perl'). # The default file (with absolute path) is: /usr/bin/perl. -PERL_PATH = /usr/bin/perl +PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool @@ -2121,7 +2121,7 @@ PERL_PATH = /usr/bin/perl # powerful graphs. # The default value is: YES. -CLASS_DIAGRAMS = YES +CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: @@ -2130,20 +2130,20 @@ CLASS_DIAGRAMS = YES # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. -MSCGEN_PATH = +MSCGEN_PATH = # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. -DIA_PATH = +DIA_PATH = # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. -HIDE_UNDOC_RELATIONS = YES +HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: @@ -2152,7 +2152,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: YES. -HAVE_DOT = YES +HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2162,7 +2162,7 @@ HAVE_DOT = YES # Minimum value: 0, maximum value: 32, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_NUM_THREADS = 0 +DOT_NUM_THREADS = 0 # When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make @@ -2172,21 +2172,21 @@ DOT_NUM_THREADS = 0 # The default value is: Helvetica. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = Helvetica +DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of # dot graphs. # Minimum value: 4, maximum value: 24, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the default font as specified with # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set # the path where dot can find it using this tag. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTPATH = +DOT_FONTPATH = # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for # each documented class showing the direct and indirect inheritance relations. @@ -2194,7 +2194,7 @@ DOT_FONTPATH = # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -CLASS_GRAPH = YES +CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation @@ -2203,14 +2203,14 @@ CLASS_GRAPH = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -COLLABORATION_GRAPH = YES +COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for # groups, showing the direct groups dependencies. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -GROUP_GRAPHS = YES +GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling @@ -2218,7 +2218,7 @@ GROUP_GRAPHS = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -UML_LOOK = NO +UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside the # class node. If there are many fields or methods and many nodes the graph may @@ -2231,7 +2231,7 @@ UML_LOOK = NO # Minimum value: 0, maximum value: 100, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. -UML_LIMIT_NUM_FIELDS = 10 +UML_LIMIT_NUM_FIELDS = 10 # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their @@ -2239,7 +2239,7 @@ UML_LIMIT_NUM_FIELDS = 10 # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -TEMPLATE_RELATIONS = NO +TEMPLATE_RELATIONS = NO # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the @@ -2248,7 +2248,7 @@ TEMPLATE_RELATIONS = NO # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -INCLUDE_GRAPH = YES +INCLUDE_GRAPH = YES # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing @@ -2257,7 +2257,7 @@ INCLUDE_GRAPH = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -INCLUDED_BY_GRAPH = YES +INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH tag is set to YES then doxygen will generate a call # dependency graph for every global function or class method. @@ -2269,7 +2269,7 @@ INCLUDED_BY_GRAPH = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALL_GRAPH = NO +CALL_GRAPH = NO # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. @@ -2281,14 +2281,14 @@ CALL_GRAPH = NO # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALLER_GRAPH = NO +CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -GRAPHICAL_HIERARCHY = YES +GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The @@ -2297,7 +2297,7 @@ GRAPHICAL_HIERARCHY = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -DIRECTORY_GRAPH = YES +DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section @@ -2314,7 +2314,7 @@ DIRECTORY_GRAPH = YES # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_IMAGE_FORMAT = png +DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. @@ -2326,32 +2326,32 @@ DOT_IMAGE_FORMAT = png # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = NO +INTERACTIVE_SVG = NO # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = +DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile # command). # This tag requires that the tag HAVE_DOT is set to YES. -DOTFILE_DIRS = +DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the \mscfile # command). -MSCFILE_DIRS = +MSCFILE_DIRS = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile # command). -DIAFILE_DIRS = +DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the # path where java can find the plantuml.jar file. If left blank, it is assumed @@ -2359,12 +2359,12 @@ DIAFILE_DIRS = # generate a warning when it encounters a \startuml command in this case and # will not generate output for the diagram. -PLANTUML_JAR_PATH = +PLANTUML_JAR_PATH = # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. -PLANTUML_INCLUDE_PATH = +PLANTUML_INCLUDE_PATH = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes @@ -2376,7 +2376,7 @@ PLANTUML_INCLUDE_PATH = # Minimum value: 0, maximum value: 10000, default value: 50. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_GRAPH_MAX_NODES = 50 +DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs # generated by dot. A depth value of 3 means that only nodes reachable from the @@ -2388,7 +2388,7 @@ DOT_GRAPH_MAX_NODES = 50 # Minimum value: 0, maximum value: 1000, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. -MAX_DOT_GRAPH_DEPTH = 0 +MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not seem @@ -2400,7 +2400,7 @@ MAX_DOT_GRAPH_DEPTH = 0 # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_TRANSPARENT = NO +DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This @@ -2409,7 +2409,7 @@ DOT_TRANSPARENT = NO # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_MULTI_TARGETS = NO +DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated @@ -2417,11 +2417,11 @@ DOT_MULTI_TARGETS = NO # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -GENERATE_LEGEND = YES +GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot # files that are used to generate the various graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_CLEANUP = YES +DOT_CLEANUP = YES diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index 7ee5a204629..fa983cb1d6c 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -50,6 +50,7 @@ POBJS := \ $(POBJ)/pchrono.o \ $(POBJ)/pdynlib.o \ $(POBJ)/pexception.o \ + $(POBJ)/pfunction.o \ $(POBJ)/pfmtlog.o \ $(POBJ)/poptions.o \ $(POBJ)/pparser.o \ @@ -63,9 +64,9 @@ NLOBJS := \ $(NLOBJ)/nl_setup.o \ $(NLOBJ)/nl_factory.o \ $(NLOBJ)/analog/nld_bjt.o \ - $(NLOBJ)/analog/nld_fourterm.o \ + $(NLOBJ)/analog/nlid_fourterm.o \ $(NLOBJ)/analog/nld_switches.o \ - $(NLOBJ)/analog/nld_twoterm.o \ + $(NLOBJ)/analog/nlid_twoterm.o \ $(NLOBJ)/analog/nld_opamps.o \ $(NLOBJ)/devices/nld_2102A.o \ $(NLOBJ)/devices/nld_2716.o \ @@ -114,7 +115,7 @@ NLOBJS := \ $(NLOBJ)/devices/nld_log.o \ $(NLOBJ)/devices/nlid_proxy.o \ $(NLOBJ)/devices/nld_system.o \ - $(NLOBJ)/devices/nld_truthtable.o \ + $(NLOBJ)/devices/nlid_truthtable.o \ $(NLOBJ)/macro/nlm_base.o \ $(NLOBJ)/macro/nlm_cd4xxx.o \ $(NLOBJ)/macro/nlm_opamp.o \ @@ -169,7 +170,7 @@ maketree: $(sort $(OBJDIRS)) .PHONY: clang mingw doc clang: - $(MAKE) CC=clang++ LD=clang++ CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors" + $(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors" # # Mostly done: -Wno-weak-vtables -Wno-cast-align diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp index 502f044ec76..bc1d7051b39 100644 --- a/src/lib/netlist/devices/net_lib.cpp +++ b/src/lib/netlist/devices/net_lib.cpp @@ -9,60 +9,62 @@ ****************************************************************************/ #include "net_lib.h" -#include "nld_system.h" #include "nl_factory.h" #include "solver/nld_solver.h" + #define xstr(s) # s + +#if 0 #define ENTRY1(nic, name, defparam) factory.register_device<nic>( # name, xstr(nic), defparam ); #define ENTRY(nic, name, defparam) ENTRY1(NETLIB_NAME(nic), name, defparam) +#endif #define NETLIB_DEVICE_DECL(chip) extern factory::constructor_ptr_t decl_ ## chip; -#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (# name, xstr(nic), defparam) ); +//#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (# name, xstr(nic), defparam) ); +#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (pstring(# name), pstring(xstr(nic)), pstring(defparam)) ); #define ENTRYX(nic, name, defparam) { NETLIB_DEVICE_DECL(nic) ENTRYX1(NETLIB_NAME(nic), name, defparam, decl_ ## nic) } namespace netlist { - using namespace netlist::analog; - namespace devices { -static void initialize_factory(factory::list_t &factory) + void initialize_factory(factory::list_t &factory) { - ENTRY(R, RES, "R") - ENTRY(POT, POT, "R") - ENTRY(POT2, POT2, "R") - ENTRY(C, CAP, "C") - ENTRY(L, IND, "L") - ENTRY(D, DIODE, "MODEL") - ENTRY(VCVS, VCVS, "") - ENTRY(VCCS, VCCS, "") - ENTRY(CCCS, CCCS, "") - ENTRY(LVCCS, LVCCS, "") - ENTRY(VS, VS, "V") - ENTRY(CS, CS, "I") - ENTRYX(opamp, OPAMP, "MODEL") + ENTRYX(R, RES, "R") + ENTRYX(POT, POT, "R") + ENTRYX(POT2, POT2, "R") + ENTRYX(C, CAP, "C") + ENTRYX(L, IND, "L") + ENTRYX(D, DIODE, "MODEL") + ENTRYX(VS, VS, "V") + ENTRYX(CS, CS, "I") + ENTRYX(VCVS, VCVS, "") + ENTRYX(VCCS, VCCS, "") + ENTRYX(CCCS, CCCS, "") + ENTRYX(LVCCS, LVCCS, "") + ENTRYX(opamp, OPAMP, "MODEL") ENTRYX(dummy_input, DUMMY_INPUT, "") ENTRYX(frontier, FRONTIER_DEV, "+I,+G,+Q") // not intended to be used directly ENTRYX(function, AFUNC, "N,FUNC") // only for macro devices - NO FEEDBACK loops - ENTRY(QBJT_EB, QBJT_EB, "MODEL") - ENTRY(QBJT_switch, QBJT_SW, "MODEL") + ENTRYX(QBJT_EB, QBJT_EB, "MODEL") + ENTRYX(QBJT_switch, QBJT_SW, "MODEL") ENTRYX(logic_input, TTL_INPUT, "IN") ENTRYX(logic_input, LOGIC_INPUT, "IN,FAMILY") ENTRYX(analog_input, ANALOG_INPUT, "IN") ENTRYX(log, LOG, "+I") ENTRYX(logD, LOGD, "+I,+I2") ENTRYX(clock, CLOCK, "FREQ") - ENTRYX(extclock, EXTCLOCK, "FREQ") + ENTRYX(extclock, EXTCLOCK, "FREQ,PATTERN") ENTRYX(mainclock, MAINCLOCK, "FREQ") ENTRYX(gnd, GND, "") ENTRYX(netlistparams, PARAMETER, "") - ENTRY(solver, SOLVER, "FREQ") + ENTRYX(solver, SOLVER, "FREQ") ENTRYX(res_sw, RES_SWITCH, "+IN,+P1,+P2") ENTRYX(switch1, SWITCH, "") ENTRYX(switch2, SWITCH2, "") - ENTRYX(nicRSFF, NETDEV_RSFF, "+S,+R") + ENTRYX(nicRSFF, NETDEV_RSFF, "") ENTRYX(nicDelay, NETDEV_DELAY, "") ENTRYX(2716, EPROM_2716, "+GQ,+EPQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10") ENTRYX(2102A, RAM_2102A, "+CEQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+RWQ,+DI") @@ -158,10 +160,3 @@ static void initialize_factory(factory::list_t &factory) } //namespace devices } // namespace netlist -namespace netlist -{ - void initialize_factory(factory::list_t &factory) - { - devices::initialize_factory(factory); - } -} diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h index 9bbd9db744a..9ac05f9bccb 100644 --- a/src/lib/netlist/devices/net_lib.h +++ b/src/lib/netlist/devices/net_lib.h @@ -11,7 +11,28 @@ #ifndef NET_LIB_H #define NET_LIB_H -#include "nl_base.h" +#include "nl_setup.h" + +//#define NL_AUTO_DEVICES 1 + +#ifdef NL_AUTO_DEVICES +#include "nld_devinc.h" + +#include "solver/nld_solver.h" + +#include "macro/nlm_cd4xxx.h" +#include "macro/nlm_ttl74xx.h" +#include "macro/nlm_opamp.h" +#include "macro/nlm_other.h" + +#include "nld_7448.h" + +#else + +#define SOLVER(name, freq) \ + NET_REGISTER_DEV(SOLVER, name) \ + PARAM(name.FREQ, freq) + #include "nld_system.h" #include "nld_2102A.h" @@ -72,12 +93,8 @@ #include "analog/nld_switches.h" #include "analog/nld_twoterm.h" #include "analog/nld_opamps.h" -#include "solver/nld_solver.h" #include "nld_legacy.h" - -namespace netlist { - void initialize_factory(factory::list_t &factory); -} +#endif #endif diff --git a/src/lib/netlist/devices/nld_2102A.cpp b/src/lib/netlist/devices/nld_2102A.cpp index 8dbd5be8fec..803f5b523c9 100644 --- a/src/lib/netlist/devices/nld_2102A.cpp +++ b/src/lib/netlist/devices/nld_2102A.cpp @@ -6,6 +6,7 @@ */ #include "nld_2102A.h" +#include "nl_base.h" #define ADDR2BYTE(a) ((a) >> 3) #define ADDR2BIT(a) ((a) & 0x7) diff --git a/src/lib/netlist/devices/nld_2716.cpp b/src/lib/netlist/devices/nld_2716.cpp index 7ba974b92da..aa491c47d3c 100644 --- a/src/lib/netlist/devices/nld_2716.cpp +++ b/src/lib/netlist/devices/nld_2716.cpp @@ -6,6 +6,7 @@ */ #include "nld_2716.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_4020.cpp b/src/lib/netlist/devices/nld_4020.cpp index a147cf3f58f..14459fb3b62 100644 --- a/src/lib/netlist/devices/nld_4020.cpp +++ b/src/lib/netlist/devices/nld_4020.cpp @@ -5,7 +5,7 @@ * */ -#include <devices/nlid_cmos.h> +#include "devices/nlid_cmos.h" #include "nld_4020.h" namespace netlist diff --git a/src/lib/netlist/devices/nld_4066.cpp b/src/lib/netlist/devices/nld_4066.cpp index f33688b73b7..11dca7b11dd 100644 --- a/src/lib/netlist/devices/nld_4066.cpp +++ b/src/lib/netlist/devices/nld_4066.cpp @@ -5,8 +5,8 @@ * */ -#include <devices/nlid_cmos.h> -#include "analog/nld_twoterm.h" +#include "devices/nlid_cmos.h" +#include "analog/nlid_twoterm.h" #include "nld_4066.h" namespace netlist diff --git a/src/lib/netlist/devices/nld_4316.cpp b/src/lib/netlist/devices/nld_4316.cpp index 8b9cb0d46ad..5c86f885545 100644 --- a/src/lib/netlist/devices/nld_4316.cpp +++ b/src/lib/netlist/devices/nld_4316.cpp @@ -5,8 +5,8 @@ * */ -#include <devices/nlid_cmos.h> -#include "analog/nld_twoterm.h" +#include "devices/nlid_cmos.h" +#include "analog/nlid_twoterm.h" #include "nld_4316.h" namespace netlist { namespace devices { diff --git a/src/lib/netlist/devices/nld_74107.cpp b/src/lib/netlist/devices/nld_74107.cpp index a9006d55a75..3a3c43ac0fa 100644 --- a/src/lib/netlist/devices/nld_74107.cpp +++ b/src/lib/netlist/devices/nld_74107.cpp @@ -6,6 +6,7 @@ */ #include "nld_74107.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74123.cpp b/src/lib/netlist/devices/nld_74123.cpp index bcbfdcb106a..514ea4e9390 100644 --- a/src/lib/netlist/devices/nld_74123.cpp +++ b/src/lib/netlist/devices/nld_74123.cpp @@ -5,10 +5,10 @@ * */ -#include "nld_74123.h" - #include "nlid_system.h" -#include "analog/nld_twoterm.h" +#include "analog/nlid_twoterm.h" + +#include <cmath> namespace netlist { diff --git a/src/lib/netlist/devices/nld_74153.cpp b/src/lib/netlist/devices/nld_74153.cpp index fb97411e350..efa6322e514 100644 --- a/src/lib/netlist/devices/nld_74153.cpp +++ b/src/lib/netlist/devices/nld_74153.cpp @@ -6,6 +6,7 @@ */ #include "nld_74153.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74161.cpp b/src/lib/netlist/devices/nld_74161.cpp index d6e31f36417..4579fa41b7a 100644 --- a/src/lib/netlist/devices/nld_74161.cpp +++ b/src/lib/netlist/devices/nld_74161.cpp @@ -8,6 +8,7 @@ #define MAXCNT 15 #include "nld_74161.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74165.cpp b/src/lib/netlist/devices/nld_74165.cpp index bb263409bf9..c967f95d44c 100644 --- a/src/lib/netlist/devices/nld_74165.cpp +++ b/src/lib/netlist/devices/nld_74165.cpp @@ -6,6 +6,7 @@ */ #include "nld_74165.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74166.cpp b/src/lib/netlist/devices/nld_74166.cpp index 5cb7114ee0f..d56159183b0 100644 --- a/src/lib/netlist/devices/nld_74166.cpp +++ b/src/lib/netlist/devices/nld_74166.cpp @@ -6,6 +6,7 @@ */ #include "nld_74166.h" +#include "nl_base.h" namespace netlist { @@ -82,7 +83,7 @@ namespace netlist netlist_time delay = NLTIME_FROM_NS(26); if (m_CLRQ()) { - bool clear_unset = !m_last_CLRQ(); + bool clear_unset = !m_last_CLRQ; if (clear_unset) { delay = NLTIME_FROM_NS(35); diff --git a/src/lib/netlist/devices/nld_74174.cpp b/src/lib/netlist/devices/nld_74174.cpp index 64698423435..d131b18af23 100644 --- a/src/lib/netlist/devices/nld_74174.cpp +++ b/src/lib/netlist/devices/nld_74174.cpp @@ -6,6 +6,7 @@ */ #include "nld_74174.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74175.cpp b/src/lib/netlist/devices/nld_74175.cpp index 4d8e3608ee8..3055a73f2c9 100644 --- a/src/lib/netlist/devices/nld_74175.cpp +++ b/src/lib/netlist/devices/nld_74175.cpp @@ -6,6 +6,7 @@ */ #include "nld_74175.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74192.cpp b/src/lib/netlist/devices/nld_74192.cpp index 80e1853b7f7..77029cfdf50 100644 --- a/src/lib/netlist/devices/nld_74192.cpp +++ b/src/lib/netlist/devices/nld_74192.cpp @@ -8,6 +8,7 @@ #define MAXCNT 9 #include "nld_74192.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74193.cpp b/src/lib/netlist/devices/nld_74193.cpp index 3d32596dbee..f5370719778 100644 --- a/src/lib/netlist/devices/nld_74193.cpp +++ b/src/lib/netlist/devices/nld_74193.cpp @@ -8,6 +8,7 @@ #define MAXCNT 15 #include "nld_74193.h" +#include "nl_base.h" namespace netlist { @@ -136,8 +137,8 @@ namespace netlist for (std::size_t i=0; i<4; i++) m_Q[i].push((m_cnt >> i) & 1, delay[i]); - m_BORROWQ.push(tBorrow, NLTIME_FROM_NS(20)); //FIXME - m_CARRYQ.push(tCarry, NLTIME_FROM_NS(20)); //FIXME + m_BORROWQ.push(tBorrow, NLTIME_FROM_NS(20)); //FIXME timing + m_CARRYQ.push(tCarry, NLTIME_FROM_NS(20)); //FIXME timing } NETLIB_DEVICE_IMPL(74193) diff --git a/src/lib/netlist/devices/nld_74194.cpp b/src/lib/netlist/devices/nld_74194.cpp index e951e351e93..4fe5092f4d5 100644 --- a/src/lib/netlist/devices/nld_74194.cpp +++ b/src/lib/netlist/devices/nld_74194.cpp @@ -6,6 +6,7 @@ */ #include "nld_74194.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_74194.h b/src/lib/netlist/devices/nld_74194.h index 944d9537754..8d07b685e55 100644 --- a/src/lib/netlist/devices/nld_74194.h +++ b/src/lib/netlist/devices/nld_74194.h @@ -28,17 +28,17 @@ #include "nl_setup.h" -#define TTL_74194(name, cCLK, cS0, cS1, cSRIN, cA, cB, cC, cD, cSLIN, cCLRQ) \ - NET_REGISTER_DEV(TTL_74194, name) \ - NET_CONNECT(name, CLK, cCLK) \ - NET_CONNECT(name, S0, cS0) \ - NET_CONNECT(name, S1, cS1) \ - NET_CONNECT(name, SRIN, cSRIN) \ - NET_CONNECT(name, A, cA) \ - NET_CONNECT(name, B, cB) \ - NET_CONNECT(name, C, cC) \ - NET_CONNECT(name, D, cD) \ - NET_CONNECT(name, SLIN, cSLIN) \ +#define TTL_74194(name, cCLK, cS0, cS1, cSRIN, cA, cB, cC, cD, cSLIN, cCLRQ) \ + NET_REGISTER_DEV(TTL_74194, name) \ + NET_CONNECT(name, CLK, cCLK) \ + NET_CONNECT(name, S0, cS0) \ + NET_CONNECT(name, S1, cS1) \ + NET_CONNECT(name, SRIN, cSRIN) \ + NET_CONNECT(name, A, cA) \ + NET_CONNECT(name, B, cB) \ + NET_CONNECT(name, C, cC) \ + NET_CONNECT(name, D, cD) \ + NET_CONNECT(name, SLIN, cSLIN) \ NET_CONNECT(name, CLRQ, cCLRQ) #define TTL_74194_DIP(name) \ diff --git a/src/lib/netlist/devices/nld_74279.cpp b/src/lib/netlist/devices/nld_74279.cpp index 48c2e7e095b..ff8f12e07ea 100644 --- a/src/lib/netlist/devices/nld_74279.cpp +++ b/src/lib/netlist/devices/nld_74279.cpp @@ -5,8 +5,9 @@ * */ +#include "nlid_truthtable.h" #include "nld_74279.h" -#include "nld_truthtable.h" +#include "nl_base.h" namespace netlist { @@ -56,7 +57,7 @@ namespace netlist nld_74279A::truthtable_t nld_74279A::m_ttbl; nld_74279B::truthtable_t nld_74279B::m_ttbl; - const char *nld_74279A::m_desc[] = { + const pstring nld_74279A::m_desc[] = { "S,R,_Q|Q", "0,X,X|1|22", "1,0,X|0|27", @@ -66,7 +67,7 @@ namespace netlist }; - const char *nld_74279B::m_desc[] = { + const pstring nld_74279B::m_desc[] = { "S1,S2,R,_Q|Q", "0,X,X,X|1|22", "X,0,X,X|1|22", diff --git a/src/lib/netlist/devices/nld_74365.cpp b/src/lib/netlist/devices/nld_74365.cpp index 34eafb0856e..f008b721344 100644 --- a/src/lib/netlist/devices/nld_74365.cpp +++ b/src/lib/netlist/devices/nld_74365.cpp @@ -6,6 +6,7 @@ */ #include "nld_74365.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7448.cpp b/src/lib/netlist/devices/nld_7448.cpp index 8b4d11c374b..a4b358c3da5 100644 --- a/src/lib/netlist/devices/nld_7448.cpp +++ b/src/lib/netlist/devices/nld_7448.cpp @@ -5,8 +5,8 @@ * */ +#include "nlid_truthtable.h" #include "nld_7448.h" -#include "nld_truthtable.h" namespace netlist { @@ -14,7 +14,7 @@ namespace netlist { #if (USE_TRUTHTABLE_7448 && USE_TRUTHTABLE) - NETLIB_TRUTHTABLE(7448, 7, 7, 0); + NETLIB_TRUTHTABLE(7448, 7, 7); #else @@ -80,7 +80,7 @@ namespace netlist #if (USE_TRUTHTABLE_7448 && USE_TRUTHTABLE) nld_7448::truthtable_t nld_7448::m_ttbl; - const char *nld_7448::m_desc[] = { + const pstring nld_7448::m_desc[] = { " LTQ,BIQ,RBIQ, A , B , C , D | a, b, c, d, e, f, g", " 1, 1, 1, 0, 0, 0, 0 | 1, 1, 1, 1, 1, 1, 0|100,100,100,100,100,100,100", diff --git a/src/lib/netlist/devices/nld_7448.h b/src/lib/netlist/devices/nld_7448.h index 199b46343a8..24cdcb8f6f1 100644 --- a/src/lib/netlist/devices/nld_7448.h +++ b/src/lib/netlist/devices/nld_7448.h @@ -24,7 +24,7 @@ #ifndef NLD_7448_H_ #define NLD_7448_H_ -#include "nl_base.h" +#include "nl_setup.h" /* * FIXME: Using truthtable is a lot slower than the explicit device @@ -34,6 +34,8 @@ #define USE_TRUTHTABLE_7448 (0) +#ifndef NL_AUTO_DEVICES + #define TTL_7448(name, cA0, cA1, cA2, cA3, cLTQ, cBIQ, cRBIQ) \ NET_REGISTER_DEV(TTL_7448, name) \ NET_CONNECT(name, A, cA0) \ @@ -47,4 +49,6 @@ #define TTL_7448_DIP(name) \ NET_REGISTER_DEV(TTL_7448_DIP, name) +#endif + #endif /* NLD_7448_H_ */ diff --git a/src/lib/netlist/devices/nld_7450.cpp b/src/lib/netlist/devices/nld_7450.cpp index 007f899a5f9..2ad560b1d07 100644 --- a/src/lib/netlist/devices/nld_7450.cpp +++ b/src/lib/netlist/devices/nld_7450.cpp @@ -6,6 +6,7 @@ */ #include "nld_7450.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7473.cpp b/src/lib/netlist/devices/nld_7473.cpp index fc73b97c201..3c88b0f8167 100644 --- a/src/lib/netlist/devices/nld_7473.cpp +++ b/src/lib/netlist/devices/nld_7473.cpp @@ -6,6 +6,7 @@ */ #include "nld_7473.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7474.cpp b/src/lib/netlist/devices/nld_7474.cpp index f11ccbd2164..627d3a9b48a 100644 --- a/src/lib/netlist/devices/nld_7474.cpp +++ b/src/lib/netlist/devices/nld_7474.cpp @@ -6,6 +6,7 @@ */ #include "nld_7474.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7475.cpp b/src/lib/netlist/devices/nld_7475.cpp index 3c26c1ce439..7bf3f14d7f2 100644 --- a/src/lib/netlist/devices/nld_7475.cpp +++ b/src/lib/netlist/devices/nld_7475.cpp @@ -7,6 +7,7 @@ */ #include "nld_7475.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7483.cpp b/src/lib/netlist/devices/nld_7483.cpp index a11f36c1540..518026e7fe5 100644 --- a/src/lib/netlist/devices/nld_7483.cpp +++ b/src/lib/netlist/devices/nld_7483.cpp @@ -6,6 +6,7 @@ */ #include "nld_7483.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7485.cpp b/src/lib/netlist/devices/nld_7485.cpp index b4237a6426d..4526b9001ea 100644 --- a/src/lib/netlist/devices/nld_7485.cpp +++ b/src/lib/netlist/devices/nld_7485.cpp @@ -6,6 +6,7 @@ */ #include "nld_7485.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7490.cpp b/src/lib/netlist/devices/nld_7490.cpp index e395c64120e..a85ccbcfbcb 100644 --- a/src/lib/netlist/devices/nld_7490.cpp +++ b/src/lib/netlist/devices/nld_7490.cpp @@ -6,6 +6,7 @@ */ #include "nld_7490.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_7493.cpp b/src/lib/netlist/devices/nld_7493.cpp index 557d7fa42b6..df6ab4ad668 100644 --- a/src/lib/netlist/devices/nld_7493.cpp +++ b/src/lib/netlist/devices/nld_7493.cpp @@ -6,7 +6,7 @@ */ #include "nld_7493.h" -#include "nl_setup.h" +#include "nl_base.h" namespace netlist { @@ -29,8 +29,8 @@ namespace netlist logic_input_t m_I; logic_output_t m_Q; - state_var_u8 m_reset; - state_var_u8 m_state; + state_var<netlist_sig_t> m_reset; + state_var<netlist_sig_t> m_state; }; NETLIB_OBJECT(7493) @@ -99,7 +99,7 @@ namespace netlist NETLIB_UPDATE(7493ff) { - constexpr netlist_time out_delay = NLTIME_FROM_NS(18); + static constexpr netlist_time out_delay = NLTIME_FROM_NS(18); if (m_reset) { m_state ^= 1; diff --git a/src/lib/netlist/devices/nld_74ls629.cpp b/src/lib/netlist/devices/nld_74ls629.cpp index 07eee6f5a57..26a5aaf2220 100644 --- a/src/lib/netlist/devices/nld_74ls629.cpp +++ b/src/lib/netlist/devices/nld_74ls629.cpp @@ -40,7 +40,7 @@ #include "nld_74ls629.h" -#include "analog/nld_twoterm.h" +#include "analog/nlid_twoterm.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_82S115.cpp b/src/lib/netlist/devices/nld_82S115.cpp index c01d013aec5..855e22c0f87 100644 --- a/src/lib/netlist/devices/nld_82S115.cpp +++ b/src/lib/netlist/devices/nld_82S115.cpp @@ -6,6 +6,7 @@ */ #include "nld_82S115.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_82S115.h b/src/lib/netlist/devices/nld_82S115.h index 0c900e4dad7..1ceb22dc1b1 100644 --- a/src/lib/netlist/devices/nld_82S115.h +++ b/src/lib/netlist/devices/nld_82S115.h @@ -30,19 +30,19 @@ #include "nl_setup.h" -#define PROM_82S115(name, cCE1Q, cCE2, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cSTROBE) \ - NET_REGISTER_DEV(PROM_82S115, name) \ - NET_CONNECT(name, CE1Q, cCE1Q) \ - NET_CONNECT(name, CE2, cCE2) \ - NET_CONNECT(name, A0, cA0) \ - NET_CONNECT(name, A1, cA1) \ - NET_CONNECT(name, A2, cA2) \ - NET_CONNECT(name, A3, cA3) \ - NET_CONNECT(name, A4, cA4) \ - NET_CONNECT(name, A5, cA5) \ - NET_CONNECT(name, A6, cA6) \ - NET_CONNECT(name, A7, cA7) \ - NET_CONNECT(name, A8, cA8) \ +#define PROM_82S115(name, cCE1Q, cCE2, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cSTROBE) \ + NET_REGISTER_DEV(PROM_82S115, name) \ + NET_CONNECT(name, CE1Q, cCE1Q) \ + NET_CONNECT(name, CE2, cCE2) \ + NET_CONNECT(name, A0, cA0) \ + NET_CONNECT(name, A1, cA1) \ + NET_CONNECT(name, A2, cA2) \ + NET_CONNECT(name, A3, cA3) \ + NET_CONNECT(name, A4, cA4) \ + NET_CONNECT(name, A5, cA5) \ + NET_CONNECT(name, A6, cA6) \ + NET_CONNECT(name, A7, cA7) \ + NET_CONNECT(name, A8, cA8) \ NET_CONNECT(name, STROBE, cSTROBE) #define PROM_82S115_DIP(name) \ diff --git a/src/lib/netlist/devices/nld_82S123.cpp b/src/lib/netlist/devices/nld_82S123.cpp index f9e97174d4a..2152bd738eb 100644 --- a/src/lib/netlist/devices/nld_82S123.cpp +++ b/src/lib/netlist/devices/nld_82S123.cpp @@ -6,6 +6,7 @@ */ #include "nld_82S123.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_82S126.cpp b/src/lib/netlist/devices/nld_82S126.cpp index d3a86ce84ee..221b7425c8d 100644 --- a/src/lib/netlist/devices/nld_82S126.cpp +++ b/src/lib/netlist/devices/nld_82S126.cpp @@ -6,6 +6,7 @@ */ #include "nld_82S126.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_82S16.cpp b/src/lib/netlist/devices/nld_82S16.cpp index fccdc8b1044..a2a199a61d5 100644 --- a/src/lib/netlist/devices/nld_82S16.cpp +++ b/src/lib/netlist/devices/nld_82S16.cpp @@ -6,6 +6,7 @@ */ #include "nld_82S16.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_9310.cpp b/src/lib/netlist/devices/nld_9310.cpp index 4ddb62af519..dd448c4282b 100644 --- a/src/lib/netlist/devices/nld_9310.cpp +++ b/src/lib/netlist/devices/nld_9310.cpp @@ -6,6 +6,7 @@ */ #include "nld_9310.h" +#include "nl_base.h" #define MAXCNT 9 @@ -158,21 +159,22 @@ namespace netlist { if (m_loadq) { - switch (m_cnt()) + if (m_cnt < MAXCNT - 1) { - case MAXCNT - 1: - m_cnt = MAXCNT; - m_RC.push(m_ent, NLTIME_FROM_NS(20)); - m_QA.push(1, NLTIME_FROM_NS(20)); - break; - case MAXCNT: - m_RC.push(0, NLTIME_FROM_NS(20)); - m_cnt = 0; - update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); - break; - default: - m_cnt++; - update_outputs(m_cnt); + m_cnt++; + update_outputs(m_cnt); + } + else if (m_cnt == MAXCNT - 1) + { + m_cnt = MAXCNT; + m_RC.push(m_ent, NLTIME_FROM_NS(20)); + m_QA.push(1, NLTIME_FROM_NS(20)); + } + else // MAXCNT + { + m_RC.push(0, NLTIME_FROM_NS(20)); + m_cnt = 0; + update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); } } else diff --git a/src/lib/netlist/devices/nld_9312.cpp b/src/lib/netlist/devices/nld_9312.cpp index 2ad298f368a..b3fe0545f81 100644 --- a/src/lib/netlist/devices/nld_9312.cpp +++ b/src/lib/netlist/devices/nld_9312.cpp @@ -20,8 +20,8 @@ * | 1 | 1 | 1 | 0 || D7|D7Q| * +---+---+---+---++---+---+ */ +#include "nlid_truthtable.h" #include "nld_9312.h" -#include "nld_truthtable.h" namespace netlist { @@ -130,7 +130,7 @@ namespace netlist * do this right now. */ - const char *nld_9312::m_desc[] = { + const pstring nld_9312::m_desc[] = { " C, B, A, G,D0,D1,D2,D3,D4,D5,D6,D7| Y,YQ", " X, X, X, 1, X, X, X, X, X, X, X, X| 0, 1|33,19", " 0, 0, 0, 0, 0, X, X, X, X, X, X, X| 0, 1|33,28", diff --git a/src/lib/netlist/devices/nld_9312.h b/src/lib/netlist/devices/nld_9312.h index 98cc0d115c8..c85d86d2773 100644 --- a/src/lib/netlist/devices/nld_9312.h +++ b/src/lib/netlist/devices/nld_9312.h @@ -39,19 +39,19 @@ #include "nl_setup.h" -#define TTL_9312(name, cA, cB, cC, cD0, cD1, cD2, cD3, cD4, cD5, cD6, cD7, cSTROBE) \ - NET_REGISTER_DEV(TTL_9312, name) \ - NET_CONNECT(name, A, cA) \ - NET_CONNECT(name, B, cB) \ - NET_CONNECT(name, C, cC) \ - NET_CONNECT(name, D0, cD0) \ - NET_CONNECT(name, D1, cD1) \ - NET_CONNECT(name, D2, cD2) \ - NET_CONNECT(name, D3, cD3) \ - NET_CONNECT(name, D4, cD4) \ - NET_CONNECT(name, D5, cD5) \ - NET_CONNECT(name, D6, cD6) \ - NET_CONNECT(name, D7, cD7) \ +#define TTL_9312(name, cA, cB, cC, cD0, cD1, cD2, cD3, cD4, cD5, cD6, cD7, cSTROBE) \ + NET_REGISTER_DEV(TTL_9312, name) \ + NET_CONNECT(name, A, cA) \ + NET_CONNECT(name, B, cB) \ + NET_CONNECT(name, C, cC) \ + NET_CONNECT(name, D0, cD0) \ + NET_CONNECT(name, D1, cD1) \ + NET_CONNECT(name, D2, cD2) \ + NET_CONNECT(name, D3, cD3) \ + NET_CONNECT(name, D4, cD4) \ + NET_CONNECT(name, D5, cD5) \ + NET_CONNECT(name, D6, cD6) \ + NET_CONNECT(name, D7, cD7) \ NET_CONNECT(name, G, cSTROBE) #define TTL_9312_DIP(name) \ diff --git a/src/lib/netlist/devices/nld_9316.cpp b/src/lib/netlist/devices/nld_9316.cpp index ea7ca9fc45c..e9004417b6d 100644 --- a/src/lib/netlist/devices/nld_9316.cpp +++ b/src/lib/netlist/devices/nld_9316.cpp @@ -6,6 +6,7 @@ */ #include "nld_9316.h" +#include "nl_base.h" #define MAXCNT 15 @@ -161,22 +162,22 @@ namespace netlist { if (m_loadq) { - switch (m_cnt()) + if (m_cnt < MAXCNT - 1) { - case MAXCNT - 1: - m_cnt = MAXCNT; - m_RC.push(m_ent, NLTIME_FROM_NS(27)); - m_QA.push(1, NLTIME_FROM_NS(20)); - break; - case MAXCNT: - m_RC.push(0, NLTIME_FROM_NS(27)); - m_cnt = 0; - update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); - break; - default: - m_cnt++; - update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); - break; + m_cnt++; + update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); + } + else if (m_cnt == MAXCNT - 1) + { + m_cnt = MAXCNT; + m_RC.push(m_ent, NLTIME_FROM_NS(27)); + m_QA.push(1, NLTIME_FROM_NS(20)); + } + else // MAXCNT + { + m_RC.push(0, NLTIME_FROM_NS(27)); + m_cnt = 0; + update_outputs_all(m_cnt, NLTIME_FROM_NS(20)); } } else diff --git a/src/lib/netlist/devices/nld_9322.cpp b/src/lib/netlist/devices/nld_9322.cpp index 881ec9e5355..1f402d4111b 100644 --- a/src/lib/netlist/devices/nld_9322.cpp +++ b/src/lib/netlist/devices/nld_9322.cpp @@ -6,6 +6,7 @@ */ #include "nld_9322.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_am2847.cpp b/src/lib/netlist/devices/nld_am2847.cpp index b4891db5398..be5f75c3774 100644 --- a/src/lib/netlist/devices/nld_am2847.cpp +++ b/src/lib/netlist/devices/nld_am2847.cpp @@ -6,6 +6,7 @@ */ #include "nld_am2847.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_dm9334.cpp b/src/lib/netlist/devices/nld_dm9334.cpp index 091f08f00a8..b8607374620 100644 --- a/src/lib/netlist/devices/nld_dm9334.cpp +++ b/src/lib/netlist/devices/nld_dm9334.cpp @@ -6,6 +6,7 @@ */ #include "nld_dm9334.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_legacy.cpp b/src/lib/netlist/devices/nld_legacy.cpp index 3a063094b72..29cff9576ab 100644 --- a/src/lib/netlist/devices/nld_legacy.cpp +++ b/src/lib/netlist/devices/nld_legacy.cpp @@ -6,7 +6,7 @@ */ #include "nld_legacy.h" -#include "nl_setup.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_log.cpp b/src/lib/netlist/devices/nld_log.cpp index 17661de803d..d69bc6aa81e 100644 --- a/src/lib/netlist/devices/nld_log.cpp +++ b/src/lib/netlist/devices/nld_log.cpp @@ -5,7 +5,6 @@ * */ -#include <memory> #include "nl_base.h" #include "plib/pstream.h" #include "plib/pfmtlog.h" @@ -20,21 +19,22 @@ namespace netlist { NETLIB_CONSTRUCTOR(log) , m_I(*this, "I") + , m_strm(plib::pfmt("{1}.log")(this->name())) + , m_writer(m_strm) { - pstring filename = plib::pfmt("{1}.log")(this->name()); - m_strm = plib::make_unique<plib::pofilestream>(filename); } NETLIB_UPDATEI() { /* use pstring::sprintf, it is a LOT faster */ - m_strm->writeline(plib::pfmt("{1} {2}").e(netlist().time().as_double(),".9").e(static_cast<double>(m_I()))); + m_writer.writeline(plib::pfmt("{1} {2}").e(netlist().time().as_double(),".9").e(static_cast<double>(m_I()))); } NETLIB_RESETI() { } protected: analog_input_t m_I; - std::unique_ptr<plib::pofilestream> m_strm; + plib::pofilestream m_strm; + plib::putf8_writer m_writer; }; NETLIB_OBJECT_DERIVED(logD, log) @@ -46,7 +46,7 @@ namespace netlist NETLIB_UPDATEI() { - m_strm->writeline(plib::pfmt("{1} {2}").e(netlist().time().as_double(),".9").e(static_cast<double>(m_I() - m_I2()))); + m_writer.writeline(plib::pfmt("{1} {2}").e(netlist().time().as_double(),".9").e(static_cast<double>(m_I() - m_I2()))); } NETLIB_RESETI() { } diff --git a/src/lib/netlist/devices/nld_mm5837.cpp b/src/lib/netlist/devices/nld_mm5837.cpp index 7650538997b..d9297166d94 100644 --- a/src/lib/netlist/devices/nld_mm5837.cpp +++ b/src/lib/netlist/devices/nld_mm5837.cpp @@ -6,8 +6,8 @@ */ #include "nld_mm5837.h" -#include <solver/nld_matrix_solver.h> -#include "analog/nld_twoterm.h" +#include "solver/nld_matrix_solver.h" +#include "analog/nlid_twoterm.h" #define R_LOW (1000.0) #define R_HIGH (1000.0) @@ -72,7 +72,7 @@ namespace netlist m_RV.set(NL_FCONST(1.0) / R_LOW, 0.0, 0.0); m_inc = netlist_time::from_double(1.0 / m_FREQ()); if (m_FREQ() < 24000 || m_FREQ() > 56000) - netlist().log().warning("MM5837: Frequency outside of specs.", m_FREQ()); + log().warning(MW_1_FREQUENCY_OUTSIDE_OF_SPECS_1, m_FREQ()); m_shift = 0x1ffff; m_is_timestep = m_RV.m_P.net().solver()->is_timestep(); @@ -82,7 +82,7 @@ namespace netlist { m_inc = netlist_time::from_double(1.0 / m_FREQ()); if (m_FREQ() < 24000 || m_FREQ() > 56000) - netlist().log().warning("MM5837: Frequency outside of specs.", m_FREQ()); + log().warning(MW_1_FREQUENCY_OUTSIDE_OF_SPECS_1, m_FREQ()); } NETLIB_UPDATE(MM5837_dip) diff --git a/src/lib/netlist/devices/nld_ne555.cpp b/src/lib/netlist/devices/nld_ne555.cpp index 3cfd120be30..f9bb5e261c2 100644 --- a/src/lib/netlist/devices/nld_ne555.cpp +++ b/src/lib/netlist/devices/nld_ne555.cpp @@ -6,8 +6,8 @@ */ #include "nld_ne555.h" -#include "analog/nld_twoterm.h" -#include <solver/nld_solver.h> +#include "analog/nlid_twoterm.h" +#include "solver/nld_solver.h" #define R_OFF (1E20) #define R_ON (25) // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2 diff --git a/src/lib/netlist/devices/nld_r2r_dac.cpp b/src/lib/netlist/devices/nld_r2r_dac.cpp index 8a6d811f2d4..f4006eef31d 100644 --- a/src/lib/netlist/devices/nld_r2r_dac.cpp +++ b/src/lib/netlist/devices/nld_r2r_dac.cpp @@ -5,8 +5,9 @@ * */ -#include "nld_r2r_dac.h" -#include "analog/nld_twoterm.h" +#include "nl_base.h" +#include "nl_factory.h" +#include "analog/nlid_twoterm.h" namespace netlist { diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp index f555e41720a..e3585271696 100644 --- a/src/lib/netlist/devices/nld_system.cpp +++ b/src/lib/netlist/devices/nld_system.cpp @@ -5,8 +5,8 @@ * */ -#include <solver/nld_solver.h> -#include <solver/nld_matrix_solver.h> +#include "solver/nld_solver.h" +#include "solver/nld_matrix_solver.h" #include "nlid_system.h" namespace netlist @@ -132,82 +132,13 @@ namespace netlist NETLIB_UPDATE(function) { - //nl_double val = INPANALOG(m_I[0]) * INPANALOG(m_I[1]) * 0.2; - //OUTANALOG(m_Q, val); - nl_double stack[20]; - unsigned ptr = 0; - std::size_t e = m_precompiled.size(); - for (std::size_t i = 0; i<e; i++) + for (std::size_t i=0; i < static_cast<unsigned>(m_N()); i++) { - rpn_inst &rc = m_precompiled[i]; - switch (rc.m_cmd) - { - case ADD: - ptr--; - stack[ptr-1] = stack[ptr] + stack[ptr-1]; - break; - case MULT: - ptr--; - stack[ptr-1] = stack[ptr] * stack[ptr-1]; - break; - case SUB: - ptr--; - stack[ptr-1] = stack[ptr-1] - stack[ptr]; - break; - case DIV: - ptr--; - stack[ptr-1] = stack[ptr-1] / stack[ptr]; - break; - case POW: - ptr--; - stack[ptr-1] = std::pow(stack[ptr-1], stack[ptr]); - break; - case PUSH_INPUT: - stack[ptr++] = (*m_I[static_cast<unsigned>(rc.m_param)])(); - break; - case PUSH_CONST: - stack[ptr++] = rc.m_param; - break; - } + m_vals[i] = (*m_I[i])(); } - m_Q.push(stack[ptr-1]); + m_Q.push(m_precompiled.evaluate(m_vals)); } - void NETLIB_NAME(function)::compile() - { - plib::pstring_vector_t cmds(m_func(), " "); - m_precompiled.clear(); - - for (std::size_t i=0; i < cmds.size(); i++) - { - pstring cmd = cmds[i]; - rpn_inst rc; - if (cmd == "+") - rc.m_cmd = ADD; - else if (cmd == "-") - rc.m_cmd = SUB; - else if (cmd == "*") - rc.m_cmd = MULT; - else if (cmd == "/") - rc.m_cmd = DIV; - else if (cmd == "pow") - rc.m_cmd = POW; - else if (cmd.startsWith("A")) - { - rc.m_cmd = PUSH_INPUT; - rc.m_param = cmd.substr(1).as_long(); - } - else - { - bool err = false; - rc.m_cmd = PUSH_CONST; - rc.m_param = cmd.as_double(&err); - if (err) - netlist().log().fatal("nld_function: unknown/misformatted token <{1}> in <{2}>", cmd, m_func()); - } - m_precompiled.push_back(rc); - } - } NETLIB_DEVICE_IMPL(dummy_input) NETLIB_DEVICE_IMPL(frontier) diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h index 738ceb2a171..46781fe2884 100644 --- a/src/lib/netlist/devices/nld_system.h +++ b/src/lib/netlist/devices/nld_system.h @@ -54,9 +54,6 @@ NET_C(cG, name.G) \ NET_C(cOUT, name.Q) -#define OPTIMIZE_FRONTIER(attach, r_in, r_out) \ - setup.register_frontier(# attach, r_in, r_out); - #define RES_SWITCH(name, cIN, cP1, cP2) \ NET_REGISTER_DEV(RES_SWITCH, name) \ NET_C(cIN, name.I) \ @@ -72,4 +69,5 @@ PARAM(name.N, p_N) \ PARAM(name.FUNC, p_F) + #endif /* NLD_SYSTEM_H_ */ diff --git a/src/lib/netlist/devices/nld_tristate.cpp b/src/lib/netlist/devices/nld_tristate.cpp index db21468685e..b724a09bf9c 100644 --- a/src/lib/netlist/devices/nld_tristate.cpp +++ b/src/lib/netlist/devices/nld_tristate.cpp @@ -6,6 +6,7 @@ */ #include "nld_tristate.h" +#include "nl_base.h" namespace netlist { diff --git a/src/lib/netlist/devices/nlid_cmos.h b/src/lib/netlist/devices/nlid_cmos.h index 4770eac2164..2d836ef656d 100644 --- a/src/lib/netlist/devices/nlid_cmos.h +++ b/src/lib/netlist/devices/nlid_cmos.h @@ -8,6 +8,7 @@ #ifndef NLID_CMOS_H_ #define NLID_CMOS_H_ +#include "nl_setup.h" #include "nl_base.h" namespace netlist diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp index 0b08327070c..4b18ca0bbb2 100644 --- a/src/lib/netlist/devices/nlid_proxy.cpp +++ b/src/lib/netlist/devices/nlid_proxy.cpp @@ -5,7 +5,6 @@ * */ -//#include <memory> #include "nlid_proxy.h" #include "solver/nld_solver.h" //#include "plib/pstream.h" @@ -100,7 +99,7 @@ namespace netlist , m_last_state(*this, "m_last_var", -1) , m_is_timestep(false) { - const char *power_syms[3][2] ={ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}}; + const pstring power_syms[3][2] ={ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}}; //register_sub(m_RV); //register_term("1", m_RV.m_P); //register_term("2", m_RV.m_N); @@ -112,8 +111,10 @@ namespace netlist for (int i = 0; i < 3; i++) { pstring devname = out_proxied->device().name(); - auto tp = netlist().setup().find_terminal(devname + "." + power_syms[i][0], detail::device_object_t::type_t::INPUT, false); - auto tn = netlist().setup().find_terminal(devname + "." + power_syms[i][1], detail::device_object_t::type_t::INPUT, false); + auto tp = netlist().setup().find_terminal(devname + "." + power_syms[i][0], + detail::terminal_type::INPUT, false); + auto tn = netlist().setup().find_terminal(devname + "." + power_syms[i][1], + detail::terminal_type::INPUT, false); if (tp != nullptr && tn != nullptr) { /* alternative logic */ @@ -121,12 +122,12 @@ namespace netlist } } if (!f) - netlist().log().warning("D/A Proxy: Found no valid combination of power terminals on device {1}", out_proxied->device().name()); + log().warning(MW_1_NO_POWER_TERMINALS_ON_DEVICE_1, out_proxied->device().name()); else - netlist().log().warning("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name()); + log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name()); #if (0) printf("%s %s\n", out_proxied->name().c_str(), out_proxied->device().name().c_str()); - auto x = netlist().setup().find_terminal(out_proxied->name(), detail::device_object_t::type_t::OUTPUT, false); + auto x = netlist().setup().find_terminal(out_proxied->name(), detail::device_object_t::terminal_type::OUTPUT, false); if (x) printf("==> %s\n", x->name().c_str()); #endif } diff --git a/src/lib/netlist/devices/nlid_proxy.h b/src/lib/netlist/devices/nlid_proxy.h index 77a8d52026c..178faae20fd 100644 --- a/src/lib/netlist/devices/nlid_proxy.h +++ b/src/lib/netlist/devices/nlid_proxy.h @@ -11,12 +11,8 @@ #ifndef NLID_PROXY_H_ #define NLID_PROXY_H_ -#include <vector> - #include "nl_setup.h" -#include "nl_base.h" -#include "nl_factory.h" -#include "analog/nld_twoterm.h" +#include "analog/nlid_twoterm.h" namespace netlist { @@ -127,7 +123,7 @@ namespace netlist analog::NETLIB_SUB(twoterm) m_RV; state_var<int> m_last_state; bool m_is_timestep; - }; +}; } //namespace devices } // namespace netlist diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h index 8d2cd8162f8..e9baa4c159d 100644 --- a/src/lib/netlist/devices/nlid_system.h +++ b/src/lib/netlist/devices/nlid_system.h @@ -11,12 +11,10 @@ #ifndef NLID_SYSTEM_H_ #define NLID_SYSTEM_H_ -#include <vector> - -#include "nl_setup.h" #include "nl_base.h" -#include "nl_factory.h" -#include "analog/nld_twoterm.h" +#include "nl_setup.h" +#include "analog/nlid_twoterm.h" +#include "plib/putil.h" namespace netlist { @@ -126,7 +124,7 @@ namespace netlist connect(m_feedback, m_Q); { netlist_time base = netlist_time::from_double(1.0 / (m_freq()*2.0)); - plib::pstring_vector_t pat(m_pattern(),","); + std::vector<pstring> pat(plib::psplit(m_pattern(),",")); m_off = netlist_time::from_double(m_offset()); unsigned long pati[256]; @@ -175,7 +173,7 @@ namespace netlist /* make sure we get the family first */ , m_FAMILY(*this, "FAMILY", "FAMILY(TYPE=TTL)") { - set_logic_family(netlist().family_from_model(m_FAMILY())); + set_logic_family(setup().family_from_model(m_FAMILY())); } NETLIB_UPDATE_AFTER_PARAM_CHANGE() @@ -309,9 +307,15 @@ namespace netlist , m_func(*this, "FUNC", "") , m_Q(*this, "Q") { + std::vector<pstring> inps; for (int i=0; i < m_N(); i++) - m_I.push_back(plib::make_unique<analog_input_t>(*this, plib::pfmt("A{1}")(i))); - compile(); + { + pstring n = plib::pfmt("A{1}")(i); + m_I.push_back(plib::make_unique<analog_input_t>(*this, n)); + inps.push_back(n); + m_vals.push_back(0.0); + } + m_precompiled.compile(inps, m_func()); } protected: @@ -321,32 +325,13 @@ namespace netlist private: - enum rpn_cmd - { - ADD, - MULT, - SUB, - DIV, - POW, - PUSH_CONST, - PUSH_INPUT - }; - - struct rpn_inst - { - rpn_inst() : m_cmd(ADD), m_param(0.0) { } - rpn_cmd m_cmd; - nl_double m_param; - }; - - void compile(); - param_int_t m_N; param_str_t m_func; analog_output_t m_Q; std::vector<std::unique_ptr<analog_input_t>> m_I; - std::vector<rpn_inst> m_precompiled; + std::vector<double> m_vals; + plib::pfunction m_precompiled; }; // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/devices/nld_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp index 9030f6b8801..824061fdc30 100644 --- a/src/lib/netlist/devices/nld_truthtable.cpp +++ b/src/lib/netlist/devices/nlid_truthtable.cpp @@ -5,9 +5,10 @@ * */ -#include "nld_truthtable.h" +#include "nlid_truthtable.h" #include "plib/plists.h" #include "nl_setup.h" +#include "plib/palloc.h" namespace netlist { @@ -16,11 +17,10 @@ namespace netlist template<unsigned m_NI, unsigned m_NO> class netlist_factory_truthtable_t : public netlist_base_factory_truthtable_t { - P_PREVENT_COPYING(netlist_factory_truthtable_t) public: netlist_factory_truthtable_t(const pstring &name, const pstring &classname, - const pstring &def_param) - : netlist_base_factory_truthtable_t(name, classname, def_param) + const pstring &def_param, const pstring &sourcefile) + : netlist_base_factory_truthtable_t(name, classname, def_param, sourcefile) { } plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) override @@ -120,7 +120,7 @@ uint_least64_t truthtable_desc_t::get_ignored_extended(uint_least64_t state) // desc // ---------------------------------------------------------------------------------------- -void truthtable_desc_t::help(unsigned cur, plib::pstring_vector_t list, +void truthtable_desc_t::help(unsigned cur, std::vector<pstring> list, uint_least64_t state, uint_least64_t val, std::vector<uint_least8_t> &timing_index) { pstring elem = list[cur].trim(); @@ -165,7 +165,7 @@ void truthtable_desc_t::help(unsigned cur, plib::pstring_vector_t list, } } -void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, uint_least64_t disabled_ignore) +void truthtable_desc_t::setup(const std::vector<pstring> &truthtable, uint_least64_t disabled_ignore) { unsigned line = 0; @@ -185,14 +185,14 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, uint_lea while (!ttline.equals("")) { - plib::pstring_vector_t io(ttline,"|"); + std::vector<pstring> io(plib::psplit(ttline,"|")); // checks nl_assert_always(io.size() == 3, "io.count mismatch"); - plib::pstring_vector_t inout(io[0], ","); + std::vector<pstring> inout(plib::psplit(io[0], ",")); nl_assert_always(inout.size() == m_num_bits, "number of bits not matching"); - plib::pstring_vector_t out(io[1], ","); + std::vector<pstring> out(plib::psplit(io[1], ",")); nl_assert_always(out.size() == m_NO, "output count not matching"); - plib::pstring_vector_t times(io[2], ","); + std::vector<pstring> times(plib::psplit(io[2], ",")); nl_assert_always(times.size() == m_NO, "timing count not matching"); uint_least64_t val = 0; @@ -260,8 +260,8 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, uint_lea } netlist_base_factory_truthtable_t::netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname, - const pstring &def_param) -: factory::element_t(name, classname, def_param), m_family(family_TTL()) + const pstring &def_param, const pstring &sourcefile) +: factory::element_t(name, classname, def_param, sourcefile), m_family(family_TTL()) { } @@ -270,35 +270,36 @@ netlist_base_factory_truthtable_t::~netlist_base_factory_truthtable_t() } -#define ENTRYY(n, m) case (n * 100 + m): \ +#define ENTRYY(n, m, s) case (n * 100 + m): \ { using xtype = netlist_factory_truthtable_t<n, m>; \ - ret = new xtype(desc.name, desc.classname, desc.def_param); } break + ret = plib::palloc<xtype>(desc.name, desc.classname, desc.def_param, s); } break -#define ENTRY(n) ENTRYY(n, 1); ENTRYY(n, 2); ENTRYY(n, 3); ENTRYY(n, 4); ENTRYY(n, 5); ENTRYY(n, 6) +#define ENTRY(n, s) ENTRYY(n, 1, s); ENTRYY(n, 2, s); ENTRYY(n, 3, s); \ + ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s) -void tt_factory_create(setup_t &setup, tt_desc &desc) +void tt_factory_create(setup_t &setup, tt_desc &desc, const pstring &sourcefile) { netlist_base_factory_truthtable_t *ret; switch (desc.ni * 100 + desc.no) { - ENTRY(1); - ENTRY(2); - ENTRY(3); - ENTRY(4); - ENTRY(5); - ENTRY(6); - ENTRY(7); - ENTRY(8); - ENTRY(9); - ENTRY(10); + ENTRY(1, sourcefile); + ENTRY(2, sourcefile); + ENTRY(3, sourcefile); + ENTRY(4, sourcefile); + ENTRY(5, sourcefile); + ENTRY(6, sourcefile); + ENTRY(7, sourcefile); + ENTRY(8, sourcefile); + ENTRY(9, sourcefile); + ENTRY(10, sourcefile); default: pstring msg = plib::pfmt("unable to create truthtable<{1},{2}>")(desc.ni)(desc.no); nl_assert_always(false, msg); } ret->m_desc = desc.desc; if (desc.family != "") - ret->m_family = setup.netlist().family_from_model(desc.family); + ret->m_family = setup.family_from_model(desc.family); setup.factory().register_device(std::unique_ptr<netlist_base_factory_truthtable_t>(ret)); } diff --git a/src/lib/netlist/devices/nld_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h index 990afc45dd7..68c3d680e40 100644 --- a/src/lib/netlist/devices/nld_truthtable.h +++ b/src/lib/netlist/devices/nlid_truthtable.h @@ -7,15 +7,12 @@ * Author: andre */ -#ifndef NLD_TRUTHTABLE_H_ -#define NLD_TRUTHTABLE_H_ - -#include <new> -#include <cstdint> +#ifndef NLID_TRUTHTABLE_H_ +#define NLID_TRUTHTABLE_H_ #include "nl_setup.h" -#include "nl_factory.h" -#include "plib/plists.h" +#include "nl_base.h" +#include "plib/putil.h" #define NETLIB_TRUTHTABLE(cname, nIN, nOUT) \ class NETLIB_NAME(cname) : public nld_truthtable_t<nIN, nOUT> \ @@ -26,7 +23,7 @@ : nld_truthtable_t<nIN, nOUT>(owner, name, family_TTL(), &m_ttbl, m_desc) { } \ private: \ static truthtable_t m_ttbl; \ - static const char *m_desc[]; \ + static const pstring m_desc[]; \ } @@ -112,10 +109,10 @@ namespace netlist { } - void setup(const plib::pstring_vector_t &desc, uint_least64_t disabled_ignore); + void setup(const std::vector<pstring> &desc, uint_least64_t disabled_ignore); private: - void help(unsigned cur, plib::pstring_vector_t list, + void help(unsigned cur, std::vector<pstring> list, uint_least64_t state, uint_least64_t val, std::vector<uint_least8_t> &timing_index); static unsigned count_bits(uint_least64_t v); static uint_least64_t set_bits(uint_least64_t v, uint_least64_t b); @@ -159,14 +156,14 @@ namespace netlist template <class C> nld_truthtable_t(C &owner, const pstring &name, const logic_family_desc_t *fam, - truthtable_t *ttp, const char *desc[]) + truthtable_t *ttp, const pstring *desc) : device_t(owner, name) , m_fam(*this, fam) , m_ign(*this, "m_ign", 0) , m_active(*this, "m_active", 1) , m_ttp(ttp) { - while (*desc != nullptr && **desc != 0 ) + while (*desc != "" ) { m_desc.push_back(*desc); desc++; @@ -176,7 +173,7 @@ namespace netlist template <class C> nld_truthtable_t(C &owner, const pstring &name, const logic_family_desc_t *fam, - truthtable_t *ttp, const plib::pstring_vector_t &desc) + truthtable_t *ttp, const std::vector<pstring> &desc) : device_t(owner, name) , m_fam(*this, fam) , m_ign(*this, "m_ign", 0) @@ -193,12 +190,12 @@ namespace netlist pstring header = m_desc[0]; - plib::pstring_vector_t io(header,"|"); + std::vector<pstring> io(plib::psplit(header,"|")); // checks nl_assert_always(io.size() == 2, "too many '|'"); - plib::pstring_vector_t inout(io[0], ","); + std::vector<pstring> inout(plib::psplit(io[0], ",")); nl_assert_always(inout.size() == m_num_bits, "bitcount wrong"); - plib::pstring_vector_t out(io[1], ","); + std::vector<pstring> out(plib::psplit(io[1], ",")); nl_assert_always(out.size() == m_NO, "output count wrong"); for (std::size_t i=0; i < m_NI; i++) @@ -363,27 +360,26 @@ namespace netlist state_var_u32 m_ign; state_var_s32 m_active; truthtable_t * m_ttp; - plib::pstring_vector_t m_desc; + std::vector<pstring> m_desc; }; class netlist_base_factory_truthtable_t : public factory::element_t { - P_PREVENT_COPYING(netlist_base_factory_truthtable_t) public: netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname, - const pstring &def_param); + const pstring &def_param, const pstring &sourcefile); virtual ~netlist_base_factory_truthtable_t(); - plib::pstring_vector_t m_desc; + std::vector<pstring> m_desc; const logic_family_desc_t *m_family; }; - void tt_factory_create(setup_t &setup, tt_desc &desc); + void tt_factory_create(setup_t &setup, tt_desc &desc, const pstring &sourcefile); } //namespace devices } // namespace netlist -#endif /* NLD_TRUTHTABLE_H_ */ +#endif /* NLID_TRUTHTABLE_H_ */ diff --git a/src/lib/netlist/documentation/mainpage.dox.h b/src/lib/netlist/documentation/mainpage.dox.h index 75df1a18065..744abe642e6 100644 --- a/src/lib/netlist/documentation/mainpage.dox.h +++ b/src/lib/netlist/documentation/mainpage.dox.h @@ -161,5 +161,4 @@ equation solver. The formal representation of the circuit will stay the same, thus scales. - */ diff --git a/src/lib/netlist/macro/nlm_cd4xxx.cpp b/src/lib/netlist/macro/nlm_cd4xxx.cpp index 469ff13b954..ed805cb52dc 100644 --- a/src/lib/netlist/macro/nlm_cd4xxx.cpp +++ b/src/lib/netlist/macro/nlm_cd4xxx.cpp @@ -2,7 +2,6 @@ // copyright-holders:Couriersud #include "nlm_cd4xxx.h" -#include "devices/nld_truthtable.h" #include "devices/nld_system.h" #include "devices/nld_4020.h" #include "devices/nld_4066.h" diff --git a/src/lib/netlist/macro/nlm_cd4xxx.h b/src/lib/netlist/macro/nlm_cd4xxx.h index de10ff7a64d..446c2d6e435 100644 --- a/src/lib/netlist/macro/nlm_cd4xxx.h +++ b/src/lib/netlist/macro/nlm_cd4xxx.h @@ -22,6 +22,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define CD4001_NOR(name) \ NET_REGISTER_DEV(CD4001_NOR, name) @@ -44,6 +46,7 @@ #define CD4316_DIP(name) \ NET_REGISTER_DEV(CD4016_DIP, name) +#endif /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/macro/nlm_opamp.cpp b/src/lib/netlist/macro/nlm_opamp.cpp index 146f95b72b4..f363c88a100 100644 --- a/src/lib/netlist/macro/nlm_opamp.cpp +++ b/src/lib/netlist/macro/nlm_opamp.cpp @@ -1,9 +1,7 @@ // license:GPL-2.0+ // copyright-holders:Couriersud #include "nlm_opamp.h" - -#include "analog/nld_opamps.h" -#include "devices/nld_system.h" +#include "devices/net_lib.h" /* * Generic layout with 4 opamps, VCC on pin 4 and GND on pin 11 diff --git a/src/lib/netlist/macro/nlm_opamp.h b/src/lib/netlist/macro/nlm_opamp.h index 6e3c1f615e7..ec717fdb2dc 100644 --- a/src/lib/netlist/macro/nlm_opamp.h +++ b/src/lib/netlist/macro/nlm_opamp.h @@ -11,6 +11,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define MB3614_DIP(name) \ NET_REGISTER_DEV(MB3614_DIP, name) @@ -23,6 +25,8 @@ #define LM3900(name) \ NET_REGISTER_DEV(LM3900, name) +#endif + /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/macro/nlm_other.cpp b/src/lib/netlist/macro/nlm_other.cpp index 84a3af4dc04..49f4404427a 100644 --- a/src/lib/netlist/macro/nlm_other.cpp +++ b/src/lib/netlist/macro/nlm_other.cpp @@ -2,7 +2,6 @@ // copyright-holders:Couriersud #include "nlm_other.h" -#include "devices/nld_truthtable.h" #include "devices/nld_system.h" /* diff --git a/src/lib/netlist/macro/nlm_other.h b/src/lib/netlist/macro/nlm_other.h index bb73d0105d2..f0e8ca05af0 100644 --- a/src/lib/netlist/macro/nlm_other.h +++ b/src/lib/netlist/macro/nlm_other.h @@ -11,12 +11,15 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define MC14584B_GATE(name) \ NET_REGISTER_DEV(MC14584B_GATE, name) #define MC14584B_DIP(name) \ NET_REGISTER_DEV(MC14584B_DIP, name) +#endif /* ---------------------------------------------------------------------------- * External declarations diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp index c66314366d2..c8fe9912911 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.cpp +++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp @@ -2,7 +2,6 @@ // copyright-holders:Couriersud #include "nlm_ttl74xx.h" -#include "devices/nld_truthtable.h" #include "devices/nld_system.h" @@ -377,7 +376,7 @@ static NETLIST_START(TTL_7427_DIP) s2.C, /* C2 |5 10| B3 */ s3.B, s2.Q, /* Y2 |6 9| A3 */ s3.A, GND.I, /* GND |7 8| Y3 */ s3.Q - /* +--------------+ */ + /* +--------------+ */ ) NETLIST_END() @@ -413,11 +412,11 @@ static NETLIST_START(TTL_7430_DIP) s1.A, /* A |1 ++ 14| VCC */ VCC.I, s1.B, /* B |2 13| NC */ NC.I, s1.C, /* C |3 12| H */ s1.H, - s1.D, /* D |4 7420 11| G */ s1.G, + s1.D, /* D |4 7430 11| G */ s1.G, s1.E, /* E |5 10| NC */ NC.I, s1.F, /* F |6 9| NC */ NC.I, GND.I, /* GND |7 8| Y */ s1.Q - /* +--------------+ */ + /* +--------------+ */ ) NETLIST_END() diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx.h index 44b3db63bd3..526fbf395da 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.h +++ b/src/lib/netlist/macro/nlm_ttl74xx.h @@ -11,6 +11,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define TTL_7400_GATE(name) \ NET_REGISTER_DEV(TTL_7400_GATE, name) @@ -200,6 +202,8 @@ #define TTL_74260_DIP(name) \ NET_REGISTER_DEV(TTL_74260_DIP, name) +#endif + /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/netlist_types.h b/src/lib/netlist/netlist_types.h new file mode 100644 index 00000000000..c7c4aef4750 --- /dev/null +++ b/src/lib/netlist/netlist_types.h @@ -0,0 +1,54 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/*! + * + * \file netlist_types.h + * + */ + +#ifndef NETLIST_TYPES_H_ +#define NETLIST_TYPES_H_ + +#include <cstdint> +#include <unordered_map> + +#include "nl_config.h" +#include "plib/pchrono.h" +#include "plib/pstring.h" + +namespace netlist +{ + //============================================================ + // Performance tracking + //============================================================ + +#if NL_KEEP_STATISTICS + using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, true>; + using nperfcount_t = plib::chrono::counter<true>; +#else + using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, false>; + using nperfcount_t = plib::chrono::counter<false>; +#endif + + //============================================================ + // Types needed by various includes + //============================================================ + + namespace detail { + + /*! Enum specifying the type of object */ + enum terminal_type { + TERMINAL = 0, /*!< object is an analog terminal */ + INPUT = 1, /*!< object is an input */ + OUTPUT = 2, /*!< object is an output */ + }; + + /*! Type of the model map used. + * This is used to hold all #Models in an unordered map + */ + using model_map_t = std::unordered_map<pstring, pstring>; + + } +} + +#endif /* NETLIST_TYPES_H_ */ diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 80acf9847a3..4374ef2212d 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -6,6 +6,7 @@ */ #include <cstring> +#include <cmath> #include "solver/nld_matrix_solver.h" #include "solver/nld_solver.h" @@ -25,7 +26,7 @@ namespace netlist namespace detail { #if (USE_MEMPOOL) -static plib::mempool pool(65536, 8); +static plib::mempool pool(6553600, 64); void * object_t::operator new (size_t size) { @@ -135,24 +136,6 @@ const logic_family_desc_t *family_CD4XXX() return &obj; } -class logic_family_std_proxy_t : public logic_family_desc_t -{ -public: - logic_family_std_proxy_t() { } - virtual plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_t &anetlist, - const pstring &name, logic_output_t *proxied) const override; - virtual plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *proxied) const override; -}; - -plib::owned_ptr<devices::nld_base_d_to_a_proxy> logic_family_std_proxy_t::create_d_a_proxy(netlist_t &anetlist, - const pstring &name, logic_output_t *proxied) const -{ - return plib::owned_ptr<devices::nld_base_d_to_a_proxy>::Create<devices::nld_d_to_a_proxy>(anetlist, name, proxied); -} -plib::owned_ptr<devices::nld_base_a_to_d_proxy> logic_family_std_proxy_t::create_a_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *proxied) const -{ - return plib::owned_ptr<devices::nld_base_a_to_d_proxy>::Create<devices::nld_a_to_d_proxy>(anetlist, name, proxied); -} // ---------------------------------------------------------------------------------------- // queue_t @@ -199,10 +182,10 @@ void detail::queue_t::on_post_load() netlist().log().debug("current time {1} qsize {2}\n", netlist().time().as_double(), m_qsize); for (std::size_t i = 0; i < m_qsize; i++ ) { - detail::net_t *n = netlist().find_net(m_names[i].m_buf); + detail::net_t *n = netlist().find_net(pstring(m_names[i].m_buf, pstring::UTF8)); //log().debug("Got {1} ==> {2}\n", qtemp[i].m_name, n)); //log().debug("schedule time {1} ({2})\n", n->time().as_double(), netlist_time::from_raw(m_times[i]).as_double())); - this->push(n, netlist_time::from_raw(m_times[i])); + this->push(queue_t::entry_t(netlist_time::from_raw(m_times[i]),n)); } } @@ -234,24 +217,22 @@ detail::device_object_t::device_object_t(core_device_t &dev, const pstring &anam { } -detail::device_object_t::type_t detail::device_object_t::type() const +detail::terminal_type detail::core_terminal_t::type() const { if (dynamic_cast<const terminal_t *>(this) != nullptr) - return type_t::TERMINAL; - else if (dynamic_cast<const param_t *>(this) != nullptr) - return param_t::PARAM; + return terminal_type::TERMINAL; else if (dynamic_cast<const logic_input_t *>(this) != nullptr) - return param_t::INPUT; + return terminal_type::INPUT; else if (dynamic_cast<const logic_output_t *>(this) != nullptr) - return param_t::OUTPUT; + return terminal_type::OUTPUT; else if (dynamic_cast<const analog_input_t *>(this) != nullptr) - return param_t::INPUT; + return terminal_type::INPUT; else if (dynamic_cast<const analog_output_t *>(this) != nullptr) - return param_t::OUTPUT; + return terminal_type::OUTPUT; else { netlist().log().fatal(MF_1_UNKNOWN_TYPE_FOR_OBJECT, name()); - return type_t::TERMINAL; // please compiler + return terminal_type::TERMINAL; // please compiler } } @@ -272,19 +253,16 @@ netlist_t::netlist_t(const pstring &aname) { state().save_item(this, static_cast<plib::state_manager_t::callback_t &>(m_queue), "m_queue"); state().save_item(this, m_time, "m_time"); - m_setup = new setup_t(*this); + m_setup = plib::make_unique<setup_t>(*this); /* FIXME: doesn't really belong here */ NETLIST_NAME(base)(*m_setup); } netlist_t::~netlist_t() { - if (m_setup != nullptr) - delete m_setup; m_nets.clear(); m_devices.clear(); - pfree(m_lib); pstring::resetmem(); } @@ -303,48 +281,18 @@ void netlist_t::register_dev(plib::owned_ptr<core_device_t> dev) void netlist_t::remove_dev(core_device_t *dev) { - m_devices.erase( - std::remove_if( - m_devices.begin(), + m_devices.erase( + std::remove_if( + m_devices.begin(), m_devices.end(), - [&] (plib::owned_ptr<core_device_t> const& p) - { - return p.get() == dev; - }), + [&] (plib::owned_ptr<core_device_t> const& p) + { + return p.get() == dev; + }), m_devices.end() - ); + ); } -const logic_family_desc_t *netlist_t::family_from_model(const pstring &model) -{ - model_map_t map; - setup().model_parse(model, map); - - if (setup().model_value_str(map, "TYPE") == "TTL") - return family_TTL(); - if (setup().model_value_str(map, "TYPE") == "CD4XXX") - return family_CD4XXX(); - - for (auto & e : m_family_cache) - if (e.first == model) - return e.second.get(); - - auto ret = plib::make_unique_base<logic_family_desc_t, logic_family_std_proxy_t>(); - - ret->m_fixed_V = setup().model_value(map, "FV"); - ret->m_low_thresh_PCNT = setup().model_value(map, "IVL"); - ret->m_high_thresh_PCNT = setup().model_value(map, "IVH"); - ret->m_low_VO = setup().model_value(map, "OVL"); - ret->m_high_VO = setup().model_value(map, "OVH"); - ret->m_R_low = setup().model_value(map, "ORL"); - ret->m_R_high = setup().model_value(map, "ORH"); - - auto retp = ret.get(); - - m_family_cache.emplace_back(model, std::move(ret)); - - return retp; -} void netlist_t::start() @@ -372,6 +320,7 @@ void netlist_t::start() /* create devices */ + log().debug("Creating devices ...\n"); for (auto & e : setup().m_device_factory) { if ( !setup().factory().is_class<devices::NETLIB_NAME(solver)>(e.second) @@ -394,9 +343,12 @@ void netlist_t::start() auto p = setup().m_param_values.find(d->name() + ".HINT_NO_DEACTIVATE"); if (p != setup().m_param_values.end()) { - //FIXME: Error checking - auto v = p->second.as_long(); - d->set_hint_deactivate(!v); + //FIXME: turn this into a proper function + bool error; + auto v = p->second.as_double(&error); + if (error || std::abs(v - std::floor(v)) > 1e-6 ) + log().fatal(MF_1_HND_VAL_NOT_SUPPORTED, p->second); + d->set_hint_deactivate(v == 0.0); } } else @@ -404,11 +356,30 @@ void netlist_t::start() } pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"})); - m_lib = plib::palloc<plib::dynlib>(libpath); + m_lib = plib::make_unique<plib::dynlib>(libpath); /* resolve inputs */ setup().resolve_inputs(); + /* Make sure devices are fully created - now done in register_dev */ + + log().debug("Setting delegate pointers ...\n"); + for (auto &dev : m_devices) + dev->set_delegate_pointer(); + + log().verbose("looking for two terms connected to rail nets ..."); + for (auto & t : get_device_list<analog::NETLIB_NAME(twoterm)>()) + { + if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) + { + log().warning(MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3, + t->name(), t->m_N.net().name(), t->m_P.net().name()); + t->m_N.net().remove_terminal(t->m_N); + t->m_P.net().remove_terminal(t->m_P); + remove_dev(t); + } + } + log().verbose("initialize solver ...\n"); if (m_solver == nullptr) @@ -420,12 +391,6 @@ void netlist_t::start() else m_solver->post_start(); - /* finally, set the pointers */ - - log().debug("Setting delegate pointers ...\n"); - for (auto &dev : m_devices) - dev->set_delegate_pointer(); - } void netlist_t::stop() @@ -433,7 +398,8 @@ void netlist_t::stop() log().debug("Printing statistics ...\n"); print_stats(); log().debug("Stopping solver device ...\n"); - m_solver->stop(); + if (m_solver != nullptr) + m_solver->stop(); } detail::net_t *netlist_t::find_net(const pstring &name) @@ -474,16 +440,16 @@ void netlist_t::reset() dev->update_param(); // Step all devices once ! + /* + * INFO: The order here affects power up of e.g. breakout. However, such + * variations are explicitly stated in the breakout manual. + */ #if 0 for (std::size_t i = 0; i < m_devices.size(); i++) { m_devices[i]->update_dev(); } #else - /* FIXME: this makes breakout attract mode working again. - * It is however not acceptable that this depends on the startup order. - * Best would be, if reset would call update_dev for devices which need it. - */ std::size_t i = m_devices.size(); while (i>0) m_devices[--i]->update_dev(); @@ -495,7 +461,7 @@ void netlist_t::process_queue(const netlist_time &delta) { netlist_time stop(m_time + delta); - m_queue.push(nullptr, stop); + m_queue.push(detail::queue_t::entry_t(stop, nullptr)); m_stat_mainloop.start(); @@ -522,17 +488,20 @@ void netlist_t::process_queue(const netlist_time &delta) while (m_queue.top().m_exec_time > mc_time) { m_time = mc_time; - mc_time += inc; mc_net.toggle_new_Q(); mc_net.update_devs(); + mc_time += inc; } const detail::queue_t::entry_t e(m_queue.pop()); m_time = e.m_exec_time; - if (e.m_object == nullptr) + if (e.m_object != nullptr) + { + e.m_object->update_devs(); + m_perf_out_processed.inc(); + } + else break; - e.m_object->update_devs(); - m_perf_out_processed.inc(); } mc_net.set_time(mc_time); } @@ -599,6 +568,21 @@ void netlist_t::print_stats() const } } +core_device_t *netlist_t::pget_single_device(const pstring classname, bool (*cc)(core_device_t *)) +{ + core_device_t *ret = nullptr; + for (auto &d : m_devices) + { + if (cc(d.get())) + { + if (ret != nullptr) + this->log().fatal(MF_1_MORE_THAN_ONE_1_DEVICE_FOUND, classname); + else + ret = d.get(); + } + } + return ret; +} // ---------------------------------------------------------------------------------------- @@ -610,7 +594,7 @@ core_device_t::core_device_t(netlist_t &owner, const pstring &name) , logic_family_t() , netlist_ref(owner) , m_hint_deactivate(false) -#if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL) +#if (!NL_USE_PMF_VIRTUAL) , m_static_update() #endif { @@ -623,7 +607,7 @@ core_device_t::core_device_t(core_device_t &owner, const pstring &name) , logic_family_t() , netlist_ref(owner.netlist()) , m_hint_deactivate(false) -#if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL) +#if (!NL_USE_PMF_VIRTUAL) , m_static_update() #endif { @@ -639,17 +623,16 @@ core_device_t::~core_device_t() void core_device_t::set_delegate_pointer() { -#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) - void (core_device_t::* pFunc)() = &core_device_t::update; - m_static_update = pFunc; -#elif (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) - void (core_device_t::* pFunc)() = &core_device_t::update; - m_static_update = reinterpret_cast<net_update_delegate>((this->*pFunc)); -#elif (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL) - m_static_update = plib::mfp::get_mfp<net_update_delegate>(&core_device_t::update, this); +#if (!NL_USE_PMF_VIRTUAL) + m_static_update.set_base(&core_device_t::update, this); #endif } +plib::plog_base<NL_DEBUG> &core_device_t::log() +{ + return netlist().log(); +} + // ---------------------------------------------------------------------------------------- // device_t // ---------------------------------------------------------------------------------------- @@ -697,7 +680,7 @@ void device_t::connect(const pstring &t1, const pstring &t2) void device_t::connect_post_start(detail::core_terminal_t &t1, detail::core_terminal_t &t2) { if (!setup().connect(t1, t2)) - netlist().log().fatal(MF_2_ERROR_CONNECTING_1_TO_2, t1.name(), t2.name()); + log().fatal(MF_2_ERROR_CONNECTING_1_TO_2, t1.name(), t2.name()); } @@ -705,9 +688,9 @@ void device_t::connect_post_start(detail::core_terminal_t &t1, detail::core_term // family_setter_t // ----------------------------------------------------------------------------- -detail::family_setter_t::family_setter_t(core_device_t &dev, const char *desc) +detail::family_setter_t::family_setter_t(core_device_t &dev, const pstring desc) { - dev.set_logic_family(dev.netlist().family_from_model(desc)); + dev.set_logic_family(dev.netlist().setup().family_from_model(desc)); } detail::family_setter_t::family_setter_t(core_device_t &dev, const logic_family_desc_t *desc) @@ -719,13 +702,6 @@ detail::family_setter_t::family_setter_t(core_device_t &dev, const logic_family_ // net_t // ---------------------------------------------------------------------------------------- -// FIXME: move somewhere central - -struct do_nothing_deleter{ - template<typename T> void operator()(T*){} -}; - - detail::net_t::net_t(netlist_t &nl, const pstring &aname, core_terminal_t *mr) : object_t(aname) , netlist_ref(nl) @@ -734,10 +710,9 @@ detail::net_t::net_t(netlist_t &nl, const pstring &aname, core_terminal_t *mr) , m_time(*this, "m_time", netlist_time::zero()) , m_active(*this, "m_active", 0) , m_in_queue(*this, "m_in_queue", 2) - , m_railterminal(nullptr) , m_cur_Analog(*this, "m_cur_Analog", 0.0) + , m_railterminal(mr) { - m_railterminal = mr; } detail::net_t::~net_t() @@ -758,7 +733,7 @@ void detail::net_t::inc_active(core_terminal_t &term) NL_NOEXCEPT if (m_time > netlist().time()) { m_in_queue = 1; /* pending */ - netlist().queue().push(this, m_time); + netlist().queue().push(queue_t::entry_t(m_time, this)); } else { @@ -968,16 +943,20 @@ terminal_t::~terminal_t() void terminal_t::schedule_solve() { - // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only. - if (net().solver() != nullptr) - net().solver()->update_forced(); + // Nets may belong to railnets which do not have a solver attached + // FIXME: Enforce that all terminals get connected? + if (this->has_net()) + if (net().solver() != nullptr) + net().solver()->update_forced(); } void terminal_t::schedule_after(const netlist_time &after) { - // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only. - if (net().solver() != nullptr) - net().solver()->update_after(after); + // Nets may belong to railnets which do not have a solver attached + // FIXME: Enforce that all terminals get connected? + if (this->has_net()) + if (net().solver() != nullptr) + net().solver()->update_after(after); } // ---------------------------------------------------------------------------------------- @@ -1037,7 +1016,7 @@ analog_output_t::analog_output_t(core_device_t &dev, const pstring &aname) netlist().m_nets.push_back(plib::owned_ptr<analog_net_t>(&m_my_net, false)); this->set_net(&m_my_net); - net().m_cur_Analog = NL_FCONST(0.0); + //net().m_cur_Analog = NL_FCONST(0.0); netlist().setup().register_term(*this); } @@ -1047,7 +1026,7 @@ analog_output_t::~analog_output_t() void analog_output_t::initial(const nl_double val) { - net().m_cur_Analog = val; + net().set_Q_Analog(val); } // ----------------------------------------------------------------------------- @@ -1133,11 +1112,11 @@ param_double_t::param_double_t(device_t &device, const pstring name, const doubl m_param = device.setup().get_initial_param_val(this->name(),val); netlist().save(*this, m_param, "m_param"); } - +#if 0 param_double_t::~param_double_t() { } - +#endif param_int_t::param_int_t(device_t &device, const pstring name, const int val) : param_t(device, name) { @@ -1145,9 +1124,11 @@ param_int_t::param_int_t(device_t &device, const pstring name, const int val) netlist().save(*this, m_param, "m_param"); } +#if 0 param_int_t::~param_int_t() { } +#endif param_logic_t::param_logic_t(device_t &device, const pstring name, const bool val) : param_t(device, name) @@ -1156,9 +1137,11 @@ param_logic_t::param_logic_t(device_t &device, const pstring name, const bool va netlist().save(*this, m_param, "m_param"); } +#if 0 param_logic_t::~param_logic_t() { } +#endif param_ptr_t::param_ptr_t(device_t &device, const pstring name, uint8_t * val) : param_t(device, name) @@ -1167,13 +1150,15 @@ param_ptr_t::param_ptr_t(device_t &device, const pstring name, uint8_t * val) //netlist().save(*this, m_param, "m_param"); } +#if 0 param_ptr_t::~param_ptr_t() { } +#endif void param_model_t::changed() { - netlist().log().fatal("Models can not be changed at runtime"); + netlist().log().fatal(MF_1_MODEL_1_CAN_NOT_BE_CHANGED_AT_RUNTIME, name()); m_map.clear(); } @@ -1200,8 +1185,6 @@ std::unique_ptr<plib::pistream> param_data_t::stream() return device().netlist().setup().get_data_stream(Value()); } - - namespace devices { // ---------------------------------------------------------------------------------------- diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 171a81292ae..e56a10b9e20 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -9,27 +9,27 @@ #ifndef NLBASE_H_ #define NLBASE_H_ -#include <vector> -#include <unordered_map> -#include <memory> -//#include <cmath> -#include <cstdint> - #include "nl_lists.h" #include "nl_time.h" -#include "plib/palloc.h" +#include "plib/palloc.h" // owned_ptr #include "plib/pdynlib.h" #include "plib/pstate.h" #include "plib/pfmtlog.h" #include "plib/pstream.h" -#include "plib/pexception.h" +#include "plib/ppmf.h" + +#include <unordered_map> + +#ifdef NL_PROHIBIT_BASEH_INCLUDE +#error "nl_base.h included. Please correct." +#endif // ---------------------------------------------------------------------------------------- // Type definitions // ---------------------------------------------------------------------------------------- /*! netlist_sig_t is the type used for logic signals. */ -using netlist_sig_t = std::uint_least32_t; +using netlist_sig_t = std::uint32_t; //============================================================ // MACROS / New Syntax @@ -85,18 +85,26 @@ class NETLIB_NAME(name) : public device_t : device_t(owner, name) /*! Add this to a device definition to mark the device as dynamic. - * If this is added to device definition the device is treated as an analog - * dynamic device, i.e. #NETLIB_UPDATE_TERMINALSI is called on a each step - * of the Newton-Raphson step of solving the linear equations. + * If NETLIB_IS_DYNAMIC(true) is added to the device definition the device + * is treated as an analog dynamic device, i.e. #NETLIB_UPDATE_TERMINALSI + * is called on a each step of the Newton-Raphson step + * of solving the linear equations. + * + * You may also use e.g. NETLIB_IS_DYNAMIC(m_func() != "") to only make the + * device a dynamic device if parameter m_func is set. */ -#define NETLIB_IS_DYNAMIC() \ - public: virtual bool is_dynamic() const override { return true; } +#define NETLIB_IS_DYNAMIC(expr) \ + public: virtual bool is_dynamic() const override { return expr; } /*! Add this to a device definition to mark the device as a time-stepping device. - * + * * You have to implement NETLIB_TIMESTEP in this case as well. Currently, only * the capacitor and inductor devices uses this. * + * You may also use e.g. NETLIB_IS_TIMESTEP(m_func() != "") to only make the + * device a dynamic device if parameter m_func is set. This is used by the + * Voltage Source element. + * * Example: * * NETLIB_TIMESTEP_IS_TIMESTEP() @@ -109,8 +117,8 @@ class NETLIB_NAME(name) : public device_t * } * */ -#define NETLIB_IS_TIMESTEP() \ - public: virtual bool is_timestep() const override { return true; } +#define NETLIB_IS_TIMESTEP(expr) \ + public: virtual bool is_timestep() const override { return expr; } /*! Used to implement the time stepping code. * @@ -220,11 +228,6 @@ namespace netlist class core_device_t; class device_t; - /*! Type of the model map used. - * This is used to hold all #Models in an unordered map - */ - using model_map_t = std::unordered_map<pstring, pstring>; - /*! Logic families descriptors are used to create proxy devices. * The logic family describes the analog capabilities of logic devices, * inputs and outputs. @@ -248,7 +251,7 @@ namespace netlist double R_low() const { return m_R_low; } double R_high() const { return m_R_high; } - double m_fixed_V; //!< For variable voltage families, specify 0. For TTL this would be 5. */ + double m_fixed_V; //!< For variable voltage families, specify 0. For TTL this would be 5. */ double m_low_thresh_PCNT; //!< low input threshhold offset. If the input voltage is below this value times supply voltage, a "0" input is signalled double m_high_thresh_PCNT; //!< high input threshhold offset. If the input voltage is above the value times supply voltage, a "0" input is signalled double m_low_VO; //!< low output voltage offset. This voltage is output if the ouput is "0" @@ -273,12 +276,12 @@ namespace netlist public: logic_family_t() : m_logic_family(nullptr) {} - ~logic_family_t() { } const logic_family_desc_t *logic_family() const { return m_logic_family; } void set_logic_family(const logic_family_desc_t *fam) { m_logic_family = fam; } protected: + ~logic_family_t() { } // prohibit polymorphic destruction const logic_family_desc_t *m_logic_family; }; @@ -313,19 +316,15 @@ namespace netlist //! Move Constructor. state_var(state_var &&rhs) NL_NOEXCEPT = default; //! Assignment operator to assign value of a state var. - state_var &operator=(state_var rhs) { std::swap(rhs.m_value, this->m_value); return *this; } + state_var &operator=(const state_var &rhs) { m_value = rhs; return *this; } //! Assignment operator to assign value of type T. - state_var &operator=(const T rhs) { m_value = rhs; return *this; } + state_var &operator=(const T &rhs) { m_value = rhs; return *this; } //! Return value of state variable. operator T & () { return m_value; } - //! Return value of state variable. - T & operator()() { return m_value; } //! Return const value of state variable. - operator const T & () const { return m_value; } - //! Return const value of state variable. - const T & operator()() const { return m_value; } + constexpr operator const T & () const { return m_value; } T * ptr() { return &m_value; } - const T * ptr() const { return &m_value; } + constexpr T * ptr() const { return &m_value; } private: T m_value; }; @@ -338,13 +337,20 @@ namespace netlist struct state_var<T[N]> { public: - state_var(device_t &dev, const pstring name, const T & value); + //! Constructor. + template <typename O> + state_var(O &owner, //!< owner must have a netlist() method. + const pstring name, //!< identifier/name for this state variable + const T &value //!< Initial value after construction + ); + //! Copy Constructor. state_var(const state_var &rhs) NL_NOEXCEPT = default; + //! Move Constructor. state_var(state_var &&rhs) NL_NOEXCEPT = default; - state_var &operator=(const state_var rhs) { m_value = rhs.m_value; return *this; } - state_var &operator=(const T rhs) { m_value = rhs; return *this; } + state_var &operator=(const state_var &rhs) { m_value = rhs.m_value; return *this; } + state_var &operator=(const T &rhs) { m_value = rhs; return *this; } T & operator[](const std::size_t i) { return m_value[i]; } - const T & operator[](const std::size_t i) const { return m_value[i]; } + constexpr T & operator[](const std::size_t i) const { return m_value[i]; } private: T m_value[N]; }; @@ -376,7 +382,6 @@ namespace netlist */ class detail::object_t { - P_PREVENT_COPYING(object_t) public: /*! Constructor. @@ -384,7 +389,6 @@ namespace netlist * Every class derived from the object_t class must have a name. */ object_t(const pstring &aname /*!< string containing name of the object */); - virtual ~object_t(); /*! return name of the object * @@ -396,6 +400,8 @@ namespace netlist void operator delete (void *ptr, void *) { } void * operator new (size_t size); void operator delete (void * mem); + protected: + ~object_t(); // only childs should be destructible private: pstring m_name; @@ -404,11 +410,13 @@ namespace netlist struct detail::netlist_ref { netlist_ref(netlist_t &nl) : m_netlist(nl) { } - ~netlist_ref() {} netlist_t & netlist() { return m_netlist; } const netlist_t & netlist() const { return m_netlist; } + protected: + ~netlist_ref() {} // prohibit polymorphic destruction + private: netlist_t & m_netlist; @@ -425,16 +433,7 @@ namespace netlist */ class detail::device_object_t : public detail::object_t { - P_PREVENT_COPYING(device_object_t) public: - /*! Enum specifying the type of object */ - enum type_t { - TERMINAL = 0, /*!< object is an analog terminal */ - INPUT = 1, /*!< object is an input */ - OUTPUT = 2, /*!< object is an output */ - PARAM = 3, /*!< object is a parameter */ - }; - /*! Constructor. * * \param dev device owning the object. @@ -446,16 +445,6 @@ namespace netlist */ core_device_t &device() const { return m_device; } - /*! The object type. - * \returns type of the object - */ - type_t type() const; - /*! Checks if object is of specified type. - * \param atype type to check object against. - * \returns true if object is of specified type else false. - */ - bool is_type(const type_t atype) const { return (type() == atype); } - /*! The netlist owning the owner of this object. * \returns reference to netlist object. */ @@ -478,7 +467,6 @@ namespace netlist */ class detail::core_terminal_t : public device_object_t, public plib::linkedlist_t<core_terminal_t>::element_t { - P_PREVENT_COPYING(core_terminal_t) public: using list_t = std::vector<core_terminal_t *>; @@ -495,6 +483,16 @@ namespace netlist core_terminal_t(core_device_t &dev, const pstring &aname, const state_e state); virtual ~core_terminal_t(); + /*! The object type. + * \returns type of the object + */ + terminal_type type() const; + /*! Checks if object is of specified type. + * \param atype type to check object against. + * \returns true if object is of specified type else false. + */ + bool is_type(const terminal_type atype) const { return (type() == atype); } + void set_net(net_t *anet); void clear_net(); bool has_net() const { return (m_net != nullptr); } @@ -540,7 +538,6 @@ namespace netlist class terminal_t : public analog_t { - P_PREVENT_COPYING(terminal_t) public: terminal_t(core_device_t &dev, const pstring &aname); @@ -550,16 +547,12 @@ namespace netlist void set(const nl_double G) { - set_ptr(m_Idr1, 0); - set_ptr(m_go1, G); - set_ptr(m_gt1, G); + set(G,G, 0.0); } void set(const nl_double GO, const nl_double GT) { - set_ptr(m_Idr1, 0); - set_ptr(m_go1, GO); - set_ptr(m_gt1, GT); + set(GO, GT, 0.0); } void set(const nl_double GO, const nl_double GT, const nl_double I) @@ -690,7 +683,6 @@ namespace netlist public detail::object_t, public detail::netlist_ref { - P_PREVENT_COPYING(net_t) public: net_t(netlist_t &nl, const pstring &aname, core_terminal_t *mr = nullptr); @@ -698,12 +690,6 @@ namespace netlist void reset(); - void add_terminal(core_terminal_t &terminal); - void remove_terminal(core_terminal_t &terminal); - - bool is_logic() const NL_NOEXCEPT; - bool is_analog() const NL_NOEXCEPT; - void toggle_new_Q() { m_new_Q ^= 1; } void force_queue_execution() { m_new_Q = (m_cur_Q ^ 1); } @@ -724,6 +710,14 @@ namespace netlist void inc_active(core_terminal_t &term) NL_NOEXCEPT; void dec_active(core_terminal_t &term) NL_NOEXCEPT; + /* setup stuff */ + + void add_terminal(core_terminal_t &terminal); + void remove_terminal(core_terminal_t &terminal); + + bool is_logic() const NL_NOEXCEPT; + bool is_analog() const NL_NOEXCEPT; + void rebuild_list(); /* rebuild m_list after a load */ void move_connections(net_t &dest_net); @@ -737,26 +731,25 @@ namespace netlist state_var_s32 m_active; state_var_u8 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ + state_var<nl_double> m_cur_Analog; + private: plib::linkedlist_t<core_terminal_t> m_list_active; core_terminal_t * m_railterminal; public: - // FIXME: Have to fix the public at some time - state_var<nl_double> m_cur_Analog; }; class logic_net_t : public detail::net_t { - P_PREVENT_COPYING(logic_net_t) public: logic_net_t(netlist_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr); virtual ~logic_net_t(); netlist_sig_t Q() const { return m_cur_Q; } - netlist_sig_t new_Q() const { return m_new_Q; } + netlist_sig_t new_Q() const { return m_new_Q; } void initial(const netlist_sig_t val) { m_cur_Q = m_new_Q = val; } void set_Q(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT @@ -781,7 +774,7 @@ namespace netlist /* internal state support * FIXME: get rid of this and implement export/import in MAME */ - netlist_sig_t &Q_state_ptr() { return m_cur_Q; } + netlist_sig_t *Q_state_ptr() { return m_cur_Q.ptr(); } protected: private: @@ -790,7 +783,6 @@ namespace netlist class analog_net_t : public detail::net_t { - P_PREVENT_COPYING(analog_net_t) public: using list_t = std::vector<analog_net_t *>; @@ -800,7 +792,8 @@ namespace netlist virtual ~analog_net_t(); nl_double Q_Analog() const { return m_cur_Analog; } - nl_double &Q_Analog_state_ptr() { return m_cur_Analog; } + void set_Q_Analog(const nl_double &v) { m_cur_Analog = v; } + nl_double *Q_Analog_state_ptr() { return m_cur_Analog.ptr(); } //FIXME: needed by current solver code devices::matrix_solver_t *solver() const { return m_solver; } @@ -816,7 +809,6 @@ namespace netlist class logic_output_t : public logic_t { - P_PREVENT_COPYING(logic_output_t) public: logic_output_t(core_device_t &dev, const pstring &aname); @@ -835,7 +827,6 @@ namespace netlist class analog_output_t : public analog_t { - P_PREVENT_COPYING(analog_output_t) public: analog_output_t(core_device_t &dev, const pstring &aname); virtual ~analog_output_t(); @@ -854,7 +845,6 @@ namespace netlist class param_t : public detail::device_object_t { - P_PREVENT_COPYING(param_t) public: enum param_type_t { @@ -866,11 +856,12 @@ namespace netlist }; param_t(device_t &device, const pstring &name); - virtual ~param_t(); param_type_t param_type() const; protected: + virtual ~param_t(); /* not intended to be destroyed */ + void update_param(); template<typename C> @@ -889,7 +880,6 @@ namespace netlist { public: param_ptr_t(device_t &device, const pstring name, std::uint8_t* val); - virtual ~param_ptr_t(); std::uint8_t * operator()() const { return m_param; } void setTo(std::uint8_t *param) { set(m_param, param); } private: @@ -900,7 +890,6 @@ namespace netlist { public: param_logic_t(device_t &device, const pstring name, const bool val); - virtual ~param_logic_t(); bool operator()() const { return m_param; } void setTo(const bool ¶m) { set(m_param, param); } private: @@ -911,7 +900,6 @@ namespace netlist { public: param_int_t(device_t &device, const pstring name, const int val); - virtual ~param_int_t(); int operator()() const { return m_param; } void setTo(const int ¶m) { set(m_param, param); } private: @@ -922,7 +910,6 @@ namespace netlist { public: param_double_t(device_t &device, const pstring name, const double val); - virtual ~param_double_t(); double operator()() const { return m_param; } void setTo(const double ¶m) { set(m_param, param); } private: @@ -934,6 +921,7 @@ namespace netlist public: param_str_t(device_t &device, const pstring name, const pstring val); virtual ~param_str_t(); + const pstring operator()() const { return Value(); } void setTo(const pstring ¶m) { @@ -981,8 +969,8 @@ namespace netlist private: /* hide this */ void setTo(const pstring ¶m) = delete; - model_map_t m_map; - }; + detail::model_map_t m_map; +}; class param_data_t : public param_str_t @@ -996,6 +984,28 @@ namespace netlist }; // ----------------------------------------------------------------------------- + // rom parameter + // ----------------------------------------------------------------------------- + + template <typename ST, std::size_t AW, std::size_t DW> + class param_rom_t final: public param_data_t + { + public: + + param_rom_t(device_t &device, const pstring name); + + const ST & operator[] (std::size_t n) { return m_data[n]; } + protected: + virtual void changed() override + { + stream()->read(&m_data[0],1<<AW); + } + + private: + ST m_data[1 << AW]; + }; + + // ----------------------------------------------------------------------------- // core_device_t // ----------------------------------------------------------------------------- @@ -1004,7 +1014,6 @@ namespace netlist public logic_family_t, public detail::netlist_ref { - P_PREVENT_COPYING(core_device_t) public: core_device_t(netlist_t &owner, const pstring &name); core_device_t(core_device_t &owner, const pstring &name); @@ -1052,15 +1061,15 @@ namespace netlist void do_update() NL_NOEXCEPT { - #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) - (this->*m_static_update)(); - #elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) - m_static_update(this); + #if (NL_USE_PMF_VIRTUAL) + update(); #else - update(); + m_static_update.call(this); #endif } + plib::plog_base<NL_DEBUG> &log(); + public: virtual void timestep(ATTR_UNUSED const nl_double st) { } virtual void update_terminals() { } @@ -1072,14 +1081,9 @@ namespace netlist private: bool m_hint_deactivate; - #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) - typedef void (core_device_t::*net_update_delegate)(); - #elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) - using net_update_delegate = MEMBER_ABI void (*)(core_device_t *); - #endif - #if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL) - net_update_delegate m_static_update; + #if (!NL_USE_PMF_VIRTUAL) + plib::pmfp_base<void> m_static_update; #endif }; @@ -1089,7 +1093,6 @@ namespace netlist class device_t : public core_device_t { - P_PREVENT_COPYING(device_t) public: template <class C> @@ -1103,7 +1106,7 @@ namespace netlist template<class C, typename... Args> void register_sub(const pstring &name, std::unique_ptr<C> &dev, const Args&... args) { - dev.reset(new C(*this, name, args...)); + dev.reset(plib::palloc<C>(*this, name, args...)); } void register_subalias(const pstring &name, detail::core_terminal_t &term); @@ -1127,7 +1130,7 @@ namespace netlist struct detail::family_setter_t { family_setter_t() { } - family_setter_t(core_device_t &dev, const char *desc); + family_setter_t(core_device_t &dev, const pstring desc); family_setter_t(core_device_t &dev, const logic_family_desc_t *desc); }; @@ -1171,9 +1174,8 @@ namespace netlist // ----------------------------------------------------------------------------- - class netlist_t : public plib::plog_dispatch_intf + class netlist_t : public plib::plog_dispatch_intf, private plib::nocopyassignmove { - P_PREVENT_COPYING(netlist_t) public: explicit netlist_t(const pstring &aname); @@ -1207,7 +1209,6 @@ namespace netlist void remove_dev(core_device_t *dev); detail::net_t *find_net(const pstring &name); - const logic_family_desc_t *family_from_model(const pstring &model); template<class device_class> std::vector<device_class *> get_device_list() @@ -1222,22 +1223,16 @@ namespace netlist return tmp; } - template<class device_class> - device_class *get_single_device(const char *classname) + template<class C> + static bool check_class(core_device_t *p) { - device_class *ret = nullptr; - for (auto &d : m_devices) - { - device_class *dev = dynamic_cast<device_class *>(d.get()); - if (dev != nullptr) - { - if (ret != nullptr) - this->log().fatal("more than one {1} device found", classname); - else - ret = dev; - } - } - return ret; + return dynamic_cast<C *>(p) != nullptr; + } + + template<class C> + C *get_single_device(const pstring classname) + { + return dynamic_cast<C *>(pget_single_device(classname, check_class<C>)); } /* logging and name */ @@ -1252,24 +1247,34 @@ namespace netlist template<typename O, typename C> void save(O &owner, C &state, const pstring &stname) { - this->state().save_item(static_cast<void *>(&owner), state, owner.name() + pstring(".") + stname); + this->state().save_item(static_cast<void *>(&owner), state, from_utf8(owner.name()) + pstring(".") + stname); } template<typename O, typename C> void save(O &owner, C *state, const pstring &stname, const std::size_t count) { - this->state().save_state_ptr(static_cast<void *>(&owner), owner.name() + pstring(".") + stname, plib::state_manager_t::datatype_f<C>::f(), count, state); + this->state().save_state_ptr(static_cast<void *>(&owner), from_utf8(owner.name()) + pstring(".") + stname, plib::state_manager_t::datatype_f<C>::f(), count, state); } void rebuild_lists(); /* must be called after post_load ! */ plib::dynlib &lib() { return *m_lib; } + // FIXME: find something better /* sole use is to manage lifetime of net objects */ std::vector<plib::owned_ptr<detail::net_t>> m_nets; + /* sole use is to manage lifetime of family objects */ + std::vector<std::pair<pstring, std::unique_ptr<logic_family_desc_t>>> m_family_cache; protected: void print_stats() const; private: + + /* helper for save above */ + static pstring from_utf8(const char *c) { return pstring(c, pstring::UTF8); } + static pstring from_utf8(const pstring &c) { return c; } + + core_device_t *pget_single_device(const pstring classname, bool (*cc)(core_device_t *)); + /* mostly rw */ netlist_time m_time; detail::queue_t m_queue; @@ -1281,21 +1286,17 @@ namespace netlist devices::NETLIB_NAME(netlistparams) *m_params; pstring m_name; - setup_t * m_setup; + std::unique_ptr<setup_t> m_setup; plib::plog_base<NL_DEBUG> m_log; - plib::dynlib * m_lib; // external lib needs to be loaded as long as netlist exists + std::unique_ptr<plib::dynlib> m_lib; // external lib needs to be loaded as long as netlist exists plib::state_manager_t m_state; // performance nperftime_t m_stat_mainloop; nperfcount_t m_perf_out_processed; - nperfcount_t m_perf_inp_processed; - nperfcount_t m_perf_inp_active; std::vector<plib::owned_ptr<core_device_t>> m_devices; - /* sole use is to manage lifetime of family objects */ - std::vector<std::pair<pstring, std::unique_ptr<logic_family_desc_t>>> m_family_cache; }; // ----------------------------------------------------------------------------- @@ -1313,43 +1314,24 @@ namespace netlist object_array_t(core_device_t &dev, init names) { for (std::size_t i = 0; i<N; i++) - this->emplace(i, dev, names.p[i]); + this->emplace(i, dev, pstring(names.p[i], pstring::UTF8)); } }; // ----------------------------------------------------------------------------- - // rom parameter + // inline implementations // ----------------------------------------------------------------------------- template <typename ST, std::size_t AW, std::size_t DW> - class param_rom_t final: public param_data_t + inline param_rom_t<ST, AW, DW>::param_rom_t(device_t &device, const pstring name) + : param_data_t(device, name) { - public: - - param_rom_t(device_t &device, const pstring name) - : param_data_t(device, name) - { - auto f = stream(); - if (f != nullptr) - f->read(&m_data[0],1<<AW); - else - device.netlist().log().warning("Rom {1} not found", Value()); - } - - const ST & operator[] (std::size_t n) { return m_data[n]; } - - protected: - virtual void changed() override - { - stream()->read(&m_data[0],1<<AW); - } - private: - ST m_data[1 << AW]; - }; - - // ----------------------------------------------------------------------------- - // inline implementations - // ----------------------------------------------------------------------------- + auto f = stream(); + if (f != nullptr) + f->read(&m_data[0],1<<AW); + else + device.netlist().log().warning("Rom {1} not found", Value()); + } inline bool detail::core_terminal_t::is_logic() const NL_NOEXCEPT { @@ -1414,7 +1396,7 @@ namespace netlist m_time = netlist().time() + delay; m_in_queue = (m_active > 0); /* queued ? */ if (m_in_queue) - netlist().queue().push(this, m_time); + netlist().queue().push(queue_t::entry_t(m_time, this)); } } @@ -1426,7 +1408,7 @@ namespace netlist m_time = netlist().time() + delay; m_in_queue = (m_active > 0); /* queued ? */ if (m_in_queue) - netlist().queue().push(this, m_time); + netlist().queue().push(queue_t::entry_t(m_time, this)); } inline const analog_net_t & analog_t::net() const NL_NOEXCEPT @@ -1443,7 +1425,7 @@ namespace netlist inline logic_net_t & logic_t::net() NL_NOEXCEPT { - return *static_cast<logic_net_t *>(&core_terminal_t::net()); + return static_cast<logic_net_t &>(core_terminal_t::net()); } inline const logic_net_t & logic_t::net() const NL_NOEXCEPT @@ -1465,7 +1447,7 @@ namespace netlist { if (newQ != m_my_net.Q_Analog()) { - m_my_net.m_cur_Analog = newQ; + m_my_net.set_Q_Analog(newQ); m_my_net.toggle_new_Q(); m_my_net.push_to_queue(NLTIME_FROM_NS(1)); } @@ -1480,9 +1462,10 @@ namespace netlist } template <typename T, std::size_t N> - state_var<T[N]>::state_var(device_t &dev, const pstring name, const T & value) + template <typename O> + state_var<T[N]>::state_var(O &owner, const pstring name, const T & value) { - dev.netlist().save(dev, m_value, name); + owner.netlist().save(owner, m_value, name); for (std::size_t i=0; i<N; i++) m_value[i] = value; } @@ -1499,5 +1482,14 @@ namespace netlist } +namespace plib +{ + template<typename X> + struct ptype_traits<netlist::state_var<X>> : ptype_traits<X> + { + }; +} + + #endif /* NLBASE_H_ */ diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h index 88f240394be..ded567717f9 100644 --- a/src/lib/netlist/nl_config.h +++ b/src/lib/netlist/nl_config.h @@ -9,68 +9,12 @@ #ifndef NLCONFIG_H_ #define NLCONFIG_H_ -#include <cstdint> - #include "plib/pconfig.h" -#include "plib/pchrono.h" //============================================================ // SETUP //============================================================ -/* - * The following options determine how object::update is called. - * NL_PMF_TYPE_VIRTUAL - * Use stock virtual call - * - * NL_PMF_TYPE_GNUC_PMF - * Use standard pointer to member function syntax - * - * NL_PMF_TYPE_GNUC_PMF_CONV - * Use gnu extension and convert the pmf to a function pointer. - * This is not standard compliant and needs - * -Wno-pmf-conversions to compile. - * - * NL_PMF_TYPE_INTERNAL - * Use the same approach as MAME for deriving the function pointer. - * This is compiler-dependant as well - * - * Benchmarks for ./nltool -c run -f src/mame/drivers/nl_pong.c -t 10 -n pong_fast - * - * NL_PMF_TYPE_INTERNAL: 215% - * NL_PMF_TYPE_GNUC_PMF: 163% - * NL_PMF_TYPE_GNUC_PMF_CONV: 215% - * NL_PMF_TYPE_VIRTUAL: 213% - * - * The whole exercise was done to avoid virtual calls. In prior versions of - * netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement. - * Since than, was removed from functions declared as virtual. - * This may explain that the recent benchmarks show no difference at all. - * - * Disappointing is the GNUC_PMF performance. - */ - -// This will be autodetected -// #define NL_PMF_TYPE 0 - -#define NL_PMF_TYPE_VIRTUAL 0 -#define NL_PMF_TYPE_GNUC_PMF 1 -#define NL_PMF_TYPE_GNUC_PMF_CONV 2 -#define NL_PMF_TYPE_INTERNAL 3 - -#ifndef NL_PMF_TYPE - #if PHAS_PMF_INTERNAL - #define NL_PMF_TYPE NL_PMF_TYPE_INTERNAL - #else - #define NL_PMF_TYPE NL_PMF_TYPE_VIRTUAL - #endif -#endif - -#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) -#pragma GCC diagnostic ignored "-Wpmf-conversions" -#endif - - //============================================================ // GENERAL @@ -86,8 +30,12 @@ * */ #define USE_MEMPOOL (0) + #define USE_TRUTHTABLE (1) +// How many times do we try to resolve links (connections) +#define NL_MAX_LINK_RESOLVE_LOOPS (100) + //============================================================ // Solver defines //============================================================ @@ -120,20 +68,6 @@ #endif //============================================================ -// Performance tracking -//============================================================ - -namespace netlist -{ -#if NL_KEEP_STATISTICS -using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, true>; -using nperfcount_t = plib::chrono::counter<true>; -#else -using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, false>; -using nperfcount_t = plib::chrono::counter<false>; -#endif -} -//============================================================ // General //============================================================ @@ -156,6 +90,20 @@ using nperfcount_t = plib::chrono::counter<false>; #define NL_FCONST(x) x using nl_double = double; +/* The following option determines how object::update is called. + * If set to 1, a virtual call is used. If it is left undefined, the best + * approach will be automatically selected. + */ + +//#define NL_USE_PMF_VIRTUAL 1 + +#ifndef NL_USE_PMF_VIRTUAL + #if PPMF_TYPE == PPMF_TYPE_PMF + #define NL_USE_PMF_VIRTUAL 1 + #else + #define NL_USE_PMF_VIRTUAL 0 + #endif +#endif //============================================================ // WARNINGS diff --git a/src/lib/netlist/nl_dice_compat.h b/src/lib/netlist/nl_dice_compat.h index 209f18d82af..b0ebdb2e371 100644 --- a/src/lib/netlist/nl_dice_compat.h +++ b/src/lib/netlist/nl_dice_compat.h @@ -27,8 +27,11 @@ sed -e 's/#define \(.*\)"\(.*\)"[ \t]*,[ \t]*\(.*\)/NET_ALIAS(\1,\2.\3)/' src/ma #ifndef NL_CONVERT_CPP #include "devices/net_lib.h" #include "analog/nld_twoterm.h" + +#include <cmath> #endif + /* -------------------------------------------------------------------- * Compatibility macros for DICE netlists ... * -------------------------------------------------------------------- */ diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index 563e33dd93f..ec52187558f 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -11,18 +11,92 @@ // nl_base.cpp -#define MF_1_DUPLICATE_NAME_DEVICE_LIST "Error adding {1} to device list. Duplicate name." -#define MF_1_UNKNOWN_TYPE_FOR_OBJECT "Unknown type for object {1} " -#define MF_2_NET_1_DUPLICATE_TERMINAL_2 "net {1}: duplicate terminal {2}" -#define MF_2_REMOVE_TERMINAL_1_FROM_NET_2 "Can not remove terminal {1} from net {2}." -#define MF_1_UNKNOWN_PARAM_TYPE "Can not determine param_type for {1}" -#define MF_2_ERROR_CONNECTING_1_TO_2 "Error connecting {1} to {2}" -#define MF_0_NO_SOLVER "No solver found for this netlist although analog elements are present\n" +#define MF_1_DUPLICATE_NAME_DEVICE_LIST "Error adding {1} to device list. Duplicate name." +#define MF_1_UNKNOWN_TYPE_FOR_OBJECT "Unknown type for object {1} " +#define MF_2_NET_1_DUPLICATE_TERMINAL_2 "net {1}: duplicate terminal {2}" +#define MF_2_REMOVE_TERMINAL_1_FROM_NET_2 "Can not remove terminal {1} from net {2}." +#define MF_1_UNKNOWN_PARAM_TYPE "Can not determine param_type for {1}" +#define MF_2_ERROR_CONNECTING_1_TO_2 "Error connecting {1} to {2}" +#define MF_0_NO_SOLVER "No solver found for this netlist although analog elements are present" +#define MF_1_HND_VAL_NOT_SUPPORTED "HINT_NO_DEACTIVATE value not supported: <{1}>" // nl_factory.cpp -#define MF_1_FACTORY_ALREADY_CONTAINS_1 "factory already contains {1}" +#define MF_1_FACTORY_ALREADY_CONTAINS_1 "factory already contains {1}" #define MF_1_CLASS_1_NOT_FOUND "Class <{1}> not found!" +// nld_opamps.cpp -#endif /* NLBASE_H_ */ +#define MF_1_UNKNOWN_OPAMP_TYPE "Unknown opamp type: {1}" + +// nld_matrix_solver.cpp + +#define MF_1_UNHANDLED_ELEMENT_1_FOUND "setup_base:unhandled element <{1}> found" +#define MF_1_FOUND_TERM_WITH_MISSING_OTHERNET "found term with missing othernet {1}" + +#define MW_1_NEWTON_LOOPS_EXCEEDED_ON_NET_1 "NEWTON_LOOPS exceeded on net {1}... reschedule" + +// nld_solver.cpp + +#define MF_1_UNKNOWN_SOLVER_TYPE "Unknown solver type: {1}" +#define MF_1_NETGROUP_SIZE_EXCEEDED_1 "Encountered netgroup with > {1} nets" + +#define MW_1_NO_SPECIFIC_SOLVER "No specific solver found for netlist of size {1}" + +// nl_base.cpp + +#define MF_1_MODEL_1_CAN_NOT_BE_CHANGED_AT_RUNTIME "Model {1} can not be changed at runtime" +#define MF_1_MORE_THAN_ONE_1_DEVICE_FOUND "more than one {1} device found" + +// nl_parser.cpp + +#define MF_0_UNEXPECTED_NETLIST_END "Unexpected NETLIST_END" +#define MF_0_UNEXPECTED_NETLIST_START "Unexpected NETLIST_START" + +// nl_setup.cpp + +//#define MF_1_CLASS_1_NOT_FOUND "Class {1} not found!" +#define MF_1_UNABLE_TO_PARSE_MODEL_1 "Unable to parse model: {1}" +#define MF_1_MODEL_ALREADY_EXISTS_1 "Model already exists: {1}" +#define MF_1_ADDING_ALIAS_1_TO_ALIAS_LIST "Error adding alias {1} to alias list" +#define MF_1_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1 "You must pass an equal number of pins to DIPPINS {1}" +#define MF_1_UNKNOWN_OBJECT_TYPE_1 "Unknown object type {1}" +#define MF_2_INVALID_NUMBER_CONVERSION_1_2 "Invalid number conversion {1} : {2}" +#define MF_1_ADDING_PARAMETER_1_TO_PARAMETER_LIST "Error adding parameter {1} to parameter list" +#define MF_2_ADDING_1_2_TO_TERMINAL_LIST "Error adding {1} {2} to terminal list" +#define MF_2_NET_C_NEEDS_AT_LEAST_2_TERMINAL "You must pass at least 2 terminals to NET_C" +#define MF_1_FOUND_NO_OCCURRENCE_OF_1 "Found no occurrence of {1}" +#define MF_2_TERMINAL_1_2_NOT_FOUND "Alias {1} was resolved to be terminal {2}. Terminal {2} was not found." +#define MF_2_OBJECT_1_2_WRONG_TYPE "object {1}({2}) found but wrong type" +#define MF_2_PARAMETER_1_2_NOT_FOUND "parameter {1}({2}) not found!" +#define MF_2_CONNECTING_1_TO_2 "Error connecting {1} to {2}" +#define MF_2_MERGE_RAIL_NETS_1_AND_2 "Trying to merge two rail nets: {1} and {2}" +#define MF_1_OBJECT_INPUT_TYPE_1 "Unable to determine input type of {1}" +#define MF_1_OBJECT_OUTPUT_TYPE_1 "Unable to determine output type of {1}" +#define MF_1_INPUT_1_ALREADY_CONNECTED "Input {1} already connected" +#define MF_0_LINK_TRIES_EXCEEDED "Error connecting -- bailing out" +#define MF_1_MODEL_NOT_FOUND "Model {1} not found" +#define MF_1_MODEL_ERROR_1 "Model error {1}" +#define MF_1_MODEL_ERROR_ON_PAIR_1 "Model error on pair {1}" +#define MF_2_MODEL_PARAMETERS_NOT_UPPERCASE_1_2 "model parameters should be uppercase:{1} {2}" +#define MF_2_ENTITY_1_NOT_FOUND_IN_MODEL_2 "Entity {1} not found in model {2}" +#define MF_1_UNKNOWN_NUMBER_FACTOR_IN_1 "Unknown number factor in: {1}" +#define MF_1_NOT_FOUND_IN_SOURCE_COLLECTION "unable to find {1} in source collection" + +#define MW_3_OVERWRITING_PARAM_1_OLD_2_NEW_3 "Overwriting {1} old <{2}> new <{3}>" +#define MW_1_CONNECTING_1_TO_ITSELF "Connecting {1} to itself. This may be right, though" +#define MW_1_DUMMY_1_WITHOUT_CONNECTIONS "Found dummy terminal {1} without connections" +#define MW_1_TERMINAL_1_WITHOUT_CONNECTIONS "Found terminal {1} without connections" +#define MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3 "Found device {1} connected only to railterminals {2}/{3}. Will be removed" +#define MW_1_DATA_1_NOT_FOUND "unable to find data named {1} in source collection" + +// nld_mm5837.cpp + +#define MW_1_FREQUENCY_OUTSIDE_OF_SPECS_1 "MM5837: Frequency outside of specs: {1}" + +// nlid_proxy.cpp + +#define MW_1_NO_POWER_TERMINALS_ON_DEVICE_1 "D/A Proxy: Found no valid combination of power terminals on device {1}" + + +#endif /* NL_ERRSTR_H_ */ diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp index 50dc2ef9c8d..2ab15375d62 100644 --- a/src/lib/netlist/nl_factory.cpp +++ b/src/lib/netlist/nl_factory.cpp @@ -9,6 +9,7 @@ ****************************************************************************/ #include "nl_factory.h" +#include "nl_base.h" #include "nl_setup.h" #include "plib/putil.h" #include "nl_errstr.h" @@ -16,9 +17,31 @@ namespace netlist { namespace factory { +class NETLIB_NAME(wrapper) : public device_t +{ +public: + NETLIB_NAME(wrapper)(netlist_t &anetlist, const pstring &name) + : device_t(anetlist, name) + { + } +protected: + NETLIB_RESETI(); + NETLIB_UPDATEI(); +}; + + + +element_t::element_t(const pstring &name, const pstring &classname, + const pstring &def_param, const pstring &sourcefile) + : m_name(name), m_classname(classname), m_def_param(def_param), + m_sourcefile(sourcefile) +{ +} + element_t::element_t(const pstring &name, const pstring &classname, const pstring &def_param) - : m_name(name), m_classname(classname), m_def_param(def_param) + : m_name(name), m_classname(classname), m_def_param(def_param), + m_sourcefile("<unknown>") { } diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h index 9e2185e0729..92f126ea4d5 100644 --- a/src/lib/netlist/nl_factory.h +++ b/src/lib/netlist/nl_factory.h @@ -9,29 +9,42 @@ #ifndef NLFACTORY_H_ #define NLFACTORY_H_ -#include <type_traits> - -#include "nl_config.h" #include "plib/palloc.h" -#include "plib/plists.h" -#include "plib/putil.h" -#include "nl_base.h" - -#define NETLIB_DEVICE_IMPL(chip) factory::constructor_ptr_t decl_ ## chip = factory::constructor_t< NETLIB_NAME(chip) >; -#define NETLIB_DEVICE_IMPL_NS(ns, chip) factory::constructor_ptr_t decl_ ## chip = factory::constructor_t< ns :: NETLIB_NAME(chip) >; - -namespace netlist { namespace factory -{ +#include "plib/ptypes.h" + +#define NETLIB_DEVICE_IMPL(chip) \ + static std::unique_ptr<factory::element_t> NETLIB_NAME(chip ## _c)( \ + const pstring &name, const pstring &classname, const pstring &def_param) \ + { \ + return std::unique_ptr<factory::element_t>(plib::palloc<factory::device_element_t<NETLIB_NAME(chip)>>(name, classname, def_param, pstring(__FILE__))); \ + } \ + factory::constructor_ptr_t decl_ ## chip = NETLIB_NAME(chip ## _c); + +#define NETLIB_DEVICE_IMPL_NS(ns, chip) \ + static std::unique_ptr<factory::element_t> NETLIB_NAME(chip ## _c)( \ + const pstring &name, const pstring &classname, const pstring &def_param) \ + { \ + return std::unique_ptr<factory::element_t>(plib::palloc<factory::device_element_t<ns :: NETLIB_NAME(chip)>>(name, classname, def_param, pstring(__FILE__))); \ + } \ + factory::constructor_ptr_t decl_ ## chip = NETLIB_NAME(chip ## _c); + +namespace netlist { + class netlist_t; + class device_t; + class setup_t; + +namespace factory { // ----------------------------------------------------------------------------- // net_dev class factory // ----------------------------------------------------------------------------- - class element_t + class element_t : plib::nocopyassignmove { - P_PREVENT_COPYING(element_t) public: element_t(const pstring &name, const pstring &classname, const pstring &def_param); + element_t(const pstring &name, const pstring &classname, + const pstring &def_param, const pstring &sourcefile); virtual ~element_t(); virtual plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) = 0; @@ -40,21 +53,25 @@ namespace netlist { namespace factory const pstring &name() const { return m_name; } const pstring &classname() const { return m_classname; } const pstring ¶m_desc() const { return m_def_param; } + const pstring &sourcefile() const { return m_sourcefile; } protected: pstring m_name; /* device name */ pstring m_classname; /* device class name */ pstring m_def_param; /* default parameter */ + pstring m_sourcefile; /* source file */ }; template <class C> class device_element_t : public element_t { - P_PREVENT_COPYING(device_element_t) public: device_element_t(const pstring &name, const pstring &classname, const pstring &def_param) : element_t(name, classname, def_param) { } + device_element_t(const pstring &name, const pstring &classname, + const pstring &def_param, const pstring &sourcefile) + : element_t(name, classname, def_param, sourcefile) { } plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) override { @@ -72,7 +89,7 @@ namespace netlist { namespace factory void register_device(const pstring &name, const pstring &classname, const pstring &def_param) { - register_device(std::unique_ptr<element_t>(new device_element_t<device_class>(name, classname, def_param))); + register_device(std::unique_ptr<element_t>(plib::palloc<device_element_t<device_class>>(name, classname, def_param))); } void register_device(std::unique_ptr<element_t> factory); @@ -87,7 +104,7 @@ namespace netlist { namespace factory private: setup_t &m_setup; -}; + }; // ----------------------------------------------------------------------------- // factory_creator_ptr_t @@ -100,42 +117,33 @@ namespace netlist { namespace factory std::unique_ptr<element_t> constructor_t(const pstring &name, const pstring &classname, const pstring &def_param) { - return std::unique_ptr<element_t>(new device_element_t<T>(name, classname, def_param)); + return std::unique_ptr<element_t>(plib::palloc<device_element_t<T>>(name, classname, def_param)); } // ----------------------------------------------------------------------------- // factory_lib_entry_t: factory class to wrap macro based chips/elements // ----------------------------------------------------------------------------- - class NETLIB_NAME(wrapper) : public device_t - { - public: - NETLIB_NAME(wrapper)(netlist_t &anetlist, const pstring &name) - : device_t(anetlist, name) - { - } - protected: - NETLIB_RESETI(); - NETLIB_UPDATEI(); - }; - class library_element_t : public element_t { - P_PREVENT_COPYING(library_element_t) public: library_element_t(setup_t &setup, const pstring &name, const pstring &classname, - const pstring &def_param) - : element_t(name, classname, def_param), m_setup(setup) { } + const pstring &def_param, const pstring &source) + : element_t(name, classname, def_param, source) { } plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) override; void macro_actions(netlist_t &anetlist, const pstring &name) override; private: - setup_t &m_setup; }; -} } + } + + namespace devices { + void initialize_factory(factory::list_t &factory); + } +} #endif /* NLFACTORY_H_ */ diff --git a/src/lib/netlist/nl_lists.h b/src/lib/netlist/nl_lists.h index 2b378dadf71..4c6935bd7d4 100644 --- a/src/lib/netlist/nl_lists.h +++ b/src/lib/netlist/nl_lists.h @@ -11,10 +11,14 @@ #define NLLISTS_H_ #include <atomic> +#include <thread> +#include <mutex> #include "nl_config.h" +#include "netlist_types.h" #include "plib/plists.h" #include "plib/pchrono.h" +#include "plib/ptypes.h" // ---------------------------------------------------------------------------------------- // timed queue @@ -23,41 +27,45 @@ namespace netlist { - //FIXME: move to an appropriate place template<bool enabled_ = true> - class pspin_lock + class pspin_mutex { public: - pspin_lock() { } - void acquire() noexcept{ while (m_lock.test_and_set(std::memory_order_acquire)) { } } - void release() noexcept { m_lock.clear(std::memory_order_release); } + pspin_mutex() noexcept { } + void lock() noexcept{ while (m_lock.test_and_set(std::memory_order_acquire)) { } } + void unlock() noexcept { m_lock.clear(std::memory_order_release); } private: std::atomic_flag m_lock = ATOMIC_FLAG_INIT; }; template<> - class pspin_lock<false> + class pspin_mutex<false> { public: - void acquire() const noexcept { } - void release() const noexcept { } + void lock() const noexcept { } + void unlock() const noexcept { } }; - #if HAS_OPENMP && USE_OPENMP - using tqlock = pspin_lock<true>; - #else - using tqlock = pspin_lock<false>; - #endif - template <class Element, class Time> - class timed_queue + class timed_queue : plib::nocopyassignmove { - P_PREVENT_COPYING(timed_queue) public: struct entry_t { + entry_t() { } + entry_t(const Time &t, const Element &o) : m_exec_time(t), m_object(o) { } + entry_t(const entry_t &e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { } + entry_t(entry_t &&e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { } + + entry_t& operator=(entry_t && other) + { + m_exec_time = other.m_exec_time; + m_object = other.m_object; + return *this; + } + Time m_exec_time; Element m_object; }; @@ -65,37 +73,35 @@ namespace netlist timed_queue(unsigned list_size) : m_list(list_size) { - m_lock.acquire(); clear(); - m_lock.release(); } std::size_t capacity() const { return m_list.size(); } bool empty() const { return (m_end == &m_list[1]); } - void push(Element o, const Time t) noexcept + void push(entry_t &&e) noexcept { /* Lock */ - m_lock.acquire(); + tqlock lck(m_lock); entry_t * i = m_end; - for (; t > (i - 1)->m_exec_time; --i) + while (e.m_exec_time > (i - 1)->m_exec_time) { - *(i) = *(i-1); + *(i) = std::move(*(i-1)); + --i; m_prof_sortmove.inc(); } - *i = { t, o }; + *i = std::move(e); ++m_end; m_prof_call.inc(); - m_lock.release(); } - entry_t pop() noexcept { return *(--m_end); } - const entry_t &top() const noexcept { return *(m_end-1); } + entry_t pop() noexcept { return std::move(*(--m_end)); } + const entry_t &top() const noexcept { return std::move(*(m_end-1)); } void remove(const Element &elem) noexcept { /* Lock */ - m_lock.acquire(); + tqlock lck(m_lock); for (entry_t * i = m_end - 1; i > &m_list[0]; i--) { if (i->m_object == elem) @@ -103,24 +109,23 @@ namespace netlist m_end--; while (i < m_end) { - *i = *(i+1); + *i = std::move(*(i+1)); ++i; } - m_lock.release(); return; } } - m_lock.release(); } void retime(const Element &elem, const Time t) noexcept { remove(elem); - push(elem, t); + push(entry_t(t, elem)); } void clear() { + tqlock lck(m_lock); m_end = &m_list[0]; /* put an empty element with maximum time into the queue. * the insert algo above will run into this element and doesn't @@ -137,8 +142,14 @@ namespace netlist const entry_t & operator[](const std::size_t index) const { return m_list[ 1 + index]; } private: + #if HAS_OPENMP && USE_OPENMP + using tqmutex = pspin_mutex<true>; + #else + using tqmutex = pspin_mutex<false>; + #endif + using tqlock = std::lock_guard<tqmutex>; - tqlock m_lock; + tqmutex m_lock; entry_t * m_end; std::vector<entry_t> m_list; diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp index 6dee211ce56..db7ced8fae0 100644 --- a/src/lib/netlist/nl_parser.cpp +++ b/src/lib/netlist/nl_parser.cpp @@ -7,7 +7,7 @@ #include "nl_parser.h" #include "nl_factory.h" -#include "devices/nld_truthtable.h" +#include "nl_errstr.h" namespace netlist { @@ -28,13 +28,7 @@ bool parser_t::parse(const pstring nlname) { set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"); set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers - char ws[5]; - ws[0] = ' '; - ws[1] = 9; - ws[2] = 10; - ws[3] = 13; - ws[4] = 0; - set_whitespace(ws); + set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13)); set_comment("/*", "*/", "//"); m_tok_param_left = register_token("("); m_tok_param_right = register_token(")"); @@ -64,18 +58,16 @@ bool parser_t::parse(const pstring nlname) while (true) { token_t token = get_token(); - if (token.is_type(ENDOFFILE)) { return false; - //error("EOF while searching for <{1}>", nlname); } if (token.is(m_tok_NETLIST_END)) { require_token(m_tok_param_left); if (!in_nl) - error("Unexpected NETLIST_END"); + error (MF_0_UNEXPECTED_NETLIST_END); else { in_nl = false; @@ -85,7 +77,7 @@ bool parser_t::parse(const pstring nlname) else if (token.is(m_tok_NETLIST_START)) { if (in_nl) - error("Unexpected NETLIST_START"); + error (MF_0_UNEXPECTED_NETLIST_START); require_token(m_tok_param_left); token_t name = get_token(); require_token(m_tok_param_right); @@ -99,7 +91,7 @@ bool parser_t::parse(const pstring nlname) } } -void parser_t::parse_netlist(ATTR_UNUSED const pstring &nlname) +void parser_t::parse_netlist(const pstring &nlname) { while (true) { @@ -132,10 +124,10 @@ void parser_t::parse_netlist(ATTR_UNUSED const pstring &nlname) else if (token.is(m_tok_LOCAL_SOURCE)) net_local_source(); else if (token.is(m_tok_TRUTHTABLE_START)) - net_truthtable_start(); + net_truthtable_start(nlname); else if (token.is(m_tok_LOCAL_LIB_ENTRY)) { - m_setup.register_lib_entry(get_identifier()); + m_setup.register_lib_entry(get_identifier(), "parser: " + nlname); require_token(m_tok_param_right); } else if (token.is(m_tok_NETLIST_END)) @@ -148,7 +140,7 @@ void parser_t::parse_netlist(ATTR_UNUSED const pstring &nlname) } } -void parser_t::net_truthtable_start() +void parser_t::net_truthtable_start(const pstring &nlname) { pstring name = get_identifier(); require_token(m_tok_comma); @@ -194,7 +186,7 @@ void parser_t::net_truthtable_start() require_token(token, m_tok_TRUTHTABLE_END); require_token(m_tok_param_left); require_token(m_tok_param_right); - netlist::devices::tt_factory_create(m_setup, desc); + m_setup.tt_factory_create(desc, nlname); return; } } @@ -300,7 +292,7 @@ void parser_t::net_c() void parser_t::dippins() { - plib::pstring_vector_t pins; + std::vector<pstring> pins; pins.push_back(get_identifier()); require_token(m_tok_comma); @@ -357,7 +349,7 @@ void parser_t::netdev_hint() void parser_t::device(const pstring &dev_type) { factory::element_t *f = m_setup.factory().factory_by_name(dev_type); - auto paramlist = plib::pstring_vector_t(f->param_desc(), ","); + auto paramlist = plib::psplit(f->param_desc(), ","); pstring devname = get_identifier(); @@ -404,7 +396,7 @@ void parser_t::device(const pstring &dev_type) nl_double parser_t::eval_param(const token_t tok) { - static const char *macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"}; + static pstring macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"}; static nl_double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12}; int i; int f=0; @@ -415,7 +407,6 @@ nl_double parser_t::eval_param(const token_t tok) for (i=1; i<6;i++) if (tok.str().equals(macs[i])) f = i; -#if 1 if (f>0) { require_token(m_tok_param_left); @@ -431,22 +422,6 @@ nl_double parser_t::eval_param(const token_t tok) } return ret * facs[f]; -#else - if (f>0) - { - require_token(m_tok_param_left); - val = get_identifier(); - } - else - val = tok.str(); - - ret = val.as_double(&e); - - if (e) - fatal("Error with parameter ...\n"); - if (f>0) - require_token(m_tok_param_right); - return ret * facs[f]; -#endif } + } diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h index 5c915e69997..4654bcb3f87 100644 --- a/src/lib/netlist/nl_parser.h +++ b/src/lib/netlist/nl_parser.h @@ -15,10 +15,9 @@ namespace netlist { class parser_t : public plib::ptokenizer { - P_PREVENT_COPYING(parser_t) public: - parser_t(plib::pistream &strm, setup_t &setup) - : plib::ptokenizer(strm), m_setup(setup), m_buf(nullptr) {} + parser_t(plib::putf8_reader &strm, setup_t &setup) + : plib::ptokenizer(strm), m_setup(setup) {} bool parse(const pstring nlname = ""); @@ -37,7 +36,7 @@ namespace netlist void net_submodel(); void net_include(); void net_local_source(); - void net_truthtable_start(); + void net_truthtable_start(const pstring &nlname); /* for debugging messages */ netlist_t &netlist() { return m_setup.netlist(); } @@ -70,9 +69,7 @@ namespace netlist token_id_t m_tok_TT_FAMILY; setup_t &m_setup; - - const char *m_buf; - }; +}; } diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 84aa7c8d384..0572ec1e693 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -5,22 +5,17 @@ * */ -#include <cstdio> - -#include "solver/nld_solver.h" - #include "plib/palloc.h" #include "plib/putil.h" #include "nl_base.h" #include "nl_setup.h" #include "nl_parser.h" #include "nl_factory.h" -#include "devices/net_lib.h" -#include "devices/nld_truthtable.h" #include "devices/nlid_system.h" #include "devices/nlid_proxy.h" #include "analog/nld_twoterm.h" #include "solver/nld_solver.h" +#include "devices/nlid_truthtable.h" // ---------------------------------------------------------------------------------------- // setup_t @@ -34,7 +29,7 @@ setup_t::setup_t(netlist_t &netlist) , m_proxy_cnt(0) , m_frontier_cnt(0) { - initialize_factory(m_factory); + devices::initialize_factory(m_factory); } setup_t::~setup_t() @@ -73,16 +68,16 @@ void setup_t::namespace_pop() m_namespace_stack.pop(); } -void setup_t::register_lib_entry(const pstring &name) +void setup_t::register_lib_entry(const pstring &name, const pstring &sourcefile) { - factory().register_device(plib::make_unique_base<factory::element_t, factory::library_element_t>(*this, name, name, "")); + factory().register_device(plib::make_unique_base<factory::element_t, factory::library_element_t>(*this, name, name, "", sourcefile)); } void setup_t::register_dev(const pstring &classname, const pstring &name) { auto f = factory().factory_by_name(classname); if (f == nullptr) - log().fatal("Class {1} not found!\n", classname); + log().fatal(MF_1_CLASS_1_NOT_FOUND, classname); /* make sure we parse macro library entries */ f->macro_actions(netlist(), name); m_device_factory.push_back(std::pair<pstring, factory::element_t *>(build_fqn(name), f)); @@ -103,17 +98,17 @@ void setup_t::register_model(const pstring &model_in) { auto pos = model_in.find(" "); if (pos == model_in.end()) - log().fatal("Unable to parse model: {1}", model_in); + log().fatal(MF_1_UNABLE_TO_PARSE_MODEL_1, model_in); pstring model = model_in.left(pos).trim().ucase(); pstring def = model_in.substr(pos + 1).trim(); if (!m_models.insert({model, def}).second) - log().fatal("Model already exists: {1}", model_in); + log().fatal(MF_1_MODEL_ALREADY_EXISTS_1, model_in); } void setup_t::register_alias_nofqn(const pstring &alias, const pstring &out) { if (!m_alias.insert({alias, out}).second) - log().fatal("Error adding alias {1} to alias list\n", alias); + log().fatal(MF_1_ADDING_ALIAS_1_TO_ALIAS_LIST, alias); } void setup_t::register_alias(const pstring &alias, const pstring &out) @@ -125,9 +120,10 @@ void setup_t::register_alias(const pstring &alias, const pstring &out) void setup_t::register_dippins_arr(const pstring &terms) { - plib::pstring_vector_t list(terms,", "); + std::vector<pstring> list(plib::psplit(terms,", ")); if (list.size() == 0 || (list.size() % 2) == 1) - log().fatal("You must pass an equal number of pins to DIPPINS {1}" , build_fqn("")); + log().fatal(MF_1_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1, + build_fqn("")); std::size_t n = list.size(); for (std::size_t i = 0; i < n / 2; i++) { @@ -136,22 +132,19 @@ void setup_t::register_dippins_arr(const pstring &terms) } } -pstring setup_t::objtype_as_str(detail::device_object_t &in) const +pstring setup_t::termtype_as_str(detail::core_terminal_t &in) const { switch (in.type()) { - case terminal_t::TERMINAL: - return "TERMINAL"; - case terminal_t::INPUT: - return "INPUT"; - case terminal_t::OUTPUT: - return "OUTPUT"; - case terminal_t::PARAM: - return "PARAM"; + case detail::terminal_type::TERMINAL: + return pstring("TERMINAL"); + case detail::terminal_type::INPUT: + return pstring("INPUT"); + case detail::terminal_type::OUTPUT: + return pstring("OUTPUT"); } - // FIXME: noreturn - log().fatal("Unknown object type {1}\n", static_cast<unsigned>(in.type())); - return "Error"; + log().fatal(MF_1_UNKNOWN_OBJECT_TYPE_1, static_cast<unsigned>(in.type())); + return pstring("Error"); } pstring setup_t::get_initial_param_val(const pstring name, const pstring def) @@ -170,7 +163,7 @@ double setup_t::get_initial_param_val(const pstring name, const double def) { double vald = 0; if (sscanf(i->second.c_str(), "%lf", &vald) != 1) - log().fatal("Invalid number conversion {1} : {2}\n", name, i->second); + log().fatal(MF_2_INVALID_NUMBER_CONVERSION_1_2, name, i->second); return vald; } else @@ -184,7 +177,7 @@ int setup_t::get_initial_param_val(const pstring name, const int def) { double vald = 0; if (sscanf(i->second.c_str(), "%lf", &vald) != 1) - log().fatal("Invalid number conversion {1} : {2}\n", name, i->second); + log().fatal(MF_2_INVALID_NUMBER_CONVERSION_1_2, name, i->second); return static_cast<int>(vald); } else @@ -194,21 +187,22 @@ int setup_t::get_initial_param_val(const pstring name, const int def) void setup_t::register_param(pstring name, param_t ¶m) { if (!m_params.insert({param.name(), param_ref_t(param.name(), param.device(), param)}).second) - log().fatal("Error adding parameter {1} to parameter list\n", name); + log().fatal(MF_1_ADDING_PARAMETER_1_TO_PARAMETER_LIST, name); } void setup_t::register_term(detail::core_terminal_t &term) { if (!m_terminals.insert({term.name(), &term}).second) - log().fatal("Error adding {1} {2} to terminal list\n", objtype_as_str(term), term.name()); - log().debug("{1} {2}\n", objtype_as_str(term), term.name()); + log().fatal(MF_2_ADDING_1_2_TO_TERMINAL_LIST, termtype_as_str(term), + term.name()); + log().debug("{1} {2}\n", termtype_as_str(term), term.name()); } void setup_t::register_link_arr(const pstring &terms) { - plib::pstring_vector_t list(terms,", "); + std::vector<pstring> list(plib::psplit(terms,", ")); if (list.size() < 2) - log().fatal("You must pass at least 2 terminals to NET_C"); + log().fatal(MF_2_NET_C_NEEDS_AT_LEAST_2_TERMINAL); for (std::size_t i = 1; i < list.size(); i++) { register_link(list[0], list[i]); @@ -245,7 +239,7 @@ void setup_t::remove_connections(const pstring pin) link++; } if (!found) - log().fatal("remove_connections: found no occurrence of {1}\n", pin); + log().fatal(MF_1_FOUND_NO_OCCURRENCE_OF_1, pin); } @@ -274,7 +268,7 @@ void setup_t::register_frontier(const pstring attach, const double r_IN, const d } } if (!found) - log().fatal("Frontier setup: found no occurrence of {1}\n", attach); + log().fatal(MF_1_FOUND_NO_OCCURRENCE_OF_1, attach); register_link(attach, frontier_name + ".Q"); } @@ -292,11 +286,13 @@ void setup_t::register_param(const pstring ¶m, const pstring &value) if (idx == m_param_values.end()) { if (!m_param_values.insert({fqn, value}).second) - log().fatal("Unexpected error adding parameter {1} to parameter list\n", param); + log().fatal(MF_1_ADDING_PARAMETER_1_TO_PARAMETER_LIST, + param); } else { - log().warning("Overwriting {1} old <{2}> new <{3}>\n", fqn, idx->second, value); + log().warning(MW_3_OVERWRITING_PARAM_1_OLD_2_NEW_3, fqn, idx->second, + value); m_param_values[fqn] = value; } } @@ -331,32 +327,32 @@ detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, bool detail::core_terminal_t *term = (ret == m_terminals.end() ? nullptr : ret->second); if (term == nullptr && required) - log().fatal("terminal {1}({2}) not found!\n", terminal_in, tname); + log().fatal(MF_2_TERMINAL_1_2_NOT_FOUND, terminal_in, tname); if (term != nullptr) log().debug("Found input {1}\n", tname); return term; } detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, - detail::device_object_t::type_t atype, bool required) + detail::terminal_type atype, bool required) { const pstring &tname = resolve_alias(terminal_in); auto ret = m_terminals.find(tname); /* look for default */ - if (ret == m_terminals.end() && atype == detail::device_object_t::OUTPUT) + if (ret == m_terminals.end() && atype == detail::terminal_type::OUTPUT) { /* look for ".Q" std output */ ret = m_terminals.find(tname + ".Q"); } if (ret == m_terminals.end() && required) - log().fatal("terminal {1}({2}) not found!\n", terminal_in, tname); + log().fatal(MF_2_TERMINAL_1_2_NOT_FOUND, terminal_in, tname); detail::core_terminal_t *term = (ret == m_terminals.end() ? nullptr : ret->second); if (term != nullptr && term->type() != atype) { if (required) - log().fatal("object {1}({2}) found but wrong type\n", terminal_in, tname); + log().fatal(MF_2_OBJECT_1_2_WRONG_TYPE, terminal_in, tname); else term = nullptr; } @@ -373,18 +369,17 @@ param_t *setup_t::find_param(const pstring ¶m_in, bool required) const const pstring &outname = resolve_alias(param_in_fqn); auto ret = m_params.find(outname); if (ret == m_params.end() && required) - log().fatal("parameter {1}({2}) not found!\n", param_in_fqn, outname); + log().fatal(MF_2_PARAMETER_1_2_NOT_FOUND, param_in_fqn, outname); if (ret != m_params.end()) log().debug("Found parameter {1}\n", outname); return (ret == m_params.end() ? nullptr : &ret->second.m_param); } -// FIXME avoid dynamic cast here devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out) { nl_assert(out.is_logic()); - logic_output_t &out_cast = dynamic_cast<logic_output_t &>(out); + logic_output_t &out_cast = static_cast<logic_output_t &>(out); devices::nld_base_proxy *proxy = out_cast.get_proxy(); if (proxy == nullptr) @@ -403,7 +398,8 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out) { p->clear_net(); // de-link from all nets ... if (!connect(new_proxy->proxy_term(), *p)) - log().fatal("Error connecting {1} to {2}\n", new_proxy->proxy_term().name(), (*p).name()); + log().fatal(MF_2_CONNECTING_1_TO_2, + new_proxy->proxy_term().name(), (*p).name()); } out.net().m_core_terms.clear(); // clear the list @@ -437,7 +433,6 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) auto ret = new_proxy.get(); -#if 1 /* connect all existing terminals to new net */ if (inp.has_net()) @@ -446,18 +441,12 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) { p->clear_net(); // de-link from all nets ... if (!connect(ret->proxy_term(), *p)) - log().fatal("Error connecting {1} to {2}\n", ret->proxy_term().name(), (*p).name()); + log().fatal(MF_2_CONNECTING_1_TO_2, + ret->proxy_term().name(), (*p).name()); } inp.net().m_core_terms.clear(); // clear the list } ret->out().net().add_terminal(inp); -#else - if (inp.has_net()) - //fatalerror("logic inputs can only belong to one net!\n"); - merge_nets(ret->out().net(), inp.net()); - else - ret->out().net().add_terminal(inp); -#endif netlist().register_dev(std::move(new_proxy)); return ret; } @@ -465,19 +454,20 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) void setup_t::merge_nets(detail::net_t &thisnet, detail::net_t &othernet) { - netlist().log().debug("merging nets ...\n"); + log().debug("merging nets ...\n"); if (&othernet == &thisnet) { - netlist().log().warning("Connecting {1} to itself. This may be right, though\n", thisnet.name()); + log().warning(MW_1_CONNECTING_1_TO_ITSELF, thisnet.name()); return; // Nothing to do } if (thisnet.isRailNet() && othernet.isRailNet()) - netlist().log().fatal("Trying to merge two rail nets: {1} and {2}\n", thisnet.name(), othernet.name()); + log().fatal(MF_2_MERGE_RAIL_NETS_1_AND_2, + thisnet.name(), othernet.name()); if (othernet.isRailNet()) { - netlist().log().debug("othernet is railnet\n"); + log().debug("othernet is railnet\n"); merge_nets(othernet, thisnet); } else @@ -521,7 +511,8 @@ void setup_t::connect_terminal_input(terminal_t &term, detail::core_terminal_t & } else if (inp.is_logic()) { - netlist().log().verbose("connect terminal {1} (in, {2}) to {3}\n", inp.name(), pstring(inp.is_analog() ? "analog" : inp.is_logic() ? "logic" : "?"), term.name()); + log().verbose("connect terminal {1} (in, {2}) to {3}\n", inp.name(), + inp.is_analog() ? pstring("analog") : inp.is_logic() ? pstring("logic") : pstring("?"), term.name()); auto proxy = get_a_d_proxy(inp); //out.net().register_con(proxy->proxy_term()); @@ -530,7 +521,7 @@ void setup_t::connect_terminal_input(terminal_t &term, detail::core_terminal_t & } else { - log().fatal("Netlist: Severe Error"); + log().fatal(MF_1_OBJECT_INPUT_TYPE_1, inp.name()); } } @@ -554,7 +545,7 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o } else { - log().fatal("Netlist: Severe Error"); + log().fatal(MF_1_OBJECT_OUTPUT_TYPE_1, out.name()); } } @@ -609,7 +600,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term { for (auto & t : t1.net().m_core_terms) { - if (t->is_type(detail::core_terminal_t::TERMINAL)) + if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t2, *t); if (ret) break; @@ -624,7 +615,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term { for (auto & t : t2.net().m_core_terms) { - if (t->is_type(detail::core_terminal_t::TERMINAL)) + if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t1, *t); if (ret) break; @@ -643,39 +634,39 @@ bool setup_t::connect(detail::core_terminal_t &t1_in, detail::core_terminal_t &t detail::core_terminal_t &t2 = resolve_proxy(t2_in); bool ret = true; - if (t1.is_type(detail::core_terminal_t::OUTPUT) && t2.is_type(detail::core_terminal_t::INPUT)) + if (t1.is_type(detail::terminal_type::OUTPUT) && t2.is_type(detail::terminal_type::INPUT)) { if (t2.has_net() && t2.net().isRailNet()) - log().fatal("Input {1} already connected\n", t2.name()); + log().fatal(MF_1_INPUT_1_ALREADY_CONNECTED, t2.name()); connect_input_output(t2, t1); } - else if (t1.is_type(detail::core_terminal_t::INPUT) && t2.is_type(detail::core_terminal_t::OUTPUT)) + else if (t1.is_type(detail::terminal_type::INPUT) && t2.is_type(detail::terminal_type::OUTPUT)) { if (t1.has_net() && t1.net().isRailNet()) - log().fatal("Input {1} already connected\n", t1.name()); + log().fatal(MF_1_INPUT_1_ALREADY_CONNECTED, t1.name()); connect_input_output(t1, t2); } - else if (t1.is_type(detail::core_terminal_t::OUTPUT) && t2.is_type(detail::core_terminal_t::TERMINAL)) + else if (t1.is_type(detail::terminal_type::OUTPUT) && t2.is_type(detail::terminal_type::TERMINAL)) { connect_terminal_output(dynamic_cast<terminal_t &>(t2), t1); } - else if (t1.is_type(detail::core_terminal_t::TERMINAL) && t2.is_type(detail::core_terminal_t::OUTPUT)) + else if (t1.is_type(detail::terminal_type::TERMINAL) && t2.is_type(detail::terminal_type::OUTPUT)) { connect_terminal_output(dynamic_cast<terminal_t &>(t1), t2); } - else if (t1.is_type(detail::core_terminal_t::INPUT) && t2.is_type(detail::core_terminal_t::TERMINAL)) + else if (t1.is_type(detail::terminal_type::INPUT) && t2.is_type(detail::terminal_type::TERMINAL)) { connect_terminal_input(dynamic_cast<terminal_t &>(t2), t1); } - else if (t1.is_type(detail::core_terminal_t::TERMINAL) && t2.is_type(detail::core_terminal_t::INPUT)) + else if (t1.is_type(detail::terminal_type::TERMINAL) && t2.is_type(detail::terminal_type::INPUT)) { connect_terminal_input(dynamic_cast<terminal_t &>(t1), t2); } - else if (t1.is_type(detail::core_terminal_t::TERMINAL) && t2.is_type(detail::core_terminal_t::TERMINAL)) + else if (t1.is_type(detail::terminal_type::TERMINAL) && t2.is_type(detail::terminal_type::TERMINAL)) { connect_terminals(dynamic_cast<terminal_t &>(t1), dynamic_cast<terminal_t &>(t2)); } - else if (t1.is_type(detail::core_terminal_t::INPUT) && t2.is_type(detail::core_terminal_t::INPUT)) + else if (t1.is_type(detail::terminal_type::INPUT) && t2.is_type(detail::terminal_type::INPUT)) { ret = connect_input_input(t1, t2); } @@ -693,8 +684,8 @@ void setup_t::resolve_inputs() * We therefore first park connecting inputs and retry * after all other terminals were connected. */ - int tries = 100; - while (m_links.size() > 0 && tries > 0) // FIXME: convert into constant + int tries = NL_MAX_LINK_RESOLVE_LOOPS; + while (m_links.size() > 0 && tries > 0) { for (auto li = m_links.begin(); li != m_links.end(); ) @@ -714,9 +705,9 @@ void setup_t::resolve_inputs() if (tries == 0) { for (auto & link : m_links) - log().warning("Error connecting {1} to {2}\n", link.first, link.second); + log().warning(MF_2_CONNECTING_1_TO_2, link.first, link.second); - log().fatal("Error connecting -- bailing out\n"); + log().fatal(MF_0_LINK_TRIES_EXCEEDED); } log().verbose("deleting empty nets ..."); @@ -743,38 +734,26 @@ void setup_t::resolve_inputs() { detail::core_terminal_t *term = i.second; if (!term->has_net() && dynamic_cast< devices::NETLIB_NAME(dummy_input) *>(&term->device()) != nullptr) - log().warning("Found dummy terminal {1} without connections", term->name()); + log().warning(MW_1_DUMMY_1_WITHOUT_CONNECTIONS, term->name()); else if (!term->has_net()) errstr += plib::pfmt("Found terminal {1} without a net\n")(term->name()); else if (term->net().num_cons() == 0) - log().warning("Found terminal {1} without connections", term->name()); + log().warning(MW_1_TERMINAL_1_WITHOUT_CONNECTIONS, term->name()); } + //FIXME: error string handling if (errstr != "") log().fatal("{1}", errstr); - - log().verbose("looking for two terms connected to rail nets ..."); - for (auto & t : netlist().get_device_list<analog::NETLIB_NAME(twoterm)>()) - { - if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) - { - log().warning("Found device {1} connected only to railterminals {2}/{3}. Will be removed", - t->name(), t->m_N.net().name(), t->m_P.net().name()); - t->m_N.net().remove_terminal(t->m_N); - t->m_P.net().remove_terminal(t->m_P); - netlist().remove_dev(t); - } - } } void setup_t::start_devices() { - pstring env = plib::util::environment("NL_LOGS"); + pstring env = plib::util::environment("NL_LOGS", ""); if (env != "") { log().debug("Creating dynamic logs ..."); - plib::pstring_vector_t loglist(env, ":"); + std::vector<pstring> loglist(plib::psplit(env, ":")); for (pstring ll : loglist) { pstring name = "log_" + ll; @@ -800,7 +779,7 @@ const plib::plog_base<NL_DEBUG> &setup_t::log() const // Model // ---------------------------------------------------------------------------------------- -static pstring model_string(model_map_t &map) +static pstring model_string(detail::model_map_t &map) { pstring ret = map["COREMODEL"] + "("; for (auto & i : map) @@ -809,7 +788,7 @@ static pstring model_string(model_map_t &map) return ret + ")"; } -void setup_t::model_parse(const pstring &model_in, model_map_t &map) +void setup_t::model_parse(const pstring &model_in, detail::model_map_t &map) { pstring model = model_in; pstring::iterator pos(nullptr); @@ -823,7 +802,7 @@ void setup_t::model_parse(const pstring &model_in, model_map_t &map) key = model.ucase(); auto i = m_models.find(key); if (i == m_models.end()) - log().fatal("Model {1} not found\n", model); + log().fatal(MF_1_MODEL_NOT_FOUND, model); model = i->second; } pstring xmodel = model.left(pos); @@ -836,40 +815,41 @@ void setup_t::model_parse(const pstring &model_in, model_map_t &map) if (i != m_models.end()) model_parse(xmodel, map); else - log().fatal("Model doesn't exist: <{1}>\n", model_in); + log().fatal(MF_1_MODEL_NOT_FOUND, model_in); } pstring remainder=model.substr(pos+1).trim(); if (!remainder.endsWith(")")) - log().fatal("Model error {1}\n", model); + log().fatal(MF_1_MODEL_ERROR_1, model); // FIMXE: Not optimal remainder = remainder.left(remainder.begin() + (remainder.len() - 1)); - plib::pstring_vector_t pairs(remainder," ", true); + std::vector<pstring> pairs(plib::psplit(remainder," ", true)); for (pstring &pe : pairs) { auto pose = pe.find("="); if (pose == pe.end()) - log().fatal("Model error on pair {1}\n", model); + log().fatal(MF_1_MODEL_ERROR_ON_PAIR_1, model); map[pe.left(pose).ucase()] = pe.substr(pose+1); } } -const pstring setup_t::model_value_str(model_map_t &map, const pstring &entity) +const pstring setup_t::model_value_str(detail::model_map_t &map, const pstring &entity) { pstring ret; if (entity != entity.ucase()) - log().fatal("model parameters should be uppercase:{1} {2}\n", entity, model_string(map)); + log().fatal(MF_2_MODEL_PARAMETERS_NOT_UPPERCASE_1_2, entity, + model_string(map)); if (map.find(entity) == map.end()) - log().fatal("Entity {1} not found in model {2}\n", entity, model_string(map)); + log().fatal(MF_2_ENTITY_1_NOT_FOUND_IN_MODEL_2, entity, model_string(map)); else ret = map[entity]; return ret; } -nl_double setup_t::model_value(model_map_t &map, const pstring &entity) +nl_double setup_t::model_value(detail::model_map_t &map, const pstring &entity) { pstring tmp = model_value_str(map, entity); @@ -887,16 +867,67 @@ nl_double setup_t::model_value(model_map_t &map, const pstring &entity) case 'a': factor = 1e-18; break; default: if (*p < '0' || *p > '9') - nl_exception(plib::pfmt("Unknown number factor in: {1}")(entity)); + log().fatal(MF_1_UNKNOWN_NUMBER_FACTOR_IN_1, entity); } if (factor != NL_FCONST(1.0)) tmp = tmp.left(tmp.begin() + (tmp.len() - 1)); return tmp.as_double() * factor; } -void setup_t::tt_factory_create(tt_desc &desc) +class logic_family_std_proxy_t : public logic_family_desc_t +{ +public: + logic_family_std_proxy_t() { } + virtual plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_t &anetlist, + const pstring &name, logic_output_t *proxied) const override; + virtual plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *proxied) const override; +}; + +plib::owned_ptr<devices::nld_base_d_to_a_proxy> logic_family_std_proxy_t::create_d_a_proxy(netlist_t &anetlist, + const pstring &name, logic_output_t *proxied) const +{ + return plib::owned_ptr<devices::nld_base_d_to_a_proxy>::Create<devices::nld_d_to_a_proxy>(anetlist, name, proxied); +} +plib::owned_ptr<devices::nld_base_a_to_d_proxy> logic_family_std_proxy_t::create_a_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *proxied) const +{ + return plib::owned_ptr<devices::nld_base_a_to_d_proxy>::Create<devices::nld_a_to_d_proxy>(anetlist, name, proxied); +} + + +const logic_family_desc_t *setup_t::family_from_model(const pstring &model) { - devices::tt_factory_create(*this, desc); + detail::model_map_t map; + model_parse(model, map); + + if (model_value_str(map, "TYPE") == "TTL") + return family_TTL(); + if (model_value_str(map, "TYPE") == "CD4XXX") + return family_CD4XXX(); + + for (auto & e : netlist().m_family_cache) + if (e.first == model) + return e.second.get(); + + auto ret = plib::make_unique_base<logic_family_desc_t, logic_family_std_proxy_t>(); + + ret->m_fixed_V = model_value(map, "FV"); + ret->m_low_thresh_PCNT = model_value(map, "IVL"); + ret->m_high_thresh_PCNT = model_value(map, "IVH"); + ret->m_low_VO = model_value(map, "OVL"); + ret->m_high_VO = model_value(map, "OVH"); + ret->m_R_low = model_value(map, "ORL"); + ret->m_R_high = model_value(map, "ORH"); + + auto retp = ret.get(); + + netlist().m_family_cache.emplace_back(model, std::move(ret)); + + return retp; +} + +void setup_t::tt_factory_create(tt_desc &desc, const pstring &sourcefile) +{ + devices::tt_factory_create(*this, desc, sourcefile); } @@ -911,7 +942,7 @@ void setup_t::include(const pstring &netlist_name) if (source->parse(netlist_name)) return; } - log().fatal("unable to find {1} in source collection", netlist_name); + log().fatal(MF_1_NOT_FOUND_IN_SOURCE_COLLECTION, netlist_name); } std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring name) @@ -925,18 +956,21 @@ std::unique_ptr<plib::pistream> setup_t::get_data_stream(const pstring name) return strm; } } - //log().fatal("unable to find data named {1} in source collection", name); - log().warning("unable to find data named {1} in source collection", name); + log().warning(MW_1_DATA_1_NOT_FOUND, name); return std::unique_ptr<plib::pistream>(nullptr); } -bool setup_t::parse_stream(plib::pistream &istrm, const pstring &name) +bool setup_t::parse_stream(plib::putf8_reader &istrm, const pstring &name) { plib::pomemstream ostrm; + plib::putf8_writer owrt(ostrm); - plib::pimemstream istrm2(plib::ppreprocessor(&m_defines).process(istrm, ostrm)); - return parser_t(istrm2, *this).parse(name); + plib::ppreprocessor(&m_defines).process(istrm, owrt); + + plib::pimemstream istrm2(ostrm); + plib::putf8_reader reader2(istrm2); + return parser_t(reader2, *this).parse(name); } void setup_t::register_define(pstring defstr) @@ -957,7 +991,11 @@ bool source_t::parse(const pstring &name) if (m_type != SOURCE) return false; else - return m_setup.parse_stream(*stream(name), name); + { + auto rstream = stream(name); + plib::putf8_reader reader(*rstream); + return m_setup.parse_stream(reader, name); + } } std::unique_ptr<plib::pistream> source_string_t::stream(const pstring &name) diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h index 798ba8f4140..e9fc0861328 100644 --- a/src/lib/netlist/nl_setup.h +++ b/src/lib/netlist/nl_setup.h @@ -8,19 +8,18 @@ #ifndef NLSETUP_H_ #define NLSETUP_H_ -#include <memory> -#include <stack> -#include <unordered_map> -#include <vector> - #include "plib/pstring.h" -#include "plib/pfmtlog.h" -#include "plib/pstream.h" #include "plib/putil.h" +#include "plib/pstream.h" #include "plib/pparser.h" -#include "nl_config.h" -#include "nl_base.h" + #include "nl_factory.h" +#include "nl_config.h" +#include "netlist_types.h" + +#include <stack> +#include <vector> +#include <memory> //============================================================ // MACROS / inline netlist definitions @@ -71,7 +70,7 @@ void NETLIST_NAME(name)(netlist::setup_t &setup) \ #define LOCAL_LIB_ENTRY(name) \ LOCAL_SOURCE(name) \ - setup.register_lib_entry(# name); + setup.register_lib_entry(# name, __FILE__); #define INCLUDE(name) \ setup.include(# name); @@ -81,6 +80,9 @@ void NETLIST_NAME(name)(netlist::setup_t &setup) \ NETLIST_NAME(model)(setup); \ setup.namespace_pop(); +#define OPTIMIZE_FRONTIER(attach, r_in, r_out) \ + setup.register_frontier(# attach, r_in, r_out); + // ----------------------------------------------------------------------------- // truthtable defines // ----------------------------------------------------------------------------- @@ -105,12 +107,29 @@ void NETLIST_NAME(name)(netlist::setup_t &setup) \ desc.family = x; #define TRUTHTABLE_END() \ - netlist::devices::tt_factory_create(setup, desc); \ + setup.tt_factory_create(desc, __FILE__); \ } namespace netlist { + + namespace detail { + class core_terminal_t; + class net_t; + } + + namespace devices { + class nld_base_proxy; + } + + class core_device_t; + class param_t; + class setup_t; + class netlist_t; + class logic_family_desc_t; + class terminal_t; + // ----------------------------------------------------------------------------- // truthtable desc // ----------------------------------------------------------------------------- @@ -122,7 +141,7 @@ namespace netlist unsigned long ni; unsigned long no; pstring def_param; - plib::pstring_vector_t desc; + std::vector<pstring> desc; pstring family; }; @@ -178,9 +197,8 @@ namespace netlist // ---------------------------------------------------------------------------------------- - class setup_t + class setup_t : plib::nocopyassignmove { - P_PREVENT_COPYING(setup_t) public: using link_t = std::pair<pstring, pstring>; @@ -202,7 +220,7 @@ namespace netlist void register_dev(const pstring &classname, const pstring &name); - void register_lib_entry(const pstring &name); + void register_lib_entry(const pstring &name, const pstring &sourcefile); void register_model(const pstring &model_in); void register_alias(const pstring &alias, const pstring &out); @@ -241,7 +259,7 @@ namespace netlist std::unique_ptr<plib::pistream> get_data_stream(const pstring name); - bool parse_stream(plib::pistream &istrm, const pstring &name); + bool parse_stream(plib::putf8_reader &istrm, const pstring &name); /* register a source */ @@ -258,14 +276,14 @@ namespace netlist /* model / family related */ - const pstring model_value_str(model_map_t &map, const pstring &entity); - nl_double model_value(model_map_t &map, const pstring &entity); + const pstring model_value_str(detail::model_map_t &map, const pstring &entity); + double model_value(detail::model_map_t &map, const pstring &entity); - void model_parse(const pstring &model, model_map_t &map); + void model_parse(const pstring &model, detail::model_map_t &map); - /* FIXME: truth table trampoline */ + const logic_family_desc_t *family_from_model(const pstring &model); - void tt_factory_create(tt_desc &desc); + void tt_factory_create(tt_desc &desc, const pstring &sourcefile); /* helper - also used by nltool */ const pstring resolve_alias(const pstring &name) const; @@ -280,7 +298,7 @@ namespace netlist std::unordered_map<pstring, detail::core_terminal_t *> m_terminals; /* needed by proxy */ - detail::core_terminal_t *find_terminal(const pstring &outname_in, detail::device_object_t::type_t atype, bool required = true); + detail::core_terminal_t *find_terminal(const pstring &outname_in, const detail::terminal_type atype, bool required = true); private: @@ -295,7 +313,7 @@ namespace netlist bool connect_input_input(detail::core_terminal_t &t1, detail::core_terminal_t &t2); // helpers - pstring objtype_as_str(detail::device_object_t &in) const; + pstring termtype_as_str(detail::core_terminal_t &in) const; devices::nld_base_proxy *get_d_a_proxy(detail::core_terminal_t &out); devices::nld_base_proxy *get_a_d_proxy(detail::core_terminal_t &inp); @@ -312,7 +330,7 @@ namespace netlist unsigned m_proxy_cnt; unsigned m_frontier_cnt; - }; +}; // ---------------------------------------------------------------------------------------- // base sources @@ -353,7 +371,7 @@ namespace netlist { public: source_mem_t(setup_t &setup, const char *mem) - : source_t(setup), m_str(mem) + : source_t(setup), m_str(mem, pstring::UTF8) { } diff --git a/src/lib/netlist/nl_time.h b/src/lib/netlist/nl_time.h index 4edc9524a43..7706555f995 100644 --- a/src/lib/netlist/nl_time.h +++ b/src/lib/netlist/nl_time.h @@ -10,6 +10,7 @@ #include <cstdint> #include "nl_config.h" +#include "plib/ptypes.h" #include "plib/pstate.h" //============================================================ @@ -45,82 +46,83 @@ namespace netlist constexpr explicit ptime(const internal_type nom, const internal_type den) noexcept : m_time(nom * (resolution / den)) { } - ptime &operator=(const ptime rhs) { m_time = rhs.m_time; return *this; } + ptime &operator=(const ptime rhs) noexcept { m_time = rhs.m_time; return *this; } - ptime &operator+=(const ptime &rhs) { m_time += rhs.m_time; return *this; } - ptime &operator-=(const ptime &rhs) { m_time -= rhs.m_time; return *this; } + ptime &operator+=(const ptime &rhs) noexcept { m_time += rhs.m_time; return *this; } + ptime &operator-=(const ptime &rhs) noexcept { m_time -= rhs.m_time; return *this; } - friend ptime operator-(ptime lhs, const ptime &rhs) + friend constexpr ptime operator-(const ptime &lhs, const ptime &rhs) noexcept { - lhs -= rhs; - return lhs; + return ptime(lhs.m_time - rhs.m_time); } - friend ptime operator+(ptime lhs, const ptime &rhs) + friend constexpr ptime operator+(const ptime &lhs, const ptime &rhs) noexcept { - lhs += rhs; - return lhs; + return ptime(lhs.m_time + rhs.m_time); } - friend ptime operator*(ptime lhs, const mult_type factor) + friend constexpr ptime operator*(const ptime &lhs, const mult_type factor) noexcept { - lhs.m_time *= static_cast<internal_type>(factor); - return lhs; + return ptime(lhs.m_time * static_cast<internal_type>(factor)); } - friend mult_type operator/(const ptime &lhs, const ptime &rhs) + friend constexpr mult_type operator/(const ptime &lhs, const ptime &rhs) noexcept { return static_cast<mult_type>(lhs.m_time / rhs.m_time); } - friend bool operator<(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator<(const ptime &lhs, const ptime &rhs) noexcept { return (lhs.m_time < rhs.m_time); } - friend bool operator>(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator>(const ptime &lhs, const ptime &rhs) noexcept { return (rhs < lhs); } - friend bool operator<=(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator<=(const ptime &lhs, const ptime &rhs) noexcept { return !(lhs > rhs); } - friend bool operator>=(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator>=(const ptime &lhs, const ptime &rhs) noexcept { return !(lhs < rhs); } - friend bool operator==(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator==(const ptime &lhs, const ptime &rhs) noexcept { return lhs.m_time == rhs.m_time; } - friend bool operator!=(const ptime &lhs, const ptime &rhs) + friend constexpr bool operator!=(const ptime &lhs, const ptime &rhs) noexcept { return !(lhs == rhs); } - constexpr internal_type as_raw() const { return m_time; } - constexpr double as_double() const { return static_cast<double>(m_time) - / static_cast<double>(resolution); } + constexpr internal_type as_raw() const noexcept { return m_time; } + constexpr double as_double() const noexcept + { + return static_cast<double>(m_time) + / static_cast<double>(resolution); + } // for save states .... - internal_type *get_internaltype_ptr() { return &m_time; } - - static constexpr ptime from_nsec(const internal_type ns) { return ptime(ns, UINT64_C(1000000000)); } - static constexpr ptime from_usec(const internal_type us) { return ptime(us, UINT64_C(1000000)); } - static constexpr ptime from_msec(const internal_type ms) { return ptime(ms, UINT64_C(1000)); } - static constexpr ptime from_hz(const internal_type hz) { return ptime(1 , hz); } - static constexpr ptime from_raw(const internal_type raw) { return ptime(raw, resolution); } - static constexpr ptime from_double(const double t) { return ptime(static_cast<internal_type>( t * static_cast<double>(resolution)), resolution); } - - static constexpr ptime zero() { return ptime(0, resolution); } - static constexpr ptime quantum() { return ptime(1, resolution); } - static constexpr ptime never() { return ptime(plib::numeric_limits<internal_type>::max(), resolution); } + internal_type *get_internaltype_ptr() noexcept { return &m_time; } + + static constexpr ptime from_nsec(const internal_type ns) noexcept { return ptime(ns, UINT64_C(1000000000)); } + static constexpr ptime from_usec(const internal_type us) noexcept { return ptime(us, UINT64_C(1000000)); } + static constexpr ptime from_msec(const internal_type ms) noexcept { return ptime(ms, UINT64_C(1000)); } + static constexpr ptime from_hz(const internal_type hz) noexcept { return ptime(1 , hz); } + static constexpr ptime from_raw(const internal_type raw) noexcept { return ptime(raw); } + static constexpr ptime from_double(const double t) noexcept { return ptime(static_cast<internal_type>( t * static_cast<double>(resolution)), resolution); } + + static constexpr ptime zero() noexcept { return ptime(0, resolution); } + static constexpr ptime quantum() noexcept { return ptime(1, resolution); } + static constexpr ptime never() noexcept { return ptime(plib::numeric_limits<internal_type>::max(), resolution); } private: + constexpr explicit ptime(const internal_type time) : m_time(time) {} internal_type m_time; }; diff --git a/src/lib/netlist/plib/palloc.cpp b/src/lib/netlist/plib/palloc.cpp index 2f1131601da..ceee5a75904 100644 --- a/src/lib/netlist/plib/palloc.cpp +++ b/src/lib/netlist/plib/palloc.cpp @@ -5,8 +5,6 @@ * */ -#include <cstdio> - #include "pconfig.h" #include "palloc.h" #include "pfmtlog.h" diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index 2d223180b3d..2e4c2809048 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -10,9 +10,6 @@ #include <vector> #include <memory> -#include <utility> - -#include "pconfig.h" #include "pstring.h" namespace plib { @@ -31,7 +28,7 @@ template<typename T> void pfree(T *ptr) { delete ptr; } template<typename T> -inline T* palloc_array(std::size_t num) +inline T* palloc_array(const std::size_t num) { return new T[num](); } diff --git a/src/lib/netlist/plib/pchrono.h b/src/lib/netlist/plib/pchrono.h index e37cd995ab5..5d64f9c4add 100644 --- a/src/lib/netlist/plib/pchrono.h +++ b/src/lib/netlist/plib/pchrono.h @@ -9,7 +9,6 @@ #define PCHRONO_H_ #include <cstdint> -#include <thread> #include <chrono> #include "pconfig.h" diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index f2164bbde7f..e3870206cbd 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -8,10 +8,6 @@ #ifndef PCONFIG_H_ #define PCONFIG_H_ -#include <cstdint> -#include <thread> -#include <chrono> - /* * Define this for more accurate measurements if you processor supports * RDTSCP. @@ -41,6 +37,9 @@ typedef __int128_t INT128; #endif #if defined(__GNUC__) +#ifdef RESTRICT +#undef RESTRICT +#endif #define RESTRICT __restrict__ #define ATTR_UNUSED __attribute__((__unused__)) #else @@ -52,16 +51,17 @@ typedef __int128_t INT128; // Standard defines //============================================================ -// prevent implicit copying -#define P_PREVENT_COPYING(name) \ - private: \ - name(const name &); \ - name &operator=(const name &); - //============================================================ -// cut down delegate implementation +// Pointer to Member Function //============================================================ +// This will be autodetected +// #define PPMF_TYPE 0 + +#define PPMF_TYPE_PMF 0 +#define PPMF_TYPE_GNUC_PMF_CONV 1 +#define PPMF_TYPE_INTERNAL 2 + #if defined(__GNUC__) /* does not work in versions over 4.7.x of 32bit MINGW */ #if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) @@ -86,66 +86,12 @@ typedef __int128_t INT128; #define MEMBER_ABI #endif -namespace plib { -/* - * The following class was derived from the MAME delegate.h code. - * It derives a pointer to a member function. - */ - -#if (PHAS_PMF_INTERNAL) - class mfp - { - public: - // construct from any member function pointer - class generic_class; - using generic_function = void (*)(); - - template<typename MemberFunctionType> - mfp(MemberFunctionType mftp) - : m_function(0), m_this_delta(0) - { - *reinterpret_cast<MemberFunctionType *>(this) = mftp; - } - - // binding helper - template<typename FunctionType, typename ObjectType> - FunctionType update_after_bind(ObjectType *object) - { - return reinterpret_cast<FunctionType>( - convert_to_generic(reinterpret_cast<generic_class *>(object))); - } - template<typename FunctionType, typename MemberFunctionType, typename ObjectType> - static FunctionType get_mfp(MemberFunctionType mftp, ObjectType *object) - { - mfp mfpo(mftp); - return mfpo.update_after_bind<FunctionType>(object); - } - - private: - // extract the generic function and adjust the object pointer - generic_function convert_to_generic(generic_class * object) const - { - // apply the "this" delta to the object first - generic_class * o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta); - - // if the low bit of the vtable index is clear, then it is just a raw function pointer - if (!(m_function & 1)) - return reinterpret_cast<generic_function>(m_function); - - // otherwise, it is the byte index into the vtable where the actual function lives - std::uint8_t *vtable_base = *reinterpret_cast<std::uint8_t **>(o_p_delta); - return *reinterpret_cast<generic_function *>(vtable_base + m_function - 1); - } - - // actual state - uintptr_t m_function; // first item can be one of two things: - // if even, it's a pointer to the function - // if odd, it's the byte offset into the vtable - int m_this_delta; // delta to apply to the 'this' pointer - }; - +#ifndef PPMF_TYPE + #if PHAS_PMF_INTERNAL + #define PPMF_TYPE PPMF_TYPE_INTERNAL + #else + #define PPMF_TYPE PPMF_TYPE_PMF + #endif #endif -} - #endif /* PCONFIG_H_ */ diff --git a/src/lib/netlist/plib/pdynlib.h b/src/lib/netlist/plib/pdynlib.h index e91b86e3a82..3a0c12a5f2d 100644 --- a/src/lib/netlist/plib/pdynlib.h +++ b/src/lib/netlist/plib/pdynlib.h @@ -7,10 +7,6 @@ #ifndef PDYNLIB_H_ #define PDYNLIB_H_ -#include <cstdarg> -#include <cstddef> - -#include "pconfig.h" #include "pstring.h" namespace plib { diff --git a/src/lib/netlist/plib/pexception.cpp b/src/lib/netlist/plib/pexception.cpp index 2eedd6f9d16..282acfe30d5 100644 --- a/src/lib/netlist/plib/pexception.cpp +++ b/src/lib/netlist/plib/pexception.cpp @@ -11,9 +11,9 @@ #include "pfmtlog.h" #if (defined(__x86_64__) || defined(__i386__)) && defined(__linux__) -#define HAS_FEENABLE_EXCEPT (1) +#define HAS_FEENABLE_EXCEPT (1) #else -#define HAS_FEENABLE_EXCEPT (0) +#define HAS_FEENABLE_EXCEPT (0) #endif namespace plib { diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h index a4d3b3c498f..9ef3077a75d 100644 --- a/src/lib/netlist/plib/pexception.h +++ b/src/lib/netlist/plib/pexception.h @@ -10,7 +10,6 @@ #include <exception> -#include "pconfig.h" #include "pstring.h" namespace plib { diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp index 48b0f1544c1..9451e11866d 100644 --- a/src/lib/netlist/plib/pfmtlog.cpp +++ b/src/lib/netlist/plib/pfmtlog.cpp @@ -6,11 +6,8 @@ */ #include <cstring> -//FIXME:: pstring should be locale free -#include <cctype> #include <cstdlib> -#include <cstdio> - +#include <cstdarg> #include <algorithm> #include "pfmtlog.h" @@ -22,7 +19,7 @@ plog_dispatch_intf::~plog_dispatch_intf() { } -pfmt::pfmt(const pstring &fmt) +pfmt::pfmt(const pstring fmt) : m_str(m_str_buf), m_allocated(0), m_arg(0) { std::size_t l = fmt.blen() + 1; @@ -34,18 +31,6 @@ pfmt::pfmt(const pstring &fmt) memcpy(m_str, fmt.c_str(), l); } -pfmt::pfmt(const char *fmt) -: m_str(m_str_buf), m_allocated(0), m_arg(0) -{ - std::size_t l = strlen(fmt) + 1; - if (l>sizeof(m_str_buf)) - { - m_allocated = 2 * l; - m_str = palloc_array<char>(2 * l); - } - memcpy(m_str, fmt, l); -} - pfmt::~pfmt() { if (m_allocated > 0) diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index c5369109b81..681607bddc0 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -9,12 +9,19 @@ #include <limits> -#include "pconfig.h" #include "pstring.h" #include "ptypes.h" namespace plib { +P_ENUM(plog_level, + DEBUG, + INFO, + VERBOSE, + WARNING, + ERROR, + FATAL) + template <typename T> struct ptype_traits_base { @@ -157,13 +164,12 @@ protected: class pfmt : public pformat_base<pfmt> { public: - explicit pfmt(const pstring &fmt); - explicit pfmt(const char *fmt); + explicit pfmt(const pstring fmt); virtual ~pfmt(); - operator pstring() const { return m_str; } + operator pstring() const { return pstring(m_str, pstring::UTF8); } - const char *cstr() { return m_str; } + const char *c_str() { return m_str; } protected: @@ -177,54 +183,53 @@ private: unsigned m_arg; }; -P_ENUM(plog_level, - DEBUG, - INFO, - VERBOSE, - WARNING, - ERROR, - FATAL) - class plog_dispatch_intf; template <bool build_enabled = true> -class pfmt_writer_t +class pfmt_writer_t : plib::nocopyassignmove { public: - pfmt_writer_t() : m_enabled(true) { } + explicit pfmt_writer_t() : m_enabled(true) { } virtual ~pfmt_writer_t() { } - void operator ()(const char *fmt) const + /* runtime enable */ + template<bool enabled, typename... Args> + void log(const pstring fmt, Args&&... args) const + { + if (build_enabled && enabled && m_enabled) (*this)(fmt, std::forward<Args>(args)...); + } + + void operator ()(const pstring fmt) const { if (build_enabled && m_enabled) vdowrite(fmt); } template<typename T1> - void operator ()(const char *fmt, const T1 &v1) const + void operator ()(const pstring fmt, const T1 &v1) const { if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)); } template<typename T1, typename T2> - void operator ()(const char *fmt, const T1 &v1, const T2 &v2) const + void operator ()(const pstring fmt, const T1 &v1, const T2 &v2) const { if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)); } template<typename T1, typename T2, typename T3> - void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3) const + void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3) const { if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)); } template<typename T1, typename T2, typename T3, typename T4> - void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) const + void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) const { if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)); } template<typename T1, typename T2, typename T3, typename T4, typename T5> - void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) const + void operator ()(const pstring fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) const { if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)(v5)); } @@ -237,18 +242,18 @@ public: bool is_enabled() const { return m_enabled; } protected: - virtual void vdowrite(const pstring &ls) const {} + virtual void vdowrite(const pstring &ls) const = 0; private: bool m_enabled; }; -template <plog_level::e L, bool build_enabled = true> +template <plog_level::E L, bool build_enabled = true> class plog_channel : public pfmt_writer_t<build_enabled> { public: - explicit plog_channel(plog_dispatch_intf *b) : pfmt_writer_t<build_enabled>(), m_base(b) { } + explicit plog_channel(plog_dispatch_intf *b) : pfmt_writer_t<build_enabled>(), m_base(b) { } virtual ~plog_channel() { } protected: @@ -260,7 +265,7 @@ private: class plog_dispatch_intf { - template<plog_level::e, bool> friend class plog_channel; + template<plog_level::E, bool> friend class plog_channel; public: virtual ~plog_dispatch_intf(); @@ -292,7 +297,7 @@ public: }; -template <plog_level::e L, bool build_enabled> +template <plog_level::E L, bool build_enabled> void plog_channel<L, build_enabled>::vdowrite(const pstring &ls) const { m_base->vlog(L, ls); diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp new file mode 100644 index 00000000000..b457c940021 --- /dev/null +++ b/src/lib/netlist/plib/pfunction.cpp @@ -0,0 +1,212 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * palloc.c + * + */ + +#include <cmath> +#include <stack> +#include "pfunction.h" +#include "pfmtlog.h" +#include "putil.h" +#include "pexception.h" + +namespace plib { + +void pfunction::compile(const std::vector<pstring> &inputs, const pstring expr) +{ + if (expr.startsWith("rpn:")) + compile_postfix(inputs, expr.substr(4)); + else + compile_infix(inputs, expr); +} + +void pfunction::compile_postfix(const std::vector<pstring> &inputs, const pstring expr) +{ + std::vector<pstring> cmds(plib::psplit(expr, " ")); + compile_postfix(inputs, cmds, expr); +} + +void pfunction::compile_postfix(const std::vector<pstring> &inputs, + const std::vector<pstring> &cmds, const pstring expr) +{ + m_precompiled.clear(); + int stk = 0; + + for (const pstring &cmd : cmds) + { + rpn_inst rc; + if (cmd == "+") + { rc.m_cmd = ADD; stk -= 1; } + else if (cmd == "-") + { rc.m_cmd = SUB; stk -= 1; } + else if (cmd == "*") + { rc.m_cmd = MULT; stk -= 1; } + else if (cmd == "/") + { rc.m_cmd = DIV; stk -= 1; } + else if (cmd == "pow") + { rc.m_cmd = POW; stk -= 1; } + else if (cmd == "sin") + { rc.m_cmd = SIN; stk -= 0; } + else if (cmd == "cos") + { rc.m_cmd = COS; stk -= 0; } + else + { + for (unsigned i = 0; i < inputs.size(); i++) + { + if (inputs[i] == cmd) + { + rc.m_cmd = PUSH_INPUT; + rc.m_param = i; + stk += 1; + break; + } + } + if (rc.m_cmd != PUSH_INPUT) + { + bool err = false; + rc.m_cmd = PUSH_CONST; + rc.m_param = cmd.as_double(&err); + if (err) + throw plib::pexception(plib::pfmt("nld_function: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); + stk += 1; + } + } + if (stk < 1) + throw plib::pexception(plib::pfmt("nld_function: stack underflow on token <{1}> in <{2}>")(cmd)(expr)); + m_precompiled.push_back(rc); + } + if (stk != 1) + throw plib::pexception(plib::pfmt("nld_function: stack count different to one on <{2}>")(expr)); +} + +static int get_prio(pstring v) +{ + if (v == "(" || v == ")") + return 1; + else if (v.left(v.begin()+1) >= "a" && v.left(v.begin()+1) <= "z") + return 0; + else if (v == "*" || v == "/") + return 20; + else if (v == "+" || v == "-") + return 10; + else if (v == "^") + return 30; + else + return -1; +} + +static pstring pop_check(std::stack<pstring> &stk, const pstring &expr) +{ + if (stk.size() == 0) + throw plib::pexception(plib::pfmt("nld_function: stack underflow during infix parsing of: <{1}>")(expr)); + pstring res = stk.top(); + stk.pop(); + return res; +} + +void pfunction::compile_infix(const std::vector<pstring> &inputs, const pstring expr) +{ + // Shunting-yard infix parsing + std::vector<pstring> sep = {"(", ")", ",", "*", "/", "+", "-", "^"}; + std::vector<pstring> sexpr(plib::psplit(expr.replace(" ",""), sep)); + std::stack<pstring> opstk; + std::vector<pstring> postfix; + + //printf("dbg: %s\n", expr.c_str()); + for (unsigned i = 0; i < sexpr.size(); i++) + { + pstring &s = sexpr[i]; + if (s=="(") + opstk.push(s); + else if (s==")") + { + pstring x = pop_check(opstk, expr); + while (x != "(") + { + postfix.push_back(x); + x = pop_check(opstk, expr); + } + if (opstk.size() > 0 && get_prio(opstk.top()) == 0) + postfix.push_back(pop_check(opstk, expr)); + } + else if (s==",") + { + pstring x = pop_check(opstk, expr); + while (x != "(") + { + postfix.push_back(x); + x = pop_check(opstk, expr); + } + opstk.push(x); + } + else { + int p = get_prio(s); + if (p>0) + { + if (opstk.size() == 0) + opstk.push(s); + else + { + if (get_prio(opstk.top()) >= get_prio(s)) + postfix.push_back(pop_check(opstk, expr)); + opstk.push(s); + } + } + else if (p == 0) // Function or variable + { + if (sexpr[i+1] == "(") + opstk.push(s); + else + postfix.push_back(s); + } + else + postfix.push_back(s); + } + } + while (opstk.size() > 0) + { + postfix.push_back(opstk.top()); + opstk.pop(); + } + compile_postfix(inputs, postfix, expr); +} + + +#define ST1 stack[ptr] +#define ST2 stack[ptr-1] + +#define OP(OP, ADJ, EXPR) \ +case OP: \ + ptr-=ADJ; \ + stack[ptr-1] = EXPR; \ + break; + +double pfunction::evaluate(const std::vector<double> &values) +{ + double stack[20]; + unsigned ptr = 0; + for (auto &rc : m_precompiled) + { + switch (rc.m_cmd) + { + OP(ADD, 1, ST2 + ST1) + OP(MULT, 1, ST2 * ST1) + OP(SUB, 1, ST2 - ST1) + OP(DIV, 1, ST2 / ST1) + OP(POW, 1, std::pow(ST2, ST1)) + OP(SIN, 0, std::sin(ST2)); + OP(COS, 0, std::cos(ST2)); + case PUSH_INPUT: + stack[ptr++] = values[static_cast<unsigned>(rc.m_param)]; + break; + case PUSH_CONST: + stack[ptr++] = rc.m_param; + break; + } + } + return stack[ptr-1]; +} + +} diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h new file mode 100644 index 00000000000..da61fe84e17 --- /dev/null +++ b/src/lib/netlist/plib/pfunction.h @@ -0,0 +1,87 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * pfunction.h + * + */ + +#ifndef PFUNCTION_H_ +#define PFUNCTION_H_ + +#include <vector> + +#include "pstring.h" + +namespace plib { + + //============================================================ + // function evaluation + //============================================================ + + /*! Class providing support for evaluating expressions + * + */ + class pfunction + { + enum rpn_cmd + { + ADD, + MULT, + SUB, + DIV, + POW, + SIN, + COS, + PUSH_CONST, + PUSH_INPUT + }; + struct rpn_inst + { + rpn_inst() : m_cmd(ADD), m_param(0.0) { } + rpn_cmd m_cmd; + double m_param; + }; + public: + pfunction() + { + } + + /*! Compile an expression + * + * @param inputs Vector of input variables, e.g. {"A","B"} + * @param expr infix or postfix expression. default is infix, postrix + * to be prefixed with rpn, e.g. "rpn:A B + 1.3 /" + */ + void compile(const std::vector<pstring> &inputs, const pstring expr); + + /*! Compile a rpn expression + * + * @param inputs Vector of input variables, e.g. {"A","B"} + * @param expr Reverse polish notation expression, e.g. "A B + 1.3 /" + */ + void compile_postfix(const std::vector<pstring> &inputs, const pstring expr); + /*! Compile an infix expression + * + * @param inputs Vector of input variables, e.g. {"A","B"} + * @param expr Infix expression, e.g. "(A+B)/1.3" + */ + void compile_infix(const std::vector<pstring> &inputs, const pstring expr); + /*! Evaluate the expression + * + * @param values for input variables, e.g. {1.1, 2.2} + * @return value of expression + */ + double evaluate(const std::vector<double> &values); + + private: + + void compile_postfix(const std::vector<pstring> &inputs, + const std::vector<pstring> &cmds, const pstring expr); + + std::vector<rpn_inst> m_precompiled; //!< precompiled expression + }; + + +} + +#endif /* PEXCEPTION_H_ */ diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index 37f4e2a1391..c6ba2821790 100644 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -10,10 +10,7 @@ #ifndef PLISTS_H_ #define PLISTS_H_ -#include <algorithm> #include <vector> -#include <type_traits> -#include <cmath> #include "pstring.h" @@ -56,6 +53,7 @@ public: template<typename... Args> void emplace(const std::size_t index, Args&&... args) { + // allocate on buffer new (&m_buf[index]) C(std::forward<Args>(args)...); } diff --git a/src/lib/netlist/plib/poptions.cpp b/src/lib/netlist/plib/poptions.cpp index a14d4ae93e7..775ee6d8810 100644 --- a/src/lib/netlist/plib/poptions.cpp +++ b/src/lib/netlist/plib/poptions.cpp @@ -39,13 +39,13 @@ namespace plib { { } - int option_str::parse(pstring argument) + int option_str::parse(const pstring &argument) { m_val = argument; return 0; } - int option_str_limit::parse(pstring argument) + int option_str_limit::parse(const pstring &argument) { if (plib::container::contains(m_limit, argument)) { @@ -56,20 +56,27 @@ namespace plib { return 1; } - int option_bool::parse(ATTR_UNUSED pstring argument) + int option_bool::parse(const pstring &argument) { m_val = true; return 0; } - int option_double::parse(pstring argument) + int option_double::parse(const pstring &argument) { bool err = false; m_val = argument.as_double(&err); return (err ? 1 : 0); } - int option_vec::parse(pstring argument) + int option_long::parse(const pstring &argument) + { + bool err = false; + m_val = argument.as_long(&err); + return (err ? 1 : 0); + } + + int option_vec::parse(const pstring &argument) { bool err = false; m_val.push_back(argument); @@ -102,18 +109,18 @@ namespace plib { int options::parse(int argc, char *argv[]) { - m_app = argv[0]; + m_app = pstring(argv[0], pstring::UTF8); for (int i=1; i<argc; ) { - pstring arg(argv[i]); + pstring arg(argv[i], pstring::UTF8); option *opt = nullptr; pstring opt_arg; bool has_equal_arg = false; if (arg.startsWith("--")) { - auto v = pstring_vector_t(arg.substr(2),"="); + auto v = psplit(arg.substr(2),"="); opt = getopt_long(v[0]); has_equal_arg = (v.size() > 1); if (has_equal_arg) @@ -148,7 +155,7 @@ namespace plib { else { i++; // FIXME: are there more arguments? - if (opt->parse(argv[i]) != 0) + if (opt->parse(pstring(argv[i], pstring::UTF8)) != 0) return i - 1; } } @@ -166,13 +173,13 @@ namespace plib { pstring options::split_paragraphs(pstring text, unsigned width, unsigned indent, unsigned firstline_indent) { - auto paragraphs = pstring_vector_t(text,"\n"); + auto paragraphs = psplit(text,"\n"); pstring ret(""); for (auto &p : paragraphs) { pstring line = pstring("").rpad(" ", firstline_indent); - for (auto &s : pstring_vector_t(p, " ")) + for (auto &s : psplit(p, " ")) { if (line.len() + s.len() > width) { diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h index aa5ce07cbc8..f859b2f5b3d 100644 --- a/src/lib/netlist/plib/poptions.h +++ b/src/lib/netlist/plib/poptions.h @@ -10,8 +10,6 @@ #ifndef POPTIONS_H_ #define POPTIONS_H_ -#include <cstddef> - #include "pstring.h" #include "plists.h" #include "putil.h" @@ -67,7 +65,7 @@ public: /* no_argument options will be called with "" argument */ - virtual int parse(ATTR_UNUSED pstring argument) = 0; + virtual int parse(const pstring &argument) = 0; pstring short_opt() { return m_short; } pstring long_opt() { return m_long; } @@ -85,7 +83,7 @@ public: : option(parent, ashort, along, help, true), m_val(defval) {} - virtual int parse(pstring argument) override; + virtual int parse(const pstring &argument) override; pstring operator ()() { return m_val; } private: @@ -96,17 +94,19 @@ class option_str_limit : public option { public: option_str_limit(options &parent, pstring ashort, pstring along, pstring defval, pstring limit, pstring help) - : option(parent, ashort, along, help, true), m_val(defval), m_limit(limit, ":") - {} + : option(parent, ashort, along, help, true), m_val(defval) + { + m_limit = plib::psplit(limit, ":"); + } - virtual int parse(pstring argument) override; + virtual int parse(const pstring &argument) override; pstring operator ()() { return m_val; } - const plib::pstring_vector_t &limit() { return m_limit; } + const std::vector<pstring> &limit() { return m_limit; } private: pstring m_val; - plib::pstring_vector_t m_limit; + std::vector<pstring> m_limit; }; class option_bool : public option @@ -116,7 +116,7 @@ public: : option(parent, ashort, along, help, false), m_val(false) {} - virtual int parse(ATTR_UNUSED pstring argument) override; + virtual int parse(const pstring &argument) override; bool operator ()() { return m_val; } private: @@ -130,13 +130,27 @@ public: : option(parent, ashort, along, help, true), m_val(defval) {} - virtual int parse(pstring argument) override; + virtual int parse(const pstring &argument) override; double operator ()() { return m_val; } private: double m_val; }; +class option_long : public option +{ +public: + option_long(options &parent, pstring ashort, pstring along, long defval, pstring help) + : option(parent, ashort, along, help, true), m_val(defval) + {} + + virtual int parse(const pstring &argument) override; + + long operator ()() { return m_val; } +private: + long m_val; +}; + class option_vec : public option { public: @@ -144,7 +158,7 @@ public: : option(parent, ashort, along, help, true) {} - virtual int parse(pstring argument) override; + virtual int parse(const pstring &argument) override; std::vector<pstring> operator ()() { return m_val; } private: diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp index 35629aacdee..6604c07dcb7 100644 --- a/src/lib/netlist/plib/pparser.cpp +++ b/src/lib/netlist/plib/pparser.cpp @@ -8,14 +8,15 @@ #include <cstdarg> #include "pparser.h" -#include "plib/palloc.h" +#include "palloc.h" +#include "putil.h" namespace plib { // ---------------------------------------------------------------------------------------- // A simple tokenizer // ---------------------------------------------------------------------------------------- -ptokenizer::ptokenizer(pistream &strm) +ptokenizer::ptokenizer(plib::putf8_reader &strm) : m_strm(strm), m_lineno(0), m_cur_line(""), m_px(m_cur_line.begin()), m_unget(0), m_string('"') { } @@ -302,7 +303,7 @@ void ppreprocessor::error(const pstring &err) -double ppreprocessor::expr(const pstring_vector_t &sexpr, std::size_t &start, int prio) +double ppreprocessor::expr(const std::vector<pstring> &sexpr, std::size_t &start, int prio) { double val; pstring tok=sexpr[start]; @@ -383,7 +384,7 @@ ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name) pstring ppreprocessor::replace_macros(const pstring &line) { - pstring_vector_t elems(line, m_expr_sep); + std::vector<pstring> elems(psplit(line, m_expr_sep)); pstringbuffer ret = ""; for (auto & elem : elems) { @@ -396,7 +397,7 @@ pstring ppreprocessor::replace_macros(const pstring &line) return ret; } -static pstring catremainder(const pstring_vector_t &elems, std::size_t start, pstring sep) +static pstring catremainder(const std::vector<pstring> &elems, std::size_t start, pstring sep) { pstringbuffer ret = ""; for (auto & elem : elems) @@ -415,13 +416,13 @@ pstring ppreprocessor::process_line(const pstring &line) // FIXME ... revise and extend macro handling if (lt.startsWith("#")) { - pstring_vector_t lti(lt, " ", true); + std::vector<pstring> lti(psplit(lt, " ", true)); if (lti[0].equals("#if")) { m_level++; std::size_t start = 0; lt = replace_macros(lt); - pstring_vector_t t(lt.substr(3).replace(" ",""), m_expr_sep); + std::vector<pstring> t(psplit(lt.substr(3).replace(" ",""), m_expr_sep)); int val = static_cast<int>(expr(t, start, 0)); if (val == 0) m_ifflag |= (1 << m_level); @@ -483,7 +484,7 @@ pstring ppreprocessor::process_line(const pstring &line) } -postream & ppreprocessor::process_i(pistream &istrm, postream &ostrm) +void ppreprocessor::process(putf8_reader &istrm, putf8_writer &ostrm) { pstring line; while (istrm.readline(line)) @@ -491,7 +492,6 @@ postream & ppreprocessor::process_i(pistream &istrm, postream &ostrm) line = process_line(line); ostrm.writeline(line); } - return ostrm; } } diff --git a/src/lib/netlist/plib/pparser.h b/src/lib/netlist/plib/pparser.h index db88299d85c..321dad2f608 100644 --- a/src/lib/netlist/plib/pparser.h +++ b/src/lib/netlist/plib/pparser.h @@ -11,18 +11,16 @@ #include <unordered_map> #include <cstdint> -#include "pconfig.h" #include "pstring.h" #include "plists.h" -#include "putil.h" +//#include "putil.h" #include "pstream.h" namespace plib { -class ptokenizer +class ptokenizer : nocopyassignmove { - P_PREVENT_COPYING(ptokenizer) public: - explicit ptokenizer(pistream &strm); + explicit ptokenizer(plib::putf8_reader &strm); virtual ~ptokenizer(); @@ -126,7 +124,7 @@ private: bool eof() { return m_strm.eof(); } - pistream &m_strm; + putf8_reader &m_strm; int m_lineno; pstring m_cur_line; @@ -148,9 +146,8 @@ private: }; -class ppreprocessor +class ppreprocessor : plib::nocopyassignmove { - P_PREVENT_COPYING(ppreprocessor) public: struct define_t @@ -165,22 +162,12 @@ public: ppreprocessor(std::vector<define_t> *defines = nullptr); virtual ~ppreprocessor() {} - template<class ISTR, class OSTR> - OSTR &process(ISTR &istrm, OSTR &ostrm) - { - return dynamic_cast<OSTR &>(process_i(istrm, ostrm)); - } + void process(putf8_reader &istrm, putf8_writer &ostrm); protected: - - postream &process_i(pistream &istrm, postream &ostrm); - - double expr(const plib::pstring_vector_t &sexpr, std::size_t &start, int prio); - + double expr(const std::vector<pstring> &sexpr, std::size_t &start, int prio); define_t *get_define(const pstring &name); - pstring replace_macros(const pstring &line); - virtual void error(const pstring &err); private: @@ -188,9 +175,9 @@ private: pstring process_line(const pstring &line); std::unordered_map<pstring, define_t> m_defines; - plib::pstring_vector_t m_expr_sep; + std::vector<pstring> m_expr_sep; - std::uint_least32_t m_ifflag; // 31 if levels + std::uint_least64_t m_ifflag; // 31 if levels int m_level; int m_lineno; }; diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h new file mode 100644 index 00000000000..03a2a65baa4 --- /dev/null +++ b/src/lib/netlist/plib/ppmf.h @@ -0,0 +1,198 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * ppmf.h + * + */ + +#ifndef PPMF_H_ +#define PPMF_H_ + +#include "pconfig.h" +#include <utility> +#include <cstdint> + + +/* + * + * NL_PMF_TYPE_GNUC_PMF + * Use standard pointer to member function syntax C++11 + * + * NL_PMF_TYPE_GNUC_PMF_CONV + * Use gnu extension and convert the pmf to a function pointer. + * This is not standard compliant and needs + * -Wno-pmf-conversions to compile. + * + * NL_PMF_TYPE_INTERNAL + * Use the same approach as MAME for deriving the function pointer. + * This is compiler-dependent as well + * + * Benchmarks for ./nltool -c run -f src/mame/machine/nl_pong.cpp -t 10 -n pong_fast + * + * NL_PMF_TYPE_INTERNAL: 215% 215% + * NL_PMF_TYPE_GNUC_PMF: 163% 196% + * NL_PMF_TYPE_GNUC_PMF_CONV: 215% 215% + * NL_PMF_TYPE_VIRTUAL: 213% 209% + * + * The whole exercise was done to avoid virtual calls. In prior versions of + * netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement. + * Since than, "hot" was removed from functions declared as virtual. + * This may explain that the recent benchmarks show no difference at all. + * + */ + +#if (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV) +#pragma GCC diagnostic ignored "-Wpmf-conversions" +#endif + +namespace plib { +/* + * The following class was derived from the MAME delegate.h code. + * It derives a pointer to a member function. + */ + +#if (PHAS_PMF_INTERNAL) + class mfp + { + public: + // construct from any member function pointer + class generic_class; + using generic_function = void (*)(); + + template<typename MemberFunctionType> + mfp(MemberFunctionType mftp) + : m_function(0), m_this_delta(0) + { + *reinterpret_cast<MemberFunctionType *>(this) = mftp; + } + + template<typename FunctionType, typename MemberFunctionType, typename ObjectType> + static FunctionType get_mfp(MemberFunctionType mftp, ObjectType *object) + { + mfp mfpo(mftp); + //return mfpo.update_after_bind<FunctionType>(object); + return reinterpret_cast<FunctionType>( + mfpo.convert_to_generic(reinterpret_cast<generic_class *>(object))); + } + + private: + // extract the generic function and adjust the object pointer + generic_function convert_to_generic(generic_class * object) const + { + // apply the "this" delta to the object first + generic_class * o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta); + + // if the low bit of the vtable index is clear, then it is just a raw function pointer + if (!(m_function & 1)) + return reinterpret_cast<generic_function>(m_function); + + // otherwise, it is the byte index into the vtable where the actual function lives + std::uint8_t *vtable_base = *reinterpret_cast<std::uint8_t **>(o_p_delta); + return *reinterpret_cast<generic_function *>(vtable_base + m_function - 1); + } + + // actual state + uintptr_t m_function; // first item can be one of two things: + // if even, it's a pointer to the function + // if odd, it's the byte offset into the vtable + int m_this_delta; // delta to apply to the 'this' pointer + }; +#endif + +#if (PPMF_TYPE == PPMF_TYPE_PMF) + template<typename R, typename... Targs> + class pmfp_base + { + public: + class generic_class; +#if defined (__INTEL_COMPILER) && defined (_M_X64) // needed for "Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130" at least + using generic_function = int [((sizeof(void *) + 4 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)]; +#elif defined(_MSC_VER)// all other cases - for MSVC maximum size is one pointer, plus 3 ints; all other implementations seem to be smaller + using generic_function = int [((sizeof(void *) + 3 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)]; +#else + using generic_function = R (generic_class::*)(Targs...); +#endif + pmfp_base() {} + + template<typename MemberFunctionType, typename O> + void set_base(MemberFunctionType mftp, O *object) + { + using function_ptr = R (O::*)(Targs...); + function_ptr t = mftp; + *reinterpret_cast<function_ptr *>(&m_func) = t; + } + template<typename O> + inline R call(O *obj, Targs... args) + { + using function_ptr = R (O::*)(Targs...); + function_ptr t = *reinterpret_cast<function_ptr *>(&m_func); + return (obj->*t)(std::forward<Targs>(args)...); + } + private: + generic_function m_func; + }; + +#elif ((PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV) || (PPMF_TYPE == PPMF_TYPE_INTERNAL)) + template<typename R, typename... Targs> + class pmfp_base + { + public: + using generic_function = void (*)(); + + pmfp_base() : m_func(nullptr) {} + + template<typename MemberFunctionType, typename O> + void set_base(MemberFunctionType mftp, O *object) + { + #if (PPMF_TYPE == PPMF_TYPE_INTERNAL) + using function_ptr = MEMBER_ABI R (*)(O *obj, Targs... args); + m_func = reinterpret_cast<generic_function>(plib::mfp::get_mfp<function_ptr>(mftp, object)); + #elif (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV) + R (O::* pFunc)(Targs...) = mftp; + m_func = reinterpret_cast<generic_function>((object->*pFunc)); + #endif + } + template<typename O> + inline R call(O *obj, Targs... args) const + { + using function_ptr = MEMBER_ABI R (*)(O *obj, Targs... args); + return (reinterpret_cast<function_ptr>(m_func))(obj, std::forward<Targs>(args)...); + } + bool is_set() { return m_func != nullptr; } + private: + generic_function m_func; + }; +#endif + + template<typename R, typename... Targs> + class pmfp : public pmfp_base<R, Targs...> + { + public: + class generic_class; + pmfp() : pmfp_base<R, Targs...>(), m_obj(nullptr) {} + + template<typename MemberFunctionType, typename O> + pmfp(MemberFunctionType mftp, O *object) + { + this->set(mftp, object); + } + + template<typename MemberFunctionType, typename O> + void set(MemberFunctionType mftp, O *object) + { + this->set_base(mftp, object); + m_obj = reinterpret_cast<generic_class *>(object); + } + + inline R operator()(Targs... args) + { + return this->call(m_obj, std::forward<Targs>(args)...); + } + private: + generic_class *m_obj; + }; + + +} + +#endif /* PPMF_H_ */ diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h index 7c25bf4d722..4256fa45152 100644 --- a/src/lib/netlist/plib/pstate.h +++ b/src/lib/netlist/plib/pstate.h @@ -8,13 +8,12 @@ #ifndef PSTATE_H_ #define PSTATE_H_ -#include <memory> -#include <type_traits> - -#include "plists.h" #include "pstring.h" #include "ptypes.h" +#include <vector> +#include <memory> + // ---------------------------------------------------------------------------------------- // state saving ... // ---------------------------------------------------------------------------------------- diff --git a/src/lib/netlist/plib/pstream.cpp b/src/lib/netlist/plib/pstream.cpp index b05d86d7bc5..efbf2aa2374 100644 --- a/src/lib/netlist/plib/pstream.cpp +++ b/src/lib/netlist/plib/pstream.cpp @@ -27,28 +27,6 @@ pistream::~pistream() { } -bool pistream::readline(pstring &line) -{ - char c = 0; - m_linebuf.clear(); - if (!this->readbyte(c)) - { - line = ""; - return false; - } - while (true) - { - if (c == 10) - break; - else if (c != 13) /* ignore CR */ - m_linebuf += c; - if (!this->readbyte(c)) - break; - } - line = m_linebuf; - return true; -} - // ----------------------------------------------------------------------------- // postream: output stream // ----------------------------------------------------------------------------- @@ -367,9 +345,43 @@ pstream::pos_type pomemstream::vtell() return m_pos; } -pstream_fmt_writer_t::~pstream_fmt_writer_t() +bool putf8_reader::readline(pstring &line) { + pstring::code_t c = 0; + m_linebuf.clear(); + if (!this->readcode(c)) + { + line = ""; + return false; + } + while (true) + { + if (c == 10) + break; + else if (c != 13) /* ignore CR */ + m_linebuf += pstring(c); + if (!this->readcode(c)) + break; + } + line = m_linebuf; + return true; } +putf8_fmt_writer::putf8_fmt_writer(postream &strm) +: pfmt_writer_t() +, putf8_writer(strm) +{ +} + +putf8_fmt_writer::~putf8_fmt_writer() +{ +} + +void putf8_fmt_writer::vdowrite(const pstring &ls) const +{ + write(ls); +} + + } diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index 6d02c4d1551..83c514da2e1 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -7,9 +7,6 @@ #ifndef PSTREAM_H_ #define PSTREAM_H_ -#include <cstdarg> -#include <cstddef> - #include "pconfig.h" #include "pstring.h" #include "pfmtlog.h" @@ -20,9 +17,8 @@ namespace plib { // pstream: things common to all streams // ----------------------------------------------------------------------------- -class pstream +class pstream : nocopyassignmove { - P_PREVENT_COPYING(pstream) public: using pos_type = std::size_t; @@ -73,7 +69,6 @@ private: class pistream : public pstream { - P_PREVENT_COPYING(pistream) public: explicit pistream(const unsigned flags) : pstream(flags) {} @@ -81,15 +76,6 @@ public: bool eof() const { return ((flags() & FLAG_EOF) != 0); } - /* this digests linux & dos/windows text files */ - - bool readline(pstring &line); - - bool readbyte(char &b) - { - return (read(&b, 1) == 1); - } - pos_type read(void *buf, const unsigned n) { return vread(buf, n); @@ -99,8 +85,6 @@ protected: /* read up to n bytes from stream */ virtual pos_type vread(void *buf, const pos_type n) = 0; -private: - pstringbuffer m_linebuf; }; // ----------------------------------------------------------------------------- @@ -109,30 +93,11 @@ private: class postream : public pstream { - P_PREVENT_COPYING(postream) public: explicit postream(unsigned flags) : pstream(flags) {} virtual ~postream(); - /* this digests linux & dos/windows text files */ - - void writeline(const pstring &line) - { - write(line); - write(10); - } - - void write(const pstring &text) - { - write(text.c_str(), text.blen()); - } - - void write(const char c) - { - write(&c, 1); - } - void write(const void *buf, const pos_type n) { vwrite(buf, n); @@ -153,7 +118,6 @@ private: class pomemstream : public postream { - P_PREVENT_COPYING(pomemstream) public: pomemstream(); @@ -177,8 +141,6 @@ private: class postringstream : public postream { - P_PREVENT_COPYING(postringstream ) - public: postringstream() : postream(0) { } @@ -205,7 +167,6 @@ private: class pofilestream : public postream { - P_PREVENT_COPYING(pofilestream) public: explicit pofilestream(const pstring &fname); @@ -233,7 +194,6 @@ private: class pstderr : public pofilestream { - P_PREVENT_COPYING(pstderr) public: pstderr(); virtual ~pstderr(); @@ -245,7 +205,6 @@ public: class pstdout : public pofilestream { - P_PREVENT_COPYING(pstdout) public: pstdout(); virtual ~pstdout(); @@ -257,7 +216,6 @@ public: class pifilestream : public pistream { - P_PREVENT_COPYING(pifilestream) public: explicit pifilestream(const pstring &fname); @@ -286,7 +244,6 @@ private: class pstdin : public pifilestream { - P_PREVENT_COPYING(pstdin) public: pstdin(); @@ -299,13 +256,13 @@ public: class pimemstream : public pistream { - P_PREVENT_COPYING(pimemstream) public: pimemstream(const void *mem, const pos_type len); explicit pimemstream(const pomemstream &ostrm); virtual ~pimemstream(); + pos_type size() const { return m_len; } protected: /* read up to n bytes from stream */ virtual pos_type vread(void *buf, const pos_type n) override; @@ -324,7 +281,6 @@ private: class pistringstream : public pimemstream { - P_PREVENT_COPYING(pistringstream) public: pistringstream(const pstring &str) : pimemstream(str.c_str(), str.len()), m_str(str) { } virtual ~pistringstream(); @@ -335,27 +291,86 @@ private: }; // ----------------------------------------------------------------------------- -// pstream_fmt_writer_t: writer on top of ostream +// putf8reader_t: reader on top of istream // ----------------------------------------------------------------------------- -class pstream_fmt_writer_t : public plib::pfmt_writer_t<> +/* this digests linux & dos/windows text files */ + +class putf8_reader : plib::nocopyassignmove { - P_PREVENT_COPYING(pstream_fmt_writer_t) public: + explicit putf8_reader(pistream &strm) : m_strm(strm) {} + virtual ~putf8_reader() {} - explicit pstream_fmt_writer_t(postream &strm) : m_strm(strm) {} - virtual ~pstream_fmt_writer_t(); + bool eof() const { return m_strm.eof(); } + bool readline(pstring &line); -protected: - virtual void vdowrite(const pstring &ls) const override + bool readbyte1(char &b) + { + return (m_strm.read(&b, 1) == 1); + } + + bool readcode(pstring::code_t &c) + { + char b[4]; + if (m_strm.read(&b[0], 1) != 1) + return false; + const unsigned l = pstring::traits::codelen(b); + for (unsigned i = 1; i < l; i++) + if (m_strm.read(&b[i], 1) != 1) + return false; + c = pstring::traits::code(b); + return true; + } + +private: + pistream &m_strm; + pstringbuffer m_linebuf; +}; + +// ----------------------------------------------------------------------------- +// putf8writer_t: writer on top of ostream +// ----------------------------------------------------------------------------- + +class putf8_writer : plib::nocopyassignmove +{ +public: + explicit putf8_writer(postream &strm) : m_strm(strm) {} + virtual ~putf8_writer() {} + + void writeline(const pstring &line) const { - m_strm.write(ls); + write(line); + write(10); + } + + void write(const pstring &text) const + { + m_strm.write(text.c_str(), text.blen()); + } + + void write(const pstring::code_t c) const + { + write(pstring(c)); } private: postream &m_strm; }; +class putf8_fmt_writer : public pfmt_writer_t<>, public putf8_writer +{ +public: + + explicit putf8_fmt_writer(postream &strm); + virtual ~putf8_fmt_writer(); + +protected: + virtual void vdowrite(const pstring &ls) const override; + +private: +}; + } #endif /* PSTREAM_H_ */ diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 2506357c9a5..baeace1edb9 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -6,17 +6,16 @@ */ #include <cstring> -//FIXME:: pstring should be locale free -#include <cctype> -#include <cstdlib> -#include <cstdio> #include <algorithm> #include <stack> +#include <cstdlib> #include "pstring.h" #include "palloc.h" #include "plists.h" +template <typename F> pstr_t pstring_t<F>::m_zero(0); + template<typename F> pstring_t<F>::~pstring_t() { @@ -97,14 +96,15 @@ const pstring_t<F> pstring_t<F>::substr(const iterator start, const iterator end return ret; } - template<typename F> const pstring_t<F> pstring_t<F>::ucase() const { - pstring_t ret = *this; - ret.pcopy(c_str(), blen()); - for (std::size_t i=0; i<ret.len(); i++) - ret.m_ptr->str()[i] = static_cast<char>(toupper(static_cast<int>(ret.m_ptr->str()[i]))); + pstring_t ret = ""; + for (auto c : *this) + if (c >= 'a' && c <= 'z') + ret += (c - 'a' + 'A'); + else + ret += c; return ret; } @@ -151,7 +151,7 @@ typename pstring_t<F>::iterator pstring_t<F>::find_last_not_of(const pstring_t & } template<typename F> -typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t &search, iterator start) const +typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t search, iterator start) const { for (; start != end(); ++start) { @@ -169,6 +169,15 @@ typename pstring_t<F>::iterator pstring_t<F>::find(const pstring_t &search, iter } template<typename F> +typename pstring_t<F>::iterator pstring_t<F>::find(const code_t search, iterator start) const +{ + mem_t buf[traits::MAXCODELEN+1] = { 0 }; + traits::encode(search, buf); + return find(pstring_t(&buf[0], UTF8), start); +} + + +template<typename F> pstring_t<F> pstring_t<F>::replace(const pstring_t &search, const pstring_t &replace) const { pstring_t ret(""); @@ -188,13 +197,13 @@ pstring_t<F> pstring_t<F>::replace(const pstring_t &search, const pstring_t &rep } template<typename F> -const pstring_t<F> pstring_t<F>::ltrim(const pstring_t &ws) const +const pstring_t<F> pstring_t<F>::ltrim(const pstring_t ws) const { return substr(find_first_not_of(ws), end()); } template<typename F> -const pstring_t<F> pstring_t<F>::rtrim(const pstring_t &ws) const +const pstring_t<F> pstring_t<F>::rtrim(const pstring_t ws) const { auto f = find_last_not_of(ws); if (f==end()) @@ -230,7 +239,7 @@ double pstring_t<F>::as_double(bool *error) const if (error != nullptr) *error = false; - ret = strtod(c_str(), &e); + ret = std::strtod(c_str(), &e); if (*e != 0) if (error != nullptr) *error = true; @@ -246,9 +255,9 @@ long pstring_t<F>::as_long(bool *error) const if (error != nullptr) *error = false; if (startsWith("0x")) - ret = strtol(substr(2).c_str(), &e, 16); + ret = std::strtol(substr(2).c_str(), &e, 16); else - ret = strtol(c_str(), &e, 10); + ret = std::strtol(c_str(), &e, 10); if (*e != 0) if (error != nullptr) *error = true; @@ -256,24 +265,6 @@ long pstring_t<F>::as_long(bool *error) const } template<typename F> -typename pstring_t<F>::iterator pstring_t<F>::find(const mem_t *search, iterator start) const -{ - for (; start != end(); ++start) - { - iterator itc(start); - iterator cmp(search); - while (itc != end() && *cmp != 0 && *itc == *cmp) - { - ++itc; - ++cmp; - } - if (*cmp == 0) - return start; - } - return end(); -} - -template<typename F> bool pstring_t<F>::startsWith(const pstring_t &arg) const { if (arg.blen() > blen()) @@ -291,17 +282,6 @@ bool pstring_t<F>::endsWith(const pstring_t &arg) const return (memcmp(c_str()+this->blen()-arg.blen(), arg.c_str(), arg.blen()) == 0); } - -template<typename F> -bool pstring_t<F>::startsWith(const mem_t *arg) const -{ - std::size_t alen = strlen(arg); - if (alen > blen()) - return false; - else - return (memcmp(arg, c_str(), alen) == 0); -} - template<typename F> int pstring_t<F>::pcmp(const mem_t *right) const { @@ -435,8 +415,8 @@ static inline std::size_t countleadbits(std::size_t x) template<typename F> void pstring_t<F>::sfree(pstr_t *s) { - s->m_ref_count--; - if (s->m_ref_count == 0 && s != &m_zero) + bool b = s->dec_and_check(); + if ( b && s != &m_zero) { if (stk != nullptr) { @@ -445,7 +425,6 @@ void pstring_t<F>::sfree(pstr_t *s) } else plib::pfree_array(reinterpret_cast<char *>(s)); - //_mm_free(((char *)s)); } } @@ -492,16 +471,15 @@ void pstring_t<F>::resetmem() template<typename F> void pstring_t<F>::sfree(pstr_t *s) { - s->m_ref_count--; - if (s->m_ref_count == 0 && s != &m_zero) + bool b = s->dec_and_check(); + if ( b && s != &m_zero) { plib::pfree_array(((char *)s)); - //_mm_free(((char *)s)); } } template<typename F> -pstr_t *pstring_t<F>::salloc(int n) +pstr_t *pstring_t<F>::salloc(std::size_t n) { int size = sizeof(pstr_t) + n + 1; pstr_t *p = (pstr_t *) plib::palloc_array<char>(size); diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 16bf61b08ee..80a8fc4e78e 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -7,11 +7,8 @@ #ifndef PSTRING_H_ #define PSTRING_H_ -#include <cstdarg> -#include <cstddef> #include <iterator> - -#include "pconfig.h" +#include <exception> // ---------------------------------------------------------------------------------------- // pstring: immutable strings ... @@ -22,27 +19,24 @@ struct pstr_t { - //str_t() : m_ref_count(1), m_len(0) { m_str[0] = 0; } - pstr_t(const std::size_t alen) - { - init(alen); - } + pstr_t(const std::size_t alen) { init(alen); } void init(const std::size_t alen) { - m_ref_count = 1; - m_len = alen; - m_str[0] = 0; + m_ref_count = 1; + m_len = alen; + m_str[0] = 0; } char *str() { return &m_str[0]; } unsigned char *ustr() { return reinterpret_cast<unsigned char *>(&m_str[0]); } std::size_t len() const { return m_len; } - int m_ref_count; + void inc() { m_ref_count++; } + bool dec_and_check() { --m_ref_count; return m_ref_count == 0; } private: + int m_ref_count; std::size_t m_len; char m_str[1]; }; - template <typename F> struct pstring_t { @@ -53,20 +47,38 @@ public: typedef typename F::code_t code_t; typedef std::size_t size_type; + enum enc_t + { + UTF8 + }; + // simple construction/destruction - pstring_t() + pstring_t() : m_ptr(&m_zero) { - init(); + init(nullptr); } ~pstring_t(); - // construction with copy - pstring_t(const mem_t *string) { init(); if (string != nullptr && *string != 0) pcopy(string); } - pstring_t(const pstring_t &string) { init(); pcopy(string); } + // FIXME: Do something with encoding + pstring_t(const mem_t *string, const enc_t enc) : m_ptr(&m_zero) + { + init(string); + } + + template<typename C, std::size_t N> + pstring_t(C (&string)[N]) : m_ptr(&m_zero) { + static_assert(std::is_same<C, const mem_t>::value, "pstring constructor only accepts const mem_t"); + static_assert(N>0,"pstring from array of length 0"); + if (string[N-1] != 0) + throw std::exception(); + init(string); + } + + pstring_t(const pstring_t &string) : m_ptr(&m_zero) { init(string); } pstring_t(pstring_t &&string) : m_ptr(string.m_ptr) { string.m_ptr = nullptr; } + explicit pstring_t(code_t code) : m_ptr(&m_zero) { pstring_t t; t+= code; init(t); } // assignment operators - pstring_t &operator=(const mem_t *string) { pcopy(string); return *this; } pstring_t &operator=(const pstring_t &string) { pcopy(string); return *this; } struct iterator final : public std::iterator<std::forward_iterator_tag, mem_t> @@ -94,41 +106,24 @@ public: // concatenation operators pstring_t& operator+=(const pstring_t &string) { pcat(string); return *this; } - pstring_t& operator+=(const mem_t *string) { pcat(string); return *this; } friend pstring_t operator+(const pstring_t &lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const pstring_t &lhs, const mem_t *rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const mem_t *lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } // comparison operators - bool operator==(const mem_t *string) const { return (pcmp(string) == 0); } bool operator==(const pstring_t &string) const { return (pcmp(string) == 0); } - bool operator!=(const mem_t *string) const { return (pcmp(string) != 0); } bool operator!=(const pstring_t &string) const { return (pcmp(string) != 0); } - bool operator<(const mem_t *string) const { return (pcmp(string) < 0); } bool operator<(const pstring_t &string) const { return (pcmp(string) < 0); } - bool operator<=(const mem_t *string) const { return (pcmp(string) <= 0); } bool operator<=(const pstring_t &string) const { return (pcmp(string) <= 0); } - bool operator>(const mem_t *string) const { return (pcmp(string) > 0); } bool operator>(const pstring_t &string) const { return (pcmp(string) > 0); } - bool operator>=(const mem_t *string) const { return (pcmp(string) >= 0); } bool operator>=(const pstring_t &string) const { return (pcmp(string) >= 0); } bool equals(const pstring_t &string) const { return (pcmp(string) == 0); } - - //int cmp(const pstring_t &string) const { return pcmp(string); } - //int cmp(const mem_t *string) const { return pcmp(string); } - bool startsWith(const pstring_t &arg) const; - bool startsWith(const mem_t *arg) const; - bool endsWith(const pstring_t &arg) const; - bool endsWith(const mem_t *arg) const { return endsWith(pstring_t(arg)); } pstring_t replace(const pstring_t &search, const pstring_t &replace) const; - const pstring_t cat(const pstring_t &s) const { return *this + s; } - const pstring_t cat(const mem_t *s) const { return *this + s; } + const pstring_t cat(const code_t c) const { return *this + c; } size_type blen() const { return m_ptr->len(); } @@ -145,11 +140,9 @@ public: pstring_t& operator+=(const code_t c) { mem_t buf[traits::MAXCODELEN+1] = { 0 }; traits::encode(c, buf); pcat(buf); return *this; } friend pstring_t operator+(const pstring_t &lhs, const code_t rhs) { return pstring_t(lhs) += rhs; } - iterator find(const pstring_t &search, iterator start) const; - iterator find(const pstring_t &search) const { return find(search, begin()); } - iterator find(const mem_t *search, iterator start) const; - iterator find(const mem_t *search) const { return find(search, begin()); } - iterator find(const code_t search, iterator start) const { mem_t buf[traits::MAXCODELEN+1] = { 0 }; traits::encode(search, buf); return find(buf, start); } + iterator find(const pstring_t search, iterator start) const; + iterator find(const pstring_t search) const { return find(search, begin()); } + iterator find(const code_t search, iterator start) const; iterator find(const code_t search) const { return find(search, begin()); } const pstring_t substr(const iterator start, const iterator end) const ; @@ -162,9 +155,9 @@ public: iterator find_first_not_of(const pstring_t &no) const; iterator find_last_not_of(const pstring_t &no) const; - const pstring_t ltrim(const pstring_t &ws = " \t\n\r") const; - const pstring_t rtrim(const pstring_t &ws = " \t\n\r") const; - const pstring_t trim(const pstring_t &ws = " \t\n\r") const { return this->ltrim(ws).rtrim(ws); } + const pstring_t ltrim(const pstring_t ws = pstring_t(" \t\n\r")) const; + const pstring_t rtrim(const pstring_t ws = pstring_t(" \t\n\r")) const; + const pstring_t trim(const pstring_t ws = pstring_t(" \t\n\r")) const { return this->ltrim(ws).rtrim(ws); } const pstring_t rpad(const pstring_t &ws, const size_type cnt) const; @@ -178,10 +171,16 @@ protected: pstr_t *m_ptr; private: - void init() + void init(const mem_t *string) + { + m_ptr->inc(); + if (string != nullptr && *string != 0) + pcopy(string); + } + void init(const pstring_t &string) { - m_ptr = &m_zero; - m_ptr->m_ref_count++; + m_ptr->inc(); + pcopy(string); } int pcmp(const pstring_t &right) const; @@ -191,14 +190,12 @@ private: void pcopy(const mem_t *from, std::size_t size); void pcopy(const mem_t *from); - void pcopy(const pstring_t &from) { sfree(m_ptr); m_ptr = from.m_ptr; - m_ptr->m_ref_count++; + m_ptr->inc(); } - void pcat(const mem_t *s); void pcat(const pstring_t &s); @@ -208,8 +205,6 @@ private: static pstr_t m_zero; }; -template <typename F> pstr_t pstring_t<F>::m_zero(0); - struct pu8_traits { static const unsigned MAXCODELEN = 1; /* in memory units */ @@ -358,7 +353,8 @@ public: // C string conversion helpers const char *c_str() const { return m_ptr; } - operator pstring() const { return pstring(m_ptr); } + // FIXME: encoding should be parameter + operator pstring() const { return pstring(m_ptr, pstring::UTF8); } // concatenation operators pstringbuffer& operator+=(const char c) { char buf[2] = { c, 0 }; pcat(buf); return *this; } diff --git a/src/lib/netlist/plib/ptypes.h b/src/lib/netlist/plib/ptypes.h index 9c477f71944..182333875d0 100644 --- a/src/lib/netlist/plib/ptypes.h +++ b/src/lib/netlist/plib/ptypes.h @@ -9,6 +9,7 @@ #define PTYPES_H_ #include <type_traits> +#include <limits> #include "pconfig.h" #include "pstring.h" @@ -39,10 +40,25 @@ namespace plib #endif //============================================================ + // prevent implicit copying + //============================================================ + + struct nocopyassignmove + { + protected: + nocopyassignmove() = default; + ~nocopyassignmove() = default; + private: + nocopyassignmove(const nocopyassignmove &) = delete; + nocopyassignmove(nocopyassignmove &&) = delete; + nocopyassignmove &operator=(const nocopyassignmove &) = delete; + }; + + //============================================================ // penum - strongly typed enumeration //============================================================ - struct enum_base + struct penum_base { protected: static int from_string_int(const char *str, const char *x); @@ -52,22 +68,22 @@ namespace plib } #define P_ENUM(ename, ...) \ - struct ename : public plib::enum_base { \ - enum e { __VA_ARGS__ }; \ - ename (e v) : m_v(v) { } \ + struct ename : public plib::penum_base { \ + enum E { __VA_ARGS__ }; \ + ename (E v) : m_v(v) { } \ bool set_from_string (const pstring &s) { \ static const char *strings = # __VA_ARGS__; \ int f = from_string_int(strings, s.c_str()); \ - if (f>=0) { m_v = static_cast<e>(f); return true; } else { return false; } \ + if (f>=0) { m_v = static_cast<E>(f); return true; } else { return false; } \ } \ - operator e() const {return m_v;} \ + operator E() const {return m_v;} \ bool operator==(const ename &rhs) const {return m_v == rhs.m_v;} \ - bool operator==(const e &rhs) const {return m_v == rhs;} \ + bool operator==(const E &rhs) const {return m_v == rhs;} \ const pstring name() const { \ static const char *strings = # __VA_ARGS__; \ return nthstr(static_cast<int>(m_v), strings); \ } \ - private: e m_v; }; + private: E m_v; }; #endif /* PTYPES_H_ */ diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp index 39e1b444f33..6a24e8c4012 100644 --- a/src/lib/netlist/plib/putil.cpp +++ b/src/lib/netlist/plib/putil.cpp @@ -36,13 +36,14 @@ namespace plib if (getenv(var.c_str()) == nullptr) return default_val; else - return pstring(getenv(var.c_str())); + return pstring(getenv(var.c_str()), pstring::UTF8); } } - pstring_vector_t::pstring_vector_t(const pstring &str, const pstring &onstr, bool ignore_empty) - : std::vector<pstring>() + std::vector<pstring> psplit(const pstring &str, const pstring &onstr, bool ignore_empty) { + std::vector<pstring> ret; + pstring::iterator p = str.begin(); pstring::iterator pn = str.find(onstr, p); @@ -50,7 +51,7 @@ namespace plib { pstring t = str.substr(p, pn); if (!ignore_empty || t.len() != 0) - this->push_back(t); + ret.push_back(t); p = pn + onstr.len(); pn = str.find(onstr, p); } @@ -58,14 +59,15 @@ namespace plib { pstring t = str.substr(p, str.end()); if (!ignore_empty || t.len() != 0) - this->push_back(t); + ret.push_back(t); } + return ret; } - pstring_vector_t::pstring_vector_t(const pstring &str, const pstring_vector_t &onstrl) - : std::vector<pstring>() + std::vector<pstring> psplit(const pstring &str, const std::vector<pstring> &onstrl) { pstring col = ""; + std::vector<pstring> ret; unsigned i = 0; while (i<str.blen()) @@ -82,10 +84,10 @@ namespace plib if (p != static_cast<std::size_t>(-1)) { if (col != "") - this->push_back(col); + ret.push_back(col); col = ""; - this->push_back(onstrl[p]); + ret.push_back(onstrl[p]); i += onstrl[p].blen(); } else @@ -96,11 +98,13 @@ namespace plib } } if (col != "") - this->push_back(col); + ret.push_back(col); + + return ret; } - int enum_base::from_string_int(const char *str, const char *x) + int penum_base::from_string_int(const char *str, const char *x) { int cnt = 0; const char *cur = str; @@ -127,7 +131,7 @@ namespace plib return cnt; return -1; } - pstring enum_base::nthstr(int n, const char *str) + pstring penum_base::nthstr(int n, const char *str) { char buf[64]; char *bufp = buf; @@ -139,7 +143,7 @@ namespace plib if (*str == ',') { *bufp = 0; - return pstring(buf); + return pstring(buf, pstring::UTF8); } else if (*str != ' ') *bufp++ = *str; @@ -152,6 +156,6 @@ namespace plib str++; } *bufp = 0; - return pstring(buf); + return pstring(buf, pstring::UTF8); } } // namespace plib diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h index 9e79e958927..4bc8dcd695f 100644..100755 --- a/src/lib/netlist/plib/putil.h +++ b/src/lib/netlist/plib/putil.h @@ -8,17 +8,18 @@ #ifndef P_UTIL_H_ #define P_UTIL_H_ -#include <initializer_list> +#include "pstring.h" -#include "plib/pstring.h" -#include "plib/plists.h" +#include <initializer_list> +#include <algorithm> +#include <vector> // <<= needed by windows build namespace plib { namespace util { const pstring buildpath(std::initializer_list<pstring> list ); - const pstring environment(const pstring &var, const pstring &default_val = ""); + const pstring environment(const pstring &var, const pstring &default_val); } namespace container @@ -66,13 +67,8 @@ namespace plib // string list // ---------------------------------------------------------------------------------------- - class pstring_vector_t : public std::vector<pstring> - { - public: - pstring_vector_t() : std::vector<pstring>() { } - pstring_vector_t(const pstring &str, const pstring &onstr, bool ignore_empty = false); - pstring_vector_t(const pstring &str, const pstring_vector_t &onstrl); - }; + std::vector<pstring> psplit(const pstring &str, const pstring &onstr, bool ignore_empty = false); + std::vector<pstring> psplit(const pstring &str, const std::vector<pstring> &onstrl); } diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 91f9fc7c1ae..6eec3d0e6dc 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -8,21 +8,12 @@ ****************************************************************************/ -#include <cstdio> -#include <cstdlib> - #include "plib/poptions.h" -#include "plib/pstring.h" -#include "plib/plists.h" -#include "plib/ptypes.h" -#include "plib/pexception.h" #include "nl_setup.h" -#include "nl_factory.h" #include "nl_parser.h" #include "devices/net_lib.h" #include "tools/nl_convert.h" - -#include <cfenv> +#include "solver/nld_solver.h" class tool_options_t : public plib::options { @@ -30,7 +21,7 @@ public: tool_options_t() : plib::options(), opt_grp1(*this, "General options", "The following options apply to all commands."), - opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static", "run|convert|listdevices|static"), + opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header", "run|convert|listdevices|static|header"), opt_file(*this, "f", "file", "-", "file to process (default is stdin)"), opt_defines(*this, "D", "define", "predefine value as macro, e.g. -Dname=value. If '=value' is omitted predefine it as 1. This option may be specified repeatedly."), opt_rfolders(*this, "r", "rom", "where to look for files"), @@ -77,8 +68,8 @@ public: static plib::pstdout pout_strm; static plib::pstderr perr_strm; -static plib::pstream_fmt_writer_t pout(pout_strm); -static plib::pstream_fmt_writer_t perr(perr_strm); +static plib::putf8_fmt_writer pout(pout_strm); +static plib::putf8_fmt_writer perr(perr_strm); static NETLIST_START(dummy) /* Standard stuff */ @@ -211,7 +202,7 @@ struct input_t if (e != 3) throw netlist::nl_exception(plib::pfmt("error {1} scanning line {2}\n")(e)(line)); m_time = netlist::netlist_time::from_double(t); - m_param = setup.find_param(buf, true); + m_param = setup.find_param(pstring(buf, pstring::UTF8), true); } void setparam() @@ -244,8 +235,9 @@ static std::vector<input_t> read_input(const netlist::setup_t &setup, pstring fn if (fname != "") { plib::pifilestream f(fname); + plib::putf8_reader r(f); pstring l; - while (f.readline(l)) + while (r.readline(l)) { if (l != "") { @@ -319,12 +311,95 @@ static void static_compile(tool_options_t &opts) opts.opt_logs(), opts.opt_defines(), opts.opt_rfolders()); - nt.solver()->create_solver_code(pout_strm); + plib::putf8_writer w(pout_strm); + std::map<pstring, pstring> mp; + + nt.solver()->create_solver_code(mp); + + for (auto &e : mp) + { + w.write(e.second); + } nt.stop(); } +static void mac_out(const pstring s, const bool cont = true) +{ + static const unsigned RIGHT = 72; + if (cont) + { + unsigned adj = 0; + for (auto x : s) + adj += (x == '\t' ? 3 : 0); + pout("{1}\\\n", s.rpad(" ", RIGHT-1-adj)); + } + else + pout("{1}\n", s); +} + +static void create_header(tool_options_t &opts) +{ + netlist_tool_t nt("netlist"); + + nt.init(); + + nt.log().verbose.set_enabled(false); + nt.log().warning.set_enabled(false); + + nt.setup().register_source(plib::make_unique_base<netlist::source_t, + netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy)); + nt.setup().include("dummy"); + + pout("// license:GPL-2.0+\n"); + pout("// copyright-holders:Couriersud\n"); + pout("#ifndef NLD_DEVINC_H\n"); + pout("#define NLD_DEVINC_H\n"); + pout("\n"); + pout("#include \"nl_setup.h\"\n"); + pout("#ifndef __PLIB_PREPROCESSOR__\n"); + pout("\n"); + pout("/* ----------------------------------------------------------------------------\n"); + pout(" * Netlist Macros\n"); + pout(" * ---------------------------------------------------------------------------*/\n"); + pout("\n"); + + pstring last_source(""); + + for (auto &e : nt.setup().factory()) + { + if (last_source != e->sourcefile()) + { + last_source = e->sourcefile(); + pout("{1}\n", pstring("// ").rpad("-", 72)); + pout("{1}\n", pstring("// Source: ").cat(e->sourcefile().replace("../",""))); + pout("{1}\n", pstring("// ").rpad("-", 72)); + } + auto v = plib::psplit(e->param_desc(), ","); + pstring vs; + for (auto s : v) + vs += ", p" + s.replace("+","").replace(".","_"); + mac_out("#define " + e->name() + "(name" + vs + ")"); + mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)"); \ + + for (auto s : v) + { + pstring r(s.replace("+","").replace(".","_")); + if (s.startsWith("+")) + mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")"); + else + mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")"); + } + mac_out("", false); + } + pout("#endif // __PLIB_PREPROCESSOR__\n"); + pout("#endif\n"); + nt.stop(); + +} + + /*------------------------------------------------- listdevices - list all known devices -------------------------------------------------*/ @@ -390,7 +465,7 @@ static void listdevices(tool_options_t &opts) } out += "," + f->param_desc(); - for (auto p : plib::pstring_vector_t(f->param_desc(),",") ) + for (auto p : plib::psplit(f->param_desc(),",") ) { if (p.startsWith("+")) { @@ -417,7 +492,7 @@ static void listdevices(tool_options_t &opts) -------------------------------------------------*/ #if 0 -static const char *pmf_verbose[] = +static const pstring pmf_verbose[] = { "NL_PMF_TYPE_VIRTUAL", "NL_PMF_TYPE_GNUC_PMF", @@ -455,7 +530,7 @@ int main(int argc, char *argv[]) { pout( "nltool (netlist) 0.1\n" - "Copyright (C) 2016 Couriersud\n" + "Copyright (C) 2017 Couriersud\n" "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n" @@ -472,6 +547,8 @@ int main(int argc, char *argv[]) run(opts); else if (cmd == "static") static_compile(opts); + else if (cmd == "header") + create_header(opts); else if (cmd == "convert") { pstring contents; @@ -508,7 +585,7 @@ int main(int argc, char *argv[]) result = c.result(); } /* present result */ - pout_strm.write(result.c_str()); + pout.write(result); } else { diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp index 44adf2b3508..52f59f366f6 100644 --- a/src/lib/netlist/prg/nlwav.cpp +++ b/src/lib/netlist/prg/nlwav.cpp @@ -1,13 +1,12 @@ // license:GPL-2.0+ // copyright-holders:Couriersud -#include <plib/poptions.h> -#include <cstdio> #include <cstring> #include "plib/pstring.h" #include "plib/plists.h" #include "plib/pstream.h" +#include "plib/poptions.h" +#include "plib/ppmf.h" #include "nl_setup.h" -#include <memory> class nlwav_options_t : public plib::options { @@ -17,6 +16,7 @@ public: opt_inp(*this, "i", "input", "-", "input file"), opt_out(*this, "o", "output", "-", "output file"), opt_amp(*this, "a", "amp", 10000.0, "amplification after mean correction"), + opt_rate(*this, "r", "rate", 48000, "sample rate of output file"), opt_verb(*this, "v", "verbose", "be verbose - this produces lots of output"), opt_quiet(*this,"q", "quiet", "be quiet - no warnings"), opt_version(*this, "", "version", "display version and exit"), @@ -25,6 +25,7 @@ public: plib::option_str opt_inp; plib::option_str opt_out; plib::option_double opt_amp; + plib::option_long opt_rate; plib::option_bool opt_verb; plib::option_bool opt_quiet; plib::option_bool opt_version; @@ -35,8 +36,8 @@ plib::pstdin pin_strm; plib::pstdout pout_strm; plib::pstderr perr_strm; -plib::pstream_fmt_writer_t pout(pout_strm); -plib::pstream_fmt_writer_t perr(perr_strm); +plib::putf8_fmt_writer pout(pout_strm); +plib::putf8_fmt_writer perr(perr_strm); nlwav_options_t opts; @@ -141,11 +142,114 @@ private: }; -static void convert() +class log_processor { - plib::postream *fo = (opts.opt_out() == "-" ? &pout_strm : new plib::pofilestream(opts.opt_out())); - plib::pistream *fin = (opts.opt_inp() == "-" ? &pin_strm : new plib::pifilestream(opts.opt_inp())); - wav_t *wo = new wav_t(*fo, 48000); +public: + typedef plib::pmfp<void, double, double> callback_type; + log_processor(plib::pistream &is, callback_type cb) : m_is(is), m_cb(cb) { } + + void process() + { + plib::putf8_reader reader(m_is); + pstring line; + + while(reader.readline(line)) + { + double t = 0.0; double v = 0.0; + sscanf(line.c_str(), "%lf %lf", &t, &v); + m_cb(t, v); + } + } + +private: + plib::pistream &m_is; + callback_type m_cb; +}; + +struct aggregator +{ + typedef plib::pmfp<void, double, double> callback_type; + + aggregator(double quantum, callback_type cb) + : m_quantum(quantum) + , m_cb(cb) + , ct(0.0) + , lt(0.0) + , outsam(0.0) + , cursam(0.0) + { } + void process(double time, double val) + { + while (time >= ct) + { + outsam += (ct - lt) * cursam; + outsam = outsam / m_quantum; + m_cb(ct, outsam); + outsam = 0.0; + lt = ct; + ct += m_quantum; + } + outsam += (time-lt)*cursam; + lt = time; + cursam = val; + } + +private: + double m_quantum; + callback_type m_cb; + double ct; + double lt; + double outsam; + double cursam; +}; + +class wavwriter +{ +public: + wavwriter(plib::postream &fo, unsigned sample_rate, double ampa) + : mean(0.0) + , means(0.0) + , maxsam(-1e9) + , minsam(1e9) + , n(0) + , m_fo(fo) + , amp(ampa) + , m_wo(m_fo, sample_rate) + { } + + void process(double time, double outsam) + { + means += outsam; + maxsam = std::max(maxsam, outsam); + minsam = std::min(minsam, outsam); + n++; + //mean = means / (double) n; + mean += 5.0 / static_cast<double>(m_wo.sample_rate()) * (outsam - mean); + + outsam = (outsam - mean) * amp; + outsam = std::max(-32000.0, outsam); + outsam = std::min(32000.0, outsam); + m_wo.write_sample(static_cast<int>(outsam)); + } + + double mean; + double means; + double maxsam; + double minsam; + std::size_t n; + +private: + plib::postream &m_fo; + double amp; + wav_t m_wo; +}; + +static void convert(long sample_rate) +{ + plib::postream *fo = (opts.opt_out() == "-" ? &pout_strm : plib::palloc<plib::pofilestream>(opts.opt_out())); + plib::pistream *fin = (opts.opt_inp() == "-" ? &pin_strm : plib::palloc<plib::pifilestream>(opts.opt_inp())); + plib::putf8_reader reader(*fin); + wav_t *wo = plib::palloc<wav_t>(*fo, static_cast<unsigned>(sample_rate)); double dt = 1.0 / static_cast<double>(wo->sample_rate()); double ct = dt; @@ -162,7 +266,7 @@ static void convert() //short sample = 0; pstring line; - while(fin->readline(line)) + while(reader.readline(line)) { #if 1 double t = 0.0; double v = 0.0; @@ -212,11 +316,11 @@ static void convert() //printf("%f %f\n", t, v); #endif } - delete wo; + plib::pfree(wo); if (opts.opt_inp() != "-") - delete fin; + plib::pfree(fin); if (opts.opt_out() != "-") - delete fo; + plib::pfree(fo); if (!opts.opt_quiet()) { @@ -227,10 +331,39 @@ static void convert() } } -static void usage(plib::pstream_fmt_writer_t &fw) +static void convert1(long sample_rate) +{ + plib::postream *fo = (opts.opt_out() == "-" ? &pout_strm : plib::palloc<plib::pofilestream>(opts.opt_out())); + plib::pistream *fin = (opts.opt_inp() == "-" ? &pin_strm : plib::palloc<plib::pifilestream>(opts.opt_inp())); + + double dt = 1.0 / static_cast<double>(sample_rate); + + wavwriter *wo = plib::palloc<wavwriter>(*fo, static_cast<unsigned>(sample_rate), opts.opt_amp()); + aggregator ag(dt, aggregator::callback_type(&wavwriter::process, wo)); + log_processor lp(*fin, log_processor::callback_type(&aggregator::process, &ag)); + + lp.process(); + + if (!opts.opt_quiet()) + { + perr("Mean (low freq filter): {}\n", wo->mean); + perr("Mean (static): {}\n", wo->means / static_cast<double>(wo->n)); + perr("Amp + {}\n", 32000.0 / (wo->maxsam - wo->mean)); + perr("Amp - {}\n", -32000.0 / (wo->minsam - wo->mean)); + } + + plib::pfree(wo); + if (opts.opt_inp() != "-") + plib::pfree(fin); + if (opts.opt_out() != "-") + plib::pfree(fo); + +} + +static void usage(plib::putf8_fmt_writer &fw) { fw("{}\n", opts.help("Convert netlist log files into wav files.\n", - "nltool [options]").c_str()); + "nltool [options]")); } @@ -255,7 +388,7 @@ int main(int argc, char *argv[]) { pout( "nlwav (netlist) 0.1\n" - "Copyright (C) 2016 Couriersud\n" + "Copyright (C) 2017 Couriersud\n" "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n" @@ -263,7 +396,10 @@ int main(int argc, char *argv[]) return 0; } - convert(); + if ((1)) + convert1(opts.opt_rate()); + else + convert(opts.opt_rate()); return 0; } diff --git a/src/lib/netlist/solver/mat_cr.h b/src/lib/netlist/solver/mat_cr.h index 340c662752f..c39af1b2f5f 100644 --- a/src/lib/netlist/solver/mat_cr.h +++ b/src/lib/netlist/solver/mat_cr.h @@ -12,38 +12,79 @@ #include <algorithm> #include "plib/pconfig.h" +#include "plib/palloc.h" -template<int storage_N> +template<std::size_t N, typename C = uint16_t, typename T = double> struct mat_cr_t { - unsigned nz_num; - unsigned ia[storage_N + 1]; - unsigned ja[storage_N * storage_N]; - unsigned diag[storage_N]; /* n */ + typedef C index_type; + typedef T value_type; - template<typename T> - void mult_vec(const T * RESTRICT A, const T * RESTRICT x, T * RESTRICT res) + C diag[N]; // diagonal index pointer n + C ia[N+1]; // row index pointer n + 1 + C ja[N*N]; // column index array nz_num, initially (n * n) + T A[N*N]; // Matrix elements nz_num, initially (n * n) + + std::size_t size; + std::size_t nz_num; + + mat_cr_t(const std::size_t n) + : size(n) + , nz_num(0) + { +#if 0 +#if 0 + ia = plib::palloc_array<C>(n + 1); + ja = plib::palloc_array<C>(n * n); + diag = plib::palloc_array<C>(n); +#else + diag = plib::palloc_array<C>(n + (n + 1) + n * n); + ia = diag + n; + ja = ia + (n+1); + A = plib::palloc_array<T>(n * n); +#endif +#endif + } + + ~mat_cr_t() + { +#if 0 + plib::pfree_array(diag); +#if 0 + plib::pfree_array(ia); + plib::pfree_array(ja); +#endif + plib::pfree_array(A); +#endif + } + + void set_scalar(const T scalar) + { + for (std::size_t i=0, e=nz_num; i<e; i++) + A[i] = scalar; + } + + void mult_vec(const T * RESTRICT x, T * RESTRICT res) { /* * res = A * x */ - unsigned i = 0; - unsigned k = 0; - const unsigned oe = nz_num; + std::size_t i = 0; + std::size_t k = 0; + const std::size_t oe = nz_num; while (k < oe) { T tmp = 0.0; - const unsigned e = ia[i+1]; + const std::size_t e = ia[i+1]; for (; k < e; k++) tmp += A[k] * x[ja[k]]; res[i++] = tmp; } } - template<typename T> - void incomplete_LU_factorization(const T * RESTRICT A, T * RESTRICT LU) + void incomplete_LU_factorization(T * RESTRICT LU) { /* * incomplete LU Factorization according to http://de.wikipedia.org/wiki/ILU-Zerlegung @@ -52,28 +93,28 @@ struct mat_cr_t * */ - const unsigned lnz = nz_num; + const std::size_t lnz = nz_num; - for (unsigned k = 0; k < lnz; k++) + for (std::size_t k = 0; k < lnz; k++) LU[k] = A[k]; - for (unsigned i = 1; ia[i] < lnz; i++) // row i + for (std::size_t i = 1; ia[i] < lnz; i++) // row i { - const unsigned iai1 = ia[i + 1]; - const unsigned pke = diag[i]; - for (unsigned pk = ia[i]; pk < pke; pk++) // all columns left of diag in row i + const std::size_t iai1 = ia[i + 1]; + const std::size_t pke = diag[i]; + for (std::size_t pk = ia[i]; pk < pke; pk++) // all columns left of diag in row i { // pk == (i, k) - const unsigned k = ja[pk]; - const unsigned iak1 = ia[k + 1]; + const std::size_t k = ja[pk]; + const std::size_t iak1 = ia[k + 1]; const T LUpk = LU[pk] = LU[pk] / LU[diag[k]]; - unsigned pt = ia[k]; + std::size_t pt = ia[k]; - for (unsigned pj = pk + 1; pj < iai1; pj++) // pj = (i, j) + for (std::size_t pj = pk + 1; pj < iai1; pj++) // pj = (i, j) { // we can assume that within a row ja increases continuously */ - const unsigned ej = ja[pj]; + const std::size_t ej = ja[pj]; while (ja[pt] < ej && pt < iak1) pt++; if (pt < iak1 && ja[pt] == ej) @@ -83,7 +124,6 @@ struct mat_cr_t } } - template<typename T> void solveLUx (const T * RESTRICT LU, T * RESTRICT r) { /* @@ -96,7 +136,7 @@ struct mat_cr_t * * ==> LUx = r * - * ==> Ux = L?????r = w + * ==> Ux = L⁻¹ r = w * * ==> r = Lw * @@ -108,32 +148,28 @@ struct mat_cr_t * */ - unsigned i; - - for (i = 1; ia[i] < nz_num; i++ ) + for (std::size_t i = 1; ia[i] < nz_num; ++i ) { T tmp = 0.0; - const unsigned j1 = ia[i]; - const unsigned j2 = diag[i]; + const std::size_t j1 = ia[i]; + const std::size_t j2 = diag[i]; - for (unsigned j = j1; j < j2; j++ ) + for (std::size_t j = j1; j < j2; ++j ) tmp += LU[j] * r[ja[j]]; r[i] -= tmp; } // i now is equal to n; - for (; 0 < i; i-- ) + for (std::size_t i = size; i-- > 0; ) { - const unsigned im1 = i - 1; T tmp = 0.0; - const unsigned j1 = diag[im1] + 1; - const unsigned j2 = ia[im1+1]; - for (unsigned j = j1; j < j2; j++ ) + const std::size_t di = diag[i]; + const std::size_t j2 = ia[i+1]; + for (std::size_t j = di + 1; j < j2; j++ ) tmp += LU[j] * r[ja[j]]; - r[im1] = (r[im1] - tmp) / LU[diag[im1]]; + r[i] = (r[i] - tmp) / LU[di]; } } - }; #endif /* MAT_CR_H_ */ diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index a27301a754d..f314aea2314 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -8,6 +8,8 @@ #include "nld_matrix_solver.h" #include "plib/putil.h" +#include <cmath> // <<= needed by windows build + namespace netlist { namespace devices @@ -64,7 +66,7 @@ void terms_for_net_t::set_pointers() for (unsigned i = 0; i < count(); i++) { m_terms[i]->set_ptrs(&m_gt[i], &m_go[i], &m_Idr[i]); - m_connected_net_V[i] = m_terms[i]->m_otherterm->net().m_cur_Analog.ptr(); + m_connected_net_V[i] = m_terms[i]->m_otherterm->net().Q_Analog_state_ptr(); } } @@ -91,15 +93,11 @@ matrix_solver_t::matrix_solver_t(netlist_t &anetlist, const pstring &name, matrix_solver_t::~matrix_solver_t() { - for (unsigned k = 0; k < m_terms.size(); k++) - { - plib::pfree(m_terms[k]); - } - } void matrix_solver_t::setup_base(analog_net_t::list_t &nets) { + log().debug("New solver setup\n"); m_nets.clear(); @@ -108,7 +106,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets) for (auto & net : nets) { m_nets.push_back(net); - m_terms.push_back(plib::palloc<terms_for_net_t>()); + m_terms.push_back(plib::make_unique<terms_for_net_t>()); m_rails_temp.push_back(plib::palloc<terms_for_net_t>()); } @@ -125,7 +123,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets) log().debug("{1} {2} {3}\n", p->name(), net->name(), net->isRailNet()); switch (p->type()) { - case terminal_t::TERMINAL: + case detail::terminal_type::TERMINAL: if (p->device().is_timestep()) if (!plib::container::contains(m_step_devices, &p->device())) m_step_devices.push_back(&p->device()); @@ -138,7 +136,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets) } log().debug("Added terminal {1}\n", p->name()); break; - case terminal_t::INPUT: + case detail::terminal_type::INPUT: { proxied_analog_output_t *net_proxy_output = nullptr; for (auto & input : m_inps) @@ -157,14 +155,14 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets) net_proxy_output->m_proxied_net = static_cast<analog_net_t *>(&p->net()); } net_proxy_output->net().add_terminal(*p); - // FIXME: repeated + // FIXME: repeated calling - kind of brute force net_proxy_output->net().rebuild_list(); log().debug("Added input\n"); } break; - case terminal_t::OUTPUT: - case terminal_t::PARAM: - log().fatal("unhandled element found\n"); + case detail::terminal_type::OUTPUT: + log().fatal(MF_1_UNHANDLED_ELEMENT_1_FOUND, + p->name()); break; } } @@ -210,7 +208,7 @@ void matrix_solver_t::setup_matrix() * literature but I have found no articles about Gauss Seidel. * * For Gaussian Elimination however increasing order is better suited. - * FIXME: Even better would be to sort on elements right of the matrix diagonal. + * NOTE: Even better would be to sort on elements right of the matrix diagonal. * */ @@ -240,7 +238,7 @@ void matrix_solver_t::setup_matrix() /* create a list of non zero elements. */ for (unsigned k = 0; k < iN; k++) { - terms_for_net_t * t = m_terms[k]; + terms_for_net_t * t = m_terms[k].get(); /* pretty brutal */ int *other = t->connected_net_idx(); @@ -262,7 +260,7 @@ void matrix_solver_t::setup_matrix() */ for (unsigned k = 0; k < iN; k++) { - terms_for_net_t * t = m_terms[k]; + terms_for_net_t * t = m_terms[k].get(); /* pretty brutal */ int *other = t->connected_net_idx(); @@ -292,9 +290,9 @@ void matrix_solver_t::setup_matrix() * This should reduce cache misses ... */ - bool **touched = new bool*[iN]; + bool **touched = plib::palloc_array<bool *>(iN); for (unsigned k=0; k<iN; k++) - touched[k] = new bool[iN]; + touched[k] = plib::palloc_array<bool>(iN); for (unsigned k = 0; k < iN; k++) { @@ -352,8 +350,8 @@ void matrix_solver_t::setup_matrix() } for (unsigned k=0; k<iN; k++) - delete [] touched[k]; - delete [] touched; + plib::pfree_array(touched[k]); + plib::pfree_array(touched); } void matrix_solver_t::update_inputs() @@ -378,6 +376,7 @@ void matrix_solver_t::reset() void matrix_solver_t::update() NL_NOEXCEPT { const netlist_time new_timestep = solve(); + update_inputs(); if (m_params.m_dynamic_ts && has_timestep_devices() && new_timestep > netlist_time::zero()) { @@ -389,6 +388,7 @@ void matrix_solver_t::update() NL_NOEXCEPT void matrix_solver_t::update_forced() { ATTR_UNUSED const netlist_time new_timestep = solve(); + update_inputs(); if (m_params.m_dynamic_ts && has_timestep_devices()) { @@ -423,7 +423,7 @@ void matrix_solver_t::solve_base() // reschedule .... if (this_resched > 1 && !m_Q_sync.net().is_queued()) { - log().warning("NEWTON_LOOPS exceeded on net {1}... reschedule", this->name()); + log().warning(MW_1_NEWTON_LOOPS_EXCEEDED_ON_NET_1, this->name()); m_Q_sync.net().toggle_new_Q(); m_Q_sync.net().reschedule_in_queue(m_params.m_nr_recalc_delay); } @@ -449,7 +449,6 @@ const netlist_time matrix_solver_t::solve() step(delta); solve_base(); const netlist_time next_time_step = compute_next_timestep(delta.as_double()); - update_inputs(); return next_time_step; } @@ -479,7 +478,7 @@ void matrix_solver_t::add_term(std::size_t k, terminal_t *term) else // if (ot<0) { m_rails_temp[k]->add(term, ot, true); - log().fatal("found term with missing othernet {1}\n", term->name()); + log().fatal(MF_1_FOUND_TERM_WITH_MISSING_OTHERNET, term->name()); } } } @@ -490,14 +489,10 @@ netlist_time matrix_solver_t::compute_next_timestep(const double cur_ts) if (m_params.m_dynamic_ts) { - /* - * FIXME: We should extend the logic to use either all nets or - * only output nets. - */ for (std::size_t k = 0, iN=m_terms.size(); k < iN; k++) { analog_net_t *n = m_nets[k]; - terms_for_net_t *t = m_terms[k]; + terms_for_net_t *t = m_terms[k].get(); const nl_double DD_n = (n->Q_Analog() - t->m_last_V); const nl_double hn = cur_ts; @@ -546,12 +541,12 @@ void matrix_solver_t::log_stats() log().verbose(" {1:6.3} average newton raphson loops", static_cast<double>(this->m_stat_newton_raphson) / static_cast<double>(this->m_stat_vsolver_calls)); log().verbose(" {1:10} invocations ({2:6.0} Hz) {3:10} gs fails ({4:6.2} %) {5:6.3} average", - this->m_stat_calculations(), - static_cast<double>(this->m_stat_calculations()) / this->netlist().time().as_double(), - this->m_iterative_fail(), - 100.0 * static_cast<double>(this->m_iterative_fail()) - / static_cast<double>(this->m_stat_calculations()), - static_cast<double>(this->m_iterative_total()) / static_cast<double>(this->m_stat_calculations())); + this->m_stat_calculations, + static_cast<double>(this->m_stat_calculations) / this->netlist().time().as_double(), + this->m_iterative_fail, + 100.0 * static_cast<double>(this->m_iterative_fail) + / static_cast<double>(this->m_stat_calculations), + static_cast<double>(this->m_iterative_total) / static_cast<double>(this->m_stat_calculations)); } } diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h index 522b157eafb..82910e9c4d1 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.h +++ b/src/lib/netlist/solver/nld_matrix_solver.h @@ -8,11 +8,9 @@ #ifndef NLD_MATRIX_SOLVER_H_ #define NLD_MATRIX_SOLVER_H_ -#include <type_traits> - -//#include "solver/nld_solver.h" #include "nl_base.h" -#include "plib/pstream.h" +#include "nl_errstr.h" +#include "plib/putil.h" namespace netlist { @@ -36,10 +34,8 @@ namespace netlist }; -class terms_for_net_t +class terms_for_net_t : plib::nocopyassignmove { - P_PREVENT_COPYING(terms_for_net_t) - public: terms_for_net_t(); @@ -47,14 +43,14 @@ public: void add(terminal_t *term, int net_other, bool sorted); - inline std::size_t count() { return m_terms.size(); } + inline std::size_t count() const { return m_terms.size(); } inline terminal_t **terms() { return m_terms.data(); } inline int *connected_net_idx() { return m_connected_net_idx.data(); } inline nl_double *gt() { return m_gt.data(); } inline nl_double *go() { return m_go.data(); } inline nl_double *Idr() { return m_Idr.data(); } - inline nl_double **connected_net_V() { return m_connected_net_V.data(); } + inline nl_double * const *connected_net_V() const { return m_connected_net_V.data(); } void set_pointers(); @@ -110,11 +106,18 @@ public: virtual ~matrix_solver_t(); - void setup(analog_net_t::list_t &nets) { vsetup(nets); } + void setup(analog_net_t::list_t &nets) + { + vsetup(nets); + } void solve_base(); + /* after every call to solve, update inputs must be called. + * this can be done as well as a batch to ease parallel processing. + */ const netlist_time solve(); + void update_inputs(); inline bool has_dynamic_devices() const { return m_dynamic_devices.size() > 0; } inline bool has_timestep_devices() const { return m_step_devices.size() > 0; } @@ -133,13 +136,11 @@ public: public: int get_net_idx(detail::net_t *net); - plib::plog_base<NL_DEBUG> &log() { return netlist().log(); } - virtual void log_stats(); - virtual void create_solver_code(plib::postream &strm) + virtual std::pair<pstring, pstring> create_solver_code() { - strm.writeline(plib::pfmt("/* {1} doesn't support static compile */")); + return std::pair<pstring, pstring>("", plib::pfmt("/* {1} doesn't support static compile */")); } protected: @@ -163,7 +164,7 @@ protected: template <typename T> void build_LE_RHS(); - std::vector<terms_for_net_t *> m_terms; + std::vector<std::unique_ptr<terms_for_net_t>> m_terms; std::vector<analog_net_t *> m_nets; std::vector<std::unique_ptr<proxied_analog_output_t>> m_inps; @@ -191,31 +192,30 @@ private: void step(const netlist_time &delta); - void update_inputs(); - const eSortType m_sort; }; template <typename T> T matrix_solver_t::delta(const T * RESTRICT V) { - /* FIXME: Ideally we should also include currents (RHS) here. This would + /* NOTE: Ideally we should also include currents (RHS) here. This would * need a reevaluation of the right hand side after voltages have been updated * and thus belong into a different calculation. This applies to all solvers. */ - std::size_t iN = this->m_terms.size(); + const std::size_t iN = this->m_terms.size(); T cerr = 0; - for (unsigned i = 0; i < iN; i++) - cerr = std::max(cerr, std::abs(V[i] - static_cast<T>(this->m_nets[i]->m_cur_Analog))); + for (std::size_t i = 0; i < iN; i++) + cerr = std::max(cerr, std::abs(V[i] - static_cast<T>(this->m_nets[i]->Q_Analog()))); return cerr; } template <typename T> void matrix_solver_t::store(const T * RESTRICT V) { - for (std::size_t i = 0, iN=m_terms.size(); i < iN; i++) - this->m_nets[i]->m_cur_Analog = V[i]; + const std::size_t iN = this->m_terms.size(); + for (std::size_t i = 0; i < iN; i++) + this->m_nets[i]->set_Q_Analog(V[i]); } template <typename T> @@ -225,26 +225,28 @@ void matrix_solver_t::build_LE_A() T &child = static_cast<T &>(*this); - const unsigned iN = child.N(); - for (unsigned k = 0; k < iN; k++) + const std::size_t iN = child.N(); + for (std::size_t k = 0; k < iN; k++) { - for (unsigned i=0; i < iN; i++) + terms_for_net_t *terms = m_terms[k].get(); + + for (std::size_t i=0; i < iN; i++) child.A(k,i) = 0.0; - const std::size_t terms_count = m_terms[k]->count(); - const std::size_t railstart = m_terms[k]->m_railstart; - const nl_double * RESTRICT gt = m_terms[k]->gt(); + const std::size_t terms_count = terms->count(); + const std::size_t railstart = terms->m_railstart; + const nl_double * const RESTRICT gt = terms->gt(); { nl_double akk = 0.0; - for (unsigned i = 0; i < terms_count; i++) + for (std::size_t i = 0; i < terms_count; i++) akk += gt[i]; child.A(k,k) = akk; } - const nl_double * RESTRICT go = m_terms[k]->go(); - const int * RESTRICT net_other = m_terms[k]->connected_net_idx(); + const nl_double * const RESTRICT go = terms->go(); + int * RESTRICT net_other = terms->connected_net_idx(); for (std::size_t i = 0; i < railstart; i++) child.A(k,net_other[i]) -= go[i]; @@ -257,15 +259,15 @@ void matrix_solver_t::build_LE_RHS() static_assert(std::is_base_of<matrix_solver_t, T>::value, "T must derive from matrix_solver_t"); T &child = static_cast<T &>(*this); - const unsigned iN = child.N(); - for (unsigned k = 0; k < iN; k++) + const std::size_t iN = child.N(); + for (std::size_t k = 0; k < iN; k++) { nl_double rhsk_a = 0.0; nl_double rhsk_b = 0.0; const std::size_t terms_count = m_terms[k]->count(); - const nl_double * RESTRICT go = m_terms[k]->go(); - const nl_double * RESTRICT Idr = m_terms[k]->Idr(); + const nl_double * const RESTRICT go = m_terms[k]->go(); + const nl_double * const RESTRICT Idr = m_terms[k]->Idr(); const nl_double * const * RESTRICT other_cur_analog = m_terms[k]->connected_net_V(); for (std::size_t i = 0; i < terms_count; i++) diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index 5b4a33ce66e..b929fb6ed22 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -19,7 +19,7 @@ * going forward in case we implement cuda solvers in the future. */ #define NL_USE_DYNAMIC_ALLOCATION (0) -#define TEST_PARALLEL (0) +#define TEST_PARALLEL (0 ) #if TEST_PARALLEL #include <thread> @@ -36,16 +36,17 @@ namespace netlist #if TEST_PARALLEL #define MAXTHR 10 -static const int num_thr = 1; +static const int num_thr = 3; struct thr_intf { + virtual ~thr_intf() = default; virtual void do_work(const int id, void *param) = 0; }; struct ti_t { - volatile std::atomic<int> lo; + /*volatile */std::atomic<int> lo; thr_intf *intf; void *params; // int block[29]; /* make it 256 bytes */ @@ -113,7 +114,7 @@ static void thr_dispose() } #endif -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> #if TEST_PARALLEL class matrix_solver_direct_t: public matrix_solver_t, public thr_intf #else @@ -123,8 +124,8 @@ class matrix_solver_direct_t: public matrix_solver_t friend class matrix_solver_t; public: - matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const unsigned size); - matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, const eSortType sort, const solver_parameters_t *params, const unsigned size); + matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size); + matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, const eSortType sort, const solver_parameters_t *params, const std::size_t size); virtual ~matrix_solver_direct_t(); @@ -135,7 +136,7 @@ protected: virtual unsigned vsolve_non_dynamic(const bool newton_raphson) override; unsigned solve_non_dynamic(const bool newton_raphson); - inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + constexpr std::size_t N() const { return (m_N == 0) ? m_dim : m_N; } void LE_solve(); @@ -156,13 +157,14 @@ protected: inline nl_ext_double &RHS(const T1 &r) { return m_A[r * m_pitch + N()]; } #else template <typename T1, typename T2> - inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; } + nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; } template <typename T1> - inline nl_ext_double &RHS(const T1 &r) { return m_A[r][N()]; } + nl_ext_double &RHS(const T1 &r) { return m_A[r][N()]; } #endif nl_double m_last_RHS[storage_N]; // right hand side - contains currents private: + //static const std::size_t m_pitch = (((storage_N + 1) + 0) / 1) * 1; static const std::size_t m_pitch = (((storage_N + 1) + 7) / 8) * 8; //static const std::size_t m_pitch = (((storage_N + 1) + 15) / 16) * 16; //static const std::size_t m_pitch = (((storage_N + 1) + 31) / 32) * 32; @@ -173,7 +175,7 @@ private: #endif //nl_ext_double m_RHSx[storage_N]; - const unsigned m_dim; + const std::size_t m_dim; }; @@ -181,44 +183,41 @@ private: // matrix_solver_direct // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_direct_t<m_N, storage_N>::~matrix_solver_direct_t() { #if (NL_USE_DYNAMIC_ALLOCATION) - pfree_array(m_A); + plib::pfree_array(m_A); #endif #if TEST_PARALLEL thr_dispose(); #endif } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_direct_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { - if (m_dim < nets.size()) - log().fatal("Dimension {1} less than {2}", m_dim, nets.size()); - matrix_solver_t::setup_base(nets); /* add RHS element */ - for (unsigned k = 0; k < N(); k++) + for (std::size_t k = 0; k < N(); k++) { - terms_for_net_t * t = m_terms[k]; + terms_for_net_t * t = m_terms[k].get(); - if (!plib::container::contains(t->m_nzrd, N())) - t->m_nzrd.push_back(N()); + if (!plib::container::contains(t->m_nzrd, static_cast<unsigned>(N()))) + t->m_nzrd.push_back(static_cast<unsigned>(N())); } netlist().save(*this, m_last_RHS, "m_last_RHS"); - for (unsigned k = 0; k < N(); k++) + for (std::size_t k = 0; k < N(); k++) netlist().save(*this, RHS(k), plib::pfmt("RHS.{1}")(k)); } #if TEST_PARALLEL -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_direct_t<m_N, storage_N>::do_work(const int id, void *param) { const int i = x_i[id]; @@ -242,58 +241,13 @@ void matrix_solver_direct_t<m_N, storage_N>::do_work(const int id, void *param) } #endif -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_direct_t<m_N, storage_N>::LE_solve() { - const unsigned kN = N(); - - for (unsigned i = 0; i < kN; i++) { - // FIXME: use a parameter to enable pivoting? m_pivot - if (!TEST_PARALLEL && m_params.m_pivot) - { - /* Find the row with the largest first value */ - unsigned maxrow = i; - for (unsigned j = i + 1; j < kN; j++) - { - //if (std::abs(m_A[j][i]) > std::abs(m_A[maxrow][i])) - if (A(j,i) * A(j,i) > A(maxrow,i) * A(maxrow,i)) - maxrow = j; - } - - if (maxrow != i) - { - /* Swap the maxrow and ith row */ - for (unsigned k = 0; k < kN + 1; k++) { - std::swap(A(i,k), A(maxrow,k)); - } - //std::swap(RHS(i), RHS(maxrow)); - } - /* FIXME: Singular matrix? */ - const nl_double f = 1.0 / A(i,i); - - /* Eliminate column i from row j */ - - for (unsigned j = i + 1; j < kN; j++) - { - const nl_double f1 = - A(j,i) * f; - if (f1 != NL_FCONST(0.0)) - { - const nl_double * RESTRICT pi = &A(i,i+1); - nl_double * RESTRICT pj = &A(j,i+1); -#if 1 - vec_add_mult_scalar(kN-i,pi,f1,pj); -#else - vec_add_mult_scalar(kN-i-1,pj,f1,pi); - //for (unsigned k = i+1; k < kN; k++) - // pj[k] = pj[k] + pi[k] * f1; - //for (unsigned k = i+1; k < kN; k++) - //A(j,k) += A(i,k) * f1; - RHS(j) += RHS(i) * f1; -#endif - } - } - } - else + const std::size_t kN = N(); + if (!(!TEST_PARALLEL && m_params.m_pivot)) + { + for (std::size_t i = 0; i < kN; i++) { #if TEST_PARALLEL const unsigned eb = m_terms[i]->m_nzbd.size(); @@ -326,29 +280,76 @@ void matrix_solver_direct_t<m_N, storage_N>::LE_solve() const auto &nzrd = m_terms[i]->m_nzrd; const auto &nzbd = m_terms[i]->m_nzbd; - for (auto & j : nzbd) + for (std::size_t j : nzbd) { const nl_double f1 = -f * A(j,i); - for (auto & k : nzrd) + for (std::size_t k : nzrd) A(j,k) += A(i,k) * f1; //RHS(j) += RHS(i) * f1; + } #endif + } + } + else + { + for (std::size_t i = 0; i < kN; i++) + { + /* Find the row with the largest first value */ + std::size_t maxrow = i; + for (std::size_t j = i + 1; j < kN; j++) + { + //if (std::abs(m_A[j][i]) > std::abs(m_A[maxrow][i])) + if (A(j,i) * A(j,i) > A(maxrow,i) * A(maxrow,i)) + maxrow = j; + } + + if (maxrow != i) + { + /* Swap the maxrow and ith row */ + for (std::size_t k = 0; k < kN + 1; k++) { + std::swap(A(i,k), A(maxrow,k)); + } + //std::swap(RHS(i), RHS(maxrow)); + } + /* FIXME: Singular matrix? */ + const nl_double f = 1.0 / A(i,i); + + /* Eliminate column i from row j */ + + for (std::size_t j = i + 1; j < kN; j++) + { + const nl_double f1 = - A(j,i) * f; + if (f1 != NL_FCONST(0.0)) + { + const nl_double * RESTRICT pi = &A(i,i+1); + nl_double * RESTRICT pj = &A(j,i+1); +#if 1 + vec_add_mult_scalar_p(kN-i,pi,f1,pj); +#else + vec_add_mult_scalar_p(kN-i-1,pj,f1,pi); + //for (unsigned k = i+1; k < kN; k++) + // pj[k] = pj[k] + pi[k] * f1; + //for (unsigned k = i+1; k < kN; k++) + //A(j,k) += A(i,k) * f1; + RHS(j) += RHS(i) * f1; +#endif + } } } } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> template <typename T> void matrix_solver_direct_t<m_N, storage_N>::LE_back_subst( T * RESTRICT x) { - const unsigned kN = N(); + const std::size_t kN = N(); /* back substitution */ if (m_params.m_pivot) { - for (unsigned j = kN; j-- > 0; ) + for (std::size_t j = kN; j-- > 0; ) { T tmp = 0; for (std::size_t k = j+1; k < kN; k++) @@ -358,14 +359,14 @@ void matrix_solver_direct_t<m_N, storage_N>::LE_back_subst( } else { - for (unsigned j = kN; j-- > 0; ) + for (std::size_t j = kN; j-- > 0; ) { T tmp = 0; const auto *p = m_terms[j]->m_nzrd.data(); const auto e = m_terms[j]->m_nzrd.size() - 1; /* exclude RHS element */ - for (unsigned k = 0; k < e; k++) + for (std::size_t k = 0; k < e; k++) { const auto pk = p[k]; tmp += A(j,pk) * x[pk]; @@ -376,7 +377,7 @@ void matrix_solver_direct_t<m_N, storage_N>::LE_back_subst( } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_direct_t<m_N, storage_N>::solve_non_dynamic(const bool newton_raphson) { nl_double new_V[storage_N]; // = { 0.0 }; @@ -399,27 +400,27 @@ unsigned matrix_solver_direct_t<m_N, storage_N>::solve_non_dynamic(const bool ne } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> inline unsigned matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { build_LE_A<matrix_solver_direct_t>(); build_LE_RHS<matrix_solver_direct_t>(); - for (unsigned i=0, iN=N(); i < iN; i++) + for (std::size_t i=0, iN=N(); i < iN; i++) m_last_RHS[i] = RHS(i); this->m_stat_calculations++; return this->solve_non_dynamic(newton_raphson); } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_direct_t<m_N, storage_N>::matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, - const solver_parameters_t *params, const unsigned size) + const solver_parameters_t *params, const std::size_t size) : matrix_solver_t(anetlist, name, ASCENDING, params) , m_dim(size) { #if (NL_USE_DYNAMIC_ALLOCATION) - m_A = palloc_array(nl_ext_double, N() * m_pitch); + m_A = plib::palloc_array<nl_ext_double>(N() * m_pitch); #endif for (unsigned k = 0; k < N(); k++) { @@ -430,14 +431,14 @@ matrix_solver_direct_t<m_N, storage_N>::matrix_solver_direct_t(netlist_t &anetli #endif } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_direct_t<m_N, storage_N>::matrix_solver_direct_t(netlist_t &anetlist, const pstring &name, - const eSortType sort, const solver_parameters_t *params, const unsigned size) + const eSortType sort, const solver_parameters_t *params, const std::size_t size) : matrix_solver_t(anetlist, name, sort, params) , m_dim(size) { #if (NL_USE_DYNAMIC_ALLOCATION) - m_A = palloc_array(nl_ext_double, N() * m_pitch); + m_A = plib::palloc_array<nl_ext_double>(N() * m_pitch); #endif for (unsigned k = 0; k < N(); k++) { diff --git a/src/lib/netlist/solver/nld_ms_direct_lu.h b/src/lib/netlist/solver/nld_ms_direct_lu.h index f71982f8eb4..c379cf8d055 100644 --- a/src/lib/netlist/solver/nld_ms_direct_lu.h +++ b/src/lib/netlist/solver/nld_ms_direct_lu.h @@ -4,7 +4,7 @@ * nld_ms_direct.h * */ - +#if 0 #ifndef NLD_MS_DIRECT_H_ #define NLD_MS_DIRECT_H_ @@ -345,10 +345,10 @@ void matrix_solver_direct_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) if(0) for (unsigned k = 0; k < N(); k++) { - netlist().log("{1:3}: ", k); + log("{1:3}: ", k); for (unsigned j = 0; j < m_terms[k]->m_nzrd.size(); j++) - netlist().log(" {1:3}", m_terms[k]->m_nzrd[j]); - netlist().log("\n"); + log(" {1:3}", m_terms[k]->m_nzrd[j]); + log("\n"); } /* @@ -634,3 +634,4 @@ matrix_solver_direct_t<m_N, storage_N>::matrix_solver_direct_t(const eSolverType } // namespace netlist #endif /* NLD_MS_DIRECT_H_ */ +#endif diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 80a68604a56..eda9b14aa74 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -5,8 +5,6 @@ * * Gaussian elimination using compressed row format. * - * Fow w==1 we will do the classic Gauss-Seidel approach - * */ #ifndef NLD_MS_GCR_H_ @@ -21,24 +19,20 @@ #include "solver/vector_base.h" #include "plib/pstream.h" -#define NL_USE_SSE 0 -#if NL_USE_SSE -#include <mmintrin.h> -#endif - namespace netlist { namespace devices { -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_GCR_t: public matrix_solver_t { public: matrix_solver_GCR_t(netlist_t &anetlist, const pstring &name, - const solver_parameters_t *params, const unsigned size) + const solver_parameters_t *params, const std::size_t size) : matrix_solver_t(anetlist, name, matrix_solver_t::ASCENDING, params) , m_dim(size) + , mat(size) , m_proc(nullptr) { } @@ -47,55 +41,50 @@ public: { } - inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + constexpr std::size_t N() const { return (m_N == 0) ? m_dim : m_N; } virtual void vsetup(analog_net_t::list_t &nets) override; virtual unsigned vsolve_non_dynamic(const bool newton_raphson) override; - virtual void create_solver_code(plib::postream &strm) override; + virtual std::pair<pstring, pstring> create_solver_code() override; private: - void csc_private(plib::postream &strm); + //typedef typename mat_cr_t<storage_N>::type mattype; + typedef typename mat_cr_t<storage_N>::index_type mattype; - using extsolver = void (*)(double * RESTRICT m_A, double * RESTRICT RHS); + void csc_private(plib::putf8_fmt_writer &strm); - pstring static_compile_name() - { - plib::postringstream t; - csc_private(t); - std::hash<pstring> h; + using extsolver = void (*)(double * RESTRICT m_A, double * RESTRICT RHS, double * RESTRICT V); - return plib::pfmt("nl_gcr_{1:x}_{2}")(h( t.str() ))(mat.nz_num); - } + pstring static_compile_name(); - unsigned m_dim; + const std::size_t m_dim; std::vector<unsigned> m_term_cr[storage_N]; mat_cr_t<storage_N> mat; - nl_double m_A[storage_N * storage_N]; extsolver m_proc; }; // ---------------------------------------------------------------------------------------- -// matrix_solver - GMRES +// matrix_solver - GCR // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_GCR_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { setup_base(nets); - unsigned nz = 0; - const unsigned iN = this->N(); + mattype nz = 0; + const std::size_t iN = this->N(); /* build the final matrix */ bool touched[storage_N][storage_N] = { { false } }; - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { - for (auto & j : this->m_terms[k]->m_nz) + for (auto &j : this->m_terms[k]->m_nz) touched[k][j] = true; } @@ -103,42 +92,31 @@ void matrix_solver_GCR_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) unsigned ops = 0; - const bool static_compile = false; - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { ops++; // 1/A(k,k) - if (static_compile) printf("const double fd%d = 1.0 / A(%d,%d); \n", k, k, k); - for (unsigned row = k + 1; row < iN; row++) + for (std::size_t row = k + 1; row < iN; row++) { if (touched[row][k]) { ops++; fc++; - if (static_compile) printf(" const double f%d = -fd%d * A(%d,%d); \n", fc, k, row, k); - for (unsigned col = k + 1; col < iN; col++) + for (std::size_t col = k + 1; col < iN; col++) if (touched[k][col]) { - if (touched[row][col]) - { - if (static_compile) printf(" A(%d,%d) += f%d * A(%d,%d); \n", row, col, fc, k, col); - } else - { - if (static_compile) printf(" A(%d,%d) = f%d * A(%d,%d); \n", row, col, fc, k, col); - } touched[row][col] = true; ops += 2; } - if (static_compile) printf(" RHS(%d) += f%d * RHS(%d); \n", row, fc, k); } } } - for (unsigned k=0; k<iN; k++) + for (mattype k=0; k<iN; k++) { mat.ia[k] = nz; - for (unsigned j=0; j<iN; j++) + for (mattype j=0; j<iN; j++) { if (touched[k][j]) { @@ -151,10 +129,10 @@ void matrix_solver_GCR_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) m_term_cr[k].clear(); /* build pointers into the compressed row format matrix for each terminal */ - for (unsigned j=0; j< this->m_terms[k]->m_railstart;j++) + for (std::size_t j=0; j< this->m_terms[k]->m_railstart;j++) { int other = this->m_terms[k]->connected_net_idx()[j]; - for (unsigned i = mat.ia[k]; i < nz; i++) + for (auto i = mat.ia[k]; i < nz; i++) if (other == static_cast<int>(mat.ja[i])) { m_term_cr[k].push_back(i); @@ -179,82 +157,173 @@ void matrix_solver_GCR_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) if (m_proc != nullptr) this->log().verbose("External static solver {1} found ...", symname); else - this->log().verbose("External static solver {1} not found ...", symname); + this->log().warning("External static solver {1} not found ...", symname); } } +#if 0 +template <std::size_t m_N, std::size_t storage_N> +void matrix_solver_GCR_t<m_N, storage_N>::csc_private(plib::putf8_fmt_writer &strm) +{ + const std::size_t iN = N(); + for (std::size_t i = 0; i < iN - 1; i++) + { + const auto &nzbd = this->m_terms[i]->m_nzbd; + + if (nzbd.size() > 0) + { + std::size_t pi = mat.diag[i]; + + //const nl_double f = 1.0 / m_A[pi++]; + strm("const double f{1} = 1.0 / m_A[{2}];\n", i, pi); + pi++; + const std::size_t piie = mat.ia[i+1]; + + //for (auto & j : nzbd) + for (std::size_t j : nzbd) + { + // proceed to column i + std::size_t pj = mat.ia[j]; + + while (mat.ja[pj] < i) + pj++; + + //const nl_double f1 = - m_A[pj++] * f; + strm("\tconst double f{1}_{2} = -f{3} * m_A[{4}];\n", i, j, i, pj); + pj++; -template <unsigned m_N, unsigned storage_N> -void matrix_solver_GCR_t<m_N, storage_N>::csc_private(plib::postream &strm) + // subtract row i from j */ + for (std::size_t pii = pi; pii<piie; ) + { + while (mat.ja[pj] < mat.ja[pii]) + pj++; + //m_A[pj++] += m_A[pii++] * f1; + strm("\tm_A[{1}] += m_A[{2}] * f{3}_{4};\n", pj, pii, i, j); + pj++; pii++; + } + //RHS[j] += f1 * RHS[i]; + strm("\tRHS[{1}] += f{2}_{3} * RHS[{4}];\n", j, i, j, i); + } + } + } + + //new_V[iN - 1] = RHS[iN - 1] / mat.A[mat.diag[iN - 1]]; + strm("\tV[{1}] = RHS[{2}] / m_A[{3}];\n", iN - 1, iN - 1, mat.diag[iN - 1]); + for (std::size_t j = iN - 1; j-- > 0;) + { + strm("\tdouble tmp{1} = 0.0;\n", j); + const std::size_t e = mat.ia[j+1]; + for (std::size_t pk = mat.diag[j] + 1; pk < e; pk++) + { + strm("\ttmp{1} += m_A[{2}] * V[{3}];\n", j, pk, mat.ja[pk]); + } + strm("\tV[{1}] = (RHS[{1}] - tmp{1}) / m_A[{4}];\n", j, j, j, mat.diag[j]); + } +} +#else +template <std::size_t m_N, std::size_t storage_N> +void matrix_solver_GCR_t<m_N, storage_N>::csc_private(plib::putf8_fmt_writer &strm) { - const unsigned iN = N(); - for (unsigned i = 0; i < iN - 1; i++) + const std::size_t iN = N(); + + for (std::size_t i = 0; i < mat.nz_num; i++) + strm("double m_A{1} = m_A[{2}];\n", i, i); + + for (std::size_t i = 0; i < iN - 1; i++) { const auto &nzbd = this->m_terms[i]->m_nzbd; if (nzbd.size() > 0) { - unsigned pi = mat.diag[i]; + std::size_t pi = mat.diag[i]; //const nl_double f = 1.0 / m_A[pi++]; - strm.writeline(plib::pfmt("const double f{1} = 1.0 / m_A[{2}];")(i)(pi)); + strm("const double f{1} = 1.0 / m_A{2};\n", i, pi); pi++; - const unsigned piie = mat.ia[i+1]; + const std::size_t piie = mat.ia[i+1]; - for (auto & j : nzbd) + //for (auto & j : nzbd) + for (std::size_t j : nzbd) { // proceed to column i - unsigned pj = mat.ia[j]; + std::size_t pj = mat.ia[j]; while (mat.ja[pj] < i) pj++; //const nl_double f1 = - m_A[pj++] * f; - strm.writeline(plib::pfmt("\tconst double f{1}_{2} = -f{3} * m_A[{4}];")(i)(j)(i)(pj)); + strm("\tconst double f{1}_{2} = -f{3} * m_A{4};\n", i, j, i, pj); pj++; // subtract row i from j */ - for (unsigned pii = pi; pii<piie; ) + for (std::size_t pii = pi; pii<piie; ) { while (mat.ja[pj] < mat.ja[pii]) pj++; //m_A[pj++] += m_A[pii++] * f1; - strm.writeline(plib::pfmt("\tm_A[{1}] += m_A[{2}] * f{3}_{4};")(pj)(pii)(i)(j)); + strm("\tm_A{1} += m_A{2} * f{3}_{4};\n", pj, pii, i, j); pj++; pii++; } //RHS[j] += f1 * RHS[i]; - strm.writeline(plib::pfmt("\tRHS[{1}] += f{2}_{3} * RHS[{4}];")(j)(i)(j)(i)); + strm("\tRHS[{1}] += f{2}_{3} * RHS[{4}];\n", j, i, j, i); } } } + + //new_V[iN - 1] = RHS[iN - 1] / mat.A[mat.diag[iN - 1]]; + strm("\tV[{1}] = RHS[{2}] / m_A{3};\n", iN - 1, iN - 1, mat.diag[iN - 1]); + for (std::size_t j = iN - 1; j-- > 0;) + { + strm("\tdouble tmp{1} = 0.0;\n", j); + const std::size_t e = mat.ia[j+1]; + for (std::size_t pk = mat.diag[j] + 1; pk < e; pk++) + { + strm("\ttmp{1} += m_A{2} * V[{3}];\n", j, pk, mat.ja[pk]); + } + strm("\tV[{1}] = (RHS[{1}] - tmp{1}) / m_A{4};\n", j, j, j, mat.diag[j]); + } +} +#endif + +template <std::size_t m_N, std::size_t storage_N> +pstring matrix_solver_GCR_t<m_N, storage_N>::static_compile_name() +{ + plib::postringstream t; + plib::putf8_fmt_writer w(t); + csc_private(w); + std::hash<pstring> h; + + return plib::pfmt("nl_gcr_{1:x}_{2}")(h( t.str() ))(mat.nz_num); } -template <unsigned m_N, unsigned storage_N> -void matrix_solver_GCR_t<m_N, storage_N>::create_solver_code(plib::postream &strm) +template <std::size_t m_N, std::size_t storage_N> +std::pair<pstring, pstring> matrix_solver_GCR_t<m_N, storage_N>::create_solver_code() { - //const unsigned iN = N(); + plib::postringstream t; + plib::putf8_fmt_writer strm(t); + pstring name = static_compile_name(); - strm.writeline(plib::pfmt("extern \"C\" void {1}(double * _restrict m_A, double * _restrict RHS)")(static_compile_name())); - strm.writeline("{"); + strm.writeline(plib::pfmt("extern \"C\" void {1}(double * __restrict m_A, double * __restrict RHS, double * __restrict V)\n")(name)); + strm.writeline("{\n"); csc_private(strm); - strm.writeline("}"); + strm.writeline("}\n"); + return std::pair<pstring, pstring>(name, t.str()); } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_GCR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { - const unsigned iN = this->N(); + const std::size_t iN = this->N(); nl_double RHS[storage_N]; nl_double new_V[storage_N]; - for (unsigned i=0, e=mat.nz_num; i<e; i++) - m_A[i] = 0.0; + mat.set_scalar(0.0); - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { - terms_for_net_t *t = this->m_terms[k]; + terms_for_net_t *t = this->m_terms[k].get(); nl_double gtot_t = 0.0; nl_double RHS_t = 0.0; @@ -264,126 +333,109 @@ unsigned matrix_solver_GCR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newt const nl_double * const RESTRICT go = t->go(); const nl_double * const RESTRICT Idr = t->Idr(); const nl_double * const * RESTRICT other_cur_analog = t->connected_net_V(); + const unsigned * const RESTRICT tcr = m_term_cr[k].data(); -#if (0 ||NL_USE_SSE) - __m128d mg = _mm_set_pd(0.0, 0.0); - __m128d mr = _mm_set_pd(0.0, 0.0); - unsigned i = 0; - for (; i < term_count - 1; i+=2) - { - mg = _mm_add_pd(mg, _mm_loadu_pd(>[i])); - mr = _mm_add_pd(mr, _mm_loadu_pd(&Idr[i])); - } - gtot_t = _mm_cvtsd_f64(mg) + _mm_cvtsd_f64(_mm_unpackhi_pd(mg,mg)); - RHS_t = _mm_cvtsd_f64(mr) + _mm_cvtsd_f64(_mm_unpackhi_pd(mr,mr)); - for (; i < term_count; i++) - { - gtot_t += gt[i]; - RHS_t += Idr[i]; - } -#else - for (unsigned i = 0; i < term_count; i++) +#if 0 + for (std::size_t i = 0; i < term_count; i++) { gtot_t += gt[i]; RHS_t += Idr[i]; } -#endif + for (std::size_t i = railstart; i < term_count; i++) RHS_t += go[i] * *other_cur_analog[i]; RHS[k] = RHS_t; // add diagonal element - m_A[mat.diag[k]] = gtot_t; + mat.A[mat.diag[k]] = gtot_t; - for (unsigned i = 0; i < railstart; i++) + for (std::size_t i = 0; i < railstart; i++) + mat.A[tcr[i]] -= go[i]; + } +#else + for (std::size_t i = 0; i < railstart; i++) { - const unsigned pi = m_term_cr[k][i]; - m_A[pi] -= go[i]; + mat.A[tcr[i]] -= go[i]; + gtot_t = gtot_t + gt[i]; + RHS_t = RHS_t + Idr[i]; } + + for (std::size_t i = railstart; i < term_count; i++) + { + RHS_t += (Idr[i] + go[i] * *other_cur_analog[i]); + gtot_t += gt[i]; + } + + RHS[k] = RHS_t; + mat.A[mat.diag[k]] += gtot_t; } - mat.ia[iN] = mat.nz_num; +#endif + mat.ia[iN] = static_cast<mattype>(mat.nz_num); /* now solve it */ if (m_proc != nullptr) { //static_solver(m_A, RHS); - m_proc(m_A, RHS); + m_proc(mat.A, RHS, new_V); } else { - for (unsigned i = 0; i < iN - 1; i++) + for (std::size_t i = 0; i < iN - 1; i++) { const auto &nzbd = this->m_terms[i]->m_nzbd; if (nzbd.size() > 0) { - unsigned pi = mat.diag[i]; - const nl_double f = 1.0 / m_A[pi++]; - const unsigned piie = mat.ia[i+1]; + std::size_t pi = mat.diag[i]; + const nl_double f = 1.0 / mat.A[pi++]; + const std::size_t piie = mat.ia[i+1]; - for (auto & j : nzbd) + for (std::size_t j : nzbd) // for (std::size_t j = i + 1; j < iN; j++) { // proceed to column i //__builtin_prefetch(&m_A[mat.diag[j+1]], 1); - unsigned pj = mat.ia[j]; + std::size_t pj = mat.ia[j]; while (mat.ja[pj] < i) pj++; - const nl_double f1 = - m_A[pj++] * f; + const nl_double f1 = - mat.A[pj++] * f; // subtract row i from j */ - for (unsigned pii = pi; pii<piie; ) + for (std::size_t pii = pi; pii<piie; ) { while (mat.ja[pj] < mat.ja[pii]) pj++; - m_A[pj++] += m_A[pii++] * f1; + mat.A[pj++] += mat.A[pii++] * f1; } RHS[j] += f1 * RHS[i]; } } } - } - - /* backward substitution - * - */ + /* backward substitution + * + */ - /* row n-1 */ - new_V[iN - 1] = RHS[iN - 1] / m_A[mat.diag[iN - 1]]; + /* row n-1 */ + new_V[iN - 1] = RHS[iN - 1] / mat.A[mat.diag[iN - 1]]; - for (unsigned j = iN - 1; j-- > 0;) - { - //__builtin_prefetch(&new_V[j-1], 1); - //if (j>0)__builtin_prefetch(&m_A[mat.diag[j-1]], 0); -#if (NL_USE_SSE) - __m128d tmp = _mm_set_pd1(0.0); - const unsigned e = mat.ia[j+1]; - unsigned pk = mat.diag[j] + 1; - for (; pk < e - 1; pk+=2) - { - //tmp += m_A[pk] * new_V[mat.ja[pk]]; - tmp = _mm_add_pd(tmp, _mm_mul_pd(_mm_set_pd(m_A[pk], m_A[pk+1]), - _mm_set_pd(new_V[mat.ja[pk]], new_V[mat.ja[pk+1]]))); - } - double tmpx = _mm_cvtsd_f64(tmp) + _mm_cvtsd_f64(_mm_unpackhi_pd(tmp,tmp)); - for (; pk < e; pk++) - { - tmpx += m_A[pk] * new_V[mat.ja[pk]]; - } - new_V[j] = (RHS[j] - tmpx) / m_A[mat.diag[j]]; -#else - double tmp = 0; - const unsigned e = mat.ia[j+1]; - for (unsigned pk = mat.diag[j] + 1; pk < e; pk++) + for (std::size_t j = iN - 1; j-- > 0;) { - tmp += m_A[pk] * new_V[mat.ja[pk]]; + //__builtin_prefetch(&new_V[j-1], 1); + //if (j>0)__builtin_prefetch(&m_A[mat.diag[j-1]], 0); + double tmp = 0; + auto jdiag = mat.diag[j]; + const std::size_t e = mat.ia[j+1]; + for (std::size_t pk = jdiag + 1; pk < e; pk++) + { + tmp += mat.A[pk] * new_V[mat.ja[pk]]; + } + new_V[j] = (RHS[j] - tmp) / mat.A[jdiag]; } - new_V[j] = (RHS[j] - tmp) / m_A[mat.diag[j]]; -#endif } + this->m_stat_calculations++; if (newton_raphson) diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h index 0c5a5e6228f..a97de6a2446 100644 --- a/src/lib/netlist/solver/nld_ms_gmres.h +++ b/src/lib/netlist/solver/nld_ms_gmres.h @@ -23,16 +23,17 @@ namespace netlist { namespace devices { -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_GMRES_t: public matrix_solver_direct_t<m_N, storage_N> { public: - matrix_solver_GMRES_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const unsigned size) + matrix_solver_GMRES_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size) : matrix_solver_direct_t<m_N, storage_N>(anetlist, name, matrix_solver_t::ASCENDING, params, size) , m_use_iLU_preconditioning(true) , m_use_more_precise_stop_condition(false) , m_accuracy_mult(1.0) + , mat(size) { } @@ -45,7 +46,10 @@ public: private: - unsigned solve_ilu_gmres(nl_double * RESTRICT x, const nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy); + //typedef typename mat_cr_t<storage_N>::type mattype; + typedef typename mat_cr_t<storage_N>::index_type mattype; + + unsigned solve_ilu_gmres(nl_double (& RESTRICT x)[storage_N], const nl_double * RESTRICT rhs, const unsigned restart_max, const std::size_t mr, nl_double accuracy); std::vector<unsigned> m_term_cr[storage_N]; @@ -55,7 +59,6 @@ private: mat_cr_t<storage_N> mat; - nl_double m_A[storage_N * storage_N]; nl_double m_LU[storage_N * storage_N]; nl_double m_c[storage_N + 1]; /* mr + 1 */ @@ -71,22 +74,22 @@ private: // matrix_solver - GMRES // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_GMRES_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { matrix_solver_direct_t<m_N, storage_N>::vsetup(nets); - unsigned nz = 0; - const unsigned iN = this->N(); + mattype nz = 0; + const std::size_t iN = this->N(); - for (unsigned k=0; k<iN; k++) + for (std::size_t k=0; k<iN; k++) { - terms_for_net_t * RESTRICT row = this->m_terms[k]; + terms_for_net_t * RESTRICT row = this->m_terms[k].get(); mat.ia[k] = nz; - for (unsigned j=0; j<row->m_nz.size(); j++) + for (std::size_t j=0; j<row->m_nz.size(); j++) { - mat.ja[nz] = row->m_nz[j]; + mat.ja[nz] = static_cast<mattype>(row->m_nz[j]); if (row->m_nz[j] == k) mat.diag[k] = nz; nz++; @@ -110,10 +113,10 @@ void matrix_solver_GMRES_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) mat.nz_num = nz; } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { - const unsigned iN = this->N(); + const std::size_t iN = this->N(); /* ideally, we could get an estimate for the spectral radius of * Inv(D - L) * U @@ -127,10 +130,9 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool ne nl_double RHS[storage_N]; nl_double new_V[storage_N]; - for (unsigned i=0, e=mat.nz_num; i<e; i++) - m_A[i] = 0.0; + mat.set_scalar(0.0); - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { nl_double gtot_t = 0.0; nl_double RHS_t = 0.0; @@ -142,7 +144,7 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool ne const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); const nl_double * const * RESTRICT other_cur_analog = this->m_terms[k]->connected_net_V(); - new_V[k] = this->m_nets[k]->m_cur_Analog; + new_V[k] = this->m_nets[k]->Q_Analog(); for (std::size_t i = 0; i < term_count; i++) { @@ -156,24 +158,24 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool ne RHS[k] = RHS_t; // add diagonal element - m_A[mat.diag[k]] = gtot_t; + mat.A[mat.diag[k]] = gtot_t; for (std::size_t i = 0; i < railstart; i++) { - const unsigned pi = m_term_cr[k][i]; - m_A[pi] -= go[i]; + const std::size_t pi = m_term_cr[k][i]; + mat.A[pi] -= go[i]; } } - mat.ia[iN] = mat.nz_num; + mat.ia[iN] = static_cast<mattype>(mat.nz_num); const nl_double accuracy = this->m_params.m_accuracy; - unsigned mr = iN; + std::size_t mr = iN; if (iN > 3 ) mr = static_cast<unsigned>(std::sqrt(iN) * 2.0); unsigned iter = std::max(1u, this->m_params.m_gs_loops); - unsigned gsl = solve_ilu_gmres(new_V, RHS, iter, mr, accuracy); - unsigned failed = mr * iter; + unsigned gsl = solve_ilu_gmres(new_V, RHS, iter, static_cast<unsigned>(mr), accuracy); + unsigned failed = static_cast<unsigned>(mr) * iter; this->m_iterative_total += gsl; this->m_stat_calculations++; @@ -200,7 +202,7 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool ne } template <typename T> -inline void givens_mult( const T & c, const T & s, T & g0, T & g1 ) +inline static void givens_mult( const T c, const T s, T & g0, T & g1 ) { const T tg0 = c * g0 - s * g1; const T tg1 = s * g0 + c * g1; @@ -209,8 +211,8 @@ inline void givens_mult( const T & c, const T & s, T & g0, T & g1 ) g1 = tg1; } -template <unsigned m_N, unsigned storage_N> -unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RESTRICT x, const nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy) +template <std::size_t m_N, std::size_t storage_N> +unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double (& RESTRICT x)[storage_N], const nl_double * RESTRICT rhs, const unsigned restart_max, const std::size_t mr, nl_double accuracy) { /*------------------------------------------------------------------------- * The code below was inspired by code published by John Burkardt under @@ -237,10 +239,10 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES unsigned itr_used = 0; double rho_delta = 0.0; - const unsigned n = this->N(); + const std::size_t n = this->N(); if (m_use_iLU_preconditioning) - mat.incomplete_LU_factorization(m_A, m_LU); + mat.incomplete_LU_factorization(m_LU); if (m_use_more_precise_stop_condition) { @@ -258,7 +260,8 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES nl_double t[storage_N]; nl_double Ax[storage_N]; vec_set(n, accuracy, t); - mat.mult_vec(m_A, t, Ax); + mat.mult_vec(t, Ax); + mat.solveLUx(m_LU, Ax); const nl_double rho_to_accuracy = std::sqrt(vecmult2(n, Ax)) / accuracy; @@ -270,14 +273,13 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES for (unsigned itr = 0; itr < restart_max; itr++) { - unsigned last_k = mr; - nl_double mu; + std::size_t last_k = mr; nl_double rho; nl_double Ax[storage_N]; nl_double residual[storage_N]; - mat.mult_vec(m_A, x, Ax); + mat.mult_vec(x, Ax); vec_sub(n, rhs, Ax, residual); @@ -288,24 +290,27 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES rho = std::sqrt(vecmult2(n, residual)); - vec_mult_scalar(n, residual, NL_FCONST(1.0) / rho, m_v[0]); + if (rho < rho_delta) + return itr_used + 1; vec_set(mr+1, NL_FCONST(0.0), m_g); m_g[0] = rho; - for (unsigned i = 0; i < mr; i++) + for (std::size_t i = 0; i < mr; i++) vec_set(mr + 1, NL_FCONST(0.0), m_ht[i]); - for (unsigned k = 0; k < mr; k++) + vec_mult_scalar(n, residual, NL_FCONST(1.0) / rho, m_v[0]); + + for (std::size_t k = 0; k < mr; k++) { - const unsigned k1 = k + 1; + const std::size_t k1 = k + 1; - mat.mult_vec(m_A, m_v[k], m_v[k1]); + mat.mult_vec(m_v[k], m_v[k1]); if (m_use_iLU_preconditioning) mat.solveLUx(m_LU, m_v[k1]); - for (unsigned j = 0; j <= k; j++) + for (std::size_t j = 0; j <= k; j++) { m_ht[j][k] = vecmult(n, m_v[k1], m_v[j]); vec_add_mult_scalar(n, m_v[j], -m_ht[j][k], m_v[k1]); @@ -315,13 +320,13 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES if (m_ht[k1][k] != 0.0) vec_scale(n, m_v[k1], NL_FCONST(1.0) / m_ht[k1][k]); - for (unsigned j = 0; j < k; j++) + for (std::size_t j = 0; j < k; j++) givens_mult(m_c[j], m_s[j], m_ht[j][k], m_ht[j+1][k]); - mu = std::hypot(m_ht[k][k], m_ht[k1][k]); + const nl_double mu = 1.0 / std::hypot(m_ht[k][k], m_ht[k1][k]); - m_c[k] = m_ht[k][k] / mu; - m_s[k] = -m_ht[k1][k] / mu; + m_c[k] = m_ht[k][k] * mu; + m_s[k] = -m_ht[k1][k] * mu; m_ht[k][k] = m_c[k] * m_ht[k][k] - m_s[k] * m_ht[k1][k]; m_ht[k1][k] = 0.0; @@ -344,17 +349,17 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::solve_ilu_gmres (nl_double * RES /* Solve the system H * y = g */ /* x += m_v[j] * m_y[j] */ - for (unsigned i = last_k + 1; i-- > 0;) + for (std::size_t i = last_k + 1; i-- > 0;) { double tmp = m_g[i]; - for (unsigned j = i + 1; j <= last_k; j++) + for (std::size_t j = i + 1; j <= last_k; j++) { tmp -= m_ht[i][j] * m_y[j]; } m_y[i] = tmp / m_ht[i][i]; } - for (unsigned i = 0; i <= last_k; i++) + for (std::size_t i = 0; i <= last_k; i++) vec_add_mult_scalar(n, m_v[i], m_y[i], x); #if 1 diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h index 2f3597f3a89..b87f5bcc835 100644 --- a/src/lib/netlist/solver/nld_ms_sm.h +++ b/src/lib/netlist/solver/nld_ms_sm.h @@ -47,7 +47,7 @@ namespace netlist //#define nl_ext_double long double // slightly slower #define nl_ext_double nl_double -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_sm_t: public matrix_solver_t { friend class matrix_solver_t; @@ -55,7 +55,7 @@ class matrix_solver_sm_t: public matrix_solver_t public: matrix_solver_sm_t(netlist_t &anetlist, const pstring &name, - const solver_parameters_t *params, const unsigned size); + const solver_parameters_t *params, const std::size_t size); virtual ~matrix_solver_sm_t(); @@ -66,7 +66,7 @@ protected: virtual unsigned vsolve_non_dynamic(const bool newton_raphson) override; unsigned solve_non_dynamic(const bool newton_raphson); - inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + constexpr std::size_t N() const { return (m_N == 0) ? m_dim : m_N; } void LE_invert(); @@ -103,7 +103,7 @@ private: //nl_ext_double m_RHSx[storage_N]; - const unsigned m_dim; + const std::size_t m_dim; }; @@ -111,20 +111,17 @@ private: // matrix_solver_direct // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_sm_t<m_N, storage_N>::~matrix_solver_sm_t() { #if (NL_USE_DYNAMIC_ALLOCATION) - pfree_array(m_A); + plib::pfree_array(m_A); #endif } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_sm_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { - if (m_dim < nets.size()) - log().fatal("Dimension {1} less than {2}", m_dim, nets.size()); - matrix_solver_t::setup_base(nets); netlist().save(*this, m_last_RHS, "m_last_RHS"); @@ -135,14 +132,14 @@ void matrix_solver_sm_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_sm_t<m_N, storage_N>::LE_invert() { - const unsigned kN = N(); + const std::size_t kN = N(); - for (unsigned i = 0; i < kN; i++) + for (std::size_t i = 0; i < kN; i++) { - for (unsigned j = 0; j < kN; j++) + for (std::size_t j = 0; j < kN; j++) { W(i,j) = lA(i,j) = A(i,j); Ainv(i,j) = 0.0; @@ -150,7 +147,7 @@ void matrix_solver_sm_t<m_N, storage_N>::LE_invert() Ainv(i,i) = 1.0; } /* down */ - for (unsigned i = 0; i < kN; i++) + for (std::size_t i = 0; i < kN; i++) { /* FIXME: Singular matrix? */ const nl_double f = 1.0 / W(i,i); @@ -169,28 +166,28 @@ void matrix_solver_sm_t<m_N, storage_N>::LE_invert() { for (std::size_t k = 0; k < e; k++) W(j,p[k]) += W(i,p[k]) * f1; - for (unsigned k = 0; k <= i; k ++) + for (std::size_t k = 0; k <= i; k ++) Ainv(j,k) += Ainv(i,k) * f1; } } } /* up */ - for (unsigned i = kN; i-- > 0; ) + for (std::size_t i = kN; i-- > 0; ) { /* FIXME: Singular matrix? */ const nl_double f = 1.0 / W(i,i); - for (unsigned j = i; j-- > 0; ) + for (std::size_t j = i; j-- > 0; ) { const nl_double f1 = - W(j,i) * f; if (f1 != 0.0) { - for (unsigned k = i; k < kN; k++) + for (std::size_t k = i; k < kN; k++) W(j,k) += W(i,k) * f1; - for (unsigned k = 0; k < kN; k++) + for (std::size_t k = 0; k < kN; k++) Ainv(j,k) += Ainv(i,k) * f1; } } - for (unsigned k = 0; k < kN; k++) + for (std::size_t k = 0; k < kN; k++) { Ainv(i,k) *= f; lAinv(i,k) = Ainv(i,k); @@ -198,27 +195,27 @@ void matrix_solver_sm_t<m_N, storage_N>::LE_invert() } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> template <typename T> void matrix_solver_sm_t<m_N, storage_N>::LE_compute_x( T * RESTRICT x) { - const unsigned kN = N(); + const std::size_t kN = N(); - for (unsigned i=0; i<kN; i++) + for (std::size_t i=0; i<kN; i++) x[i] = 0.0; - for (unsigned k=0; k<kN; k++) + for (std::size_t k=0; k<kN; k++) { const nl_double f = RHS(k); - for (unsigned i=0; i<kN; i++) + for (std::size_t i=0; i<kN; i++) x[i] += Ainv(i,k) * f; } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_sm_t<m_N, storage_N>::solve_non_dynamic(const bool newton_raphson) { static const bool incremental = true; @@ -308,29 +305,26 @@ unsigned matrix_solver_sm_t<m_N, storage_N>::solve_non_dynamic(const bool newton } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> inline unsigned matrix_solver_sm_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { build_LE_A<matrix_solver_sm_t>(); build_LE_RHS<matrix_solver_sm_t>(); - for (unsigned i=0, iN=N(); i < iN; i++) + for (std::size_t i=0, iN=N(); i < iN; i++) m_last_RHS[i] = RHS(i); this->m_stat_calculations++; return this->solve_non_dynamic(newton_raphson); } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_sm_t<m_N, storage_N>::matrix_solver_sm_t(netlist_t &anetlist, const pstring &name, - const solver_parameters_t *params, const unsigned size) + const solver_parameters_t *params, const std::size_t size) : matrix_solver_t(anetlist, name, NOSORT, params) , m_dim(size) { -#if (NL_USE_DYNAMIC_ALLOCATION) - m_A = palloc_array(nl_ext_double, N() * m_pitch); -#endif - for (unsigned k = 0; k < N(); k++) + for (std::size_t k = 0; k < N(); k++) { m_last_RHS[k] = 0.0; } diff --git a/src/lib/netlist/solver/nld_ms_sor.h b/src/lib/netlist/solver/nld_ms_sor.h index 15f56ee264b..dc3a5d1821c 100644 --- a/src/lib/netlist/solver/nld_ms_sor.h +++ b/src/lib/netlist/solver/nld_ms_sor.h @@ -21,12 +21,12 @@ namespace netlist { namespace devices { -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_SOR_t: public matrix_solver_direct_t<m_N, storage_N> { public: - matrix_solver_SOR_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const unsigned size) + matrix_solver_SOR_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size) : matrix_solver_direct_t<m_N, storage_N>(anetlist, name, matrix_solver_t::ASCENDING, params, size) , m_lp_fact(*this, "m_lp_fact", 0) { @@ -46,16 +46,16 @@ private: // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_SOR_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { matrix_solver_direct_t<m_N, storage_N>::vsetup(nets); } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_SOR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { - const unsigned iN = this->N(); + const std::size_t iN = this->N(); bool resched = false; unsigned resched_cnt = 0; @@ -74,7 +74,7 @@ unsigned matrix_solver_SOR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newt nl_double RHS[storage_N]; nl_double new_V[storage_N]; - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { nl_double gtot_t = 0.0; nl_double gabs_t = 0.0; @@ -86,7 +86,7 @@ unsigned matrix_solver_SOR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newt const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); const nl_double * const *other_cur_analog = this->m_terms[k]->connected_net_V(); - new_V[k] = this->m_nets[k]->m_cur_Analog; + new_V[k] = this->m_nets[k]->Q_Analog(); for (std::size_t i = 0; i < term_count; i++) { @@ -125,17 +125,10 @@ unsigned matrix_solver_SOR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newt const nl_double accuracy = this->m_params.m_accuracy; - /* uncommenting the line below will force dynamic updates every X iterations - * althought the system has not converged yet. This is a proof of concept, - * - */ - const bool interleaved_dynamic_updates = false; - //const bool interleaved_dynamic_updates = newton_raphson; - do { resched = false; nl_double err = 0; - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { const int * RESTRICT net_other = this->m_terms[k]->connected_net_idx(); const std::size_t railstart = this->m_terms[k]->m_railstart; @@ -156,29 +149,20 @@ unsigned matrix_solver_SOR_t<m_N, storage_N>::vsolve_non_dynamic(const bool newt resched_cnt++; //} while (resched && (resched_cnt < this->m_params.m_gs_loops)); - } while (resched && ((!interleaved_dynamic_updates && resched_cnt < this->m_params.m_gs_loops) || (interleaved_dynamic_updates && resched_cnt < 5 ))); + } while (resched && ((resched_cnt < this->m_params.m_gs_loops))); this->m_iterative_total += resched_cnt; + this->m_stat_calculations++; - if (resched && !interleaved_dynamic_updates) + if (resched) { // Fallback to direct solver ... this->m_iterative_fail++; return matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(newton_raphson); } - this->m_stat_calculations++; - - if (interleaved_dynamic_updates) - { - for (unsigned k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog += 1.0 * (new_V[k] - this->m_nets[k]->m_cur_Analog); - } - else - { - for (unsigned k = 0; k < iN; k++) - this->m_nets[k]->m_cur_Analog = new_V[k]; - } + for (std::size_t k = 0; k < iN; k++) + this->m_nets[k]->set_Q_Analog(new_V[k]); return resched_cnt; } diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h index 43b6eeeafb5..265ef821957 100644 --- a/src/lib/netlist/solver/nld_ms_sor_mat.h +++ b/src/lib/netlist/solver/nld_ms_sor_mat.h @@ -22,14 +22,14 @@ namespace netlist { namespace devices { -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_SOR_mat_t: public matrix_solver_direct_t<m_N, storage_N> { friend class matrix_solver_t; public: - matrix_solver_SOR_mat_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const unsigned size) + matrix_solver_SOR_mat_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, std::size_t size) : matrix_solver_direct_t<m_N, storage_N>(anetlist, name, matrix_solver_t::DESCENDING, params, size) , m_Vdelta(*this, "m_Vdelta", 0.0) , m_omega(*this, "m_omega", params->m_gs_sor) @@ -58,7 +58,7 @@ private: // matrix_solver - Gauss - Seidel // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_SOR_mat_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { matrix_solver_direct_t<m_N, storage_N>::vsetup(nets); @@ -113,7 +113,7 @@ nl_double matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve() } #endif -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { /* The matrix based code looks a lot nicer but actually is 30% slower than @@ -123,7 +123,7 @@ unsigned matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve_non_dynamic(const bool nl_double new_v[storage_N] = { 0.0 }; - const unsigned iN = this->N(); + const std::size_t iN = this->N(); matrix_solver_t::build_LE_A<matrix_solver_SOR_mat_t>(); matrix_solver_t::build_LE_RHS<matrix_solver_SOR_mat_t>(); @@ -169,14 +169,14 @@ unsigned matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve_non_dynamic(const bool } #endif - for (unsigned k = 0; k < iN; k++) - new_v[k] = this->m_nets[k]->m_cur_Analog; + for (std::size_t k = 0; k < iN; k++) + new_v[k] = this->m_nets[k]->Q_Analog(); do { resched = false; nl_double cerr = 0.0; - for (unsigned k = 0; k < iN; k++) + for (std::size_t k = 0; k < iN; k++) { nl_double Idrive = 0; @@ -199,10 +199,12 @@ unsigned matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve_non_dynamic(const bool } while (resched && (resched_cnt < this->m_params.m_gs_loops)); this->m_stat_calculations++; + this->m_iterative_total += resched_cnt; this->m_gs_total += resched_cnt; if (resched) { + this->m_iterative_fail++; //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); this->m_gs_fail++; diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h index e644ce40085..c2e016e4dec 100644 --- a/src/lib/netlist/solver/nld_ms_w.h +++ b/src/lib/netlist/solver/nld_ms_w.h @@ -54,13 +54,13 @@ namespace netlist //#define nl_ext_double long double // slightly slower #define nl_ext_double nl_double -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> class matrix_solver_w_t: public matrix_solver_t { friend class matrix_solver_t; public: - matrix_solver_w_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const unsigned size); + matrix_solver_w_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size); virtual ~matrix_solver_w_t(); @@ -71,7 +71,7 @@ protected: virtual unsigned vsolve_non_dynamic(const bool newton_raphson) override; unsigned solve_non_dynamic(const bool newton_raphson); - inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + constexpr std::size_t N() const { return (m_N == 0) ? m_dim : m_N; } void LE_invert(); @@ -115,7 +115,7 @@ private: //nl_ext_double m_RHSx[storage_N]; - const unsigned m_dim; + const std::size_t m_dim; }; @@ -123,17 +123,14 @@ private: // matrix_solver_direct // ---------------------------------------------------------------------------------------- -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_w_t<m_N, storage_N>::~matrix_solver_w_t() { } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_w_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) { - if (m_dim < nets.size()) - log().fatal("Dimension {1} less than {2}", m_dim, nets.size()); - matrix_solver_t::setup_base(nets); netlist().save(*this, m_last_RHS, "m_last_RHS"); @@ -144,14 +141,14 @@ void matrix_solver_w_t<m_N, storage_N>::vsetup(analog_net_t::list_t &nets) -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> void matrix_solver_w_t<m_N, storage_N>::LE_invert() { - const unsigned kN = N(); + const std::size_t kN = N(); - for (unsigned i = 0; i < kN; i++) + for (std::size_t i = 0; i < kN; i++) { - for (unsigned j = 0; j < kN; j++) + for (std::size_t j = 0; j < kN; j++) { W(i,j) = lA(i,j) = A(i,j); Ainv(i,j) = 0.0; @@ -159,7 +156,7 @@ void matrix_solver_w_t<m_N, storage_N>::LE_invert() Ainv(i,i) = 1.0; } /* down */ - for (unsigned i = 0; i < kN; i++) + for (std::size_t i = 0; i < kN; i++) { /* FIXME: Singular matrix? */ const nl_double f = 1.0 / W(i,i); @@ -170,63 +167,63 @@ void matrix_solver_w_t<m_N, storage_N>::LE_invert() const auto * RESTRICT const pb = m_terms[i]->m_nzbd.data(); const size_t eb = m_terms[i]->m_nzbd.size(); - for (unsigned jb = 0; jb < eb; jb++) + for (std::size_t jb = 0; jb < eb; jb++) { const auto j = pb[jb]; const nl_double f1 = - W(j,i) * f; if (f1 != 0.0) { - for (unsigned k = 0; k < e; k++) + for (std::size_t k = 0; k < e; k++) W(j,p[k]) += W(i,p[k]) * f1; - for (unsigned k = 0; k <= i; k ++) + for (std::size_t k = 0; k <= i; k ++) Ainv(j,k) += Ainv(i,k) * f1; } } } /* up */ - for (unsigned i = kN; i-- > 0; ) + for (std::size_t i = kN; i-- > 0; ) { /* FIXME: Singular matrix? */ const nl_double f = 1.0 / W(i,i); - for (unsigned j = i; j-- > 0; ) + for (std::size_t j = i; j-- > 0; ) { const nl_double f1 = - W(j,i) * f; if (f1 != 0.0) { - for (unsigned k = i; k < kN; k++) + for (std::size_t k = i; k < kN; k++) W(j,k) += W(i,k) * f1; - for (unsigned k = 0; k < kN; k++) + for (std::size_t k = 0; k < kN; k++) Ainv(j,k) += Ainv(i,k) * f1; } } - for (unsigned k = 0; k < kN; k++) + for (std::size_t k = 0; k < kN; k++) { Ainv(i,k) *= f; } } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> template <typename T> void matrix_solver_w_t<m_N, storage_N>::LE_compute_x( T * RESTRICT x) { - const unsigned kN = N(); + const std::size_t kN = N(); - for (unsigned i=0; i<kN; i++) + for (std::size_t i=0; i<kN; i++) x[i] = 0.0; - for (unsigned k=0; k<kN; k++) + for (std::size_t k=0; k<kN; k++) { const nl_double f = RHS(k); - for (unsigned i=0; i<kN; i++) + for (std::size_t i=0; i<kN; i++) x[i] += Ainv(i,k) * f; } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> unsigned matrix_solver_w_t<m_N, storage_N>::solve_non_dynamic(const bool newton_raphson) { const auto iN = N(); @@ -372,27 +369,27 @@ unsigned matrix_solver_w_t<m_N, storage_N>::solve_non_dynamic(const bool newton_ } } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> inline unsigned matrix_solver_w_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson) { build_LE_A<matrix_solver_w_t>(); build_LE_RHS<matrix_solver_w_t>(); - for (unsigned i=0, iN=N(); i < iN; i++) + for (std::size_t i=0, iN=N(); i < iN; i++) m_last_RHS[i] = RHS(i); this->m_stat_calculations++; return this->solve_non_dynamic(newton_raphson); } -template <unsigned m_N, unsigned storage_N> +template <std::size_t m_N, std::size_t storage_N> matrix_solver_w_t<m_N, storage_N>::matrix_solver_w_t(netlist_t &anetlist, const pstring &name, - const solver_parameters_t *params, const unsigned size) + const solver_parameters_t *params, const std::size_t size) : matrix_solver_t(anetlist, name, NOSORT, params) ,m_cnt(0) , m_dim(size) { - for (unsigned k = 0; k < N(); k++) + for (std::size_t k = 0; k < N(); k++) { m_last_RHS[k] = 0.0; } diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 52cccfd8419..d2ecf3c5bd2 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -10,34 +10,37 @@ */ #if 0 -#pragma GCC optimize "-ffast-math" -#pragma GCC optimize "-fstrict-aliasing" -#pragma GCC optimize "-ftree-vectorizer-verbose=2" -#pragma GCC optimize "-fopt-info-vec" -#pragma GCC optimize "-fopt-info-vec-missed" -//#pragma GCC optimize "-ftree-parallelize-loops=4" -#pragma GCC optimize "-funroll-loops" -#pragma GCC optimize "-funswitch-loops" -#pragma GCC optimize "-fvariable-expansion-in-unroller" -#pragma GCC optimize "-funsafe-loop-optimizations" -#pragma GCC optimize "-fvect-cost-model" -#pragma GCC optimize "-fvariable-expansion-in-unroller" -#pragma GCC optimize "-ftree-loop-if-convert-stores" -#pragma GCC optimize "-ftree-loop-distribution" -#pragma GCC optimize "-ftree-loop-im" -#pragma GCC optimize "-ftree-loop-ivcanon" -#pragma GCC optimize "-fivopts" +#pragma GCC optimize "fast-math" +#pragma GCC optimize "strict-aliasing" +#pragma GCC optimize "tree-vectorize" +#pragma GCC optimize "tree-vectorizer-verbose=7" +#pragma GCC optimize "opt-info-vec" +#pragma GCC optimize "opt-info-vec-missed" +//#pragma GCC optimize "tree-parallelize-loops=4" +#pragma GCC optimize "unroll-loops" +#pragma GCC optimize "unswitch-loops" +#pragma GCC optimize "variable-expansion-in-unroller" +#pragma GCC optimize "unsafe-loop-optimizations" +#pragma GCC optimize "vect-cost-model" +#pragma GCC optimize "variable-expansion-in-unroller" +#pragma GCC optimize "tree-loop-if-convert-stores" +#pragma GCC optimize "tree-loop-distribution" +#pragma GCC optimize "tree-loop-im" +#pragma GCC optimize "tree-loop-ivcanon" +#pragma GCC optimize "ivopts" #endif -#include <iostream> #include <algorithm> +#include <cmath> // <<= needed by windows build + #include "nl_lists.h" #if HAS_OPENMP #include "omp.h" #endif -#include "plib/putil.h" +#include "nl_factory.h" + #include "nld_solver.h" #include "nld_matrix_solver.h" @@ -107,6 +110,10 @@ NETLIB_UPDATE(solver) ATTR_UNUSED const netlist_time ts = m_mat_solvers[i]->solve(); } } + + for (auto & solver : m_mat_solvers) + if (solver->has_timestep_devices() || force_solve) + solver->update_inputs(); } else for (int i = 0; i < t_cnt; i++) @@ -114,12 +121,16 @@ NETLIB_UPDATE(solver) { // Ignore return value ATTR_UNUSED const netlist_time ts = m_mat_solvers[i]->solve(); + solver->update_inputs(); } #else for (auto & solver : m_mat_solvers) if (solver->has_timestep_devices() || force_solve) + { // Ignore return value ATTR_UNUSED const netlist_time ts = solver->solve(); + solver->update_inputs(); + } #endif /* step circuit */ @@ -131,65 +142,65 @@ NETLIB_UPDATE(solver) } template <class C> -std::unique_ptr<matrix_solver_t> create_it(netlist_t &nl, pstring name, solver_parameters_t ¶ms, unsigned size) +std::unique_ptr<matrix_solver_t> create_it(netlist_t &nl, pstring name, solver_parameters_t ¶ms, std::size_t size) { typedef C solver; return plib::make_unique<solver>(nl, name, ¶ms, size); } -template <int m_N, int storage_N> -std::unique_ptr<matrix_solver_t> NETLIB_NAME(solver)::create_solver(unsigned size, const bool use_specific) +template <std::size_t m_N, std::size_t storage_N> +std::unique_ptr<matrix_solver_t> NETLIB_NAME(solver)::create_solver(std::size_t size, const pstring &solvername) { - pstring solvername = plib::pfmt("Solver_{1}")(m_mat_solvers.size()); - if (use_specific && m_N == 1) - return plib::make_unique<matrix_solver_direct1_t>(netlist(), solvername, &m_params); - else if (use_specific && m_N == 2) - return plib::make_unique<matrix_solver_direct2_t>(netlist(), solvername, &m_params); - else + if (pstring("SOR_MAT").equals(m_method())) { - if (pstring("SOR_MAT").equals(m_method())) - { - return create_it<matrix_solver_SOR_mat_t<m_N, storage_N>>(netlist(), solvername, m_params, size); - //typedef matrix_solver_SOR_mat_t<m_N,storage_N> solver_sor_mat; - //return plib::make_unique<solver_sor_mat>(netlist(), solvername, &m_params, size); - } - else if (pstring("MAT_CR").equals(m_method())) + return create_it<matrix_solver_SOR_mat_t<m_N, storage_N>>(netlist(), solvername, m_params, size); + //typedef matrix_solver_SOR_mat_t<m_N,storage_N> solver_sor_mat; + //return plib::make_unique<solver_sor_mat>(netlist(), solvername, &m_params, size); + } + else if (pstring("MAT_CR").equals(m_method())) + { + if (size > 0) // GCR always outperforms MAT solver { typedef matrix_solver_GCR_t<m_N,storage_N> solver_mat; return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); } - else if (pstring("MAT").equals(m_method())) + else { typedef matrix_solver_direct_t<m_N,storage_N> solver_mat; return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); } - else if (pstring("SM").equals(m_method())) - { - /* Sherman-Morrison Formula */ - typedef matrix_solver_sm_t<m_N,storage_N> solver_mat; - return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); - } - else if (pstring("W").equals(m_method())) - { - /* Woodbury Formula */ - typedef matrix_solver_w_t<m_N,storage_N> solver_mat; - return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); - } - else if (pstring("SOR").equals(m_method())) - { - typedef matrix_solver_SOR_t<m_N,storage_N> solver_GS; - return plib::make_unique<solver_GS>(netlist(), solvername, &m_params, size); - } - else if (pstring("GMRES").equals(m_method())) - { - typedef matrix_solver_GMRES_t<m_N,storage_N> solver_GMRES; - return plib::make_unique<solver_GMRES>(netlist(), solvername, &m_params, size); - } - else - { - netlist().log().fatal("Unknown solver type: {1}\n", m_method()); - return nullptr; - } + } + else if (pstring("MAT").equals(m_method())) + { + typedef matrix_solver_direct_t<m_N,storage_N> solver_mat; + return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); + } + else if (pstring("SM").equals(m_method())) + { + /* Sherman-Morrison Formula */ + typedef matrix_solver_sm_t<m_N,storage_N> solver_mat; + return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); + } + else if (pstring("W").equals(m_method())) + { + /* Woodbury Formula */ + typedef matrix_solver_w_t<m_N,storage_N> solver_mat; + return plib::make_unique<solver_mat>(netlist(), solvername, &m_params, size); + } + else if (pstring("SOR").equals(m_method())) + { + typedef matrix_solver_SOR_t<m_N,storage_N> solver_GS; + return plib::make_unique<solver_GS>(netlist(), solvername, &m_params, size); + } + else if (pstring("GMRES").equals(m_method())) + { + typedef matrix_solver_GMRES_t<m_N,storage_N> solver_GMRES; + return plib::make_unique<solver_GMRES>(netlist(), solvername, &m_params, size); + } + else + { + log().fatal(MF_1_UNKNOWN_SOLVER_TYPE, m_method()); + return nullptr; } } @@ -214,7 +225,7 @@ struct net_splitter groups.back().push_back(n); for (auto &p : n->m_core_terms) { - if (p->is_type(terminal_t::TERMINAL)) + if (p->is_type(detail::terminal_type::TERMINAL)) { terminal_t *pt = static_cast<terminal_t *>(p); analog_net_t *other_net = &pt->m_otherterm->net(); @@ -275,13 +286,13 @@ void NETLIB_NAME(solver)::post_start() //m_params.m_max_timestep = std::max(m_params.m_max_timestep, m_params.m_max_timestep::) // Override log statistics - pstring p = plib::util::environment("NL_STATS"); + pstring p = plib::util::environment("NL_STATS", ""); if (p != "") m_params.m_log_stats = p.as_long(); else m_params.m_log_stats = m_log_stats(); - netlist().log().verbose("Scanning net groups ..."); + log().verbose("Scanning net groups ..."); // determine net groups net_splitter splitter; @@ -289,86 +300,103 @@ void NETLIB_NAME(solver)::post_start() splitter.run(netlist()); // setup the solvers - netlist().log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), netlist().m_nets.size()); + log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), netlist().m_nets.size()); for (auto & grp : splitter.groups) { std::unique_ptr<matrix_solver_t> ms; - unsigned net_count = static_cast<unsigned>(grp.size()); + std::size_t net_count = grp.size(); + pstring sname = plib::pfmt("Solver_{1}")(m_mat_solvers.size()); switch (net_count) { #if 1 case 1: - ms = create_solver<1,1>(1, use_specific); + if (use_specific) + ms = plib::make_unique<matrix_solver_direct1_t>(netlist(), sname, &m_params); + else + ms = create_solver<1,1>(1, sname); break; case 2: - ms = create_solver<2,2>(2, use_specific); + if (use_specific) + ms = plib::make_unique<matrix_solver_direct2_t>(netlist(), sname, &m_params); + else + ms = create_solver<2,2>(2, sname); break; case 3: - ms = create_solver<3,3>(3, use_specific); + ms = create_solver<3,3>(3, sname); break; case 4: - ms = create_solver<4,4>(4, use_specific); + ms = create_solver<4,4>(4, sname); break; case 5: - ms = create_solver<5,5>(5, use_specific); + ms = create_solver<5,5>(5, sname); break; case 6: - ms = create_solver<6,6>(6, use_specific); + ms = create_solver<6,6>(6, sname); break; case 7: - ms = create_solver<7,7>(7, use_specific); + ms = create_solver<7,7>(7, sname); break; case 8: - ms = create_solver<8,8>(8, use_specific); + ms = create_solver<8,8>(8, sname); + break; + case 9: + ms = create_solver<9,9>(9, sname); break; case 10: - ms = create_solver<10,10>(10, use_specific); + ms = create_solver<10,10>(10, sname); break; case 11: - ms = create_solver<11,11>(11, use_specific); + ms = create_solver<11,11>(11, sname); break; case 12: - ms = create_solver<12,12>(12, use_specific); + ms = create_solver<12,12>(12, sname); break; case 15: - ms = create_solver<15,15>(15, use_specific); + ms = create_solver<15,15>(15, sname); break; case 31: - ms = create_solver<31,31>(31, use_specific); + ms = create_solver<31,31>(31, sname); + break; + case 35: + ms = create_solver<31,31>(31, sname); break; case 49: - ms = create_solver<49,49>(49, use_specific); + ms = create_solver<49,49>(49, sname); break; #if 0 case 87: - ms = create_solver<87,87>(87, use_specific); + ms = create_solver<87,87>(87, sname); break; #endif #endif default: - netlist().log().warning("No specific solver found for netlist of size {1}", net_count); - if (net_count <= 16) + log().warning(MW_1_NO_SPECIFIC_SOLVER, net_count); + if (net_count <= 8) + { + ms = create_solver<0, 8>(net_count, sname); + } + else if (net_count <= 16) { - ms = create_solver<0,16>(net_count, use_specific); + ms = create_solver<0,16>(net_count, sname); } else if (net_count <= 32) { - ms = create_solver<0,32>(net_count, use_specific); + ms = create_solver<0,32>(net_count, sname); } else if (net_count <= 64) { - ms = create_solver<0,64>(net_count, use_specific); + ms = create_solver<0,64>(net_count, sname); } else if (net_count <= 128) { - ms = create_solver<0,128>(net_count, use_specific); + ms = create_solver<0,128>(net_count, sname); } else { - netlist().log().fatal("Encountered netgroup with > 128 nets"); + log().fatal(MF_1_NETGROUP_SIZE_EXCEEDED_1, 128); ms = nullptr; /* tease compilers */ } @@ -379,16 +407,16 @@ void NETLIB_NAME(solver)::post_start() ms->set_delegate_pointer(); ms->setup(grp); - netlist().log().verbose("Solver {1}", ms->name()); - netlist().log().verbose(" ==> {2} nets", grp.size()); - netlist().log().verbose(" has {1} elements", ms->has_dynamic_devices() ? "dynamic" : "no dynamic"); - netlist().log().verbose(" has {1} elements", ms->has_timestep_devices() ? "timestep" : "no timestep"); + log().verbose("Solver {1}", ms->name()); + log().verbose(" ==> {2} nets", grp.size()); + log().verbose(" has {1} elements", ms->has_dynamic_devices() ? "dynamic" : "no dynamic"); + log().verbose(" has {1} elements", ms->has_timestep_devices() ? "timestep" : "no timestep"); for (auto &n : grp) { - netlist().log().verbose("Net {1}", n->name()); + log().verbose("Net {1}", n->name()); for (const auto &pcore : n->m_core_terms) { - netlist().log().verbose(" {1}", pcore->name()); + log().verbose(" {1}", pcore->name()); } } @@ -396,12 +424,16 @@ void NETLIB_NAME(solver)::post_start() } } -void NETLIB_NAME(solver)::create_solver_code(plib::postream &strm) +void NETLIB_NAME(solver)::create_solver_code(std::map<pstring, pstring> &mp) { for (auto & s : m_mat_solvers) - s->create_solver_code(strm); + { + auto r = s->create_solver_code(); + mp[r.first] = r.second; // automatically overwrites identical names + } } + NETLIB_DEVICE_IMPL(solver) } //namespace devices } // namespace netlist diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h index e3ba6419f8b..4f6eb2a21d9 100644 --- a/src/lib/netlist/solver/nld_solver.h +++ b/src/lib/netlist/solver/nld_solver.h @@ -8,7 +8,8 @@ #ifndef NLD_SOLVER_H_ #define NLD_SOLVER_H_ -#include "nl_setup.h" +#include <map> + #include "nl_base.h" #include "plib/pstream.h" #include "solver/nld_matrix_solver.h" @@ -17,14 +18,6 @@ #define ATTR_ALIGNED(N) ATTR_ALIGN // ---------------------------------------------------------------------------------------- -// Macros -// ---------------------------------------------------------------------------------------- - -#define SOLVER(name, freq) \ - NET_REGISTER_DEV(SOLVER, name) \ - PARAM(name.FREQ, freq) - -// ---------------------------------------------------------------------------------------- // solver // ---------------------------------------------------------------------------------------- @@ -59,7 +52,7 @@ NETLIB_OBJECT(solver) /* automatic time step */ , m_dynamic_ts(*this, "DYNAMIC_TS", 0) - , m_dynamic_lte(*this, "DYNAMIC_LTE", 5e-5) // diff/timestep + , m_dynamic_lte(*this, "DYNAMIC_LTE", 1e-5) // diff/timestep , m_dynamic_min_ts(*this, "DYNAMIC_MIN_TIMESTEP", 1e-6) // nl_double timestep resolution , m_log_stats(*this, "LOG_STATS", 1) // nl_double timestep resolution @@ -76,7 +69,7 @@ NETLIB_OBJECT(solver) inline nl_double gmin() { return m_gmin(); } - void create_solver_code(plib::postream &strm); + void create_solver_code(std::map<pstring, pstring> &mp); NETLIB_UPDATEI(); NETLIB_RESETI(); @@ -107,8 +100,8 @@ private: solver_parameters_t m_params; - template <int m_N, int storage_N> - std::unique_ptr<matrix_solver_t> create_solver(unsigned size, bool use_specific); + template <std::size_t m_N, std::size_t storage_N> + std::unique_ptr<matrix_solver_t> create_solver(std::size_t size, const pstring &solvername); }; } //namespace devices diff --git a/src/lib/netlist/solver/vector_base.h b/src/lib/netlist/solver/vector_base.h index 3f0c53c8ade..b294eb0ee48 100644..100755 --- a/src/lib/netlist/solver/vector_base.h +++ b/src/lib/netlist/solver/vector_base.h @@ -36,14 +36,14 @@ private: #endif template<typename T> -inline void vec_set (const std::size_t & n, const T &scalar, T * RESTRICT result) +inline static void vec_set (const std::size_t n, const T scalar, T * RESTRICT result) { for ( std::size_t i = 0; i < n; i++ ) result[i] = scalar; } template<typename T> -inline T vecmult (const std::size_t & n, const T * RESTRICT a1, const T * RESTRICT a2 ) +inline static T vecmult (const std::size_t n, const T * RESTRICT a1, const T * RESTRICT a2 ) { T value = 0.0; for ( std::size_t i = 0; i < n; i++ ) @@ -52,7 +52,7 @@ inline T vecmult (const std::size_t & n, const T * RESTRICT a1, const T * RESTRI } template<typename T> -inline T vecmult2 (const std::size_t & n, const T *a1) +inline static T vecmult2 (const std::size_t n, const T *a1) { T value = 0.0; for ( std::size_t i = 0; i < n; i++ ) @@ -63,43 +63,56 @@ inline T vecmult2 (const std::size_t & n, const T *a1) return value; } -template<typename T> -inline void vec_mult_scalar (const std::size_t & n, const T * RESTRICT v, const T & scalar, T * RESTRICT result) +template<typename T, std::size_t N> +inline static void vec_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T & scalar, T (& RESTRICT result)[N]) { - for ( std::size_t i = 0; i < n; i++ ) - { - result[i] = scalar * v[i]; - } + if (n != N) + for ( std::size_t i = 0; i < n; i++ ) + result[i] = scalar * v[i]; + else + for ( std::size_t i = 0; i < N; i++ ) + result[i] = scalar * v[i]; +} + +template<typename T, std::size_t N> +inline static void vec_add_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T scalar, T (& RESTRICT result)[N]) +{ + if (n != N) + for ( std::size_t i = 0; i < n; i++ ) + result[i] = result[i] + scalar * v[i]; + else + for ( std::size_t i = 0; i < N; i++ ) + result[i] = result[i] + scalar * v[i]; } template<typename T> -inline void vec_add_mult_scalar (const std::size_t & n, const T * RESTRICT v, const T scalar, T * RESTRICT result) +inline static void vec_add_mult_scalar_p(const std::size_t & n, const T * RESTRICT v, const T scalar, T * RESTRICT result) { for ( std::size_t i = 0; i < n; i++ ) result[i] += scalar * v[i]; } -inline void vec_add_ip(const std::size_t & n, const double * RESTRICT v, double * RESTRICT result) +inline static void vec_add_ip(const std::size_t n, const double * RESTRICT v, double * RESTRICT result) { for ( std::size_t i = 0; i < n; i++ ) result[i] += v[i]; } template<typename T> -inline void vec_sub(const std::size_t & n, const T * RESTRICT v1, const T * RESTRICT v2, T * RESTRICT result) +inline void vec_sub(const std::size_t n, const T * RESTRICT v1, const T * RESTRICT v2, T * RESTRICT result) { for ( std::size_t i = 0; i < n; i++ ) result[i] = v1[i] - v2[i]; } template<typename T> -inline void vec_scale (const std::size_t & n, T * RESTRICT v, const T scalar) +inline void vec_scale (const std::size_t n, T * RESTRICT v, const T scalar) { for ( std::size_t i = 0; i < n; i++ ) v[i] = scalar * v[i]; } -inline double vec_maxabs(const std::size_t & n, const double * RESTRICT v) +inline double vec_maxabs(const std::size_t n, const double * RESTRICT v) { double ret = 0.0; for ( std::size_t i = 0; i < n; i++ ) diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index 9523febf06a..5b0bfd267c3 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -6,7 +6,6 @@ */ #include <algorithm> -#include <cstdio> #include <cmath> #include <unordered_map> #include "nl_convert.h" @@ -18,7 +17,7 @@ * define a model param on core device */ /* Format: external name,netlist device,model */ -static const char *s_lib_map = +static const pstring s_lib_map = "SN74LS00D, TTL_7400_DIP, 74LSXX\n" "SN74LS04D, TTL_7404_DIP, 74LSXX\n" "SN74ALS08D, TTL_7408_DIP, 74ALSXX\n" @@ -44,11 +43,12 @@ using lib_map_t = std::unordered_map<pstring, lib_map_entry>; static lib_map_t read_lib_map(const pstring lm) { plib::pistringstream istrm(lm); + plib::putf8_reader reader(istrm); lib_map_t m; pstring line; - while (istrm.readline(line)) + while (reader.readline(line)) { - plib::pstring_vector_t split(line, ","); + std::vector<pstring> split(plib::psplit(line, ",")); m[split[0].trim()] = { split[1].trim(), split[2].trim() }; } return m; @@ -185,21 +185,21 @@ const pstring nl_convert_base_t::get_nl_val(const double val) { { int i = 0; - while (m_units[i].m_unit != "-" ) + while (pstring(m_units[i].m_unit, pstring::UTF8) != "-" ) { if (m_units[i].m_mult <= std::abs(val)) break; i++; } - return plib::pfmt(m_units[i].m_func.c_str())(val / m_units[i].m_mult); + return plib::pfmt(pstring(m_units[i].m_func, pstring::UTF8))(val / m_units[i].m_mult); } } double nl_convert_base_t::get_sp_unit(const pstring &unit) { int i = 0; - while (m_units[i].m_unit != "-") + while (pstring(m_units[i].m_unit, pstring::UTF8) != "-") { - if (m_units[i].m_unit == unit) + if (pstring(m_units[i].m_unit, pstring::UTF8) == unit) return m_units[i].m_mult; i++; } @@ -242,7 +242,7 @@ nl_convert_base_t::unit_t nl_convert_base_t::m_units[] = { void nl_convert_spice_t::convert(const pstring &contents) { - plib::pstring_vector_t spnl(contents, "\n"); + std::vector<pstring> spnl(plib::psplit(contents, "\n")); // Add gnd net @@ -274,7 +274,7 @@ void nl_convert_spice_t::process_line(const pstring &line) { if (line != "") { - plib::pstring_vector_t tt(line, " ", true); + std::vector<pstring> tt(plib::psplit(line, " ", true)); double val = 0.0; switch (tt[0].code_at(0)) { @@ -313,7 +313,7 @@ void nl_convert_spice_t::process_line(const pstring &line) model = tt[5]; else model = tt[4]; - plib::pstring_vector_t m(model,"{"); + std::vector<pstring> m(plib::psplit(model,"{")); if (m.size() == 2) { if (m[1].len() != 4) @@ -401,19 +401,13 @@ void nl_convert_spice_t::process_line(const pstring &line) Eagle converter -------------------------------------------------*/ -nl_convert_eagle_t::tokenizer::tokenizer(nl_convert_eagle_t &convert, plib::pistream &strm) +nl_convert_eagle_t::tokenizer::tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &strm) : plib::ptokenizer(strm) , m_convert(convert) { set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"); set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers - char ws[5]; - ws[0] = ' '; - ws[1] = 9; - ws[2] = 10; - ws[3] = 13; - ws[4] = 0; - set_whitespace(ws); + set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13)); /* FIXME: gnetlist doesn't print comments */ set_comment("/*", "*/", "//"); set_string_char('\''); @@ -435,7 +429,8 @@ void nl_convert_eagle_t::tokenizer::verror(const pstring &msg, int line_num, con void nl_convert_eagle_t::convert(const pstring &contents) { plib::pistringstream istrm(contents); - tokenizer tok(*this, istrm); + plib::putf8_reader reader(istrm); + tokenizer tok(*this, reader); out("NETLIST_START(dummy)\n"); add_term("GND", "GND"); @@ -543,19 +538,13 @@ void nl_convert_eagle_t::convert(const pstring &contents) RINF converter -------------------------------------------------*/ -nl_convert_rinf_t::tokenizer::tokenizer(nl_convert_rinf_t &convert, plib::pistream &strm) +nl_convert_rinf_t::tokenizer::tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &strm) : plib::ptokenizer(strm) , m_convert(convert) { set_identifier_chars(".abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_-"); set_number_chars("0123456789", "0123456789eE-."); //FIXME: processing of numbers - char ws[5]; - ws[0] = ' '; - ws[1] = 9; - ws[2] = 10; - ws[3] = 13; - ws[4] = 0; - set_whitespace(ws); + set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13)); /* FIXME: gnetlist doesn't print comments */ set_comment("","","//"); // FIXME:needs to be confirmed set_string_char('"'); @@ -589,7 +578,8 @@ void nl_convert_rinf_t::tokenizer::verror(const pstring &msg, int line_num, cons void nl_convert_rinf_t::convert(const pstring &contents) { plib::pistringstream istrm(contents); - tokenizer tok(*this, istrm); + plib::putf8_reader reader(istrm); + tokenizer tok(*this, reader); auto lm = read_lib_map(s_lib_map); out("NETLIST_START(dummy)\n"); diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h index 3536488c766..d0d12c377e0 100644 --- a/src/lib/netlist/tools/nl_convert.h +++ b/src/lib/netlist/tools/nl_convert.h @@ -49,7 +49,7 @@ protected: double get_sp_val(const pstring &sin); - plib::pstream_fmt_writer_t out; + plib::putf8_fmt_writer out; private: struct net_t @@ -59,14 +59,14 @@ private: : m_name(aname), m_no_export(false) {} const pstring &name() { return m_name;} - plib::pstring_vector_t &terminals() { return m_terminals; } + std::vector<pstring> &terminals() { return m_terminals; } void set_no_export() { m_no_export = true; } bool is_no_export() { return m_no_export; } private: pstring m_name; bool m_no_export; - plib::pstring_vector_t m_terminals; + std::vector<pstring> m_terminals; }; struct dev_t @@ -101,8 +101,8 @@ private: }; struct unit_t { - pstring m_unit; - pstring m_func; + const char *m_unit; + const char *m_func; double m_mult; }; @@ -166,7 +166,7 @@ public: class tokenizer : public plib::ptokenizer { public: - tokenizer(nl_convert_eagle_t &convert, plib::pistream &strm); + tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &strm); token_id_t m_tok_ADD; token_id_t m_tok_VALUE; @@ -202,7 +202,7 @@ public: class tokenizer : public plib::ptokenizer { public: - tokenizer(nl_convert_rinf_t &convert, plib::pistream &strm); + tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &strm); token_id_t m_tok_HEA; token_id_t m_tok_APP; diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp index 0db64344861..dc7c334b1bf 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -885,7 +885,7 @@ chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer) // get a pointer to the map entry uint64_t blockoffs; uint32_t blocklen; - uint32_t blockcrc; + util::crc32_t blockcrc; uint8_t *rawmap; uint8_t *dest = reinterpret_cast<uint8_t *>(buffer); switch (m_version) @@ -2147,12 +2147,12 @@ void chd_file::decompress_v5_map() // read the reader uint8_t rawbuf[16]; file_read(m_mapoffset, rawbuf, sizeof(rawbuf)); - uint32_t mapbytes = be_read(&rawbuf[0], 4); - uint64_t firstoffs = be_read(&rawbuf[4], 6); - uint16_t mapcrc = be_read(&rawbuf[10], 2); - uint8_t lengthbits = rawbuf[12]; - uint8_t selfbits = rawbuf[13]; - uint8_t parentbits = rawbuf[14]; + uint32_t const mapbytes = be_read(&rawbuf[0], 4); + uint64_t const firstoffs = be_read(&rawbuf[4], 6); + util::crc16_t const mapcrc = be_read(&rawbuf[10], 2); + uint8_t const lengthbits = rawbuf[12]; + uint8_t const selfbits = rawbuf[13]; + uint8_t const parentbits = rawbuf[14]; // now read the map std::vector<uint8_t> compressed(mapbytes); diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h index 906bad047b4..5e9c9134c97 100644 --- a/src/lib/util/hashing.h +++ b/src/lib/util/hashing.h @@ -15,10 +15,12 @@ #include "osdcore.h" #include "corestr.h" -#include <string> #include "md5.h" #include "sha1.h" +#include <functional> +#include <string> + namespace util { //************************************************************************** @@ -132,13 +134,23 @@ protected: // final digest struct crc32_t { - bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; } - bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; } + crc32_t() { } + constexpr crc32_t(const crc32_t &rhs) = default; + constexpr crc32_t(const uint32_t crc) : m_raw(crc) { } + + constexpr bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; } + constexpr bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; } + + crc32_t &operator=(const crc32_t &rhs) = default; crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; } - operator uint32_t() const { return m_raw; } + + constexpr operator uint32_t() const { return m_raw; } + bool from_string(const char *string, int length = -1); std::string as_string() const; + uint32_t m_raw; + static const crc32_t null; }; @@ -178,13 +190,23 @@ protected: // final digest struct crc16_t { - bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; } - bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; } + crc16_t() { } + constexpr crc16_t(const crc16_t &rhs) = default; + constexpr crc16_t(const uint16_t crc) : m_raw(crc) { } + + constexpr bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; } + constexpr bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; } + + crc16_t &operator=(const crc16_t &rhs) = default; crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; } - operator uint16_t() const { return m_raw; } + + constexpr operator uint16_t() const { return m_raw; } + bool from_string(const char *string, int length = -1); std::string as_string() const; + uint16_t m_raw; + static const crc16_t null; }; @@ -220,4 +242,22 @@ protected: } // namespace util +namespace std { + +template <> struct hash<::util::crc32_t> +{ + typedef ::util::crc32_t argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const & s) const { return std::hash<std::uint32_t>()(s); } +}; + +template <> struct hash<::util::crc16_t> +{ + typedef ::util::crc16_t argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const & s) const { return std::hash<std::uint16_t>()(s); } +}; + +} // namespace std + #endif // __HASHING_H__ diff --git a/src/lib/util/path_to_regex.cpp b/src/lib/util/path_to_regex.cpp index 927ababbb8a..89a21a5e7f6 100644 --- a/src/lib/util/path_to_regex.cpp +++ b/src/lib/util/path_to_regex.cpp @@ -1,7 +1,7 @@ // license:MIT // copyright-holders:Alfred Bratterud -// NOTE: Author allowed MAME project to distribute this file under MIT -// license. Other projects need to do it under Apache 2 license +// NOTE: Author allowed MAME project to distribute this file under MIT +// license. Other projects need to do it under Apache 2 license // // This file is a part of the IncludeOS unikernel - www.includeos.org // diff --git a/src/lib/util/path_to_regex.hpp b/src/lib/util/path_to_regex.hpp index 7608d77bb5d..a6b11a22031 100644 --- a/src/lib/util/path_to_regex.hpp +++ b/src/lib/util/path_to_regex.hpp @@ -1,7 +1,7 @@ // license:MIT // copyright-holders:Alfred Bratterud -// NOTE: Author allowed MAME project to distribute this file under MIT -// license. Other projects need to do it under Apache 2 license +// NOTE: Author allowed MAME project to distribute this file under MIT +// license. Other projects need to do it under Apache 2 license // // This file is a part of the IncludeOS unikernel - www.includeos.org // diff --git a/src/lib/util/server_ws.hpp b/src/lib/util/server_ws.hpp index 170dc31ae63..b9d4721e96b 100644 --- a/src/lib/util/server_ws.hpp +++ b/src/lib/util/server_ws.hpp @@ -64,7 +64,7 @@ namespace webpp { } }; - + class Connection { friend class SocketServerBase<socket_type>; friend class SocketServer<socket_type>; @@ -142,7 +142,7 @@ namespace webpp { catch (...) {} } }; - + class Message : public std::istream { friend class SocketServerBase<socket_type>; diff --git a/src/lib/util/sha1.hpp b/src/lib/util/sha1.hpp index 7befbd326f0..a293bebb7cc 100644 --- a/src/lib/util/sha1.hpp +++ b/src/lib/util/sha1.hpp @@ -36,76 +36,76 @@ namespace { // local // Rotate an integer value to left. inline unsigned int rol(unsigned int value, unsigned int steps) { - return ((value << steps) | (value >> (32 - steps))); + return ((value << steps) | (value >> (32 - steps))); } // Sets the first 16 integers in the buffert to zero. // Used for clearing the W buffert. inline void clearWBuffert(unsigned int * buffert) { - for (int pos = 16; --pos >= 0;) - { - buffert[pos] = 0; - } + for (int pos = 16; --pos >= 0;) + { + buffert[pos] = 0; + } } inline void innerHash(unsigned int * result, unsigned int * w) { - unsigned int a = result[0]; - unsigned int b = result[1]; - unsigned int c = result[2]; - unsigned int d = result[3]; - unsigned int e = result[4]; - - int round = 0; - - #define sha1macro(func,val) \ - { \ - const unsigned int t = rol(a, 5) + (func) + e + val + w[round]; \ - e = d; \ - d = c; \ - c = rol(b, 30); \ - b = a; \ - a = t; \ - } - - while (round < 16) - { - sha1macro((b & c) | (~b & d), 0x5a827999) - ++round; - } - while (round < 20) - { - w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); - sha1macro((b & c) | (~b & d), 0x5a827999) - ++round; - } - while (round < 40) - { - w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); - sha1macro(b ^ c ^ d, 0x6ed9eba1) - ++round; - } - while (round < 60) - { - w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); - sha1macro((b & c) | (b & d) | (c & d), 0x8f1bbcdc) - ++round; - } - while (round < 80) - { - w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); - sha1macro(b ^ c ^ d, 0xca62c1d6) - ++round; - } - - #undef sha1macro - - result[0] += a; - result[1] += b; - result[2] += c; - result[3] += d; - result[4] += e; + unsigned int a = result[0]; + unsigned int b = result[1]; + unsigned int c = result[2]; + unsigned int d = result[3]; + unsigned int e = result[4]; + + int round = 0; + + #define sha1macro(func,val) \ + { \ + const unsigned int t = rol(a, 5) + (func) + e + val + w[round]; \ + e = d; \ + d = c; \ + c = rol(b, 30); \ + b = a; \ + a = t; \ + } + + while (round < 16) + { + sha1macro((b & c) | (~b & d), 0x5a827999) + ++round; + } + while (round < 20) + { + w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); + sha1macro((b & c) | (~b & d), 0x5a827999) + ++round; + } + while (round < 40) + { + w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); + sha1macro(b ^ c ^ d, 0x6ed9eba1) + ++round; + } + while (round < 60) + { + w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); + sha1macro((b & c) | (b & d) | (c & d), 0x8f1bbcdc) + ++round; + } + while (round < 80) + { + w[round] = rol((w[round - 3] ^ w[round - 8] ^ w[round - 14] ^ w[round - 16]), 1); + sha1macro(b ^ c ^ d, 0xca62c1d6) + ++round; + } + + #undef sha1macro + + result[0] += a; + result[1] += b; + result[2] += c; + result[3] += d; + result[4] += e; } } // namespace @@ -118,62 +118,62 @@ inline void innerHash(unsigned int * result, unsigned int * w) * the sha1 result in. */ inline void calc(void const * src, size_t bytelength, unsigned char * hash) { - // Init the result array. - unsigned int result[5] = { 0x67452301, 0xefcdab89, 0x98badcfe, - 0x10325476, 0xc3d2e1f0 }; - - // Cast the void src pointer to be the byte array we can work with. - unsigned char const * sarray = static_cast<unsigned char const *>(src); - - // The reusable round buffer - unsigned int w[80]; - - // Loop through all complete 64byte blocks. - - size_t endCurrentBlock; - size_t currentBlock = 0; - - if (bytelength >= 64) { - size_t const endOfFullBlocks = bytelength - 64; - - while (currentBlock <= endOfFullBlocks) { - endCurrentBlock = currentBlock + 64; - - // Init the round buffer with the 64 byte block data. - for (int roundPos = 0; currentBlock < endCurrentBlock; currentBlock += 4) - { - // This line will swap endian on big endian and keep endian on - // little endian. - w[roundPos++] = static_cast<unsigned int>(sarray[currentBlock + 3]) - | (static_cast<unsigned int>(sarray[currentBlock + 2]) << 8) - | (static_cast<unsigned int>(sarray[currentBlock + 1]) << 16) - | (static_cast<unsigned int>(sarray[currentBlock]) << 24); - } - innerHash(result, w); - } - } - - // Handle the last and not full 64 byte block if existing. - endCurrentBlock = bytelength - currentBlock; - clearWBuffert(w); - size_t lastBlockBytes = 0; - for (;lastBlockBytes < endCurrentBlock; ++lastBlockBytes) { - w[lastBlockBytes >> 2] |= static_cast<unsigned int>(sarray[lastBlockBytes + currentBlock]) << ((3 - (lastBlockBytes & 3)) << 3); - } - - w[lastBlockBytes >> 2] |= 0x80 << ((3 - (lastBlockBytes & 3)) << 3); - if (endCurrentBlock >= 56) { - innerHash(result, w); - clearWBuffert(w); - } - w[15] = bytelength << 3; - innerHash(result, w); - - // Store hash in result pointer, and make sure we get in in the correct - // order on both endian models. - for (int hashByte = 20; --hashByte >= 0;) { - hash[hashByte] = (result[hashByte >> 2] >> (((3 - hashByte) & 0x3) << 3)) & 0xff; - } + // Init the result array. + unsigned int result[5] = { 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 }; + + // Cast the void src pointer to be the byte array we can work with. + unsigned char const * sarray = static_cast<unsigned char const *>(src); + + // The reusable round buffer + unsigned int w[80]; + + // Loop through all complete 64byte blocks. + + size_t endCurrentBlock; + size_t currentBlock = 0; + + if (bytelength >= 64) { + size_t const endOfFullBlocks = bytelength - 64; + + while (currentBlock <= endOfFullBlocks) { + endCurrentBlock = currentBlock + 64; + + // Init the round buffer with the 64 byte block data. + for (int roundPos = 0; currentBlock < endCurrentBlock; currentBlock += 4) + { + // This line will swap endian on big endian and keep endian on + // little endian. + w[roundPos++] = static_cast<unsigned int>(sarray[currentBlock + 3]) + | (static_cast<unsigned int>(sarray[currentBlock + 2]) << 8) + | (static_cast<unsigned int>(sarray[currentBlock + 1]) << 16) + | (static_cast<unsigned int>(sarray[currentBlock]) << 24); + } + innerHash(result, w); + } + } + + // Handle the last and not full 64 byte block if existing. + endCurrentBlock = bytelength - currentBlock; + clearWBuffert(w); + size_t lastBlockBytes = 0; + for (;lastBlockBytes < endCurrentBlock; ++lastBlockBytes) { + w[lastBlockBytes >> 2] |= static_cast<unsigned int>(sarray[lastBlockBytes + currentBlock]) << ((3 - (lastBlockBytes & 3)) << 3); + } + + w[lastBlockBytes >> 2] |= 0x80 << ((3 - (lastBlockBytes & 3)) << 3); + if (endCurrentBlock >= 56) { + innerHash(result, w); + clearWBuffert(w); + } + w[15] = bytelength << 3; + innerHash(result, w); + + // Store hash in result pointer, and make sure we get in in the correct + // order on both endian models. + for (int hashByte = 20; --hashByte >= 0;) { + hash[hashByte] = (result[hashByte >> 2] >> (((3 - hashByte) & 0x3) << 3)) & 0xff; + } } } // namespace sha1 diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp index 5849abb8d73..b48cef44c79 100644 --- a/src/lib/util/unicode.cpp +++ b/src/lib/util/unicode.cpp @@ -15,7 +15,7 @@ #define UTF8PROC_DLLEXPORT #endif -#include "utf8proc/utf8proc.h" +#include <utf8proc.h> #include <codecvt> #include <locale> @@ -389,7 +389,7 @@ std::string utf8_from_wstring(const std::wstring &string) //------------------------------------------------- // internal_normalize_unicode - uses utf8proc to -// normalize unicode +// normalize unicode //------------------------------------------------- static std::string internal_normalize_unicode(const char *s, size_t length, unicode_normalization_form normalization_form, bool null_terminated) @@ -437,7 +437,7 @@ static std::string internal_normalize_unicode(const char *s, size_t length, unic //------------------------------------------------- // normalize_unicode - uses utf8proc to normalize -// unicode +// unicode //------------------------------------------------- std::string normalize_unicode(const std::string &s, unicode_normalization_form normalization_form) @@ -448,7 +448,7 @@ std::string normalize_unicode(const std::string &s, unicode_normalization_form n //------------------------------------------------- // normalize_unicode - uses utf8proc to normalize -// unicode +// unicode //------------------------------------------------- std::string normalize_unicode(const char *s, unicode_normalization_form normalization_form) @@ -459,7 +459,7 @@ std::string normalize_unicode(const char *s, unicode_normalization_form normaliz //------------------------------------------------- // normalize_unicode - uses utf8proc to normalize -// unicode +// unicode //------------------------------------------------- std::string normalize_unicode(const char *s, size_t length, unicode_normalization_form normalization_form) diff --git a/src/mame/audio/nl_kidniki.h b/src/mame/audio/nl_kidniki.h index 29fbc1a094c..c511958bccb 100644 --- a/src/mame/audio/nl_kidniki.h +++ b/src/mame/audio/nl_kidniki.h @@ -1,4 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Andrew Gardner, Couriersud +#include "netlist/nl_setup.h" + NETLIST_EXTERNAL(kidniki) diff --git a/src/mame/audio/nl_mario.cpp b/src/mame/audio/nl_mario.cpp index 6a7dab55359..2a00b09c152 100644 --- a/src/mame/audio/nl_mario.cpp +++ b/src/mame/audio/nl_mario.cpp @@ -96,12 +96,12 @@ static NETLIST_START(nl_mario_snd1) NET_C(R7.2, 2J_B.FC) NET_C(C4.2, GND) - SN74LS629(1J_B, CAP_N(39)) /* C5 */ + SN74LS629(1J_B, CAP_N(39)) /* C5 */ NET_C(1J_B.RNG, V5) NET_C(1J_B.ENQ, ttllow) NET_C(GND, 1J_B.GND) - SN74LS629(2J_B, CAP_N(6.8)) /* C16 */ + SN74LS629(2J_B, CAP_N(6.8)) /* C16 */ NET_C(2J_B.RNG, V5) NET_C(2J_B.ENQ, ttllow) NET_C(GND, 2J_B.GND) diff --git a/src/mame/audio/polyplay.cpp b/src/mame/audio/polyplay.cpp index 7a32b4c1cbe..87e881c2509 100644 --- a/src/mame/audio/polyplay.cpp +++ b/src/mame/audio/polyplay.cpp @@ -30,4 +30,4 @@ WRITE_LINE_MEMBER(polyplay_state::ctc_zc1_w) m_flipflop2 = ~m_flipflop2; m_speaker2->level_w(m_flipflop2); } -}
\ No newline at end of file +} diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp index c4440d0e9f1..56cdac32fe2 100644 --- a/src/mame/drivers/5clown.cpp +++ b/src/mame/drivers/5clown.cpp @@ -874,7 +874,7 @@ static INPUT_PORTS_START( fclown ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN0-3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Setting") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Setting") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(3) PORT_NAME("Coin In") diff --git a/src/mame/drivers/aa310.cpp b/src/mame/drivers/aa310.cpp index f62ebc51a4b..00e468750b5 100644 --- a/src/mame/drivers/aa310.cpp +++ b/src/mame/drivers/aa310.cpp @@ -87,6 +87,7 @@ #include "cpu/arm/arm.h" #include "includes/archimds.h" #include "formats/acorn_dsk.h" +#include "formats/apd_dsk.h" #include "machine/i2cmem.h" #include "machine/ram.h" #include "machine/wd_fdc.h" @@ -351,7 +352,8 @@ INPUT_PORTS_END FLOPPY_FORMATS_MEMBER( aa310_state::floppy_formats ) FLOPPY_ACORN_ADFS_NEW_FORMAT, - FLOPPY_ACORN_ADFS_OLD_FORMAT + FLOPPY_ACORN_ADFS_OLD_FORMAT, + FLOPPY_APD_FORMAT FLOPPY_FORMATS_END static SLOT_INTERFACE_START( aa310_floppies ) diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp index 3fd5d2b8953..2fb4748ccdd 100644 --- a/src/mame/drivers/aerofgt.cpp +++ b/src/mame/drivers/aerofgt.cpp @@ -93,7 +93,7 @@ WRITE8_MEMBER(aerofgt_state::pending_command_clear_w) WRITE8_MEMBER(aerofgt_state::aerofgt_sh_bankswitch_w) { - membank("bank1")->set_entry(data & 0x03); + m_soundbank->set_entry(data & 0x03); } WRITE16_MEMBER(aerofgt_state::pspikesb_oki_banking_w) @@ -112,9 +112,9 @@ WRITE16_MEMBER(aerofgt_state::aerfboo2_okim6295_banking_w) WRITE8_MEMBER(aerofgt_state::aerfboot_okim6295_banking_w) { - /*bit 2 (0x4) setted too?*/ + /*bit 2 (0x4) set too?*/ if (data & 0x4) - membank("okibank")->set_entry(data & 0x3); + m_okibank->set_entry(data & 0x3); } WRITE8_MEMBER(aerofgt_state::karatblzbl_d7759_write_port_0_w) @@ -374,7 +374,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, aerofgt_state ) AM_RANGE(0x0000, 0x77ff) AM_ROM AM_RANGE(0x7800, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("soundbank") ADDRESS_MAP_END static ADDRESS_MAP_START( turbofrc_sound_portmap, AS_IO, 8, aerofgt_state ) @@ -1304,9 +1304,7 @@ MACHINE_START_MEMBER(aerofgt_state,common) MACHINE_START_MEMBER(aerofgt_state,aerofgt) { - uint8_t *rom = memregion("audiocpu")->base(); - - membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000); + m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000); MACHINE_START_CALL_MEMBER(common); } @@ -1320,7 +1318,7 @@ MACHINE_RESET_MEMBER(aerofgt_state,aerofgt) { MACHINE_RESET_CALL_MEMBER(common); - membank("bank1")->set_entry(0); /* needed by spinlbrk */ + m_soundbank->set_entry(0); /* needed by spinlbrk */ } static MACHINE_CONFIG_START( pspikes, aerofgt_state ) @@ -1922,9 +1920,8 @@ ROM_START( pspikes ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "pspikes2.bin", 0x00000, 0x40000, CRC(ec0c070e) SHA1(4ddcc184e835a2f9d15f01aaa03734fd75fe797e) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -1947,9 +1944,8 @@ ROM_START( pspikesk ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "20", 0x00000, 0x40000, CRC(75cdcee2) SHA1(272a08c46c1d0989f9fbb156e28e6a7ffa9c0a53) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -1973,9 +1969,8 @@ ROM_START( pspikesu ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "svolly91.73", 0x00000, 0x40000, CRC(bfbffcdb) SHA1(2bba99cb6d0cb2fbb3cd1242551dd7e2c6ebef50) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -1995,9 +1990,8 @@ ROM_START( svolly91 ) ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "u11.jpn", 0x00000, 0x40000, CRC(ea2e4c82) SHA1(f9cf9122499d9b1e54221fb8b6ef9c12004ca85e) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) ) @@ -2374,9 +2368,8 @@ ROM_START( karatblz ) ROM_LOAD16_WORD_SWAP( "rom2v3", 0x00000, 0x40000, CRC(01f772e1) SHA1(f87f19a82d75839b5671f23ce14218d7b910eabc) ) ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2406,9 +2399,8 @@ ROM_START( karatblza ) ROM_LOAD16_WORD_SWAP( "v2.u14", 0x00000, 0x40000, CRC(7a78976e) SHA1(3b74b80765622b8488bdd0729ec98a2c7584cad5) ) ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(47e410fe) SHA1(d26fc93f91ccf00856db2b7dfd0d905d87e99bd8) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2438,9 +2430,8 @@ ROM_START( karatblzu ) ROM_LOAD16_WORD_SWAP( "2.u14", 0x00000, 0x40000, CRC(202e6220) SHA1(2605511a0574cbc39fdf3d8ae27a0aa9b43345fb) ) ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2470,9 +2461,8 @@ ROM_START( karatblzj ) ROM_LOAD16_WORD_SWAP( "2tecmo.u14", 0x00000, 0x40000, CRC(57e52654) SHA1(15939d8f7c693b9248f3dd2b2ad5fbae2c19621f) ) ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) ) @@ -2560,9 +2550,8 @@ ROM_START( turbofrc ) // World version with no copyright notice ROM_LOAD16_WORD_SWAP( "4v1.subpcb.u1", 0x40000, 0x40000, CRC(6cd5312b) SHA1(57b109fe268fb963e981c91b6d288667a3c9a665) ) // 27c2048 - located on a OR-10 SUB BOARD - 4 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "4v3.u14", 0x80000, 0x40000, CRC(63f50557) SHA1(f8dba8c9ba412c9a67457ec31a804c57593ab20b) ) // 27c2048 - 4 stamped on chip with VideoSystem logo V - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom @@ -2595,9 +2584,8 @@ ROM_START( turbofrcu ) // US version: most notable thing in there is the points ROM_LOAD16_WORD_SWAP( "8v1.subpcb.u1", 0x40000, 0x40000, CRC(cc324da6) SHA1(ed2eaff7351914e3ebaf925ddc01be9d44d89fa6) ) // 27c2048 - located on a OR-10 SUB BOARD - 8 stamped on chip with VideoSystem logo V ROM_LOAD16_WORD_SWAP( "8v3.u14", 0x80000, 0x40000, CRC(c0a15480) SHA1(1ec99382e0a00a8167773b1d454a63cc5cd6199c) ) // 27c2048 - 8 stamped on chip with VideoSystem logo V - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001 - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x0a0000, "gfx1", 0 ) ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom @@ -2628,9 +2616,8 @@ ROM_START( aerofgt ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ ROM_LOAD16_WORD_SWAP( "1.u4", 0x00000, 0x80000, CRC(6fdff0a2) SHA1(7cc9529b426091027aa3e23586cb7d162376c0ff) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x100000, "gfx1", 0 ) ROM_LOAD( "538a54.124", 0x000000, 0x80000, CRC(4d2c4df2) SHA1(f51c2b3135f0a921ac1a79e63d6878c03cb6254b) ) @@ -2652,9 +2639,8 @@ ROM_START( aerofgtb ) ROM_LOAD16_BYTE( "v2", 0x00000, 0x40000, CRC(5c9de9f0) SHA1(93b62c59f0bc052c6fdbd5aae292a7ab2122dfd1) ) ROM_LOAD16_BYTE( "v1", 0x00001, 0x40000, CRC(89c1dcf4) SHA1(41401d63049c140e4254dc791022d85c44271390) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "v3", 0x00000, 0x20000, CRC(cbb18cf4) SHA1(7119a7536cf710660ff06d1e7d2879c79ef12b3d) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x080000, "gfx1", 0 ) ROM_LOAD( "it-19-03", 0x000000, 0x80000, CRC(85eba1a4) SHA1(5691a95d6359fdab29be0d615066370c2b856c0a) ) @@ -2682,9 +2668,8 @@ ROM_START( aerofgtc ) ROM_LOAD16_BYTE( "v2.149", 0x00000, 0x40000, CRC(f187aec6) SHA1(8905af34f114ae22fbfbd3ae115f19280bdd4fb3) ) ROM_LOAD16_BYTE( "v1.111", 0x00001, 0x40000, CRC(9e684b19) SHA1(b5e1e5b74ed9fd223c9315ee2d548e620224c102) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) - ROM_RELOAD( 0x10000, 0x20000 ) /* gfx ROMs were missing in this set, I'm using the aerofgtb ones */ ROM_REGION( 0x080000, "gfx1", 0 ) @@ -2713,9 +2698,8 @@ ROM_START( sonicwi ) ROM_LOAD16_BYTE( "2.149", 0x00000, 0x40000, CRC(3d1b96ba) SHA1(941be323c0cb15e05c92b897984617b05c5cf676) ) ROM_LOAD16_BYTE( "1.111", 0x00001, 0x40000, CRC(a3d09f94) SHA1(a1064d659488878f5303edc2b8636312ab632a83) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ + ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */ ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) // 3.156 - ROM_RELOAD( 0x10000, 0x20000 ) /* gfx ROMs were missing in this set, I'm using the aerofgtb ones */ ROM_REGION( 0x080000, "gfx1", 0 ) @@ -2823,7 +2807,7 @@ ROM_END DRIVER_INIT_MEMBER(aerofgt_state, banked_oki) { - membank("okibank")->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000); + m_okibank->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000); } diff --git a/src/mame/drivers/aleisttl.cpp b/src/mame/drivers/aleisttl.cpp index df43a588445..51c2e64ff1a 100644 --- a/src/mame/drivers/aleisttl.cpp +++ b/src/mame/drivers/aleisttl.cpp @@ -7,7 +7,7 @@ Chase (aka Chase1) (1976) Deluxe Soccer (1973) Fire Power (1975) EG-1020-2 - Fütsball (1975) + Fötsball (1975) Galaxy Raider (1974) Hesitation (1974) AL-6500? Hockey, Soccer, Tennis (1974) diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp index 2828a8e3512..258e2df1a35 100644 --- a/src/mame/drivers/alg.cpp +++ b/src/mame/drivers/alg.cpp @@ -320,11 +320,13 @@ static MACHINE_CONFIG_START( alg_r1, alg_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) MCFG_SOUND_ROUTE(2, "rspeaker", 0.25) MCFG_SOUND_ROUTE(3, "lspeaker", 0.25) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) MCFG_SOUND_MODIFY("laserdisc") MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index e60f4298d8d..7cd26f8acfd 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -8,6 +8,7 @@ #include "emu.h" #include "includes/amiga.h" +#include "bus/amiga/keyboard/keyboard.h" #include "bus/amiga/zorro/zorro.h" #include "cpu/m68000/m68000.h" #include "cpu/m6502/m6502.h" @@ -20,11 +21,11 @@ #include "machine/nvram.h" #include "machine/i2cmem.h" #include "machine/amigafdc.h" -#include "machine/amigakbd.h" #include "machine/cr511b.h" #include "machine/rp5c01.h" #include "softlist.h" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -1318,7 +1319,7 @@ static MACHINE_CONFIG_START( amiga_base, amiga_state ) MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amigakbd_device, kdat_w)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amiga_keyboard_bus_device, kdat_in_w)) MCFG_DEVCB_INVERT MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL) MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) @@ -1328,11 +1329,13 @@ static MACHINE_CONFIG_START( amiga_base, amiga_state ) // audio MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_PAL) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) // floppy drives MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_PAL) @@ -1358,10 +1361,10 @@ static MACHINE_CONFIG_START( amiga_base, amiga_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") // keyboard - MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) - MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, cnt_w)) - MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, sp_w)) - MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(WRITELINE(amiga_state, kbreset_w)) + MCFG_AMIGA_KEYBOARD_INTERFACE_ADD("kbd", "a500_us") + MCFG_AMIGA_KEYBOARD_KCLK_HANDLER(DEVWRITELINE("cia_0", mos8520_device, cnt_w)) + MCFG_AMIGA_KEYBOARD_KDAT_HANDLER(DEVWRITELINE("cia_0", mos8520_device, sp_w)) + MCFG_AMIGA_KEYBOARD_KRST_HANDLER(WRITELINE(amiga_state, kbreset_w)) // software MCFG_SOFTWARE_LIST_ADD("wb_list", "amiga_workbench") @@ -1694,6 +1697,12 @@ static MACHINE_CONFIG_DERIVED_CLASS( a1200, amiga_base, a1200_state ) MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", nullptr, false) MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) + // keyboard +#if 0 + MCFG_DEVICE_MODIFY("kbd") + MCFG_SLOT_DEFAULT_OPTION("a1200_us") +#endif + // todo: pcmcia MACHINE_CONFIG_END @@ -2064,10 +2073,6 @@ ROM_START( a1200 ) ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - - ROM_REGION(0x4000, "keyboard", 0) - ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) // COMMODORE | 391508-01 REV0 | KEYBOARD MPU (MC68HC05C4AFN) - ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) // Amiga Tech REV1 Keyboard MPU (MC68HC05C12FN) ROM_END #define rom_a1200n rom_a1200 diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp index 4b385c086a2..c9651eeb8cb 100644 --- a/src/mame/drivers/aristmk5.cpp +++ b/src/mame/drivers/aristmk5.cpp @@ -13,10 +13,10 @@ TODO (MK-5 specific): - Fix remaining errors - - If all tests passes, this msg is printed on the keyboard serial port: - "System Startup Code Entered \n Gos_create could not allocate stack for the new process \n - Unrecoverable error occurred. System will now restart" - Apparently it looks like some sort of protection device ... + - Layouts for various configurations + - Bill acceptor + - Serial printer + - Default NVRAM code DASMing of POST (adonis): - bp 0x3400224: @@ -179,9 +179,11 @@ #include "machine/input_merger.h" #include "machine/nvram.h" #include "machine/ins8250.h" +#include "machine/ticket.h" #include "sound/volt_reg.h" #include "aristmk5.lh" +#include "aristmk5_us.lh" class aristmk5_state : public archimedes_state { @@ -191,26 +193,35 @@ public: , m_eeprom(*this, "eeprom%d", 0) , m_rtc(*this, "rtc") , m_nvram(*this, "nvram") + , m_hopper(*this, "hopper") , m_sram(*this, "sram") + , m_p1(*this, "P1") + , m_p2(*this, "P2") , m_extra_ports(*this, "EXTRA") { } DECLARE_WRITE32_MEMBER(Ns5w48); DECLARE_READ32_MEMBER(Ns5x58); - DECLARE_READ32_MEMBER(mk5_ioc_r); - DECLARE_WRITE32_MEMBER(mk5_ioc_w); DECLARE_READ32_MEMBER(Ns5r50); - DECLARE_WRITE32_MEMBER(sram_banksel_w); - DECLARE_WRITE32_MEMBER(eeprom_w); - DECLARE_WRITE32_MEMBER(rtc_w); - DECLARE_READ32_MEMBER(eeprom_r); - DECLARE_READ32_MEMBER(ldor_r); - DECLARE_WRITE32_MEMBER(ldor_clk_w); + DECLARE_WRITE8_MEMBER(sram_banksel_w); + DECLARE_WRITE8_MEMBER(eeprom_w); + DECLARE_WRITE8_MEMBER(eeprom_usa_w); + DECLARE_WRITE8_MEMBER(rtc_w); + DECLARE_WRITE8_MEMBER(rtc_usa_w); + DECLARE_WRITE8_MEMBER(hopper_w); + DECLARE_READ8_MEMBER(eeprom_r); + DECLARE_READ8_MEMBER(ldor_r); + DECLARE_WRITE8_MEMBER(ldor_clk_w); DECLARE_WRITE8_MEMBER(buttons_lamps_w); DECLARE_WRITE8_MEMBER(other_lamps_w); DECLARE_WRITE8_MEMBER(bill_acceptor_lamps_w); DECLARE_READ8_MEMBER(sram_r); DECLARE_WRITE8_MEMBER(sram_w); + DECLARE_WRITE8_MEMBER(spi_mux_w); + DECLARE_WRITE8_MEMBER(spi_data_w); + DECLARE_READ8_MEMBER(spi_int_ack_r); + DECLARE_WRITE8_MEMBER(spi_int_ack_w); + DECLARE_READ8_MEMBER(spi_data_r); DECLARE_WRITE_LINE_MEMBER(uart_irq_callback); DECLARE_DRIVER_INIT(aristmk5); @@ -218,27 +229,130 @@ public: virtual void machine_reset() override; TIMER_CALLBACK_MEMBER(mk5_VSYNC_callback); TIMER_CALLBACK_MEMBER(mk5_2KHz_callback); + TIMER_CALLBACK_MEMBER(spi_timer); INPUT_CHANGED_MEMBER(coin_start); CUSTOM_INPUT_MEMBER(coin_r); + CUSTOM_INPUT_MEMBER(coin_usa_r); + CUSTOM_INPUT_MEMBER(hopper_r); private: required_device_array<eeprom_serial_93cxx_device, 2> m_eeprom; required_device<ds1302_device> m_rtc; required_device<nvram_device> m_nvram; + required_device<ticket_dispenser_device> m_hopper; required_memory_region m_sram; + required_ioport m_p1; + required_ioport m_p2; required_ioport m_extra_ports; emu_timer * m_mk5_2KHz_timer; emu_timer * m_mk5_VSYNC_timer; - uint8_t m_ext_latch; + emu_timer * m_spi_timer; uint8_t m_sram_bank; - uint8_t m_flyback; uint8_t m_ldor_shift_reg; + uint8_t m_hopper_test; uint64_t m_coin_start_cycles; + uint8_t m_coin_div; + uint8_t m_spi_mux; + uint8_t m_spi_latch; + uint8_t m_spi_bits; + uint32_t m_spi_data[8]; }; +WRITE8_MEMBER(aristmk5_state::spi_mux_w) +{ + uint8_t spi_mux = (data >> 4) & 7; + + if (spi_mux == m_spi_mux) + return; + + m_spi_mux = spi_mux; + + switch (m_spi_mux) + { + case 0: // Test + case 3: // not used + break; + + case 1: // Top box lamps + break; + + case 2: // Mechanical meters + for(int i=0; i<4; i++) + output().set_lamp_value(32 + i, BIT(m_spi_data[m_spi_mux], 1 + i)); // Tower Lamps + break; + + case 4: // Door inputs + m_spi_data[m_spi_mux] = m_p1->read(); + break; + + case 5: // Door outputs + for(int i=0; i<32; i++) + output().set_lamp_value(i, BIT(m_spi_data[m_spi_mux], i)); + break; + + case 6: // Main board slow I/O + m_spi_data[m_spi_mux] = m_p2->read() & ~((data & 0x80) ? 0 : 0x100); + break; + + case 7: // Main board security registers + break; + } +} + +WRITE8_MEMBER(aristmk5_state::spi_data_w) +{ + m_spi_latch = data; + m_spi_bits = 0; + + // start the SPI clock + m_spi_timer->adjust(attotime::from_hz((double)MASTER_CLOCK / 9 / 512 / 2), 0, attotime::from_hz((double)MASTER_CLOCK / 9 / 512 / 2)); +} + +READ8_MEMBER(aristmk5_state::spi_data_r) +{ + return m_spi_latch; +} + +READ8_MEMBER(aristmk5_state::spi_int_ack_r) +{ + archimedes_clear_irq_b(0x08); + return 0; +} + +WRITE8_MEMBER(aristmk5_state::spi_int_ack_w) +{ + archimedes_clear_irq_b(0x08); +} + +TIMER_CALLBACK_MEMBER(aristmk5_state::spi_timer) +{ + if (m_spi_mux == 0 || m_spi_mux == 3) + { + m_spi_latch = (((m_spi_latch & 1) << 7) ^ 0x80) | ((m_spi_latch >> 1) & 0x7f); + } + else + { + static int mux_bits[8] = { 0, 16, 16, 0, 24, 32, 24, 8 }; + + uint32_t mux_mask = ((uint32_t)1 << (mux_bits[m_spi_mux] - 1)) - 1; + uint32_t spi_in_bit = m_spi_data[m_spi_mux] & 1; + uint32_t spi_out_bit = m_spi_latch & 1; + + m_spi_data[m_spi_mux] = (spi_out_bit << (mux_bits[m_spi_mux] - 1)) | ((m_spi_data[m_spi_mux] >> 1) & mux_mask); + m_spi_latch = (spi_in_bit << 7) | ((m_spi_latch >> 1) & 0x7f); + } + + // SPI interrupt + if (++m_spi_bits == 8) + { + m_spi_timer->adjust(attotime::never); + archimedes_request_irq_b(0x08); + } +} + WRITE_LINE_MEMBER(aristmk5_state::uart_irq_callback) { if (state) @@ -249,7 +363,7 @@ WRITE_LINE_MEMBER(aristmk5_state::uart_irq_callback) TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_VSYNC_callback) { - m_ioc_regs[IRQ_STATUS_A] |= 0x08; //turn vsync bit on + archimedes_request_irq_a(0x08); //turn vsync bit on m_mk5_VSYNC_timer->adjust(attotime::never); } @@ -300,7 +414,7 @@ WRITE32_MEMBER(aristmk5_state::Ns5w48) */ - m_ioc_regs[IRQ_STATUS_A] &= ~0x08; + archimedes_clear_irq_a(0x08); /* bit 1 bit 0 */ if((data &~(0x02)) && (data & (0x01))) // external video crystal is enabled. 25 mhz @@ -323,7 +437,7 @@ WRITE32_MEMBER(aristmk5_state::Ns5w48) TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_2KHz_callback) { - m_ioc_regs[IRQ_STATUS_A] |= 0x01; + archimedes_request_irq_a(0x01); m_mk5_2KHz_timer->adjust(attotime::never); } @@ -350,62 +464,17 @@ READ32_MEMBER(aristmk5_state::Ns5x58) // reset 2KHz timer - m_mk5_2KHz_timer->adjust(attotime::from_hz(1953.125)); - m_ioc_regs[IRQ_STATUS_A] &= ~0x01; - m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); + m_mk5_2KHz_timer->adjust(attotime::from_hz((double)MASTER_CLOCK / 9 / 4096)); + archimedes_clear_irq_a(0x01); return 0xffffffff; } -/* same as plain AA but with the I2C unconnected */ -READ32_MEMBER(aristmk5_state::mk5_ioc_r) -{ - uint32_t ioc_addr; - - ioc_addr = offset*4; - ioc_addr >>= 16; - ioc_addr &= 0x37; - - if(((ioc_addr == 0x20) || (ioc_addr == 0x30)) && (offset & 0x1f) == 0) - { - int vert_pos; - - vert_pos = m_screen->vpos(); - m_flyback = (vert_pos <= m_vidc_regs[VIDC_VDSR] || vert_pos >= m_vidc_regs[VIDC_VDER]) ? 0x80 : 0x00; - - //i2c_data = (i2cmem_sda_read(machine().device("i2cmem")) & 1); - - return (m_flyback) | (m_ioc_regs[CONTROL] & 0x7c) | (1<<1) | 1; - } - - return archimedes_ioc_r(space,offset,mem_mask); -} - -WRITE32_MEMBER(aristmk5_state::mk5_ioc_w) -{ - uint32_t ioc_addr; - - ioc_addr = offset*4; - ioc_addr >>= 16; - ioc_addr &= 0x37; - - if(!m_ext_latch) - { - if(((ioc_addr == 0x20) || (ioc_addr == 0x30)) && (offset & 0x1f) == 0) - { - m_ioc_regs[CONTROL] = data & 0x7c; - return; - } - else - archimedes_ioc_w(space,offset,data,mem_mask); - } -} - READ32_MEMBER(aristmk5_state::Ns5r50) { return 0xf5; // checked inside the CPU check, unknown meaning } -READ32_MEMBER(aristmk5_state::eeprom_r) +READ8_MEMBER(aristmk5_state::eeprom_r) { uint8_t data = 0x00; if (m_eeprom[0]->do_read() && m_eeprom[1]->do_read()) @@ -417,46 +486,60 @@ READ32_MEMBER(aristmk5_state::eeprom_r) return data; } -WRITE32_MEMBER(aristmk5_state::rtc_w) +WRITE8_MEMBER(aristmk5_state::hopper_w) { - if (ACCESSING_BITS_0_7) - { - m_rtc->ce_w(BIT(data, 5)); + m_hopper->write(space, 0, (data & 0x02) ? 0x80 : 0); + m_hopper_test = BIT(data, 2); +} + +WRITE8_MEMBER(aristmk5_state::rtc_w) +{ + m_rtc->ce_w(BIT(data, 5)); - if (BIT(data, 6)) - m_rtc->io_w(BIT(data, 3)); + if (BIT(data, 6)) + m_rtc->io_w(BIT(data, 3)); - m_rtc->sclk_w(BIT(data, 4)); - } + m_rtc->sclk_w(BIT(data, 4)); } -WRITE32_MEMBER(aristmk5_state::eeprom_w) +WRITE8_MEMBER(aristmk5_state::rtc_usa_w) { - if (ACCESSING_BITS_0_7) - { - m_eeprom[0]->cs_write(BIT(data, 5)); - m_eeprom[1]->cs_write(BIT(data, 6)); - m_eeprom[0]->di_write(BIT(data, 3)); - m_eeprom[1]->di_write(BIT(data, 3)); - m_eeprom[0]->clk_write(BIT(data, 4)); - m_eeprom[1]->clk_write(BIT(data, 4)); - } + rtc_w(space, offset, data, mem_mask); + m_hopper_test = BIT(data, 2); } -READ32_MEMBER(aristmk5_state::ldor_r) +WRITE8_MEMBER(aristmk5_state::eeprom_w) +{ + m_coin_div = data & 1; + + m_eeprom[0]->cs_write(BIT(data, 5)); + m_eeprom[1]->cs_write(BIT(data, 6)); + m_eeprom[0]->di_write(BIT(data, 3)); + m_eeprom[1]->di_write(BIT(data, 3)); + m_eeprom[0]->clk_write(BIT(data, 4)); + m_eeprom[1]->clk_write(BIT(data, 4)); +} + +WRITE8_MEMBER(aristmk5_state::eeprom_usa_w) +{ + eeprom_w(space, offset, data, mem_mask); + m_hopper->write(space, 0, (data & 0x04) ? 0x80 : 0); +} + +READ8_MEMBER(aristmk5_state::ldor_r) { if (m_extra_ports->read() & 0x01) m_ldor_shift_reg = 0; // open the Logic door clears the shift register - return (m_ldor_shift_reg & 0x80); + return (m_ldor_shift_reg & 0x80) | 0x60 | ((m_hopper_test && m_hopper->line_r()) ? 0x10 : 0x00); } -WRITE32_MEMBER(aristmk5_state::ldor_clk_w) +WRITE8_MEMBER(aristmk5_state::ldor_clk_w) { m_ldor_shift_reg = (m_ldor_shift_reg << 1) | BIT(data, 0); } -WRITE32_MEMBER(aristmk5_state::sram_banksel_w) +WRITE8_MEMBER(aristmk5_state::sram_banksel_w) { /* @@ -537,36 +620,16 @@ static ADDRESS_MAP_START( aristmk5_map, AS_PROGRAM, 32, aristmk5_state ) AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_SHARE("physicalram") /* physical RAM - 16 MB for now, should be 512k for the A310 */ /* MK-5 overrides */ - AM_RANGE(0x03010420, 0x03010423) AM_WRITE(sram_banksel_w) // SRAM bank select write - AM_RANGE(0x03010440, 0x03010443) AM_WRITE(rtc_w) - AM_RANGE(0x03010450, 0x03010453) AM_WRITE(eeprom_w) - AM_RANGE(0x03010800, 0x03010803) AM_READ(eeprom_r) - - AM_RANGE(0x03010580, 0x03010583) AM_READ_PORT("P3") - AM_RANGE(0x03010700, 0x03010703) AM_READ_PORT("P6") - AM_RANGE(0x03012000, 0x03012003) AM_READ_PORT("P1") - AM_RANGE(0x03012010, 0x03012013) AM_READ_PORT("P2") - AM_RANGE(0x03012200, 0x03012203) AM_READ_PORT("DSW1") - AM_RANGE(0x03012210, 0x03012213) AM_READ_PORT("DSW2") - AM_RANGE(0x03010584, 0x03010587) AM_READ_PORT("P4") - AM_RANGE(0x03012184, 0x03012187) AM_READ_PORT("P5") - - AM_RANGE(0x03012020, 0x03012023) AM_READ(ldor_r) - AM_RANGE(0x03012070, 0x03012073) AM_WRITE(ldor_clk_w) - - AM_RANGE(0x03012000, 0x0301201f) AM_WRITE8(buttons_lamps_w, 0x000000ff) - AM_RANGE(0x03012030, 0x0301203f) AM_WRITE8(other_lamps_w, 0x000000ff) - AM_RANGE(0x03012380, 0x0301238f) AM_WRITE8(bill_acceptor_lamps_w, 0x000000ff) + AM_RANGE(0x03010420, 0x03010423) AM_WRITE8(sram_banksel_w, 0x000000ff) // SRAM bank select write AM_RANGE(0x03010480, 0x0301049f) AM_DEVREADWRITE8("uart_0a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) AM_RANGE(0x03010500, 0x0301051f) AM_DEVREADWRITE8("uart_0b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03010580, 0x03010583) AM_READ_PORT("P3") AM_RANGE(0x03010600, 0x0301061f) AM_DEVREADWRITE8("uart_1a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) AM_RANGE(0x03010680, 0x0301069f) AM_DEVREADWRITE8("uart_1b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) - AM_RANGE(0x03012100, 0x0301211f) AM_DEVREADWRITE8("uart_2a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) - AM_RANGE(0x03012140, 0x0301215f) AM_DEVREADWRITE8("uart_2b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) - AM_RANGE(0x03012300, 0x0301231f) AM_DEVREADWRITE8("uart_3a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) - AM_RANGE(0x03012340, 0x0301235f) AM_DEVREADWRITE8("uart_3b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03010700, 0x03010703) AM_READ_PORT("P6") + AM_RANGE(0x03010800, 0x03010803) AM_READ8(eeprom_r, 0x000000ff) AM_RANGE(0x03010810, 0x03010813) AM_DEVREADWRITE("watchdog", watchdog_timer_device, reset32_r, reset32_w) //MK-5 specific, watchdog AM_RANGE(0x03220000, 0x0323ffff) AM_READWRITE8(sram_r, sram_w, 0x000000ff) @@ -575,8 +638,7 @@ static ADDRESS_MAP_START( aristmk5_map, AS_PROGRAM, 32, aristmk5_state ) AM_RANGE(0x03250050, 0x03250053) AM_READ(Ns5r50) //IOEB ID register AM_RANGE(0x03250058, 0x0325005b) AM_READ(Ns5x58) //IOEB interrupt Latch - - AM_RANGE(0x03000000, 0x0331ffff) AM_READWRITE(mk5_ioc_r, mk5_ioc_w) + AM_RANGE(0x03000000, 0x0331ffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w) AM_RANGE(0x03320000, 0x0333ffff) AM_READWRITE8(sram_r, sram_w, 0x000000ff) AM_RANGE(0x03400000, 0x035fffff) AM_WRITE(archimedes_vidc_w) @@ -589,17 +651,58 @@ ADDRESS_MAP_END /* U.S games have no dram emulator enabled */ static ADDRESS_MAP_START( aristmk5_usa_map, AS_PROGRAM, 32, aristmk5_state ) AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w) + + AM_RANGE(0x03010440, 0x03010443) AM_WRITE8(rtc_usa_w, 0x000000ff) + AM_RANGE(0x03010450, 0x03010453) AM_WRITE8(eeprom_usa_w, 0x000000ff) + + AM_RANGE(0x03012000, 0x03012003) AM_READ_PORT("P1") + AM_RANGE(0x03012010, 0x03012013) AM_READ_PORT("P2") + AM_RANGE(0x03012200, 0x03012203) AM_READ_PORT("DSW1") + AM_RANGE(0x03012210, 0x03012213) AM_READ_PORT("DSW2") + AM_RANGE(0x03010584, 0x03010587) AM_READ_PORT("P4") + + AM_RANGE(0x03012020, 0x03012023) AM_READ8(ldor_r, 0x000000ff) + AM_RANGE(0x03012070, 0x03012073) AM_WRITE8(ldor_clk_w, 0x000000ff) + AM_RANGE(0x03012184, 0x03012187) AM_READ_PORT("P5") + + AM_RANGE(0x03012000, 0x0301201f) AM_WRITE8(buttons_lamps_w, 0x000000ff) + AM_RANGE(0x03012030, 0x0301203f) AM_WRITE8(other_lamps_w, 0x000000ff) + AM_RANGE(0x03012380, 0x0301238f) AM_WRITE8(bill_acceptor_lamps_w, 0x000000ff) + + AM_RANGE(0x03012100, 0x0301211f) AM_DEVREADWRITE8("uart_2a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03012140, 0x0301215f) AM_DEVREADWRITE8("uart_2b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03012300, 0x0301231f) AM_DEVREADWRITE8("uart_3a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03012340, 0x0301235f) AM_DEVREADWRITE8("uart_3b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_IMPORT_FROM(aristmk5_map) ADDRESS_MAP_END /* with dram emulator enabled */ static ADDRESS_MAP_START( aristmk5_drame_map, AS_PROGRAM, 32, aristmk5_state ) AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(aristmk5_drame_memc_logical_r, archimedes_memc_logical_w) + + AM_RANGE(0x03010430, 0x03010433) AM_WRITE8(hopper_w, 0x000000ff) + AM_RANGE(0x03010440, 0x03010443) AM_WRITE8(rtc_w, 0x000000ff) + AM_RANGE(0x03010450, 0x03010453) AM_WRITE8(eeprom_w, 0x000000ff) + + AM_RANGE(0x03010400, 0x03010403) AM_WRITE8(spi_mux_w, 0x000000ff) + AM_RANGE(0x03010470, 0x03010473) AM_WRITE8(spi_data_w, 0x000000ff) + AM_RANGE(0x03010850, 0x03010853) AM_READWRITE8(spi_int_ack_r, spi_int_ack_w, 0x000000ff) + AM_RANGE(0x03010870, 0x03010873) AM_READ8(spi_data_r, 0x000000ff) + + AM_RANGE(0x03014000, 0x0301401f) AM_DEVREADWRITE8("uart_2a", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_RANGE(0x03014020, 0x0301403f) AM_DEVREADWRITE8("uart_2b", ins8250_uart_device, ins8250_r, ins8250_w, 0x000000ff) + AM_IMPORT_FROM(aristmk5_map) ADDRESS_MAP_END -CUSTOM_INPUT_MEMBER(aristmk5_state::coin_r) +CUSTOM_INPUT_MEMBER(aristmk5_state::hopper_r) +{ + return (m_hopper_test && m_hopper->line_r()) ? 0 : 1; +} + +CUSTOM_INPUT_MEMBER(aristmk5_state::coin_usa_r) { // ---x Coin Acceptor // --x- Credit Sense @@ -608,6 +711,9 @@ CUSTOM_INPUT_MEMBER(aristmk5_state::coin_r) uint8_t data = 0x07; + if (!m_coin_div) + data |= 0x08; + if (m_coin_start_cycles) { attotime diff = m_maincpu->cycles_to_attotime(m_maincpu->total_cycles() - m_coin_start_cycles); @@ -626,13 +732,37 @@ CUSTOM_INPUT_MEMBER(aristmk5_state::coin_r) return data; } +CUSTOM_INPUT_MEMBER(aristmk5_state::coin_r) +{ + uint8_t data = 0x01; + + if (m_coin_start_cycles) + { + attotime diff = m_maincpu->cycles_to_attotime(m_maincpu->total_cycles() - m_coin_start_cycles); + + if (diff > attotime::from_msec(10) && diff < attotime::from_msec(15)) + data &= ~0x01; + if (diff > attotime::from_msec(0) && diff < attotime::from_msec(20)) + data |= 0x10; + if (diff > attotime::from_msec(15) && diff < attotime::from_msec(30)) + data |= 0x08; + if (diff > attotime::from_msec(25) && !m_coin_div) + data |= 0x02; + + if (diff > attotime::from_msec(30)) + m_coin_start_cycles = 0; + } + + return data; +} + INPUT_CHANGED_MEMBER(aristmk5_state::coin_start) { if (newval && !m_coin_start_cycles) m_coin_start_cycles = m_maincpu->total_cycles(); } -static INPUT_PORTS_START( aristmk5 ) +static INPUT_PORTS_START( aristmk5_usa ) /* This simulates the ROM swap */ PORT_START("ROM_LOAD") PORT_CONFNAME( 0x03, 0x03, "System Mode" ) @@ -684,27 +814,85 @@ static INPUT_PORTS_START( aristmk5 ) PORT_START("P3") PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_SERVICE) - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Reset Key") PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_TOGGLE PORT_NAME("Bill acceptor door") PORT_BIT(0x00000040, IP_ACTIVE_LOW , IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_TOGGLE PORT_NAME("Main door") PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_TOGGLE PORT_NAME("Cashbox door") - PORT_START("P6") - PORT_BIT(0x00000002, IP_ACTIVE_LOW, IPT_KEYPAD) // Battery - PORT_START("P4") - PORT_BIT(0x00000078, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, aristmk5_state, coin_r, nullptr) + PORT_BIT(0x00000078, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, aristmk5_state, coin_usa_r, nullptr) PORT_START("P5") - PORT_BIT(0x00000008, IP_ACTIVE_LOW, IPT_KEYPAD) // Meters + PORT_BIT(0x00000008, IP_ACTIVE_LOW, IPT_OTHER) // Meters + + PORT_START("P6") + PORT_BIT(0x00000002, IP_ACTIVE_LOW, IPT_OTHER) // Battery PORT_START("EXTRA") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_CODE(KEYCODE_L) PORT_NAME("Logic door") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_TOGGLE PORT_CODE(KEYCODE_L) PORT_NAME("Logic door") PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_COIN1) PORT_CHANGED_MEMBER(DEVICE_SELF, aristmk5_state, coin_start, nullptr) INPUT_PORTS_END +static INPUT_PORTS_START( aristmk5 ) + /* This simulates the ROM swap */ + PORT_START("ROM_LOAD") + PORT_CONFNAME( 0x03, 0x03, "System Mode" ) + PORT_CONFSETTING( 0x00, "USA Set Chip v4.04.09 Mode" ) + PORT_CONFSETTING( 0x01, "USA Set Chip v4.04.00 Mode" ) + PORT_CONFSETTING( 0x02, "USA Set Chip v4.02.04 Mode" ) + PORT_CONFSETTING( 0x03, "Game Mode" ) + + PORT_START("P1") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_J) + PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) + PORT_BIT(0x00ff0000, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("P2") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Reset Key") + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_SERVICE) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_OTHER) // Hopper full + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_OTHER) // Hopper empty + PORT_BIT(0x00000100, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_TOGGLE PORT_NAME("Main door optical sensor") + PORT_BIT(0x0000fe00, IP_ACTIVE_HIGH, IPT_UNUSED) // Unused optical security sensors + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_TOGGLE PORT_NAME("Logic door") + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_TOGGLE PORT_NAME("Topbox door") + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_TOGGLE PORT_NAME("Meter cage") + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_TOGGLE PORT_NAME("Cashbox door") + PORT_BIT(0x00100000, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_TOGGLE PORT_NAME("Main door") + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_TOGGLE PORT_NAME("Bill acceptor door") + PORT_BIT(0x00c00000, IP_ACTIVE_HIGH, IPT_UNUSED) // Unused mechanical security switch + + PORT_START("P3") + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CUSTOM_MEMBER(DEVICE_SELF, aristmk5_state, hopper_r, nullptr) + PORT_BIT(0x000000f8, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, aristmk5_state, coin_r, nullptr) + + PORT_START("P6") + PORT_BIT(0x00000002, IP_ACTIVE_LOW, IPT_OTHER) // Battery + + PORT_START("EXTRA") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_COIN1) PORT_CHANGED_MEMBER(DEVICE_SELF, aristmk5_state, coin_start, nullptr) +INPUT_PORTS_END + DRIVER_INIT_MEMBER(aristmk5_state,aristmk5) { archimedes_driver_init(); @@ -845,12 +1033,13 @@ void aristmk5_state::machine_start() m_mk5_2KHz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_2KHz_callback),this)); m_mk5_VSYNC_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_VSYNC_callback),this)); + m_spi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::spi_timer), this)); } void aristmk5_state::machine_reset() { archimedes_reset(); - m_mk5_2KHz_timer->adjust(attotime::from_hz(1953.125)); // 8MHz / 4096 + m_mk5_2KHz_timer->adjust(attotime::from_hz((double)MASTER_CLOCK / 9 / 4096)); // 8MHz / 4096 m_mk5_VSYNC_timer->adjust(attotime::from_hz(50000)); // default bit 1 & bit 2 == 0 m_ioc_regs[IRQ_STATUS_B] |= 0x40; //hack, set keyboard irq empty to be ON @@ -876,15 +1065,15 @@ void aristmk5_state::machine_reset() m_ldor_shift_reg = 0x55; m_coin_start_cycles = 0; m_sram_bank = 0; + m_hopper_test = 1; + m_coin_div = 0; + m_spi_mux = 0; + m_spi_latch = 0; + m_spi_bits = 0; + memset(m_spi_data, 0, sizeof(m_spi_data)); } -#if 0 -#define NVRAM_SIZE 256 -#define NVRAM_PAGE_SIZE 0 /* max size of one write request */ -#endif - - static MACHINE_CONFIG_START( aristmk5, aristmk5_state ) MCFG_CPU_ADD("maincpu", ARM, MASTER_CLOCK/6) // 12000000 MCFG_CPU_PROGRAM_MAP(aristmk5_drame_map) @@ -892,9 +1081,6 @@ static MACHINE_CONFIG_START( aristmk5, aristmk5_state ) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(2)) /* 1.6 - 2 seconds */ -// MCFG_I2CMEM_ADD("i2cmem") -// MCFG_I2CMEM_PAGE_SIZE(NVRAM_PAGE_SIZE) -// MCFG_I2CMEM_DATA_SIZE(NVRAM_SIZE) /* TODO: this isn't supposed to access a keyboard ... */ MCFG_DEVICE_ADD("kart", AAKART, 12000000/128) // TODO: frequency @@ -941,6 +1127,8 @@ static MACHINE_CONFIG_START( aristmk5, aristmk5_state ) MCFG_DS1302_ADD("rtc", XTAL_32_768kHz) + MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW) + MCFG_SPEAKER_STANDARD_MONO("speaker") MCFG_SOUND_ADD("dac0", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(0, "speaker", 0.1) // unknown DAC MCFG_SOUND_ADD("dac1", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(0, "speaker", 0.1) // unknown DAC @@ -961,6 +1149,14 @@ static MACHINE_CONFIG_START( aristmk5, aristmk5_state ) MCFG_SOUND_ROUTE_EX(0, "dac7", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac7", -1.0, DAC_VREF_NEG_INPUT) MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( aristmk5_touch, aristmk5 ) + MCFG_DEVICE_MODIFY("uart_0a") + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx)) + + MCFG_MICROTOUCH_ADD("microtouch", 2400, DEVWRITELINE("uart_0a", ins8250_uart_device, rx_w)) +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( aristmk5_usa, aristmk5 ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(aristmk5_usa_map) @@ -1462,7 +1658,7 @@ ROM_END // 630 - 10 Credit Multiplier / 9 Line Multiline. -// The Chariot Challenge - NSW/ACT - A - 10/08/98. +// The Chariot Challenge - Venezuela - A - 10/08/98. // 04J00714 ROM_START( chariotc ) ARISTOCRAT_MK5_BIOS @@ -1825,6 +2021,24 @@ ROM_START( dolphntrb ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( dolphntrce ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("ahg1606.u7", 0x0000000, 0x0080000, CRC(d468edf7) SHA1(100672d09184e06130ce253749bd9e20ee0a06d4) ) + ROM_LOAD32_WORD("ahg1606.u11", 0x0000002, 0x0080000, CRC(0fe64635) SHA1(b504216e59984951b46701019f87cad759ab60f2) ) + ROM_LOAD32_WORD("ahg1606.u8", 0x0100000, 0x0080000, CRC(a53a2de4) SHA1(1741af795f88e867021f3c08d8990611d893a8e8) ) + ROM_LOAD32_WORD("ahg1606.u12", 0x0100002, 0x0080000, CRC(c2e268a2) SHA1(6aeb27ae844dbf495c64be210bcac97f4c7a6969) ) + ROM_LOAD32_WORD("ahg1606.u9", 0x0200000, 0x0080000, CRC(fe9146f7) SHA1(95bef8910d213d588d45ec2639828a31aab6603c) ) + ROM_LOAD32_WORD("ahg1606.u13", 0x0200002, 0x0080000, CRC(d6aa89fe) SHA1(eccb49d49f533aeed9fefb14018bcc06d3fdaf23) ) + ROM_LOAD32_WORD("ahg1606.u10", 0x0300000, 0x0080000, CRC(0be76189) SHA1(a458f620f48b9f4a73f59d31ba98864c5a64e1d7) ) + ROM_LOAD32_WORD("ahg1606.u14", 0x0300002, 0x0080000, CRC(c6c59ed6) SHA1(0ce8e5824c5937ffe2eeb34320db9dc568bca7cb) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + // 602/1 - 10 Credit Multiplier / 9 Line Multiline. // Dolphin Treasure - Export B - 06/12/96. @@ -1862,6 +2076,17 @@ ROM_START( dolphntru ) ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END +ROM_START( drgneye ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0100521v.u7", 0x0000000, 0x0080000, CRC(db9c952d) SHA1(4cbe3ffe6cf0bb112cb9a2d7a4ff0b28154d32c1) ) + ROM_LOAD32_WORD("0100521v.u11", 0x0000002, 0x0080000, CRC(2bb47749) SHA1(796f610e5202b5eb26a6e901d43ee5d9e3f95332) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END ROM_START( dynajack ) ARISTOCRAT_MK5_BIOS @@ -2113,6 +2338,24 @@ ROM_START( goldpyra ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( goldpyrb ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + // these are the 'bios' for Casino games (could be moved to a different base set) + ROM_LOAD32_WORD( "0700474v.u7", 0x000000, 0x80000, CRC(04b7dcbf) SHA1(eded1223336181bb08f9593247f1f79d96278b75) ) + ROM_LOAD32_WORD( "0700474v.u11", 0x000002, 0x80000, CRC(a89ce1b5) SHA1(411b474a111f23ebd834bea5af0bf0cf3926d590) ) + + ROM_LOAD32_WORD( "0100878v.u8", 0x100000, 0x80000, CRC(c3184f1c) SHA1(3f808b465175108d48ca5b2560e4546b30a7fd72) ) + ROM_LOAD32_WORD( "0100878v.u12", 0x100002, 0x80000, CRC(acb3de77) SHA1(e0e337d6efbd6ee8e0c0ec2653c3dc0bd5741ff4) ) + ROM_LOAD32_WORD( "0100878v.u9", 0x200000, 0x80000, CRC(0a2f6903) SHA1(11fd913f8c3a677ae07c7ec50548a82c1eaf63ee) ) + ROM_LOAD32_WORD( "0100878v.u13", 0x200002, 0x80000, CRC(0df660be) SHA1(73d370d90655dada34f2b5b2209652632c34a22e) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + ROM_START( goldenra ) ARISTOCRAT_MK5_BIOS @@ -2549,6 +2792,25 @@ ROM_START( marmagic ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( marmagicua ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD( "ehg1558.u7", 0x000000, 0x80000, CRC(7c2602ae) SHA1(f5a13154448041575e4bea1399ed0a5a0888d493) ) + ROM_LOAD32_WORD( "ehg1558.u11", 0x000002, 0x80000, CRC(4fe3b18a) SHA1(cc36eddd264de1a088c16e1b741168130d895bd7) ) + ROM_LOAD32_WORD( "ehg1558.u8", 0x100000, 0x80000, CRC(c9ff4bd8) SHA1(5766d7c39e753fb2a2412a41338dcfd4e31b642b) ) + ROM_LOAD32_WORD( "ehg1558.u12", 0x100002, 0x80000, CRC(d00cd217) SHA1(2be7c1ef6c0a39d1c7ed391feeaf0f42a6471bae) ) + ROM_LOAD32_WORD( "ehg1558.u9", 0x200000, 0x80000, CRC(879e4b14) SHA1(52d9540dd3ed51d42a31d1a7effe75e995e95330) ) + ROM_LOAD32_WORD( "ehg1558.u13", 0x200002, 0x80000, CRC(770872a1) SHA1(cd430385a3dfc080decfa2402d7dbad0db912e15) ) + ROM_LOAD32_WORD( "ehg1558.u10", 0x300000, 0x80000, CRC(4301eb40) SHA1(1a32c61df2ab04c365135378d97d18bbb0b50179) ) + ROM_LOAD32_WORD( "ehg1558.u14", 0x300002, 0x80000, CRC(a2096cb3) SHA1(c2bba35396f9c83b17d692a384b6406f3441c8f5) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + + // US003 - Multi credit / Multi line. // Margarita Magic [Reel Game] - NSW/ACT - A - 07/07/2000. @@ -2781,6 +3043,21 @@ ROM_START( pantmag ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( pantmaga ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0100716v.u7", 0x0000000, 0x0080000, CRC(8646a4a6) SHA1(1449ba497e4ccebf5de9630bfaf31ad3c583fc44) ) + ROM_LOAD32_WORD("0100716v.u11", 0x0000002, 0x0080000, CRC(61ae2a5a) SHA1(3b11c0f1c6e1464211e6dea958f08d7212ee5756) ) + ROM_LOAD32_WORD("0100716v.u8", 0x0100000, 0x0080000, CRC(91997f98) SHA1(2353abdc0b160cf087230f0c290f37f045a4d07b) ) + ROM_LOAD32_WORD("0100716v.u12", 0x0100002, 0x0080000, CRC(6adfd0ab) SHA1(3b6479bcd95812f5678a27adc7decbc881cd6caa) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + + // MV4115/6 - 9/20 Line Multiline Multiplier. // Party Gras [Reel Game] - Export A - 10/11/2001. @@ -2970,7 +3247,7 @@ ROM_START( pengpayu ) ROM_END -ROM_START( petshop ) +ROM_START( petshopa ) ARISTOCRAT_MK5_BIOS // checksum code not found (due to bad rom) ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) @@ -2984,6 +3261,51 @@ ROM_START( petshop ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( petshop ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0100731v.u7", 0x0000000, 0x0080000, CRC(01cffccc) SHA1(a39d943e700fff34d82bcff8c61f2586ee65e673) ) + ROM_LOAD32_WORD("0100731v.u11", 0x0000002, 0x0080000, CRC(a8e906c5) SHA1(f6dd7bcf5fa90933c9741699f0c1e07b685ccb40) ) + ROM_LOAD32_WORD("0100731v.u8", 0x0100000, 0x0080000, CRC(757e1296) SHA1(e14508bbaa3439a93c8b716267a2198ed3c54728) ) + ROM_LOAD32_WORD("0100731v.u12", 0x0100002, 0x0080000, CRC(6e74cd57) SHA1(9092e656cbd8627b208b81ca0d737483a779bce1) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( phantpay ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0500005v.u7", 0x0000000, 0x0080000, CRC(2cfc44a7) SHA1(a2a93047311d7a1f45e2915478ba2a11d5179194) ) + ROM_LOAD32_WORD("0500005v.u11", 0x0000002, 0x0080000, CRC(3e91ed2a) SHA1(92d49bd78d329ad53cb2063af2d324eada3f53d1) ) + ROM_LOAD32_WORD("0500005v.u8", 0x0100000, 0x0080000, CRC(ab1e77e9) SHA1(5a8da1210214ccc89dfde2e28f5142036a743172) ) + ROM_LOAD32_WORD("0500005v.u12", 0x0100002, 0x0080000, CRC(d43a092a) SHA1(5f851bd179b14ef3983b460ed932810f3713d3e5) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( penpir2 ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + // these are the 'bios' for Casino games (could be moved to a different base set) + ROM_LOAD32_WORD( "0700474v.u7", 0x000000, 0x80000, CRC(04b7dcbf) SHA1(eded1223336181bb08f9593247f1f79d96278b75) ) + ROM_LOAD32_WORD( "0700474v.u11", 0x000002, 0x80000, CRC(a89ce1b5) SHA1(411b474a111f23ebd834bea5af0bf0cf3926d590) ) + + ROM_LOAD32_WORD( "0100869v.u8", 0x100000, 0x80000, CRC(5a87f637) SHA1(0fee8140637e9f923727e8c358c9f59b8319855d) ) + ROM_LOAD32_WORD( "0100869v.u12", 0x100002, 0x80000, CRC(2aef04c1) SHA1(7415f436960c7b4a43634161ca317b2ae34ee745) ) + ROM_LOAD32_WORD( "0100869v.u9", 0x200000, 0x80000, CRC(05de2653) SHA1(7d3f9d50013d8137cef285940b04209cfdae4a1d) ) + ROM_LOAD32_WORD( "0100869v.u13", 0x200002, 0x80000, CRC(e1dbfd58) SHA1(687b7254279734e1835e1713d032b5aa2cf70812) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END ROM_START( przfight ) ARISTOCRAT_MK5_BIOS @@ -3183,6 +3505,20 @@ ROM_START( qnilemax ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END +ROM_START( qtbird ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0500009v.u7", 0x0000000, 0x0080000, CRC(f294fc0a) SHA1(f3d60ca6008445f535fce027f5ec3fe82ae552c3) ) + ROM_LOAD32_WORD("0500009v.u11", 0x0000002, 0x0080000, CRC(328b7e04) SHA1(5c49f60b7c88d6e94e7ab464fad4eee6806f327a) ) + ROM_LOAD32_WORD("0500009v.u8", 0x0100000, 0x0080000, CRC(764b5568) SHA1(a097992499044b7ca017a8c85387dc1ea94ff27a) ) + ROM_LOAD32_WORD("0500009v.u12", 0x0100002, 0x0080000, CRC(bb8344a9) SHA1(8b0e904b937c7f34470ad946076240b0c54bf434) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + ROM_START( rainwrce ) ARISTOCRAT_MK5_BIOS @@ -3329,7 +3665,7 @@ ROM_START( sbuk2 ) ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) ROM_LOAD32_WORD("0400501v.u7", 0x0000000, 0x0080000, CRC(f025775d) SHA1(71a94f6f17fa7cdcd997b0117b8f4afe21606a69) ) ROM_LOAD32_WORD("0400501v.u11", 0x0000002, 0x0080000, CRC(f1b51a61) SHA1(8e9fcb071f704122e13333094828a41974646792) ) - ROM_LOAD32_WORD("0400501v.u8", 0x0100000, 0x0080000, CRC(03912f4e) SHA1(48bdcd2160e05261b7d834c53e1d483acaad098f) ) + ROM_LOAD32_WORD("0400501v.u8", 0x0100000, 0x0080000, BAD_DUMP CRC(03912f4e) SHA1(48bdcd2160e05261b7d834c53e1d483acaad098f) ) // bit 0x20 is stuck on for most of the ROM ROM_LOAD32_WORD("0400501v.u12", 0x0100002, 0x0080000, CRC(f9b65d2b) SHA1(f519fc284aaa08d3619e4d88e92e690320cf5432) ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ @@ -3570,7 +3906,7 @@ ROM_START( unicorndnz ) ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) ROM_END -ROM_START( wamazon ) +ROM_START( wamazona ) ARISTOCRAT_MK5_BIOS /* Checksum code found at 0x000b68 @@ -3584,7 +3920,7 @@ ROM_START( wamazon ) ROM_LOAD32_WORD("0200285v.u7", 0x0000000, 0x0080000, CRC(bfa21358) SHA1(6b76656401b3dbbace8d4335951468b9885fc7f0) ) ROM_LOAD32_WORD("0200285v.u11", 0x0000002, 0x0080000, CRC(54b2a375) SHA1(635fde5c678b908fa58c0e04ba9b7a84fac1f7fe) ) ROM_LOAD32_WORD("0200285v.u8", 0x0100000, 0x0080000, CRC(4e39f128) SHA1(91d3c6a9e5c30275c3f8967dde55214df097f2ba) ) - ROM_LOAD32_WORD("0200285v.u12", 0x0100002, 0x0080000, CRC(2cd12986) SHA1(b6b0bd6dd8c964498edc3763cb5c450795042a8d) ) + ROM_LOAD32_WORD("0200285v.u12", 0x0100002, 0x0080000, BAD_DUMP CRC(2cd12986) SHA1(b6b0bd6dd8c964498edc3763cb5c450795042a8d) ) // actually a bad dump of u7 from oscara5! ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) @@ -3592,7 +3928,7 @@ ROM_START( wamazon ) ROM_END -ROM_START( wamazona ) +ROM_START( wamazon ) ARISTOCRAT_MK5_BIOS /* Checksum code found at 0x000b68 @@ -3710,6 +4046,33 @@ ROM_START( wcougaru ) ROM_LOAD( "rtc", 0x000000, 0x00001f, CRC(6909acb0) SHA1(6a4589599cd1c477e916474e7b029e9a4e92019b) ) ROM_END +ROM_START( wizways ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("0200396v.u7", 0x0000000, 0x0080000, CRC(85fca945) SHA1(ca48a907b4f6c1b665ae053e2992681f02166cb1) ) + ROM_LOAD32_WORD("0200396v.u11", 0x0000002, 0x0080000, CRC(677c855f) SHA1(a4ec8e6151271af292379ead28214ef9163bfdc3) ) + ROM_LOAD32_WORD("0200396v.u8", 0x0100000, 0x0080000, CRC(4b1192ae) SHA1(2537249ccfc8c507762ac2c46d05ef13fa3d0bf9) ) + ROM_LOAD32_WORD("0200396v.u12", 0x0100002, 0x0080000, CRC(934d7286) SHA1(205f72b62d83667e9068141346bda3bcb9742a83) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( wnpost ) + ARISTOCRAT_MK5_BIOS + + ROM_REGION( 0x400000, "game_prg", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD("rhg041804.u7", 0x0000000, 0x0080000, CRC(73274802) SHA1(9838a63d5f4e1bf31675ac15c34a17e709f2f647) ) + ROM_LOAD32_WORD("rhg041804.u11", 0x0000002, 0x0080000, CRC(4f076a94) SHA1(2962429c930ffc17e2f37a006215ee6f1c649953) ) + ROM_LOAD32_WORD("rhg041804.u8", 0x0100000, 0x0080000, CRC(b1830ffa) SHA1(c23a97bfdfe9e408f0ec8053646d6c8c8e06a263) ) + ROM_LOAD32_WORD("rhg041804.u12", 0x0100002, 0x0080000, CRC(ff70b305) SHA1(3c832ed20b1d00318fd3d2428bb469735f68965b) ) + + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) /* ARM Code */ + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x20000*4, "sram", ROMREGION_ERASE00 ) +ROM_END ROM_START( wthing ) ARISTOCRAT_MK5_BIOS @@ -3766,118 +4129,133 @@ GAME( 1995, aristmk5, 0, aristmk5, aristmk5, aristmk5_state, aristmk // Dates listed below are for the combination (reel layout), not release dates GAMEL( 1998, adonis, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Adonis (0200751V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/9, A - 25/05/98, Rev 10 GAMEL( 1998, adonisa, adonis, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Adonis (0100751V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/9, A - 25/05/98, Rev 9 -GAMEL( 2001, adonisu, adonis, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Adonis (BHG1508, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4124/1, B - 31/07/01 - BAD DUMP GAMEL( 1999, adonisce, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Adonis - Cash Express (0201005V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/9, C - 06/07/99 GAMEL( 1996, baddog, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Bad Dog Poker (0200428V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 386/56, A - 17/12/96 -GAMEL( 1996, blackpnt, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Black Panther (0200818V, Victoria)", MACHINE_FLAGS, layout_aristmk5 ) // 594/1, A - 30/07/96 GAMEL( 1998, bootsctn, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Boot Scootin' (0100812V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 616/1, B - 11/12/98 -GAMEL( 1999, bootsctnu, bootsctn, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Boot Scootin' (GHG1012-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4098, A - 25/08/99 - BAD DUMP GAMEL( 1996, bumblbug, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Bumble Bugs (0200510V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 593, D - 5/07/96 GAMEL( 1996, bumblbugql,bumblbug, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Bumble Bugs (0200456V, Queensland)", MACHINE_FLAGS, layout_aristmk5 ) // 593, D - 5/07/96 -GAMEL( 1997, bumblbugu, bumblbug, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Bumble Bugs (CHG0479-03, US)", MACHINE_FLAGS, layout_aristmk5 ) // 593, D - 05/07/97 - BAD DUMP GAMEL( 1995, buttdeli, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Butterfly Delight (0200143V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 571/4, A - 19/12/95 GAMEL( 1999, cashcat, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Cat (0300863V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4089, A - 4/1/99 GAMEL( 1997, cashcham, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Chameleon (0100438V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 603/1, C - 15/4/97 -GAMEL( 1996, cashchamu, cashcham, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Chameleon (DHG4078-99, US)", MACHINE_FLAGS, layout_aristmk5 ) // 603(a), B - 06/12/96 - BAD DUMP GAMEL( 1998, cashchama, cashcham, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Chameleon (0200437V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 603(a), D - 18/02/98 GAMEL( 1998, cashchamnz,cashcham, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Chameleon (0300781V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4067, A - 31/08/98 GAMEL( 1997, cashcra5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Crop (0300467V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 607, C - 14/07/97 -GAMEL( 1998, chariotc, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "The Chariot Challenge (04J00714, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 630, A - 10/08/98, Rev 12 +GAMEL( 1998, chariotc, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "The Chariot Challenge (04J00714, Venezuela)", MACHINE_FLAGS, layout_aristmk5 ) // 630, A - 10/08/98, Rev 12 GAMEL( 1998, chariotca, chariotc, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "The Chariot Challenge (0100787V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 630/1, A - 10/08/98 GAMEL( 2001, checkma5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Checkmate (01J00681, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB011, B - 06/07/01 GAMEL( 1996, chickna5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Chicken (0100351V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 596, A - 27/08/96 -GAMEL( 1998, chickna5u, chickna5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Chicken (RHG0730-03, US)", MACHINE_FLAGS, layout_aristmk5 ) // 596, C - 23/02/98 - BAD DUMP +GAMEL( 1998, chickna5u, chickna5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Chicken (RHG0730-03, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 596, C - 23/02/98 GAMEL( 1998, chickna5qld,chickna5,aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Chicken (0200530V, Queensland)", MACHINE_FLAGS, layout_aristmk5 ) // 596, C - 23/02/98 GAMEL( 1998, coralrc2, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Coral Riches II (0100919V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 577/7, A - 29/12/98 GAMEL( 1998, cuckoo, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cuckoo (0200753V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 615/1, D - 03/07/98 -GAMEL( 2000, cuckoou, cuckoo, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cuckoo (CHG1195, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4104, C - 02/02/00 +GAMEL( 2000, cuckoou, cuckoo, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cuckoo (CHG1195, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4104, C - 02/02/00 GAMEL( 1995, dstbloom, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Desert Bloom (0200111V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 577/2, A - 12/10/95 GAMEL( 1999, diamdove, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Diamond Dove (0101018V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 640, B - 19/05/99 -GAMEL( 1996, dmdfever, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Diamond Fever (0200302V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 483/7, E - 05/09/96 -GAMEL( 1997, dimtouch, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Diamond Touch (0400433V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 604, E - 30/06/97 +GAMEL( 1996, dmdfever, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Diamond Fever (0200302V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 483/7, E - 05/09/96 - jumps to service mode +GAMEL( 1997, dimtouch, aristmk5, aristmk5_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Diamond Touch (0400433V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 604, E - 30/06/97 GAMEL( 1996, dolphntr, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure (0200424V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/1, B - 06/12/96, Rev 3 GAMEL( 1996, dolphntra, dolphntr, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure (0100424V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/1, B - 06/12/96, Rev 1.24.4.0 GAMEL( 1996, dolphntrb, dolphntr, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure (0100388V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602, B - 10/12/96 -GAMEL( 1996, dolphntru, dolphntr, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure (FHG4077-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // 602/1, B - 06/12/96 +GAMEL( 1996, dolphntru, dolphntr, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure (FHG4077-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 602/1, B - 06/12/96 +GAMEL( 1999, dolphntrce,dolphntr, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dolphin Treasure - Cash Express (AHG1606, US)",MACHINE_FLAGS, layout_aristmk5_us ) // MV4090, D - 22/12/99 +GAMEL( 1997, drgneye, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dragon's Eye (0100521V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 610, A - 09/05/97 GAMEL( 2000, dynajack, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Dynamite Jack (01J00081, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB004, A - 12/07/2000 GAMEL( 1998, eldorda5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "El Dorado (0100652V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 623, B - 24/03/98 GAMEL( 1995, eforsta5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Enchanted Forest (0400122V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 570/3, E - 23/06/95 -GAMEL( 1997, eforsta5u, eforsta5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Enchanted Forest (JHG0415-03, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4033, B - 10/02/97 GAMEL( 2000, fortellr, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Fortune Teller (01J00131, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB006, D - 24/11/2000 -GAMEL( 1998, gambler, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "The Gambler (EHG0916-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4084/1, A - 30/10/98 - POSSIBLE BAD DUMP GAMEL( 2001, geisha, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Geisha (0101408V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4127, A - 05/03/01 -GAMEL( 1999, genmagi, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Genie Magic (0200894V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // ???, C - 15/02/99 +GAMEL( 1999, genmagi, aristmk5, aristmk5_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Genie Magic (0200894V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // ???, C - 15/02/99 GAMEL( 1998, gnomeatw, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Gnome Around The World (0100767V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 625, C - 18/12/98 -GAMEL( 1997, goldpyr, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Pyramids (AHG1205-03, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4091, B - 13/05/97 -GAMEL( 1997, goldpyra, goldpyr, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Pyramids (AHG1206-99, US)", MACHINE_FLAGS, layout_aristmk5 ) // 602/2, B - 13/05/97 - BAD DUMP +GAMEL( 1997, goldpyr, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Pyramids (AHG1205-03, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4091, B - 13/05/97 +GAMEL( 1998, goldpyrb, goldpyr, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Pyramids (0100878V, Victoria)", MACHINE_FLAGS, layout_aristmk5 ) // 602/5, C - 19/06/98 GAMEL( 2000, goldenra, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Ra (0101164V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 661, A - 10/04/00 GAMEL( 1999, incasun, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Inca Sun (0100872V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 631/3 B, B - 03/05/99 GAMEL( 1999, incasunsp, incasun, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Inca Sun (0100872V, NSW/ACT, Show Program)", MACHINE_FLAGS, layout_aristmk5 ) // 631/3 B, B - 03/05/99 GAMEL( 2000, incasunnz, incasun, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Inca Sun (0101108V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4113, A - 6/3/00 -GAMEL( 2000, incasunu, incasun, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Inca Sun (CHG1458, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4130/3, A - 05/09/00 +GAMEL( 2000, incasunu, incasun, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Inca Sun (CHG1458, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4130/3, A - 05/09/00 GAMEL( 1998, indrema5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Indian Dreaming (0100845V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 628/1, B - 15/12/98 GAMEL( 1996, jungjuic, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Jungle Juice (0200240V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // 566/3, F - 06/03/96 GAMEL( 1995, kgalah, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "King Galah (0200536V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 613/6, A - 21/07/95 -GAMEL( 2001, koalamnt, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Koala Mint (CHG1573, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4137, A - 12/09/01 - BAD DUMP GAMEL( 1998, kookabuk, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Kooka Bucks (0100677V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 661, A - 03/04/98 GAMEL( 1997, locoloot, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Loco Loot (0100472V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 599/2, C - 17/06/97 GAMEL( 1998, locolootnz,locoloot, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Loco Loot (0600725V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4064, A - 8/7/98 GAMEL( 1997, lonewolf, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Lone Wolf (0100587V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 621, A - 29/10/97 -GAMEL( 1997, mgarden, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Garden (AHG1211-99, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4033, B - 10/02/97 - BAD DUMP -GAMEL( 2000, magimask, aristmk5, aristmk5_usa_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Mask (DHG1309, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4115, A - 09/05/00 -GAMEL( 2000, magimaska, magimask, aristmk5_usa_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Mask (AHG1548, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4115, A - 09/05/00 -GAMEL( 1997, magtcha5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Touch (0200455V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 606, A - 06/03/97 +GAMEL( 2000, magimask, aristmk5, aristmk5_usa_touch, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Mask (DHG1309, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4115, A - 09/05/00 +GAMEL( 2000, magimaska, magimask, aristmk5_usa_touch, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Mask (AHG1548, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4115, A - 09/05/00 +GAMEL( 1997, magtcha5, aristmk5, aristmk5_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Touch (0200455V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 606, A - 06/03/97 GAMEL( 2000, marmagic, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Margarita Magic (01J00101, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB005, A - 07/07/00 -GAMEL( 2000, marmagicu, marmagic, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Margarita Magic (EHG1559, US)", MACHINE_FLAGS, layout_aristmk5 ) // US003, A - 07/07/00 - BAD DUMP -GAMEL( 1996, minemine, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Mine, Mine, Mine (VHG0416-99, US)", MACHINE_FLAGS, layout_aristmk5 ) // 559/2, E - 14/02/96 +GAMEL( 2000, marmagicua,marmagic, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Margarita Magic (EHG1558, US)", MACHINE_FLAGS, layout_aristmk5_us ) // US003, 07/07/2000 +GAMEL( 1996, minemine, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Mine, Mine, Mine (VHG0416-99, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 559/2, E - 14/02/96 GAMEL( 1997, monmouse, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Money Mouse (0400469V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 607/1, B - 08/04/97 GAMEL( 2001, montree, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Money Tree (0201397V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4126, C - 12/04/01 -GAMEL( 1996, mountmon, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Mountain Money (0100294V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) //595/3, B - 11/06/96 +GAMEL( 1996, mountmon, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Mountain Money (0100294V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 595/3, B - 11/06/96 GAMEL( 2000, multidrw, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Multidraw - Free Games (0200956V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 386/64, E - 08/05/00 GAMEL( 1996, mystgard, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Mystic Garden (0100275V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 595/1, B - 11/06/96 GAMEL( 1999, orchidms, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Orchid Mist (0200849V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 601/3, C - 03/02/99 GAMEL( 1996, oscara5, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Oscar (0200348V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 593/2, C - 20/09/96 GAMEL( 1999, pantmag, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Panther Magic (0101046V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 594/7, A - 06/10/99 -GAMEL( 2001, partygrs, aristmk5, aristmk5_usa_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Party Gras (AHG1567, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4115/6, A - 10/11/01 -GAMEL( 2001, partygrsa, partygrs, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Party Gras (BHG1284, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4115/3, B - 06/02/01 - BAD DUMP +GAMEL( 1999, pantmaga, pantmag, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Panther Magic (0100716V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 594/4, A - 13/05/98 +GAMEL( 2001, partygrs, aristmk5, aristmk5_usa_touch, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Party Gras (AHG1567, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4115/6, A - 10/11/01 GAMEL( 2000, peaflut, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Peacock Flutter (02J00011, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB001, A - 10/03/00 GAMEL( 1997, pengpay, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pays (0200460V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 586/4(a), D - 03/06/97 GAMEL( 1996, pengpaya, pengpay, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pays (0200357V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 586/4, C - 12/11/96 GAMEL( 1997, pengpayb, pengpay, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pays (0200359V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 586/3(a), D - 03/06/97 -GAMEL( 1997, pengpayu, pengpay, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pays (BHI0417-03, US)", MACHINE_FLAGS, layout_aristmk5 ) // 586/7(b) B - 14/07/97 -GAMEL( 1998, petshop, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Pet Shop (0100679V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 618, A - 09/03/98 - BAD DUMP +GAMEL( 1997, pengpayu, pengpay, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pays (BHI0417-03, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 586/7(b) B - 14/07/97 +GAMEL( 1998, petshop, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Pet Shop (0100731V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 618/1, A - 17/04/98 +GAMEL( 1995, phantpay, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Phantom Pays (0500005V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 570/1, E - 12/09/95 +GAMEL( 1998, penpir2, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Penguin Pirate II (0100869V, Victoria)", MACHINE_FLAGS, layout_aristmk5 ) // 619/3, A - 17/12/98 GAMEL( 1996, przfight, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Prize Fight (0100299V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 578/4, B - 08/08/96 GAMEL( 1998, qcash, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queens of Cash (0100706V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 603/6, C - 23/07/98 GAMEL( 1997, qnile, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (0100439V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/4, B - 13/05/97 GAMEL( 1997, qnilea, qnile, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (0300440V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/3, B - 13/05/97 GAMEL( 1997, qnileb, qnile, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (0200439V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/4, B - 13/05/97 GAMEL( 1997, qnilec, qnile, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (0300439V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/4, B - 13/05/97 -GAMEL( 1997, qnileu, qnile, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (GHG4091-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4091, B - 13/05/97 -GAMEL( 1999, qnilemax, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile - Maximillions (0401072V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/4, D - 18/06/99 +GAMEL( 1997, qnileu, qnile, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile (GHG4091-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4091, B - 13/05/97 +GAMEL( 1999, qnilemax, aristmk5, aristmk5_touch, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Queen of the Nile - Maximillions (0401072V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 602/4, D - 18/06/99 +GAMEL( 1994, qtbird, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Q.T. Bird (0500009V, NSW/ACT) ", MACHINE_FLAGS, layout_aristmk5 ) // 581, A - 27/10/94 GAMEL( 2000, rainwrce, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Rainbow Warriors - Cash Express (0101332V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 655, B - 02/03/00 GAMEL( 1998, reelrock, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Reelin-n-Rockin (0100779V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 628, A - 13/07/98 GAMEL( 1997, retrsam, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Return of the Samurai (0400549V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 608, A - 17/04/97 GAMEL( 1997, retrsama, retrsam, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Return of the Samurai (0200506V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 608, A - 17/04/97 GAMEL( 1997, retrsamb, retrsam, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Return of the Samurai (0200549V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 608, A - 17/04/97 GAMEL( 1997, sumospin, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Sumo Spins (0200606V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 622, A - 08/12/97 -GAMEL( 1999, sbuk2, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Super Bucks II (0400501V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 578, G - 26/07/99 GAMEL( 1998, sbuk3, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Super Bucks III (0200711V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 626, A - 22/04/98 GAMEL( 1995, swhr2, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Sweethearts II (0200004V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 577/1, C - 07/09/95 -GAMEL( 1998, swhr2u, swhr2, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Sweethearts II (PHG0742-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // MV4061, A - 29/06/98 - BAD DUMP GAMEL( 1995, swhr2v, swhr2, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Sweet Hearts II (01J01986, Venezuela)", MACHINE_FLAGS, layout_aristmk5 ) // 577/1, C - 07/09/95 -GAMEL( 199?, topbana, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Top Banana (0100550V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // BAD DUMP +GAMEL( 1997, topbana, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Top Banana (0100550V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 594/3, A - 18/08/97 GAMEL( 2000, trstrove, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Treasure Trove (01J00161, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB001/3, A - 5/10/00 GAMEL( 2002, tritreat, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Triple Treat (0201692V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 692, A - 17/05/02 GAMEL( 2001, trojhors, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Trojan Horse (01J00851, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // JB001/5, A - 30/10/01 -GAMEL( 1997, trpdlght, aristmk5, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Tropical Delight (PHG0625-02, US)", MACHINE_FLAGS, layout_aristmk5 ) // 577/3, D - 24/09/97 - BAD DUMP GAMEL( 1998, unicornd, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Unicorn Dreaming (0100791V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 631/1, A - 31/08/98 GAMEL( 2000, unicorndnz,unicornd, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Unicorn Dreaming (0101228V, New Zealand)", MACHINE_FLAGS, layout_aristmk5 ) // MV4113/1, A - 05/04/2000 -GAMEL( 1996, wamazon, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Amazon (0200285V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 506/6, A - 7/5/96 -GAMEL( 1996, wamazona, wamazon, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Amazon (0200507V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 506/8, A - 10/10/96 +GAMEL( 1996, wamazon, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Amazon (0200507V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 506/8, A - 10/10/96 GAMEL( 1996, wamazonv, wamazon, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Amazon (01J01996, Venezuela)", MACHINE_FLAGS, layout_aristmk5 ) // 506/8, A - 10/10/96 GAMEL( 1996, wildbill, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Bill (0100297V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 543/8, C - 15/08/96 GAMEL( 1996, wcougar, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Cougar (0100167V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 569/9, B - 27/2/96 -GAMEL( 1997, wcougaru, wcougar, aristmk5_usa, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Cougar (NHG0296-04, US)", MACHINE_FLAGS, layout_aristmk5 ) // 569/8, D - 19/05/97 +GAMEL( 1997, wcougaru, wcougar, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Cougar (NHG0296-04, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 569/8, D - 19/05/97 +GAMEL( 1996, wizways, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wizard Ways (0200396V, NSW/ACT) ", MACHINE_FLAGS, layout_aristmk5 ) // 598/3, A - 04/11/96 +GAMEL( 1997, wnpost, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Winning Post (RHG0418-04, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 541/2, G - 11/02/97 GAMEL( 1999, wthing, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Thing (0101158V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 608/4, B - 14/12/99 GAMEL( 1999, wtiger, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "White Tiger Classic (0200954V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 638/1, B - 08/07/99 +// the following might be bad dumps or need different hardware (unconfirmed) +GAMEL( 1996, blackpnt, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Black Panther (0200818V, Victoria)", MACHINE_FLAGS, layout_aristmk5 ) // 594/1, A - 30/07/96 - doesn't boot, 'needs VLC (Video Lottery Consultants) comms instead of QCOM' (or bad?) + +// the following parent sets are known bad dumps, and do not boot (confirmed) +GAMEL( 1998, gambler, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "The Gambler (EHG0916-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4084/1, A - 30/10/98 +GAMEL( 2001, koalamnt, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Koala Mint (CHG1573, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4137, A - 12/09/01 +GAMEL( 1997, mgarden, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Magic Garden (AHG1211-99, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4033, B - 10/02/97 +GAMEL( 1997, trpdlght, aristmk5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Tropical Delight (PHG0625-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 577/3, D - 24/09/97 +GAMEL( 1999, sbuk2, aristmk5, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Super Bucks II (0400501V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 578, G - 26/07/99 +// the following clone sets are known bad dumps, and do not boot (confirmed) +GAMEL( 2001, adonisu, adonis, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Adonis (BHG1508, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4124/1, B - 31/07/01 +GAMEL( 1999, bootsctnu, bootsctn, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Boot Scootin' (GHG1012-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4098, A - 25/08/99 +GAMEL( 1997, bumblbugu, bumblbug, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Bumble Bugs (CHG0479-03, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 593, D - 05/07/97 +GAMEL( 1996, cashchamu, cashcham, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Cash Chameleon (DHG4078-99, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 603(a), B - 06/12/96 +GAMEL( 1997, eforsta5u, eforsta5, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Enchanted Forest (JHG0415-03, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4033, B - 10/02/97 +GAMEL( 1997, goldpyra, goldpyr, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Golden Pyramids (AHG1206-99, US)", MACHINE_FLAGS, layout_aristmk5_us ) // 602/2, B - 13/05/97 +GAMEL( 2000, marmagicu, marmagic, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Margarita Magic (EHG1559, US)", MACHINE_FLAGS, layout_aristmk5_us ) // US003, A - 07/07/00 +GAMEL( 2001, partygrsa, partygrs, aristmk5_usa_touch, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Party Gras (BHG1284, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4115/3, B - 06/02/01 +GAMEL( 1998, petshopa, petshop, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Pet Shop (0100679V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 618, A - 09/03/98 +GAMEL( 1998, swhr2u, swhr2, aristmk5_usa, aristmk5_usa, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Sweethearts II (PHG0742-02, US)", MACHINE_FLAGS, layout_aristmk5_us ) // MV4061, A - 29/06/98 +GAMEL( 1996, wamazona, wamazon, aristmk5, aristmk5, aristmk5_state, aristmk5, ROT0, "Aristocrat", "Wild Amazon (0200285V, NSW/ACT)", MACHINE_FLAGS, layout_aristmk5 ) // 506/6, A - 7/5/96 diff --git a/src/mame/drivers/armedf.cpp b/src/mame/drivers/armedf.cpp index 51545f99ead..7de230d0770 100644 --- a/src/mame/drivers/armedf.cpp +++ b/src/mame/drivers/armedf.cpp @@ -338,7 +338,7 @@ Notes: ---- -x-- ---- ---- disable fg layer ---- --x- ---- ---- disable sprite ---- ---x ---- ---- disable tx layer - ---- ---- 1--1 ---- unknown + ---- ---- 1--1 ---- unknown ---- ---- ---- --x- coin counter 1 ---- ---- ---- ---x coin counter 0 */ @@ -1584,7 +1584,7 @@ static MACHINE_CONFIG_START( bigfghtr, bigfghtr_state ) MCFG_CPU_ADD("mcu", I8751, XTAL_16MHz/2) // verified MCFG_CPU_PROGRAM_MAP(bigfghtr_mcu_map) MCFG_CPU_IO_MAP(bigfghtr_mcu_io_map) - + MCFG_MACHINE_START_OVERRIDE(armedf_state,armedf) MCFG_MACHINE_RESET_OVERRIDE(armedf_state,armedf) diff --git a/src/mame/drivers/arsystems.cpp b/src/mame/drivers/arsystems.cpp index b9c3aeb92ce..25e81048373 100644 --- a/src/mame/drivers/arsystems.cpp +++ b/src/mame/drivers/arsystems.cpp @@ -312,11 +312,13 @@ static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) /* cia */ MCFG_DEVICE_ADD("cia_0", MOS8520, amiga_state::CLK_E_NTSC) diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index 574c420501e..08520d50cbd 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -323,7 +323,7 @@ static INPUT_PORTS_START( asteroid ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT ) PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) @@ -416,7 +416,7 @@ static INPUT_PORTS_START( asterock ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) @@ -457,7 +457,7 @@ static INPUT_PORTS_START( astdelux ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT ) PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) @@ -542,7 +542,7 @@ static INPUT_PORTS_START( llander ) /* Of the rest, Bit 6 is the 3KHz source. 3,4 and 5 are unknown */ PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") PORT_START("IN1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp index 85720b45726..278773aefa2 100644 --- a/src/mame/drivers/astrof.cpp +++ b/src/mame/drivers/astrof.cpp @@ -1196,20 +1196,20 @@ ROM_END /* Star Fighter (VGG) CPUs -QTY Type clock position function -1x R6502-13 2a 8-bit Microprocessor - main -1x TBA810 2f Audio Amplifier - sound -1x oscillator 10595 9c +QTY Type clock position function +1x R6502-13 2a 8-bit Microprocessor - main +1x TBA810 2f Audio Amplifier - sound +1x oscillator 10595 9c ROMs -QTY Type position status -6x TMS2716 0-5 dumped -1x MMI6341-1J 12c dumped +QTY Type position status +6x TMS2716 0-5 dumped +1x MMI6341-1J 12c dumped RAMs -QTY Type position -19x ITT4027 1-19 -2x 2114L3PC 5b,6b +QTY Type position +19x ITT4027 1-19 +2x 2114L3PC 5b,6b Others 1x 22x2 edge connector diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp index 77144702d7a..3c31e120919 100644 --- a/src/mame/drivers/asuka.cpp +++ b/src/mame/drivers/asuka.cpp @@ -1570,10 +1570,10 @@ ROM_END ROM_START( cadashi ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 512k for 68000 code */ - ROM_LOAD16_BYTE( "c21-14it", 0x00000, 0x20000, CRC(d1d9e613) SHA1(296c188daec962bdb4e78e20f1cc4c7d1f4dda09) ) /* need correct Taito ID #s for these roms */ - ROM_LOAD16_BYTE( "c21-16it", 0x00001, 0x20000, CRC(142256ef) SHA1(9ffc64d7c900bfa0300de9e6d18c7458f4c76ed7) ) /* ID numbers should be at least 26 or higher */ - ROM_LOAD16_BYTE( "c21-13it", 0x40000, 0x20000, CRC(c9cf6e30) SHA1(872c871cd60e0aa7149660277f67f90748d82743) ) - ROM_LOAD16_BYTE( "c21-17it", 0x40001, 0x20000, CRC(641fc9dd) SHA1(1497e39f6b250de39ef2785aaca7e68a803612fa) ) + ROM_LOAD16_BYTE( "c21_27-1.ic11", 0x00000, 0x20000, CRC(d1d9e613) SHA1(296c188daec962bdb4e78e20f1cc4c7d1f4dda09) ) + ROM_LOAD16_BYTE( "c21_29-1.ic15", 0x00001, 0x20000, CRC(142256ef) SHA1(9ffc64d7c900bfa0300de9e6d18c7458f4c76ed7) ) + ROM_LOAD16_BYTE( "c21_26-1.ic10", 0x40000, 0x20000, CRC(c9cf6e30) SHA1(872c871cd60e0aa7149660277f67f90748d82743) ) + ROM_LOAD16_BYTE( "c21_28-1.ic14", 0x40001, 0x20000, CRC(641fc9dd) SHA1(1497e39f6b250de39ef2785aaca7e68a803612fa) ) ROM_REGION( 0x80000, "gfx1", 0 ) ROM_LOAD( "c21-02.9", 0x00000, 0x80000, CRC(205883b9) SHA1(5aafee8cab3f949a7db91bcc26912f331041b51e) ) /* SCR tiles (8 x 8) */ diff --git a/src/mame/drivers/atarittl.cpp b/src/mame/drivers/atarittl.cpp index c414f7471b3..b63e10a6a70 100644 --- a/src/mame/drivers/atarittl.cpp +++ b/src/mame/drivers/atarittl.cpp @@ -57,9 +57,9 @@ netlist system per-game: TM-057 (Stunt Cycle) - 566 Voltage-Controlled Oscillator - 1N751A Zener Diode - 1N752A Zener Diode + 566 Voltage-Controlled Oscillator + 1N751A Zener Diode + 1N752A Zener Diode TM-055 (Indy 4) 7406 Hex Inverter Buffers/Drivers with O.C. H.V. Outputs (note: Might not be needed, could just clone from 7404) @@ -94,13 +94,13 @@ #define HRES_MULT (1) // end -#define SC_VIDCLOCK (14318181/2) -#define SC_HTOTAL (0x1C8+1) // 456 -#define SC_VTOTAL (0x103+1) // 259 -#define SC_HBSTART (SC_HTOTAL) -#define SC_HBEND (32) -#define SC_VBSTART (SC_VTOTAL) -#define SC_VBEND (8) +#define SC_VIDCLOCK (14318181/2) +#define SC_HTOTAL (0x1C8+1) // 456 +#define SC_VTOTAL (0x103+1) // 259 +#define SC_HBSTART (SC_HTOTAL) +#define SC_HBEND (32) +#define SC_VBSTART (SC_VTOTAL) +#define SC_VBEND (8) class atarikee_state : public driver_device { @@ -136,8 +136,6 @@ public: , m_maincpu(*this, "maincpu") //, m_video(*this, "fixfreq") , m_probe_screen(*this, "screen") - , m_hf1(*this, "maincpu:hf1") - , m_d7(*this, "maincpu:d7") , m_probe_bit0(0.0) , m_probe_bit1(0.0) , m_probe_bit2(0.0) @@ -174,8 +172,6 @@ private: required_device<netlist_mame_device_t> m_maincpu; //required_device<fixedfreq_device> m_video; required_device<screen_device> m_probe_screen; - required_device<netlist_mame_rom_t> m_hf1; - required_device<netlist_mame_rom_t> m_d7; int m_probe_bit0; int m_probe_bit1; @@ -184,7 +180,7 @@ private: int m_probe_bit4; int m_probe_bit5; int m_probe_bit6; - + std::unique_ptr<int[]> m_probe_data; int m_last_beam; @@ -331,9 +327,6 @@ static MACHINE_CONFIG_START( stuntcyc, stuntcyc_state ) MCFG_DEVICE_ADD("maincpu", NETLIST_CPU, STUNTCYC_NL_CLOCK) MCFG_NETLIST_SETUP(stuntcyc) - MCFG_NETLIST_ROM_REGION("maincpu", "hf1", "hf1", "004275.f1", 0x0000, 0x0200) - MCFG_NETLIST_ROM_REGION("maincpu", "d7", "d7", "004811.d7", 0x0000, 0x0020) - //MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "VIDEO_OUT", fixedfreq_device, update_vid, "fixfreq") MCFG_NETLIST_LOGIC_OUTPUT("maincpu", "probe_bit0", "probe_bit0", stuntcyc_state, probe_bit0_cb, "") MCFG_NETLIST_LOGIC_OUTPUT("maincpu", "probe_bit1", "probe_bit1", stuntcyc_state, probe_bit1_cb, "") @@ -495,10 +488,10 @@ ROM_END ROM_START( stuntcyc ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) - ROM_REGION( 0x0200, "hf1", ROMREGION_ERASE00 ) + ROM_REGION( 0x0200, "maincpu:004275.f1", ROMREGION_ERASE00 ) ROM_LOAD( "004275.f1", 0x0000, 0x0200, CRC(4ed5a99d) SHA1(1e5f439bce72e78dfff76fd8f61187c6ef484a64) ) // Motorcycle & Bus - ROM_REGION( 0x0020, "d7", ROMREGION_ERASE00 ) + ROM_REGION( 0x0020, "maincpu:004811.d7", ROMREGION_ERASE00 ) ROM_LOAD( "004811.d7", 0x0000, 0x0020, CRC(31a09efb) SHA1(fd5d538c9ec1234acf7c74ca0704113d220abbf6) ) // Score Translator ROM_END diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp index 4d27c17a824..ff03e937c58 100644 --- a/src/mame/drivers/atlantis.cpp +++ b/src/mame/drivers/atlantis.cpp @@ -232,7 +232,7 @@ WRITE32_MEMBER(atlantis_state::board_ctrl_w) break; case CTRL_VSYNC_CLEAR: //VSYNC_IE (0x1) - //VSYNC_POL (0x2) off=negative true, on=positive true + //VSYNC_POL (0x2) off=negative true, on=positive true // 0x1 VBlank clear? if (changeData & 0x1) { if ((data & 0x0001) == 0) { diff --git a/src/mame/drivers/atom.cpp b/src/mame/drivers/atom.cpp index cb412dc9cd8..9f9a2da2a5d 100644 --- a/src/mame/drivers/atom.cpp +++ b/src/mame/drivers/atom.cpp @@ -75,12 +75,12 @@ Hardware: PPIA 8255 The identity number of each station is set up in hardware by links to IC 8. IC 8 is an octal buffer which when enabled feeds the cards station ID to the computer bus. Each link codes a bit in an eight bit binary number allowing any station ID in the range 0 to 255 to be set up. if a link is left open then the bit is a one, when a link is made the bit is a zero. Hence all links open corresponds to station ID 255, and all links made to station ID 0. Each station must have a unique identity and - some indentities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is - reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a sugested + some identities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is + reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a suggested scheme for number allocation is to number normal user stations from one upwards and to number special stations and servers from 255 downwards. 2011 June 04 - Phill Harvey-Smith - Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory reigion causing the basic ROM to become + Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory region causing the basic ROM to become corrupted. Values are now correctly placed in bytes 0x0008 - 0x000B of RAM. @@ -90,10 +90,9 @@ Hardware: PPIA 8255 TODO: - - connect to softwarelist - e000 EPROM switching - display should be monochrome -- Should be optional, Acorn produced a Colour Card, and there is - at least one aftermarket Colour card. + at least one after market Colour card. - ram expansion - tap files - mouse @@ -287,17 +286,16 @@ static ADDRESS_MAP_START( atombb_mem, AS_PROGRAM, 8, atom_state ) ADDRESS_MAP_END /*------------------------------------------------- - ADDRESS_MAP( prophet2_mem ) + ADDRESS_MAP( prophet_mem ) -------------------------------------------------*/ -//static ADDRESS_MAP_START( prophet2_mem, AS_PROGRAM, 8, atom_state ) +//static ADDRESS_MAP_START( prophet_mem, AS_PROGRAM, 8, atom_state ) // AM_RANGE(0x0000, 0x09ff) AM_RAM // AM_RANGE(0x0a00, 0x7fff) AM_RAM // AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram") // AM_RANGE(0x9800, 0x9fff) AM_RAM +// AM_RANGE(0xa000, 0xafff) AM_ROM AM_REGION("ic24", 0) // AM_RANGE(0xb000, 0xb003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write) -//// AM_RANGE(0xb400, 0xb403) AM_DEVREADWRITE(MC6854_TAG, mc6854_device, read, write) -//// AM_RANGE(0xb404, 0xb404) AM_READ_PORT("ECONET") // AM_RANGE(0xb800, 0xb80f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write) // AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) //ADDRESS_MAP_END @@ -603,7 +601,7 @@ WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback ) WRITE_LINE_MEMBER( atom_state::motor_w ) { for (int i=0; i != 2; i++) { - char devname[1]; + char devname[8]; sprintf(devname, "%d", i); floppy_connector *con = m_fdc->subdevice<floppy_connector>(devname); if (con) { @@ -681,7 +679,7 @@ image_init_result atom_state::load_cart(device_image_interface &image, generic_s if (size > 0x1000) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size"); return image_init_result::FAIL; } @@ -754,7 +752,7 @@ static MACHINE_CONFIG_START( atom, atom_state ) MCFG_QUICKLOAD_ADD("quickload", atom_state, atom_atm, "atm", 0) - /* cartridge */ + /* utility rom slot */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "atom_cart") MCFG_GENERIC_EXTENSIONS("bin,rom") MCFG_GENERIC_LOAD(atom_state, cart_load) @@ -867,14 +865,19 @@ MACHINE_CONFIG_END //static MACHINE_CONFIG_DERIVED( prophet2, atom ) // /* basic machine hardware */ // MCFG_CPU_MODIFY(SY6502_TAG) -// MCFG_CPU_PROGRAM_MAP(prophet2_mem) +// MCFG_CPU_PROGRAM_MAP(prophet_mem) // // /* fdc */ // MCFG_DEVICE_REMOVE(I8271_TAG) // MCFG_DEVICE_REMOVE(I8271_TAG ":0") // MCFG_DEVICE_REMOVE(I8271_TAG ":1") // +// /* internal ram */ +// MCFG_RAM_MODIFY(RAM_TAG) +// MCFG_RAM_DEFAULT_SIZE("32K") + // /* Software lists */ +// MCFG_SOFTWARE_LIST_REMOVE("rom_list") // MCFG_SOFTWARE_LIST_REMOVE("flop_list") //MACHINE_CONFIG_END @@ -883,7 +886,16 @@ MACHINE_CONFIG_END -------------------------------------------------*/ //static MACHINE_CONFIG_DERIVED( prophet3, atom ) +// /* basic machine hardware */ +// MCFG_CPU_MODIFY(SY6502_TAG) +// MCFG_CPU_PROGRAM_MAP(prophet_mem) // +// /* internal ram */ +// MCFG_RAM_MODIFY(RAM_TAG) +// MCFG_RAM_DEFAULT_SIZE("32K") + +// /* Software lists */ +// MCFG_SOFTWARE_LIST_REMOVE("rom_list") //MACHINE_CONFIG_END /*------------------------------------------------- diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index 8172815e861..48571180652 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -261,7 +261,7 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma } else bitmap.fill(0); - + // Text output for(y=0;y<(bitmap.height()-1)/10;y++) // lines { diff --git a/src/mame/drivers/atvtrack.cpp b/src/mame/drivers/atvtrack.cpp index 914ea4ac667..8d624e22ebc 100644 --- a/src/mame/drivers/atvtrack.cpp +++ b/src/mame/drivers/atvtrack.cpp @@ -85,9 +85,9 @@ write - enable slave CPU, gpu, etc most of bits is unclear SH4 XTAL is 33MHz, SH4 MD0-2 pins is 001 or 011 (CPU core clk = XTAL*6, preipheral clk = XTAL, bus clk is XTAL or XTAL*2) TODO: - devicify NAND - somehow hook PVR2 renderer here - add sound + devicify NAND + somehow hook PVR2 renderer here + add sound */ @@ -206,9 +206,9 @@ WRITE64_MEMBER(atvtrack_state::control_w) else m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } -// logerror("Write %08x at %08x ",dat, 0x20000+addr*4+0); -// logbinary(dat); -// logerror("\n"); +// logerror("Write %08x at %08x ",dat, 0x20000+addr*4+0); +// logbinary(dat); +// logerror("\n"); } READ64_MEMBER(atvtrack_state::nand_data_r) @@ -319,7 +319,7 @@ WRITE32_MEMBER(atvtrack_state::gpu_w) { case 0x00/4: // not really required, game code will go even if GPU CPU shows no signs of live - if (data) // internal CPU start ? + if (data) // internal CPU start ? m_subcpu->space(AS_PROGRAM).write_byte(0x18001350, 1); // simulate GPUs internal CPU reply to skip busy loop break; case 0x70/4: @@ -369,7 +369,7 @@ WRITE64_MEMBER(atvtrack_state::ioport_w) // bit 7 IO - data bit *1 always 1 / set to 30 during slave CPU test, then to 10 // bit 6 IO - data bit Test ADC CS, ~DAC CS unused // bit 5 IO - data bit Down ADC CLK, ~DAC CLK unused - // bit 4 IO - data bit Service DAC data JP6 lamp + // bit 4 IO - data bit Service DAC data JP6 lamp // bit 3 IO - data bit Up ADC data JP5 coin counter // bit 2 I - unk, (SD: 1 = FPGA ready after config) // bit 1 O - data bits operation direction: 0 - output, 1 - input (SD: FPGA config data) @@ -389,9 +389,9 @@ WRITE64_MEMBER(atvtrack_state::ioport_w) if (data & 0x0100) m_slaverun = true; } -// logerror("SH4 16bit i/o port write "); -// logbinary((uint32_t)data,15,0); -// logerror("\n"); +// logerror("SH4 16bit i/o port write "); +// logbinary((uint32_t)data,15,0); +// logerror("\n"); } #ifdef SPECIALMODE if (offset == SH4_IOPORT_DMA/8) { @@ -424,7 +424,7 @@ uint32_t atvtrack_state::screen_update_atvtrack(screen_device &screen, bitmap_rg void get_altera10ke_eab(u8* dst, u8 *pof, int eab) { // extract Altera FLEX 10KE 4kbit Embedded Array Block (EAB) - u32 startbit = 0x45b * 8 + 1 + (0x25e6 * 8) * eab; // base ofsset actually depends on POF header size, however this EPC1PC8 dump havent it (bad dumper software?) + u32 startbit = 0x45b * 8 + 1 + (0x25e6 * 8) * eab; // base ofsset actually depends on POF header size, however this EPC1PC8 dump havent it (bad dumper software?) for (u32 bit = 0; bit < 4096; bit++) { diff --git a/src/mame/drivers/avt.cpp b/src/mame/drivers/avt.cpp index 59e34ebaa5a..061ba6e77ee 100644 --- a/src/mame/drivers/avt.cpp +++ b/src/mame/drivers/avt.cpp @@ -405,9 +405,9 @@ ************************************************************************************************/ -#define MASTER_CLOCK XTAL_10MHz /* unknown */ +#define MASTER_CLOCK XTAL_16MHz /* unknown */ #define CPU_CLOCK MASTER_CLOCK/4 /* guess... seems accurate */ -#define CRTC_CLOCK MASTER_CLOCK/16 /* it gives 59.410646 fps with current settings */ +#define CRTC_CLOCK MASTER_CLOCK/24 /* it gives 63.371293 Hz. with current settings */ #include "emu.h" #include "cpu/z80/z80.h" @@ -519,14 +519,14 @@ uint32_t avt_state::screen_update_avt(screen_device &screen, bitmap_ind16 &bitma count = 0; - for(y=0;y<mc6845_v_display;y++) + for(y = 0; y < mc6845_v_display; y++) { - for(x=0;x<mc6845_h_display;x++) + for(x = 0; x < mc6845_h_display; x++) { uint16_t tile = m_videoram[count] | ((m_colorram[count] & 1) << 8); uint8_t color = (m_colorram[count] & 0xf0) >> 4; - gfx->opaque(bitmap,cliprect,tile,color,0,0,x*8,(y*8)); + gfx->opaque(bitmap, cliprect, tile,color, 0, 0, x * 8, y * 8); count++; } @@ -597,6 +597,8 @@ PALETTE_INIT_MEMBER(avt_state, avt) // popmessage("written : %02X", data); //} +// [:crtc] M6845: Mode Control 10 is not supported!!! + WRITE8_MEMBER( avt_state::avt_6845_address_w ) { m_crtc_index = data; @@ -631,9 +633,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( avt_portmap, AS_IO, 8, avt_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) // AM_RANGE(0x00, 0x03) unk, maybe IO -// AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") +// AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW1") // AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") - AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1") + AM_RANGE(0x02, 0x02) AM_READ_PORT("IN0") // AM_RANGE(0x08, 0x0b) unk, maybe IO // AM_RANGE(0x08, 0x08) AM_READ_PORT("IN2") // AM_RANGE(0x09, 0x09) AM_READ_PORT("IN3") @@ -644,13 +646,67 @@ static ADDRESS_MAP_START( avt_portmap, AS_IO, 8, avt_state ) ADDRESS_MAP_END /* I/O byte R/W + (from avtbingo) + + inputs are throusg port 02h, masked with 0x3F & 0x40. + + 02C3: DB 02 in a,($02) + 02C5: 2F cpl + 02C6: E6 3F and $3F + 02C8: C9 ret + + 02D1: DB 02 in a,($02) + 02D3: 2F cpl + 02D4: E6 3F and $3F + 02D6: CD B2 02 call $02B2 + 02D9: C9 ret + + 0338: DB 02 in a,($02) --> poll IN0 + 033A: E6 40 and $40 ------> check for IN0-7 if active. + 033C: 28 02 jr z,$0340 --> to continue the program. + 033E: AF xor a + 033F: C9 ret + .... + 1ACB: B7 or a + 1ACC: 28 03 jr z,$1AD1 --> to continue the program. + 1ACE: CD B6 2D call $2DB6 ----> nothing there!!! + + + poll the port 00h and compare with 0x03 + + 1379: 0E 00 ld c,$00 + 137B: ED 78 in a,(c) + 137D: FE 03 cp $03 + 137F: 20 04 jr nz,$1385 + ...code continues... - ----------------- + ----------------- - unknown writes: + unknown writes: + [:maincpu] ':maincpu' (01D4): unmapped io memory write to 0001 = 0F & FF + [:maincpu] ':maincpu' (01D8): unmapped io memory write to 0009 = 4F & FF + [:maincpu] ':maincpu' (01DC): unmapped io memory write to 000B = CF & FF + [:maincpu] ':maincpu' (01E0): unmapped io memory write to 000B = C0 & FF + [:maincpu] ':maincpu' (01E4): unmapped io memory write to 000A = C0 & FF \ + [:maincpu] ':maincpu' (02CD): unmapped io memory write to 000A = EE & FF \ + [:maincpu] ':maincpu' (030E): unmapped io memory write to 000A = C0 & FF > Alternate these values too often... Mux selector? + [:maincpu] ':maincpu' (02CD): unmapped io memory write to 000A = EE & FF / + [:maincpu] ':maincpu' (030E): unmapped io memory write to 000A = C0 & FF / + + [:maincpu] ':maincpu' (0321): unmapped io memory write to 0003 = 06 & FF \ + [:maincpu] ':maincpu' (0325): unmapped io memory write to 0003 = CF & FF \ + [:maincpu] ':maincpu' (0329): unmapped io memory write to 0003 = FF & FF > Unknown commands. + [:maincpu] ':maincpu' (032D): unmapped io memory write to 0003 = 97 & FF / + [:maincpu] ':maincpu' (0331): unmapped io memory write to 0003 = F7 & FF / + + [:maincpu] ':maincpu' (0335): unmapped io memory write to 000A = C0 & FF \ + [:maincpu] ':maincpu' (02CD): unmapped io memory write to 000A = EE & FF \ + [:maincpu] ':maincpu' (030E): unmapped io memory write to 000A = C0 & FF > Same as above... + [:maincpu] ':maincpu' (02CD): unmapped io memory write to 000A = EE & FF / + [:maincpu] ':maincpu' (030E): unmapped io memory write to 000A = C0 & FF / avtnfl and avtbingo have similarities. @@ -659,7 +715,6 @@ ADDRESS_MAP_END all access a000/c000 with an offset of 0x800 for video. avtnfl and avtbingo use 28/29 for CRTC. - */ /********************************************* @@ -823,6 +878,20 @@ static INPUT_PORTS_START( symbols ) INPUT_PORTS_END +static INPUT_PORTS_START( avtbingo ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Column 3 UP") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Column 2 UP") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Column 1 UP") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Column 5 UP") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Column 4 UP") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7) PORT_NAME("IN0-7") // Used. Masked 0x40. See code at PC=0338. + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + + /********************************************* * Graphics Layouts * *********************************************/ @@ -960,8 +1029,8 @@ ROM_END * Game Drivers * *********************************************/ -/* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ -GAME( 1985, avtsym14, 0, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "Symbols (ver 1.4)", MACHINE_NOT_WORKING ) -GAME( 1985, avtsym25, avtsym14, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "Symbols (ver 2.5)", MACHINE_NOT_WORKING ) -GAME( 1985, avtbingo, 0, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "Arrow Bingo", MACHINE_NOT_WORKING ) -GAME( 1989, avtnfl, 0, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "NFL (ver 109)", MACHINE_NOT_WORKING ) +/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */ +GAME( 1985, avtsym14, 0, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "Symbols (ver 1.4)", MACHINE_NOT_WORKING ) +GAME( 1985, avtsym25, avtsym14, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "Symbols (ver 2.5)", MACHINE_NOT_WORKING ) +GAME( 1985, avtbingo, 0, avt, avtbingo, driver_device, 0, ROT0, "Advanced Video Technology", "Arrow Bingo", MACHINE_NOT_WORKING ) +GAME( 1989, avtnfl, 0, avt, symbols, driver_device, 0, ROT0, "Advanced Video Technology", "NFL (ver 109)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/aztarac.cpp b/src/mame/drivers/aztarac.cpp index dcdda3ae0cf..56de6ca3405 100644 --- a/src/mame/drivers/aztarac.cpp +++ b/src/mame/drivers/aztarac.cpp @@ -198,22 +198,27 @@ MACHINE_CONFIG_END ROM_START( aztarac ) ROM_REGION( 0xc000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "l8_6.bin", 0x000000, 0x001000, CRC(25f8da18) SHA1(e8179ba3683e39c8225b549ead74c8af2d0a0b3e) ) - ROM_LOAD16_BYTE( "n8_0.bin", 0x000001, 0x001000, CRC(04e20626) SHA1(2b6a04992037257830df2c01a6da748fb4449f79) ) - ROM_LOAD16_BYTE( "l7_7.bin", 0x002000, 0x001000, CRC(230e244c) SHA1(42283a368144acf2aad2ef390e312e0951c3ea64) ) - ROM_LOAD16_BYTE( "n7_1.bin", 0x002001, 0x001000, CRC(37b12697) SHA1(da288b077902e3205600a021c3fac5730f9fb832) ) - ROM_LOAD16_BYTE( "l6_8.bin", 0x004000, 0x001000, CRC(1293fb9d) SHA1(5a8d512372fd38f1a55f990f5c3eb51833c463d8) ) - ROM_LOAD16_BYTE( "n6_2.bin", 0x004001, 0x001000, CRC(712c206a) SHA1(eb29f161189c14d84896502940e3ab6cc3bd1cd0) ) - ROM_LOAD16_BYTE( "l5_9.bin", 0x006000, 0x001000, CRC(743a6501) SHA1(da83a8f756466bcd94d4b0cc28a1a1858e9532f3) ) - ROM_LOAD16_BYTE( "n5_3.bin", 0x006001, 0x001000, CRC(a65cbf99) SHA1(dd06f98c0989604bd4ac6317e545e1fcf6722e75) ) - ROM_LOAD16_BYTE( "l4_a.bin", 0x008000, 0x001000, CRC(9cf1b0a1) SHA1(dd644026f49d8430c0b4cf4c750dc33c013c19fc) ) - ROM_LOAD16_BYTE( "n4_4.bin", 0x008001, 0x001000, CRC(5f0080d5) SHA1(fb1303f9a02067faea2ac4d523051c416de9cf35) ) - ROM_LOAD16_BYTE( "l3_b.bin", 0x00a000, 0x001000, CRC(8cc7f7fa) SHA1(fefb9a4fdd63878bc5d8138e3e8456cb6638425a) ) - ROM_LOAD16_BYTE( "n3_5.bin", 0x00a001, 0x001000, CRC(40452376) SHA1(1d058b7ecd2bbff3393950aab9215b262908475b) ) + ROM_LOAD16_BYTE( "6.l8", 0x000000, 0x001000, CRC(25f8da18) SHA1(e8179ba3683e39c8225b549ead74c8af2d0a0b3e) ) + ROM_LOAD16_BYTE( "0.n8", 0x000001, 0x001000, CRC(04e20626) SHA1(2b6a04992037257830df2c01a6da748fb4449f79) ) + ROM_LOAD16_BYTE( "7.l7", 0x002000, 0x001000, CRC(230e244c) SHA1(42283a368144acf2aad2ef390e312e0951c3ea64) ) + ROM_LOAD16_BYTE( "1.n7", 0x002001, 0x001000, CRC(37b12697) SHA1(da288b077902e3205600a021c3fac5730f9fb832) ) + ROM_LOAD16_BYTE( "8.l6", 0x004000, 0x001000, CRC(1293fb9d) SHA1(5a8d512372fd38f1a55f990f5c3eb51833c463d8) ) + ROM_LOAD16_BYTE( "2.n6", 0x004001, 0x001000, CRC(712c206a) SHA1(eb29f161189c14d84896502940e3ab6cc3bd1cd0) ) + ROM_LOAD16_BYTE( "9.l5", 0x006000, 0x001000, CRC(743a6501) SHA1(da83a8f756466bcd94d4b0cc28a1a1858e9532f3) ) + ROM_LOAD16_BYTE( "3.n5", 0x006001, 0x001000, CRC(a65cbf99) SHA1(dd06f98c0989604bd4ac6317e545e1fcf6722e75) ) + ROM_LOAD16_BYTE( "a.l4", 0x008000, 0x001000, CRC(9cf1b0a1) SHA1(dd644026f49d8430c0b4cf4c750dc33c013c19fc) ) + ROM_LOAD16_BYTE( "4.n4", 0x008001, 0x001000, CRC(5f0080d5) SHA1(fb1303f9a02067faea2ac4d523051c416de9cf35) ) + ROM_LOAD16_BYTE( "b.l3", 0x00a000, 0x001000, CRC(8cc7f7fa) SHA1(fefb9a4fdd63878bc5d8138e3e8456cb6638425a) ) + ROM_LOAD16_BYTE( "5.n3", 0x00a001, 0x001000, CRC(40452376) SHA1(1d058b7ecd2bbff3393950aab9215b262908475b) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "j4_c.bin", 0x0000, 0x1000, CRC(e897dfcd) SHA1(750df3d08512d8098a13ec62677831efa164c126) ) - ROM_LOAD( "j3_d.bin", 0x1000, 0x1000, CRC(4016de77) SHA1(7232ec003f1b9d3623d762f3270108a1d1837846) ) + ROM_LOAD( "c.j4", 0x0000, 0x1000, CRC(e897dfcd) SHA1(750df3d08512d8098a13ec62677831efa164c126) ) + ROM_LOAD( "d.j3", 0x1000, 0x1000, CRC(4016de77) SHA1(7232ec003f1b9d3623d762f3270108a1d1837846) ) + + ROM_REGION( 0x3000, "proms", 0 ) /* not hooked up */ + ROM_LOAD( "l5.l5", 0x0000, 0x0020, CRC(317fb438) SHA1(3130e1dbde06228707ba46ae85d8df8cc8f32b67) ) + ROM_LOAD( "k8.k8", 0x0000, 0x1000, CRC(596ad8d9) SHA1(7e2d2d3e02712911ef5ef55d1df5740f6ec28bcb) ) + ROM_LOAD( "k9.k9", 0x0000, 0x1000, CRC(b8544823) SHA1(78ff1fcb7e640929765533592015cfccef690179) ) ROM_END diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp index fc5ff1f7d10..8c84a56b31b 100644 --- a/src/mame/drivers/bublbobl.cpp +++ b/src/mame/drivers/bublbobl.cpp @@ -804,7 +804,7 @@ static MACHINE_CONFIG_START( tokio, bublbobl_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( tokiob, tokio ) - + MCFG_DEVICE_REMOVE("maincpu") MCFG_DEVICE_REMOVE("bmcu") diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp index 3eb06741e9e..e9d7c1c4629 100644 --- a/src/mame/drivers/bwidow.cpp +++ b/src/mame/drivers/bwidow.cpp @@ -447,7 +447,7 @@ static INPUT_PORTS_START( bwidow ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") /* bit 6 is the VG HALT bit. We set it to "low" */ /* per default (busy vector processor). */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) @@ -525,7 +525,7 @@ static INPUT_PORTS_START( gravitar ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") /* bit 6 is the VG HALT bit. We set it to "low" */ /* per default (busy vector processor). */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) @@ -633,7 +633,7 @@ static INPUT_PORTS_START( spacduel ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") /* bit 6 is the VG HALT bit. We set it to "low" */ /* per default (busy vector processor). */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr) diff --git a/src/mame/drivers/bzone.cpp b/src/mame/drivers/bzone.cpp index f95bf75f3d7..2da43382822 100644 --- a/src/mame/drivers/bzone.cpp +++ b/src/mame/drivers/bzone.cpp @@ -355,7 +355,7 @@ ADDRESS_MAP_END PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )\ PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )\ PORT_SERVICE( 0x10, IP_ACTIVE_LOW )\ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)\ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") \ /* bit 6 is the VG HALT bit. We set it to "low" */\ /* per default (busy vector processor). */\ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_bzone_device, done_r, nullptr)\ diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index d17b7ffca90..e6b97398ebd 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -108,21 +108,21 @@ public: memory_region *m_cart_rom; - uint8_t m_bus_control; - uint8_t m_power; - uint8_t m_banks; - uint8_t m_clock_control; - uint8_t m_clock_divider; - uint8_t m_key_select; - - std::unique_ptr<uint8_t[]> m_sysram[2]; - uint16_t m_sysram_size[2]; - uint16_t m_sysram_end[2]; - uint16_t m_sysram_mask[2]; + u8 m_bus_control; + u8 m_power; + u8 m_banks; + u8 m_clock_control; + u8 m_clock_divider; + u8 m_key_select; + + std::unique_ptr<u8[]> m_sysram[2]; + u16 m_sysram_size[2]; + u16 m_sysram_end[2]; + u16 m_sysram_mask[2]; void postload(); - void init_sysram(int chip, uint16_t size); - void update_lcd_indicator(uint8_t y, uint8_t x, int state); + void init_sysram(int chip, u16 size); + void update_lcd_indicator(u8 y, u8 x, int state); void update_clock_divider(); DECLARE_READ8_MEMBER(sysram_r); @@ -156,7 +156,7 @@ public: DEVICE_IMAGE_LOAD_MEMBER(cc40_state, cc40_cartridge) { - uint32_t size = m_cart->common_get_size("rom"); + u32 size = m_cart->common_get_size("rom"); // max size is 4*32KB if (size > 0x20000) @@ -186,7 +186,7 @@ PALETTE_INIT_MEMBER(cc40_state, cc40) palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off } -void cc40_state::update_lcd_indicator(uint8_t y, uint8_t x, int state) +void cc40_state::update_lcd_indicator(u8 y, u8 x, int state) { // reference _________________... // output# |10 11 12 13 14 0 1 2 3 4 @@ -336,7 +336,7 @@ WRITE8_MEMBER(cc40_state::clock_control_w) READ8_MEMBER(cc40_state::keyboard_r) { - uint8_t ret = 0; + u8 ret = 0; // read selected keyboard rows for (int i = 0; i < 8; i++) @@ -510,12 +510,12 @@ void cc40_state::machine_reset() bankswitch_w(space, 0, 0); } -void cc40_state::init_sysram(int chip, uint16_t size) +void cc40_state::init_sysram(int chip, u16 size) { if (m_sysram[chip] == nullptr) { // init to largest possible - m_sysram[chip] = std::make_unique<uint8_t[]>(0x2000); + m_sysram[chip] = std::make_unique<u8[]>(0x2000); save_pointer(NAME(m_sysram[chip].get()), 0x2000, chip); save_item(NAME(m_sysram_size[chip]), chip); diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp index 79d17c18954..65f4aca72f1 100644 --- a/src/mame/drivers/cclimber.cpp +++ b/src/mame/drivers/cclimber.cpp @@ -308,6 +308,13 @@ WRITE8_MEMBER(cclimber_state::nmi_mask_w) } +READ8_MEMBER(cclimber_state::bagmanf_a000_r) +{ + // Should this actually use the same PAL16R6 as the parent set? + return 0x3f; +} + + /* Note that River Patrol reads/writes to a000-a4f0. This is a bug in the code. The instruction at 0x0593 should say LD DE,$8000 */ @@ -436,22 +443,23 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bagmanf_map, AS_PROGRAM, 8, cclimber_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6bff) AM_RAM /* Crazy Kong only */ - AM_RANGE(0x8000, 0x83ff) AM_RAM - AM_RANGE(0x8800, 0x88ff) AM_RAM AM_SHARE("bigspriteram") + AM_RANGE(0x8000, 0x8000) AM_READ_PORT("P1") + AM_RANGE(0x8800, 0x8800) AM_READ_PORT("P2") + AM_RANGE(0x8800, 0x88ff) AM_RAM AM_SHARE("bigspriteram") // wrong AM_RANGE(0x8900, 0x8bff) AM_RAM /* not used, but initialized */ AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("videoram") AM_RANGE(0xffe0, 0xffff) AM_RAM AM_SHARE("column_scroll") // wrong, is this area even connected? + AM_RANGE(0x9800, 0x9800) AM_READ_PORT("SYSTEM") AM_RANGE(0x9800, 0x981f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x98dc, 0x98df) AM_RAM AM_SHARE("bigspritectrl") // wrong AM_RANGE(0x9800, 0x9bff) AM_RAM AM_SHARE("colorram") AM_RANGE(0x9c00, 0x9fff) AM_RAM /* not used, but initialized */ - AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1") AM_WRITE(nmi_mask_w) + AM_RANGE(0xa000, 0xa000) AM_READ(bagmanf_a000_r) AM_WRITE(nmi_mask_w) AM_RANGE(0xa001, 0xa002) AM_WRITEONLY AM_SHARE("flip_screen") AM_RANGE(0xa004, 0xa004) AM_DEVWRITE("cclimber_audio", cclimber_audio_device, sample_trigger_w) - - AM_RANGE(0xa800, 0xa800) AM_READ_PORT("P2") AM_DEVWRITE("cclimber_audio", cclimber_audio_device, sample_rate_w) + AM_RANGE(0xa800, 0xa800) AM_READNOP AM_DEVWRITE("cclimber_audio", cclimber_audio_device, sample_rate_w) AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW") AM_DEVWRITE("cclimber_audio", cclimber_audio_device, sample_volume_w) - AM_RANGE(0xb800, 0xb800) AM_READ_PORT("SYSTEM") + AM_RANGE(0xb800, 0xb800) AM_READNOP ADDRESS_MAP_END static ADDRESS_MAP_START( toprollr_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, cclimber_state ) @@ -613,27 +621,9 @@ static INPUT_PORTS_START( ckong ) INPUT_PORTS_END static INPUT_PORTS_START( bagmanf ) - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) - - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_INCLUDE( ckong ) - PORT_START("DSW") + PORT_MODIFY("DSW") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x03, "2" ) PORT_DIPSETTING( 0x02, "3" ) @@ -656,8 +646,6 @@ static INPUT_PORTS_START( bagmanf ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) ) /* Cabinet type set through edge connector, not dip switch (verified on real pcb) */ PORT_DIPSETTING( 0x80, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) - - PORT_START("SYSTEM") INPUT_PORTS_END /* Similar to normal Crazy Kong except for the lives per game */ @@ -2277,6 +2265,7 @@ ROM_END this set also explains why the cannonball set above contained a number of bagman roms, it was clearly a half-converted board. + A bootleg of "Le Bagnard" with a KCK-series motherboard has also been observed. */ ROM_START( bagmanf ) ROM_REGION( 0x6000, "maincpu", 0 ) @@ -2297,8 +2286,8 @@ ROM_START( bagmanf ) ROM_REGION( 0x2000, "gfx2", ROMREGION_ERASE00 ) ROM_REGION( 0x0060, "proms", 0 ) - ROM_LOAD( "v6", 0x0000, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) ) - ROM_LOAD( "u6", 0x0020, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) ) + ROM_LOAD( "v6", 0x0020, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) ) + ROM_LOAD( "u6", 0x0000, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) ) ROM_LOAD( "t6", 0x0040, 0x0020, CRC(676b3166) SHA1(29b9434cd34d43ea5664e436e2a24b54f8d88aac) ) /* as well as one of the program roms, the daughterboard contains the speech hardware + roms */ diff --git a/src/mame/drivers/cdi.cpp b/src/mame/drivers/cdi.cpp index a2c70c94c23..0cdcea594ee 100644 --- a/src/mame/drivers/cdi.cpp +++ b/src/mame/drivers/cdi.cpp @@ -950,7 +950,7 @@ static MACHINE_CONFIG_DERIVED( quizard1, quizard ) MCFG_CPU_ADD("mcu", I8751, 8000000) MCFG_CPU_IO_MAP(mcu_io_map) -// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cdi_state, irq0_line_pulse) +// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cdi_state, irq0_line_pulse) MACHINE_CONFIG_END @@ -967,7 +967,7 @@ static MACHINE_CONFIG_DERIVED( quizard4, quizard ) MCFG_CPU_ADD("mcu", I8751, 8000000) MCFG_CPU_IO_MAP(mcu_io_map) -// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cdi_state, irq0_line_pulse) +// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cdi_state, irq0_line_pulse) MACHINE_CONFIG_END @@ -1058,12 +1058,12 @@ ROM_END /* Quizard notes - The MCU controls the protection sequence, which in turn controls the game display language. - Each Quizard game (1,2,3,4) requires it's own MCU, you can upgrade between revisions by changing - just the CD, but not between games as a new MCU is required. + The MCU controls the protection sequence, which in turn controls the game display language. + Each Quizard game (1,2,3,4) requires it's own MCU, you can upgrade between revisions by changing + just the CD, but not between games as a new MCU is required. - The only dumped MCUs are German region ones for Quizard 1 and 4. - A Czech Quizard 4 MCU was located but it was an 89c51 type instead + The only dumped MCUs are German region ones for Quizard 1 and 4. + A Czech Quizard 4 MCU was located but it was an 89c51 type instead */ @@ -1084,7 +1084,7 @@ ROM_START( quizard ) /* CD-ROM printed ??/?? */ DISK_IMAGE_READONLY( "quizard18", 0, BAD_DUMP SHA1(ede873b22957f2a707bbd3039e962ef2ca5aedbd) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) + ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // confirmed good on original hardware ROM_END @@ -1102,7 +1102,7 @@ ROM_START( quizard_17 ) DISK_IMAGE_READONLY( "quizard17", 0, BAD_DUMP SHA1(4bd698f076505b4e17be978481bce027eb47123b) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) + ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // confirmed good on original hardware ROM_END ROM_START( quizard_12 ) /* CD-ROM printed 01/95 */ @@ -1119,7 +1119,7 @@ ROM_START( quizard_12 ) /* CD-ROM printed 01/95 */ DISK_IMAGE_READONLY( "quizard12", 0, BAD_DUMP SHA1(6e41683b96b74e903040842aeb18437ad7813c82) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) + ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // confirmed good on original hardware ROM_END ROM_START( quizard_10 ) @@ -1139,7 +1139,7 @@ ROM_START( quizard_10 ) DISK_IMAGE_READONLY( "quizard10", 0, SHA1(5715db50f0d5ffe06f47c0943f4bf0481ab6048e) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) + ROM_LOAD( "quizard1_german_d8751.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // confirmed good on original hardware ROM_END @@ -1230,7 +1230,7 @@ ROM_START( quizard4 ) /* CD-ROM printed 09/98 */ DISK_IMAGE_READONLY( "quizard4r42", 0, BAD_DUMP SHA1(a5d5c8950b4650b8753f9119dc7f1ccaa2aa5442) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) + ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // confirmed good on original hardware ROM_END ROM_START( quizard4_41 ) @@ -1247,7 +1247,7 @@ ROM_START( quizard4_41 ) DISK_IMAGE_READONLY( "quizard4r41", 0, BAD_DUMP SHA1(2c0484c6545aac8e00b318328c6edce6f5dde43d) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) + ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // confirmed good on original hardware ROM_END ROM_START( quizard4_40 ) /* CD-ROM printed 07/97 */ @@ -1264,7 +1264,7 @@ ROM_START( quizard4_40 ) /* CD-ROM printed 07/97 */ DISK_IMAGE_READONLY( "quizard4r40", 0, BAD_DUMP SHA1(288cc37a994e4f1cbd47aa8c92342879c6fc0b87) ) ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) + ROM_LOAD( "quizard4_german_d8751.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // confirmed good on original hardware ROM_END diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp index a3a74af5640..5c120979a51 100644 --- a/src/mame/drivers/cfx9850.cpp +++ b/src/mame/drivers/cfx9850.cpp @@ -30,219 +30,185 @@ public: : driver_device(mconfig, type, tag), m_video_ram(*this, "video_ram"), m_display_ram(*this, "display_ram"), - m_ko1(*this, "KO1"), - m_ko2(*this, "KO2"), - m_ko3(*this, "KO3"), - m_ko4(*this, "KO4"), - m_ko5(*this, "KO5"), - m_ko6(*this, "KO6"), - m_ko7(*this, "KO7"), - m_ko8(*this, "KO8"), - m_ko9(*this, "KO9"), - m_ko10(*this, "KO10"), - m_ko11(*this, "KO11"), - m_ko12(*this, "KO12") , + m_ko_port(*this, "KO.%u", 0), m_maincpu(*this, "maincpu") { } - DECLARE_WRITE8_MEMBER(cfx9850_kol_w); - DECLARE_WRITE8_MEMBER(cfx9850_koh_w); - DECLARE_READ8_MEMBER(cfx9850_ki_r); - DECLARE_READ8_MEMBER(cfx9850_battery_level_r); - required_shared_ptr<uint8_t> m_video_ram; - required_shared_ptr<uint8_t> m_display_ram; - uint16_t m_ko; /* KO lines KO1 - KO14 */ + DECLARE_WRITE8_MEMBER(kol_w); + DECLARE_WRITE8_MEMBER(koh_w); + DECLARE_READ8_MEMBER(ki_r); + DECLARE_READ8_MEMBER(in0_r); + required_shared_ptr<u8> m_video_ram; + required_shared_ptr<u8> m_display_ram; + u16 m_ko; // KO lines KO1 - KO14 DECLARE_PALETTE_INIT(cfx9850); - uint32_t screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: - required_ioport m_ko1; - required_ioport m_ko2; - required_ioport m_ko3; - required_ioport m_ko4; - required_ioport m_ko5; - required_ioport m_ko6; - required_ioport m_ko7; - required_ioport m_ko8; - required_ioport m_ko9; - required_ioport m_ko10; - required_ioport m_ko11; - required_ioport m_ko12; + required_ioport_array<12> m_ko_port; required_device<cpu_device> m_maincpu; }; -static ADDRESS_MAP_START( cfx9850, AS_PROGRAM, 8, cfx9850_state ) +static ADDRESS_MAP_START(cfx9850, AS_PROGRAM, 8, cfx9850_state) AM_RANGE( 0x000000, 0x007fff ) AM_ROM AM_RANGE( 0x080000, 0x0807ff ) AM_RAM AM_SHARE("video_ram") -// AM_RANGE( 0x100000, 0x10ffff ) /* some memory mapped i/o? */ -// AM_RANGE( 0x110000, 0x11ffff ) /* some memory mapped i/o? */ +// AM_RANGE( 0x100000, 0x10ffff ) // some memory mapped i/o? +// AM_RANGE( 0x110000, 0x11ffff ) // some memory mapped i/o? AM_RANGE( 0x200000, 0x27ffff ) AM_ROM AM_REGION( "bios", 0 ) AM_RANGE( 0x400000, 0x40ffff ) AM_RAM AM_RANGE( 0x600000, 0x6007ff ) AM_MIRROR(0xf800) AM_RAM AM_SHARE("display_ram") -// AM_RANGE( 0xe10000, 0xe1ffff ) /* some memory mapped i/o? */ +// AM_RANGE( 0xe10000, 0xe1ffff ) // some memory mapped i/o? ADDRESS_MAP_END -WRITE8_MEMBER( cfx9850_state::cfx9850_kol_w ) +WRITE8_MEMBER(cfx9850_state::kol_w) { - m_ko = ( m_ko & 0xff00 ) | data; + m_ko = (m_ko & 0xff00) | data; } -WRITE8_MEMBER( cfx9850_state::cfx9850_koh_w ) +WRITE8_MEMBER(cfx9850_state::koh_w) { - m_ko = ( m_ko & 0x00ff ) | ( data << 8 ); + m_ko = (m_ko & 0x00ff) | (data << 8); } -READ8_MEMBER( cfx9850_state::cfx9850_ki_r ) +READ8_MEMBER(cfx9850_state::ki_r) { - uint8_t data = 0; - - if ( m_ko & ( 1 << 0 ) ) data |= m_ko1->read(); - if ( m_ko & ( 1 << 1 ) ) data |= m_ko2->read(); - if ( m_ko & ( 1 << 2 ) ) data |= m_ko3->read(); - if ( m_ko & ( 1 << 3 ) ) data |= m_ko4->read(); - if ( m_ko & ( 1 << 4 ) ) data |= m_ko5->read(); - if ( m_ko & ( 1 << 5 ) ) data |= m_ko6->read(); - if ( m_ko & ( 1 << 6 ) ) data |= m_ko7->read(); - if ( m_ko & ( 1 << 7 ) ) data |= m_ko8->read(); - if ( m_ko & ( 1 << 8 ) ) data |= m_ko9->read(); - if ( m_ko & ( 1 << 9 ) ) data |= m_ko10->read(); - if ( m_ko & ( 1 << 10 ) ) data |= m_ko11->read(); - if ( m_ko & ( 1 << 11 ) ) data |= m_ko12->read(); + u8 data = 0; + + for (int i = 0; i < 12; i++) + { + if (BIT(m_ko, i)) + { + data |= m_ko_port[i]->read(); + } + } return data; } -READ8_MEMBER( cfx9850_state::cfx9850_battery_level_r ) +READ8_MEMBER(cfx9850_state::in0_r) { + // battery level return 0x30; } -static ADDRESS_MAP_START( cfx9850_io, AS_IO, 8, cfx9850_state ) - AM_RANGE( HCD62121_KOL, HCD62121_KOL ) AM_WRITE( cfx9850_kol_w ) - AM_RANGE( HCD62121_KOH, HCD62121_KOH ) AM_WRITE( cfx9850_koh_w ) - AM_RANGE( HCD62121_KI, HCD62121_KI ) AM_READ( cfx9850_ki_r ) - AM_RANGE( HCD62121_IN0, HCD62121_IN0 ) AM_READ( cfx9850_battery_level_r ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( cfx9850 ) - PORT_START( "KO1" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "AC On/Off" ) PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXE Enter" ) PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "(-) Ares" ) PORT_CODE(KEYCODE_MINUS) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXP Pi" ) PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ". SPACE" ) PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "0 Z" ) PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO3" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "- ] Y" ) PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "+ [ X" ) PORT_CODE(KEYCODE_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "3 W" ) PORT_CODE(KEYCODE_W) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "2 V" ) PORT_CODE(KEYCODE_V) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "1 U" ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO4" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/ } T" ) PORT_CODE(KEYCODE_T) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "* { S" ) PORT_CODE(KEYCODE_S) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "6 R" ) PORT_CODE(KEYCODE_R) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "5 Q" ) PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "4 P" ) PORT_CODE(KEYCODE_P) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO5" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "DEL DG" ) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "9 O" ) PORT_CODE(KEYCODE_O) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "8 N" ) PORT_CODE(KEYCODE_N) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "7 M" ) PORT_CODE(KEYCODE_M) - PORT_BIT( 0x87, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO6" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TAB L" ) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ", K" ) PORT_CODE(KEYCODE_K) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ") x^-1 J" ) PORT_CODE(KEYCODE_J) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "( .. I" ) PORT_CODE(KEYCODE_I) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F<=>0 H" ) PORT_CODE(KEYCODE_H) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "a b/c G" ) PORT_CODE(KEYCODE_G) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO7" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "tan tan^-1 F" ) PORT_CODE(KEYCODE_F) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "cos cas^-1 E" ) PORT_CODE(KEYCODE_E) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "sin sin^-1 D" ) PORT_CODE(KEYCODE_D) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ln e^x C" ) PORT_CODE(KEYCODE_C) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "log 10^x B" ) PORT_CODE(KEYCODE_B) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x,d,t A" ) PORT_CODE(KEYCODE_A) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO8" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Right" ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Down" ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXIT QUIT" ) PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/\\ .. .." ) PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x^2 sqrt .." ) PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ALPHA ..-LOCK" ) PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO9" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Up" ) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Left" ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "MENU SET UP" ) PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "VARS PRGM" ) PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "OPTN" ) PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "SHIFT" ) PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO10" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F6 G<=>T" ) PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F5 G-Solv" ) PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F4 Sketch" ) PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F3 V-Window" ) PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F2 Zoom" ) PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F1 Trace" ) PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - /* KO11 is not connected */ - PORT_START( "KO11" ) - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO12" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TEST" ) PORT_CODE(KEYCODE_TILDE) - PORT_BIT( 0xf7, IP_ACTIVE_HIGH, IPT_UNUSED ) +static INPUT_PORTS_START(cfx9850) + PORT_START("KO.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AC On/Off") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-) Ares") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXP Pi") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". SPACE") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x83, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.2") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- ] Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ [ X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x83, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.3") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ } T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* { S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x83, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.4") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL DG") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x87, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.5") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") x^-1 J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( .. I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F<=>0 H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("a b/c G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x81, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.6") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tan tan^-1 F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("cos cas^-1 E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sin sin^-1 D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ln e^x C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("log 10^x B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x,d,t A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x81, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.7") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXIT QUIT") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/\\ .. ..") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2 sqrt ..") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA ..-LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x81, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.8") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MENU SET UP") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VARS PRGM") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OPTN") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x81, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.9") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6 G<=>T") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5 G-Solv") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4 Sketch") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3 V-Window") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2 Zoom") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1 Trace") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x81, IP_ACTIVE_HIGH, IPT_UNUSED) + + // KO11 is not connected + PORT_START("KO.10") + PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KO.11") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TEST") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0xf7, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END PALETTE_INIT_MEMBER(cfx9850_state, cfx9850) { - palette.set_pen_color( 0, 0xff, 0xff, 0xff ); - palette.set_pen_color( 1, 0x00, 0x00, 0xff ); - palette.set_pen_color( 2, 0x00, 0xff, 0x00 ); - palette.set_pen_color( 3, 0xff, 0x00, 0x00 ); + palette.set_pen_color(0, 0xff, 0xff, 0xff); + palette.set_pen_color(1, 0x00, 0x00, 0xff); + palette.set_pen_color(2, 0x00, 0xff, 0x00); + palette.set_pen_color(3, 0xff, 0x00, 0x00); } -uint32_t cfx9850_state::screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 cfx9850_state::screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t offset = 0; + u16 offset = 0; - for ( int i = 0; i < 16; i++ ) + for (int i = 0; i < 16; i++) { int x = 120 - i * 8; - for ( int j = 0; j < 64; j++ ) + for (int j = 0; j < 64; j++) { - uint8_t data1 = m_display_ram[ offset ]; - uint8_t data2 = m_display_ram[ offset + 0x400 ]; + u8 data1 = m_display_ram[offset]; + u8 data2 = m_display_ram[offset + 0x400]; - for ( int b = 0; b < 8; b++ ) + for (int b = 0; b < 8; b++) { bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); data1 <<= 1; @@ -257,37 +223,40 @@ uint32_t cfx9850_state::screen_update_cfx9850(screen_device &screen, bitmap_ind1 } -static MACHINE_CONFIG_START( cfx9850, cfx9850_state ) - MCFG_CPU_ADD( "maincpu", HCD62121, 4300000 ) /* 4.3 MHz */ - MCFG_CPU_PROGRAM_MAP( cfx9850 ) - MCFG_CPU_IO_MAP( cfx9850_io ) +static MACHINE_CONFIG_START(cfx9850, cfx9850_state) + MCFG_CPU_ADD("maincpu", HCD62121, 4300000) /* 4.3 MHz */ + MCFG_CPU_PROGRAM_MAP(cfx9850) + MCFG_HCD62121_KOL_CB(WRITE8(cfx9850_state, kol_w)) + MCFG_HCD62121_KOH_CB(WRITE8(cfx9850_state, koh_w)) + MCFG_HCD62121_KI_CB(READ8(cfx9850_state, ki_r)) + MCFG_HCD62121_IN0_CB(READ8(cfx9850_state, in0_r)) - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_SIZE( 128, 64 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 127, 0, 63 ) + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 127, 0, 63) MCFG_SCREEN_UPDATE_DRIVER(cfx9850_state, screen_update_cfx9850) MCFG_SCREEN_PALETTE("palette") MCFG_DEFAULT_LAYOUT(layout_lcd) - /* TODO: It uses a color display, but I'm being lazy here. 3 colour lcd */ - MCFG_PALETTE_ADD( "palette", 4 ) + // TODO: Verify amount of colors and palette + MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(cfx9850_state, cfx9850) MACHINE_CONFIG_END -ROM_START( cfx9850 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "hcd62121.bin", 0x0000, 0x8000, CRC(e72075f8) SHA1(f50d176e1c225dab69abfc67702c9dfb296b6a78) ) +ROM_START(cfx9850) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD("hcd62121.bin", 0x0000, 0x8000, CRC(e72075f8) SHA1(f50d176e1c225dab69abfc67702c9dfb296b6a78)) - ROM_REGION( 0x80000, "bios", 0 ) - /* No idea yet which rom is what version. */ - ROM_SYSTEM_BIOS( 0, "rom1", "rom1, version unknown" ) - ROMX_LOAD( "cfx9850.bin", 0x00000, 0x80000, CRC(6c9bd903) SHA1(d5b6677ab4e0d3f84e5769e89e8f3d101f98f848), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "rom2", "rom2, version unknown" ) - ROMX_LOAD( "cfx9850b.bin", 0x00000, 0x80000, CRC(cd3c497f) SHA1(1d1aa38205eec7aba3ed6bef7389767e38afe075), ROM_BIOS(2) ) + ROM_REGION(0x80000, "bios", 0) + // Unknown yet which rom is which version. + ROM_SYSTEM_BIOS(0, "rom1", "rom1, version unknown") + ROMX_LOAD("cfx9850.bin", 0x00000, 0x80000, CRC(6c9bd903) SHA1(d5b6677ab4e0d3f84e5769e89e8f3d101f98f848), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rom2", "rom2, version unknown") + ROMX_LOAD("cfx9850b.bin", 0x00000, 0x80000, CRC(cd3c497f) SHA1(1d1aa38205eec7aba3ed6bef7389767e38afe075), ROM_BIOS(2)) ROM_END -COMP( 1996, cfx9850, 0, 0, cfx9850, cfx9850, driver_device, 0, "Casio", "CFX-9850G", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +COMP(1996, cfx9850, 0, 0, cfx9850, cfx9850, driver_device, 0, "Casio", "CFX-9850G", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/coco12.cpp b/src/mame/drivers/coco12.cpp index 35a3d776915..7b4c38df94f 100644 --- a/src/mame/drivers/coco12.cpp +++ b/src/mame/drivers/coco12.cpp @@ -107,19 +107,6 @@ INPUT_PORTS_END //------------------------------------------------- -// INPUT_PORTS( coco_cart_autostart ) -//------------------------------------------------- - -INPUT_PORTS_START( coco_cart_autostart ) - PORT_START(CART_AUTOSTART_TAG) - PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( 0x01, DEF_STR( On )) -INPUT_PORTS_END - - - -//------------------------------------------------- // INPUT_PORTS( coco_beckerport ) //------------------------------------------------- @@ -238,7 +225,6 @@ static INPUT_PORTS_START( coco ) PORT_INCLUDE( coco_keyboard ) PORT_INCLUDE( coco_joystick ) PORT_INCLUDE( coco_analog_control ) - PORT_INCLUDE( coco_cart_autostart ) PORT_INCLUDE( coco_rtc ) PORT_INCLUDE( coco_beckerport ) INPUT_PORTS_END diff --git a/src/mame/drivers/coco3.cpp b/src/mame/drivers/coco3.cpp index cefb1940070..15f41f0f42d 100644 --- a/src/mame/drivers/coco3.cpp +++ b/src/mame/drivers/coco3.cpp @@ -221,7 +221,6 @@ static INPUT_PORTS_START( coco3 ) PORT_INCLUDE( coco3_keyboard ) PORT_INCLUDE( coco3_joystick ) PORT_INCLUDE( coco_analog_control ) - PORT_INCLUDE( coco_cart_autostart ) PORT_INCLUDE( coco_rat_mouse ) PORT_INCLUDE( coco_lightgun ) PORT_INCLUDE( coco_rtc ) diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp index d16ecd6a5e5..b0240f3d3b3 100644 --- a/src/mame/drivers/cubo.cpp +++ b/src/mame/drivers/cubo.cpp @@ -1049,11 +1049,13 @@ static MACHINE_CONFIG_START( cubo, cubo_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_PAL) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) MCFG_SOUND_ROUTE(2, "rspeaker", 0.25) MCFG_SOUND_ROUTE(3, "lspeaker", 0.25) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) MCFG_SOUND_ADD("cdda", CDDA, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) diff --git a/src/mame/drivers/d9final.cpp b/src/mame/drivers/d9final.cpp index 9d1328e1cc2..f076490d0bc 100644 --- a/src/mame/drivers/d9final.cpp +++ b/src/mame/drivers/d9final.cpp @@ -130,7 +130,7 @@ static ADDRESS_MAP_START( d9final_map, AS_PROGRAM, 8, d9final_state ) AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sc0_lovram) AM_SHARE("lo_vram") AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(sc0_hivram) AM_SHARE("hi_vram") AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(sc0_cram) AM_SHARE("cram") - AM_RANGE(0xf000, 0xf007) AM_READ(prot_latch_r) //AM_DEVWRITE("essnd", es8712_device, es8712_w) + AM_RANGE(0xf000, 0xf007) AM_READ(prot_latch_r) //AM_DEVREADWRITE("essnd", es8712_device, read, write) AM_RANGE(0xf800, 0xf80f) AM_DEVREADWRITE("rtc", rtc62421_device, read, write) ADDRESS_MAP_END diff --git a/src/mame/drivers/dblcrown.cpp b/src/mame/drivers/dblcrown.cpp index 257103cd97a..9ba9a8c1525 100644 --- a/src/mame/drivers/dblcrown.cpp +++ b/src/mame/drivers/dblcrown.cpp @@ -47,6 +47,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" +#include "machine/i8255.h" #include "machine/nvram.h" #include "machine/watchdog.h" @@ -79,9 +80,7 @@ public: std::unique_ptr<uint8_t[]> m_vram; uint8_t m_vram_bank[2]; uint8_t m_mux_data; - uint8_t m_lamps_data; - DECLARE_READ8_MEMBER(bank_r); DECLARE_WRITE8_MEMBER(bank_w); DECLARE_READ8_MEMBER(irq_source_r); DECLARE_WRITE8_MEMBER(irq_source_w); @@ -91,12 +90,10 @@ public: DECLARE_WRITE8_MEMBER(vram_w); DECLARE_READ8_MEMBER(vram_bank_r); DECLARE_WRITE8_MEMBER(vram_bank_w); - DECLARE_READ8_MEMBER(mux_r); DECLARE_WRITE8_MEMBER(mux_w); DECLARE_READ8_MEMBER(in_mux_r); DECLARE_READ8_MEMBER(in_mux_type_r); DECLARE_WRITE8_MEMBER(output_w); - DECLARE_READ8_MEMBER(lamps_r); DECLARE_WRITE8_MEMBER(lamps_w); DECLARE_WRITE8_MEMBER(watchdog_w); @@ -159,11 +156,6 @@ uint32_t dblcrown_state::screen_update( screen_device &screen, bitmap_ind16 &bit return 0; } -READ8_MEMBER( dblcrown_state::bank_r) -{ - return m_bank; -} - WRITE8_MEMBER( dblcrown_state::bank_w) { m_bank = data; @@ -246,11 +238,6 @@ WRITE8_MEMBER( dblcrown_state::vram_bank_w) printf("vram bank = %02x\n",data); } -READ8_MEMBER( dblcrown_state::mux_r) -{ - return m_mux_data; -} - WRITE8_MEMBER( dblcrown_state::mux_w) { m_mux_data = data; @@ -307,11 +294,6 @@ WRITE8_MEMBER( dblcrown_state::output_w ) } -READ8_MEMBER( dblcrown_state::lamps_r ) -{ - return m_lamps_data; -} - WRITE8_MEMBER( dblcrown_state::lamps_w ) { /* bits @@ -333,8 +315,6 @@ WRITE8_MEMBER( dblcrown_state::lamps_w ) output().set_lamp_value(5, (data >> 5) & 1); /* Hold 3 */ output().set_lamp_value(6, (data >> 6) & 1); /* Hold 2 */ output().set_lamp_value(7, (data >> 7) & 1); /* Hold 1 */ - - m_lamps_data = data; } WRITE8_MEMBER(dblcrown_state::watchdog_w) @@ -377,10 +357,8 @@ static ADDRESS_MAP_START( dblcrown_io, AS_IO, 8, dblcrown_state ) AM_RANGE(0x03, 0x03) AM_READ_PORT("DSWD") AM_RANGE(0x04, 0x04) AM_READ(in_mux_r) AM_RANGE(0x05, 0x05) AM_READ(in_mux_type_r) - AM_RANGE(0x10, 0x10) AM_READWRITE(lamps_r, lamps_w) - AM_RANGE(0x11, 0x11) AM_READWRITE(bank_r, bank_w) - AM_RANGE(0x12, 0x12) AM_READWRITE(mux_r, mux_w) - AM_RANGE(0x20, 0x21) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ppi", i8255_device, read, write) + AM_RANGE(0x20, 0x21) AM_DEVWRITE("ymz", ymz284_device, address_data_w) AM_RANGE(0x30, 0x30) AM_WRITE(watchdog_w) AM_RANGE(0x40, 0x40) AM_WRITE(output_w) ADDRESS_MAP_END @@ -638,9 +616,14 @@ static MACHINE_CONFIG_START( dblcrown, dblcrown_state ) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(dblcrown_state, lamps_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(dblcrown_state, bank_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(dblcrown_state, mux_w)) + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("aysnd", AY8910, SND_CLOCK) + MCFG_SOUND_ADD("ymz", YMZ284, SND_CLOCK) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END diff --git a/src/mame/drivers/dccons.cpp b/src/mame/drivers/dccons.cpp index 68f36b83194..cb96b4c7f88 100644 --- a/src/mame/drivers/dccons.cpp +++ b/src/mame/drivers/dccons.cpp @@ -347,16 +347,6 @@ WRITE64_MEMBER(dc_cons_state::dc_pdtra_w ) PDTRA = (data & 0xffff); } -READ64_MEMBER(dc_cons_state::dc_arm_r ) -{ - return *((uint64_t *)dc_sound_ram.target()+offset); -} - -WRITE64_MEMBER(dc_cons_state::dc_arm_w ) -{ - COMBINE_DATA((uint64_t *)dc_sound_ram.target() + offset); -} - #if 0 READ8_MEMBER(dc_cons_state::dc_flash_r) { @@ -383,7 +373,7 @@ static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state ) AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(dc_modem_r, dc_modem_w ) AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) - AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(dc_arm_r, dc_arm_w ) + AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(sh4_soundram_r, sh4_soundram_w ) // AM_RANGE(0x01000000, 0x01ffffff) G2 Ext Device #1 // AM_RANGE(0x02700000, 0x02707fff) AICA reg mirror // AM_RANGE(0x02800000, 0x02ffffff) AICA wave mem mirror @@ -564,9 +554,9 @@ static INPUT_PORTS_START( dc ) //A4 - A5, second analog stick, unused on DC PORT_START("MAMEDEBUG") - PORT_DIPNAME( 0x01, 0x00, "Bilinear Filtering" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_CONFNAME( 0x01, 0x00, "Bilinear Filtering" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) PORT_START("SCREEN_TYPE") PORT_CONFNAME( 0x03, 0x03, "Screen Connection Type" ) @@ -575,27 +565,6 @@ static INPUT_PORTS_START( dc ) PORT_CONFSETTING( 0x03, "S-Video" ) INPUT_PORTS_END -MACHINE_RESET_MEMBER(dc_cons_state,dc_console) -{ - dc_state::machine_reset(); - m_aica->set_ram_base(dc_sound_ram, 2*1024*1024); -} - -WRITE_LINE_MEMBER(dc_cons_state::aica_irq) -{ - m_soundcpu->set_input_line(ARM7_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(dc_cons_state::sh4_aica_irq) -{ - if(state) - dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_AICA; - else - dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_AICA; - - dc_update_interrupt_status(); -} - static MACHINE_CONFIG_FRAGMENT( gdrom_config ) MCFG_DEVICE_MODIFY("cdda") MCFG_SOUND_ROUTE(0, "^^^^lspeaker", 1.0) @@ -642,8 +611,8 @@ static MACHINE_CONFIG_START( dc, dc_cons_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("aica", AICA, 0) MCFG_AICA_MASTER - MCFG_AICA_IRQ_CB(WRITELINE(dc_cons_state, aica_irq)) - MCFG_AICA_MAIN_IRQ_CB(WRITELINE(dc_cons_state, sh4_aica_irq)) + MCFG_AICA_IRQ_CB(WRITELINE(dc_state, aica_irq)) + MCFG_AICA_MAIN_IRQ_CB(WRITELINE(dc_state, sh4_aica_irq)) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) diff --git a/src/mame/drivers/ddragon.cpp b/src/mame/drivers/ddragon.cpp index 00b93ff2efa..0ceccf6eec9 100644 --- a/src/mame/drivers/ddragon.cpp +++ b/src/mame/drivers/ddragon.cpp @@ -55,7 +55,6 @@ Dip locations verified with manual for ddragon & ddragon2 #include "emu.h" #include "cpu/m6809/hd6309.h" #include "cpu/m6800/m6800.h" -#include "cpu/m6805/m68705.h" #include "cpu/m6809/m6809.h" #include "cpu/z80/z80.h" #include "sound/ym2151.h" @@ -183,7 +182,7 @@ WRITE8_MEMBER(ddragon_state::ddragon_bankswitch_w) } -WRITE8_MEMBER(ddragon_state::toffy_bankswitch_w) +WRITE8_MEMBER(toffy_state::toffy_bankswitch_w) { m_scrollx_hi = data & 0x01; m_scrolly_hi = (data & 0x02) >> 1; @@ -195,7 +194,7 @@ WRITE8_MEMBER(ddragon_state::toffy_bankswitch_w) } -READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r) +READ8_MEMBER(darktowr_state::darktowr_mcu_bank_r) { // logerror("BankRead %05x %08x\n",space.device().safe_pc(),offset); @@ -216,26 +215,27 @@ READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r) } if (offset == 0x1401 || offset == 1) - return m_darktowr_mcu_ports[0]; + return m_mcu_port_a_out; logerror("Unmapped mcu bank read %04x\n",offset); return 0xff; } -WRITE8_MEMBER(ddragon_state::darktowr_mcu_bank_w) +WRITE8_MEMBER(darktowr_state::darktowr_mcu_bank_w) { logerror("BankWrite %05x %08x %08x\n", space.device().safe_pc(), offset, data); if (offset == 0x1400 || offset == 0) { - m_darktowr_mcu_ports[1] = BITSWAP8(data,0,1,2,3,4,5,6,7); - logerror("MCU PORT 1 -> %04x (from %04x)\n", BITSWAP8(data,0,1,2,3,4,5,6,7), data); + uint8_t const value(BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7)); + m_mcu->pb_w(space, 0, value); + logerror("MCU PORT 1 -> %04x (from %04x)\n", value, data); } } -WRITE8_MEMBER(ddragon_state::darktowr_bankswitch_w) +WRITE8_MEMBER(darktowr_state::darktowr_bankswitch_w) { m_scrollx_hi = (data & 0x01); m_scrolly_hi = ((data & 0x02) >> 1); @@ -250,7 +250,7 @@ WRITE8_MEMBER(ddragon_state::darktowr_bankswitch_w) membank("bank1")->set_entry(newbank); if (newbank == 4 && oldbank != 4) - space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_r),this), write8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_w),this)); + space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(darktowr_state::darktowr_mcu_bank_r),this), write8_delegate(FUNC(darktowr_state::darktowr_mcu_bank_w),this)); else if (newbank != 4 && oldbank == 4) space.install_readwrite_bank(0x4000, 0x7fff, "bank1"); } @@ -351,10 +351,10 @@ CUSTOM_INPUT_MEMBER(ddragon_state::subcpu_bus_free) } -WRITE8_MEMBER(ddragon_state::darktowr_mcu_w) +WRITE8_MEMBER(darktowr_state::mcu_port_a_w) { - logerror("McuWrite %05x %08x %08x\n",space.device().safe_pc(), offset, data); - m_darktowr_mcu_ports[offset] = data; + logerror("McuWrite %05x %08x %08x\n", space.device().safe_pc(), offset, data); + m_mcu_port_a_out = data; } @@ -594,21 +594,6 @@ ADDRESS_MAP_END /************************************* * - * MCU memory maps - * - *************************************/ - -static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, ddragon_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0007) AM_RAM_WRITE(darktowr_mcu_w) AM_SHARE("darktowr_mcu") - AM_RANGE(0x0008, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x07ff) AM_ROM -ADDRESS_MAP_END - - - -/************************************* - * * Input ports * *************************************/ @@ -1104,17 +1089,17 @@ static MACHINE_CONFIG_START( ddragon2, ddragon_state ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( darktowr, ddragon ) +static MACHINE_CONFIG_DERIVED_CLASS( darktowr, ddragon, darktowr_state ) /* basic machine hardware */ - MCFG_CPU_ADD("mcu", M68705,XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(mcu_map) + MCFG_CPU_ADD("mcu", M68705P3, XTAL_4MHz) + MCFG_M68705_PORTA_W_CB(WRITE8(darktowr_state, mcu_port_a_w)) /* video hardware */ MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( toffy, ddragon ) +static MACHINE_CONFIG_DERIVED_CLASS( toffy, ddragon, toffy_state ) /* basic machine hardware */ MCFG_DEVICE_REMOVE("sub") @@ -1809,7 +1794,7 @@ ROM_START( tstrike ) ROM_REGION( 0x10000, "soundcpu", 0 ) /* audio cpu */ ROM_LOAD( "tstrike.30", 0x08000, 0x08000, CRC(3f3f04a1) SHA1(45d2b4542ec783c1c4122616606be6c160f76c06) ) - ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ ROM_LOAD( "68705prt.mcu", 0x00000, 0x0800, CRC(34cbb2d3) SHA1(8e0c3b13c636012d88753d547c639b1a8af85680) ) ROM_REGION( 0x08000, "gfx1", 0 ) @@ -1853,7 +1838,7 @@ ROM_START( tstrikea ) ROM_REGION( 0x10000, "soundcpu", 0 ) /* audio cpu */ ROM_LOAD( "tstrike.30", 0x08000, 0x08000, CRC(3f3f04a1) SHA1(45d2b4542ec783c1c4122616606be6c160f76c06) ) - ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ ROM_LOAD( "68705prt.mcu", 0x00000, 0x0800, CRC(34cbb2d3) SHA1(8e0c3b13c636012d88753d547c639b1a8af85680) ) ROM_REGION( 0x08000, "gfx1", 0 ) @@ -1897,7 +1882,7 @@ ROM_START( ddungeon ) ROM_REGION( 0x10000, "soundcpu", 0 ) /* audio cpu */ ROM_LOAD( "dd30.30", 0x08000, 0x08000, CRC(ef1af99a) SHA1(7ced695b81ca9efbb7b28b78013e112edac85672) ) - ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ ROM_LOAD( "dd_mcu.bin", 0x00000, 0x0800, CRC(34cbb2d3) SHA1(8e0c3b13c636012d88753d547c639b1a8af85680) ) ROM_REGION( 0x10000, "gfx1", 0 ) /* GFX? */ @@ -1936,7 +1921,7 @@ ROM_START( ddungeone ) ROM_REGION( 0x10000, "soundcpu", 0 ) /* audio cpu */ ROM_LOAD( "21j-0-1", 0x08000, 0x08000, CRC(9efa95bb) SHA1(da997d9cc7b9e7b2c70a4b6d30db693086a6f7d8) ) /* from ddragon */ - ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ ROM_LOAD( "dd_mcu.bin", 0x00000, 0x0800, CRC(34cbb2d3) SHA1(8e0c3b13c636012d88753d547c639b1a8af85680) ) ROM_REGION( 0x10000, "gfx1", 0 ) /* GFX? */ @@ -1973,7 +1958,7 @@ ROM_START( darktowr ) ROM_REGION( 0x10000, "soundcpu", 0 ) /* audio cpu */ ROM_LOAD( "21j-0-1", 0x08000, 0x08000, CRC(9efa95bb) SHA1(da997d9cc7b9e7b2c70a4b6d30db693086a6f7d8) ) /* from ddragon */ - ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */ ROM_LOAD( "68705prt.mcu", 0x00000, 0x0800, CRC(34cbb2d3) SHA1(8e0c3b13c636012d88753d547c639b1a8af85680) ) ROM_REGION( 0x08000, "gfx1", 0 ) /* chars */ @@ -2090,23 +2075,26 @@ DRIVER_INIT_MEMBER(ddragon_state,ddragon2) } -DRIVER_INIT_MEMBER(ddragon_state,darktowr) +DRIVER_INIT_MEMBER(darktowr_state, darktowr) { + save_item(NAME(m_mcu_port_a_out)); + m_sprite_irq = INPUT_LINE_NMI; m_ym_irq = M6809_FIRQ_LINE; m_technos_video_hw = 0; - m_maincpu->space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(darktowr_state::darktowr_bankswitch_w), this)); + m_mcu_port_a_out = 0xff; } -DRIVER_INIT_MEMBER(ddragon_state,toffy) +DRIVER_INIT_MEMBER(toffy_state, toffy) { int i, length; uint8_t *rom; m_ym_irq = M6809_FIRQ_LINE; m_technos_video_hw = 0; - m_maincpu->space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(toffy_state::toffy_bankswitch_w), this)); /* the program rom has a simple bitswap encryption */ rom = memregion("maincpu")->base(); @@ -2170,32 +2158,32 @@ DRIVER_INIT_MEMBER(ddragon_state,ddragon6809) * *************************************/ -GAME( 1987, ddragon, 0, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan", "Double Dragon (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonw, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito license)", "Double Dragon (World set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonw1, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito license)", "Double Dragon (World set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonu, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonua, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonub, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonb2, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragonb, ddragon, ddragonb, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg with HD6309)", MACHINE_SUPPORTS_SAVE ) // according to dump notes -GAME( 1987, ddragonba, ddragon, ddragonba, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg with M6803)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, ddragon6809, ddragon, ddragon6809, ddragon, ddragon_state, ddragon6809, ROT0, "bootleg", "Double Dragon (bootleg with 3xM6809, set 1)", MACHINE_NOT_WORKING ) -GAME( 1987, ddragon6809a,ddragon, ddragon6809, ddragon, ddragon_state, ddragon6809, ROT0, "bootleg", "Double Dragon (bootleg with 3xM6809, set 2)", MACHINE_NOT_WORKING ) - -GAME( 1988, ddragon2, 0, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, ddragon2u, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, ddragon2j, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (Japan)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad dump -GAME( 1988, ddragon2b, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "bootleg", "Double Dragon II - The Revenge (US, bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragon, 0, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan", "Double Dragon (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonw, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito license)", "Double Dragon (World set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonw1, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito license)", "Double Dragon (World set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonu, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonua, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonub, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "Technos Japan (Taito America license)", "Double Dragon (US set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonb2, ddragon, ddragon, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragonb, ddragon, ddragonb, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg with HD6309)", MACHINE_SUPPORTS_SAVE ) // according to dump notes +GAME( 1987, ddragonba, ddragon, ddragonba, ddragon, ddragon_state, ddragon, ROT0, "bootleg", "Double Dragon (bootleg with M6803)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, ddragon6809, ddragon, ddragon6809, ddragon, ddragon_state, ddragon6809, ROT0, "bootleg", "Double Dragon (bootleg with 3xM6809, set 1)", MACHINE_NOT_WORKING ) +GAME( 1987, ddragon6809a,ddragon, ddragon6809, ddragon, ddragon_state, ddragon6809, ROT0, "bootleg", "Double Dragon (bootleg with 3xM6809, set 2)", MACHINE_NOT_WORKING ) + +GAME( 1988, ddragon2, 0, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, ddragon2u, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, ddragon2j, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "Technos Japan", "Double Dragon II - The Revenge (Japan)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad dump +GAME( 1988, ddragon2b, ddragon2, ddragon2, ddragon2, ddragon_state, ddragon2, ROT0, "bootleg", "Double Dragon II - The Revenge (US, bootleg)", MACHINE_SUPPORTS_SAVE ) /* these were conversions of double dragon */ -GAME( 1991, tstrike, 0, darktowr, tstrike, ddragon_state, darktowr, ROT0, "East Coast Coin Company", "Thunder Strike (set 1)", MACHINE_SUPPORTS_SAVE ) // same manufacturer as The Game Room? -GAME( 1991, tstrikea, tstrike, darktowr, tstrike, ddragon_state, darktowr, ROT0, "The Game Room", "Thunder Strike (set 2, older)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, ddungeon, 0, darktowr, ddungeon, ddragon_state, darktowr, ROT0, "The Game Room", "Dangerous Dungeons (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, ddungeone,ddungeon, darktowr, ddungeon, ddragon_state, darktowr, ROT0, "East Coast Coin Company", "Dangerous Dungeons (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, darktowr, 0, darktowr, darktowr, ddragon_state, darktowr, ROT0, "The Game Room", "Dark Tower", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, tstrike, 0, darktowr, tstrike, darktowr_state, darktowr, ROT0, "East Coast Coin Company", "Thunder Strike (set 1)", MACHINE_SUPPORTS_SAVE ) // same manufacturer as The Game Room? +GAME( 1991, tstrikea, tstrike, darktowr, tstrike, darktowr_state, darktowr, ROT0, "The Game Room", "Thunder Strike (set 2, older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, ddungeon, 0, darktowr, ddungeon, darktowr_state, darktowr, ROT0, "The Game Room", "Dangerous Dungeons (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, ddungeone, ddungeon, darktowr, ddungeon, darktowr_state, darktowr, ROT0, "East Coast Coin Company", "Dangerous Dungeons (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, darktowr, 0, darktowr, darktowr, darktowr_state, darktowr, ROT0, "The Game Room", "Dark Tower", MACHINE_SUPPORTS_SAVE ) /* these run on their own board, but are basically the same game. Toffy even has 'dangerous dungeons' text in it */ -GAME( 1993, toffy, 0, toffy, toffy, ddragon_state, toffy, ROT0, "Midas", "Toffy", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, toffy, 0, toffy, toffy, toffy_state, toffy, ROT0, "Midas", "Toffy", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, stoffy, 0, toffy, toffy, ddragon_state, toffy, ROT0, "Midas", "Super Toffy", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, stoffyu, stoffy, toffy, toffy, ddragon_state, toffy, ROT0, "Midas (Unico license)", "Super Toffy (Unico license)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, stoffy, 0, toffy, toffy, toffy_state, toffy, ROT0, "Midas", "Super Toffy", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, stoffyu, stoffy, toffy, toffy, toffy_state, toffy, ROT0, "Midas (Unico license)", "Super Toffy (Unico license)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp index 11b387ccca6..a04f9106f89 100644 --- a/src/mame/drivers/dec0.cpp +++ b/src/mame/drivers/dec0.cpp @@ -51,7 +51,45 @@ ToDo: - Get rid of ROM patches in Sly Spy and Hippodrome; - background pen in Birdie Try is presumably wrong. - Pixel clock frequency isn't verified; -- Finally, get a proper decap of the MCUs used by Bad Dudes and Birdie Try; +- Finally, get a proper decap of the MCUs used by Dragonninja and Birdie Try; + + +Bad Dudes MCU dump came from an MCU that had been damaged during a misguided +attempt at decapping. Data didn't read consistently, and the final dump was +built up from multiple dumps by taking the most common value for each location. +It appears there may be one bit error in the dump. The MCU implements a +command to calculate a program ROM checksum and compare the low byte of the +result to a value supplied by the host CPU, but with the dump as-is, it doesn't +work. Here's the code in question: + +0AB0: 51 50 acall $0A50 +0AB2: C3 clr c +0AB3: 48 orl a,r0 +0AB4: 70 02 jnz $0AB8 +0AB6: 80 89 sjmp $0A41 +0AB8: 21 F0 ajmp $09F0 + +The function at $0A50 reads the expected value from the host, $0A41 is the +normal command response, and $09F0 is the error response. The orl instruction +doesn't make sense here. However, changing it from 48 to 60 makes it an xrl +instruction which would work as expected. + +Unfortunately the game doesn't issue this command during the attract loop or +first level, so I haven't been able to test it. I can't even use the checksum +function to verify that the program is good because the expected value mod 256 +has to be supplied by the host. + +The current Dragonninja MCU program was made by hacking the expected startup +synchronisation command in the Bad Dudes MCU program (location $09A4 changed +from $0B to $03). There may be other differences in a real Dragonninja MCU. +The table of expected values for command 7 is the same for Dragonninja (from +debugging main CPU program). + +Bad Dudes only seems to use commands $0B (sync), $01 (reset if parameter is not +$3B), $07 (return table index if parameter matches table otherwise reset) and +$09 (set table index to zero). Dragonninja only seems to use commands $03 (on +startup), $07 (same function as Bad Dudes) and $09 (same function as Bad +Dudes). Most of the MCU program isn't utilised. PCB Layouts @@ -168,6 +206,7 @@ Notes: #include "cpu/h6280/h6280.h" #include "cpu/z80/z80.h" #include "cpu/mcs51/mcs51.h" +#include "cpu/m6805/m68705.h" #include "includes/dec0.h" #include "sound/2203intf.h" #include "sound/3812intf.h" @@ -1560,6 +1599,16 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( baddudes, dec0 ) + MCFG_CPU_ADD("mcu", I8751, XTAL_8MHz) + MCFG_CPU_IO_MAP(mcu_io_map) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(dec0_state, screen_update_baddudes) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( drgninjab, dec0 ) + /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(dec0_state, screen_update_baddudes) @@ -1668,6 +1717,9 @@ static MACHINE_CONFIG_DERIVED( midresb, midres ) MCFG_CPU_REPLACE("audiocpu", M6502, 1500000 ) MCFG_CPU_PROGRAM_MAP(dec0_s_map) + MCFG_CPU_ADD("mcu", M68705R3, XTAL_3_579545MHz) + MCFG_DEVICE_DISABLE() + MCFG_SOUND_MODIFY("ym2") MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) @@ -1685,6 +1737,10 @@ static MACHINE_CONFIG_DERIVED( midresb, midres ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( midresbj, midresb ) + MCFG_DEVICE_REMOVE("mcu") +MACHINE_CONFIG_END + /******************************************************************************/ ROM_START( hbarrel ) @@ -1795,8 +1851,8 @@ ROM_START( baddudes ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ ROM_LOAD( "ei07.8a", 0x8000, 0x8000, CRC(9fb1ef4b) SHA1(f4dd0773be93c2ad8b0faacd12939c531b5aa130) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "ei31.9a", 0x0000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller - see notes */ + ROM_LOAD( "ei31.9a", 0x0000, 0x1000, CRC(2a8745d2) SHA1(f15ab17b1e7836d603135f5c66ca2e3d72f6e4a2) BAD_DUMP ) ROM_REGION( 0x10000, "gfx1", 0 ) /* chars */ ROM_LOAD( "ei25.15j", 0x00000, 0x08000, CRC(bcf59a69) SHA1(486727e19c12ea55b47e2ef773d0d0471cf50083) ) @@ -1838,8 +1894,8 @@ ROM_START( drgninja ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ ROM_LOAD( "eg07.8a", 0x8000, 0x8000, CRC(001d2f51) SHA1(f186671f0450ccf9201577a5caf0efc490c6645e) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "i8751", 0x0000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller - using hacked baddudes program */ + ROM_LOAD( "i8751", 0x0000, 0x1000, CRC(c3f6bc70) SHA1(3c80197dc70c6cb283df5d11d29a9d9baabcd99b) BAD_DUMP ) /* various graphic and sound roms also differ when compared to baddudes */ @@ -2685,7 +2741,7 @@ ROM_START( ffantasybl ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 sound */ ROM_LOAD( "15.bin", 0x8000, 0x8000, CRC(9871b98d) SHA1(2b6c46bc2b10a28946d6ad8251e1a156a0b99947) ) - ROM_REGION( 0x10000, "cpu2", 0 ) /* 68705 MCU */ // (labeled on PCB as Z80, but it isn't!) + ROM_REGION( 0x1000, "mcu", 0 ) /* 68705 MCU */ // (labeled on PCB as Z80, but it isn't!) ROM_LOAD( "68705u3.bin", 0x00000, 0x1000, NO_DUMP ) // nor dumped, maybe it's the same as the midresb one? ROM_REGION( 0x20000, "gfx1", 0 ) /* chars */ @@ -3181,7 +3237,7 @@ ROM_START( midresb ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 sound */ // same as hippodrome / fighting fantasy... ROM_LOAD( "15.bin", 0x8000, 0x8000, CRC(9871b98d) SHA1(2b6c46bc2b10a28946d6ad8251e1a156a0b99947) ) - ROM_REGION( 0x10000, "cpu2", 0 ) /* 68705 MCU */ + ROM_REGION( 0x1000, "mcu", 0 ) /* 68705 MCU */ ROM_LOAD( "68705r3.bin", 0x00000, 0x1000, CRC(ad5b1c13) SHA1(3616dc5969323a54e3e171d169f76250ae4e711a) ) ROM_REGION( 0x20000, "gfx1", 0 ) /* chars */ @@ -3233,7 +3289,7 @@ ROM_START( midresbj ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 sound */ ROM_LOAD( "15", 0x0000, 0x10000, CRC(99d47166) SHA1(a9a1adfe47be8dd3e4d6f8c783447e09be1747b2) ) - ROM_REGION( 0x10000, "cpu2", ROMREGION_ERASE00 ) /* 68705 MCU */ + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASE00 ) /* 68705 MCU */ //ROM_LOAD( "68705r3.bin", 0x00000, 0x1000, CRC(ad5b1c13) SHA1(3616dc5969323a54e3e171d169f76250ae4e711a) ) // unpopulated socket ROM_REGION( 0x20000, "gfx1", 0 ) /* chars */ @@ -3381,8 +3437,8 @@ DRIVER_INIT_MEMBER(dec0_state,ffantasybl) // YEAR, NAME, PARENT, MACHINE, INPUT, STATE/DEVICE, INIT, MONITOR,COMPANY, FULLNAME, FLAGS GAME( 1987, hbarrel, 0, hbarrel, hbarrel, dec0_state, hbarrel, ROT270, "Data East USA", "Heavy Barrel (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, hbarrelw, hbarrel, hbarrel, hbarrel, dec0_state, hbarrel, ROT270, "Data East Corporation", "Heavy Barrel (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, baddudes, 0, baddudes, baddudes, dec0_state, baddudes, ROT0, "Data East USA", "Bad Dudes vs. Dragonninja (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, drgninja, baddudes, baddudes, drgninja, dec0_state, baddudes, ROT0, "Data East Corporation", "Dragonninja (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, baddudes, 0, baddudes, baddudes, dec0_state, hbarrel, ROT0, "Data East USA", "Bad Dudes vs. Dragonninja (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, drgninja, baddudes, baddudes, drgninja, dec0_state, hbarrel, ROT0, "Data East Corporation", "Dragonninja (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, birdtry, 0, birdtry, birdtry, dec0_state, birdtry, ROT270, "Data East Corporation", "Birdie Try (Japan)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // protection controls game related data, impossible to emulate without a working PCB GAME( 1988, robocop, 0, robocop, robocop, dec0_state, robocop, ROT0, "Data East Corporation", "Robocop (World revision 4)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, robocopw, robocop, robocop, robocop, dec0_state, robocop, ROT0, "Data East Corporation", "Robocop (World revision 3)", MACHINE_SUPPORTS_SAVE ) @@ -3408,17 +3464,15 @@ GAME( 1990, bouldashj, bouldash, slyspy, bouldash, dec0_state, slyspy, ROT0 // bootlegs // more or less just an unprotected versions of the game, everything intact -GAME( 1988, robocopb, robocop, robocopb, robocop, dec0_state, robocop, ROT0, "bootleg", "Robocop (World bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, drgninjab, baddudes, baddudes, drgninja, dec0_state, baddudes, ROT0, "bootleg", "Dragonninja (bootleg)", MACHINE_SUPPORTS_SAVE ) - - +GAME( 1988, robocopb, robocop, robocopb, robocop, dec0_state, robocop, ROT0, "bootleg", "Robocop (World bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, drgninjab, baddudes, drgninjab, drgninja, dec0_state, drgninja, ROT0, "bootleg", "Dragonninja (bootleg)", MACHINE_SUPPORTS_SAVE ) // this is a common bootleg board -GAME( 1989, midresb, midres, midresb, midresb, dec0_state, midresb, ROT0, "bootleg", "Midnight Resistance (bootleg with 68705)", MACHINE_SUPPORTS_SAVE ) // need to hook up 68705? (probably unused) -GAME( 1989, midresbj, midres, midresb, midresb, dec0_state, midresb, ROT0, "bootleg", "Midnight Resistance (Joystick bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ffantasybl, hippodrm, ffantasybl, ffantasybl, dec0_state, ffantasybl, ROT0, "bootleg", "Fighting Fantasy (bootleg with 68705)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 68705 not dumped, might be the same as midresb -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) +GAME( 1989, midresb, midres, midresb, midresb, dec0_state, midresb, ROT0, "bootleg", "Midnight Resistance (bootleg with 68705)", MACHINE_SUPPORTS_SAVE ) // need to hook up 68705? (probably unused) +GAME( 1989, midresbj, midres, midresbj, midresb, dec0_state, midresb, ROT0, "bootleg", "Midnight Resistance (Joystick bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ffantasybl, hippodrm, ffantasybl, ffantasybl, dec0_state, ffantasybl, ROT0, "bootleg", "Fighting Fantasy (bootleg with 68705)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 68705 not dumped, might be the same as midresb +GAME( 1988, drgninjab2, baddudes, drgninjab, drgninja, dec0_state, drgninja, 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_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // sound rom / music from section z with mods for ADPCM? diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index 09d80fa33b4..a1696f126a6 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -457,7 +457,7 @@ void deco32_state::deco32_set_audio_output(uint8_t raw_data) // TODO: assume linear with a 0.0-1.0 dB scale for now uint8_t raw_vol = 0xff - raw_data; float vol_output = ((float)raw_vol) / 255.0f; - + m_ym2151->set_output_gain(ALL_OUTPUTS, vol_output); m_oki1->set_output_gain(ALL_OUTPUTS, vol_output); m_oki2->set_output_gain(ALL_OUTPUTS, vol_output); @@ -734,8 +734,8 @@ WRITE32_MEMBER(deco32_state::nslasher_eeprom_w) pri_w(space,0,data&0x3,0xffffffff); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */ } - -// popmessage("%08x",data); + +// popmessage("%08x",data); if (ACCESSING_BITS_8_15) deco32_set_audio_output((data >> 8) & 0xff); } diff --git a/src/mame/drivers/ep64.cpp b/src/mame/drivers/ep64.cpp index a1b9c94f4c2..f094b9dba0d 100644 --- a/src/mame/drivers/ep64.cpp +++ b/src/mame/drivers/ep64.cpp @@ -151,7 +151,7 @@ Notes: (All IC's shown) #include "emu.h" #include "softlist.h" -#include "audio/dave.h" +#include "sound/dave.h" #include "bus/rs232/rs232.h" #include "bus/ep64/exp.h" #include "cpu/z80/z80.h" diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp index 4c108332c09..c07d0c42c7d 100644 --- a/src/mame/drivers/equites.cpp +++ b/src/mame/drivers/equites.cpp @@ -781,7 +781,7 @@ static INPUT_PORTS_START( gekisou ) PORT_START("IN1") PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Settings") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE ) // settings PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) diff --git a/src/mame/drivers/esd16.cpp b/src/mame/drivers/esd16.cpp index 75483cb0372..5dad197c838 100644 --- a/src/mame/drivers/esd16.cpp +++ b/src/mame/drivers/esd16.cpp @@ -23,6 +23,7 @@ Year + Game PCB Notes 98 Multi Champ ESD 11-09-98 (also a year 1999 revision) 99 Multi Champ Deluxe ESD 08-26-1999 (also a year 2000 revision) 99 Head Panic ESD 05-28-99 (All English version, copyright 1999) +99 Head Panic ESD 06-10-1999 (All English version, copyright 1999) 00 Head Panic ESD 08-26-1999 (All English version, copyright 2000) 00 Head Panic ESD 08-26-1999 (with Fuuki, Story in Japanese) 00 Deluxe 5 ESD (no date is marked on PCB) @@ -1026,7 +1027,7 @@ Notes: 2x pushbutton -ESD 08-26-1999 +ESD 08-26-1999 (ESD 06-10-1999 nearly identical) |-----------------------------------------| | 3014 3812 6116 6295 ESD4 | |VOL ESD3 Z80 * | @@ -1121,6 +1122,33 @@ ROM_START( hedpanicf ) /* Story line in Japanese, game instructions in English * ROM_END +ROM_START( hedpanica ) /* Story line & game instructions in English, copyright year is 1999 - ESD 06-10-1999 PCB */ + ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "esd12.cu03", 0x000000, 0x040000, CRC(deb7e0a0) SHA1(ef3a00e9bfdffd7c89326ad97a261f9a7b9863ae) ) /* CU03 */ + ROM_LOAD16_BYTE( "esd11.cu02", 0x000001, 0x040000, CRC(e1418f23) SHA1(39f14172d9b1a0d47edfe2456362fddc22f60066) ) /* CU02 */ + + ROM_REGION( 0x40000, "audiocpu", 0 ) /* Z80 Code */ + ROM_LOAD( "esd3.su06", 0x00000, 0x40000, CRC(a88d4424) SHA1(eefb5ac79632931a36f360713c482cd079891f91) ) /* AT27C020 mask rom */ + + ROM_REGION( 0x600000, "spr", 0 ) /* Sprites, 16x16x5 */ + ROM_LOAD( "ju04", 0x200000, 0x200000, CRC(4f3503d7) SHA1(4bed795c7328e0ebfa97688918eb8a908c29deb8) ) + ROM_LOAD( "ju06", 0x000000, 0x200000, CRC(9f6f6193) SHA1(c7c7ae6898ab7177eefb0e525d827666e2af9f7e) ) + /* expand this to take up 0x200000 bytes too so we can decode it */ + ROM_LOAD16_BYTE( "esd5.bin", 0x400000, 0x080000, CRC(6968265a) SHA1(84b4f2d8b3bf6ea4117fa8281c76b58df778261d) ) /* JU07 */ + ROM_FILL( 0x500000, 0x100000, 0x00 ) + + ROM_REGION( 0x400000, "bgs", 0 ) /* Layers, 16x16x8 */ + ROM_LOAD16_BYTE( "fu35", 0x000000, 0x200000, CRC(9b5a45c5) SHA1(fbd8bc6ccc068d2cc7fe4f575fa0847f53e786ab) ) + ROM_LOAD16_BYTE( "fu34", 0x000001, 0x200000, CRC(8f2099cc) SHA1(40795ae5fb8de613c2d5b6147992c153695bf698) ) + + ROM_REGION( 0x80000, "oki", 0 ) /* Samples */ + ROM_LOAD( "esd4.bin", 0x000000, 0x080000, CRC(5692fe92) SHA1(4423039cb437ab36d198b212ef394bf1704be404) ) /* SU10 */ + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) + ROM_LOAD( "hedpanic.nv", 0x0000, 0x0080, CRC(e91f4038) SHA1(f492de71170900f87912a272ab4f4a3a37ba31fe) ) +ROM_END + + ROM_START( hedpanico ) /* Story line & game instructions in English, copyright year is 1999 - ESD 05-28-99 PCB which uses older style sprites */ ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ ROM_LOAD16_BYTE( "esd2.rom", 0x000000, 0x040000, CRC(70b08424) SHA1(2ba4fb3b749e31db4239a9173b8509366400152f) ) /* CU03 */ @@ -1600,6 +1628,9 @@ GAME( 2001, jumppope, jumppop, jumppop, jumppop, driver_device, 0, ROT0, "Ema /* ESD 05-28-99 */ GAME( 1999, hedpanico,hedpanic, hedpanio, hedpanic, driver_device, 0, ROT0, "ESD", "Head Panic (ver. 0615, 15/06/1999)", MACHINE_SUPPORTS_SAVE ) +/* ESD 06-10-1999 */ +GAME( 1999, hedpanica,hedpanic, hedpanic, hedpanic, driver_device, 0, ROT0, "ESD", "Head Panic (ver. 0702, 02/07/1999)", MACHINE_SUPPORTS_SAVE ) + /* ESD 08-26-1999 */ GAME( 2000, mchampdx, 0, mchampdx, hedpanic, driver_device, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 0106, 06/01/2000)", MACHINE_SUPPORTS_SAVE ) GAME( 1999, mchampdxa,mchampdx, mchampdx, hedpanic, driver_device, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 1126, 26/11/1999)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/exidy.cpp b/src/mame/drivers/exidy.cpp index f9c22dedd0d..4edd6d74aec 100644 --- a/src/mame/drivers/exidy.cpp +++ b/src/mame/drivers/exidy.cpp @@ -1118,6 +1118,31 @@ ROM_START( mtrap ) ROM_END +ROM_START( mtrap2 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "mtl-2.11a", 0xa000, 0x1000, CRC(a8cc3a18) SHA1(09fa9eff5ae5cb923d6e9137ba9a4b6944acffb2) ) + ROM_LOAD( "mtl-2.10a", 0xb000, 0x1000, CRC(e26b074c) SHA1(e8882edc818860d887c08e8083a40c4717412b2f) ) + ROM_LOAD( "mtl-2.9a", 0xc000, 0x1000, CRC(845394f6) SHA1(a150a6f00465abb787d8d46a2e32d8985364554e) ) + ROM_LOAD( "mtl-2.8a", 0xd000, 0x1000, CRC(854d2d50) SHA1(4213999acbc03ee8300b2fcf86349cd7450adae5) ) + ROM_LOAD( "mtl-2.7a", 0xe000, 0x1000, CRC(3d235f95) SHA1(57031d9784c55853dcf6e396ee685d8dd0d3ef87) ) + ROM_LOAD( "mtl-2.6a", 0xf000, 0x1000, CRC(7ed7632a) SHA1(6800d3c1b901808373d3edd2a3fcf699f93d7daf) ) + + ROM_REGION( 0x8000, "audiocpu", 0 ) + ROM_LOAD( "mta5a.bin", 0x6800, 0x0800, CRC(dbe4ec02) SHA1(34e965428dbb4b9c558927bb80d19cb550b53228) ) + ROM_LOAD( "mta6a.bin", 0x7000, 0x0800, CRC(c00f0c05) SHA1(398b0bc2a7e54b1e2326ed067bf6bb15cc52ed39) ) + ROM_LOAD( "mta7a.bin", 0x7800, 0x0800, CRC(f3f16ca7) SHA1(3928c5da246c43036a7b4cbb140a1734d5f1fb03) ) + + ROM_REGION( 0x4000, "cvsdcpu", 0 ) /* 16k for digital sound processor */ + ROM_LOAD( "mta2a.bin", 0x0000, 0x1000, CRC(13db8ed3) SHA1(939352323bdcd7df25db5eb2e30f269bcaebe6af) ) + ROM_LOAD( "mta3a.bin", 0x1000, 0x1000, CRC(31bdfe5c) SHA1(b10bfe9e56dd617c5b4cd8b5bfec9c7f537b1086) ) + ROM_LOAD( "mta4a.bin", 0x2000, 0x1000, CRC(1502d0e8) SHA1(8ef51ad4601299016f1821a5c65bec0199dd5474) ) + ROM_LOAD( "mta1a.bin", 0x3000, 0x1000, CRC(658482a6) SHA1(c0d770fbeaa7cb3e0eef47d8caa0f8a78841692e) ) + + ROM_REGION( 0x0800, "gfx1", 0 ) + ROM_LOAD( "mtl11d.bin", 0x0000, 0x0800, CRC(c6e4d339) SHA1(b091923e4d52e93d7c567afba217a10b2a3735fc) ) +ROM_END + + ROM_START( mtrap3 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "mtl-3.11a", 0xa000, 0x1000, CRC(4091be6e) SHA1(a4432f4588915276583f4b2e8db527fd24eb4291) ) @@ -1566,6 +1591,7 @@ GAME( 1980, phantoma, spectar, rallys, phantoma, exidy_state, phantoma, ROT0, GAME( 1980, phantom, spectar, rallys, phantoma, exidy_state, phantoma, ROT0, "bootleg (Proel)", "Phantom (bootleg of Spectar)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1981, mtrap, 0, mtrap, mtrap, exidy_state, mtrap, ROT0, "Exidy", "Mouse Trap (version 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, mtrap2, mtrap, mtrap, mtrap, exidy_state, mtrap, ROT0, "Exidy", "Mouse Trap (version 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, mtrap3, mtrap, mtrap, mtrap, exidy_state, mtrap, ROT0, "Exidy", "Mouse Trap (version 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, mtrap4, mtrap, mtrap, mtrap, exidy_state, mtrap, ROT0, "Exidy", "Mouse Trap (version 4)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, mtrapb, mtrap, mtrap, mtrap, exidy_state, mtrap, ROT0, "bootleg", "Mouse Trap (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/fccpu20.cpp b/src/mame/drivers/fccpu20.cpp index 5d951b25216..95d930fbe19 100644 --- a/src/mame/drivers/fccpu20.cpp +++ b/src/mame/drivers/fccpu20.cpp @@ -2,67 +2,50 @@ // copyright-holders:Joakim Larsson Edstrom /*************************************************************************** * - * Force SYS68K CPU-20 VME SBC drivers - * - * 24/12/2016 - * - * Thanks to Al Kossow and his site http://www.bitsavers.org/ I got the information - * required to start the work with this driver. - * - * - * || - * || || CPU-20 - * ||||--||_____________________________________________________________ - * ||||--|| | - * || || _ |__ - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | |VME| - * || | | | - * || | |P1 | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || |_| | - * || |___| - * || | - * || | - * || | - * || | - * || | - * || | - * || | - * || | - * || |___ - * || _| | - * || | | | - * || | | | - * || | | | - * || | | | - * || | |VME| - * || | | | - * || | |P2 | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || | | | - * || |_| | - * || |___| - * || || + - * ||||--|| | - * ||||--||--------------------------------------------------------------+ - * || + * Force SYS68K CPU-20 and CPU-21 VME SBC drivers + * + * The only purpose of this driver is to be able to start the VME board as + * a single board computer and not as a slot device. It allows the board to + * have a layout and number of other goodies as board driver too but the chassi + * emulated here is really imaginary representing any chassi that provides power + * and used without any other VME board installed. + * + * This board occupies two mechanical slots but is only using one slot. + * + * If you want to combine multiple VME boards there are a few multi VME slot chassi + * board drivers which will allow you to do that, such as the 'miniforce' driver. + * + * +=============================+ + * | CPU-20 | SYS68K/PWR-09A | + * | | | + * | RST | | + * | ABT |O +5v | + * | |O +12v | + * |O RUN O RUN|O -12v | + * |O HLT |O ON | + * |O BM | | + * | | | + * |O FLM O SL0| | + * |O EPR O SL1| | + * |O 2WS | +-------+ | + * |O 4WS | | o |PWR | + * |O 6WS | | | | + * |O 8WS | +-------+ | + * |O12WS | | + * |O14WS | | + * | | | + * | CSH | | + * | R/M | | + * | | | + * | o | | + * | o | | + * | o | | + * | o | | + * | RS232/422 | | + * | P4 P3 | | + * | | | + * |SLOT1| 1U | | + * +=============================+ * * History of Force Computers *--------------------------- @@ -70,113 +53,33 @@ * * Misc links about Force Computes and this board: *------------------------------------------------ - * http://bitsavers.org/pdf/forceComputers/ - * - * Description(s) - * ------------- - * CPU-20 has the following feature set: - * - 68020 CPU with l6.7MHz Clock Frequency - * - 68881 Floating Point Coprocessor with l6.7MHz Clock Frequency - * - Static RAM 5l2Kbyte with 55ns access time - * - 5l2Kbyte (max) of ROM/EPROM for the system - * - 2 RS232 Multi Protocol Communication Interfaces (110-38400 Baud) - * - Parallel Interface and Timer Chip provides local control and timer function - * - VMXbus Primary Master Interface to p2 connector - * - Local Interrupt handling via interrupt vectors - * - Each VMEbus IRQ level can be enabled/disabled via software - * - Address range for the short I/O address modifies (AM4) - * - Address range for the standard address modifier - * - Single level bus arbiter - * - One level slave bus arbitration - * - Power monitor - * - RESET and SOFTWARE ABORT function switches - * - Fully VMEbus, VMXbus and IEEE Pl~14 compatible - * - * Address Map - * -------------------------------------------------------------------------- - * Range Decscription - * -------------------------------------------------------------------------- -Basadressen av I / O-enheter: - * 00000000-0xxFFFFF Shared DRAM D8-D32 - * 0yy00000-FAFFFFFF VME A32 D8-D32 yy=xx+1 - * FB000000-FBFEFFFF VME A24 D8-D32 - * FBFF0000-FBFFFFFF VME A16 D8-D32 - * FC000000-FCFEFFFF VME A24 D8-D16 - * FCFF0000-FCFFFFFF VME A16 D8-D16 - * FF800800 BIM - * FF800C00 PIT - * FF800000 MPCC - * FF800A00 RTC - * -------------------------------------------------------------------------- - * - * PIT #1 hardware wiring - * ---------------------------------------------------------- - * PA0-PA3 TBC - * PA4-PA7 - * H1-H4 - * PB0-PB2 - * PB3-PB4 - * PB5 - * PB6-PB7 - * PC0,PC1 - * PC4,PC7 - * PC2 - * PC3 - * PC5 - * PC6 - * - * PIT #2 hardware setup wiring - * ---------------------------------------------------------- - * PA0-PA7 TBC - * H1-H4 - * PB0-PB2 - * PB3-PB7 - * PC0-PC1 - * PC2 - * PC3 - * PC4 - * PC5 - * PC6 - * PC7 + * See the CPU-20 slot device code in vme_fccpu20.cpp * *--------------------------------------------------------------------------- * TODO: - * - Find accurate documentation and adjust memory map - * - Add layout - * - Write & add 68561 UART - * - Add 68230 PIT - * - Add variants of boards in the CPU-20 and CPU-21 family - * - Add FGA, DUSCC devices and CPU-22 variants - * + * - Add front layout ****************************************************************************/ #include "emu.h" -#include "cpu/m68000/m68000.h" #include "bus/vme/vme.h" -#include "bus/vme/vme_fcisio.h" -#include "bus/vme/vme_fcscsi.h" -#include "bus/rs232/rs232.h" -#include "machine/68230pit.h" -#include "machine/68153bim.h" -#include "machine/clock.h" +#include "bus/vme/vme_fccpu20.h" -#define LOG_GENERAL 0x01 -#define LOG_SETUP 0x02 -#define LOG_PRINTF 0x04 -#define LOG_INT 0x08 +//************************************************************************** +// CONFIGURABLE LOGGING +//************************************************************************** -#define VERBOSE 0 // (LOG_PRINTF | LOG_SETUP | LOG_GENERAL | LOG_INT) +#define LOG_GENERAL (1U << 0) +#define LOG_SETUP (1U << 1) -#define LOGMASK(mask, ...) do { if (VERBOSE & mask) logerror(__VA_ARGS__); } while (0) -#define LOGLEVEL(mask, level, ...) do { if ((VERBOSE & mask) >= level) logerror(__VA_ARGS__); } while (0) +//#define VERBOSE (LOG_GENERAL | LOG_SETUP) +//#define LOG_OUTPUT_FUNC printf +#include "logmacro.h" -#define LOG(...) LOGMASK(LOG_GENERAL, __VA_ARGS__) -#define LOGSETUP(...) LOGMASK(LOG_SETUP, __VA_ARGS__) -#define LOGINT(...) LOGMASK(LOG_INT, __VA_ARGS__) +#define LOGSETUP(...) LOGMASKED(LOG_SETUP, __VA_ARGS__) -#if VERBOSE & LOG_PRINTF -#define logerror printf -#endif +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** #ifdef _MSC_VER #define FUNCNAME __func__ @@ -188,204 +91,104 @@ class cpu20_state : public driver_device { public: cpu20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device (mconfig, type, tag) - , m_maincpu (*this, "maincpu") - , m_pit (*this, "pit") - , m_bim (*this, "bim") + : driver_device (mconfig, type, tag) { } - DECLARE_READ32_MEMBER (bootvect_r); - DECLARE_WRITE32_MEMBER (bootvect_w); - - DECLARE_WRITE_LINE_MEMBER(bim_irq_callback); - uint8_t bim_irq_state; - int bim_irq_level; - - virtual void machine_start () override; - virtual void machine_reset () override; -private: - required_device<m68000_base_device> m_maincpu; - required_device<pit68230_device> m_pit; - required_device<bim68153_device> m_bim; - - // Pointer to System ROMs needed by bootvect_r and masking RAM buffer for post reset accesses - uint32_t *m_sysrom; - uint32_t m_sysram[2]; - void update_irq_to_maincpu(); + DECLARE_DRIVER_INIT(cpu21s) { LOGSETUP("%s\n", FUNCNAME); } + DECLARE_DRIVER_INIT(cpu21) { LOGSETUP("%s\n", FUNCNAME); } + DECLARE_DRIVER_INIT(cpu21a) { LOGSETUP("%s\n", FUNCNAME); } + DECLARE_DRIVER_INIT(cpu21ya) { LOGSETUP("%s\n", FUNCNAME); } + DECLARE_DRIVER_INIT(cpu21b) { LOGSETUP("%s\n", FUNCNAME); } + DECLARE_DRIVER_INIT(cpu21yb) { LOGSETUP("%s\n", FUNCNAME); } }; -/* -*/ -static ADDRESS_MAP_START (cpu20_mem, AS_PROGRAM, 32, cpu20_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0x00000000, 0x00000007) AM_ROM AM_READ (bootvect_r) /* ROM mirror just during reset */ - AM_RANGE (0x00000000, 0x00000007) AM_RAM AM_WRITE (bootvect_w) /* After first write we act as RAM */ - AM_RANGE (0x00000008, 0x003fffff) AM_RAM /* RAM installed in machine start */ - AM_RANGE (0xff040000, 0xff04ffff) AM_RAM /* RAM installed in machine start */ - AM_RANGE (0xff000000, 0xff00ffff) AM_ROM AM_REGION("roms", 0x0000) -// AM_RANGE (0xff800000, 0xff80000f) AM_DEVREADWRITE8("mpcc", mpcc68561_device, read, write, 0x00ff00ff) -// AM_RANGE (0xff800200, 0xff80020f) AM_DEVREADWRITE8("pit2", pit68230_device, read, write, 0xff00ff00) - AM_RANGE (0xff800800, 0xff80080f) AM_DEVREADWRITE8("bim", bim68153_device, read, write, 0xff00ff00) -// AM_RANGE (0xff800a00, 0xff800a0f) AM_DEVREADWRITE8("rtc", rtc_device, read, write, 0x00ff00ff) - AM_RANGE (0xff800c00, 0xff800dff) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0xffffffff) -ADDRESS_MAP_END - /* Input ports */ static INPUT_PORTS_START (cpu20) INPUT_PORTS_END -/* Start it up */ -void cpu20_state::machine_start () -{ - LOGSETUP("%s\n", FUNCNAME); - - save_pointer (NAME (m_sysrom), sizeof(m_sysrom)); - save_pointer (NAME (m_sysram), sizeof(m_sysram)); - - /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ - m_sysrom = (uint32_t*)(memregion ("roms")->base()); -} - -void cpu20_state::machine_reset () -{ - LOGSETUP("%s\n", FUNCNAME); +/* Slot interfaces */ +static SLOT_INTERFACE_START(cpu20_vme_cards) + SLOT_INTERFACE("fccpu20", VME_FCCPU20) +SLOT_INTERFACE_END - /* Reset pointer to bootvector in ROM for bootvector handler bootvect_r */ - if (m_sysrom == &m_sysram[0]) /* Condition needed because memory map is not setup first time */ - m_sysrom = (uint32_t*)(memregion ("roms")->base()); -} +static SLOT_INTERFACE_START(cpu21s_vme_cards) + SLOT_INTERFACE("fccpu21s", VME_FCCPU21S) +SLOT_INTERFACE_END -#if 0 -/* setup board ID */ -DRIVER_INIT_MEMBER( cpu20_state, cpu20x ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20xa ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20za ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20zbe ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20be8 ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20be16 ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20lite4 ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu20lite8 ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x50; } -DRIVER_INIT_MEMBER( cpu20_state, cpu33 ) { LOGSETUP("%s\n", FUNCNAME); m_board_id = 0x68; } // 0x60 skips FGA prompt -#endif +static SLOT_INTERFACE_START(cpu21_vme_cards) + SLOT_INTERFACE("fccpu21", VME_FCCPU21) +SLOT_INTERFACE_END -/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xff800000 to 0x0 at reset*/ -READ32_MEMBER (cpu20_state::bootvect_r){ - LOG("%s\n", FUNCNAME); - return m_sysrom[offset]; -} +static SLOT_INTERFACE_START(cpu21a_vme_cards) + SLOT_INTERFACE("fccpu21a", VME_FCCPU21A) +SLOT_INTERFACE_END -WRITE32_MEMBER (cpu20_state::bootvect_w){ - LOG("%s\n", FUNCNAME); - m_sysram[offset % sizeof(m_sysram)] &= ~mem_mask; - m_sysram[offset % sizeof(m_sysram)] |= (data & mem_mask); - m_sysrom = &m_sysram[0]; // redirect all upcomming accesses to masking RAM until reset. -} +static SLOT_INTERFACE_START(cpu21ya_vme_cards) + SLOT_INTERFACE("fccpu21ya", VME_FCCPU21YA) +SLOT_INTERFACE_END -WRITE_LINE_MEMBER(cpu20_state::bim_irq_callback) -{ - LOGINT("%s(%02x)\n", FUNCNAME, state); +static SLOT_INTERFACE_START(cpu21b_vme_cards) + SLOT_INTERFACE("fccpu21b", VME_FCCPU21B) +SLOT_INTERFACE_END - bim_irq_state = state; - bim_irq_level = m_bim->get_irq_level(); - LOGINT(" - BIM irq level %02x\n", bim_irq_level); - update_irq_to_maincpu(); -} +static SLOT_INTERFACE_START(cpu21yb_vme_cards) + SLOT_INTERFACE("fccpu21yb", VME_FCCPU21YB) +SLOT_INTERFACE_END -void cpu20_state::update_irq_to_maincpu() -{ - LOGINT("%s()\n", FUNCNAME); - LOGINT(" - bim_irq_level: %02x\n", bim_irq_level); - LOGINT(" - bim_irq_state: %02x\n", bim_irq_state); - switch (bim_irq_level & 0x07) - { - case 1: m_maincpu->set_input_line(M68K_IRQ_1, bim_irq_state); break; - case 2: m_maincpu->set_input_line(M68K_IRQ_2, bim_irq_state); break; - case 3: m_maincpu->set_input_line(M68K_IRQ_3, bim_irq_state); break; - case 4: m_maincpu->set_input_line(M68K_IRQ_4, bim_irq_state); break; - case 5: m_maincpu->set_input_line(M68K_IRQ_5, bim_irq_state); break; - case 6: m_maincpu->set_input_line(M68K_IRQ_6, bim_irq_state); break; - case 7: m_maincpu->set_input_line(M68K_IRQ_7, bim_irq_state); break; - default: logerror("Programmatic error in %s, please report\n", FUNCNAME); - } -} +/* Machine configurations */ +MACHINE_CONFIG_START (cpu20, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu20_vme_cards, "fccpu20") +MACHINE_CONFIG_END -static SLOT_INTERFACE_START(fccpu20_vme_cards) - SLOT_INTERFACE("fcisio", VME_FCISIO1) - SLOT_INTERFACE("fcscsi", VME_FCSCSI1) -SLOT_INTERFACE_END +MACHINE_CONFIG_START (cpu21s, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21s_vme_cards, "fccpu21s") +MACHINE_CONFIG_END -/* - * Machine configuration - */ -static MACHINE_CONFIG_START (cpu20, cpu20_state) - /* basic machine hardware */ - MCFG_CPU_ADD ("maincpu", M68020, XTAL_16MHz) /* Crytstal not verified */ - MCFG_CPU_PROGRAM_MAP (cpu20_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("bim", bim68153_device, iack) +MACHINE_CONFIG_START (cpu21, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21_vme_cards, "fccpu21") +MACHINE_CONFIG_END +MACHINE_CONFIG_START (cpu21a, cpu20_state) MCFG_VME_DEVICE_ADD("vme") - MCFG_VME_SLOT_ADD ("vme", "slot1", fccpu20_vme_cards, nullptr) + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21a_vme_cards, "fccpu21a") +MACHINE_CONFIG_END - /* PIT Parallel Interface and Timer device, assumed strapped for on board clock */ - MCFG_DEVICE_ADD ("pit", PIT68230, XTAL_8_664MHz) - MCFG_PIT68230_TIMER_IRQ_CB(DEVWRITELINE("bim", bim68153_device, int2_w)) +MACHINE_CONFIG_START (cpu21ya, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21ya_vme_cards, "fccpu21ya") +MACHINE_CONFIG_END -// MCFG_DEVICE_ADD ("pit2", PIT68230, XTAL_8_664MHz) +MACHINE_CONFIG_START (cpu21b, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21b_vme_cards, "fccpu21b") +MACHINE_CONFIG_END - MCFG_MC68153_ADD("bim", XTAL_16MHz / 2) - MCFG_BIM68153_OUT_INT_CB(WRITELINE(cpu20_state, bim_irq_callback)) - /*INT0 - Abort switch */ - /*INT1 - MPCC@8.064 MHz aswell */ - /*INT2 - PI/T timer */ - /*INT3 - SYSFAIL/IRQVMX/ACFAIL/MPCC2/3 */ +MACHINE_CONFIG_START (cpu21yb, cpu20_state) + MCFG_VME_DEVICE_ADD("vme") + MCFG_VME_SLOT_ADD ("vme", "slot1", cpu21yb_vme_cards, "fccpu21yb") MACHINE_CONFIG_END -/* ROM definitions */ -ROM_START (fccpu20) /* This is an original rom dump */ - ROM_REGION32_BE(0x10000, "roms", 0) -// Boots with Board ID set to: 0x36 (FGA002 BOOT on terminal P4, "Wait until harddisk is up to speed " on terminal P1) - ROM_LOAD32_BYTE("L.BIN", 0x000002, 0x4000, CRC (174ab801) SHA1 (0d7b8ed29d5fdd4bd2073005008120c5f20128dd)) - ROM_LOAD32_BYTE("LL.BIN", 0x000003, 0x4000, CRC (9fd9e3e4) SHA1 (e5a7c87021e6be412dd5a8166d9f62b681169eda)) - ROM_LOAD32_BYTE("U.BIN", 0x000001, 0x4000, CRC (d1afe4c0) SHA1 (b5baf9798d73632f7bb843cbc4b306c8c03f4296)) - ROM_LOAD32_BYTE("UU.BIN", 0x000000, 0x4000, CRC (b54d623b) SHA1 (49b272184a04570b09004de71fae0ed0d1bf5929)) -ROM_END +/* ROM configurations */ +ROM_START(fccpu20sbc) ROM_END -/* - * System ROM information - * - * xxxxxxx bootprom version xxx is released mmm dd, yyyy, coprighted by FORCE Computers Gmbh - * - * BIM setup: (reordered for improved reading) - * : 0 Reg vector <- 1f - * : 1 Reg vector <- 1c - * : 2 Reg vector <- 1d - * : 3 Reg vector <- 1c - * : 0 Reg control <- 57 - Lev:7 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 - * : 1 Reg control <- 54 - Lev:4 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 - * : 2 Reg control <- 55 - Lev:5 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 - * : 3 Reg control <- 54 - Lev:4 Auto Disable:0 Int Enable:1 Vector:0 Auto Clear:1 Flag:0 - * - * PIT setup: - * :pit Reg 0a -> 00 - * :pit Reg 00 <- 30 - PGCR - Mode 0, H34:enabled, H12:enabled, Sense assert H4:Lo, H3:Lo, H2:Lo, H1:Lo - * :pit Reg 01 <- 08 - PSSR - PC4 pin activated, PC5 pin support no interrupts, H prio mode:0 - * :pit Reg 06 <- 84 - PACR - * :pit Reg 02 <- 00 - PADDR: 00 - * :pit Reg 07 <- 84 - PBCR - * :pit Reg 09 <- ff - PBDR - * :pit Reg 03 <- ff - PBDDR: ff - * :pit Reg 0c <- 07 - PCDR - * :pit Reg 04 <- 87 - PCDDR: 87 - * :pit Reg 15 <- d8 - CPRL - * :pit Reg 14 <- 09 - CPRM - * :pit Reg 13 <- 00 - CPRH - * :pit Reg 10 <- e1 - TCR - PC3 used as TOUT and PC7 used as I/O pin, Interrupts enabled - - PC2 used as I/O pin,CLK and x32 prescaler are used - - Timer reload the preload values when reaching 0 (zero) - - Timer is enabled - */ +/* Boards supported by same rom set, need to do like this to avoid need for multi named rom sets */ +#define rom_fccpu21ssbc rom_fccpu20sbc +#define rom_fccpu21sbc rom_fccpu20sbc +#define rom_fccpu21asbc rom_fccpu20sbc +#define rom_fccpu21yasbc rom_fccpu20sbc +#define rom_fccpu21bsbc rom_fccpu20sbc +#define rom_fccpu21ybsbc rom_fccpu20sbc /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP (1986, fccpu20, 0, 0, cpu20, cpu20, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP (1986, fccpu20sbc, 0, 0, cpu20, cpu20, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-20", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21ssbc, fccpu20sbc, 0, cpu21s, cpu20, cpu20_state, cpu21s, "Force Computers Gmbh", "SYS68K/CPU-21S", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21sbc, fccpu20sbc, 0, cpu21, cpu20, cpu20_state, cpu21, "Force Computers Gmbh", "SYS68K/CPU-21", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21asbc, fccpu20sbc, 0, cpu21a, cpu20, cpu20_state, cpu21a, "Force Computers Gmbh", "SYS68K/CPU-21A", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21yasbc, fccpu20sbc, 0, cpu21ya, cpu20, cpu20_state, cpu21ya, "Force Computers Gmbh", "SYS68K/CPU-21YA", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21bsbc, fccpu20sbc, 0, cpu21b, cpu20, cpu20_state, cpu21b, "Force Computers Gmbh", "SYS68K/CPU-21B", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +COMP (1986, fccpu21ybsbc, fccpu20sbc, 0, cpu21yb, cpu20, cpu20_state, cpu21yb, "Force Computers Gmbh", "SYS68K/CPU-21YB", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) diff --git a/src/mame/drivers/fccpu30.cpp b/src/mame/drivers/fccpu30.cpp index 33ea2d70ce7..35540290f72 100644 --- a/src/mame/drivers/fccpu30.cpp +++ b/src/mame/drivers/fccpu30.cpp @@ -70,6 +70,14 @@ * * History of Force Computers *--------------------------- + * 1981 Force Computers was founded in San Jose, California. Over time a European headquarter was opened + * in Munich, Germany, and a Japanese headquarter in Tokyo + * 1996 Force was aquired by Solectron Corporation in 1996 + * 2004 Force was sold off from Solectron to Motorola + * 2008 Force was aquired by Emerson as part of the Motorola Embedded Division + * 2016 Force was aquired by Platinum Equity as part of the Emerson Network Power Division + * + * Force developed and produced VME board products based on SPARC, Pentium, PowerPC and 68K. * * Misc links about Force Computes and this board: *------------------------------------------------ @@ -636,7 +644,7 @@ void cpu30_state::update_irq_to_maincpu() static SLOT_INTERFACE_START(fccpu30_vme_cards) SLOT_INTERFACE("fcisio", VME_FCISIO1) SLOT_INTERFACE("fcscsi", VME_FCSCSI1) -SLOT_INTERFACE_END +SLOT_INTERFACE_END /* * Machine configuration diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp index 08b725beed3..b7d10af30f3 100644 --- a/src/mame/drivers/fidel6502.cpp +++ b/src/mame/drivers/fidel6502.cpp @@ -235,7 +235,7 @@ CPU is a R65C02P4, running at 4MHz NE556 dual-timer IC: - timer#1, one-shot at power-on, to CPU _RESET -- timer#2: R1=82K+50K pot at 26K, R2=1K, C=22nf, to CPU _IRQ: ~596Hz, active low=15.25us +- timer#2: R1=82K+50K pot at 26K, R2=1K, C=22nF, to CPU _IRQ: ~596Hz, active low=15.25us Memory map: ----------- @@ -383,8 +383,7 @@ I/O is via TTL, very similar to Designer Display ******************************************************************************/ -#include "emu.h" -#include "includes/fidelz80.h" +#include "includes/fidelbase.h" #include "cpu/m6502/m6502.h" #include "cpu/m6502/r65c02.h" #include "cpu/m6502/m65sc02.h" @@ -409,11 +408,11 @@ I/O is via TTL, very similar to Designer Display #include "fidel_su9.lh" // clickable -class fidel6502_state : public fidelz80base_state +class fidel6502_state : public fidelbase_state { public: fidel6502_state(const machine_config &mconfig, device_type type, const char *tag) - : fidelz80base_state(mconfig, type, tag), + : fidelbase_state(mconfig, type, tag), m_ppi8255(*this, "ppi8255"), m_cart(*this, "cartslot") { } @@ -535,7 +534,7 @@ WRITE8_MEMBER(fidel6502_state::csc_pia0_pb_w) READ8_MEMBER(fidel6502_state::csc_pia0_pb_r) { // d2: printer? - uint8_t data = 0x04; + u8 data = 0x04; // d3: TSI BUSY line if (m_speech->busy_r()) @@ -679,7 +678,7 @@ WRITE8_MEMBER(fidel6502_state::eas_ppi_portc_w) READ8_MEMBER(fidel6502_state::eas_ppi_portb_r) { // d0: printer? white wire from LED pcb - uint8_t data = 1; + u8 data = 1; // d1: TSI BUSY line data |= (m_speech->busy_r()) ? 2 : 0; @@ -712,7 +711,7 @@ WRITE8_MEMBER(fidel6502_state::sc9_control_w) { // d0-d3: 74245 P0-P3 // 74245 Q0-Q8: input mux, led select - uint16_t sel = 1 << (data & 0xf) & 0x3ff; + u16 sel = 1 << (data & 0xf) & 0x3ff; m_inp_mux = sel & 0x1ff; sc9_prepare_display(); @@ -748,7 +747,7 @@ WRITE8_MEMBER(fidel6502_state::sc12_control_w) { // d0-d3: 7442 a0-a3 // 7442 0-8: led data, input mux - uint16_t sel = 1 << (data & 0xf) & 0x3ff; + u16 sel = 1 << (data & 0xf) & 0x3ff; m_inp_mux = sel & 0x1ff; // 7442 9: speaker out @@ -803,24 +802,24 @@ READ8_MEMBER(fidel6502_state::fexcelv_speech_r) WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) { // a0-a2,d0: 74259(1) - uint8_t mask = 1 << offset; + u8 mask = 1 << offset; m_led_select = (m_led_select & ~mask) | ((data & 1) ? mask : 0); // 74259 Q0-Q3: 7442 a0-a3 // 7442 0-8: led data, input mux - uint16_t sel = 1 << (m_led_select & 0xf) & 0x3ff; - uint8_t led_data = sel & 0xff; + u16 sel = 1 << (m_led_select & 0xf) & 0x3ff; + u8 led_data = sel & 0xff; m_inp_mux = sel & 0x1ff; // 7442 9: speaker out m_dac->write(BIT(sel, 9)); // 74259 Q4-Q7,Q2,Q1: digit/led select (active low) - uint8_t led_sel = ~BITSWAP8(m_led_select,0,3,1,2,7,6,5,4) & 0x3f; + u8 led_sel = ~BITSWAP8(m_led_select,0,3,1,2,7,6,5,4) & 0x3f; // a0-a2,d1: digit segment data (model 6093) m_7seg_data = (m_7seg_data & ~mask) | ((data & 2) ? mask : 0); - uint8_t seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); + u8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); // update display: 4 7seg leds, 2*8 chessboard leds for (int i = 0; i < 6; i++) @@ -850,7 +849,7 @@ WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w) READ8_MEMBER(fidel6502_state::fexcelb_ttl_r) { // a0-a2,d6: from speech board: language switches and TSI BUSY line, otherwise tied to VCC - uint8_t d6 = (m_inp_matrix[9].read_safe(0xff) >> offset & 1) ? 0x40 : 0; + u8 d6 = (m_inp_matrix[9].read_safe(0xff) >> offset & 1) ? 0x40 : 0; // a0-a2,d7: multiplexed inputs (active low) return d6 | ((read_inputs(9) >> offset & 1) ? 0 : 0x80); @@ -858,7 +857,7 @@ READ8_MEMBER(fidel6502_state::fexcelb_ttl_r) READ8_MEMBER(fidel6502_state::fexcel_ttl_r) { - uint8_t d7 = 0x80; + u8 d7 = 0x80; // 74259(1) Q7 + 74251 I0: battery status if (m_inp_mux == 1 && ~m_led_select & 0x80) @@ -878,15 +877,15 @@ READ8_MEMBER(fidel6502_state::fexcel_ttl_r) WRITE8_MEMBER(fidel6502_state::fdesdis_control_w) { - uint8_t q3_old = m_led_select & 8; + u8 q3_old = m_led_select & 8; // a0-a2,d7: 74259 - uint8_t mask = 1 << offset; + u8 mask = 1 << offset; m_led_select = (m_led_select & ~mask) | ((data & 0x80) ? mask : 0); // 74259 Q4-Q7: 7442 a0-a3 // 7442 0-8: led data, input mux - uint16_t sel = 1 << (m_led_select >> 4 & 0xf) & 0x3ff; + u16 sel = 1 << (m_led_select >> 4 & 0xf) & 0x3ff; m_inp_mux = sel & 0x1ff; // 7442 9: speaker out @@ -913,7 +912,7 @@ WRITE8_MEMBER(fidel6502_state::fdesdis_control_w) WRITE8_MEMBER(fidel6502_state::fdesdis_lcd_w) { // a0-a2,d0-d3: 4*74259 to lcd digit segments - uint32_t mask = BITSWAP8(1 << offset,3,7,6,0,1,2,4,5); + u32 mask = BITSWAP8(1 << offset,3,7,6,0,1,2,4,5); for (int i = 0; i < 4; i++) { m_7seg_data = (m_7seg_data & ~mask) | ((data >> i & 1) ? 0 : mask); @@ -943,12 +942,12 @@ DRIVER_INIT_MEMBER(fidel6502_state, fdesdis) WRITE8_MEMBER(fidel6502_state::chesster_control_w) { // a0-a2,d7: 74259(1) - uint8_t mask = 1 << offset; + u8 mask = 1 << offset; m_led_select = (m_led_select & ~mask) | ((data & 0x80) ? mask : 0); // 74259 Q4-Q7: 7442 a0-a3 // 7442 0-8: led data, input mux - uint16_t sel = 1 << (m_led_select >> 4 & 0xf) & 0x3ff; + u16 sel = 1 << (m_led_select >> 4 & 0xf) & 0x3ff; m_inp_mux = sel & 0x1ff; // 74259 Q0,Q1: led select (active low) @@ -1554,7 +1553,7 @@ static MACHINE_CONFIG_START( rsc, fidel6502_state ) MCFG_PIA_CA2_HANDLER(WRITELINE(fidel6502_state, csc_pia1_ca2_w)) MCFG_PIA_CB2_HANDLER(WRITELINE(fidel6502_state, csc_pia1_cb2_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_rsc_v2) /* sound hardware */ @@ -1569,7 +1568,7 @@ static MACHINE_CONFIG_START( csc, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6502, 3900000/2) // from 3.9MHz resonator MCFG_CPU_PROGRAM_MAP(csc_map) - MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, irq0_line_hold, 600) // 38400kHz/64 + MCFG_CPU_PERIODIC_INT_DRIVER(fidel6502_state, irq0_line_hold, 600) // 38400kHz/64 MCFG_DEVICE_ADD("pia0", PIA6821, 0) MCFG_PIA_READPB_HANDLER(READ8(fidel6502_state, csc_pia0_pb_r)) @@ -1586,7 +1585,7 @@ static MACHINE_CONFIG_START( csc, fidel6502_state ) MCFG_PIA_CA2_HANDLER(WRITELINE(fidel6502_state, csc_pia1_ca2_w)) MCFG_PIA_CB2_HANDLER(WRITELINE(fidel6502_state, csc_pia1_cb2_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_csc) /* sound hardware */ @@ -1614,7 +1613,7 @@ static MACHINE_CONFIG_START( eas, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", R65C02, XTAL_3MHz) MCFG_CPU_PROGRAM_MAP(eas_map) - MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, irq0_line_hold, 600) // guessed + MCFG_CPU_PERIODIC_INT_DRIVER(fidel6502_state, irq0_line_hold, 600) // guessed MCFG_DEVICE_ADD("ppi8255", I8255, 0) // port B: input, port A & C: output MCFG_I8255_OUT_PORTA_CB(WRITE8(fidel6502_state, eas_ppi_porta_w)) @@ -1623,7 +1622,7 @@ static MACHINE_CONFIG_START( eas, fidel6502_state ) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_eas) /* sound hardware */ @@ -1639,7 +1638,7 @@ static MACHINE_CONFIG_START( eas, fidel6502_state ) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) + MCFG_GENERIC_LOAD(fidelbase_state, scc_cartridge) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END @@ -1648,7 +1647,7 @@ static MACHINE_CONFIG_DERIVED( eag, eas ) /* basic machine hardware */ MCFG_CPU_REPLACE("maincpu", R65C02, XTAL_5MHz) // R65C02P4 MCFG_CPU_PROGRAM_MAP(eag_map) - MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, irq0_line_hold, 600) // guessed + MCFG_CPU_PERIODIC_INT_DRIVER(fidel6502_state, irq0_line_hold, 600) // guessed MCFG_DEFAULT_LAYOUT(layout_fidel_eag) MACHINE_CONFIG_END @@ -1658,11 +1657,11 @@ static MACHINE_CONFIG_START( sc9, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6502, 1400000) // from ceramic resonator "681 JSA", measured MCFG_CPU_PROGRAM_MAP(sc9_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(610)) // from 555 timer (22nf, 102K, 2.7K) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(610)) // from 555 timer (22nF, 102K, 2.7K) MCFG_TIMER_START_DELAY(attotime::from_hz(610) - attotime::from_usec(41)) // active for 41us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(610)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_sc9) /* sound hardware */ @@ -1674,7 +1673,7 @@ static MACHINE_CONFIG_START( sc9, fidel6502_state ) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) + MCFG_GENERIC_LOAD(fidelbase_state, scc_cartridge) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END @@ -1699,11 +1698,11 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", R65C02, XTAL_4MHz) MCFG_CPU_PROGRAM_MAP(sc12_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(596)) // from 556 timer (22nf, 82K+26K, 1K) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(596)) // from 556 timer (22nF, 82K+26K, 1K) MCFG_TIMER_START_DELAY(attotime::from_hz(596) - attotime::from_nsec(15250)) // active for 15.25us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(596)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_sc12) /* sound hardware */ @@ -1715,7 +1714,7 @@ static MACHINE_CONFIG_START( sc12, fidel6502_state ) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) + MCFG_GENERIC_LOAD(fidelbase_state, scc_cartridge) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END @@ -1724,11 +1723,11 @@ static MACHINE_CONFIG_START( fexcel, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M65SC02, XTAL_12MHz/4) // G65SC102P-3, 12.0M ceramic resonator MCFG_CPU_PROGRAM_MAP(fexcel_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(630)) // from 556 timer (22nf, 102K, 1K) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(630)) // from 556 timer (22nF, 102K, 1K) MCFG_TIMER_START_DELAY(attotime::from_hz(630) - attotime::from_nsec(15250)) // active for 15.25us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(630)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_ex) /* sound hardware */ @@ -1761,7 +1760,7 @@ static MACHINE_CONFIG_DERIVED( fdes2000, fexcel ) // change irq timer frequency MCFG_DEVICE_REMOVE("irq_on") MCFG_DEVICE_REMOVE("irq_off") - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(585)) // from 556 timer (22nf, 110K, 1K) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(585)) // from 556 timer (22nF, 110K, 1K) MCFG_TIMER_START_DELAY(attotime::from_hz(585) - attotime::from_nsec(15250)) // active for 15.25us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(585)) @@ -1787,11 +1786,11 @@ static MACHINE_CONFIG_START( fdes2100d, fidel6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M65C02, XTAL_6MHz) // W65C02P-6 MCFG_CPU_PROGRAM_MAP(fdesdis_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(630)) // from 556 timer (22nf, 102K, 1K) + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel6502_state, irq_on, attotime::from_hz(630)) // from 556 timer (22nF, 102K, 1K) MCFG_TIMER_START_DELAY(attotime::from_hz(630) - attotime::from_nsec(15250)) // active for 15.25us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(630)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_desdis) /* sound hardware */ @@ -1817,7 +1816,7 @@ static MACHINE_CONFIG_START( chesster, fidel6502_state ) MCFG_TIMER_START_DELAY(attotime::from_hz(9615) - attotime::from_nsec(2600)) // active for 2.6us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel6502_state, irq_off, attotime::from_hz(9615)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_chesster) /* sound hardware */ diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp index fd59a10968c..d0eff017227 100644 --- a/src/mame/drivers/fidel68k.cpp +++ b/src/mame/drivers/fidel68k.cpp @@ -153,8 +153,7 @@ B0000x-xxxxxx: see V7, -800000 ******************************************************************************/ -#include "emu.h" -#include "includes/fidelz80.h" +#include "includes/fidelbase.h" #include "cpu/m68000/m68000.h" #include "machine/ram.h" #include "machine/nvram.h" @@ -165,11 +164,11 @@ B0000x-xxxxxx: see V7, -800000 #include "fidel_eag_68k.lh" // clickable -class fidel68k_state : public fidelz80base_state +class fidel68k_state : public fidelbase_state { public: fidel68k_state(const machine_config &mconfig, device_type type, const char *tag) - : fidelz80base_state(mconfig, type, tag), + : fidelbase_state(mconfig, type, tag), m_ram(*this, "ram") { } @@ -203,7 +202,7 @@ public: WRITE8_MEMBER(fidel68k_state::fexcel68k_mux_w) { // a1-a3,d0: 74259 - uint8_t mask = 1 << offset; + u8 mask = 1 << offset; m_led_select = (m_led_select & ~mask) | ((data & 1) ? mask : 0); // 74259 Q0-Q3: 74145 A-D (Q4-Q7 N/C) @@ -222,7 +221,7 @@ void fidel68k_state::eag_prepare_display() { // Excel 68000: 4*7seg leds, 8*8 chessboard leds // EAG: 8*7seg leds(2 panels), (8+1)*8 chessboard leds - uint8_t seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); + u8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4); set_display_segmask(0x1ff, 0x7f); display_matrix(16, 9, m_led_data << 8 | seg_data, m_inp_mux); } @@ -258,7 +257,7 @@ WRITE8_MEMBER(fidel68k_state::eag_mux_w) // d0-d3: 74145 A-D // 74145 0-8: input mux, digit/led select // 74145 9: speaker out - uint16_t sel = 1 << (data & 0xf); + u16 sel = 1 << (data & 0xf); m_dac->write(BIT(sel, 9)); m_inp_mux = sel & 0x1ff; eag_prepare_display(); @@ -557,11 +556,11 @@ static MACHINE_CONFIG_START( fexcel68k, fidel68k_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) // HD68HC000P12 MCFG_CPU_PROGRAM_MAP(fexcel68k_map) - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel68k_state, irq_on, attotime::from_hz(618)) // theoretical frequency from 556 timer (22nf, 91K + 20K POT @ 14.8K, 0.1K), measurement was 580Hz + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_on", fidel68k_state, irq_on, attotime::from_hz(618)) // theoretical frequency from 556 timer (22nF, 91K + 20K POT @ 14.8K, 0.1K), measurement was 580Hz MCFG_TIMER_START_DELAY(attotime::from_hz(618) - attotime::from_nsec(1525)) // active for 1.525us MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_off", fidel68k_state, irq_off, attotime::from_hz(618)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_ex_68k) /* sound hardware */ @@ -582,7 +581,7 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_eag_68k) MCFG_RAM_ADD("ram") @@ -598,7 +597,7 @@ static MACHINE_CONFIG_START( eag, fidel68k_state ) /* cartridge */ MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fidel_scc") MCFG_GENERIC_EXTENSIONS("bin,dat") - MCFG_GENERIC_LOAD(fidelz80base_state, scc_cartridge) + MCFG_GENERIC_LOAD(fidelbase_state, scc_cartridge) MCFG_SOFTWARE_LIST_ADD("cart_list", "fidel_scc") MACHINE_CONFIG_END @@ -631,7 +630,7 @@ static MACHINE_CONFIG_DERIVED( eagv11, eagv7 ) MCFG_CPU_REPLACE("maincpu", M68EC040, XTAL_36MHz*2*2) // wrong! should be M68EC060 @ 72MHz MCFG_CPU_PROGRAM_MAP(eagv11_map) - MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, irq2_line_hold, 600) + MCFG_CPU_PERIODIC_INT_DRIVER(fidel68k_state, irq2_line_hold, 600) MCFG_DEVICE_REMOVE("irq_on") // 8.25us is too long MCFG_DEVICE_REMOVE("irq_off") MACHINE_CONFIG_END diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp index c468c229d32..6b15a1ee86d 100644 --- a/src/mame/drivers/fidelz80.cpp +++ b/src/mame/drivers/fidelz80.cpp @@ -489,8 +489,7 @@ expect that the software reads these once on startup only. ******************************************************************************/ -#include "emu.h" -#include "includes/fidelz80.h" +#include "includes/fidelbase.h" #include "cpu/z80/z80.h" #include "cpu/mcs48/mcs48.h" #include "machine/i8255.h" @@ -507,11 +506,11 @@ expect that the software reads these once on startup only. #include "fidel_vsc.lh" // clickable -class fidelz80_state : public fidelz80base_state +class fidelz80_state : public fidelbase_state { public: fidelz80_state(const machine_config &mconfig, device_type type, const char *tag) - : fidelz80base_state(mconfig, type, tag), + : fidelbase_state(mconfig, type, tag), m_mcu(*this, "mcu"), m_z80pio(*this, "z80pio"), m_ppi8255(*this, "ppi8255"), @@ -570,7 +569,7 @@ public: // machine start/reset -void fidelz80base_state::machine_start() +void fidelbase_state::machine_start() { // zerofill memset(m_display_state, 0, sizeof(m_display_state)); @@ -603,7 +602,7 @@ void fidelz80base_state::machine_start() save_item(NAME(m_speech_bank)); } -void fidelz80base_state::machine_reset() +void fidelbase_state::machine_reset() { } @@ -618,9 +617,9 @@ void fidelz80base_state::machine_reset() // The device may strobe the outputs very fast, it is unnoticeable to the user. // To prevent flickering here, we need to simulate a decay. -void fidelz80base_state::display_update() +void fidelbase_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -633,7 +632,7 @@ void fidelz80base_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -671,7 +670,7 @@ void fidelz80base_state::display_update() memcpy(m_display_cache, active_state, sizeof(m_display_cache)); } -TIMER_DEVICE_CALLBACK_MEMBER(fidelz80base_state::display_decay_tick) +TIMER_DEVICE_CALLBACK_MEMBER(fidelbase_state::display_decay_tick) { // slowly turn off unpowered segments for (int y = 0; y < m_display_maxy; y++) @@ -682,13 +681,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(fidelz80base_state::display_decay_tick) display_update(); } -void fidelz80base_state::set_display_size(int maxx, int maxy) +void fidelbase_state::set_display_size(int maxx, int maxy) { m_display_maxx = maxx; m_display_maxy = maxy; } -void fidelz80base_state::set_display_segmask(uint32_t digits, uint32_t mask) +void fidelbase_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -699,12 +698,12 @@ void fidelz80base_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void fidelz80base_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void fidelbase_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -715,9 +714,9 @@ void fidelz80base_state::display_matrix(int maxx, int maxy, uint32_t setx, uint3 // generic input handlers -uint16_t fidelz80base_state::read_inputs(int columns) +u16 fidelbase_state::read_inputs(int columns) { - uint16_t ret = 0; + u16 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -739,9 +738,9 @@ INPUT_CHANGED_MEMBER(fidelz80_state::reset_button) // cartridge -DEVICE_IMAGE_LOAD_MEMBER(fidelz80base_state, scc_cartridge) +DEVICE_IMAGE_LOAD_MEMBER(fidelbase_state, scc_cartridge) { - uint32_t size = m_cart->common_get_size("rom"); + u32 size = m_cart->common_get_size("rom"); // max size is 16KB? if (size > 0x4000) @@ -769,7 +768,7 @@ DEVICE_IMAGE_LOAD_MEMBER(fidelz80base_state, scc_cartridge) void fidelz80_state::vcc_prepare_display() { // 4 7seg leds (note: sel d0 for extra leds) - uint8_t outdata = (m_7seg_data & 0x7f) | (m_led_select << 7 & 0x80); + u8 outdata = (m_7seg_data & 0x7f) | (m_led_select << 7 & 0x80); set_display_segmask(0xf, 0x7f); display_matrix(8, 4, outdata, m_led_select >> 2 & 0xf); } @@ -836,7 +835,7 @@ WRITE8_MEMBER(fidelz80_state::vcc_ppi_portb_w) READ8_MEMBER(fidelz80_state::vcc_ppi_portc_r) { // d0-d3: multiplexed inputs (active low), also language switches - uint8_t lan = (~m_led_select & 0x40) ? m_inp_matrix[4]->read() : 0; + u8 lan = (~m_led_select & 0x40) ? m_inp_matrix[4]->read() : 0; return ~(lan | read_inputs(4)) & 0xf; } @@ -879,7 +878,7 @@ WRITE8_MEMBER(fidelz80_state::cc10_ppi_porta_w) WRITE8_MEMBER(fidelz80_state::bcc_control_w) { // a0-a2,d7: digit segment data via NE591, Q7 is speaker out - uint8_t mask = 1 << (offset & 7); + u8 mask = 1 << (offset & 7); m_7seg_data = (m_7seg_data & ~mask) | ((data & 0x80) ? mask : 0); m_dac->write(BIT(m_7seg_data, 7)); @@ -951,7 +950,7 @@ READ8_MEMBER(fidelz80_state::vsc_pio_porta_r) READ8_MEMBER(fidelz80_state::vsc_pio_portb_r) { - uint8_t data = 0; + u8 data = 0; // d4: TSI BUSY line data |= (m_speech->busy_r()) ? 0 : 0x10; @@ -987,7 +986,7 @@ WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w) void fidelz80_state::vbrc_prepare_display() { // 14seg led segments, d15 is extra led, d14 is unused (tone on prototype?) - uint16_t outdata = BITSWAP16(m_7seg_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8); + u16 outdata = BITSWAP16(m_7seg_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8); set_display_segmask(0xff, 0x3fff); display_matrix(16, 8, outdata, m_led_select); } @@ -1093,7 +1092,7 @@ ADDRESS_MAP_END // VSC io: A2 is 8255 _CE, A3 is Z80 PIO _CE - in theory, both chips can be accessed simultaneously READ8_MEMBER(fidelz80_state::vsc_io_trampoline_r) { - uint8_t data = 0xff; // open bus + u8 data = 0xff; // open bus if (~offset & 4) data &= m_ppi8255->read(space, offset & 3); if (~offset & 8) @@ -1452,7 +1451,7 @@ static MACHINE_CONFIG_START( bcc, fidelz80_state ) MCFG_CPU_PROGRAM_MAP(bcc_map) MCFG_CPU_IO_MAP(bcc_io) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_bcc) /* sound hardware */ @@ -1476,7 +1475,7 @@ static MACHINE_CONFIG_START( cc10, fidelz80_state ) MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, vcc_ppi_portc_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, vcc_ppi_portc_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_cc) /* sound hardware */ @@ -1500,7 +1499,7 @@ static MACHINE_CONFIG_START( vcc, fidelz80_state ) MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, vcc_ppi_portc_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, vcc_ppi_portc_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_vcc) MCFG_MACHINE_START_OVERRIDE(fidelz80_state,vcc) @@ -1518,7 +1517,7 @@ static MACHINE_CONFIG_START( vsc, fidelz80_state ) MCFG_CPU_ADD("maincpu", Z80, 3900000) // 3.9MHz resonator MCFG_CPU_PROGRAM_MAP(vsc_map) MCFG_CPU_IO_MAP(vsc_io) - MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80base_state, nmi_line_pulse, 600) // 555 timer, approx 600hz + MCFG_CPU_PERIODIC_INT_DRIVER(fidelz80_state, nmi_line_pulse, 600) // 555 timer, approx 600hz MCFG_DEVICE_ADD("ppi8255", I8255, 0) MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, vsc_ppi_porta_w)) @@ -1530,7 +1529,7 @@ static MACHINE_CONFIG_START( vsc, fidelz80_state ) MCFG_Z80PIO_IN_PB_CB(READ8(fidelz80_state, vsc_pio_portb_r)) MCFG_Z80PIO_OUT_PB_CB(WRITE8(fidelz80_state, vsc_pio_portb_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_vsc) /* sound hardware */ @@ -1553,7 +1552,7 @@ static MACHINE_CONFIG_START( vbrc, fidelz80_state ) MCFG_I8243_ADD("i8243", NOOP, WRITE8(fidelz80_state, vbrc_ioexp_port_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelz80base_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", fidelbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_fidel_vbrc) /* sound hardware */ diff --git a/src/mame/drivers/firetrk.cpp b/src/mame/drivers/firetrk.cpp index 6faf9916048..7a465d04edd 100644 --- a/src/mame/drivers/firetrk.cpp +++ b/src/mame/drivers/firetrk.cpp @@ -434,7 +434,7 @@ static INPUT_PORTS_START( firetrk ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet )) PORT_DIPSETTING( 0x00, "Smokey Joe (1 Player)" ) PORT_DIPSETTING( 0x40, "Fire Truck (2 Players)" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("Diag Hold") PORT_START("BIT_7") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -444,7 +444,7 @@ static INPUT_PORTS_START( firetrk ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diag Step") PORT_START("HORN") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, firetrk_state,firetrk_horn_changed, 0) diff --git a/src/mame/drivers/fromance.cpp b/src/mame/drivers/fromance.cpp index 758d9b36602..6c52c93ab69 100644 --- a/src/mame/drivers/fromance.cpp +++ b/src/mame/drivers/fromance.cpp @@ -37,9 +37,9 @@ Memo: - 2player's input is not supported. -- Identify CRT Controller and fix layer misalignment in nekkyoku due of dynamic - changes. Actually same custom component as other V-System games of the era, - @seealso aerofgt.cpp +- Identify CRT Controller and fix layer misalignment in nekkyoku due of dynamic + changes. Actually same custom component as other V-System games of the era, + @seealso aerofgt.cpp - nekkyoku: soft reset enables flip screen without any real reason. diff --git a/src/mame/drivers/funkball.cpp b/src/mame/drivers/funkball.cpp index 2fd5f95a6b8..e5fcdf890fd 100644 --- a/src/mame/drivers/funkball.cpp +++ b/src/mame/drivers/funkball.cpp @@ -227,13 +227,7 @@ READ8_MEMBER( funkball_state::serial_r ) WRITE8_MEMBER( funkball_state::serial_w ) { if(offset == 0) - { - // TODO: hack, main CPU sends a CR only here, actually expecting Windows-style newline. - if(data == 0x0d) - m_terminal->write(space,0,0x0a); - else - m_terminal->write(space,0,data); - } + m_terminal->write(space,0,data); } uint8_t funkball_state::funkball_config_reg_r() diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp index e79f7e6966e..0aab16424f3 100644 --- a/src/mame/drivers/funworld.cpp +++ b/src/mame/drivers/funworld.cpp @@ -5289,12 +5289,15 @@ ROM_END Power Card (Fun World) Version 0263 / 1993-10-22 - Amatic encrypted CPU - based on 65SC02 (bitwise) family + Amatic encrypted CPU based on 65SC02 (bitwise) family, + with the following components inside: - Looks like a Bonus Card / Big Deal clone. - Inside the program ROM there is a reference to "Mega Card", - but the graphics are from Power Card. + 1x CY7C291A (prom replacement). + 1x 65SC02 (CPU). + 1x TI74F245A (3-state octal latch from Texas Instruments). + 1x 7400 (quad 2-input NAND gate). + + (Same as Mega Card CPU) PCB Layout... @@ -5368,12 +5371,20 @@ ROM_END '---------------' 1 2 3 4 5 6 7 8 + + Looks like a Bonus Card / Big Deal clone. + Inside the program ROM there is a reference to "Mega Card", + but the graphics are from Power Card. + */ ROM_START( powercrd ) ROM_REGION( 0x10000, "maincpu", 0 ) /* need proper decryption */ ROM_LOAD( "263a1.bin", 0x8000, 0x8000, CRC(9e5e477d) SHA1(428464a64bea8cb478bc8033859baa47d7de0297) ) /* just the 2nd half */ ROM_LOAD( "263a2.bin", 0x4000, 0x8000, CRC(11b1a13f) SHA1(766c1a45c238467d6a292795f5a159187966ceec) ) /* just the 2nd half */ + ROM_REGION( 0x0800, "decode", 0 ) /* from the CY7C291A inside of the custom CPU */ + ROM_LOAD( "powercrd_cy7c291a.bin", 0x0000, 0x0800, CRC(f1d8f35d) SHA1(2b5f9222a81a627d43fd8448385f85c71c24b914) ) /* new dump */ + ROM_REGION( 0x10000, "gfx1", 0 ) ROM_LOAD( "power_c_zg2.ic11", 0x0000, 0x8000, CRC(108380bb) SHA1(922beffe3c06f391239125e6f4ccc86ec6980c45) ) ROM_LOAD( "power_c_zg1.ic10", 0x8000, 0x8000, CRC(dc9e70c6) SHA1(7ac5bdc734d9829ea6349b60817445cb88d7387c) ) @@ -5386,6 +5397,143 @@ ROM_START( powercrd ) ROM_END +/* + + Mega Card (MC3). + Ver. 0210. + Fun World, 1993. + + Encrypted poker game. + + 1x Custom encrypted Fun World CPU based on 65SC02 (Same as Power Card). + 1x GM68B45S CRTC. + 2x EF6821P PIAs. + 1x AY38910A. + 2x ULN2003AN (out). + 1x PAL16L8ACN (PLD). + 1x Maxim MAX690CPA (Microprocessor Supervisory Circuits). + + RAM: + 1x GoldStar GM76C28-10. + 1x KM6264BL-10. + + ROM: + 4x 27C256 (two for program, two for GFX). + 1x N82S147AN bipolar PROM. + + Other: + + 1x 16MHz Xtal. + 1x 8 DIP switches bank. + 1x 3V. CR2025 lithium battery. + + 1X 17x2 Pin male connector. + 1X 22x2 Pin edge connector. + 1X 8x2 Pin edge connector. + + + + PCB layout: + + .----------------------------------------------------------------------------------------------------------------------. + | | + | .--------. .--------. .-------. | + | | | .------------. | | | | | + | | | | GD74LS157 | | | | | .---. '---. + | | | '------------' |Goldstar| | | | | .---. 8 ---| + | |GOLDSTAR| | | | | |ULN| | | ---| + | | | .------------. |GM76C28 | | | |200| |74L| P ---| + | | | | GD74LS157 | | -10 | | | |3AN| |S04| I ---| + | |GM68B45S| '------------' | | |AY38910| | | |P | N ---| + | | | | | |A/P | | | | | ---| + | | | .------------. | | .-------------------------------------. | | '---' | | C ---| + | | | | GD74LS157 | | | |## ooooooooooooooooooooooooooooooo ##| | | '---' O ---| + | | | '------------' | | |## ooooooooooooooooooooooooooooooo ##| | | N ---| + | | | '--------' '-------------------------------------' | | .---. N ---| + | | | .------------. | | | | ---| + | | | | GD74LS157 | .--------------. .--------------. | | |ULN| .---' + | | | '------------' | PAL16L8ACN | | EMPTY SOCKET | | | |200| | + | | | '--------------' '--------------' | | |3AN| | + | | | .------------------. .-----. .--------------------------------. | | | | | + | '--------' | | |XTAL | |Lfnd. Nr: 0057 | '-------' '---' | + | | KM6264BL-10 | |16.00| |Type: 'F' | .-------. | + | .-------------. | | |0MHz | |Datum: 17.3.93 | | | | + | | GD74LS245 | | | | | | | | | | + | '-------------' '------------------' '-----' | FUN WORLD | | | '---. + | | | | | ---| + | .-------------. .------------. '--------------------------------' | | ---| + | | HD74LS374P | | HD74LS374P | |EF6821P| ---| + | '-------------' '------------' .---. .---. .--------------------. | | ---| + | |GD7| |GD7| | | | | ---| + |.--------------------. .----------. |4LS| |4LS| | EMPTY SOCKET | | | .---. ---| + ||MEGA | |74LS194AN | |368| |245| | | | | | 8| ---| + ||ZG 1 | '----------' |A | | | | | | | | | ---| + || 27C256| | | | | '--------------------' | | | | 22 ---| + || IC10| .----------. '---' | | | | |DIP| ---| + |'--------------------' |74LS194AN | | | .--------------------. | | | | P ---| + | '----------' | | |MEGA MC 3 | | | | | I ---| + | '---' | 210/F/1 | | | | | N ---| + |.--------------------. .----------. | 27C256| | | | 1| ---| + ||MEGA | |74LS194AN | .---. .---. .---. | IC37| | | '---' C ---| + ||ZG 2 | '----------' |GD7| |MN7| |GD7| '--------------------' '-------' O ---| + || 27C256| |4LS| |4HC| |4LS| .-------. N ---| + || IC11| .----------. |393| |241| |139| .--------------------. | | N ---| + |'--------------------' |74LS194AN | | | | | | | |MEGA MC 3 | | | E ---| + | '----------' | | | | | | | 210/F/2 | | | C ---| + | '---' | | '---' | 27C256| | | T ---| + |.----------. .----------. | | | IC41| | | O ---| + ||GD74LS174 | |HD74LS02P | | | '--------------------' |EF6821P| R ---| + |'----------' '----------' '---' | | ---| + | ------- .---. | | ---| + |.---. .---. .---. .---. / CR-2025 \ |HD7| | | ---| + ||GD7| | | |HD7| |MAX| | LITHIUM | |4LS| | | ---| + ||4LS| |N82| |4LS| |690| | BATTERY | |02P| | | ---| + ||174| |S14| |374| '---' \ +3V. / | | | | ---| + || | |7AN| |P | Maxim ------- | | | | ---| + || | | | | | MAX690CPA '---' | | ---| + |'---' | | | | | | .---' + | | | | | | | | + | '---' '---' '-------' | + | | + '----------------------------------------------------------------------------------------------------------------------' + + + The encrypted CPU: + + It's a DIP40 custom IC. It has inside a PLCC28 IC and 3 dies: + + The PLCC28 chip is a CY7C291A (prom replacement) + DIE#1 is a TI74F245A, a 3-state octal latch from Texas Instruments. + DIE#2 is the CPU, a 65SC02. + DIE#3 is a 7400, a quad 2-input NAND gate. + + Is unknown how they are connected. + +*/ + +ROM_START( megacard ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* need proper decryption */ + ROM_LOAD( "mega_mc3_210-f-1.ic37", 0x8000, 0x8000, CRC(747f5ed1) SHA1(06757bb6a792dca93978b17b54c28e413e3720b1) ) /* just the 2nd half */ + ROM_LOAD( "mega_mc3_210-f-2.ic41", 0x4000, 0x8000, CRC(373094d2) SHA1(8aed2502e89b0e7522e88f351ac256f1afad7ee8) ) /* just the 2nd half */ + + ROM_REGION( 0x0300, "die_65sc02", 0 ) /* from the 65SC02 die inside of the custom CPU */ + ROM_LOAD( "gteu65decoderom.bin", 0x0000, 0x02f1, CRC(089af0c6) SHA1(0f46a73a7859a694a07ebe74d476fae80e57e329) ) + + ROM_REGION( 0x0800, "decode", 0 ) /* from the CY7C291A inside of the custom CPU */ + ROM_LOAD( "megacard_cy7291a.bin", 0x0000, 0x0800, CRC(596f01ac) SHA1(a8606a1dd385fbb46b1a96f11a759fa6580803d8) ) /* new dump */ + + ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_LOAD( "mega_zg2.ic11", 0x0000, 0x8000, CRC(0993d380) SHA1(e5e2386948fba2fb6b79339af27bd1d0f1e198ca) ) + ROM_LOAD( "mega_zg1.ic10", 0x8000, 0x8000, CRC(de2e2dd0) SHA1(17962d84838f39de41bc7a41d399fd18cd0bd5b7) ) + + ROM_REGION( 0x0200, "proms", 0 ) + ROM_LOAD( "n82s147an.bin", 0x0000, 0x0200, CRC(136245f3) SHA1(715309982fcafbce88b08237ca46acec31273938) ) + + ROM_REGION( 0x0200, "plds", 0 ) + ROM_LOAD( "megacard_pal16l8.bin", 0x0000, 0x0117, CRC(3159a548) SHA1(ad904fa35b78570e44323469967803e34ef4bc0c) ) +ROM_END + + /* (Multi) Joker Card from Vesely Svet (Sprightly World). Czech poker game. Program roms seems encrypted. Seems to be a Big Deal clone, running in Fun World Multi Win hardware. @@ -6764,7 +6912,6 @@ GAMEL( 1986, bonuscrd, 0, fw2ndpal, bonuscrd, driver_device, 0, GAMEL( 1986, bonuscrda, bonuscrd, fw2ndpal, bonuscrd, driver_device, 0, ROT0, "Fun World", "Bonus Card (Austrian, ATG Electronic hack)", MACHINE_IMPERFECT_COLORS, layout_bonuscrd ) // use fw1stpal machine for green background GAMEL( 1986, bigdeal, bonuscrd, fw2ndpal, bigdeal, driver_device, 0, ROT0, "Fun World", "Big Deal (Hungarian, set 1)", MACHINE_IMPERFECT_COLORS, layout_bonuscrd ) GAMEL( 1986, bigdealb, bonuscrd, fw2ndpal, bigdeal, driver_device, 0, ROT0, "Fun World", "Big Deal (Hungarian, set 2)", MACHINE_IMPERFECT_COLORS, layout_bonuscrd ) -GAME( 1993, powercrd, 0, fw2ndpal, funworld, driver_device, 0, ROT0, "Fun World", "Power Card (Ver 0263, encrypted)", MACHINE_NOT_WORKING ) // clone of Bonus Card. // CMC Italian jamma PCB's... GAMEL( 1996, cuoreuno, 0, cuoreuno, cuoreuno, driver_device, 0, ROT0, "C.M.C.", "Cuore 1 (Italian)", 0, layout_jollycrd ) @@ -6827,6 +6974,8 @@ GAMEL( 198?, jolyjokrc, jolyjokr, fw1stpal, funworld, driver_device, 0, // Encrypted games... GAME( 1992, multiwin, 0, fw1stpal, funworld, funworld_state, multiwin, ROT0, "Fun World", "Multi Win (Ver.0167, encrypted)", MACHINE_NOT_WORKING ) +GAME( 1993, powercrd, 0, fw2ndpal, funworld, driver_device, 0, ROT0, "Fun World", "Power Card (Ver 0263, encrypted)", MACHINE_NOT_WORKING ) // clone of Bonus Card. +GAME( 1993, megacard, 0, fw2ndpal, funworld, driver_device, 0, ROT0, "Fun World", "Mega Card (Ver.0210, encrypted)", MACHINE_NOT_WORKING ) GAME( 1993, jokercrd, 0, fw2ndpal, funworld, driver_device, 0, ROT0, "Vesely Svet", "Joker Card (Ver.A267BC, encrypted)", MACHINE_NOT_WORKING ) GAME( 198?, saloon, 0, saloon, saloon, funworld_state, saloon, ROT0, "<unknown>", "Saloon (French, encrypted)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/gcpinbal.cpp b/src/mame/drivers/gcpinbal.cpp index a495ec75730..4ae33117ac7 100644 --- a/src/mame/drivers/gcpinbal.cpp +++ b/src/mame/drivers/gcpinbal.cpp @@ -23,8 +23,6 @@ TODO ---- - Screen flipping support - - Understand role of bit 5 of IN1 - - Hook up 93C46 EEPROM - Hook up ES-8712 - Sort out the IOC commands for the M6585 & ES-8712 - Is SW3 actually used? @@ -64,7 +62,7 @@ ES-9209B CPU: TMP68HC000P-16 Sound: OKI M6295 OKI M6585 - Ecxellent ES-8712 + Excellent ES-8712 OSC: 32MHz, 14.31818MHz & 1056kHz, 640kHz resonators RAM: Sony CXK5864BSP-10L 8K x 8bit high speed CMOS SRAM Alliance AS7C256-20PC 32K x 8bit CMOS SRAM @@ -189,8 +187,11 @@ WRITE16_MEMBER(gcpinbal_state::ioc_w) m_oki->set_rom_bank((data & 0x800) >> 11); break; + // 93C46 serial EEPROM (status read at D80087) case 0x45: - //m_adpcm_idle = 1; + m_eeprom->di_write(BIT(data >> 8, 2)); + m_eeprom->clk_write(BIT(data >> 8, 1)); + m_eeprom->cs_write(BIT(data >> 8, 0)); break; // OKIM6295 @@ -254,6 +255,8 @@ WRITE16_MEMBER(gcpinbal_state::ioc_w) /* Controlled through ioc? */ WRITE_LINE_MEMBER(gcpinbal_state::gcp_adpcm_int) { + if (!state) + return; if (m_adpcm_idle) m_msm->reset_w(1); if (m_adpcm_start >= 0x200000 || m_adpcm_start > m_adpcm_end) @@ -266,8 +269,8 @@ WRITE_LINE_MEMBER(gcpinbal_state::gcp_adpcm_int) { uint8_t *ROM = memregion("msm")->base(); - m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_start] & 0x0f) : (ROM[m_adpcm_start] & 0xf0) >> 4)); - m_msm->data_w(m_adpcm_data & 0xf); + m_adpcm_select->ab_w(ROM[m_adpcm_start]); + m_adpcm_select->select_w(m_adpcm_trigger); m_adpcm_trigger ^= 1; if (m_adpcm_trigger == 0) m_adpcm_start++; @@ -366,7 +369,7 @@ static INPUT_PORTS_START( gcpinbal ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) // This bit gets tested (search for d8 00 87) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -443,7 +446,6 @@ void gcpinbal_state::machine_start() save_item(NAME(m_adpcm_end)); save_item(NAME(m_adpcm_idle)); save_item(NAME(m_adpcm_trigger)); - save_item(NAME(m_adpcm_data)); } void gcpinbal_state::machine_reset() @@ -460,7 +462,6 @@ void gcpinbal_state::machine_reset() m_adpcm_start = 0; m_adpcm_end = 0; m_adpcm_trigger = 0; - m_adpcm_data = 0; m_bg0_gfxset = 0; m_bg1_gfxset = 0; m_msm_start = 0; @@ -475,6 +476,8 @@ static MACHINE_CONFIG_START( gcpinbal, gcpinbal_state ) MCFG_CPU_PROGRAM_MAP(gcpinbal_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", gcpinbal_state, gcpinbal_interrupt) + MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -497,6 +500,9 @@ static MACHINE_CONFIG_START( gcpinbal, gcpinbal_state ) MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) + MCFG_DEVICE_ADD("adpcm_select", HCT157, 0) + MCFG_74157_OUT_CB(DEVWRITE8("msm", msm6585_device, data_w)) + MCFG_SOUND_ADD("msm", MSM6585, XTAL_640kHz) MCFG_MSM6585_VCLK_CB(WRITELINE(gcpinbal_state, gcp_adpcm_int)) /* VCK function */ MCFG_MSM6585_PRESCALER_SELECTOR(MSM6585_S40) /* 16 kHz */ diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 451b249cb1c..b7f536f13a5 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -279,9 +279,9 @@ ROM_START( ms3 ) ROM_REGION( 0x200000, "snd", 0 ) ROM_LOAD( "1h5053xx.u6", 0x000000, 0x080000, CRC(6735c65a) SHA1(198cacec5441aa615c0de63a0b4e47265636bcee) ) - + ROM_REGION( 0x20000, "nvram", 0 ) - ROM_LOAD( "nvram", 0x000000, 0x020000, CRC(acbbc6d9) SHA1(6e86d24ad3793b41f1f23f80f9bdb22767abc3bf) ) + ROM_LOAD( "nvram", 0x000000, 0x020000, CRC(acbbc6d9) SHA1(6e86d24ad3793b41f1f23f80f9bdb22767abc3bf) ) ROM_END ROM_START( ms72c ) @@ -302,9 +302,9 @@ ROM_START( ms72c ) ROM_REGION( 0x200000, "snd", 0 ) ROM_LOAD( "1H5008FA Multistar 7.u6", 0x000000, 0x100000, CRC(69656637) SHA1(28c2cf48856ee4f820146fdbd0f3c7e307892dc6) ) - + ROM_REGION( 0x20000, "nvram", 0 ) - ROM_LOAD( "nvram", 0x000000, 0x020000, CRC(b5e42dbc) SHA1(f6afadb6877bca2cef40725b001c7918f9c99359) ) + ROM_LOAD( "nvram", 0x000000, 0x020000, CRC(b5e42dbc) SHA1(f6afadb6877bca2cef40725b001c7918f9c99359) ) ROM_END diff --git a/src/mame/drivers/gladiatr.cpp b/src/mame/drivers/gladiatr.cpp index 828fa447413..7b915a13739 100644 --- a/src/mame/drivers/gladiatr.cpp +++ b/src/mame/drivers/gladiatr.cpp @@ -270,22 +270,6 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_irq_patch_w) WRITE_LINE_MEMBER(gladiatr_state::tclk_w) { m_tclk_val = state != 0; - - // these are actually edge-triggered, but MAME only supports polled inputs - - u8 const new_in0_val(m_in0->read()); - if (BIT(~new_in0_val & (new_in0_val ^ m_in0_val), 5)) - m_cctl_p1 = (m_cctl_p1 & 0xfc) | BIT(~new_in0_val, 5) | (BIT(~new_in0_val, 5) << 1); - else - m_cctl_p1 = (m_cctl_p1 & 0xfe) | BIT(~new_in0_val, 5); - m_in0_val = new_in0_val; - - u8 const new_in1_val(m_in0->read()); - if (BIT(~new_in1_val & (new_in1_val ^ m_in1_val), 5)) - m_cctl_p2 = (m_cctl_p2 & 0xfc) | BIT(~new_in1_val, 5) | (BIT(~new_in1_val, 5) << 1); - else - m_cctl_p2 = (m_cctl_p2 & 0xfe) | BIT(~new_in1_val, 5); - m_in1_val = new_in1_val; } READ8_MEMBER(gladiatr_state::cctl_p1_r) @@ -370,6 +354,33 @@ READ8_MEMBER(gladiatr_state::csnd_p2_r) } +INPUT_CHANGED_MEMBER(gladiatr_state::p1_s1) +{ + // P11 gets the value of 1P-S2 at the moment 1P-S1 was pressed + if (oldval && !newval) + m_cctl_p1 = (m_cctl_p1 & 0xfd) | (BIT(m_cctl_p1, 0) << 1); +} + +INPUT_CHANGED_MEMBER(gladiatr_state::p1_s2) +{ + // P10 is high when 1P-S2 is pressed + m_cctl_p1 = (m_cctl_p1 & 0xfe) | (newval ? 0x00 : 0x01); +} + +INPUT_CHANGED_MEMBER(gladiatr_state::p2_s1) +{ + // P21 gets the value of 2P-S2 at the moment 2P-S1 was pressed + if (oldval && !newval) + m_cctl_p2 = (m_cctl_p2 & 0xfd) | (BIT(m_cctl_p2, 0) << 1); +} + +INPUT_CHANGED_MEMBER(gladiatr_state::p2_s2) +{ + // P20 is high when 2P-S2 is pressed + m_cctl_p2 = (m_cctl_p2 & 0xfe) | (newval ? 0x00 : 0x01); +} + + READ8_MEMBER(ppking_state::ppking_f1_r) { @@ -622,8 +633,8 @@ static INPUT_PORTS_START( gladiatr ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gladiatr_state, p1_s1, 0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gladiatr_state, p2_s2, 0) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) @@ -632,8 +643,8 @@ static INPUT_PORTS_START( gladiatr ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, gladiatr_state, p2_s1, 0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, gladiatr_state, p2_s2, 0) PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) // coin counter outputs PORT_START("IN2") // cctl p1 @@ -1143,16 +1154,12 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr) membank("bank2")->set_entry(0); m_tclk_val = false; - m_in0_val = 0xff; - m_in1_val = 0xff; m_cctl_p1 = 0xff; m_cctl_p2 = 0xff; m_ucpu_p1 = 0xff; m_csnd_p1 = 0xff; save_item(NAME(m_tclk_val)); - save_item(NAME(m_in0_val)); - save_item(NAME(m_in1_val)); save_item(NAME(m_cctl_p1)); save_item(NAME(m_cctl_p2)); save_item(NAME(m_ucpu_p1)); diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index bf75c1ca50f..173b04f54c1 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -922,8 +922,22 @@ ADDRESS_MAP_END /* need to check item by item... - PPIs are OK. - RAM/ROM are OK. + + PPIs are OK: + B800 = 9B (A, B, C, all input) + B810 = 9B (A, B, C, all input) + B820 = 90 (A input, B & C output) + + RAM/ROM/NVRAM are OK. + + Reels RAM and scroll are OK. + (only reel 2 seems to be used by the game) + + Video & atr RAM are OK. + + PSG is OK. + + AY8910 ports are OK. */ static ADDRESS_MAP_START( mbstar_map, AS_PROGRAM, 8, goldstar_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM @@ -4111,6 +4125,163 @@ static INPUT_PORTS_START( bingownga ) PORT_DIPSETTING( 0x28, "1 Coin/10 Credits" ) INPUT_PORTS_END +static INPUT_PORTS_START( mbstar ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("IN0-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_2) PORT_NAME("Increment top's 'S' (bet?)") // Increment top's 'S' (looks like bet) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("IN0-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("IN0-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_5) PORT_NAME("Collect") // Collect. Also used to blank the BK. + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6) PORT_NAME("IN0-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_7) PORT_NAME("Bookkeeping: Down") // BK: down. + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_8) PORT_NAME("Bookkeeping: Set/Enter - Start") // BK: enter. (start?) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) PORT_NAME("IN1-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) PORT_NAME("IN1-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) PORT_NAME("IN1-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) PORT_NAME("IN1-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_T) PORT_NAME("IN1-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) PORT_NAME("IN1-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U) PORT_NAME("IN1-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I) PORT_NAME("IN1-8") + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("IN2-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("IN2-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) PORT_NAME("IN2-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) PORT_NAME("IN2-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) PORT_NAME("IN2-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) PORT_NAME("IN2-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) PORT_NAME("IN2-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) PORT_NAME("IN2-8") + + PORT_START("IN3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("IN3-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("IN3-2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C) PORT_NAME("IN3-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_V) PORT_NAME("Coin 1") PORT_IMPULSE(2) // coin 1 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_B) PORT_NAME("Coin 2") PORT_IMPULSE(2) // coin 2 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_N) PORT_NAME("Note") // note acceptor + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_M) PORT_NAME("Remote") // remote credits + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_L) PORT_NAME("Coin 3 (tokens)") // coin 3 (tokens) + + PORT_START("IN4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("IN4-1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Operator Bookkeeping") // operator bookkeeping + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("IN4-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN4-4") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Payout") // payout? + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("IN4-6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("IN4-7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Supervisor Bookkeeping") // supervisor bookkeeping + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, "DSW1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "DSW2") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) // enter in a different mode, and no attract. + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) // seems to accellerate the different mode. + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW3") + PORT_DIPNAME( 0x01, 0x01, "DSW3") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW4") + PORT_DIPNAME( 0x01, 0x01, "DSW4") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + static INPUT_PORTS_START( magodds ) PORT_START("IN0") /* d800 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -11332,7 +11503,7 @@ ROM_END /* Mega Bonus Star II (Millennium Edition, Euro) Auto-Data Graz, 2002. - + W4 derivative hardware... PCB has a daughterboard with: @@ -11372,7 +11543,58 @@ ROM_END C: DM74LS374N D: DS1232 - + Unknown Zilog 40pin IC (scratched): + (could be either a Z86C15 or Z86C91 MCU) + + +-----V-----+ + VCC -|01 40|- 74LS08N (Pin 01) + XTAL 8MHz <-|02 39|- GAL16V8 (Pin 17) + XTAL 8MHz >-|03 Z 38|- 74LS374 (Pin 03) + N/C -|04 I 37|- 74LS374 (Pin 04) + N/C -|05 L 36|- 74LS374 (Pin 07) + 74LS08N (Pin 10) -|06 O 35|- 74LS374 (Pin 08) + GAL16V8 (Pin 07) -|07 G 34|- 74LS374 (Pin 13) + GAL16V8 (Pin 08) -|08 33|- 74LS374 (Pin 14) + 74LS374 (Pin 11) -|09 32|- 74LS374 (Pin 17) + N/C -|10 31|- 74LS374 (Pin 18) + GND -|11 30|- 74LS374 (Pin 01) + N/C -|12 29|- 74LS08N (Pin 02) + 27C512 (A08) -|13 28|- 27C512 (Q7) + 27C512 (A09) -|14 27|- 27C512 (Q6) + 27C512 (A10) -|15 26|- 27C512 (Q5) + 27C512 (A11) -|16 25|- 27C512 (Q4) + 27C512 (A12) -|17 24|- 27C512 (Q3) + 27C512 (A13) -|18 23|- 27C512 (Q2) + 27C512 (A14) -|19 22|- 27C512 (Q1) + 27C512 (A15) -|20 21|- 27C512 (Q0) + +-----------+ + + 40-Pin DIP Pin Identification for Z86C15 MCU (for reference): + + --------------------------------------------------------- + Pin Symbol Function Direction + --------------------------------------------------------- + 01 VCC Power Supply Input + 02 CLKOUT Z8 System Clock Output + 03 RCIN RC Oscillator Clock Input + 04 P37 Port 3, Pin 7 Output + 05 P30 Port 3, Pin 0 Input + 06 /RESET Reset Input + 07 AGND Analog Ground + 08 NC Not Connected + 09 /WDTOUT Watch-Dog Timer Output + 10 P35 Port 3, Pin 5 Output + 11 GND Ground + 12 P32 Port 3, Pin 2 Input + 13-20 P00-P07 Port 0, Pins 0,1,2,3,4,5,6,7 In/Output + 21-28 P10-P17 Port 1, Pins 0,1,2,3,4,5,6,7 In/Output + 29 P34 Port 3, Pin 4 Output + 30 P33 Port 3, Pin 3 Input + 31-38 P20-P27 Port 2, Pins 0,1,2,3,4,5,6,7 In/Output + 39 P31 Port 3, Pin 1 Input + 40 P36 Port 3, Pin 6 Output + --------------------------------------------------------- + BASE Board (based on WING W4): XTAL: 11.98135MHZ @@ -15826,7 +16048,7 @@ GAME( 1991, megaline, 0, megaline, megaline, driver_device, 0, GAMEL( 1993, bingowng, 0, bingowng, bingowng, driver_device, 0, ROT0, "Wing Co., Ltd.", "Bingo (set 1)", 0, layout_bingowng ) GAMEL( 1993, bingownga, bingowng, bingownga,bingownga,driver_device, 0, ROT0, "Wing Co., Ltd.", "Bingo (set 2)", 0, layout_bingowng ) -GAME( 2002, mbs2euro, 0, mbstar, lucky8, driver_device, 0, ROT0, "Auto-Data Graz", "Mega Bonus Star II (Euro, Millennium Edition)", MACHINE_NOT_WORKING ) // need more work in memory map, inputs, and reels alignment. +GAME( 2002, mbs2euro, 0, mbstar, mbstar, driver_device, 0, ROT0, "Auto-Data Graz", "Mega Bonus Star II (Euro, Millennium Edition)", MACHINE_NOT_WORKING ) // need more work in memory map, inputs, and reels alignment. // --- Flaming 7's hardware (W-4 derivative) --- diff --git a/src/mame/drivers/gts80.cpp b/src/mame/drivers/gts80.cpp index 09e1adc3500..bf6ec22fbcf 100644 --- a/src/mame/drivers/gts80.cpp +++ b/src/mame/drivers/gts80.cpp @@ -577,6 +577,17 @@ ROM_START(marspf) ROM_LOAD("f666-s2.snd", 0x7800, 0x0800, CRC(7bd64d94) SHA1(a52492820e69f2072fd1dffb5cbb48fb960e19ce)) ROM_END +ROM_START(marspp) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("u2_80.bin", 0x2000, 0x1000, CRC(4f0bc7b1) SHA1(612cbacdca5cfa6ad23940796df3b7c385be79fe)) + ROM_LOAD("u3_80.bin", 0x3000, 0x1000, CRC(1e69f9d0) SHA1(ad738cac2555830257b531e5e533b15362f624b9)) + ROM_LOAD("666s-1.cpu", 0x1000, 0x0800, CRC(029e0bcf) SHA1(20764464ede38bee2a726fc2ae98a60375b3cb1c)) + + ROM_REGION(0x10000, "r1sound:audiocpu", 0) + ROM_LOAD("666-s1.snd", 0x7000, 0x0800, CRC(d33dc8a5) SHA1(8d071c392996a74c3cdc2cf5ea3be3c86553ce89)) + ROM_LOAD("666-s2.snd", 0x7800, 0x0800, CRC(e5616f3e) SHA1(a6b5ebd0b456a555db0889cd63ce79aafc64dbe5)) +ROM_END + /*------------------------------------------------------------------- / Panthera #652 /-------------------------------------------------------------------*/ @@ -785,6 +796,7 @@ ROM_END /* cust */GAME(1981, pnkpnthr, 0, gts80_s, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Pink Panther", MACHINE_IS_SKELETON_MECHANICAL) /* disp1 */GAME(1981, marsp, 0, gts80_ss, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Mars - God of War", MACHINE_IS_SKELETON_MECHANICAL) /* disp1 */GAME(1981, marspf, marsp, gts80_ss, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Mars - God of War (French speech)", MACHINE_IS_SKELETON_MECHANICAL) +/* disp1 */GAME(1981, marspp, marsp, gts80_ss, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Mars - God of War (Prototype)", MACHINE_IS_SKELETON_MECHANICAL) /* disp1 */GAME(1981, vlcno_ax, 0, gts80_ss, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Volcano", MACHINE_IS_SKELETON_MECHANICAL) /* disp1 */GAME(1981, vlcno_1c, 0, gts80_s, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Volcano (Sound Only set 1)", MACHINE_IS_SKELETON_MECHANICAL) /* disp1 */GAME(1981, vlcno_1b, vlcno_1c, gts80_s, gts80, gts80_state, gts80, ROT0, "Gottlieb", "Volcano (Sound Only set 2)", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/gts80b.cpp b/src/mame/drivers/gts80b.cpp index fdd883cb3f2..9a0b2e58146 100644 --- a/src/mame/drivers/gts80b.cpp +++ b/src/mame/drivers/gts80b.cpp @@ -478,6 +478,19 @@ ROM_START(amazonh3) ROM_REGION(0x10000, "cpu2", ROMREGION_ERASEFF) ROM_END +ROM_START(amazonh3a) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("684d-1-cpu.rom", 0x2000, 0x2000, CRC(bf4674e1) SHA1(30974f89f9e4cbb61f8f620499ee6a64c9b7b31c)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("684d-snd.rom",0x8000,0x8000, CRC(a660f233) SHA1(3b80629696a2fd5aa4a86ed472e60c95d3cfa906)) + + ROM_REGION(0x10000, "cpu2", ROMREGION_ERASEFF) +ROM_END + /*------------------------------------------------------------------- / Arena (#709) /-------------------------------------------------------------------*/ @@ -519,6 +532,44 @@ ROM_START(arenaa) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(cc2aef4e) SHA1(a6e243de99f6a76eb527e879f4441c036dd379b6)) ROM_END +ROM_START(arenaf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(49b127d8) SHA1(0436f83e969b4bfc7edaf881bf7556a868c88cdc)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(391fb7de) SHA1(ec47a6e057d18a0043afccb694c23d0fa0d42aa0)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(78e6cbf1) SHA1(7b66a0cb211a93cf475172aa0465a952009e1a59)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(f7a951c2) SHA1(12d7a6119d9033ae02c6312c9af888bfc7c63ad1)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(cc2aef4e) SHA1(a6e243de99f6a76eb527e879f4441c036dd379b6)) +ROM_END + +ROM_START(arenag) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(e170d1cd) SHA1(bd7919eb9e480309f794ac25a371c7b818dcd01b)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(71fd6e48) SHA1(5c87ba79968085d386fd1357c9d8b2b7a745682a)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(78e6cbf1) SHA1(7b66a0cb211a93cf475172aa0465a952009e1a59)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(f7a951c2) SHA1(12d7a6119d9033ae02c6312c9af888bfc7c63ad1)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(cc2aef4e) SHA1(a6e243de99f6a76eb527e879f4441c036dd379b6)) +ROM_END + /*------------------------------------------------------------------- / Bad Girls (#717) /-------------------------------------------------------------------*/ @@ -540,6 +591,42 @@ ROM_START(badgirls) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(ab3b8e2d) SHA1(b57a0b804b42b923bb102d295e3b8a69b1033d27)) ROM_END +ROM_START(badgirlsf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(58c35099) SHA1(ff76bd28175ea0f5d0437c16c5ae6886339edfe2)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(9861147a) SHA1(e9d31cd1130bc1785db26c23f52944842fdd4ca0)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(452dec20) SHA1(a9c41dfb2d83c5671ab96e946f13df774b567976)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(ab3b8e2d) SHA1(b57a0b804b42b923bb102d295e3b8a69b1033d27)) +ROM_END + +ROM_START(badgirlsg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(55aa30ac) SHA1(9544485ccf52a2ad51a00cce0c12871db099699f)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(f2923255) SHA1(645b62d015e3a4feaf485c600eb345824f551b9e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(452dec20) SHA1(a9c41dfb2d83c5671ab96e946f13df774b567976)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(ab3b8e2d) SHA1(b57a0b804b42b923bb102d295e3b8a69b1033d27)) +ROM_END + /*------------------------------------------------------------------- / Big House (#713) /-------------------------------------------------------------------*/ @@ -561,6 +648,42 @@ ROM_START(bighouse) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0b1ba1cb) SHA1(26327689992018837b1c9957c515ab67248623eb)) ROM_END +ROM_START(bighousef) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(767efc44) SHA1(6b8f9a580e6a6ad92c9efe9f4345496d5063b7a8)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(b87150bc) SHA1(2ebdf27ede3445ac99068c8cec712c06e57c7ffc)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(f330fd04) SHA1(1288c47f636d9d5b826a2b870b81788a630e489e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0b1ba1cb) SHA1(26327689992018837b1c9957c515ab67248623eb)) +ROM_END + +ROM_START(bighouseg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(214f0afb) SHA1(9874773e4ffa2472e78d42dfa9e21a621bf7b49e)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(374f3593) SHA1(e90d867fff28ee86f017b1b638bc26f1bcde6b81)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(f330fd04) SHA1(1288c47f636d9d5b826a2b870b81788a630e489e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0b1ba1cb) SHA1(26327689992018837b1c9957c515ab67248623eb)) +ROM_END + /*------------------------------------------------------------------- / Bone Busters Inc. (#719) /-------------------------------------------------------------------*/ @@ -606,6 +729,27 @@ ROM_START(bonebstrf) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(a95eedfc) SHA1(5ced2d6869a9895f8ff26d830b21d3c9364b32e7)) ROM_END +ROM_START(bonebstrg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(3b85c8bd) SHA1(5c99349dc3ae05b82932d6ec9d2d1a29c2a7e36d)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(a0aab93e) SHA1(b7fa3d6eeb1977e4d91644aab1ac03aeee6934d0)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu4", 0) + ROM_LOAD("drom2.snd", 0x8000, 0x8000, CRC(d147d78d) SHA1(f8f6d6a1921685b883b224a9ea85ead52a32a4c3)) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(ec43f4e9) SHA1(77b0988700be7a597dca7e5f06ac5d3c6834ce21)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(a95eedfc) SHA1(5ced2d6869a9895f8ff26d830b21d3c9364b32e7)) +ROM_END + /*------------------------------------------------------------------- / Bounty Hunter (#694) /-------------------------------------------------------------------*/ @@ -620,6 +764,17 @@ ROM_START(bountyh) ROM_LOAD("694-s.snd", 0x0800, 0x0800, CRC(a0383e41) SHA1(156514d2b52fcd89b608b85991c5066780949979)) ROM_END +ROM_START(bountyhg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(ea4b7e2d) SHA1(9141c950b33e32ae8ad76fd0dd06d1a13d38be9d)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x1000, "r0sound:audiocpu", 0) + ROM_LOAD("694-s.snd", 0x0800, 0x0800, CRC(a0383e41) SHA1(156514d2b52fcd89b608b85991c5066780949979)) +ROM_END + /*------------------------------------------------------------------- / Chicago Cubs' Triple Play (#696) /-------------------------------------------------------------------*/ @@ -666,16 +821,70 @@ ROM_START(diamondp) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0a18d626) SHA1(6b367668be55ca04c69c4c4c5a4a524ae8f790f8)) ROM_END +ROM_START(diamondpf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(943019a8) SHA1(558c3696339bb6e150b4ddb499bc60897d5954ec)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(479b0267) SHA1(a9586c5b2cc3561ba3409123eca5a73ebabfd823)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(c216d1e4) SHA1(aa38db5ad36d1d1d35e727ab27c1f1c05a9627cd)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0a18d626) SHA1(6b367668be55ca04c69c4c4c5a4a524ae8f790f8)) +ROM_END + +ROM_START(diamondpg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(f0ef69f6) SHA1(1f48bb656bb20073e2ff261199cb94919f0bb2ab)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(961cfdf9) SHA1(97135f77705969736f704acdeda6157bb765c73e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(c216d1e4) SHA1(aa38db5ad36d1d1d35e727ab27c1f1c05a9627cd)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(0a18d626) SHA1(6b367668be55ca04c69c4c4c5a4a524ae8f790f8)) +ROM_END + /*------------------------------------------------------------------- / Excalibur (#715) /-------------------------------------------------------------------*/ ROM_START(excalibr) ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("prom2.cpu", 0x1000, 0x0800, CRC(499e2e41) SHA1(1e3fcba18882bd7df30a43843916aa5d7968eecc)) + ROM_LOAD("prom2.cpu", 0x1000, 0x0800, CRC(082d64ab) SHA1(0eae3b549839fc281d2487d483d0b4e723ebdc48)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1.cpu", 0x2000, 0x2000, CRC(e8902c16) SHA1(c3e4ece6be7027a4deef052ba4be752070e9b542)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(a4368cd0) SHA1(c48513e56899938dc83a3545d8ee9def3dc1491f)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(9f194744) SHA1(dbd73b546071c3d4f0dcfe21e3e646da716c5b71)) +ROM_END + +ROM_START(excalibrf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(499e2e41) SHA1(1e3fcba18882bd7df30a43843916aa5d7968eecc)) ROM_CONTINUE(0x9000, 0x0800) ROM_RELOAD(0x5000, 0x0800) ROM_CONTINUE(0xd000, 0x0800) - ROM_LOAD("prom1.cpu", 0x2000, 0x2000, CRC(ed1083d7) SHA1(3ff829ecfaba7d20c75268d3ee5224cb3cac3507)) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(ed1083d7) SHA1(3ff829ecfaba7d20c75268d3ee5224cb3cac3507)) ROM_RELOAD(0x6000, 0x2000) ROM_RELOAD(0xa000, 0x2000) ROM_RELOAD(0xe000, 0x2000) @@ -709,6 +918,44 @@ ROM_START(genesisp) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0528c024) SHA1(d24ff7e088b08c1f35b54be3c806f8a8757d96c7)) ROM_END +ROM_START(genesispf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(ea7f824f) SHA1(45f619153e0584cffd33e6e09e6f5a97ab9522b2)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(e7ef875b) SHA1(37ac83d9a75ce604c5a4173ce918beb64f75cd3e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(758e1743) SHA1(6df3011c044796afcd88e52d1ca69692cb489ff4)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(4869b0ec) SHA1(b8a56753257205af56e06105515b8a700bb1935b)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0528c024) SHA1(d24ff7e088b08c1f35b54be3c806f8a8757d96c7)) +ROM_END + +ROM_START(genesispg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(e8fc30af) SHA1(2401bff3cf566cae4e6de6167fa004c5fe232928)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(68a27ec1) SHA1(b14a933e6c7e2972faef8dfecebabe3da4021367)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(758e1743) SHA1(6df3011c044796afcd88e52d1ca69692cb489ff4)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(4869b0ec) SHA1(b8a56753257205af56e06105515b8a700bb1935b)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0528c024) SHA1(d24ff7e088b08c1f35b54be3c806f8a8757d96c7)) +ROM_END + /*------------------------------------------------------------------- / Gold Wings (#707) /-------------------------------------------------------------------*/ @@ -731,6 +978,44 @@ ROM_START(goldwing) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(4e482023) SHA1(62e97d229eb28ff67f0ebc4ee04c1b4918a4affe)) ROM_END +ROM_START(goldwingf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(50337adf) SHA1(dc286d52e6872edd68af442cbd0442babc174b93)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(ec046fc0) SHA1(856f09f420e0f37488b0a896a37fffad62f18d6d)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(892dbb21) SHA1(e24611544693e95dd2b9c0f2532c4d1f0b8ac10c)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(e17e9b1f) SHA1(ada9a6139a13ef31173801d560ec732d5a285140)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(4e482023) SHA1(62e97d229eb28ff67f0ebc4ee04c1b4918a4affe)) +ROM_END + +ROM_START(goldwingg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(f69c963c) SHA1(9e39344ecfcca1115e12c559c66eaa21716c0ce2)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(a9349b2f) SHA1(836c86d8db8be5ac29013bbe4daec8d96d15fba0)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(892dbb21) SHA1(e24611544693e95dd2b9c0f2532c4d1f0b8ac10c)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(e17e9b1f) SHA1(ada9a6139a13ef31173801d560ec732d5a285140)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(4e482023) SHA1(62e97d229eb28ff67f0ebc4ee04c1b4918a4affe)) +ROM_END + /*------------------------------------------------------------------- / Hollywood Heat (#703) /-------------------------------------------------------------------*/ @@ -753,6 +1038,44 @@ ROM_START(hlywoodh) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(51709c2f) SHA1(5834d7b72bd36e30c87377dc7c3ad0cf26ff303a)) ROM_END +ROM_START(hlywoodhf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(969ca81f) SHA1(2606a0f63434056c5d2b509a885c9919a7a5d70f)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(ddc45d2d) SHA1(8bd50f3e0049fe322f7bc626d39f9787cfea1940)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(a698ec33) SHA1(e7c1d28279ec4f12095c3a106c6cefcc2a84b31e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(9232591e) SHA1(72883e0c542c572226c6c654bea14749cc9e351f)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(51709c2f) SHA1(5834d7b72bd36e30c87377dc7c3ad0cf26ff303a)) +ROM_END + +ROM_START(hlywoodhg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(bf60b631) SHA1(944089895d4253dd094a8f6b7168f9e62a75568a)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(0f212d15) SHA1(b671b8fbc50f5528f0de061c7695932035266a0e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(a698ec33) SHA1(e7c1d28279ec4f12095c3a106c6cefcc2a84b31e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(9232591e) SHA1(72883e0c542c572226c6c654bea14749cc9e351f)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(51709c2f) SHA1(5834d7b72bd36e30c87377dc7c3ad0cf26ff303a)) +ROM_END + /*------------------------------------------------------------------- / Hot Shots (#718) /-------------------------------------------------------------------*/ @@ -774,6 +1097,42 @@ ROM_START(hotshots) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(2933a80e) SHA1(5982b9ed361d90f8ea47047fc29770ef142acbec)) ROM_END +ROM_START(hotshotsf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(476e260c) SHA1(2b88920c77462d190f9b98aebf8fcb5c9e853ecd)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(8d74aca7) SHA1(c25b015ad8a6fa142c7cb46e2ac0229eb00289cf)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(42c3cc3d) SHA1(26ca7f3a71b83df18ac6be1d1eb28da20120285e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(2933a80e) SHA1(5982b9ed361d90f8ea47047fc29770ef142acbec)) +ROM_END + +ROM_START(hotshotsg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(7e2f0d59) SHA1(b8a7b9be3e4d705631e017da87b27be53ed23f30)) + ROM_CONTINUE(0x9000, 0x0800) + ROM_RELOAD(0x5000, 0x0800) + ROM_CONTINUE(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(e07b46ad) SHA1(c7b48dcfb074f3d0f38a6d49028ba172946467fc)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(42c3cc3d) SHA1(26ca7f3a71b83df18ac6be1d1eb28da20120285e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(2933a80e) SHA1(5982b9ed361d90f8ea47047fc29770ef142acbec)) +ROM_END + /*------------------------------------------------------------------- / Monte Carlo (#708) /-------------------------------------------------------------------*/ @@ -815,6 +1174,63 @@ ROM_START(mntecrloa) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(a95d1a6b) SHA1(91946ef7af0e4dd96db6d2d6f4f2e9a3a7279b81)) ROM_END +ROM_START(mntecrlof) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(f6842631) SHA1(7447994d2055c7fa12aaf35e93436ee829f5b7ae)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(33a8dbc9) SHA1(5ef586e2b1ba7f245723584bc14c60c2860d19fc)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(1a53ac15) SHA1(f2751664a09431e908873580ddf4f44df9b4eda7)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(6e234c49) SHA1(fdb4126ecdaac378d144e9dd3c29b4e79290da2a)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(a95d1a6b) SHA1(91946ef7af0e4dd96db6d2d6f4f2e9a3a7279b81)) +ROM_END + +ROM_START(mntecrlog) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(2a5e0c4f) SHA1(b386168bd911b9977104c47da962d0248f22614b)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(25e015f1) SHA1(4b1467438def657eac3b8a858d7b17c102e14f0d)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(1a53ac15) SHA1(f2751664a09431e908873580ddf4f44df9b4eda7)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(6e234c49) SHA1(fdb4126ecdaac378d144e9dd3c29b4e79290da2a)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(a95d1a6b) SHA1(91946ef7af0e4dd96db6d2d6f4f2e9a3a7279b81)) +ROM_END + +ROM_START(mntecrlo2) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2_2.cpu", 0x1000, 0x0800, CRC(8e72a68f) SHA1(8320c44020f7d5f9e887b17556252f1c617235ac)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1_2.cpu", 0x2000, 0x2000, CRC(9bd6a010) SHA1(680ce076452ab3fd911fa58fc48c07ea2ec793da)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(1a53ac15) SHA1(f2751664a09431e908873580ddf4f44df9b4eda7)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(6e234c49) SHA1(fdb4126ecdaac378d144e9dd3c29b4e79290da2a)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(a95d1a6b) SHA1(91946ef7af0e4dd96db6d2d6f4f2e9a3a7279b81)) +ROM_END + /*------------------------------------------------------------------- / Night Moves C-103 /-------------------------------------------------------------------*/ @@ -857,6 +1273,24 @@ ROM_START(raven) ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(ee5f868b) SHA1(23ef4112b94109ad4d4a6b9bb5215acec20e5e55)) ROM_END +ROM_START(raveng) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(4ca540a5) SHA1(50bb240465d80b7763574e1261f8d0ddda5ad587)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(3441aeda) SHA1(12dd2faac64170bad5cf5b9247283f64df9e5337)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(a04bf7d0) SHA1(5be5d445b199e7dc9d42e7ee5e9b31c18dec3881)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(ee5f868b) SHA1(23ef4112b94109ad4d4a6b9bb5215acec20e5e55)) +ROM_END + ROM_START(ravena) ROM_REGION(0x10000, "maincpu", 0) ROM_LOAD("prom2a.cpu", 0x1000, 0x0800, CRC(a693785e) SHA1(7c8878f1c3c5205b3ae46a78c881bbd2b722838d)) @@ -896,6 +1330,24 @@ ROM_START(robowars) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(7ecd8b67) SHA1(c5167b0acc64e535d389ba70be92a65672e119f6)) ROM_END +ROM_START(robowarsf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(1afa0e69) SHA1(178813494b877ac9ca36863661596b4df04df1bb)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(263cb8f9) SHA1(ba27ca0618b9ed68c258a654bdd00a24f8413239)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(ea59b6a1) SHA1(6a4cdd37ba85f94f703afd1c5d3f102f51fedf46)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(7ecd8b67) SHA1(c5167b0acc64e535d389ba70be92a65672e119f6)) +ROM_END + /*------------------------------------------------------------------- / Rock (#697) /-------------------------------------------------------------------*/ @@ -913,6 +1365,20 @@ ROM_START(rock) ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(effba2ad) SHA1(2288a4f655376e0aa18f8ecd9a3818ed4d6c6891)) ROM_END +ROM_START(rockg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(2de3f1e5) SHA1(ceb964292703080bb742dbc073a14dbf745ad38e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(03830e81) SHA1(786f85eba5a8f5e9cc659305623e1d178b5410f6)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(effba2ad) SHA1(2288a4f655376e0aa18f8ecd9a3818ed4d6c6891)) +ROM_END + /*------------------------------------------------------------------- / Rock Encore (#704) /-------------------------------------------------------------------*/ @@ -931,6 +1397,21 @@ ROM_START(rock_enc) ROM_LOAD("yrom2a.snd",0xc000,0x2000, CRC(66645a3f) SHA1(f06261af81e6b1829d639933297d2461a8c993fc)) ROM_END +ROM_START(rock_encg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(2de3f1e5) SHA1(ceb964292703080bb742dbc073a14dbf745ad38e)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1a.snd",0xe000,0x2000, CRC(b8aa8912) SHA1(abff690256c0030807b2d4dfa0516496516384e8)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1a.snd",0xe000,0x2000, CRC(a62e3b94) SHA1(59636c2ac7ebbd116a0eb39479c97299ba391906)) + ROM_LOAD("yrom2a.snd",0xc000,0x2000, CRC(66645a3f) SHA1(f06261af81e6b1829d639933297d2461a8c993fc)) +ROM_END + /*------------------------------------------------------------------- / Spring Break (#706) /-------------------------------------------------------------------*/ @@ -972,6 +1453,44 @@ ROM_START(sprbreaka) ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0fb0128e) SHA1(3bdc5ed11b8e062f71f2a78b955830bd985e80a3)) ROM_END +ROM_START(sprbreakf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(c0ee0555) SHA1(3d2aef5a8a6452f9f87b4ec2040643dda5843ebd)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(608cf4d5) SHA1(41193eb036da7c7d05f313d1a68723504a7a90f4)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(97d3f9ba) SHA1(1b34c7e51373c26d29d757c57a2b0333fe38d19e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(5ea89df9) SHA1(98ce7661a4d862fd02c77e69b0f6e9372c3ade2b)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0fb0128e) SHA1(3bdc5ed11b8e062f71f2a78b955830bd985e80a3)) +ROM_END + +ROM_START(sprbreakg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(fa4b750d) SHA1(89f797f65fc18473419080810bca4590f77e2502)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(2d9c4640) SHA1(3671a962334f5c84ae2635891ee90c62be69da5c)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd",0xe000,0x2000, CRC(97d3f9ba) SHA1(1b34c7e51373c26d29d757c57a2b0333fe38d19e)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd",0xe000,0x2000, CRC(5ea89df9) SHA1(98ce7661a4d862fd02c77e69b0f6e9372c3ade2b)) + ROM_LOAD("yrom2.snd",0xc000,0x2000, CRC(0fb0128e) SHA1(3bdc5ed11b8e062f71f2a78b955830bd985e80a3)) +ROM_END + ROM_START(sprbreaks) ROM_REGION(0x10000, "maincpu", 0) ROM_LOAD("prom2.rv2", 0x1000, 0x0800, CRC(911cd14f) SHA1(2bc3ff6a3889da69b97f8ec318f93208e3d42cfe)) @@ -1009,6 +1528,21 @@ ROM_START(tagteamp) ROM_LOAD("698-s.snd", 0x0800, 0x0800, CRC(9c8191b7) SHA1(12b017692f078dcdc8e4bbf1ffcea1c5d0293d06)) ROM_END +ROM_START(tagteampg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(5e6d2da7) SHA1(9b23d1ac34163edeaceffe806a2a559f3d408b41)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(e206c519) SHA1(0d5b3237807b6f11633ab9be2b0e5b000369a0e8)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x1000, "r0sound:audiocpu", 0) + ROM_LOAD("698-s.snd", 0x0800, 0x0800, CRC(9c8191b7) SHA1(12b017692f078dcdc8e4bbf1ffcea1c5d0293d06)) +ROM_END + ROM_START(tagteamp2) ROM_REGION(0x10000, "maincpu", 0) ROM_LOAD("prom2a.cpu", 0x1000, 0x0800, CRC(6d56b636) SHA1(8f50f2742be727835e7343307787b4b5daa1623a)) @@ -1045,6 +1579,42 @@ ROM_START(txsector) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(469ef444) SHA1(faa16f34357a53c3fc61b59251fabdc44c605000)) ROM_END +ROM_START(txsectorf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(1bd08247) SHA1(968cc30e5e5c783e73cb3278a58189c4f8b8186f)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(8df27155) SHA1(67aeeab0d50e43674082e1dd99a849db64ba00b2)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(61d66ca1) SHA1(59b1705b13d46b29f45257c566274f3cdce15ec2)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(469ef444) SHA1(faa16f34357a53c3fc61b59251fabdc44c605000)) +ROM_END + +ROM_START(txsectorg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(2b17261f) SHA1(a3195190c0d5116b60e487a7b7f3a28c1f110e89)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(83ea2f11) SHA1(ac3570597512c71c099aa15f0750a12a3e206b83)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(61d66ca1) SHA1(59b1705b13d46b29f45257c566274f3cdce15ec2)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(469ef444) SHA1(faa16f34357a53c3fc61b59251fabdc44c605000)) +ROM_END + /*------------------------------------------------------------------- / Victory (#710) /-------------------------------------------------------------------*/ @@ -1066,6 +1636,42 @@ ROM_START(victoryp) ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(921a100e) SHA1(0c3c7eae4ceeb5a1a8150bac52203d3f1e8f917e)) ROM_END +ROM_START(victorypf) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2f.cpu", 0x1000, 0x0800, CRC(dffcfa77) SHA1(3efaca85295ca55268b8d7c7cfe8f09f159d5fbd)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1f.cpu", 0x2000, 0x2000, CRC(d3a9df20) SHA1(7e0a97a4c1b488af89959cbaa693e23302479d0a)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(4ab6dab7) SHA1(7e21e69029e60052112ddd5c7481582ea6684dc1)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(921a100e) SHA1(0c3c7eae4ceeb5a1a8150bac52203d3f1e8f917e)) +ROM_END + +ROM_START(victorypg) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(b191a87a) SHA1(f205ffb41c5ba34e3cefc96ca870a5d08bee8854)) + ROM_RELOAD(0x5000, 0x0800) + ROM_RELOAD(0x9000, 0x0800) + ROM_RELOAD(0xd000, 0x0800) + ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(097b9062) SHA1(e7f05084b36f84b9948702ba297700473386ae6d)) + ROM_RELOAD(0x6000, 0x2000) + ROM_RELOAD(0xa000, 0x2000) + ROM_RELOAD(0xe000, 0x2000) + + ROM_REGION(0x10000, "cpu3", 0) + ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(4ab6dab7) SHA1(7e21e69029e60052112ddd5c7481582ea6684dc1)) + + ROM_REGION(0x10000, "cpu2", 0) + ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(921a100e) SHA1(0c3c7eae4ceeb5a1a8150bac52203d3f1e8f917e)) +ROM_END + /*------------------------------------------------------------------- / System 80B Test Fixture /-------------------------------------------------------------------*/ @@ -1087,35 +1693,69 @@ ROM_START(s80btest) ROM_END GAME(1985, bountyh, 0, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bounty Hunter", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1985, bountyhg, bountyh, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bounty Hunter (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1985, triplay, 0, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Chicago Cubs' Triple Play", MACHINE_IS_SKELETON_MECHANICAL) GAME(1985, triplaya, triplay, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Chicago Cubs' Triple Play (alternate set)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1985, rock, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Rock", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1985, rockg, rock, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Rock (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1985, tagteamp, 0, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Tag-Team Wrestling", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1985, tagteampg, tagteamp, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Tag-Team Wrestling (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1985, tagteamp2, tagteamp, gts80b_s, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Tag-Team Wrestling (rev.2)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, raven, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Raven", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, ravena, raven, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Raven (alternate set)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, raveng, raven, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Raven (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, hlywoodh, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hollywood Heat", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, hlywoodhf, hlywoodh, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hollywood Heat (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, hlywoodhg, hlywoodh, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hollywood Heat (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, rock_enc, rock, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Rock Encore", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, rock_encg, rock, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Rock Encore (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, genesisp, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Genesis", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, genesispf, genesisp, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Genesis (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, genesispg, genesisp, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Genesis (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, amazonh2, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Amazon Hunt II (French)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, sprbreak, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Spring Break", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, sprbreaka, sprbreak, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Spring Break (alternate set)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, sprbreakf, sprbreak, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Spring Break (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, sprbreakg, sprbreak, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Spring Break (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, sprbreaks, sprbreak, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Spring Break (single ball game)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1986, goldwing, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Gold Wings", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, goldwingf, goldwing, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Gold Wings (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, goldwingg, goldwing, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Gold Wings (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, mntecrlo, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Monte Carlo (Pinball)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, mntecrloa, mntecrlo, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Monte Carlo (Pinball, alternate set)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, mntecrlof, mntecrlo, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Monte Carlo (Pinball, French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, mntecrlog, mntecrlo, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Monte Carlo (Pinball, German)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, mntecrlo2, mntecrlo, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Monte Carlo (Pinball, rev. 2)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, arena, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Arena", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, arenaa, arena, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Arena (alternate set)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, arenaf, arena, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Arena (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, arenag, arena, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Arena (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, victoryp, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Victory (Pinball)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, victorypf, victoryp, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Victory (Pinball, French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, victorypg, victoryp, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Victory (Pinball, German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1988, diamondp, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Diamond Lady", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, diamondpf, diamondp, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Diamond Lady (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, diamondpg, diamondp, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Diamond Lady (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1988, txsector, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "TX-Sector", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, txsectorf, txsector, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "TX-Sector (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, txsectorg, txsector, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "TX-Sector (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1989, bighouse, 0, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Big House", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1989, bighousef, bighouse, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Big House (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1989, bighouseg, bighouse, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Big House (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1988, robowars, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Robo-War", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, robowarsf, robowars, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Robo-War (French)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1988, excalibr, 0, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Excalibur", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, excalibrf, excalibr, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Excalibur (French)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1988, badgirls, 0, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, badgirlsf, badgirls, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1988, badgirlsg, badgirls, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1989, hotshots, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hot Shots", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1989, hotshotsf, hotshots, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hot Shots (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1989, hotshotsg, hotshots, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Hot Shots (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1989, bonebstr, 0, bonebstr, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bone Busters Inc.", MACHINE_IS_SKELETON_MECHANICAL) GAME(1989, bonebstrf, bonebstr, bonebstr, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bone Busters Inc. (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1989, bonebstrg, bonebstr, bonebstr, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bone Busters Inc. (German)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1989, nmoves, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "International Concepts", "Night Moves", MACHINE_IS_SKELETON_MECHANICAL) GAME(1987, amazonh3, 0, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Amazon Hunt III (French)", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1987, amazonh3a, amazonh3, gts80b_s1, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Amazon Hunt III (rev. 1, French)", MACHINE_IS_SKELETON_MECHANICAL) GAME(198?, s80btest, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "System 80B Test", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/gundealr.cpp b/src/mame/drivers/gundealr.cpp index 21f077ab6c5..37eb95f4a91 100644 --- a/src/mame/drivers/gundealr.cpp +++ b/src/mame/drivers/gundealr.cpp @@ -70,7 +70,7 @@ WRITE8_MEMBER(gundealr_state::yamyam_bankswitch_w) -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, gundealr_state ) +static ADDRESS_MAP_START( base_map, AS_PROGRAM, 8, gundealr_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW0") @@ -78,16 +78,26 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, gundealr_state ) AM_RANGE(0xc004, 0xc004) AM_READ_PORT("IN0") AM_RANGE(0xc005, 0xc005) AM_READ_PORT("IN1") AM_RANGE(0xc006, 0xc006) AM_READ_PORT("IN2") - AM_RANGE(0xc010, 0xc013) AM_WRITE(yamyam_fg_scroll_w) /* Yam Yam only */ - AM_RANGE(0xc014, 0xc014) AM_WRITE(gundealr_flipscreen_w) AM_RANGE(0xc016, 0xc016) AM_WRITE(yamyam_bankswitch_w) - AM_RANGE(0xc020, 0xc023) AM_WRITE(gundealr_fg_scroll_w) /* Gun Dealer only */ AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(gundealr_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gundealr_bg_videoram_w) AM_SHARE("bg_videoram") AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(gundealr_fg_videoram_w) AM_SHARE("fg_videoram") AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("rambase") ADDRESS_MAP_END +static ADDRESS_MAP_START( gundealr_main_map, AS_PROGRAM, 8, gundealr_state ) + AM_IMPORT_FROM(base_map) + AM_RANGE(0xc014, 0xc014) AM_WRITE(gundealr_flipscreen_w) + AM_RANGE(0xc020, 0xc023) AM_WRITE(gundealr_fg_scroll_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( yamyam_main_map, AS_PROGRAM, 8, gundealr_state ) + AM_IMPORT_FROM(base_map) + AM_RANGE(0xc010, 0xc013) AM_WRITE(yamyam_fg_scroll_w) + AM_RANGE(0xc014, 0xc014) AM_WRITE(yamyam_flipscreen_w) + AM_RANGE(0xc015, 0xc015) AM_WRITENOP // Bit 7 = MCU reset? +ADDRESS_MAP_END + static ADDRESS_MAP_START( main_portmap, AS_IO, 8, gundealr_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) @@ -379,13 +389,11 @@ void gundealr_state::machine_start() membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000); - save_item(NAME(m_flipscreen)); save_item(NAME(m_scroll)); } void gundealr_state::machine_reset() { - m_flipscreen = 0; m_scroll[0] = 0; m_scroll[1] = 0; m_scroll[2] = 0; @@ -406,7 +414,7 @@ static MACHINE_CONFIG_START( gundealr, gundealr_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* 6 MHz verified for Yam! Yam!? */ - MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_PROGRAM_MAP(gundealr_main_map) MCFG_CPU_IO_MAP(main_portmap) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", gundealr_state, gundealr_scanline, "screen", 0, 1) @@ -496,6 +504,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim) } static MACHINE_CONFIG_DERIVED( yamyam, gundealr ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(yamyam_main_map) MCFG_TIMER_DRIVER_ADD_PERIODIC("mcusim", gundealr_state, yamyam_mcu_sim, attotime::from_hz(6000000/60)) /* 6mhz confirmed */ MACHINE_CONFIG_END @@ -592,6 +602,9 @@ ROM_START( yamyam ) /* DY-90010001 PCB */ ROM_REGION( 0x20000, "gfx2", 0 ) ROM_LOAD( "1.16a", 0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP) ROM_END ROM_START( yamyamk ) /* DY-90010001 PCB */ @@ -607,6 +620,9 @@ ROM_START( yamyamk ) /* DY-90010001 PCB */ ROM_REGION( 0x20000, "gfx2", 0 ) ROM_LOAD( "1.16a", 0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP) ROM_END ROM_START( wiseguy ) /* DY-90010001 PCB */ @@ -622,6 +638,9 @@ ROM_START( wiseguy ) /* DY-90010001 PCB */ ROM_REGION( 0x20000, "gfx2", 0 ) ROM_LOAD( "1.16a", 0x00000, 0x20000, CRC(b122828d) SHA1(90994ba548893a2eacdd58351cfa3952f4af926a) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP) ROM_END @@ -629,7 +648,7 @@ ROM_END GAME( 1990, gundealr, 0, gundealr, gundealr, driver_device, 0, ROT270, "Dooyong", "Gun Dealer", MACHINE_SUPPORTS_SAVE ) GAME( 1990, gundealra, gundealr, gundealr, gundealr, driver_device, 0, ROT270, "Dooyong", "Gun Dealer (alt card set)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, gundealrt, gundealr, gundealr, gundealt, driver_device, 0, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, gundealrbl, gundealr, gundealr, gundealr, driver_device, 0, ROT270, "bootleg", "Gun Dealer (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, gundealrbl, gundealr, yamyam, gundealr, driver_device, 0, ROT270, "bootleg", "Gun Dealer (bootleg)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, yamyam, 0, yamyam, yamyam, driver_device, 0, ROT0, "Dooyong", "Yam! Yam!?", MACHINE_SUPPORTS_SAVE ) GAME( 1990, yamyamk, yamyam, yamyam, yamyam, driver_device, 0, ROT0, "Dooyong", "Yam! Yam!? (Korea)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index c39d5f5a104..c72d9c87c42 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -44,10 +44,12 @@ References: #define MISCKEYS_TAG "misc_keys" #define SCREEN_TAG "screen" #define BAUD_PROM_TAG "u39" -#define NL_PROM_TAG "videobrd:u71" -#define NL_EPROM_TAG "videobrd:u78" -#define VIDEO_PROM_TAG "u71" -#define CHAR_EPROM_TAG "u78" +//#define NL_PROM_TAG "videobrd:u71" +//#define NL_EPROM_TAG "videobrd:u78" +// VIDEO_PROM at u71 +#define VIDEO_PROM_TAG NETLIST_TAG ":u90_702128_82s129.bin" +// CHAR_EPROM at u78 +#define CHAR_EPROM_TAG NETLIST_TAG ":u83_chr.bin" #define VIDEO_OUT_TAG "videobrd:video_out" #define VBLANK_OUT_TAG "videobrd:vblank" #define TVINTERQ_OUT_TAG "videobrd:tvinterq" @@ -79,8 +81,6 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, CPU_TAG) , m_video_board(*this, NETLIST_TAG) - , m_u71(*this, NL_PROM_TAG) - , m_u78(*this, NL_EPROM_TAG) , m_u9(*this, "videobrd:u9") , m_u10(*this, "videobrd:u10") , m_u11(*this, "videobrd:u11") @@ -164,8 +164,6 @@ public: private: required_device<cpu_device> m_maincpu; required_device<netlist_mame_device_t> m_video_board; - required_device<netlist_mame_rom_t> m_u71; - required_device<netlist_mame_rom_t> m_u78; required_device<netlist_ram_pointer_t> m_u9; required_device<netlist_ram_pointer_t> m_u10; required_device<netlist_ram_pointer_t> m_u11; @@ -712,9 +710,6 @@ static MACHINE_CONFIG_START( hazl1500, hazl1500_state ) MCFG_DEVICE_ADD(NETLIST_TAG, NETLIST_CPU, VIDEOBRD_CLOCK) MCFG_NETLIST_SETUP(hazelvid) - MCFG_NETLIST_ROM_REGION(NETLIST_TAG, VIDEO_PROM_TAG, VIDEO_PROM_TAG, "u90_702128_82s129.bin", 0x0000, 0x0100) - MCFG_NETLIST_ROM_REGION(NETLIST_TAG, CHAR_EPROM_TAG, CHAR_EPROM_TAG, "u83_chr.bin", 0x0000, 0x0800) - // First 1K MCFG_NETLIST_RAM_POINTER(NETLIST_TAG, "u22", "u22") MCFG_NETLIST_RAM_POINTER(NETLIST_TAG, "u23", "u23") diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp index 92ddc8343df..c08b8a0f448 100644 --- a/src/mame/drivers/hh_amis2k.cpp +++ b/src/mame/drivers/hh_amis2k.cpp @@ -48,14 +48,14 @@ public: required_device<speaker_sound_device> m_speaker; required_device<timer_device> m_a12_decay_timer; - uint8_t m_d; - uint16_t m_a; - uint8_t m_q2; - uint8_t m_q3; + u8 m_d; + u16 m_a; + u8 m_q2; + u8 m_q3; - uint16_t m_display_state[0x10]; - uint16_t m_display_cache[0x10]; - uint8_t m_display_decay[0x100]; + u16 m_display_state[0x10]; + u16 m_display_cache[0x10]; + u8 m_display_decay[0x100]; DECLARE_WRITE8_MEMBER(write_d); DECLARE_WRITE16_MEMBER(write_a); @@ -110,7 +110,7 @@ inline bool wildfire_state::index_is_7segled(int index) void wildfire_state::display_update() { - uint16_t active_state[0x10]; + u16 active_state[0x10]; for (int i = 0; i < 0x10; i++) { @@ -292,7 +292,7 @@ enum lG = 0x01 }; -static const uint8_t wildfire_7seg_table[0x10] = +static const u8 wildfire_7seg_table[0x10] = { 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, // 0-9 unaltered 0x77, // A -> unused? diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp index 1795c35e368..b51c4c1eb45 100644 --- a/src/mame/drivers/hh_cop400.cpp +++ b/src/mame/drivers/hh_cop400.cpp @@ -7,25 +7,30 @@ TODO: - why does h2hbaskb need a workaround on writing L pins? + - plus1: which sensor position is which colour? ***************************************************************************/ #include "emu.h" #include "cpu/cop400/cop400.h" +#include "sound/speaker.h" #include "sound/dac.h" #include "sound/volt_reg.h" +//#include "rendlay.h" // internal artwork #include "bship82.lh" // clickable #include "ctstein.lh" // clickable -#include "einvaderc.lh" // test-layout(but still playable) +#include "einvaderc.lh" #include "funjacks.lh" // clickable #include "funrlgl.lh" #include "h2hbaskb.lh" +#include "lchicken.lh" // clickable #include "lightfgt.lh" // clickable +#include "mdallas.lh" #include "qkracer.lh" -//#include "hh_cop400_test.lh" // common test-layout - use external artwork +#include "hh_cop400_test.lh" // common test-layout - use external artwork class hh_cop400_state : public driver_device @@ -35,6 +40,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_inp_matrix(*this, "IN.%u", 0), + m_speaker(*this, "speaker"), m_display_wait(33), m_display_maxy(1), m_display_maxx(0) @@ -42,33 +48,34 @@ public: // devices required_device<cpu_device> m_maincpu; - optional_ioport_array<5> m_inp_matrix; // max 5 + optional_ioport_array<6> m_inp_matrix; // max 6 + optional_device<speaker_sound_device> m_speaker; // misc common - uint8_t m_l; // MCU port L write data - uint8_t m_g; // MCU port G write data - uint8_t m_d; // MCU port D write data - int m_so; // MCU SO line state - int m_sk; // MCU SK line state - uint16_t m_inp_mux; // multiplexed inputs mask + u8 m_l; // MCU port L write data + u8 m_g; // MCU port G write data + u8 m_d; // MCU port D write data + int m_so; // MCU SO line state + int m_sk; // MCU SK line state + u16 m_inp_mux; // multiplexed inputs mask - uint16_t read_inputs(int columns); + u16 read_inputs(int columns); // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; @@ -128,7 +135,7 @@ void hh_cop400_state::machine_reset() void hh_cop400_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -141,7 +148,7 @@ void hh_cop400_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -196,7 +203,7 @@ void hh_cop400_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_cop400_state::set_display_segmask(uint32_t digits, uint32_t mask) +void hh_cop400_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -207,12 +214,12 @@ void hh_cop400_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void hh_cop400_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void hh_cop400_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -223,10 +230,10 @@ void hh_cop400_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t // generic input handlers -uint16_t hh_cop400_state::read_inputs(int columns) +u16 hh_cop400_state::read_inputs(int columns) { // active low - uint16_t ret = 0xffff; + u16 ret = 0xffff; // read selected input rows for (int i = 0; i < columns; i++) @@ -277,7 +284,7 @@ WRITE8_MEMBER(ctstein_state::write_g) WRITE8_MEMBER(ctstein_state::write_l) { - // L0-L3: button lamps (strobed) + // L0-L3: button lamps display_matrix(4, 1, data & 0xf, 1); } @@ -313,21 +320,20 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ctstein, ctstein_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP421, 860000) // approximation - RC osc. R=12K, C=100pf + MCFG_CPU_ADD("maincpu", COP421, 850000) // approximation - RC osc. R=12K, C=100pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_G_CB(WRITE8(ctstein_state, write_g)) MCFG_COP400_WRITE_L_CB(WRITE8(ctstein_state, write_l)) - MCFG_COP400_WRITE_SK_CB(DEVWRITELINE("dac", dac_bit_interface, write)) + MCFG_COP400_WRITE_SK_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) MCFG_COP400_READ_L_CB(READ8(ctstein_state, read_l)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ctstein) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -379,8 +385,8 @@ WRITE8_MEMBER(h2hbaskb_state::write_g) WRITE8_MEMBER(h2hbaskb_state::write_l) { // D2,D3 double as multiplexer - uint16_t mask = ((m_d >> 2 & 1) * 0x00ff) | ((m_d >> 3 & 1) * 0xff00); - uint16_t sel = (m_g | m_d << 4 | m_g << 8 | m_d << 12) & mask; + u16 mask = ((m_d >> 2 & 1) * 0x00ff) | ((m_d >> 3 & 1) * 0xff00); + u16 sel = (m_g | m_d << 4 | m_g << 8 | m_d << 12) & mask; // D2+G0,G1 are 7segs set_display_segmask(3, 0x7f); @@ -437,22 +443,21 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( h2hbaskb, h2hbaskb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP420, 1600000) // approximation - RC osc. R=43K, C=101pf - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed + MCFG_CPU_ADD("maincpu", COP420, 850000) // approximation - RC osc. R=43K, C=101pF + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_8, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(h2hbaskb_state, write_d)) MCFG_COP400_WRITE_G_CB(WRITE8(h2hbaskb_state, write_g)) MCFG_COP400_WRITE_L_CB(WRITE8(h2hbaskb_state, write_l)) MCFG_COP400_READ_IN_CB(READ8(h2hbaskb_state, read_in)) - MCFG_COP400_WRITE_SO_CB(DEVWRITELINE("dac", dac_bit_interface, write)) + MCFG_COP400_WRITE_SO_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_h2hbaskb) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -468,20 +473,15 @@ MACHINE_CONFIG_END The first version was on TMS1100 (see hh_tms1k.c), this is the reprogrammed second release with a gray case instead of black. - NOTE!: MAME external artwork is required - ***************************************************************************/ class einvaderc_state : public hh_cop400_state { public: einvaderc_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag), - m_dac(*this, "dac") + : hh_cop400_state(mconfig, type, tag) { } - required_device<dac_bit_interface> m_dac; - void prepare_display(); DECLARE_WRITE8_MEMBER(write_d); DECLARE_WRITE8_MEMBER(write_g); @@ -498,8 +498,8 @@ void einvaderc_state::prepare_display() set_display_segmask(7, 0x7f); // update display - uint8_t l = BITSWAP8(m_l,7,6,0,1,2,3,4,5); - uint16_t grid = (m_d | m_g << 4 | m_sk << 8 | m_so << 9) ^ 0x0ff; + u8 l = BITSWAP8(m_l,7,6,0,1,2,3,4,5); + u16 grid = (m_d | m_g << 4 | m_sk << 8 | m_so << 9) ^ 0x0ff; display_matrix(8, 10, l, grid); } @@ -520,7 +520,7 @@ WRITE8_MEMBER(einvaderc_state::write_g) WRITE_LINE_MEMBER(einvaderc_state::write_sk) { // SK: speaker out + led grid 8 - m_dac->write(state); + m_speaker->level_w(state); m_sk = state; prepare_display(); } @@ -555,7 +555,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( einvaderc, einvaderc_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP444, 1000000) // approximation - RC osc. R=47K, C=100pf + MCFG_CPU_ADD("maincpu", COP444L, 900000) // approximation - RC osc. R=47K, C=100pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_READ_IN_CB(IOPORT("IN.0")) MCFG_COP400_WRITE_D_CB(WRITE8(einvaderc_state, write_d)) @@ -564,14 +564,175 @@ static MACHINE_CONFIG_START( einvaderc, einvaderc_state ) MCFG_COP400_WRITE_SO_CB(WRITELINE(einvaderc_state, write_so)) MCFG_COP400_WRITE_L_CB(WRITE8(einvaderc_state, write_l)) + /* video hardware */ + MCFG_SCREEN_SVG_ADD("screen", "svg") + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(913, 1080) + MCFG_SCREEN_VISIBLE_AREA(0, 913-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_einvaderc) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + LJN I Took a Lickin' From a Chicken + * COP421 MCU label ~/005 COP421-NJC/N + * 11 leds, 1-bit sound, motor to a rubber chicken with a pulley in the middle + + This toy includes 4 games: Tic Tac Toe, Chicken Sez, and Total Recall I/II. + + known releases: + - USA: I Took a Lickin' From a Chicken (KMart Corporation/LJN?) + - Japan: Professor Chicken's Genius Classroom 「にわとり博士の天才教室」, + distributed by Bandai + +***************************************************************************/ + +class lchicken_state : public hh_cop400_state +{ +public: + lchicken_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + u8 m_motor_pos; + TIMER_DEVICE_CALLBACK_MEMBER(motor_sim_tick); + DECLARE_CUSTOM_INPUT_MEMBER(motor_switch); + + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_READ8_MEMBER(read_g); + DECLARE_WRITE_LINE_MEMBER(write_so); + DECLARE_READ_LINE_MEMBER(read_si); + +protected: + virtual void machine_start() override; +}; + +// handlers + +TIMER_DEVICE_CALLBACK_MEMBER(lchicken_state::motor_sim_tick) +{ + if (~m_inp_mux & 8) + { + m_motor_pos++; + output().set_value("motor_pos", 100 * (m_motor_pos / (float)0x100)); + } +} + +WRITE8_MEMBER(lchicken_state::write_l) +{ + // L0-L3: led data + // L4-L6: led select + // L7: N/C + display_matrix(4, 3, ~data & 0xf, data >> 4 & 7); +} + +WRITE8_MEMBER(lchicken_state::write_d) +{ + // D0-D3: input mux + // D3: motor on + m_inp_mux = data & 0xf; + output().set_value("motor_on", ~data >> 3 & 1); +} + +WRITE8_MEMBER(lchicken_state::write_g) +{ + m_g = data; +} + +READ8_MEMBER(lchicken_state::read_g) +{ + // G0-G3: multiplexed inputs + return read_inputs(4) & m_g; +} + +WRITE_LINE_MEMBER(lchicken_state::write_so) +{ + // SO: speaker out + m_speaker->level_w(state); + m_so = state; +} + +READ_LINE_MEMBER(lchicken_state::read_si) +{ + // SI: SO + return m_so; +} + + +// config + +static INPUT_PORTS_START( lchicken ) + PORT_START("IN.0") // D0 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN.1") // D1 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN.2") // D2 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN.3") // D3 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, lchicken_state, motor_switch, nullptr) +INPUT_PORTS_END + +CUSTOM_INPUT_MEMBER(lchicken_state::motor_switch) +{ + return m_motor_pos > 0xe8; // approximation +} + +void lchicken_state::machine_start() +{ + hh_cop400_state::machine_start(); + + // zerofill, register for savestates + m_motor_pos = 0; + save_item(NAME(m_motor_pos)); +} + +static MACHINE_CONFIG_START( lchicken, lchicken_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP421, 850000) // approximation - RC osc. R=12K, C=100pF + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed + MCFG_COP400_WRITE_L_CB(WRITE8(lchicken_state, write_l)) + MCFG_COP400_WRITE_D_CB(WRITE8(lchicken_state, write_d)) + MCFG_COP400_WRITE_G_CB(WRITE8(lchicken_state, write_g)) + MCFG_COP400_READ_G_CB(READ8(lchicken_state, read_g)) + MCFG_COP400_WRITE_SO_CB(WRITELINE(lchicken_state, write_so)) + MCFG_COP400_READ_SI_CB(READLINE(lchicken_state, read_si)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("chicken_motor", lchicken_state, motor_sim_tick, attotime::from_msec(6000/0x100)) // ~6sec for a full rotation + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_lchicken) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -590,12 +751,9 @@ class funjacks_state : public hh_cop400_state { public: funjacks_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag), - m_dac(*this, "dac") + : hh_cop400_state(mconfig, type, tag) { } - required_device<dac_bit_interface> m_dac; - DECLARE_WRITE8_MEMBER(write_d); DECLARE_WRITE8_MEMBER(write_l); DECLARE_WRITE8_MEMBER(write_g); @@ -623,7 +781,7 @@ WRITE8_MEMBER(funjacks_state::write_l) WRITE8_MEMBER(funjacks_state::write_g) { // G1: speaker out - m_dac->write(BIT(data, 1)); + m_speaker->level_w(data >> 1 & 1); m_g = data; } @@ -668,7 +826,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( funjacks, funjacks_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=47K, C=56pf + MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=47K, C=56pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_8, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(funjacks_state, write_d)) MCFG_COP400_WRITE_L_CB(WRITE8(funjacks_state, write_l)) @@ -680,10 +838,9 @@ static MACHINE_CONFIG_START( funjacks, funjacks_state ) MCFG_DEFAULT_LAYOUT(layout_funjacks) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -706,12 +863,9 @@ class funrlgl_state : public hh_cop400_state { public: funrlgl_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag), - m_dac(*this, "dac") + : hh_cop400_state(mconfig, type, tag) { } - required_device<dac_bit_interface> m_dac; - DECLARE_WRITE8_MEMBER(write_d); DECLARE_WRITE8_MEMBER(write_l); DECLARE_WRITE8_MEMBER(write_g); @@ -740,7 +894,7 @@ WRITE8_MEMBER(funrlgl_state::write_l) WRITE8_MEMBER(funrlgl_state::write_g) { // G3: speaker out - m_dac->write(BIT(data, 3)); + m_speaker->level_w(data >> 3 & 1); } @@ -765,12 +919,11 @@ INPUT_CHANGED_MEMBER(funrlgl_state::reset_button) m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); } - static MACHINE_CONFIG_START( funrlgl, funrlgl_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K, C=91pf - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_8, COP400_CKO_OSCILLATOR_OUTPUT, true) // guessed + MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K, C=91pF + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_8, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(funrlgl_state, write_d)) MCFG_COP400_WRITE_L_CB(WRITE8(funrlgl_state, write_l)) MCFG_COP400_READ_L_TRISTATE_CB(READ8(funrlgl_state, read_l_tristate)) @@ -781,10 +934,145 @@ static MACHINE_CONFIG_START( funrlgl, funrlgl_state ) MCFG_DEFAULT_LAYOUT(layout_funrlgl) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Mattel Dalla$ (J.R. handheld) + * COP444 MCU label COP444L-HYN/N + * 8-digit 7seg display, 1-bit sound + + This is a board game, only the handheld device is emulated here. + +***************************************************************************/ + +class mdallas_state : public hh_cop400_state +{ +public: + mdallas_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_READ8_MEMBER(read_in); +}; + +// handlers + +void mdallas_state::prepare_display() +{ + set_display_segmask(0xff, 0xff); + display_matrix(8, 8, m_l, ~(m_d << 4 | m_g)); +} + +WRITE8_MEMBER(mdallas_state::write_l) +{ + // L: digit segment data + m_l = data; + prepare_display(); +} + +WRITE8_MEMBER(mdallas_state::write_d) +{ + // D: select digit, input mux high + m_inp_mux = (m_inp_mux & 0xf) | (data << 4 & 3); + m_d = data & 0xf; + prepare_display(); +} + +WRITE8_MEMBER(mdallas_state::write_g) +{ + // G: select digit, input mux low + m_inp_mux = (m_inp_mux & 0x30) | (data & 0xf); + m_g = data & 0xf; + prepare_display(); +} + +READ8_MEMBER(mdallas_state::read_in) +{ + // IN: multiplexed inputs + return read_inputs(6) & 0xf; +} + + +// config + +/* physical button layout and labels is like this: + + < ON> [YES] [NO] [NEXT] + [W] [N] [S] [E] + [7] [8] [9] [STATUS] + [4] [5] [6] [ASSETS] + [1] [2] [3] [START] + [CLEAR] [0] [MOVE] [ENTER] +*/ + +static INPUT_PORTS_START( mdallas ) + PORT_START("IN.0") // G0 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Move") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") + + PORT_START("IN.1") // G1 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Start") + + PORT_START("IN.2") // G2 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Assets") + + PORT_START("IN.3") // G3 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Status") + + PORT_START("IN.4") // D0 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("West") // W + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Next") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("East") // E + + PORT_START("IN.5") // D1 port IN + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("No") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Yes") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("South") // S + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("North") // N +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mdallas, mdallas_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP444L, 1000000) // approximation - RC osc. R=57K, C=101pF + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed + MCFG_COP400_WRITE_L_CB(WRITE8(mdallas_state, write_l)) + MCFG_COP400_WRITE_D_CB(WRITE8(mdallas_state, write_d)) + MCFG_COP400_WRITE_G_CB(WRITE8(mdallas_state, write_g)) + MCFG_COP400_READ_IN_CB(READ8(mdallas_state, read_in)) + MCFG_COP400_WRITE_SO_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mdallas) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -795,7 +1083,10 @@ MACHINE_CONFIG_END Milton Bradley Plus One * COP410L MCU in 8-pin DIP, label ~/029 MM 57405 (die label COP410L/B NNE) - * 4 sensors(1 on each die side), 1-bit sound + * orientation sensor(4 directions), 1-bit sound + + This is a board game, each player needs to rotate a triangular pyramid + shaped piece the same as the previous player, plus 1. ***************************************************************************/ @@ -803,21 +1094,31 @@ class plus1_state : public hh_cop400_state { public: plus1_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag), - m_dac(*this, "dac") + : hh_cop400_state(mconfig, type, tag) { } - required_device<dac_bit_interface> m_dac; - DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_READ8_MEMBER(read_l); }; // handlers WRITE8_MEMBER(plus1_state::write_d) { - // D?: speaker out - m_dac->write(BIT(data, 0)); + // D0?: speaker out + m_speaker->level_w(data & 1); +} + +WRITE8_MEMBER(plus1_state::write_l) +{ + m_l = data; +} + +READ8_MEMBER(plus1_state::read_l) +{ + // L: IN.1, mask with output + return m_inp_matrix[1]->read() & m_l; } @@ -826,34 +1127,34 @@ WRITE8_MEMBER(plus1_state::write_d) static INPUT_PORTS_START( plus1 ) PORT_START("IN.0") // port G PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Sensor Position 3") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Sensor Position 1") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN.1") // port L - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Sensor Position 4") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Sensor Position 2") PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static MACHINE_CONFIG_START( plus1, plus1_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K, C=100pf + MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K, C=100pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(plus1_state, write_d)) MCFG_COP400_READ_G_CB(IOPORT("IN.0")) - MCFG_COP400_READ_L_CB(IOPORT("IN.1")) + MCFG_COP400_WRITE_L_CB(WRITE8(plus1_state, write_l)) + MCFG_COP400_READ_L_CB(READ8(plus1_state, read_l)) /* no visual feedback! */ /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -898,7 +1199,7 @@ public: void lightfgt_state::prepare_display() { - uint8_t grid = (m_so | m_d << 1) ^ 0x1f; + u8 grid = (m_so | m_d << 1) ^ 0x1f; display_matrix(5, 5, m_l, grid); } @@ -969,22 +1270,21 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( lightfgt, lightfgt_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP421, 950000) // approximation - RC osc. R=82K, C=56pf + MCFG_CPU_ADD("maincpu", COP421, 950000) // approximation - RC osc. R=82K, C=56pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_SO_CB(WRITELINE(lightfgt_state, write_so)) MCFG_COP400_WRITE_D_CB(WRITE8(lightfgt_state, write_d)) MCFG_COP400_WRITE_L_CB(WRITE8(lightfgt_state, write_l)) - MCFG_COP400_WRITE_SK_CB(DEVWRITELINE("dac", dac_bit_interface, write)) + MCFG_COP400_WRITE_SK_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) MCFG_COP400_READ_G_CB(READ8(lightfgt_state, read_g)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_lightfgt) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -1124,8 +1424,8 @@ base pulled high with 4.7K resistor, connects directly to G3, 1K resistor to G2, static MACHINE_CONFIG_START( bship82, bship82_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP420, 3000000) // approximation - RC osc. R=14K, C=100pf - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed + MCFG_CPU_ADD("maincpu", COP420, 750000) // approximation - RC osc. R=14K, C=100pF + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(bship82_state, write_d)) MCFG_COP400_WRITE_G_CB(DEVWRITE8("dac", dac_byte_interface, write)) // G: 4-bit signed DAC MCFG_COP400_READ_L_CB(READ8(bship82_state, read_l)) @@ -1137,8 +1437,8 @@ static MACHINE_CONFIG_START( bship82, bship82_state ) MCFG_DEFAULT_LAYOUT(layout_bship82) /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("dac", DAC_4BIT_BINARY_WEIGHTED_SIGN_MAGNITUDE, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.125) // unknown DAC + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC_4BIT_BINARY_WEIGHTED_SIGN_MAGNITUDE, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.125) // unknown DAC MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE_EX(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac", -1.0, DAC_VREF_NEG_INPUT) MACHINE_CONFIG_END @@ -1256,7 +1556,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( qkracer, qkracer_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP420, 1000000) // approximation - RC osc. R=47K, C=100pf + MCFG_CPU_ADD("maincpu", COP420, 1000000) // approximation - RC osc. R=47K, C=100pF MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_32, COP400_CKO_OSCILLATOR_OUTPUT, false) // guessed MCFG_COP400_WRITE_D_CB(WRITE8(qkracer_state, write_d)) MCFG_COP400_WRITE_G_CB(WRITE8(qkracer_state, write_g)) @@ -1295,6 +1595,15 @@ ROM_END ROM_START( einvaderc ) ROM_REGION( 0x0800, "maincpu", 0 ) ROM_LOAD( "copl444-hrz_n_inv_ii", 0x0000, 0x0800, CRC(76400f38) SHA1(0e92ab0517f7b7687293b189d30d57110df20fe0) ) + + ROM_REGION( 80636, "svg", 0) + ROM_LOAD( "einvaderc.svg", 0, 80636, CRC(a52d0166) SHA1(f69397ebcc518701f30a47b4d62e5a700825375a) ) // by hap, ver. 18 jan 2017 +ROM_END + + +ROM_START( lchicken ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "cop421-njc_n", 0x0000, 0x0400, CRC(319e7985) SHA1(9714327518f65ebefe38ac7911bed2b9b9c77307) ) ROM_END @@ -1310,9 +1619,15 @@ ROM_START( funrlgl ) ROM_END +ROM_START( mdallas ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "copl444l-hyn_n", 0x0000, 0x0800, CRC(7848b78c) SHA1(778d24512180892f58c49df3c72ca77b2618d63b) ) +ROM_END + + ROM_START( plus1 ) ROM_REGION( 0x0200, "maincpu", 0 ) - ROM_LOAD( "cop410l_b_nne", 0x0000, 0x0200, BAD_DUMP CRC(8626fdb8) SHA1(fd241b6dde0e4e86b439cb2c5bb3a82fb257d7e1) ) // still need to verify + ROM_LOAD( "cop410l_b_nne", 0x0000, 0x0200, CRC(d861b80c) SHA1(4652f8ee0dd4c3c48b625285bb4f094d96434071) ) ROM_END @@ -1340,12 +1655,15 @@ CONS( 1979, ctstein, 0, 0, ctstein, ctstein, driver_device, 0, "Cas CONS( 1980, h2hbaskb, 0, 0, h2hbaskb, h2hbaskb, driver_device, 0, "Coleco", "Head to Head Basketball/Hockey/Soccer (COP420L version)", MACHINE_SUPPORTS_SAVE ) -CONS( 1981, einvaderc, einvader, 0, einvaderc, einvaderc, driver_device, 0, "Entex", "Space Invader (Entex, COP444L version)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1981, einvaderc, einvader, 0, einvaderc, einvaderc, driver_device, 0, "Entex", "Space Invader (Entex, COP444L version)", MACHINE_SUPPORTS_SAVE ) + +CONS( 1980, lchicken, 0, 0, lchicken, lchicken, driver_device, 0, "LJN", "I Took a Lickin' From a Chicken", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_MECHANICAL ) CONS( 1979, funjacks, 0, 0, funjacks, funjacks, driver_device, 0, "Mattel", "Funtronics Jacks", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1979, funrlgl, 0, 0, funrlgl, funrlgl, driver_device, 0, "Mattel", "Funtronics Red Light Green Light", MACHINE_SUPPORTS_SAVE ) +CONS( 1981, mdallas, 0, 0, mdallas, mdallas, driver_device, 0, "Mattel", "Dalla$ (J.R. handheld)", MACHINE_SUPPORTS_SAVE ) // *** -CONS( 1980, plus1, 0, 0, plus1, plus1, driver_device, 0, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // *** +CONS( 1980, plus1, 0, 0, plus1, plus1, driver_device, 0, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE ) // *** CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1982, bship82, bship, 0, bship82, bship82, driver_device, 0, "Milton Bradley", "Electronic Battleship (1982 version)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // *** diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index 4cd7736585a..ea66da14cdf 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -122,34 +122,34 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint8_t m_r[8]; // MCU R ports write data (optional) - uint16_t m_d; // MCU D port write data (optional) - uint8_t m_int[2]; // MCU INT0/1 pins state - uint16_t m_inp_mux; // multiplexed inputs mask + u8 m_r[8]; // MCU R ports write data (optional) + u16 m_d; // MCU D port write data (optional) + u8 m_int[2]; // MCU INT0/1 pins state + u16 m_inp_mux; // multiplexed inputs mask - uint16_t read_inputs(int columns); + u16 read_inputs(int columns); void refresh_interrupts(void); void set_interrupt(int line, int state); DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line); // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 47 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 47 for now) - uint32_t m_grid; // VFD current row data - uint64_t m_plate; // VFD current column data + u32 m_grid; // VFD current row data + u64 m_plate; // VFD current column data - uint64_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint64_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x40]; // (internal use) + u64 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u64 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x40]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint64_t setx, uint32_t sety, bool update = true); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u64 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; @@ -210,7 +210,7 @@ void hh_hmcs40_state::machine_reset() void hh_hmcs40_state::display_update() { - uint64_t active_state[0x20]; + u64 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -223,7 +223,7 @@ void hh_hmcs40_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint64_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u64 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -278,7 +278,7 @@ void hh_hmcs40_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_hmcs40_state::set_display_segmask(uint32_t digits, uint32_t mask) +void hh_hmcs40_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -289,12 +289,12 @@ void hh_hmcs40_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void hh_hmcs40_state::display_matrix(int maxx, int maxy, uint64_t setx, uint32_t sety, bool update) +void hh_hmcs40_state::display_matrix(int maxx, int maxy, u64 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint64_t mask = (u64(1) << maxx) - 1; + u64 mask = (u64(1) << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (u64(1) << maxx)) : 0; @@ -305,9 +305,9 @@ void hh_hmcs40_state::display_matrix(int maxx, int maxy, uint64_t setx, uint32_t // generic input handlers -uint16_t hh_hmcs40_state::read_inputs(int columns) +u16 hh_hmcs40_state::read_inputs(int columns) { - uint16_t ret = 0; + u16 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -382,7 +382,7 @@ WRITE8_MEMBER(bambball_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); + u16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); display_matrix(16, 9, plate, m_grid); } @@ -491,8 +491,8 @@ public: void bmboxing_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - uint32_t plate = BITSWAP16(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + u32 plate = BITSWAP16(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8); display_matrix(12, 9, plate, grid); } @@ -630,8 +630,8 @@ public: void bfriskyt_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP24(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP24(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21); display_matrix(22, 8, plate, grid); } @@ -649,7 +649,7 @@ WRITE16_MEMBER(bfriskyt_state::grid_w) m_speaker->level_w(data >> 6 & 1); // D11-D15: input mux - uint8_t inp_mux = data >> 11 & 0x1f; + u8 inp_mux = data >> 11 & 0x1f; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -698,7 +698,6 @@ INPUT_CHANGED_MEMBER(bfriskyt_state::input_changed) update_int1(); } - static MACHINE_CONFIG_START( bfriskyt, bfriskyt_state ) /* basic machine hardware */ @@ -763,8 +762,8 @@ WRITE8_MEMBER(packmon_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + u32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); display_matrix(20, 10, plate, grid); } @@ -873,8 +872,8 @@ public: void msthawk_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - uint32_t plate = BITSWAP24(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + u32 plate = BITSWAP24(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); display_matrix(21, 10, plate, grid); } @@ -892,7 +891,7 @@ WRITE16_MEMBER(msthawk_state::grid_w) m_speaker->level_w(data >> 5 & 1); // D10-D15: input mux - uint8_t inp_mux = data >> 10 & 0x3f; + u8 inp_mux = data >> 10 & 0x3f; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -944,7 +943,6 @@ INPUT_CHANGED_MEMBER(msthawk_state::input_changed) update_int0(); } - static MACHINE_CONFIG_START( msthawk, msthawk_state ) /* basic machine hardware */ @@ -1006,8 +1004,8 @@ WRITE8_MEMBER(bzaxxon_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800; + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0); + u32 plate = BITSWAP24(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800; display_matrix(20, 11, plate, grid); } @@ -1017,7 +1015,7 @@ WRITE16_MEMBER(bzaxxon_state::grid_w) m_speaker->level_w(data >> 4 & 1); // D7-D10: input mux - uint8_t inp_mux = data >> 7 & 0xf; + u8 inp_mux = data >> 7 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -1066,7 +1064,6 @@ INPUT_CHANGED_MEMBER(bzaxxon_state::input_changed) update_int1(); } - static MACHINE_CONFIG_START( bzaxxon, bzaxxon_state ) /* basic machine hardware */ @@ -1127,8 +1124,8 @@ WRITE8_MEMBER(zackman_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); display_matrix(29, 8, plate, grid); } @@ -1138,7 +1135,7 @@ WRITE16_MEMBER(zackman_state::grid_w) m_speaker->level_w(data >> 2 & 1); // D11-D14: input mux - uint8_t inp_mux = data >> 11 & 0xf; + u8 inp_mux = data >> 11 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -1183,7 +1180,6 @@ INPUT_CHANGED_MEMBER(zackman_state::input_changed) update_int0(); } - static MACHINE_CONFIG_START( zackman, zackman_state ) /* basic machine hardware */ @@ -1243,8 +1239,8 @@ public: void bpengo_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP32(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP32(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); display_matrix(25, 8, plate, grid); } @@ -1262,7 +1258,7 @@ WRITE16_MEMBER(bpengo_state::grid_w) m_speaker->level_w(data >> 10 & 1); // D12-D15: input mux - uint8_t inp_mux = data >> 12 & 0xf; + u8 inp_mux = data >> 12 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -1311,7 +1307,6 @@ INPUT_CHANGED_MEMBER(bpengo_state::input_changed) update_int0(); } - static MACHINE_CONFIG_START( bpengo, bpengo_state ) /* basic machine hardware */ @@ -1372,8 +1367,8 @@ public: void bbtime_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); - uint32_t plate = BITSWAP32(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1; + u8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); + u32 plate = BITSWAP32(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1; display_matrix(28, 6, plate, grid); } @@ -1391,7 +1386,7 @@ WRITE16_MEMBER(bbtime_state::grid_w) m_speaker->level_w(data >> 3 & 1); // D10-D14: input mux - uint8_t inp_mux = data >> 10 & 0x1f; + u8 inp_mux = data >> 10 & 0x1f; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -1437,7 +1432,6 @@ INPUT_CHANGED_MEMBER(bbtime_state::input_changed) update_int0(); } - static MACHINE_CONFIG_START( bbtime, bbtime_state ) /* basic machine hardware */ @@ -1498,8 +1492,8 @@ WRITE8_MEMBER(bdoramon_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,7,6); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0); + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,7,6); + u32 plate = BITSWAP24(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0); display_matrix(19, 8, plate, grid); } @@ -1597,8 +1591,8 @@ WRITE8_MEMBER(bultrman_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,0,18,17,16,15,14,13,12,3,11,10,9,8,7,6,5,4,1,2); + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,18,17,16,15,14,13,12,3,11,10,9,8,7,6,5,4,1,2); display_matrix(18, 8, plate, grid); } @@ -1684,7 +1678,7 @@ public: void machiman_state::prepare_display() { - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); display_matrix(19, 5, plate, m_grid); } @@ -1938,7 +1932,7 @@ WRITE8_MEMBER(alnattck_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15); display_matrix(20, 10, plate, m_grid); } @@ -2065,7 +2059,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim) void cdkong_state::prepare_display() { - uint32_t plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800; + u32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800; display_matrix(29, 11, plate, m_grid); } @@ -2183,8 +2177,8 @@ public: void cgalaxn_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); - uint16_t plate = BITSWAP16(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13); + u16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); + u16 plate = BITSWAP16(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13); display_matrix(15, 12, plate, grid); } @@ -2248,7 +2242,6 @@ INPUT_CHANGED_MEMBER(cgalaxn_state::player_switch) prepare_display(); } - static MACHINE_CONFIG_START( cgalaxn, cgalaxn_state ) /* basic machine hardware */ @@ -2319,8 +2312,8 @@ WRITE8_MEMBER(cpacman_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); - uint32_t plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); + u32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); display_matrix(27, 11, plate, grid); } @@ -2436,8 +2429,8 @@ WRITE8_MEMBER(cmspacmn_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1); - uint64_t plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080; + u16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1); + u64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080; display_matrix(33, 12, plate, grid); } @@ -2552,7 +2545,7 @@ void sag_state::prepare_display() // grid 8-11 are 7segs set_display_segmask(0xf00, 0x7f); - uint8_t seg = BITSWAP8(m_plate,3,4,5,6,7,8,9,10); + u8 seg = BITSWAP8(m_plate,3,4,5,6,7,8,9,10); for (int y = 8; y < 12; y++) m_display_state[y] = (m_grid >> y & 1) ? seg : 0; @@ -2682,8 +2675,8 @@ public: void egalaxn2_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); + u16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); + u32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); display_matrix(24, 15, plate, grid); } @@ -2865,7 +2858,7 @@ public: DECLARE_WRITE8_MEMBER(plate_w); DECLARE_WRITE16_MEMBER(grid_w); - uint8_t m_cop_irq; + u8 m_cop_irq; DECLARE_WRITE_LINE_MEMBER(speaker_w); DECLARE_WRITE8_MEMBER(cop_irq_w); DECLARE_READ8_MEMBER(cop_latch_r); @@ -2882,8 +2875,8 @@ protected: void eturtles_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0); - uint32_t plate = BITSWAP32(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13); + u16 grid = BITSWAP16(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0); + u32 plate = BITSWAP32(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13); display_matrix(30, 15, plate | (grid >> 5 & 8), grid); // grid 8 also forces plate 3 high } @@ -2902,7 +2895,7 @@ WRITE16_MEMBER(eturtles_state::grid_w) m_d = data; // D1-D6: input mux - uint8_t inp_mux = data >> 1 & 0x3f; + u8 inp_mux = data >> 1 & 0x3f; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -2917,7 +2910,7 @@ WRITE16_MEMBER(eturtles_state::grid_w) void eturtles_state::update_int() { // INT0/1 on multiplexed inputs, and from COP D0 - uint8_t inp = read_inputs(6); + u8 inp = read_inputs(6); set_interrupt(0, (inp & 1) | m_cop_irq); set_interrupt(1, inp & 2); } @@ -2988,7 +2981,6 @@ INPUT_CHANGED_MEMBER(eturtles_state::input_changed) update_int(); } - void eturtles_state::machine_start() { hh_hmcs40_state::machine_start(); @@ -3062,8 +3054,8 @@ public: void estargte_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1); - uint32_t plate = BITSWAP32(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13); + u16 grid = BITSWAP16(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1); + u32 plate = BITSWAP32(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13); display_matrix(29, 14, plate, grid); } @@ -3179,8 +3171,8 @@ WRITE8_MEMBER(ghalien_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + u32 plate = BITSWAP24(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18); display_matrix(20, 10, plate, grid); } @@ -3298,8 +3290,8 @@ WRITE8_MEMBER(gckong_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); - uint32_t plate = BITSWAP32(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000; + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); + u32 plate = BITSWAP32(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000; display_matrix(32, 11, plate, grid); } @@ -3309,7 +3301,7 @@ WRITE16_MEMBER(gckong_state::grid_w) m_speaker->level_w(data >> 2 & 1); // D5-D8: input mux - uint8_t inp_mux = data >> 5 & 0xf; + u8 inp_mux = data >> 5 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -3360,7 +3352,6 @@ INPUT_CHANGED_MEMBER(gckong_state::input_changed) update_int1(); } - static MACHINE_CONFIG_START( gckong, gckong_state ) /* basic machine hardware */ @@ -3422,7 +3413,7 @@ WRITE8_MEMBER(gdigdug_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint32_t plate = BITSWAP32(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16); + u32 plate = BITSWAP32(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16); display_matrix(32, 9, plate, m_grid); } @@ -3432,7 +3423,7 @@ WRITE16_MEMBER(gdigdug_state::grid_w) m_speaker->level_w(data >> 6 & 1); // D11-D15: input mux - uint8_t inp_mux = data >> 11 & 0x1f; + u8 inp_mux = data >> 11 & 0x1f; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -3480,7 +3471,6 @@ INPUT_CHANGED_MEMBER(gdigdug_state::input_changed) update_int1(); } - static MACHINE_CONFIG_START( gdigdug, gdigdug_state ) /* basic machine hardware */ @@ -3543,7 +3533,7 @@ public: void mwcbaseb_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); display_matrix(16, 8, m_plate, grid); } @@ -3641,7 +3631,7 @@ static INPUT_PORTS_START( mwcbaseb ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("P1 1") INPUT_PORTS_END -static const int16_t mwcbaseb_speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 }; +static const s16 mwcbaseb_speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 }; static MACHINE_CONFIG_START( mwcbaseb, mwcbaseb_state ) @@ -3703,7 +3693,7 @@ WRITE8_MEMBER(pbqbert_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint32_t plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000; + u32 plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000; display_matrix(30, 8, plate, m_grid); } @@ -3791,8 +3781,8 @@ public: void kingman_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - uint32_t plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + u32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); display_matrix(23, 9, plate, grid); } @@ -3810,7 +3800,7 @@ WRITE16_MEMBER(kingman_state::grid_w) m_speaker->level_w(data >> 6 & 1); // D12-D15: input mux - uint8_t inp_mux = data >> 12 & 0xf; + u8 inp_mux = data >> 12 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -3856,7 +3846,6 @@ INPUT_CHANGED_MEMBER(kingman_state::input_changed) update_int0(); } - static MACHINE_CONFIG_START( kingman, kingman_state ) /* basic machine hardware */ @@ -3913,8 +3902,8 @@ public: void tmtron_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); - uint32_t plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); + u32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); display_matrix(23, 10, plate, grid); } @@ -3932,7 +3921,7 @@ WRITE16_MEMBER(tmtron_state::grid_w) m_speaker->level_w(data >> 4 & 1); // D12-D15: input mux - uint8_t inp_mux = data >> 12 & 0xf; + u8 inp_mux = data >> 12 & 0xf; if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; @@ -3978,7 +3967,6 @@ INPUT_CHANGED_MEMBER(tmtron_state::input_changed) update_int1(); } - static MACHINE_CONFIG_START( tmtron, tmtron_state ) /* basic machine hardware */ @@ -4040,7 +4028,7 @@ WRITE8_MEMBER(vinvader_state::plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - uint16_t plate = BITSWAP16(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0); + u16 plate = BITSWAP16(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0); display_matrix(12, 9, plate, m_grid); } diff --git a/src/mame/drivers/hh_melps4.cpp b/src/mame/drivers/hh_melps4.cpp index 0e557ee6b58..f337c6def02 100644 --- a/src/mame/drivers/hh_melps4.cpp +++ b/src/mame/drivers/hh_melps4.cpp @@ -34,28 +34,28 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint16_t m_inp_mux; // multiplexed inputs mask + u16 m_inp_mux; // multiplexed inputs mask - uint8_t read_inputs(int columns); + u8 read_inputs(int columns); DECLARE_INPUT_CHANGED_MEMBER(reset_button); // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_grid; // VFD current row data - uint32_t m_plate; // VFD current column data + u32 m_grid; // VFD current row data + u32 m_plate; // VFD current column data - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; @@ -109,7 +109,7 @@ void hh_melps4_state::machine_reset() void hh_melps4_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -122,7 +122,7 @@ void hh_melps4_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -177,12 +177,12 @@ void hh_melps4_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_melps4_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void hh_melps4_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -193,9 +193,9 @@ void hh_melps4_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t // generic input handlers -uint8_t hh_melps4_state::read_inputs(int columns) +u8 hh_melps4_state::read_inputs(int columns) { - uint8_t ret = 0; + u8 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -246,8 +246,8 @@ public: void cfrogger_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11); - uint16_t plate = BITSWAP16(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8); + u16 grid = BITSWAP16(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11); + u16 plate = BITSWAP16(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8); display_matrix(16, 12, plate, grid); } @@ -362,8 +362,8 @@ public: void gjungler_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,13,16,15,14,13,12,7,0,6,1,5,2,4,3) | 0x2000; + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,13,16,15,14,13,12,7,0,6,1,5,2,4,3) | 0x2000; display_matrix(18, 12, plate, grid); } diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp index c8b013ecd12..8d50186f349 100644 --- a/src/mame/drivers/hh_pic16.cpp +++ b/src/mame/drivers/hh_pic16.cpp @@ -50,23 +50,23 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint8_t m_b; // MCU port B data - uint8_t m_c; // MCU port C data + u8 m_b; // MCU port B data + u8 m_c; // MCU port C data // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; @@ -118,7 +118,7 @@ void hh_pic16_state::machine_reset() void hh_pic16_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -131,7 +131,7 @@ void hh_pic16_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -186,12 +186,12 @@ void hh_pic16_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_pic16_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void hh_pic16_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -258,7 +258,7 @@ static INPUT_PORTS_START( maniac ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) // upper-left INPUT_PORTS_END -static const int16_t maniac_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 maniac_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( maniac, maniac_state ) diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp index 92fc2c56e06..a0edf5bc8b8 100644 --- a/src/mame/drivers/hh_sm510.cpp +++ b/src/mame/drivers/hh_sm510.cpp @@ -34,11 +34,11 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint16_t m_inp_mux; // multiplexed inputs mask - int m_inp_lines; // number of input mux columns - uint8_t m_lcd_output_cache[0x100]; + u16 m_inp_mux; // multiplexed inputs mask + int m_inp_lines; // number of input mux columns + u8 m_lcd_output_cache[0x100]; - uint8_t read_inputs(int columns); + u8 read_inputs(int columns); virtual void update_k_line(); virtual DECLARE_INPUT_CHANGED_MEMBER(input_changed); @@ -87,7 +87,7 @@ WRITE16_MEMBER(hh_sm510_state::lcd_segment_w) for (int seg = 0; seg < 0x10; seg++) { int index = offset << 4 | seg; - uint8_t state = data >> seg & 1; + u8 state = data >> seg & 1; if (state != m_lcd_output_cache[index]) { @@ -107,9 +107,9 @@ WRITE16_MEMBER(hh_sm510_state::lcd_segment_w) // generic input handlers - usually S output is input mux, and K input for buttons -uint8_t hh_sm510_state::read_inputs(int columns) +u8 hh_sm510_state::read_inputs(int columns) { - uint8_t ret = 0; + u8 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index e14282582f9..b3ebab82e95 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -19,6 +19,7 @@ @CP0904A TMS0970 1977, Milton Bradley Comp IV @MP0905B TMS0970 1977, Parker Brothers Codename Sector *MP0057 TMS1000 1978, APH Student Speech+ (same ROM contents as TSI Speech+?) + @MP0154 TMS1000 1979, Fonas 2 Player Baseball @MP0158 TMS1000 1979, Entex Soccer (6003) @MP0163 TMS1000 1979, A-One LSI Match Number/LJN Electronic Concentration @MP0168 TMS1000 1979, Conic Multisport/Tandy Sports Arena (model 60-2158) @@ -80,7 +81,7 @@ @MP3476 TMS1100 1979, Milton Bradley Super Simon MP3479 TMS1100 1980, MicroVision cartridge: Baseball MP3481 TMS1100 1979, MicroVision cartridge: Connect Four - *MP3491 TMS1100 1980, Mattel Horserace Analyzer + @MP3491 TMS1100 1979, Mattel Thoroughbred Horse Race Analyzer MP3496 TMS1100 1980, MicroVision cartridge: Sea Duel M34009 TMS1100 1981, MicroVision cartridge: Alien Raiders (note: MP3498, MP3499, M3400x..) @M34012 TMS1100 1980, Mattel Dungeons & Dragons - Computer Labyrinth Game @@ -122,6 +123,8 @@ brighter: tc4/h2hfootb(offense), bankshot(cue ball), ... - stopthiep: unable to start a game (may be intentional?) - tbreakup: some of the leds flicker (rom and PLAs doublechecked) + - 7in1ss: in 2-player mode, game select and skill select can be configured + after selecting a game? - bship discrete sound, netlist is documented - finish bshipb SN76477 sound - improve elecbowl driver @@ -130,6 +133,7 @@ #include "includes/hh_tms1k.h" #include "machine/tms1024.h" +#include "video/hlcd0515.h" #include "sound/beep.h" #include "sound/sn76477.h" #include "sound/s14001a.h" @@ -158,17 +162,19 @@ #include "ebball3.lh" #include "ebaskb2.lh" #include "efootb4.lh" -#include "einvader.lh" // test-layout(but still playable) +#include "einvader.lh" #include "elecbowl.lh" #include "elecdet.lh" #include "esbattle.lh" #include "esoccer.lh" +#include "f2pbball.lh" #include "fxmcr165.lh" // clickable #include "gjackpot.lh" #include "gpoker.lh" #include "h2hbaseb.lh" #include "h2hboxing.lh" #include "h2hfootb.lh" +#include "horseran.lh" #include "lostreas.lh" // clickable #include "matchnum.lh" // clickable #include "mathmagi.lh" @@ -250,7 +256,7 @@ void hh_tms1k_state::machine_reset() void hh_tms1k_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -263,7 +269,7 @@ void hh_tms1k_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -325,7 +331,7 @@ void hh_tms1k_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_tms1k_state::set_display_segmask(uint32_t digits, uint32_t mask) +void hh_tms1k_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -336,12 +342,12 @@ void hh_tms1k_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void hh_tms1k_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void hh_tms1k_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -352,9 +358,9 @@ void hh_tms1k_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t // generic input handlers -uint8_t hh_tms1k_state::read_inputs(int columns) +u8 hh_tms1k_state::read_inputs(int columns) { - uint8_t ret = 0; + u8 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -364,10 +370,10 @@ uint8_t hh_tms1k_state::read_inputs(int columns) return ret; } -uint8_t hh_tms1k_state::read_rotated_inputs(int columns, uint8_t rowmask) +u8 hh_tms1k_state::read_rotated_inputs(int columns, u8 rowmask) { - uint8_t ret = 0; - uint16_t colmask = (1 << columns) - 1; + u8 ret = 0; + u16 colmask = (1 << columns) - 1; // read selected input columns for (int i = 0; i < 8; i++) @@ -510,12 +516,12 @@ static INPUT_PORTS_START( matchnum ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Square 1") INPUT_PORTS_END -static const int16_t matchnum_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 matchnum_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( matchnum, matchnum_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 325000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 325000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(matchnum_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(matchnum_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(matchnum_state, write_o)) @@ -656,7 +662,7 @@ static INPUT_PORTS_START( mathmagi ) INPUT_PORTS_END // output PLA is not decapped -static const uint16_t mathmagi_output_pla[0x20] = +static const u16 mathmagi_output_pla[0x20] = { lA+lB+lC+lD+lE+lF, // 0 lB+lC, // 1 @@ -695,7 +701,7 @@ static const uint16_t mathmagi_output_pla[0x20] = static MACHINE_CONFIG_START( mathmagi, mathmagi_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 175000) // approximation - RC osc. R=68K, C=82pf + MCFG_CPU_ADD("maincpu", TMS1100, 175000) // approximation - RC osc. R=68K, C=82pF MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r)) @@ -801,7 +807,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( bcheetah, bcheetah_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 100000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 100000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(bcheetah_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bcheetah_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bcheetah_state, write_o)) @@ -873,7 +879,7 @@ WRITE16_MEMBER(amaztron_state::write_o) READ8_MEMBER(amaztron_state::read_k) { // K: multiplexed inputs - uint8_t k = read_inputs(6); + u8 k = read_inputs(6); // the 5th column is tied to K4+K8 if (k & 0x10) k |= 0xc; @@ -928,7 +934,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( amaztron, amaztron_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 300000) // approximation - RC osc. R=33K?, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 300000) // approximation - RC osc. R=33K?, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o)) @@ -1066,7 +1072,7 @@ static INPUT_PORTS_START( zodiac ) INPUT_PORTS_END // output PLA is not decapped -static const uint16_t zodiac_output_pla[0x20] = +static const u16 zodiac_output_pla[0x20] = { 0x80, // empty/led 1/7 lC, // i/led 2/8 @@ -1105,7 +1111,7 @@ static const uint16_t zodiac_output_pla[0x20] = static MACHINE_CONFIG_START( zodiac, zodiac_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 500000) // approximation - RC osc. R=18K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 500000) // approximation - RC osc. R=18K, C=100pF MCFG_TMS1XXX_OUTPUT_PLA(zodiac_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(zodiac_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(zodiac_state, write_r)) @@ -1154,7 +1160,7 @@ public: void cqback_state::prepare_display() { // R9 selects between segments B/C or A'/D' - uint16_t seg = m_o; + u16 seg = m_o; if (m_r & 0x200) seg = (m_o << 7 & 0x300) | (m_o & 0xf9); @@ -1221,7 +1227,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( cqback, cqback_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=33K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=33K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(cqback_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cqback_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cqback_state, write_o)) @@ -1339,7 +1345,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( h2hfootb, h2hfootb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=39K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 310000) // approximation - RC osc. R=39K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(h2hfootb_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hfootb_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hfootb_state, write_o)) @@ -1462,10 +1468,9 @@ INPUT_CHANGED_MEMBER(h2hbaseb_state::skill_switch) set_clock(); } - void h2hbaseb_state::set_clock() { - // MCU clock is from an RC circuit with C=47pf, and R value is depending on + // MCU clock is from an RC circuit with C=47pF, and R value is depending on // skill switch: R=51K(1) or 43K(2) m_maincpu->set_unscaled_clock((m_inp_matrix[5]->read() & 1) ? 400000 : 350000); } @@ -1591,7 +1596,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( h2hboxing, h2hboxing_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=39K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=39K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(h2hboxing_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hboxing_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hboxing_state, write_o)) @@ -1744,7 +1749,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( tc4, tc4_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o)) @@ -1853,7 +1858,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( cnbaskb, cnbaskb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(cnbaskb_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnbaskb_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnbaskb_state, write_o)) @@ -1966,7 +1971,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( cmsport, cmsport_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 375000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 375000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(cmsport_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cmsport_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cmsport_state, write_o)) @@ -2087,12 +2092,12 @@ static INPUT_PORTS_START( cnfball ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY INPUT_PORTS_END -static const int16_t cnfball_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 cnfball_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( cnfball, cnfball_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(cnfball_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnfball_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnfball_state, write_o)) @@ -2143,7 +2148,7 @@ public: void cnfball2_state::prepare_display() { // R1 selects between segments B/C or A'/D' - uint16_t seg = m_o; + u16 seg = m_o; if (~m_r & 2) seg = (m_o << 7 & 0x300) | (m_o & 0xf9); @@ -2205,7 +2210,7 @@ static INPUT_PORTS_START( cnfball2 ) INPUT_PORTS_END // output PLA is not decapped -static const uint16_t cnfball2_output_pla[0x20] = +static const u16 cnfball2_output_pla[0x20] = { // first half was dumped electronically 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x40, 0x01, 0x08, 0x02, 0x04, 0x00, @@ -2218,7 +2223,7 @@ static const uint16_t cnfball2_output_pla[0x20] = static MACHINE_CONFIG_START( cnfball2, cnfball2_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_OUTPUT_PLA(cnfball2_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(cnfball2_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnfball2_state, write_r)) @@ -2324,7 +2329,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( esoccer, esoccer_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=33pf + MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=33pF MCFG_TMS1XXX_READ_K_CB(READ8(esoccer_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(esoccer_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(esoccer_state, write_o)) @@ -2458,7 +2463,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ebball, ebball_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 375000) // approximation - RC osc. R=43K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 375000) // approximation - RC osc. R=43K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o)) @@ -2581,7 +2586,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ebball2, ebball2_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o)) @@ -2744,10 +2749,9 @@ INPUT_CHANGED_MEMBER(ebball3_state::skill_switch) set_clock(); } - void ebball3_state::set_clock() { - // MCU clock is from an RC circuit(R=47K, C=33pf) oscillating by default at ~340kHz, + // MCU clock is from an RC circuit(R=47K, C=33pF) oscillating by default at ~340kHz, // but on PRO, the difficulty switch adds an extra 150K resistor to Vdd to speed // it up to around ~440kHz. m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 440000 : 340000); @@ -2873,7 +2877,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( esbattle, esbattle_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 425000) // approximation - RC osc. R=47K, C=33pf + MCFG_CPU_ADD("maincpu", TMS1000, 425000) // approximation - RC osc. R=47K, C=33pF MCFG_TMS1XXX_READ_K_CB(READ8(esbattle_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(esbattle_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(esbattle_state, write_o)) @@ -2901,8 +2905,6 @@ MACHINE_CONFIG_END TMS1100, the second more widespread release runs on a COP400. There are also differences with the overlay mask. - NOTE!: MAME external artwork is required - ***************************************************************************/ class einvader_state : public hh_tms1k_state @@ -2967,10 +2969,9 @@ INPUT_CHANGED_MEMBER(einvader_state::skill_switch) set_clock(); } - void einvader_state::set_clock() { - // MCU clock is from an RC circuit(R=47K, C=56pf) oscillating by default at ~320kHz, + // MCU clock is from an RC circuit(R=47K, C=56pF) oscillating by default at ~320kHz, // but on PRO, the difficulty switch adds an extra 180K resistor to Vdd to speed // it up to around ~400kHz. m_maincpu->set_unscaled_clock((m_inp_matrix[0]->read() & 8) ? 400000 : 320000); @@ -2990,6 +2991,11 @@ static MACHINE_CONFIG_START( einvader, einvader_state ) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(einvader_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(einvader_state, write_o)) + /* video hardware */ + MCFG_SCREEN_SVG_ADD("screen", "svg") + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(939, 1080) + MCFG_SCREEN_VISIBLE_AREA(0, 939-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_einvader) @@ -3100,7 +3106,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( efootb4, efootb4_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(efootb4_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(efootb4_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(efootb4_state, write_o)) @@ -3221,7 +3227,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ebaskb2, ebaskb2_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 360000) // approximation - RC osc. R=33K, C=82pf + MCFG_CPU_ADD("maincpu", TMS1100, 360000) // approximation - RC osc. R=33K, C=82pF MCFG_TMS1XXX_READ_K_CB(READ8(ebaskb2_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebaskb2_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebaskb2_state, write_o)) @@ -3258,6 +3264,8 @@ MACHINE_CONFIG_END 8 = 4.2 18 = 7.3 28 = 8.4 38 = 8.2 9 = 4.3 19 = - 29 = 9.4 39 = 8.3 + NOTE!: MAME external artwork is required + ***************************************************************************/ class raisedvl_state : public hh_tms1k_state @@ -3338,15 +3346,14 @@ INPUT_CHANGED_MEMBER(raisedvl_state::skill_switch) set_clock(); } - void raisedvl_state::set_clock() { - // MCU clock is from an RC circuit with C=47pf, R=47K by default. Skills + // MCU clock is from an RC circuit with C=47pF, R=47K by default. Skills // 2 and 3 add a 150K resistor in parallel, and skill 4 adds a 100K one. // 0: R=47K -> ~350kHz // 2,3: R=35K8 -> ~425kHz (combined) // 4: R=32K -> ~465kHz (combined) - uint8_t inp = m_inp_matrix[1]->read(); + u8 inp = m_inp_matrix[1]->read(); m_maincpu->set_unscaled_clock((inp & 0x20) ? 465000 : ((inp & 0x10) ? 425000 : 350000)); } @@ -3379,6 +3386,137 @@ MACHINE_CONFIG_END /*************************************************************************** + Fonas 2 Player Baseball + * TMS1000NLL MP0154 (die label 1000B, MP0154) + * 4 7seg LEDs, 37 other LEDs, 1-bit sound + + known releases: + - World: 2 Player Baseball + - USA: 2 Player Baseball, distributed by Sears + - Canada: 2 Player Baseball, distributed by Talbot Electronics + + led translation table: led zz from game PCB = MAME y.x: + + 0 = - 10 = 2.2 20 = 4.0 30 = 4.4 + 1 = 2.3 11 = 3.3 21 = 2.7 31 = 3.7 + 2 = 0.4 12 = 1.2 22 = 0.0 32 = 4.3 + 3 = 3.2 13 = 2.4 23 = 4.1 33 = 4.6 + 4 = 0.5 14 = 1.0 24 = 3.1 34 = 3.5 + 5 = 0.3 15 = 2.1 25 = 0.2 35 = 4.5 + 6 = 3.4 16 = 1.1 26 = 0.1 + 7 = 1.3 17 = 4.7 27 = 4.2 + 8 = 1.4 18 = 2.0 28 = 3.0 + 9 = 1.7 19 = 0.7 29 = 1.5 + +***************************************************************************/ + +class f2pbball_state : public hh_tms1k_state +{ +public: + f2pbball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + DECLARE_INPUT_CHANGED_MEMBER(reset_button); +}; + +// handlers + +void f2pbball_state::prepare_display() +{ + // R5-R8 are 7segs + set_display_segmask(0x1e0, 0x7f); + display_matrix(8, 9, m_o, m_r); +} + +WRITE16_MEMBER(f2pbball_state::write_r) +{ + // R4,R9,R10: input mux + m_inp_mux = (data >> 4 & 1) | (data >> 8 & 6); + + // R9,R10(ANDed together): speaker out + m_speaker->level_w(data >> 10 & data >> 9 & 1); + + // R0-R8: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(f2pbball_state::write_o) +{ + // O0-O7: led state + m_o = BITSWAP8(data,0,7,6,5,4,3,2,1); + prepare_display(); +} + +READ8_MEMBER(f2pbball_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(3); +} + + +// config + +static INPUT_PORTS_START( f2pbball ) + PORT_START("IN.0") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Pick Off") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x0c, 0x04, "Players" ) + PORT_CONFSETTING( 0x04, "1" ) + PORT_CONFSETTING( 0x00, "Practice" ) + PORT_CONFSETTING( 0x08, "2" ) + + PORT_START("IN.1") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Score") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Steal") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pitch") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Swing") + + PORT_START("IN.2") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_COCKTAIL PORT_NAME("P2 Curve Left") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Slow") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Curve Right") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_COCKTAIL PORT_NAME("P2 Fast") + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P1 Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, f2pbball_state, reset_button, 0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(f2pbball_state::reset_button) +{ + // reset button is directly wired to TMS1000 INIT pin + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); +} + +static MACHINE_CONFIG_START( f2pbball, f2pbball_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 325000) // approximation - RC osc. R=51K, C=39pF + MCFG_TMS1XXX_READ_K_CB(READ8(f2pbball_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(f2pbball_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(f2pbball_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_f2pbball) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + Gakken Poker * PCB label POKER. gakken * TMS1370 MP2105 (die label same) @@ -3503,7 +3641,7 @@ void gpoker_state::machine_reset() static MACHINE_CONFIG_START( gpoker, gpoker_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1370, 350000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1370, 350000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gpoker_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) @@ -3616,7 +3754,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( gjackpot, gjackpot_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gjackpot_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) @@ -3665,8 +3803,8 @@ public: void ginv1000_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,9,8,7); - uint16_t plate = BITSWAP16(m_plate,15,14,13,12,3,4,7,8,9,10,11,2,6,5,1,0); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,9,8,7); + u16 plate = BITSWAP16(m_plate,15,14,13,12,3,4,7,8,9,10,11,2,6,5,1,0); display_matrix(12, 10, plate, grid); } @@ -3677,7 +3815,7 @@ WRITE16_MEMBER(ginv1000_state::write_r) // R8,R15: input mux m_inp_mux = (data >> 8 & 1) | (data >> 14 & 2); - + // R1-R10: VFD matrix grid // R11-R14: VFD matrix plate m_grid = data >> 1 & 0x3ff; @@ -3721,7 +3859,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ginv1000, ginv1000_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1370, 325000) // approximation + MCFG_CPU_ADD("maincpu", TMS1370, 340000) // approximation MCFG_TMS1XXX_READ_K_CB(READ8(ginv1000_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ginv1000_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ginv1000_state, write_o)) @@ -3987,7 +4125,7 @@ static INPUT_PORTS_START( elecdet ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END -static const int16_t elecdet_speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff }; +static const s16 elecdet_speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff }; static MACHINE_CONFIG_START( elecdet, elecdet_state ) @@ -4120,7 +4258,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( starwbc, starwbc_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=51K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=51K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o)) @@ -4247,7 +4385,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( astro, astro_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf + MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pF MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o)) @@ -4313,8 +4451,8 @@ void elecbowl_state::prepare_display() } // lamp muxes - uint8_t mask = 1 << (m_o & 7); - uint8_t d = (m_r & 2) ? mask : 0; + u8 mask = 1 << (m_o & 7); + u8 d = (m_r & 2) ? mask : 0; if (~m_r & 1) m_display_state[5] = (m_display_state[5] & ~mask) | d; if (~m_r & 4) @@ -4391,7 +4529,7 @@ static INPUT_PORTS_START( elecbowl ) INPUT_PORTS_END // output PLA is not decapped -static const uint16_t elecbowl_output_pla[0x20] = +static const u16 elecbowl_output_pla[0x20] = { lA+lB+lC+lD+lE+lF, // 0 lB+lC, // 1 @@ -4412,7 +4550,7 @@ static const uint16_t elecbowl_output_pla[0x20] = static MACHINE_CONFIG_START( elecbowl, elecbowl_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pF MCFG_TMS1XXX_OUTPUT_PLA(elecbowl_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(elecbowl_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecbowl_state, write_r)) @@ -4433,6 +4571,157 @@ MACHINE_CONFIG_END /*************************************************************************** + Mattel Thoroughbred Horse Race Analyzer + * PCB label 1670-4619D + * TMS1100NLL MP3491-N2 (die label 1100E MP3491) + * HLCD0569, 67-segment LCD panel, no sound + + This handheld is not a toy, read the manual for more information. In short, + it is a device for prediciting the winning chance of a gambling horserace. + + known releases: + - USA: Thoroughbred Horse Race Analyzer + - China/Canada: Thoroughbred Horse Race Analyzer, distributed in 1994 by + Advanced Handicapping Technologies, Inc. + +***************************************************************************/ + +class horseran_state : public hh_tms1k_state +{ +public: + horseran_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag), + m_lcd(*this, "lcd") + { } + + required_device<hlcd0569_device> m_lcd; + + DECLARE_WRITE32_MEMBER(lcd_output_w); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE32_MEMBER(horseran_state::lcd_output_w) +{ + // only 3 rows used + if (offset > 2) + return; + + // output segments (lamp row*100 + col) + for (int i = 0; i < 24; i++) + output().set_lamp_value(offset*100 + i+1, data >> i & 1); + + // col5-11 and col13-19 are 7segs + for (int i = 0; i < 2; i++) + output().set_digit_value(offset << 1 | i, BITSWAP8(data >> (4+8*i),7,3,5,2,0,1,4,6) & 0x7f); +} + +WRITE16_MEMBER(horseran_state::write_r) +{ + // R0: HLCD0569 clock + // R1: HLCD0569 data in + // R2: HLCD0569 _CS + m_lcd->write_cs(data >> 2 & 1); + m_lcd->write_data(data >> 1 & 1); + m_lcd->write_clock(data & 1); + + // R3-R10: input mux + m_inp_mux = data >> 3 & 0xff; +} + +READ8_MEMBER(horseran_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(8); +} + + +// config + +/* physical button layout and labels is like this: + + [PURSE] [DIST.] [P. POSN.] [DAYS] [R.S.L.] [7] [8] [9] + [RACES] [WINS] [PLACES] [SHOWS] [EARNINGS] [4] [5] [6] + [DISTANCE] [L.E.B. 1st] [L.E.B. 2nd] [L.E.B. 3rd] [FIN. POSN.] [1] [2] [3] + [L.E.B. Fin] [SPD. RTG.] [SPD. RTG.] [ANALYZE] [NEXT] [C/H] [C/E] [0] + + R.S.L. = Races Since (Last) Layoff + L.E.B. = Last Race / Lengths Back +*/ + +static INPUT_PORTS_START( horseran ) + PORT_START("IN.0") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Next") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Final Position") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Earnings") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("R.S.L.") + + PORT_START("IN.1") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_V) PORT_NAME("Analyze") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("L.E.B. 3rd") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Shows") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("Days") + + PORT_START("IN.2") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Speed Rating (right)") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("L.E.B. 2nd") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Places") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("Post Position") + + PORT_START("IN.3") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Speed Rating (left)") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("L.E.B. 1st") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Wins") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Distance (L.E.B.)") + + PORT_START("IN.4") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("L.E.B. Finish") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Distance") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Races") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Purse") + + PORT_START("IN.5") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + + PORT_START("IN.6") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("C/E") // Clear Entry + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + + PORT_START("IN.7") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("C/H") // Clear Horse Information + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( horseran, horseran_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 300000) // approximation - RC osc. R=56K, C=47pF + MCFG_TMS1XXX_READ_K_CB(READ8(horseran_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(horseran_state, write_r)) + + /* video hardware */ + MCFG_DEVICE_ADD("lcd", HLCD0569, 1100) // C=0.022uF + MCFG_HLCD0515_WRITE_COLS_CB(WRITE32(horseran_state, lcd_output_w)) + MCFG_DEFAULT_LAYOUT(layout_horseran) + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + Mattel Dungeons & Dragons - Computer Labyrinth Game * TMS1100 M34012-N2LL (die label M34012) * 72 buttons, no LEDs, 1-bit sound @@ -4593,7 +4882,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( mdndclab, mdndclab_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 475000) // approximation - RC osc. R=27K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 475000) // approximation - RC osc. R=27K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(mdndclab_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mdndclab_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mdndclab_state, write_o)) @@ -4663,7 +4952,6 @@ WRITE16_MEMBER(comp4_state::write_o) // O0: leds common // other bits: N/C m_o = data; - display_matrix(11, 1, m_r, m_o); } READ8_MEMBER(comp4_state::read_k) @@ -4848,7 +5136,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( bship, bship_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=100K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=100K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(bship_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bship_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bship_state, write_o)) @@ -4951,7 +5239,7 @@ READ8_MEMBER(bshipb_state::read_k) static MACHINE_CONFIG_START( bshipb, bshipb_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=100K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=100K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(bshipb_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bshipb_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bshipb_state, write_o)) @@ -5068,7 +5356,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( simon, simon_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=33K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1000, 350000) // approximation - RC osc. R=33K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) @@ -5190,14 +5478,13 @@ INPUT_CHANGED_MEMBER(ssimon_state::speed_switch) set_clock(); } - void ssimon_state::set_clock() { - // MCU clock is from an RC circuit with C=100pf, R=x depending on speed switch: + // MCU clock is from an RC circuit with C=100pF, R=x depending on speed switch: // 0 Simple: R=51K -> ~200kHz // 1 Normal: R=37K -> ~275kHz // 2 Super: R=22K -> ~400kHz - uint8_t inp = m_inp_matrix[6]->read(); + u8 inp = m_inp_matrix[6]->read(); m_maincpu->set_unscaled_clock((inp & 2) ? 400000 : ((inp & 1) ? 275000 : 200000)); } @@ -5385,12 +5672,12 @@ void bigtrak_state::machine_start() save_item(NAME(m_gearbox_pos)); } -static const int16_t bigtrak_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; +static const s16 bigtrak_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; static MACHINE_CONFIG_START( bigtrak, bigtrak_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(bigtrak_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bigtrak_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bigtrak_state, write_o)) @@ -5509,7 +5796,7 @@ void mbdtower_state::prepare_display() // update current state if (~m_r & 0x10) { - uint8_t o = BITSWAP8(m_o,7,0,4,3,2,1,6,5) & 0x7f; + u8 o = BITSWAP8(m_o,7,0,4,3,2,1,6,5) & 0x7f; m_display_state[2] = (m_o & 0x80) ? o : 0; m_display_state[1] = (m_o & 0x80) ? 0 : o; m_display_state[0] = (m_r >> 8 & 1) | (m_r >> 4 & 0xe); @@ -5623,7 +5910,7 @@ void mbdtower_state::machine_start() static MACHINE_CONFIG_START( mbdtower, mbdtower_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pf + MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pF MCFG_TMS1XXX_READ_K_CB(READ8(mbdtower_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mbdtower_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mbdtower_state, write_o)) @@ -5715,28 +6002,28 @@ static INPUT_PORTS_START( cnsector ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range") PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Right") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim") PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("Evasive Sub") // expert button PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire") PORT_START("IN.3") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Slower") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button PORT_START("IN.4") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Faster") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode") INPUT_PORTS_END static MACHINE_CONFIG_START( cnsector, cnsector_state ) @@ -5851,12 +6138,12 @@ static INPUT_PORTS_START( merlin ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game") INPUT_PORTS_END -static const int16_t merlin_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; +static const s16 merlin_speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; static MACHINE_CONFIG_START( merlin, merlin_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // approximation - RC osc. R=33K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o)) @@ -5920,7 +6207,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( mmerlin, mmerlin_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(mmerlin_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mmerlin_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mmerlin_state, write_o)) @@ -6030,7 +6317,7 @@ static INPUT_PORTS_START( stopthief ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END -static const int16_t stopthief_speaker_levels[7] = { 0, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff }; +static const s16 stopthief_speaker_levels[7] = { 0, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff }; static MACHINE_CONFIG_START( stopthief, stopthief_state ) @@ -6144,7 +6431,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( bankshot, bankshot_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o)) @@ -6255,7 +6542,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( splitsec, splitsec_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf + MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pF MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) @@ -6364,7 +6651,7 @@ static INPUT_PORTS_START( lostreas ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Up") INPUT_PORTS_END -static const int16_t lostreas_speaker_levels[16] = +static const s16 lostreas_speaker_levels[16] = { 0, 0x7fff/15, 0x7fff/14, 0x7fff/13, 0x7fff/12, 0x7fff/11, 0x7fff/10, 0x7fff/9, 0x7fff/8, 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1 @@ -6373,7 +6660,7 @@ static const int16_t lostreas_speaker_levels[16] = static MACHINE_CONFIG_START( lostreas, lostreas_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 425000) // approximation - RC osc. R=39K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 425000) // approximation - RC osc. R=39K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(lostreas_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lostreas_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lostreas_state, write_o)) @@ -6422,8 +6709,8 @@ public: void tcfball_state::prepare_display() { // R8 enables leds, R9 enables digits - uint16_t mask = ((m_r >> 9 & 1) * 0x7f) | ((m_r >> 8 & 1) * 0x780); - uint16_t sel = ((m_r & 0x7f) | (m_r << 7 & 0x780)) & mask; + u16 mask = ((m_r >> 9 & 1) * 0x7f) | ((m_r >> 8 & 1) * 0x780); + u16 sel = ((m_r & 0x7f) | (m_r << 7 & 0x780)) & mask; set_display_segmask(0x77, 0x7f); set_display_segmask(0x08, 0xff); // R3 has DP @@ -6483,7 +6770,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( tcfball, tcfball_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=56K, C=24pf + MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=56K, C=24pF MCFG_TMS1XXX_READ_K_CB(READ8(tcfball_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tcfball_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tcfball_state, write_o)) @@ -6538,7 +6825,7 @@ static INPUT_PORTS_START( tcfballa ) INPUT_PORTS_END // output PLA is not decapped, dumped electronically -static const uint16_t tcfballa_output_pla[0x20] = +static const u16 tcfballa_output_pla[0x20] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x00, 0x46, 0x70, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -6547,7 +6834,7 @@ static const uint16_t tcfballa_output_pla[0x20] = static MACHINE_CONFIG_START( tcfballa, tcfballa_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=50pf + MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=50pF MCFG_TMS1XXX_OUTPUT_PLA(tcfballa_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(tcfballa_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tcfballa_state, write_r)) @@ -6696,7 +6983,7 @@ static INPUT_PORTS_START( tandy12 ) INPUT_PORTS_END // output PLA is not decapped -static const uint16_t tandy12_output_pla[0x20] = +static const u16 tandy12_output_pla[0x20] = { // these are certain 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, @@ -6711,7 +6998,7 @@ static const uint16_t tandy12_output_pla[0x20] = static MACHINE_CONFIG_START( tandy12, tandy12_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 400000) // approximation - RC osc. R=39K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 400000) // approximation - RC osc. R=39K, C=47pF MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r)) @@ -6820,7 +7107,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( monkeysee, monkeysee_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 250000) // approximation - RC osc. R=68K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 250000) // approximation - RC osc. R=68K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(monkeysee_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(monkeysee_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(monkeysee_state, write_o)) @@ -6969,7 +7256,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( speechp, speechp_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 400000) // approximation - RC osc. R=39K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(speechp_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(speechp_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(speechp_state, write_o)) @@ -7069,12 +7356,12 @@ static INPUT_PORTS_START( copycat ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const int16_t copycat_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 copycat_speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( copycat, copycat_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 320000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1000, 320000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(copycat_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(copycat_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(copycat_state, write_o)) @@ -7150,7 +7437,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( copycatm2, copycatm2_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1730, 275000) // approximation - RC osc. R=100K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1730, 275000) // approximation - RC osc. R=100K, C=47pF MCFG_TMS1XXX_READ_K_CB(IOPORT("IN.0")) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(copycatm2_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(copycatm2_state, write_o)) @@ -7221,7 +7508,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ditto, ditto_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1730, 275000) // approximation - RC osc. R=100K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1730, 275000) // approximation - RC osc. R=100K, C=47pF MCFG_TMS1XXX_READ_K_CB(IOPORT("IN.0")) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ditto_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ditto_state, write_o)) @@ -7336,7 +7623,7 @@ INPUT_PORTS_END static MACHINE_CONFIG_START( ss7in1, ss7in1_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(ss7in1_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ss7in1_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ss7in1_state, write_o)) @@ -7398,7 +7685,7 @@ public: { } required_device<tms1024_device> m_expander; - uint8_t m_exp_port[7]; + u8 m_exp_port[7]; DECLARE_WRITE8_MEMBER(expander_w); void prepare_display(); @@ -7504,7 +7791,6 @@ INPUT_CHANGED_MEMBER(tbreakup_state::skill_switch) set_clock(); } - void tbreakup_state::set_clock() { // MCU clock is from an analog circuit with resistor of 73K, PRO2 adds 100K @@ -7657,11 +7943,10 @@ INPUT_CHANGED_MEMBER(phpball_state::flipper_button) output().set_lamp_value(90 + (int)(uintptr_t)param, newval); } - static MACHINE_CONFIG_START( phpball, phpball_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_READ_K_CB(READ8(phpball_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(phpball_state, write_r)) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(phpball_state, write_o)) @@ -7787,7 +8072,7 @@ static INPUT_PORTS_START( ssports4 ) INPUT_PORTS_END // output PLA is not decapped, dumped electronically -static const uint16_t ssports4_output_pla[0x20] = +static const u16 ssports4_output_pla[0x20] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 @@ -7796,7 +8081,7 @@ static const uint16_t ssports4_output_pla[0x20] = static MACHINE_CONFIG_START( ssports4, ssports4_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pf + MCFG_CPU_ADD("maincpu", TMS1100, 375000) // approximation - RC osc. R=47K, C=47pF MCFG_TMS1XXX_OUTPUT_PLA(ssports4_output_pla) MCFG_TMS1XXX_READ_K_CB(READ8(ssports4_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssports4_state, write_r)) @@ -8038,6 +8323,9 @@ ROM_START( einvader ) ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) ROM_REGION( 365, "maincpu:opla", 0 ) ROM_LOAD( "tms1100_einvader_output.pla", 0, 365, CRC(490158e1) SHA1(61cace1eb09244663de98d8fb04d9459b19668fd) ) + + ROM_REGION( 44398, "svg", 0) + ROM_LOAD( "einvader.svg", 0, 44398, CRC(48de88fd) SHA1(56a2b9c997a447277b45902ab542eda54e7d5a2f) ) // by hap, ver. 23 mar 2016 ROM_END @@ -8074,6 +8362,17 @@ ROM_START( raisedvl ) ROM_END +ROM_START( f2pbball ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp0154", 0x0000, 0x0400, CRC(c5b45ace) SHA1(b2de32e83ab447b22d6828f0081843f364040b01) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_f2pbball_output.pla", 0, 365, CRC(30c2f28f) SHA1(db969b22475f37f083c3594f5e4f5759048377b8) ) +ROM_END + + ROM_START( gpoker ) ROM_REGION( 0x0800, "maincpu", 0 ) ROM_LOAD( "mp2105", 0x0000, 0x0800, CRC(95a8f5b4) SHA1(d14f00ba9f57e437264d972baa14a14a28ff8719) ) @@ -8123,7 +8422,7 @@ ROM_END ROM_START( elecdet ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) ) + ROM_LOAD( "mp6100a", 0x0000, 0x1000, CRC(9522fb2d) SHA1(240bdb44b7d67d3b13ebf75851635ac4b4ca2bfd) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) @@ -8179,6 +8478,17 @@ ROM_START( elecbowl ) ROM_END +ROM_START( horseran ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp3491", 0x0000, 0x0800, CRC(a0081671) SHA1(a5a07b502c69d429e5bcd1d313e86b6ee057cda6) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 365, "maincpu:opla", 0 ) // unused + ROM_LOAD( "tms1100_horseran_output.pla", 0, 365, CRC(0fea09b0) SHA1(27a56fcf2b490e9a7dbbc6ad48cc8aaca4cada94) ) +ROM_END + + ROM_START( mdndclab ) ROM_REGION( 0x0800, "maincpu", 0 ) ROM_LOAD( "m34012", 0x0000, 0x0800, CRC(e851fccd) SHA1(158362c2821678a51554e02dbb2f9ef5aaf5f59f) ) @@ -8528,10 +8838,12 @@ CONS( 1979, ebball, 0, 0, ebball, ebball, driver_device, 0, "Ent CONS( 1979, ebball2, 0, 0, ebball2, ebball2, driver_device, 0, "Entex", "Electronic Baseball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, ebball3, 0, 0, ebball3, ebball3, driver_device, 0, "Entex", "Electronic Baseball 3 (Entex)", MACHINE_SUPPORTS_SAVE ) CONS( 1979, esbattle, 0, 0, esbattle, esbattle, driver_device, 0, "Entex", "Space Battle (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100 version)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100 version)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, efootb4 , 0, 0, efootb4, efootb4, driver_device, 0, "Entex", "Color Football 4 (Entex)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, ebaskb2 , 0, 0, ebaskb2, ebaskb2, driver_device, 0, "Entex", "Electronic Basketball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1979, f2pbball, 0, 0, f2pbball, f2pbball, driver_device, 0, "Fonas", "2 Player Baseball (Fonas)", MACHINE_SUPPORTS_SAVE ) CONS( 1979, gpoker, 0, 0, gpoker, gpoker, driver_device, 0, "Gakken", "Poker (Gakken, 1979 version)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, gjackpot, 0, 0, gjackpot, gjackpot, driver_device, 0, "Gakken", "Jackpot: Gin Rummy & Black Jack", MACHINE_SUPPORTS_SAVE ) @@ -8547,6 +8859,7 @@ COMP( 1979, astro, 0, 0, astro, astro, driver_device, 0, "Kos CONS( 1978, elecbowl, 0, 0, elecbowl, elecbowl, driver_device, 0, "Marx", "Electronic Bowling (Marx)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) // *** +COMP( 1979, horseran, 0, 0, horseran, horseran, driver_device, 0, "Mattel", "Thoroughbred Horse Race Analyzer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) CONS( 1980, mdndclab, 0, 0, mdndclab, mdndclab, driver_device, 0, "Mattel", "Dungeons & Dragons - Computer Labyrinth Game", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // *** CONS( 1977, comp4, 0, 0, comp4, comp4, driver_device, 0, "Milton Bradley", "Comp IV", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index 7d96935a0e1..160bbde1f72 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -67,6 +67,7 @@ TODO: ***************************************************************************/ #include "includes/hh_ucom4.h" +#include "video/hlcd0515.h" // internal artwork #include "efball.lh" @@ -129,7 +130,7 @@ void hh_ucom4_state::machine_reset() void hh_ucom4_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -142,7 +143,7 @@ void hh_ucom4_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -197,12 +198,12 @@ void hh_ucom4_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void hh_ucom4_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void hh_ucom4_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -213,9 +214,9 @@ void hh_ucom4_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t // generic input handlers -uint8_t hh_ucom4_state::read_inputs(int columns) +u8 hh_ucom4_state::read_inputs(int columns) { - uint8_t ret = 0; + u8 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -294,8 +295,8 @@ public: void ufombs_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8); - uint16_t plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8); + u16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3); display_matrix(10, 9, plate, grid); } @@ -339,7 +340,7 @@ static INPUT_PORTS_START( ufombs ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const int16_t ufombs_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 ufombs_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( ufombs, ufombs_state ) @@ -406,7 +407,7 @@ public: void ssfball_state::prepare_display() { - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); display_matrix(16, 9, plate, m_grid); } @@ -485,7 +486,7 @@ static INPUT_PORTS_START( ssfball ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY INPUT_PORTS_END -static const int16_t ssfball_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 ssfball_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( ssfball, ssfball_state ) @@ -550,7 +551,7 @@ public: void bmsoccer_state::prepare_display() { - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2); display_matrix(16, 9, plate, m_grid); } @@ -673,8 +674,8 @@ public: void bmsafari_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - uint16_t plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + u16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3); display_matrix(10, 9, plate, grid); } @@ -783,7 +784,7 @@ public: void splasfgt_state::prepare_display() { - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); display_matrix(16, 9, plate, m_grid); } @@ -871,7 +872,7 @@ static INPUT_PORTS_START( splasfgt ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static const int16_t splasfgt_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; +static const s16 splasfgt_speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; static MACHINE_CONFIG_START( splasfgt, splasfgt_state ) @@ -935,8 +936,8 @@ public: void bcclimbr_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + u8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); + u32 plate = BITSWAP24(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); display_matrix(20, 6, plate, grid); } @@ -1153,8 +1154,8 @@ public: void invspace_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8); display_matrix(19, 9, plate, grid); } @@ -1257,7 +1258,7 @@ public: void efball_state::prepare_display() { - uint16_t plate = BITSWAP16(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7); + u16 plate = BITSWAP16(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7); display_matrix(11, 10, plate, m_grid); } @@ -1370,8 +1371,8 @@ public: void galaxy2_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - uint16_t plate = BITSWAP16(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + u16 plate = BITSWAP16(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9); display_matrix(15, 10, plate, grid); } @@ -1481,8 +1482,8 @@ public: void astrocmd_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); display_matrix(17, 9, plate, grid); } @@ -1669,16 +1670,19 @@ class mcompgin_state : public hh_ucom4_state { public: mcompgin_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) + : hh_ucom4_state(mconfig, type, tag), + m_lcd(*this, "lcd") { } - void prepare_display(); + required_device<hlcd0569_device> m_lcd; + + DECLARE_WRITE32_MEMBER(lcd_output_w); DECLARE_WRITE8_MEMBER(unk_w); }; // handlers -void mcompgin_state::prepare_display() +WRITE32_MEMBER(mcompgin_state::lcd_output_w) { } @@ -1718,7 +1722,9 @@ static MACHINE_CONFIG_START( mcompgin, mcompgin_state ) MCFG_UCOM4_WRITE_H_CB(WRITE8(mcompgin_state, unk_w)) MCFG_UCOM4_WRITE_I_CB(WRITE8(mcompgin_state, unk_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + /* video hardware */ + MCFG_DEVICE_ADD("lcd", HLCD0569, 1000) // C=? + MCFG_HLCD0515_WRITE_COLS_CB(WRITE32(mcompgin_state, lcd_output_w)) MCFG_DEFAULT_LAYOUT(layout_mcompgin) /* sound hardware */ @@ -1759,8 +1765,8 @@ public: void mvbfree_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); - uint16_t plate = BITSWAP16(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + u16 grid = BITSWAP16(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); + u16 plate = BITSWAP16(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); display_matrix(10, 14, plate, grid); } @@ -1980,8 +1986,8 @@ public: void tccombat_state::prepare_display() { - uint16_t grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6); + u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4); + u32 plate = BITSWAP24(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6); display_matrix(20, 9, plate, grid); } @@ -2161,7 +2167,6 @@ INPUT_CHANGED_MEMBER(tmtennis_state::difficulty_switch) set_clock(); } - void tmtennis_state::set_clock() { // MCU clock is from an LC circuit oscillating by default at ~360kHz, @@ -2243,8 +2248,8 @@ public: void tmpacman_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100; + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100; display_matrix(19, 8, plate, grid); } @@ -2348,7 +2353,7 @@ public: void tmscramb_state::prepare_display() { - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400; + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400; display_matrix(17, 10, plate, m_grid); } @@ -2450,8 +2455,8 @@ public: void tcaveman_state::prepare_display() { - uint8_t grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - uint32_t plate = BITSWAP24(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40; + u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + u32 plate = BITSWAP24(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40; display_matrix(19, 8, plate, grid); } diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp index a01d2bb60bc..c7fb8ad085f 100644 --- a/src/mame/drivers/ibm6580.cpp +++ b/src/mame/drivers/ibm6580.cpp @@ -6,37 +6,37 @@ IBM 6580 Displaywriter. A green-screen dedicated word-processing workstation. It uses 8" floppy disks. It could have up to 224k of ram. Consists of: - Electronics Module 6580 - Display 3300 - Keyboard 5330 [a "beamspring"-type] - Dual Diskette Unit 6360 + Electronics Module 6580 + Display 3300 + Keyboard 5330 [a "beamspring"-type] + Dual Diskette Unit 6360 Optional: - Printers: 5215, 5218, 5228 - Printer Sharing feature - Mag Card Unit - Asynchronous and Bisynchronous communications features - 66-line display and adapter (800x1056 px, 8x16 character cell) + Printers: 5215, 5218, 5228 + Printer Sharing feature + Mag Card Unit + Asynchronous and Bisynchronous communications features + 66-line display and adapter (800x1056 px, 8x16 character cell) All chips have IBM part numbers on them. F.e. on system board: - 8493077 - 8086 - 4178619 - 8251A - 4178617 - 8257-5 - 4178623 - 8259A - 4178628 - 8255A-5 - 4178625 - 8253-5 + 8493077 - 8086 + 4178619 - 8251A + 4178617 - 8257-5 + 4178623 - 8259A + 4178628 - 8255A-5 + 4178625 - 8253-5 IRQ levels per PSM p. 6-5 - 0 incoming data for printer sharing/3277 DE - 1 transfer data to commo data link - 2 printer and mag card data xfer - 3 keyboard incoming data - 4 diskette - 5 (not in use) - 6 software timer [50 ms period] - 7 error on commo data link - nmi "or when a dump switch operation is initiated" ["memory record" button] + 0 incoming data for printer sharing/3277 DE + 1 transfer data to commo data link + 2 printer and mag card data xfer + 3 keyboard incoming data + 4 diskette + 5 (not in use) + 6 software timer [50 ms period] + 7 error on commo data link + nmi "or when a dump switch operation is initiated" ["memory record" button] To do: @@ -119,10 +119,10 @@ Displaywriter System Manual S544-2023-0 (?) -- mentioned in US patents 4648071 a uint8_t gfx_expand[16] = { - 0x00, 0x03, 0x0c, 0x0f, - 0x30, 0x33, 0x3c, 0x3f, - 0xc0, 0xc3, 0xcc, 0xcf, - 0xf0, 0xf3, 0xfc, 0xff + 0x00, 0x03, 0x0c, 0x0f, + 0x30, 0x33, 0x3c, 0x3f, + 0xc0, 0xc3, 0xcc, 0xcf, + 0xf0, 0xf3, 0xfc, 0xff }; @@ -294,7 +294,7 @@ READ8_MEMBER(ibm6580_state::video_r) switch (offset) { case 8: - data = 1; // 25-line video board ID. 66-line is 0x40. + data = 1; // 25-line video board ID. 66-line is 0x40. data |= (m_screen->hblank() ? 8 : 0); data |= (m_screen->vblank() ? 4 : 0); // pure guesswork. 0x2, 0x10 and 0x20 are unknown video signals. @@ -315,8 +315,8 @@ READ8_MEMBER(ibm6580_state::video_r) void ibm6580_state::vblank_w(screen_device &screen, bool state) { -// if (state) -// m_pic8259->ir6_w(state); +// if (state) +// m_pic8259->ir6_w(state); if (ioport("DUMP")->read()) m_p40 |= 4; @@ -403,7 +403,7 @@ WRITE8_MEMBER(ibm6580_state::led_w) break; default: -// printf ("LED 0x%08x: unknown\n", data); +// printf ("LED 0x%08x: unknown\n", data); break; } } @@ -601,22 +601,22 @@ WRITE8_MEMBER(ibm6580_state::floppy_w) switch (offset) { - case 0: // 8150 -- mcu reset? + case 0: // 8150 -- mcu reset? m_floppy_mcu_sr.enqueue(0x00); m_floppy_mcu_sr.enqueue(0x00); break; - case 1: // 8152 + case 1: // 8152 m_fdc->soft_reset(); break; - case 5: // 815A + case 5: // 815A m_fdc->fifo_w(space, offset, data); if (m_floppy_idle) m_floppy_idle = false; break; - case 6: // 815C + case 6: // 815C m_floppy_mcu_cr.enqueue(data); m_floppy_mcu_cr_fifo++; if (floppy_mcu_cr_full()) @@ -631,7 +631,7 @@ READ8_MEMBER(ibm6580_state::floppy_r) switch (offset) { - case 0: // 8150 + case 0: // 8150 // bit 4 -- ?? ready // bit 5 -- mcu busy // bit 6 -- ?? idle @@ -639,14 +639,14 @@ READ8_MEMBER(ibm6580_state::floppy_r) data |= 0x40; break; - case 4: // 8158 + case 4: // 8158 data = m_fdc->msr_r(space, offset); break; - case 5: // 815a + case 5: // 815a data = m_fdc->fifo_r(space, offset); - case 6: // 815c + case 6: // 815c if (!m_floppy_mcu_sr.empty()) data = m_floppy_mcu_sr.dequeue(); break; @@ -665,7 +665,7 @@ READ8_MEMBER(ibm6580_state::floppy_r) f->dskchg_r(), f->idx_r(), f->get_cyl() )); else - DBG_LOG(2,"Floppy", ("%02x == %02x (idle %d irq %d drq %d)\n", + DBG_LOG(2,"Floppy", ("%02x == %02x (idle %d irq %d drq %d)\n", 0x8150 + (offset << 1), data, m_floppy_idle, m_fdc->get_irq(), m_fdc->get_drq() )); @@ -677,17 +677,17 @@ READ8_MEMBER(ibm6580_state::floppy_r) static ADDRESS_MAP_START(ibm6580_mem, AS_PROGRAM, 16, ibm6580_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x3ffff) AM_RAM // system RAM + AM_RANGE(0x00000, 0x3ffff) AM_RAM // system RAM AM_RANGE(0x90000, 0x90001) AM_WRITE(unk_latch_w) - AM_RANGE(0xef000, 0xeffff) AM_RAM AM_SHARE("videoram") // 66-line vram starts at 0xec000 + AM_RANGE(0xef000, 0xeffff) AM_RAM AM_SHARE("videoram") // 66-line vram starts at 0xec000 AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1", 0) ADDRESS_MAP_END static ADDRESS_MAP_START(ibm6580_io, AS_IO, 16, ibm6580_state) ADDRESS_MAP_UNMAP_HIGH // -// AM_RANGE(0x0028, 0x0028) AM_DEVREADWRITE8("upd8251", i8251_device, data_r, data_w) -// AM_RANGE(0x0029, 0x0029) AM_DEVREADWRITE8("upd8251", i8251_device, status_r, control_w) +// AM_RANGE(0x0028, 0x0028) AM_DEVREADWRITE8("upd8251", i8251_device, data_r, data_w) +// AM_RANGE(0x0029, 0x0029) AM_DEVREADWRITE8("upd8251", i8251_device, status_r, control_w) // AM_RANGE(0x0000, 0x0007) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) AM_RANGE(0x0008, 0x000f) AM_WRITE (pic_latch_w) @@ -702,7 +702,7 @@ static ADDRESS_MAP_START(ibm6580_io, AS_IO, 16, ibm6580_state) AM_RANGE(0x5000, 0x500f) AM_UNMAP AM_RANGE(0x6000, 0x601f) AM_UNMAP AM_RANGE(0x8060, 0x807f) AM_UNMAP - AM_RANGE(0x8150, 0x815f) AM_READWRITE8(floppy_r, floppy_w, 0x00ff) // HLE of floppy board + AM_RANGE(0x8150, 0x815f) AM_READWRITE8(floppy_r, floppy_w, 0x00ff) // HLE of floppy board AM_RANGE(0x81a0, 0x81af) AM_UNMAP AM_RANGE(0xc000, 0xc00f) AM_UNMAP AM_RANGE(0xe000, 0xe02f) AM_READWRITE8(video_r, video_w, 0x00ff) @@ -868,11 +868,11 @@ void ibm6580_state::video_start() } FLOPPY_FORMATS_MEMBER( ibm6580_state::floppy_formats ) - FLOPPY_HFE_FORMAT, - FLOPPY_IPF_FORMAT, - FLOPPY_MFI_FORMAT, - FLOPPY_TD0_FORMAT, - FLOPPY_IMD_FORMAT + FLOPPY_HFE_FORMAT, + FLOPPY_IPF_FORMAT, + FLOPPY_MFI_FORMAT, + FLOPPY_TD0_FORMAT, + FLOPPY_IMD_FORMAT FLOPPY_FORMATS_END0 static SLOT_INTERFACE_START( dw_floppies ) @@ -921,9 +921,9 @@ static MACHINE_CONFIG_START( ibm6580, ibm6580_state ) MCFG_UPD765A_ADD(UPD765_TAG, false, false) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(ibm6580_state, floppy_intrq)) -// MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) +// MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8257", i8257_device, dreq0_w)) -// MCFG_UPD765_HDL_CALLBACK(WRITELINE(ibm6580_state, floppy_hdl)) +// MCFG_UPD765_HDL_CALLBACK(WRITELINE(ibm6580_state, floppy_hdl)) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", dw_floppies, "8sssd", ibm6580_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", dw_floppies, "8sssd", ibm6580_state::floppy_formats) diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 1a79d4eec40..b050a5ed0e0 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -657,6 +657,7 @@ static MACHINE_CONFIG_START( ibmpcjr, pcjr_state) /* Software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","ibmpcjr_cart") MCFG_SOFTWARE_LIST_ADD("flop_list","ibmpcjr_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("pc_list","ibm5150") MACHINE_CONFIG_END static GFXDECODE_START( ibmpcjx ) @@ -680,7 +681,7 @@ static MACHINE_CONFIG_DERIVED( ibmpcjx, ibmpcjr ) MCFG_DEVICE_MODIFY(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("512K") MCFG_RAM_EXTRA_OPTIONS("") // only boots with 512k currently - MACHINE_CONFIG_END +MACHINE_CONFIG_END diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index a2d18ca6302..b3c1274878e 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -4788,6 +4788,25 @@ ROM_START( vbowlj ) ROM_COPY( "ics", 0x000000, 0x300000,0x100000) ROM_END +ROM_START( vbowlhk ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP( "bowlingv101hjs.bin", 0x00000, 0x80000, CRC(92fbfa72) SHA1(824b666ea2247ef5a974675925bcef94dbd1a992) ) // second half all 00 + + ROM_REGION( 0x400000 * 2, "blitter", 0) + ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) ) + // extra space to expand every 4 bits to 8 + + ROM_REGION( 0x100000, "blitter_hi", ROMREGION_INVERT ) + ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) ) + + ROM_REGION( 0x400000, "ics", 0 ) + ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) ) // 8 bit signed mono & u-law + ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) ) // 8 bit signed mono + ROM_COPY( "ics", 0x000000, 0x100000,0x100000) + ROM_COPY( "ics", 0x000000, 0x200000,0x100000) + ROM_COPY( "ics", 0x000000, 0x300000,0x100000) +ROM_END + /*************************************************************************** Xing Yen Man Guan @@ -4821,21 +4840,22 @@ ROM_END ***************************************************************************/ -GAME( 1997, drgnwrld, 0, drgnwrld, drgnwrld, igs011_state, drgnwrld, ROT0, "IGS", "Dragon World (World, V040O)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv30, drgnwrld, drgnwrld, drgnwrld, igs011_state, drgnwrldv30, ROT0, "IGS", "Dragon World (World, V030O)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv21, drgnwrld, drgnwrld_igs012, drgnwrld, igs011_state, drgnwrldv21, ROT0, "IGS", "Dragon World (World, V021O)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv10c, ROT0, "IGS", "Zhong Guo Long (China, V010C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv11h, ROT0, "IGS", "Dong Fang Zhi Zhu (Hong Kong, V011H)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, drgnwrldv40k, drgnwrld, drgnwrld_igs012, drgnwrldc, igs011_state, drgnwrldv40k, ROT0, "IGS", "Dragon World (Korea, V040K)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1995, lhb, 0, lhb, lhb, igs011_state, lhb, ROT0, "IGS", "Long Hu Bang (China, V035C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, lhbv33c, lhb, lhb, lhb, igs011_state, lhbv33c, ROT0, "IGS", "Long Hu Bang (China, V033C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, dbc, lhb, lhb, lhb, igs011_state, dbc, ROT0, "IGS", "Da Ban Cheng (Hong Kong, V027H)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, ryukobou, lhb, lhb, lhb, igs011_state, ryukobou, ROT0, "IGS / Alta", "Mahjong Ryukobou (Japan, V030J)", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, lhb2, 0, lhb2, lhb2, igs011_state, lhb2, ROT0, "IGS", "Long Hu Bang II (Hong Kong, V185H)", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, xymg, 0, xymg, xymg, igs011_state, xymg, ROT0, "IGS", "Xing Yun Man Guan (China, V651C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, wlcc, xymg, wlcc, wlcc, igs011_state, wlcc, ROT0, "IGS", "Wan Li Chang Cheng (China, V638C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, vbowl, 0, vbowl, vbowl, igs011_state, vbowl, ROT0, "IGS", "Virtua Bowling (World, V101XCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, vbowlj, vbowl, vbowl, vbowlj, igs011_state, vbowlj, ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1998, nkishusp, lhb2, nkishusp, nkishusp, igs011_state, nkishusp, ROT0, "IGS / Alta", "Mahjong Nenrikishu SP (Japan, V250J)", MACHINE_SUPPORTS_SAVE ) +GAME( 1997, drgnwrld, 0, drgnwrld, drgnwrld, igs011_state, drgnwrld, ROT0, "IGS", "Dragon World (World, V040O)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv30, drgnwrld, drgnwrld, drgnwrld, igs011_state, drgnwrldv30, ROT0, "IGS", "Dragon World (World, V030O)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv21, drgnwrld, drgnwrld_igs012, drgnwrld, igs011_state, drgnwrldv21, ROT0, "IGS", "Dragon World (World, V021O)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv10c, ROT0, "IGS", "Zhong Guo Long (China, V010C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv11h, ROT0, "IGS", "Dong Fang Zhi Zhu (Hong Kong, V011H)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, drgnwrldv40k, drgnwrld, drgnwrld_igs012, drgnwrldc, igs011_state, drgnwrldv40k, ROT0, "IGS", "Dragon World (Korea, V040K)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +GAME( 1995, lhb, 0, lhb, lhb, igs011_state, lhb, ROT0, "IGS", "Long Hu Bang (China, V035C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, lhbv33c, lhb, lhb, lhb, igs011_state, lhbv33c, ROT0, "IGS", "Long Hu Bang (China, V033C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, dbc, lhb, lhb, lhb, igs011_state, dbc, ROT0, "IGS", "Da Ban Cheng (Hong Kong, V027H)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, ryukobou, lhb, lhb, lhb, igs011_state, ryukobou, ROT0, "IGS / Alta", "Mahjong Ryukobou (Japan, V030J)", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, lhb2, 0, lhb2, lhb2, igs011_state, lhb2, ROT0, "IGS", "Long Hu Bang II (Hong Kong, V185H)", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, xymg, 0, xymg, xymg, igs011_state, xymg, ROT0, "IGS", "Xing Yun Man Guan (China, V651C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, wlcc, xymg, wlcc, wlcc, igs011_state, wlcc, ROT0, "IGS", "Wan Li Chang Cheng (China, V638C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, vbowl, 0, vbowl, vbowl, igs011_state, vbowl, ROT0, "IGS", "Virtua Bowling (World, V101XCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, vbowlj, vbowl, vbowl, vbowlj, igs011_state, vbowlj, ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, vbowlhk, vbowl, vbowl, vbowl, igs011_state, vbowlj, ROT0, "IGS / Tai Tin Amusement", "Virtua Bowling (Honk Kong, V101HJS)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING |MACHINE_IMPERFECT_SOUND ) // different encryption? +GAME( 1998, nkishusp, lhb2, nkishusp, nkishusp, igs011_state, nkishusp, ROT0, "IGS / Alta", "Mahjong Nenrikishu SP (Japan, V250J)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/interpro.cpp b/src/mame/drivers/interpro.cpp new file mode 100644 index 00000000000..9cc9264f608 --- /dev/null +++ b/src/mame/drivers/interpro.cpp @@ -0,0 +1,348 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#include "includes/interpro.h" +#include "debugger.h" + +#define VERBOSE 0 +#if VERBOSE +#define LOG_SYSTEM(...) logerror(__VA_ARGS__) +#define LOG_IDPROM(...) logerror(__VA_ARGS__) +#else +#define LOG_SYSTEM(...) {} +#define LOG_IDPROM(...) {} +#endif + +// machine start +void interpro_state::machine_start() +{ + m_system_reg[SREG_CTRL2] = CTRL2_COLDSTART | CTRL2_PWRENA | CTRL2_PWRUP; +} + +void interpro_state::machine_reset() +{ + // flash rom requires the following values + m_system_reg[SREG_ERROR] = 0x00; + m_system_reg[SREG_STATUS] = 0x400; + m_system_reg[SREG_CTRL1] = CTRL1_FLOPRDY; +} + +WRITE16_MEMBER(interpro_state::system_w) +{ + switch (offset) + { + case SREG_LED: + LOG_SYSTEM("LED value %d at pc 0x%08x\n", data, space.device().safe_pc()); + break; + + case SREG_STATUS: // not sure if writable? + break; + + case SREG_CTRL1: + LOG_SYSTEM("system control register 1 write data 0x%x pc 0x%08x\n", data, space.device().safe_pc()); + + if ((data ^ m_system_reg[offset]) & CTRL1_LEDDP) + LOG_SYSTEM("LED decimal point %s\n", data & CTRL1_LEDDP ? "on" : "off"); + + m_system_reg[offset] = data; + break; + + case SREG_CTRL2: + LOG_SYSTEM("system control register 2 write data 0x%x pc 0x%08x\n", data, space.device().safe_pc()); + if (data & CTRL2_RESET) + { + m_system_reg[SREG_CTRL2] &= ~CTRL2_COLDSTART; + + machine().schedule_soft_reset(); + } + else + m_system_reg[offset] = data & 0x0f; // top four bits are not persistent + break; + } +} + +READ16_MEMBER(interpro_state::system_r) +{ + LOG_SYSTEM("system register read offset %d pc 0x%08x\n", offset, space.device().safe_pc()); + switch (offset) + { + case SREG_ERROR: + case SREG_STATUS: + case SREG_CTRL1: + case SREG_CTRL2: + default: + return m_system_reg[offset]; + break; + } +} + +READ32_MEMBER(interpro_state::idprom_r) +{ + LOG_IDPROM("idprom read offset 0x%x mask 0x%08x at 0x%08x\n", offset, mem_mask, space.device().safe_pc()); + + // abitrary fake number for now, not working properly + u32 speed = 70000000; + u32 speed1 = speed >> 24; + u32 speed2 = speed >> 16; + u32 speed3 = speed >> 8; + + static uint8_t idprom[] = { + // module type id + 'M', 'P', 'C', 'B', + '*', '*', '*', '*', + + // ECO bytes + 0x87, 0x65, 0x43, 0x21, + 0xbb, 0xcc, 0xdd, 0xee, + + // the following 8 bytes are "feature bytes" + // the feature bytes contain a 32 bit word which is divided by 40000 + // if they're empty, a default value of 50 000 000 is used + // perhaps this is a system speed (50MHz)? + 0x2, 0x34, 0x56, 0x78, + (u8)speed1, (u8)speed2, (u8)speed3, (u8)speed, + + // reserved bytes + 0xff, 0xff, + + // family + // boot rom tests for family == 0x41 or 0x42 + // if so, speed read from feature bytes 2 & 3 + // if not, read speed from feature bytes 4-7 + //0x41, 0x00, // 2800-series CPU + 0x24, 0x00, // 2000-series system board + + // footprint and checksum + 0x55, 0xaa, 0x55, 0x00 + }; + + switch (offset) + { + case 0x1f: + { + uint8_t sum = 0; + + // compute the checksum (sum of all bytes must be == 0x00) + for (int i = 0; i < 0x20; i++) + sum += idprom[i]; + + return 0x100 - (sum & 0xff); + } + + default: + return idprom[offset]; + } +} + +READ32_MEMBER(interpro_state::slot0_r) +{ + // a known graphics board idprom + static uint8_t slot0[] = { + 0x00, 0x00, 0x00, 0x00, '9', '6', '3', 'A', // board + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // eco + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // features + 0xff, 0xff, // reserved + 0x22, 0x00, // family + 0x55, 0xaa, 0x55, 0x00 + }; + + return ((uint8_t *)&slot0)[offset % 32]; +} + +WRITE8_MEMBER(interpro_state::rtc_w) +{ + switch (offset) + { + case 0x00: + // write to RTC register + m_rtc->write(space, 1, data); + break; + + case 0x40: + // set RTC read/write address + m_rtc->write(space, 0, data); + break; + + default: + logerror("rtc: write to unknown offset 0x%02x data 0x%02x at pc 0x%08x\n", offset, data, space.device().safe_pc()); + break; + } +} + +READ8_MEMBER(interpro_state::rtc_r) +{ + switch (offset) + { + case 0x00: + // read from RTC register + return m_rtc->read(space, 1); + + // read from InterPro system ID PROM (contains MAC address) + case 0x40: return 0x12; + case 0x41: return 0x34; + case 0x42: return 0x56; + + default: + logerror("rtc: read from unknown offset 0x%02x at pc 0x%08x\n", offset, space.device().safe_pc()); + return 0xff; + } +} + +READ8_MEMBER(interpro_state::scsi_r) +{ + return m_scsi->read(space, offset >> 6, mem_mask); +} + +WRITE8_MEMBER(interpro_state::scsi_w) +{ + m_scsi->write(space, offset >> 6, data, mem_mask); +} + +// driver init +DRIVER_INIT_MEMBER(interpro_state, ip2800) +{ + //address_space &as = m_mmu->space(AS_1); +} + +// these maps point the cpu virtual addresses to the mmu +static ADDRESS_MAP_START(clipper_insn_map, AS_PROGRAM, 32, interpro_state) + AM_RANGE(0x00000000, 0xffffffff) AM_DEVREAD32(INTERPRO_MMU_TAG, cammu_device, mmu_r, 0xffffffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(clipper_data_map, AS_DATA, 32, interpro_state) +AM_RANGE(0x00000000, 0xffffffff) AM_DEVREADWRITE32(INTERPRO_MMU_TAG, cammu_device, mmu_r, mmu_w, 0xffffffff) +ADDRESS_MAP_END + +// these maps represent the real main, i/o and boot spaces of the system +static ADDRESS_MAP_START(interpro_main_map, AS_0, 32, interpro_state) + AM_RANGE(0x00000000, 0x00ffffff) AM_RAM // 16M RAM + + AM_RANGE(0x7f100000, 0x7f11ffff) AM_ROM AM_REGION(INTERPRO_ROM_TAG, 0) + AM_RANGE(0x7f180000, 0x7f1bffff) AM_ROM AM_REGION(INTERPRO_EEPROM_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(interpro_io_map, AS_1, 32, interpro_state) + AM_RANGE(0x00000000, 0x00000fff) AM_DEVICE(INTERPRO_MMU_TAG, cammu_device, map) + AM_RANGE(0x00001000, 0x00001fff) AM_RAM + + AM_RANGE(0x40000000, 0x4000003f) AM_DEVICE16(INTERPRO_MCGA_TAG, interpro_mcga_device, map, 0xffff) + AM_RANGE(0x4f007e00, 0x4f007eff) AM_DEVICE(INTERPRO_SGA_TAG, interpro_sga_device, map) + + AM_RANGE(0x7f000100, 0x7f00011f) AM_DEVICE8(INTERPRO_FDC_TAG, n82077aa_device, map, 0xff) + // this is probably the srx arbiter ga + AM_RANGE(0x7f000200, 0x7f0002ff) AM_RAM + AM_RANGE(0x7f000300, 0x7f00030f) AM_READWRITE16(system_r, system_w, 0xffff) + AM_RANGE(0x7f000400, 0x7f00040f) AM_DEVREADWRITE8(INTERPRO_SCC1_TAG, scc85C30_device, ba_cd_inv_r, ba_cd_inv_w, 0xff) + AM_RANGE(0x7f000410, 0x7f00041f) AM_DEVREADWRITE8(INTERPRO_SCC2_TAG, scc85230_device, ba_cd_inv_r, ba_cd_inv_w, 0xff) + AM_RANGE(0x7f000500, 0x7f0006ff) AM_READWRITE8(rtc_r, rtc_w, 0xff) + AM_RANGE(0x7f000700, 0x7f00077f) AM_READ(idprom_r) + AM_RANGE(0x7f001000, 0x7f001fff) AM_READWRITE8(scsi_r, scsi_w, 0x0000ff00) + + AM_RANGE(0x7f0fff00, 0x7f0fffff) AM_DEVICE(INTERPRO_IOGA_TAG, interpro_ioga_device, map) + + AM_RANGE(0x08000000, 0x08000fff) AM_NOP // bogus + AM_RANGE(0x8f000000, 0x8f0fffff) AM_READ(slot0_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(interpro_boot_map, AS_2, 32, interpro_state) + AM_RANGE(0x00000000, 0x00001fff) AM_RAM +ADDRESS_MAP_END + +FLOPPY_FORMATS_MEMBER(interpro_state::floppy_formats) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START(interpro_floppies) + SLOT_INTERFACE("525dd", FLOPPY_525_DD) + SLOT_INTERFACE("35hd", FLOPPY_35_HD) +SLOT_INTERFACE_END + +// input ports +static INPUT_PORTS_START(ip2800) +INPUT_PORTS_END + +static MACHINE_CONFIG_START(ip2800, interpro_state) + MCFG_CPU_ADD(INTERPRO_CPU_TAG, CLIPPER_C400, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(clipper_insn_map) + MCFG_CPU_DATA_MAP(clipper_data_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(INTERPRO_IOGA_TAG, interpro_ioga_device, inta_cb) + + MCFG_DEVICE_ADD(INTERPRO_MMU_TAG, CAMMU_C4T, 0) + MCFG_DEVICE_ADDRESS_MAP(AS_0, interpro_main_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, interpro_io_map) + MCFG_DEVICE_ADDRESS_MAP(AS_2, interpro_boot_map) + MCFG_CAMMU_SSW_CB(DEVREADLINE(INTERPRO_CPU_TAG, clipper_device, ssw)) + + // serial controllers and rs232 bus + MCFG_SCC85C30_ADD(INTERPRO_SCC1_TAG, XTAL_4_9152MHz, 0, 0, 0, 0) + + MCFG_Z80SCC_OUT_TXDA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) + MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) + MCFG_Z80SCC_OUT_INT_CB(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, ir11_w)) + + MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, ctsa_w)) + + // the following port is known as "port 2" + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INTERPRO_SCC1_TAG, z80scc_device, ctsb_w)) + + MCFG_SCC85230_ADD(INTERPRO_SCC2_TAG, XTAL_4_9152MHz, 0, 0, 0, 0) + + // real-time clock/non-volatile memory + MCFG_MC146818_ADD(INTERPRO_RTC_TAG, XTAL_32_768kHz) + MCFG_MC146818_UTC(true) + MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, ir9_w)) + + // floppy + MCFG_N82077AA_ADD(INTERPRO_FDC_TAG, n82077aa_device::MODE_PS2) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, ir1_w)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, drq_floppy)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", interpro_floppies, "525dd", interpro_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", interpro_floppies, "35hd", interpro_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(false) + + // scsi + MCFG_DEVICE_ADD(INTERPRO_SCSI_TAG, SCSI_PORT, 0) + MCFG_SCSIDEV_ADD(INTERPRO_SCSI_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + MCFG_SCSIDEV_ADD(INTERPRO_SCSI_TAG ":" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_3) + + MCFG_DEVICE_ADD(INTERPRO_SCSI_ADAPTER_TAG, NCR539X, XTAL_12_5MHz) + MCFG_LEGACY_SCSI_PORT(INTERPRO_SCSI_TAG) + MCFG_NCR539X_OUT_IRQ_CB(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, ir0_w)) + MCFG_NCR539X_OUT_DRQ_CB(DEVWRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, drq_scsi)) + + // i/o gate array + MCFG_INTERPRO_IOGA_ADD(INTERPRO_IOGA_TAG) + MCFG_INTERPRO_IOGA_NMI_CB(INPUTLINE(INTERPRO_CPU_TAG, INPUT_LINE_NMI)) + MCFG_INTERPRO_IOGA_IRQ_CB(INPUTLINE(INTERPRO_CPU_TAG, INPUT_LINE_IRQ0)) + //MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_CHANNEL_PLOTTER, unknown) + //MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_SCSI, DEVREAD8(INTERPRO_SCSI_TAG, ncr539x_device, dma_read_data), DEVWRITE8(INTERPRO_SCSI_TAG, ncr539x_device, dma_write_data)) + MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_FLOPPY, DEVREAD8(INTERPRO_FDC_TAG, n82077aa_device, mdma_r), DEVWRITE8(INTERPRO_FDC_TAG, n82077aa_device, mdma_w)) + MCFG_INTERPRO_IOGA_DMA_CB(IOGA_DMA_SERIAL, DEVREAD8(INTERPRO_SCC1_TAG, z80scc_device, da_r), DEVWRITE8(INTERPRO_SCC1_TAG, z80scc_device, da_w)) + MCFG_INTERPRO_IOGA_FDCTC_CB(DEVWRITELINE(INTERPRO_FDC_TAG, n82077aa_device, tc_line_w)) + MCFG_INTERPRO_IOGA_DMA_BUS(INTERPRO_CAMMU_TAG, AS_0) + + // memory control gate array + MCFG_DEVICE_ADD(INTERPRO_MCGA_TAG, INTERPRO_MCGA, 0) + + // srx gate array + MCFG_DEVICE_ADD(INTERPRO_SGA_TAG, INTERPRO_SGA, 0) + +MACHINE_CONFIG_END + +ROM_START(ip2800) + ROM_REGION(0x0020000, INTERPRO_ROM_TAG, 0) + ROM_SYSTEM_BIOS(0, "IP2830", "IP2830") + ROMX_LOAD("ip2830_rom.bin", 0x00000, 0x20000, CRC(467ce7bd) SHA1(53faee40d5df311f53b24c930e434cbf94a5c4aa), ROM_BIOS(1)) + + ROM_REGION(0x0040000, INTERPRO_EEPROM_TAG, 0) + ROM_LOAD_OPTIONAL("ip2830_eeprom.bin", 0x00000, 0x40000, CRC(a0c0899f) SHA1(dda6fbca81f9885a1a76ca3c25e80463a83a0ef7)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1990, ip2800, 0, 0, ip2800, ip2800, interpro_state, ip2800, "Intergraph", "InterPro 2800", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/jollyjgr.cpp b/src/mame/drivers/jollyjgr.cpp index cc2039a7fe6..c3db52b8913 100644 --- a/src/mame/drivers/jollyjgr.cpp +++ b/src/mame/drivers/jollyjgr.cpp @@ -669,13 +669,13 @@ void jollyjgr_state::machine_reset() static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_18MHz/6) /* 3MHz verified */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_18MHz/6) /* 3MHz verified */ MCFG_CPU_PROGRAM_MAP(jollyjgr_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", jollyjgr_state, jollyjgr_interrupt) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.18) /* 59.1864Hz measured */ + MCFG_SCREEN_REFRESH_RATE(59.18) /* 59.1864Hz measured */ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) @@ -689,7 +689,7 @@ static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("aysnd", AY8910, XTAL_3_579545MHz/2) /* 1.7897725MHz verified */ + MCFG_SOUND_ADD("aysnd", AY8910, XTAL_3_579545MHz/2) /* 1.7897725MHz verified */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45) MACHINE_CONFIG_END diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index c68620e1d1c..50420033dde 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -50,30 +50,30 @@ public: required_ioport_array<7> m_inp_matrix; // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); bool m_power_on; - uint8_t m_inp_mux; - uint8_t m_phoneme; + u8 m_inp_mux; + u8 m_phoneme; int m_speech_strobe; int m_vfd_data_enable; int m_vfd_data_in; int m_vfd_clock; - uint64_t m_vfd_shiftreg; - uint64_t m_vfd_shiftreg_out; + u64 m_vfd_shiftreg; + u64 m_vfd_shiftreg_out; int m_vfd_shiftcount; DECLARE_WRITE8_MEMBER(mcu_p0_w); @@ -168,7 +168,7 @@ void k28_state::power_off() void k28_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -181,7 +181,7 @@ void k28_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -236,7 +236,7 @@ void k28_state::set_display_size(int maxx, int maxy) m_display_maxy = maxy; } -void k28_state::set_display_segmask(uint32_t digits, uint32_t mask) +void k28_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -247,12 +247,12 @@ void k28_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void k28_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void k28_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -297,7 +297,7 @@ WRITE8_MEMBER(k28_state::mcu_p0_w) READ8_MEMBER(k28_state::mcu_p1_r) { - uint8_t data = 0; + u8 data = 0; // multiplexed inputs (active low) for (int i = 0; i < 7; i++) @@ -352,11 +352,11 @@ WRITE8_MEMBER(k28_state::mcu_prog_w) m_vfd_shiftcount = 0; // output 0-15: digit segment data - uint16_t seg_data = (uint16_t)(m_vfd_shiftreg >> 19); + u16 seg_data = (u16)(m_vfd_shiftreg >> 19); seg_data = BITSWAP16(seg_data,0,1,13,9,10,12,14,8,3,4,5,2,15,11,6,7); // output 16-24: digit select - uint16_t digit_sel = (uint16_t)(m_vfd_shiftreg >> 10) & 0x1ff; + u16 digit_sel = (u16)(m_vfd_shiftreg >> 10) & 0x1ff; set_display_segmask(0x1ff, 0x3fff); display_matrix(16, 9, seg_data, digit_sel); diff --git a/src/mame/drivers/kangaroo.cpp b/src/mame/drivers/kangaroo.cpp index c213279a5f8..112b9cad2e2 100644 --- a/src/mame/drivers/kangaroo.cpp +++ b/src/mame/drivers/kangaroo.cpp @@ -544,21 +544,23 @@ ROM_END ROM_START( kangaroob ) ROM_REGION( 0x14000, "maincpu", 0 ) - ROM_LOAD( "tvg_75.0", 0x0000, 0x1000, CRC(0d18c581) SHA1(0e0f89d644b79e887c53e5294783843ca7e875ba) ) - ROM_LOAD( "tvg_76.1", 0x1000, 0x1000, CRC(5978d37a) SHA1(684c1092de4a0927a03752903c86c3bbe99e868a) ) - ROM_LOAD( "tvg_77.2", 0x2000, 0x1000, CRC(522d1097) SHA1(09fe627a46d32df2e098d9fad7757f9d61bef41f) ) - ROM_LOAD( "tvg_78.3", 0x3000, 0x1000, CRC(063da970) SHA1(582ff21dd46c651f07a4846e0f8a7544a5891988) ) - ROM_LOAD( "tvg_79.4", 0x4000, 0x1000, CRC(9e5cf8ca) SHA1(015387f038c5670f88c9b22453d074bd9b2a129d) ) - ROM_LOAD( "k6", 0x5000, 0x1000, CRC(7644504a) SHA1(7a8a4bd163d2cdf27390ab2ef65fb7fa6fc1a361) ) + ROM_LOAD( "k1.ic7", 0x0000, 0x1000, CRC(0d18c581) SHA1(0e0f89d644b79e887c53e5294783843ca7e875ba) ) + ROM_LOAD( "k2.ic8", 0x1000, 0x1000, CRC(5978d37a) SHA1(684c1092de4a0927a03752903c86c3bbe99e868a) ) + ROM_LOAD( "k3.ic9", 0x2000, 0x1000, CRC(522d1097) SHA1(09fe627a46d32df2e098d9fad7757f9d61bef41f) ) + ROM_LOAD( "k4.ic10", 0x3000, 0x1000, CRC(063da970) SHA1(582ff21dd46c651f07a4846e0f8a7544a5891988) ) + ROM_LOAD( "k5.ic16", 0x4000, 0x1000, CRC(9e5cf8ca) SHA1(015387f038c5670f88c9b22453d074bd9b2a129d) ) + ROM_LOAD( "k6.ic17", 0x5000, 0x1000, CRC(7644504a) SHA1(7a8a4bd163d2cdf27390ab2ef65fb7fa6fc1a361) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "tvg_81.8", 0x0000, 0x1000, CRC(fb449bfd) SHA1(f593a0339f47e121736a927587132aeb52704557) ) + ROM_LOAD( "k7.ic24", 0x0000, 0x1000, CRC(fb449bfd) SHA1(f593a0339f47e121736a927587132aeb52704557) ) + + // MB8841 at IC29 and 2716 at IC28 not populated ROM_REGION( 0x4000, "gfx1", 0 ) - ROM_LOAD( "tvg_83.v0", 0x0000, 0x1000, CRC(c0446ca6) SHA1(fca6ba565051337c0198c93b7b8477632e0dd0b6) ) - ROM_LOAD( "tvg_85.v2", 0x1000, 0x1000, CRC(72c52695) SHA1(87f4715fbb7d509bd9cc4e71e2afb0d475bbac13) ) - ROM_LOAD( "tvg_84.v1", 0x2000, 0x1000, CRC(e4cb26c2) SHA1(5016db9d48fdcfb757618659d063b90862eb0e90) ) - ROM_LOAD( "tvg_86.v3", 0x3000, 0x1000, CRC(9e6a599f) SHA1(76b4eddb4efcd8189d8cc5962d8497e82885f212) ) + ROM_LOAD( "k10.ic76", 0x0000, 0x1000, CRC(c0446ca6) SHA1(fca6ba565051337c0198c93b7b8477632e0dd0b6) ) + ROM_LOAD( "k11.ic77", 0x1000, 0x1000, CRC(72c52695) SHA1(87f4715fbb7d509bd9cc4e71e2afb0d475bbac13) ) + ROM_LOAD( "k8.ic52", 0x2000, 0x1000, CRC(e4cb26c2) SHA1(5016db9d48fdcfb757618659d063b90862eb0e90) ) + ROM_LOAD( "k9.ic53", 0x3000, 0x1000, CRC(9e6a599f) SHA1(76b4eddb4efcd8189d8cc5962d8497e82885f212) ) ROM_END diff --git a/src/mame/drivers/konamim2.cpp b/src/mame/drivers/konamim2.cpp index 716f0bce1ff..3ac8f75ccde 100644 --- a/src/mame/drivers/konamim2.cpp +++ b/src/mame/drivers/konamim2.cpp @@ -192,6 +192,7 @@ Notes: #include "cdrom.h" #include "cpu/powerpc/ppc.h" #include "imagedev/chd_cd.h" +#include "machine/terminal.h" #include "softlist.h" struct CDE_DMA @@ -209,10 +210,19 @@ public: konamim2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_main_ram(*this, "main_ram"), + m_terminal(*this, "terminal"), + m_in_country(*this, "COUNTRY"), + m_in_card(*this, "CARD"), + m_in_monitor(*this, "MONITOR"), m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub") { } required_shared_ptr<uint64_t> m_main_ram; + required_device<generic_terminal_device> m_terminal; + required_ioport m_in_country; + required_ioport m_in_card; + required_ioport m_in_monitor; + uint32_t m_vdl0_address; uint32_t m_vdl1_address; uint32_t m_irq_enable; @@ -242,17 +252,24 @@ public: DECLARE_READ64_MEMBER(unk30000_r); DECLARE_READ64_MEMBER(unk30030_r); DECLARE_WRITE64_MEMBER(video_w); - DECLARE_WRITE64_MEMBER(video_irq_ack_w); + DECLARE_WRITE32_MEMBER(video_irq_ack_w); DECLARE_READ64_MEMBER(unk4000280_r); - DECLARE_WRITE64_MEMBER(unk4000010_w); + DECLARE_WRITE8_MEMBER(serial_w); DECLARE_WRITE64_MEMBER(unk4000418_w); DECLARE_WRITE64_MEMBER(reset_w); DECLARE_READ64_MEMBER(cde_r); DECLARE_WRITE64_MEMBER(cde_w); DECLARE_READ64_MEMBER(device2_r); DECLARE_READ64_MEMBER(cpu_r); + DECLARE_READ8_MEMBER(id3_r); + DECLARE_READ8_MEMBER(id4_r); + DECLARE_READ8_MEMBER(id5_r); + DECLARE_READ8_MEMBER(id6_r); + DECLARE_READ8_MEMBER(id7_r); + DECLARE_DRIVER_INIT(m2); virtual void video_start() override; + virtual void machine_reset() override; uint32_t screen_update_m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(m2); void cde_init(); @@ -271,21 +288,32 @@ void konamim2_state::video_start() uint32_t konamim2_state::screen_update_m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int i, j; - uint32_t fb_start = 0xffffffff; + uint32_t fb_size; + //uint32_t config; + int height = 384,width = 512; + if (m_vdl0_address != 0) { - fb_start = *(uint32_t*)&m_main_ram[(m_vdl0_address - 0x40000000) / 8] - 0x40000000; + uint32_t cur_vdl_address = screen.frame_number() & 1 ? m_vdl0_address : m_vdl1_address; + // TODO: this looks more likely to be a framebuffer copy, with parameters! + fb_start = *(uint32_t*)&m_main_ram[(cur_vdl_address - 0x40000000) / 8] - 0x40000000; + fb_size = m_main_ram[((cur_vdl_address - 0x40000000) / 8) + 2] >> 32; + //config = m_main_ram[(cur_vdl_address - 0x40000000) / 8] >> 32; + //popmessage("%08x",config); + + height = fb_size & 0x1ff; + width = (fb_size >> 24) * 16; } - + if (fb_start <= 0x800000) { uint16_t *frame = (uint16_t*)&m_main_ram[fb_start/8]; - for (j=0; j < 384; j++) + for (j=0; j < height; j++) { - uint16_t *fb = &frame[(j*512)]; + uint16_t *fb = &frame[(j*width)]; uint16_t *d = &bitmap.pix16(j); - for (i=0; i < 512; i++) + for (i=0; i < width; i++) { d[i^3] = *fb++ & 0x7fff; } @@ -382,7 +410,7 @@ WRITE64_MEMBER(konamim2_state::unk4_w) if (data & 0x800000) { // osd_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", device().tag(), space.device().safe_pc()); - m_subcpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + m_subcpu->set_input_line(PPC_IRQ, ASSERT_LINE); } m_unk20004 = (uint32_t)(data); @@ -417,14 +445,12 @@ WRITE64_MEMBER(konamim2_state::video_w) } } -WRITE64_MEMBER(konamim2_state::video_irq_ack_w) +WRITE32_MEMBER(konamim2_state::video_irq_ack_w) { - if (ACCESSING_BITS_32_63) + if (data & 0x8000) { - if ((data >> 32) & 0x8000) - { - m_irq_active &= ~0x800000; - } + m_irq_active &= ~0x800000; + m_maincpu->set_input_line(PPC_IRQ, CLEAR_LINE); } } @@ -436,14 +462,14 @@ READ64_MEMBER(konamim2_state::unk4000280_r) uint32_t sys_config = 0x03600000; - sys_config |= 0 << 0; // Bit 0: PAL/NTSC switch (default is selected by encoder) - sys_config |= 0 << 2; // Bit 2-3: Video Encoder (0 = MEIENC, 1 = VP536, 2 = BT9103, 3 = DENC) - sys_config |= 3 << 11; // Bit 11-12: Country + sys_config |= 0 << 0; // Bit 0: PAL/NTSC switch (default is selected by encoder) + sys_config |= 0 << 2; // Bit 2-3: Video Encoder (0 = MEIENC, 1 = VP536, 2 = BT9103, 3 = DENC) + sys_config |= m_in_country->read() << 11; // Bit 11-12: Country // 0 = ??? // 1 = UK // 2 = Japan // 3 = US - sys_config |= 0xb << 15; // Bit 15-18: 0x8 = AC-DevCard + sys_config |= m_in_card->read() << 15; // Bit 15-18: 0x8 = AC-DevCard // 0xb = AC-CoreBoard // 0xc = DevCard (not allowed) // 0xe = Upgrade (not allowed) @@ -454,16 +480,9 @@ READ64_MEMBER(konamim2_state::unk4000280_r) } -WRITE64_MEMBER(konamim2_state::unk4000010_w) +WRITE8_MEMBER(konamim2_state::serial_w) { - if ((data & 0xff) == 0xd) - { -// osd_printf_debug("\n"); - } - else - { -// osd_printf_debug("%c", (uint8_t)(data & 0xff)); - } + m_terminal->write(space,0,data & 0xff); } WRITE64_MEMBER(konamim2_state::unk4000418_w) @@ -1115,53 +1134,138 @@ READ64_MEMBER(konamim2_state::cpu_r) if (ACCESSING_BITS_32_63) { r = (uint64_t)((&space.device() != m_maincpu) ? 0x80000000 : 0); - //r |= 0x40000000; // sets Video-LowRes !? + r |= m_in_monitor->read() << 30; return r << 32; } return 0; } +READ8_MEMBER(konamim2_state::id3_r) +{ + return 0x03; +} + +READ8_MEMBER(konamim2_state::id4_r) +{ + return 0x04; +} + +READ8_MEMBER(konamim2_state::id5_r) +{ + return 0x05; +} + +READ8_MEMBER(konamim2_state::id6_r) +{ + return 0x06; +} + +READ8_MEMBER(konamim2_state::id7_r) +{ + return 0x07; +} + static ADDRESS_MAP_START( m2_main, AS_PROGRAM, 64, konamim2_state ) + AM_RANGE(0x00000000, 0x0000007f) AM_RAM // ??? AM_RANGE(0x00010040, 0x00010047) AM_READWRITE(irq_enable_r, irq_enable_w) AM_RANGE(0x00010050, 0x00010057) AM_READ(irq_active_r) AM_RANGE(0x00020000, 0x00020007) AM_READWRITE(unk4_r, unk4_w) + AM_RANGE(0x00020400, 0x000207ff) AM_RAM // ??? + AM_RANGE(0x00020800, 0x00020807) AM_RAM // ??? AM_RANGE(0x00030000, 0x00030007) AM_READ(unk30000_r) AM_RANGE(0x00030010, 0x00030017) AM_WRITE(video_w) AM_RANGE(0x00030030, 0x00030037) AM_READ(unk30030_r) - AM_RANGE(0x00030400, 0x00030407) AM_WRITE(video_irq_ack_w) + AM_RANGE(0x00030400, 0x00030407) AM_WRITE32(video_irq_ack_w,0x00000000ffffffffU) + AM_RANGE(0x01000000, 0x01000fff) AM_READWRITE(cde_r, cde_w) + AM_RANGE(0x02000000, 0x02000fff) AM_READ(device2_r) - AM_RANGE(0x04000010, 0x04000017) AM_WRITE(unk4000010_w) - AM_RANGE(0x04000018, 0x0400001f) AM_READ(unk1_r) + + AM_RANGE(0x03000000, 0x03000007) AM_READ8(id3_r, 0x00ff000000000000U) + + AM_RANGE(0x04000000, 0x04000007) AM_READ8(id4_r, 0x00ff000000000000U) + AM_RANGE(0x04000010, 0x04000017) AM_WRITE8(serial_w,0x00000000000000ffU) + AM_RANGE(0x04000018, 0x0400001f) AM_READ(unk1_r) // serial status AM_RANGE(0x04000020, 0x04000027) AM_WRITE(reset_w) - AM_RANGE(0x04000418, 0x0400041f) AM_WRITE(unk4000418_w) + AM_RANGE(0x04000418, 0x0400041f) AM_WRITE(unk4000418_w) // serial status ack AM_RANGE(0x04000208, 0x0400020f) AM_READ(unk3_r) AM_RANGE(0x04000280, 0x04000287) AM_READ(unk4000280_r) + + AM_RANGE(0x05000000, 0x05000007) AM_READ8(id5_r, 0x00ff000000000000U) + + AM_RANGE(0x06000000, 0x06000007) AM_READ8(id6_r, 0x00ff000000000000U) + + AM_RANGE(0x07000000, 0x07000007) AM_READ8(id7_r, 0x00ff000000000000U) + AM_RANGE(0x10000000, 0x10000007) AM_READ(cpu_r) AM_RANGE(0x10000008, 0x10001007) AM_NOP // ??? + AM_RANGE(0x20000000, 0x201fffff) AM_ROM AM_SHARE("share2") AM_RANGE(0x40000000, 0x407fffff) AM_RAM AM_SHARE("main_ram") AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("boot", 0) AM_SHARE("share2") ADDRESS_MAP_END +static ADDRESS_MAP_START( 3do_m2_main, AS_PROGRAM, 64, konamim2_state ) +// ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM( m2_main ) + +// AM_RANGE(0x00000000, 0x000cffff) devices? +ADDRESS_MAP_END + static INPUT_PORTS_START( m2 ) + // TODO: it's unknown if these are actual dip-switches or internal to something + PORT_START("COUNTRY") + PORT_CONFNAME( 0x03, 0x03, "Country" ) + PORT_CONFSETTING( 0x00, "<Invalid>" ) + PORT_CONFSETTING( 0x01, "UK" ) + PORT_CONFSETTING( 0x02, "Japan" ) + PORT_CONFSETTING( 0x03, "US" ) + + PORT_START("CARD") + PORT_CONFNAME( 0x0f, 0x0b, "Card Type" ) + PORT_CONFSETTING( 0x08, "AC-DevCard" ) + PORT_CONFSETTING( 0x0b, "AC-CoreBoard" ) + PORT_CONFSETTING( 0x0c, "DevCard (not allowed)" ) + PORT_CONFSETTING( 0x0e, "Upgrade (not allowed)" ) + PORT_CONFSETTING( 0x0f, "Multiplayer (not allowed)" ) + + PORT_START("MONITOR") + PORT_CONFNAME( 0x01, 0x00, "Monitor Type" ) + PORT_CONFSETTING( 0x01, "15 KHz" ) + PORT_CONFSETTING( 0x00, "24 KHz" ) INPUT_PORTS_END INTERRUPT_GEN_MEMBER(konamim2_state::m2) { + /* + 0x000001 + 0x000008 + 0x200000 + 0x800000 VBlank irq + */ + if (m_irq_enable & 0x800000) { + //m_irq_enable |= 0x800000; m_irq_active |= 0x800000; + device.execute().set_input_line(PPC_IRQ, ASSERT_LINE); } - + /*if (m_irq_enable & 0x8) { m_irq_active |= 0x8; }*/ - device.execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + +} + +void konamim2_state::machine_reset() +{ + m_unk3 = 0xffffffffffffffffU; + m_unk20004 = 0; + cde_init(); } static MACHINE_CONFIG_START( m2, konamim2_state ) @@ -1176,18 +1280,22 @@ static MACHINE_CONFIG_START( m2, konamim2_state ) MCFG_PPC_BUS_FREQUENCY(33000000) /* Multiplier 2, Bus = 33MHz, Core = 66MHz */ MCFG_CPU_PROGRAM_MAP(m2_main) + // TODO: declaring as second screen causes palette confusion (wants to use palette from the other screen?) + MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(704, 512) MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383) MCFG_SCREEN_UPDATE_DRIVER(konamim2_state, screen_update_m2) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette") - /*cd-rom*/ + + /*cd-rom*/ MCFG_CDROM_ADD( "cdrom" ) MCFG_CDROM_INTERFACE("3do_m2_cdrom") @@ -1195,6 +1303,12 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED_CLASS ( 3do_m2, m2, konamim2_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(3do_m2_main) + + MCFG_CPU_MODIFY("sub") + MCFG_CPU_PROGRAM_MAP(3do_m2_main) + MCFG_SOFTWARE_LIST_ADD("cd_list","3do_m2") MACHINE_CONFIG_END @@ -1329,9 +1443,7 @@ ROM_END DRIVER_INIT_MEMBER(konamim2_state,m2) { - m_unk3 = 0xffffffffffffffffU; - m_unk20004 = 0; - cde_init(); + } GAME( 1997, polystar, 0, m2, m2, konamim2_state, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp index 33c82310780..a0b1a5727e4 100644 --- a/src/mame/drivers/kurukuru.cpp +++ b/src/mame/drivers/kurukuru.cpp @@ -113,6 +113,130 @@ AB = NEC C1663C 8926B. + Pinout: + + solder side |##| components + -------------------|--|----------------- + gnd |01| gnd + gnd |02| gnd + +5v |03| +5v + +5v |04| +5v + -5v |05| -5v + +12v |06| +12v + | | + hole (no connector) |07| hole (no connector) + | | + Coin B (10Y) meter |08| Coin A (100Y) meter + hopper motor |09| unknown out (ULN2003, pin15) + speaker - |10| speaker + + (ULN2003, pin13) unknown out |11| unknown out (ULN2003, pin12) + green |12| red + sync |13| blue + (ULN2003, pin13) unknown out |14| video gnd + | | + medal in |15| management + coin B (10Y) in |16| reset + coin A (100Y) in |17| unknown in (active) + +5v |<|-- (diode) |18| (diode) --|>| +5v + +5v |<|-- (diode) |19| (diode) --|>| +5v + | | + Botechin (5th) |20| (1st) Boketa + (active) unknown in |21| (2nd) Kunio + (active) unknown in |22| (3rd) Pyon-Pyon + start |23| (4th) Pyokorin + payout |24| hopper in (opto in) + | | + not used |25| not used + not used |26| not used + gnd |27| gnd + gnd |28| gnd + + + Pyon Pyon Jump DIP switches: + + .---------------------------------------------------------------------------------. + | DIP Switches bank #1 1 2 3 4 5 6 7 8 | + +-------------------------------------+-------------------------------------------+ + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 11 medal | off off off | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 10 medal | off off on | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 6 medal | off on off | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 5 medal | off on on | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 4 medal | on off off | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 3 medal | on off on | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 2 medal | on on off | + +-----------------+-------------------+-------------------------------------------+ + | Coinage Coin A | 1 coin / 1 medal | on on on | + +-----------------+-------------------+-------------------------------------------+ + | Coin A (100Y) | Exchange | off | + +-----------------+-------------------+-------------------------------------------+ + | Coin A (100Y) | Credit | on | + +-----------------+-------------------+-------------------------------------------+ + | Win | Medal out | off | + +-----------------+-------------------+-------------------------------------------+ + | Win | Credit | on | + +-----------------+-------------------+-------------------------------------------+ + | Coinage config | Coin A: Payout | off | + +-----------------+-------------------+-------------------------------------------+ + | Coinage config | Coin A: Normal | on | + +-----------------+-------------------+-------------------------------------------+ + | Payout Mode | Manual | off | + +-----------------+-------------------+-------------------------------------------+ + | Payout Mode | Automatic | on | + +-----------------+-------------------+-------------------------------------------+ + | Repeat last bet | No | off | + +-----------------+-------------------+-------------------------------------------+ + | Repeat last bet | Yes | on | + '-----------------+-------------------+-------------------------------------------' + + .---------------------------------------------------------------------------------. + | DIP Switches bank #2 1 2 3 4 5 6 7 8 | + +-------------------------------------+-------------------------------------------+ + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 95% | on on on | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 90% | on on off | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 85% | on off on | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 80% | on off off | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 75% | off on on | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 70% | off on off | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 60% | off off on | + +-----------------+-------------------+-------------------------------------------+ + | Percentage | 50% | off off off | + +-----------------+-------------------+-------------------------------------------+ + | Winwave | Small | off | + +-----------------+-------------------+-------------------------------------------+ + | Winwave | Big | on | + +-----------------+-------------------+-------------------------------------------+ + | M.Medal | Off | off | + +-----------------+-------------------+-------------------------------------------+ + | M.Medal | On | on | + +-----------------+-------------------+-------------------------------------------+ + | HG | 20-1 | off off | + +-----------------+-------------------+-------------------------------------------+ + | HG | 50-1 | off on | + +-----------------+-------------------+-------------------------------------------+ + | HG | 100-1 | on off | + +-----------------+-------------------+-------------------------------------------+ + | HG | 200-1 | on on | + +-----------------+-------------------+-------------------------------------------+ + | unknown | off | + +-------------------------------------+-------------------------------------------+ + | unknown | on | + '-------------------------------------+-------------------------------------------' + + ************************************************************************************ General Notes.... diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp index b612920396b..c079b525a74 100644 --- a/src/mame/drivers/laserbas.cpp +++ b/src/mame/drivers/laserbas.cpp @@ -1,22 +1,32 @@ // license:BSD-3-Clause -// copyright-holders:Tomasz Slanina +// copyright-holders: Tomasz Slanina, Morten Shearman Kirkegaard, Samuel Neves, Peter Wilhelmsen + /******************************************** Laser Base / Future Flash driver - IC marked as Z1 is probably protection device - mapped in memory region f800-fbff - (similar to the one used in Parallel Turn) - - Reads form this device depends on previous - writes (adr, data), address and previous - operation (read or write). - Pinout is almost identical to 2716 - type EPROM, - except separated /RD and /WR signals and lacks - of /CS - - Tomasz Slanina analog [at] op.pl - ============================================ +TODO: +- Video: weird palette changes, Laserbase colors, missing bg scrolling between stages (CRT address lines + m_hset ( or m_vset ?)) +- Sound: sound related i/o writes ( out_w handler ) +- Interrupts - NMI/Int timing is wrong, it's based on measures of broken PCB +TS 20.01.2017 + +There's incomplete schematics available. It's missing a couple of important elements (analog sound, interrupts). +PCB contains big analog sound section, currently only partially emulated ( timers + counters + xors + dacs). There's many capacitors, +resistors and few ICs, including: + +7B LM2902N - Op Amps +4B LM2902N +2B LM2902N +1B LM2902N +6B LM1496N - Balanced Modulator-Demodulator +3B CA3080E - Op Amp +6C NE555P - Timer +4A NE555P - Timer +6A SN94560AN - ? a tone generator (similar to SN76477 ?) +3A MB84013B - Dual D flip-flop +2A MN3008 - 2048-stage long delay low noise BBD (reverb effect generator) +1C MB3712 - Power Amp. DASM notes: @@ -53,127 +63,168 @@ expected: 43 FB CC 9A D4 23 6C 01 3E <- From ROM 4 #include "cpu/z80/z80.h" #include "video/mc6845.h" #include "machine/pit8253.h" +#include "sound/dac.h" +#include "sound/volt_reg.h" class laserbas_state : public driver_device { public: laserbas_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_protram(*this, "protram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette"), + m_dac1(*this, "dac1"), + m_dac2(*this, "dac2"), + m_dac3(*this, "dac3"), + m_dac4(*this, "dac4"), + m_dac5(*this, "dac5"), + m_dac6(*this, "dac6") + { } /* misc */ - int m_count; - + int m_dac_data; + int m_counter[6]; + int m_cnt_out[6]; + int m_nmi; /* video-related */ int m_vrambank; - uint8_t m_vram1[0x8000]; - uint8_t m_vram2[0x8000]; + uint8_t m_vram[0x10000]; + int m_hset, m_vset; + int m_bset; + int m_scl; bool m_flipscreen; - required_shared_ptr<uint8_t> m_protram; + uint64_t m_z1data; + void write_pit_out(int num, int state); DECLARE_READ8_MEMBER(vram_r); DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_WRITE8_MEMBER(vrambank_w); - DECLARE_READ8_MEMBER(protram_r); - DECLARE_WRITE8_MEMBER(protram_w); + DECLARE_WRITE8_MEMBER(videoctrl_w); + DECLARE_READ8_MEMBER(z1_r); DECLARE_READ8_MEMBER(track_lo_r); DECLARE_READ8_MEMBER(track_hi_r); DECLARE_WRITE8_MEMBER(out_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_0_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_1_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_2_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_3_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_4_w); + DECLARE_WRITE_LINE_MEMBER(pit_out_5_w); + TIMER_DEVICE_CALLBACK_MEMBER(laserbas_scanline); + MC6845_UPDATE_ROW(crtc_update_row); + virtual void machine_start() override; virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update_laserbas(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device<cpu_device> m_maincpu; + required_device<palette_device> m_palette; + required_device<dac_byte_interface> m_dac1; + required_device<dac_byte_interface> m_dac2; + required_device<dac_byte_interface> m_dac3; + required_device<dac_byte_interface> m_dac4; + required_device<dac_byte_interface> m_dac5; + required_device<dac_byte_interface> m_dac6; }; -void laserbas_state::video_start() +TIMER_DEVICE_CALLBACK_MEMBER( laserbas_state::laserbas_scanline ) { - save_item(NAME(m_vram1)); - save_item(NAME(m_vram2)); - save_item(NAME(m_flipscreen)); + int scanline = param; + + if(scanline == 0 || scanline == 135) + { + m_maincpu->set_input_line(0, HOLD_LINE ); + } + + if(scanline == 240 && m_nmi) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } } -uint32_t laserbas_state::screen_update_laserbas(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +MC6845_UPDATE_ROW( laserbas_state::crtc_update_row ) { - int x,y, x0,y0, x1,y1, delta; + int x = 0; + int x_max = 0x100; + int dx = 1; if (m_flipscreen) { - delta = -1; - x0 = 256-1; x1 = -1; - y0 = 256-1; y1 = -1; - } - else - { - delta = 1; - x0 = 0; x1 = 256; - y0 = 0; y1 = 256; + y = 0xdf - y; + x = 0xff; + x_max = -1; + dx = -1; } - int pixaddr = 0; - for (y = y0; y != y1; y += delta) + int pixaddr = y << 8; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + uint32_t *b = &bitmap.pix32(y); + + while (x != x_max) { - for (x = x0; x != x1; x += delta) - { - uint8_t p1 = m_vram1[pixaddr/2]; - uint8_t p2 = m_vram2[pixaddr/2]; - uint8_t mask = (pixaddr & 1) ? 0xf0 : 0x0f; - uint8_t shift = (pixaddr & 1) ? 4 : 0; - - if (p2 & mask) - bitmap.pix16(y, x) = (p2 & mask) >> shift; - else - bitmap.pix16(y, x) = ((p1 & mask) >> shift) + 16; - - pixaddr++; - } + int offset = (pixaddr >> 1) & 0x7fff; + int shift = (pixaddr & 1) * 4; // two 4 bit pixels in one byte + int p1 = (m_vram[offset] >> shift) & 0xf; + int p2 = (m_vram[offset + 0x8000] >> shift) & 0xf; // 0x10000 VRAM, two 4 bit layers 0x8000 bytes each + int p; + + if (p2) + p = p2; + else if (p1) + p = p1 + 16; + else + p = m_bset; + + b[x] = palette[p]; + + pixaddr++; + x += dx; } - - return 0; } READ8_MEMBER(laserbas_state::vram_r) { - if(!m_vrambank) - return m_vram1[offset]; - else - return m_vram2[offset]; + return m_vram[offset+(m_vrambank?0x8000:0)]; } WRITE8_MEMBER(laserbas_state::vram_w) { - if(!m_vrambank) - m_vram1[offset] = data; - else - m_vram2[offset] = data; -} - -#if 0 -READ8_MEMBER(laserbas_state::read_unk) -{ - m_count ^= 0x80; - return m_count | 0x7f; -} -#endif - -WRITE8_MEMBER(laserbas_state::vrambank_w) -{ - m_vrambank = data & 0x40; - m_flipscreen = !(data & 0x80); + m_vram[offset+(m_vrambank?0x8000:0)] = data; } -READ8_MEMBER(laserbas_state::protram_r) +WRITE8_MEMBER(laserbas_state::videoctrl_w) { - uint8_t prot = m_protram[offset]; -// prot = machine().rand(); -// logerror("%s: Z1 read %03x = %02x\n", machine().describe_context(), offset, prot); - return prot; + if(!(offset&1)) + { + m_vrambank = data & 0x40; // layer select + m_flipscreen = !(data & 0x80); + m_vset = (data>>3)&7; // inc-ed on interrupts ( 8 ints / frame ?) + m_hset = data&7; + } + else + { + data^=0xff; + m_bset = data>>4; // bg pen + m_scl = (data&8)>>3; // unknown + m_nmi=data&1; // nmi enable (not on schematics, traced) + } } -WRITE8_MEMBER(laserbas_state::protram_w) +READ8_MEMBER(laserbas_state::z1_r) { -// logerror("%s: Z1 write %03x = %02x\n", machine().describe_context(), offset, data); - m_protram[offset] = data; + m_z1data = (m_z1data >> 10) | (uint64_t(offset & 0x03ff) << 30); + + auto const x = [this] (unsigned b) { return BIT(m_z1data, b); }; + auto const nx = [this] (unsigned b) { return BIT(~m_z1data, b); }; + auto const MUX2 = [] (bool s, uint16_t a, uint16_t b) { return s ? a : b; }; + + uint8_t const bit7 = MUX2(x(36) & x(33), x(31) ^ x(35), (nx(33) & (nx(20) | nx(36))) | (nx(36) & x(24))); + uint8_t const bit6 = MUX2(x(36), MUX2(x(33), x(29), nx(23) | x(30)), x(33) & x(15)); + uint8_t const bit5 = MUX2(x(36), nx(33) & x(27), x(32) | x(33)); + uint8_t const bit4 = MUX2(x(36), MUX2(x(33), nx(24), nx(35)), MUX2(nx(33), x(4), MUX2(nx(26), x(5) & x(23), MUX2(x(23), x(19), nx(13) | x(20))))); + uint8_t const bit3 = MUX2(x(36), x(33) & x(11), MUX2(x(33), x(25) | nx(31), x(24))); + uint8_t const bit2 = MUX2(x(33), MUX2(x(36), x(28), x(20)), MUX2(x(36), nx(11), nx(39))); + uint8_t const bit1 = MUX2(x(36), MUX2(x(23), MUX2(x(26), nx(18), nx(10)) | x(33), MUX2(x(26), x(1), x(29)) & nx(33)), MUX2(x(33), x(7), x(17))); + uint8_t const bit0 = MUX2(x(33), MUX2(x(36), x(22), nx(26)), MUX2(x(36), x(14), x(21))); + + return (bit7 << 7) | (bit6 << 6) | (bit5 << 5) | (bit4 << 4) | (bit3 << 3) | (bit2 << 2) | (bit1 << 1) | (bit0 << 0); } READ8_MEMBER(laserbas_state::track_lo_r) @@ -181,29 +232,103 @@ READ8_MEMBER(laserbas_state::track_lo_r) uint8_t dx = ioport("TRACK_X")->read(); uint8_t dy = ioport("TRACK_Y")->read(); if (dx & 0x10) - dx ^= 0x0f; + dx ^= 0xf; if (dy & 0x10) dy ^= 0x0f; - return (dx & 0x0f) | ((dy & 0x0f) << 4); + int data = (dx & 0x0f) | ((dy & 0x0f) << 4); + return data; } + READ8_MEMBER(laserbas_state::track_hi_r) { - return ((ioport("TRACK_X")->read() & 0x10) >> 4) | ((ioport("TRACK_Y")->read() & 0x10) >> 3); + int data = ((ioport("TRACK_X")->read() & 0x10) >> 4) | ((ioport("TRACK_Y")->read() & 0x10) >> 3); + return data; } WRITE8_MEMBER(laserbas_state::out_w) { - static uint8_t out[4]; - out[offset] = data; - // port 20: mask 01 = service1, mask 02 = pulsed (no delay) waiting for start1, mask 08 = coin2, mask 40 = coin1 - popmessage("OUT 20: %02x %02x - %02x %02x", out[0], out[1], out[2], out[3]); + /* sound related , maybe also lamps */ +} + +void laserbas_state::machine_start() +{ + save_item(NAME(m_vram)); + save_item(NAME(m_flipscreen)); + save_item(NAME(m_vrambank)); + save_item(NAME(m_hset)); + save_item(NAME(m_vset)); + save_item(NAME(m_bset)); + save_item(NAME(m_scl)); + save_item(NAME(m_nmi)); + save_item(NAME(m_dac_data)); + save_item(NAME(m_counter)); + save_item(NAME(m_cnt_out)); + save_item(NAME(m_z1data)); +} + +void laserbas_state::machine_reset() +{ + m_vrambank = 0; + m_flipscreen = false; + m_nmi=0; + m_bset = 0; + m_hset = 0; + m_vset = 0; + m_scl = 0; +} + +void laserbas_state::write_pit_out(int num, int state) +{ + state^=1; // 7404 (6G) + if((!state)& m_cnt_out[num]){ // 0->1 rising edge CLK + m_counter[num] = (m_counter[num]+1)&0x0f; // 4 bit counters 74393 + } + int data =(state) | ((m_counter[num]&7)<<1); // combine output from 8253 with counter bits 0-3 + data<<=4; + if(m_counter[num]&8) data^=0x0f; // counter bit 4 xors the data ( 7486 x 6) + switch(num){ + case 0: m_dac1->write(data);break; // 4 resistor packs : 47k, 100k, 220k, 470k + case 1: m_dac2->write(data);break; + case 2: m_dac3->write(data);break; + case 3: m_dac4->write(data);break; + case 4: m_dac5->write(data);break; + case 5: m_dac6->write(data);break; + } + + m_cnt_out[num]=state; +} + +WRITE_LINE_MEMBER(laserbas_state::pit_out_0_w) +{ + write_pit_out(0,state); +} + +WRITE_LINE_MEMBER(laserbas_state::pit_out_1_w) +{ + write_pit_out(1,state); +} +WRITE_LINE_MEMBER(laserbas_state::pit_out_2_w) +{ + write_pit_out(2,state); +} +WRITE_LINE_MEMBER(laserbas_state::pit_out_3_w) +{ + write_pit_out(3,state); +} +WRITE_LINE_MEMBER(laserbas_state::pit_out_4_w) +{ + write_pit_out(4,state); +} +WRITE_LINE_MEMBER(laserbas_state::pit_out_5_w) +{ + write_pit_out(5,state); } static ADDRESS_MAP_START( laserbas_memory, AS_PROGRAM, 8, laserbas_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0xbfff) AM_READWRITE(vram_r, vram_w) - AM_RANGE(0xc000, 0xf7ff) AM_ROM - AM_RANGE(0xf800, 0xfbff) AM_READWRITE(protram_r, protram_w) AM_SHARE("protram") /* protection device */ + AM_RANGE(0xc000, 0xf7ff) AM_ROM AM_WRITENOP + AM_RANGE(0xf800, 0xfbff) AM_READ(z1_r) AM_WRITENOP /* protection device */ AM_RANGE(0xfc00, 0xffff) AM_RAM ADDRESS_MAP_END @@ -211,11 +336,11 @@ static ADDRESS_MAP_START( laserbas_io, AS_IO, 8, laserbas_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_device, address_w) AM_RANGE(0x01, 0x01) AM_DEVWRITE("crtc", mc6845_device, register_w) - AM_RANGE(0x10, 0x10) AM_WRITE(vrambank_w) + AM_RANGE(0x10, 0x11) AM_WRITE(videoctrl_w) AM_RANGE(0x20, 0x20) AM_READ_PORT("DSW") AM_RANGE(0x21, 0x21) AM_READ_PORT("INPUTS") AM_RANGE(0x22, 0x22) AM_READ(track_hi_r) - AM_RANGE(0x23, 0x23) AM_READ(track_lo_r) // AM_WRITE(test_w) + AM_RANGE(0x23, 0x23) AM_READ(track_lo_r) AM_RANGE(0x20, 0x23) AM_WRITE(out_w) AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("pit0", pit8253_device, read, write) AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("pit1", pit8253_device, read, write) @@ -234,8 +359,8 @@ static INPUT_PORTS_START( laserbas ) PORT_DIPSETTING( 0x04, "10k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) PORT_DIPSETTING( 0x00, "30k" ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_CONDITION("INPUTS", 0x20, EQUALS, 0x20) @@ -259,7 +384,7 @@ static INPUT_PORTS_START( laserbas ) PORT_START("INPUTS") // $21 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -268,58 +393,67 @@ static INPUT_PORTS_START( laserbas ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service coin PORT_START("TRACK_X") - PORT_BIT( 0x1f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_RESET + PORT_BIT( 0x01f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_RESET PORT_START("TRACK_Y") - PORT_BIT( 0x1f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_RESET PORT_REVERSE + PORT_BIT( 0x01f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE INPUT_PORTS_END -void laserbas_state::machine_start() -{ - save_item(NAME(m_vrambank)); - save_item(NAME(m_count)); -} - -void laserbas_state::machine_reset() -{ - m_vrambank = 0; - m_flipscreen = false; - m_count = 0; -} +#define CLOCK 16680000 +#define PIT_CLOCK (CLOCK/16) // 12 divider ? static MACHINE_CONFIG_START( laserbas, laserbas_state ) - MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_ADD("maincpu", Z80, CLOCK / 4) MCFG_CPU_PROGRAM_MAP(laserbas_memory) MCFG_CPU_IO_MAP(laserbas_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", laserbas_state, irq0_line_hold) -// MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi", laserbas_state, nmi_line_pulse, attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", laserbas_state, laserbas_scanline, "screen", 0, 1) /* TODO: clocks aren't known */ MCFG_DEVICE_ADD("pit0", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_CLK1(31250) - MCFG_PIT8253_CLK2(31250) + MCFG_PIT8253_CLK0(PIT_CLOCK) + MCFG_PIT8253_CLK1(PIT_CLOCK) + MCFG_PIT8253_CLK2(PIT_CLOCK) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(laserbas_state, pit_out_0_w)) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(laserbas_state, pit_out_1_w)) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(laserbas_state, pit_out_2_w)) MCFG_DEVICE_ADD("pit1", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_CLK1(31250) - MCFG_PIT8253_CLK2(31250) + MCFG_PIT8253_CLK0(PIT_CLOCK) + MCFG_PIT8253_CLK1(PIT_CLOCK) + MCFG_PIT8253_CLK2(PIT_CLOCK) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(laserbas_state, pit_out_3_w)) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(laserbas_state, pit_out_4_w)) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(laserbas_state, pit_out_5_w)) 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, 0*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(laserbas_state, screen_update_laserbas) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_RAW_PARAMS(4000000, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */ + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) MCFG_MC6845_ADD("crtc", H46505, "screen", 3000000/4) /* unknown clock, hand tuned to get ~60 fps */ MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(laserbas_state, crtc_update_row) MCFG_PALETTE_ADD("palette", 32) MCFG_PALETTE_FORMAT(RRRGGGBB) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("speaker") + MCFG_SOUND_ADD("dac1", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_SOUND_ADD("dac2", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_SOUND_ADD("dac3", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_SOUND_ADD("dac4", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_SOUND_ADD("dac5", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_SOUND_ADD("dac6", DAC_4BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.16) + MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) + MCFG_SOUND_ROUTE_EX(0, "dac1", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac1", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "dac2", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac2", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "dac3", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac3", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "dac4", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac4", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "dac5", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac5", -1.0, DAC_VREF_NEG_INPUT) + MCFG_SOUND_ROUTE_EX(0, "dac6", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE_EX(0, "dac6", -1.0, DAC_VREF_NEG_INPUT) + MACHINE_CONFIG_END /* @@ -410,6 +544,6 @@ ROM_START( futflash ) ROM_LOAD( "ff.8", 0xf000, 0x0800, CRC(623f558f) SHA1(be6c6565df658555f21c43a8c2459cf399794a84) ) ROM_END -GAME( 1981, laserbas, 0, laserbas, laserbas, driver_device, 0, ROT270, "Hoei (Amstar license)", "Laser Base (set 1)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, laserbasa,laserbas, laserbas, laserbas, driver_device, 0, ROT270, "Hoei (Amstar license)", "Laser Base (set 2)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, futflash, laserbas, laserbas, laserbas, driver_device, 0, ROT270, "Hoei", "Future Flash", MACHINE_NO_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, futflash, 0, laserbas, laserbas, driver_device, 0, ROT270, "Hoei", "Future Flash", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1981, laserbas, futflash, laserbas, laserbas, driver_device, 0, ROT270, "Hoei (Amstar license)", "Laser Base (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1981, laserbasa,futflash, laserbas, laserbas, driver_device, 0, ROT270, "Hoei (Amstar license)", "Laser Base (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/lastbank.cpp b/src/mame/drivers/lastbank.cpp index 94526115a8c..b9baa4bea98 100644 --- a/src/mame/drivers/lastbank.cpp +++ b/src/mame/drivers/lastbank.cpp @@ -8,14 +8,13 @@ Uses a TC0091LVC, a variant of the one used on Taito L HW - TODO: - - sound; - ***************************************************************************/ #include "emu.h" #include "cpu/z80/z80.h" #include "sound/2203intf.h" +#include "sound/es8712.h" +#include "sound/okim6295.h" #include "machine/tc009xlvc.h" #define MASTER_CLOCK XTAL_14_31818MHz @@ -26,11 +25,15 @@ public: lastbank_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_vdp(*this, "tc0091lvc") + m_vdp(*this, "tc0091lvc"), + m_oki(*this, "oki"), + m_essnd(*this, "essnd") { } required_device<cpu_device> m_maincpu; required_device<tc0091lvc_device> m_vdp; + required_device<okim6295_device> m_oki; + required_device<es8712_device> m_essnd; virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -41,6 +44,8 @@ public: uint8_t m_irq_vector[3]; uint8_t m_irq_enable; uint8_t m_mux_data; + uint8_t m_soundlatch[2]; + uint8_t m_sound_flags; DECLARE_READ8_MEMBER(lastbank_rom_r); @@ -53,8 +58,16 @@ public: DECLARE_WRITE8_MEMBER(lastbank_ram_2_w); DECLARE_WRITE8_MEMBER(lastbank_ram_3_w); + DECLARE_WRITE8_MEMBER(output_w); + DECLARE_READ8_MEMBER(mux_0_r); DECLARE_WRITE8_MEMBER(mux_w); + DECLARE_WRITE8_MEMBER(soundlatch_w); + + DECLARE_READ8_MEMBER(soundlatch1_r); + DECLARE_READ8_MEMBER(soundlatch2_r); + DECLARE_WRITE8_MEMBER(sound_flags_w); + DECLARE_CUSTOM_INPUT_MEMBER(sound_status_r); DECLARE_READ8_MEMBER(lastbank_rom_bank_r); DECLARE_WRITE8_MEMBER(lastbank_rom_bank_w); @@ -180,11 +193,45 @@ READ8_MEMBER(lastbank_state::mux_0_r) return res; } +WRITE8_MEMBER(lastbank_state::output_w) +{ + //logerror("%s: Writing %02x to A80%x\n", machine().describe_context(), data, offset); +} + WRITE8_MEMBER(lastbank_state::mux_w) { m_mux_data = data; } +WRITE8_MEMBER(lastbank_state::soundlatch_w) +{ + m_soundlatch[offset] = data; +} + +READ8_MEMBER(lastbank_state::soundlatch1_r) +{ + return m_soundlatch[0]; +} + +READ8_MEMBER(lastbank_state::soundlatch2_r) +{ + return m_soundlatch[1]; +} + +WRITE8_MEMBER(lastbank_state::sound_flags_w) +{ + m_sound_flags = data; + if (!BIT(data, 4)) + m_essnd->reset(); + if (!BIT(data, 5)) + m_oki->reset(); +} + +CUSTOM_INPUT_MEMBER(lastbank_state::sound_status_r) +{ + return BIT(m_sound_flags, 0) << 1 | BIT(m_sound_flags, 1); +} + static ADDRESS_MAP_START( tc0091lvc_map, AS_PROGRAM, 8, lastbank_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x7fff) AM_READ(lastbank_rom_r) @@ -205,15 +252,13 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( lastbank_map, AS_PROGRAM, 8, lastbank_state ) AM_IMPORT_FROM( tc0091lvc_map ) - AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xa800, 0xa800) AM_READ_PORT("COINS") AM_WRITENOP - AM_RANGE(0xa801, 0xa801) AM_WRITENOP - AM_RANGE(0xa802, 0xa802) AM_WRITENOP + AM_RANGE(0xa000, 0xa7ff) AM_RAM + AM_RANGE(0xa800, 0xa800) AM_READ_PORT("COINS") + AM_RANGE(0xa800, 0xa802) AM_WRITE(output_w) AM_RANGE(0xa803, 0xa803) AM_WRITE(mux_w) // mux for $a808 / $a80c - AM_RANGE(0xa804, 0xa804) AM_READ_PORT("VBLANK") - AM_RANGE(0xa805, 0xa805) AM_WRITENOP - AM_RANGE(0xa806, 0xa806) AM_WRITENOP - AM_RANGE(0xa807, 0xa807) AM_WRITENOP + AM_RANGE(0xa804, 0xa804) AM_READ_PORT("SPECIAL") + AM_RANGE(0xa805, 0xa806) AM_WRITE(soundlatch_w) + AM_RANGE(0xa807, 0xa807) AM_WRITENOP // hopper? AM_RANGE(0xa808, 0xa808) AM_READ(mux_0_r) AM_RANGE(0xa80c, 0xa80c) AM_READ(mux_0_r) AM_RANGE(0xa81c, 0xa81c) AM_READ_PORT("DSW0") @@ -225,11 +270,15 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( lastbank_audio_map, AS_PROGRAM, 8, lastbank_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("share1") + AM_RANGE(0xe000, 0xe7ff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( lastbank_audio_io, AS_IO, 8, lastbank_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x06) AM_DEVREADWRITE("essnd", es8712_device, read, write) + AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) + AM_RANGE(0x80, 0x80) AM_READ(soundlatch1_r) AM_WRITE(sound_flags_w) + AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch2_r) ADDRESS_MAP_END static INPUT_PORTS_START( lastbank ) @@ -243,7 +292,7 @@ static INPUT_PORTS_START( lastbank ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) PORT_CODE(KEYCODE_N) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_START("VBLANK") + PORT_START("SPECIAL") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Reset") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Service") PORT_DIPNAME( 0x04, 0x04, "Hopper Count" ) @@ -252,8 +301,8 @@ static INPUT_PORTS_START( lastbank ) PORT_DIPNAME( 0x08, 0x08, "Hopper Empty" ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN ) // bit 6 is a status of some sort - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, lastbank_state, sound_status_r, nullptr) PORT_START("P1_KEY0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("1P 5-6") PORT_CODE(KEYCODE_V) @@ -300,106 +349,116 @@ static INPUT_PORTS_START( lastbank ) PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("DSW0") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:7") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW3:1,2,3,4") + PORT_DIPSETTING( 0x07, "1 Coin /100 Credits" ) + PORT_DIPSETTING( 0x08, "1 Coin /50 Credits" ) + PORT_DIPSETTING( 0x09, "1 Coin /25 Credits" ) + PORT_DIPSETTING( 0x0a, "1 Coin /20 Credits" ) + PORT_DIPSETTING( 0x0b, "1 Coin /10 Credits" ) + PORT_DIPSETTING( 0x0c, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x01, "5 Coins /2 Credits" ) + PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 2C_3C ) ) + PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" ) + PORT_DIPNAME( 0xf0, 0xf0, "Coin C" ) PORT_DIPLOCATION("DSW3:5,6,7,8") + PORT_DIPSETTING( 0x70, "1 Coin /100 Credits" ) + PORT_DIPSETTING( 0x80, "1 Coin /50 Credits" ) + PORT_DIPSETTING( 0x90, "1 Coin /25 Credits" ) + PORT_DIPSETTING( 0xa0, "1 Coin /20 Credits" ) + PORT_DIPSETTING( 0xb0, "1 Coin /10 Credits" ) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x10, "5 Coins /2 Credits" ) + PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x50, DEF_STR( 2C_3C ) ) + PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x30, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" ) PORT_START("DSW3") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW4:4,5,6") + PORT_DIPSETTING( 0x30, "1 Coin /50 Credits" ) + PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x28, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 6C_1C ) ) + PORT_DIPSETTING( 0x08, "9 Coins /1 Credit" ) + PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -461,7 +520,7 @@ static MACHINE_CONFIG_START( lastbank, lastbank_state ) MCFG_CPU_ADD("audiocpu",Z80,MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(lastbank_audio_map) MCFG_CPU_IO_MAP(lastbank_audio_io) - MCFG_CPU_PERIODIC_INT_DRIVER(lastbank_state, nmi_line_pulse, 60) + // yes, we have no interrupts MCFG_QUANTUM_PERFECT_CPU("maincpu") @@ -488,7 +547,12 @@ static MACHINE_CONFIG_START( lastbank, lastbank_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - // es8712 + + MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_ES8712_ADD("essnd", 12000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END /*************************************************************************** @@ -508,9 +572,11 @@ ROM_START( lastbank ) ROM_LOAD( "u11", 0x000000, 0x100000, CRC(2588d82d) SHA1(426f6821862d54123e53410e2776586ddf6b21e7) ) ROM_LOAD( "5.u10", 0x100000, 0x020000, CRC(51f3c5a7) SHA1(73d4c8817fe96d75be32c43e816e93c52b5d2b27) ) - ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */ + ROM_REGION( 0x40000, "oki", 0 ) ROM_LOAD( "6.u55", 0x00000, 0x40000, CRC(9e78e234) SHA1(031f93e4bc338d0257fa673da7ce656bb1cda5fb) ) - ROM_LOAD( "7.u60", 0x40000, 0x80000, CRC(41be7146) SHA1(00f1c0d5809efccf888e27518a2a5876c4b633d8) ) + + ROM_REGION( 0x80000, "essnd", 0 ) /* Samples */ + ROM_LOAD( "7.u60", 0x00000, 0x80000, CRC(41be7146) SHA1(00f1c0d5809efccf888e27518a2a5876c4b633d8) ) ROM_END -GAME( 1994, lastbank, 0, lastbank, lastbank, driver_device, 0, ROT0, "Excellent System", "Last Bank (v1.16)", MACHINE_NO_SOUND ) +GAME( 1994, lastbank, 0, lastbank, lastbank, driver_device, 0, ROT0, "Excellent System", "Last Bank (v1.16)", 0 ) diff --git a/src/mame/drivers/lwriter.cpp b/src/mame/drivers/lwriter.cpp index 7cf46040af8..03da909522a 100644 --- a/src/mame/drivers/lwriter.cpp +++ b/src/mame/drivers/lwriter.cpp @@ -1,23 +1,54 @@ // license:BSD-3-Clause -// copyright-holders:Joakim Larsson Edstrom +// copyright-holders:Joakim Larsson Edstrom, Jonathan Gevaryahu /****************************************************************************** Apple LaserWriter II NT driver + 0x000000 - 0x1fffff SRAM/ROM (switches based on overlay) + 0x200000 - 0x3fffff ROM + 0x400000 - 0x5fffff RAM + 0x600000 - 0x7fffff ??? more RAM? + 0x800000 - 0x9fffff LED/Printer Controls(MSB), FIFO to print mechanism(LSB) + 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Read + 0xc00000 - 0xdfffff Zilog 8530 SCC (Serial Control Chip) Write + 0xe00000 - 0xefffff Rockwell 6522 VIA + 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here) + 0xfffff0 - 0xffffff ???Auto Vector?? + TODO: - - Figure out what VIA pins is connected to switch on front that selects LocalTalk - - Let the board identify itself to a emulated mac driver so it displays the printer icon on the desktop + - Get the board to pass its self test, it fails long before it even bothers reading the dipswitches + - Hook up the rest of the VIA pins to a canon printer HLE stub + - Hook up ADB bitbang device to the VIA CB1, CB2 and PortA pins + - Hook up VIA Port A, bits 5 and 6 to the SW1 and SW2 panel switches - Everything else + DONE: + - Hook up SCC and VIA interrupt pins to the 68k + Future: + - Let the board identify itself to a emulated mac driver so it displays the printer icon on the desktop + + Self Test LEDs at 0x800000-800001 most significant nybble: + 0x8 - <Passes> cpu check? (displayed before the overlay is disabled) + 0xF - <Passes> 200000-3fffff ROM checksum + 0xE - <Passes> 400000-400007 Low half of DRAM individual bit tests (walking ones and zeroes) + 0xD - <Passes> 5ffff8-5fffff High half of DRAM individual bit tests (walking ones and zeroes) + 0xC - <Passes> 400000-5fffff comprehensive DRAM data test + 0xB - <Passes?> Unknown test + 0xA - <Passes> dies if 600000-7fffff doesn't mirror 400000-5fffff ? + 0x8 - <Passes> SRAM test 000000-000FFF (2e3616-2e3654) + 0x0 - <runs off into weeds> not sure... (2e2fd0... 2db764 is the end of the 'clear ram 41d53f down to 400000' loop...) + + If one of the self tests fails, the uppermost bit will oscillate (c000 4000 c000 4000 etc) forever ******************************************************************************/ /* * Hardware: 68000@11.16 MHz 8530 SCC - 6523 TPI or 6522 VIA on newer pcb:s + 65C22 VIA on newer pcbs (older pcbs might have a 6523/6525 TPI but the pinout is completely different?) 2MB DRAM 2KB SRAM - custom 335-0022 EEPROM + X2804 EEPROM (custom marked as 335-0022) [note that technically a 2808 or 2816 can go here and will work too] 1MB ROM + MMI67L401 64x4 FIFO, x2 +------------------------------------------------------------------------------------------------------------------------+=====+ | 1 2 3 4 5 6 7 8 9 10 11 | # @@ -79,9 +110,21 @@ public: , m_maincpu(*this, "maincpu") , m_scc(*this, "scc") , m_via(*this, "via") + , m_overlay(1) { } - DECLARE_READ16_MEMBER (bootvect_r); - DECLARE_WRITE16_MEMBER (bootvect_w); + DECLARE_READ16_MEMBER(bankedarea_r); + DECLARE_WRITE16_MEMBER(bankedarea_w); + DECLARE_WRITE8_MEMBER(led_out_w); + DECLARE_WRITE8_MEMBER(fifo_out_w); + DECLARE_READ8_MEMBER(via_pa_r); + DECLARE_WRITE8_MEMBER(via_pa_w); + DECLARE_WRITE_LINE_MEMBER(via_ca2_w); + DECLARE_READ8_MEMBER(via_pb_r); + DECLARE_WRITE8_MEMBER(via_pb_w); + DECLARE_WRITE_LINE_MEMBER(via_cb1_w); + DECLARE_WRITE_LINE_MEMBER(via_cb2_w); + DECLARE_WRITE_LINE_MEMBER(via_int_w); + //DECLARE_WRITE_LINE_MEMBER(scc_int); virtual void machine_start () override; virtual void machine_reset () override; private: @@ -95,32 +138,89 @@ private: required_device<via6522_device> m_via; #endif - // Pointer to System ROMs needed by bootvect_r and masking RAM buffer for post reset accesses - uint16_t *m_sysrom; - uint16_t m_sysram[2]; + uint16_t *m_dram_ptr, *m_sram_ptr, *m_rom_ptr; + bool m_overlay; }; +/* +Address maps (x = ignored; * = selects address within this range) +68k address map: +a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS) +* * * PAL16R6 U80 +* * * * * * decoded by pals +Overlay ON: +0 0 0 * * * * * * * * * * * * * * * * * * * * * R ROM +0 0 0 0 0 0 * * * * * * * * * * * * * * * * * * R ROMEN1 +0 0 0 0 0 1 * * * * * * * * * * * * * * * * * * R ROMEN2 +0 0 0 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3 +0 0 0 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4 +0 0 0 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS +Overlay OFF: +0 0 0 ? ? ?0? x x x x x x * * * * * * * * * * * * RW SRAM +Unknown: +? ? ? ? ? ? x x x x x x (*) (*) * * * * * * * * * 1 RW 2804 EEPROM + (technically a10 and a11 are ignored, but if a 2808 or 2816 is put in this spot the address lines do connect to the appropriate pins) +Common: +0 0 1 * * * * * * * * * * * * * * * * * * * * * R ROM +0 0 1 0 0 0 * * * * * * * * * * * * * * * * * * R ROMEN1 +0 0 1 0 0 1 * * * * * * * * * * * * * * * * * * R ROMEN2 +0 0 1 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3 +0 0 1 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4 +0 0 1 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS +0 1 0 * * * * * * * * * * * * * * * * * * * * * RW DRAM +0 1 1 * * * * * * * * * * * * * * * * * * * * * RW ???? DRAM mirror? +1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 0 W 64x8 FIFO +1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 1 W Status LEDs and mech +1 0 1 ? ? ? x x x x x x x x x x x x x x x * * 1 R 8530 SCC Read +1 1 0 ? ? ? x x x x x x x x x x x x x x x * * 0 W 8530 SCC Write +1 1 1 ?x? ?0? ? x x x x x x x x x x x x x * * * * 0 RW 65C22 VIA +1 1 1 ?x? ?1? ? x x x x x x x x x x x x x * * * * 0 RW debugger rom/pod area + | | | | | +map when overlay is set: +000000-1fffff ROM (second half is open bus) +map when overlay is clear: +000000-03ffff SRAM(?) +040000-1fffff ???? +200000-3fffff ROM (second half is open bus) +400000-5fffff DRAM +600000-7fffff DRAM mirror +800000-83ffff LEDs and status bits to printer mechanism, FIFO +840000-9fffff unknown +a00000-a3ffff SCC read +a40000-bfffff unknown +c00000-c3ffff SCC write +c40000-dfffff unknown +e00000-e3ffff VIA +e40000-f7ffff unknown +f80000-fbffff debug area (first read must be 0xAAAA5555, then 68k will jump to address of second read) +fc0000-ffffff unknown + +The ADB bit-bang transceiver MCU connects to the VIA CB1 (adbclk) and CB2 (adbdata) pins, +as well as PA0 (ST1), PA2 (ST2) and PA3 (ADB /INT) +*/ + static ADDRESS_MAP_START (maincpu_map, AS_PROGRAM, 16, lwriter_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x00000007) AM_ROM AM_READ(bootvect_r) /* ROM mirror just during reset */ - AM_RANGE(0x00000000, 0x00000007) AM_RAM AM_WRITE(bootvect_w) /* After first write we act as RAM */ - AM_RANGE(0x00000008, 0x001fffff) AM_RAM /* 2 Mb DRAM */ - AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_REGION("roms", 0) - - AM_RANGE(0x00c00000, 0x00c00001) AM_DEVWRITE8("scc", scc8530_device, ca_w, 0x00ff) - AM_RANGE(0x00c00004, 0x00c00005) AM_DEVWRITE8("scc", scc8530_device, da_w, 0x00ff) - AM_RANGE(0x00a00000, 0x00a00001) AM_DEVREAD8 ("scc", scc8530_device, ca_r, 0xff00) - AM_RANGE(0x00a00004, 0x00a00005) AM_DEVREAD8 ("scc", scc8530_device, da_r, 0xff00) + AM_RANGE(0x000000, 0x1fffff) AM_READWRITE(bankedarea_r, bankedarea_w) + AM_RANGE(0x200000, 0x2fffff) AM_ROM AM_REGION("rom", 0) // 1MB ROM + //AM_RANGE(0x300000, 0x3fffff) // open bus? + AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_REGION("dram", 0) AM_MIRROR(0x200000) // 2MB DRAM + AM_RANGE(0x800000, 0x800001) AM_WRITE8(led_out_w, 0xff00) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23 + AM_RANGE(0x800000, 0x800001) AM_WRITE8(fifo_out_w, 0x00ff) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23 + AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE8("scc", scc8530_device, ca_w, 0x00ff) AM_MIRROR(0x1ffff8) + AM_RANGE(0xc00004, 0xc00005) AM_DEVWRITE8("scc", scc8530_device, da_w, 0x00ff) AM_MIRROR(0x1ffff8) + AM_RANGE(0xa00000, 0xa00001) AM_DEVREAD8 ("scc", scc8530_device, ca_r, 0xff00) AM_MIRROR(0x1ffff8) + AM_RANGE(0xa00004, 0xa00005) AM_DEVREAD8 ("scc", scc8530_device, da_r, 0xff00) AM_MIRROR(0x1ffff8) - AM_RANGE(0x00c00002, 0x00c00003) AM_DEVWRITE8("scc", scc8530_device, cb_w, 0x00ff) - AM_RANGE(0x00c00006, 0x00c00007) AM_DEVWRITE8("scc", scc8530_device, db_w, 0x00ff) - AM_RANGE(0x00a00002, 0x00a00003) AM_DEVREAD8 ("scc", scc8530_device, cb_r, 0xff00) - AM_RANGE(0x00a00006, 0x00a00007) AM_DEVREAD8 ("scc", scc8530_device, db_r, 0xff00) + AM_RANGE(0xc00002, 0xc00003) AM_DEVWRITE8("scc", scc8530_device, cb_w, 0x00ff) AM_MIRROR(0x1ffff8) + AM_RANGE(0xc00006, 0xc00007) AM_DEVWRITE8("scc", scc8530_device, db_w, 0x00ff) AM_MIRROR(0x1ffff8) + AM_RANGE(0xa00002, 0xa00003) AM_DEVREAD8 ("scc", scc8530_device, cb_r, 0xff00) AM_MIRROR(0x1ffff8) + AM_RANGE(0xa00006, 0xa00007) AM_DEVREAD8 ("scc", scc8530_device, db_r, 0xff00) AM_MIRROR(0x1ffff8) #if TPI - AM_RANGE(0x00e00010, 0x00e0001f) AM_DEVREADWRITE8 ("tpi", tpi6523_device, read, write, 0x00ff) // Used on older boards, needs proper mapping + AM_RANGE(0xe00010, 0xe0001f) AM_DEVREADWRITE8 ("tpi", tpi6523_device, read, write, 0x00ff) AM_MIRROR(0x17ffe0) // Used on older boards, needs proper mapping #else - AM_RANGE(0x00e00000, 0x00e0001f) AM_DEVREADWRITE8 ("via", via6522_device, read, write, 0x00ff) + AM_RANGE(0xe00000, 0xe0001f) AM_DEVREADWRITE8 ("via", via6522_device, read, write, 0x00ff) AM_MIRROR(0x17ffe0) #endif ADDRESS_MAP_END @@ -130,28 +230,122 @@ INPUT_PORTS_END /* Start it up */ void lwriter_state::machine_start() { - /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ - m_sysrom = (uint16_t*)(memregion ("roms")->base ()); + m_rom_ptr = (uint16_t*)memregion("rom")->base(); + m_dram_ptr = (uint16_t*)memregion("dram")->base(); + m_sram_ptr = (uint16_t*)memregion("sram")->base(); + // do stuff here later on like setting up printer mechanisms HLE timers etc +} + +void lwriter_state::machine_reset() +{ + /* Reset the VIA */ + m_via->reset(); +} + +/* Overlay area */ +READ16_MEMBER(lwriter_state::bankedarea_r) +{ + if (m_overlay) + { + return m_rom_ptr[offset]; + } + else if (offset <= 0x01ffff) + { + if ((offset > 0x7ff) && !space.debugger_access()) { logerror("Attempt to read banked area (with overlay off) past end of SRAM from offset %08X!\n",offset<<1); } + return m_sram_ptr[offset&0x7FF]; + } + if(!space.debugger_access()) { logerror("Attempt to read banked area (with overlay off) past end of SRAM from offset %08X! Returning 0xFFFF!\n",offset<<1); } + return 0xFFFF; +} + +WRITE16_MEMBER(lwriter_state::bankedarea_w) +{ + if (m_overlay) + { + if(!space.debugger_access()) { logerror("Attempt to write banked area (with overlay ON) with data %04X to offset %08X IGNORED!\n",data, offset<<1); } + return; + } + else if (offset <= 0x01ffff) + { + if ((offset > 0x7ff) && !space.debugger_access()) { logerror("Attempt to write banked area (with overlay off) with data %04X to offset %08X!\n",data, offset<<1); } + COMBINE_DATA(&m_sram_ptr[offset&0x7FF]); + return; + } + if(!space.debugger_access()) { logerror("Attempt to write banked area (with overlay off) with data %04X to offset %08X IGNORED!\n", data, offset<<1); } +} + +/* 4 diagnostic LEDs, plus 4 i/o lines for the printer */ +WRITE8_MEMBER(lwriter_state::led_out_w) +{ + //popmessage("LED status: %02X\n", data&0xFF); + logerror("LED status: %02X\n", data&0xFF); + popmessage("LED status: %x %x %x %x %x %x %x %x\n", data&0x80, data&0x40, data&0x20, data&0x10, data&0x8, data&0x4, data&0x2, data&0x1); +} + +/* FIFO to printer, 64 bytes long */ +WRITE8_MEMBER(lwriter_state::fifo_out_w) +{ + /** TODO: actually emulate this */ + logerror("FIFO written with: %02X\n", data&0xFF); +} + +/* via stuff */ +READ8_MEMBER(lwriter_state::via_pa_r) +{ + logerror(" VIA: Port A read!\n"); + return 0xFF; +} + +WRITE8_MEMBER(lwriter_state::via_pa_w) +{ + logerror(" VIA: Port A written with data of 0x%02x!\n", data); +} + +WRITE_LINE_MEMBER(lwriter_state::via_ca2_w) +{ + logerror(" VIA: CA2 written with %d!\n", state); } -void lwriter_state::machine_reset () +READ8_MEMBER(lwriter_state::via_pb_r) { - /* Reset pointer to bootvector in ROM for bootvector handler bootvect_r */ - if (m_sysrom == &m_sysram[0]) /* Condition needed because memory map is not setup first time */ - m_sysrom = (uint16_t*)(memregion ("roms")->base ()); + logerror(" VIA: Port B read!\n"); + return 0xFF; } -/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xff800000 to 0x0 at reset*/ -READ16_MEMBER (lwriter_state::bootvect_r){ - return m_sysrom[offset]; +WRITE8_MEMBER(lwriter_state::via_pb_w) +{ + logerror(" VIA: Port B written with data of 0x%02x!\n", data); + /* Like early Mac models which had VIA A4 control overlaying, the + * LaserWriter II NT overlay is controlled by VIA B3 */ + m_overlay = BIT(data,3); } -WRITE16_MEMBER (lwriter_state::bootvect_w){ - m_sysram[offset % sizeof(m_sysram)] &= ~mem_mask; - m_sysram[offset % sizeof(m_sysram)] |= (data & mem_mask); - m_sysrom = &m_sysram[0]; // redirect all upcomming accesses to masking RAM until reset. +WRITE_LINE_MEMBER (lwriter_state::via_cb1_w) +{ + logerror(" VIA: CB1 written with %d!\n", state); } +WRITE_LINE_MEMBER(lwriter_state::via_cb2_w) +{ + logerror(" VIA: CB2 written with %d!\n", state); +} + +WRITE_LINE_MEMBER(lwriter_state::via_int_w) +{ + logerror(" VIA: INT output set to %d!\n", state); + //TODO: this is likely wrong, the VPA pin which controls whether autovector is enabled or not is controlled by PAL U8D, which is not dumped. + m_maincpu->set_input_line_and_vector(M68K_IRQ_1, (state ? ASSERT_LINE : CLEAR_LINE), M68K_INT_ACK_AUTOVECTOR); +} + +/* scc stuff */ +/* +WRITE_LINE_MEMBER(lwriter_state::scc_int) +{ + logerror(" SCC: INT output set to %d!\n", state); + //m_via->set_input_line(VIA_CA1, state ? ASSERT_LINE : CLEAR_LINE); + m_via->write_ca1(state); +}*/ + #define CPU_CLK (XTAL_22_3210MHz / 2) // Based on pictures form here: http://picclick.co.uk/Apple-Postscript-LaserWriter-IINT-Printer-640-4105-M6009-Mainboard-282160713108.html#&gid=1&pid=7 #define RXC_CLK ((CPU_CLK - (87 * 16 * 70)) / 3) // Tuned to get 9600 baud according to manual, needs rework based on real hardware @@ -167,6 +361,9 @@ static MACHINE_CONFIG_START( lwriter, lwriter_state ) MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) MCFG_Z80SCC_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) MCFG_Z80SCC_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) + /* Interrupt */ + MCFG_Z80SCC_OUT_INT_CB(DEVWRITELINE("via", via6522_device, write_ca1)) + //MCFG_Z80SCC_OUT_INT_CB(WRITELINE(lwriter_state, scc_int)) MCFG_RS232_PORT_ADD ("rs232a", default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w)) @@ -180,6 +377,14 @@ static MACHINE_CONFIG_START( lwriter, lwriter_state ) MCFG_DEVICE_ADD("tpi", TPI6525, 0) #else MCFG_DEVICE_ADD("via", VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(lwriter_state, via_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(lwriter_state, via_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(lwriter_state, via_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(lwriter_state, via_pb_w)) + MCFG_VIA6522_CB1_HANDLER(WRITELINE(lwriter_state, via_cb1_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(lwriter_state, via_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(lwriter_state, via_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(lwriter_state, via_int_w)) #endif MACHINE_CONFIG_END @@ -214,17 +419,20 @@ MACHINE_CONFIG_END * - last three loops */ + ROM_START(lwriter) - ROM_REGION16_BE (0x1000000, "roms", 0) - - ROM_LOAD16_BYTE ("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec)) - ROM_LOAD16_BYTE ("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d)) - ROM_LOAD16_BYTE ("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe)) - ROM_LOAD16_BYTE ("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462)) - ROM_LOAD16_BYTE ("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698)) - ROM_LOAD16_BYTE ("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31)) - ROM_LOAD16_BYTE ("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9)) - ROM_LOAD16_BYTE ("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa)) + ROM_REGION16_BE( 0x200000, "rom", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec)) // Label: "342-0545-A JAPAN // TC531000CP-F700 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L0 + ROM_LOAD16_BYTE("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d)) // Label: "342-0546-A JAPAN // TC531000CP-F701 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H0 + ROM_LOAD16_BYTE("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe)) // Label: "342-0547-A JAPAN // TC531000CP-F702 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L1 + ROM_LOAD16_BYTE("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462)) // Label: "342-0548-A JAPAN // TC531000CP-F703 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H1 + ROM_LOAD16_BYTE("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698)) // Label: "342-0549-A JAPAN // TC531000CP-F704 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L2 + ROM_LOAD16_BYTE("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31)) // Label: "342-0550-A JAPAN // TC531000CP-F705 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H2 + ROM_LOAD16_BYTE("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9)) // Label: "342-0551-A JAPAN // TC531000CP-F706 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L3 + ROM_LOAD16_BYTE("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa)) // Label: "342-0552-A JAPAN // TC531000CP-F707 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H3 + ROM_REGION( 0x200000, "dram", ROMREGION_ERASEFF ) + ROM_REGION( 0x1000, "sram", ROMREGION_ERASEFF ) + ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT, COMPANY, FULLNAME, FLAGS */ diff --git a/src/mame/drivers/m6805evs.cpp b/src/mame/drivers/m6805evs.cpp index bec8b22e84b..f42260193ce 100644 --- a/src/mame/drivers/m6805evs.cpp +++ b/src/mame/drivers/m6805evs.cpp @@ -6,28 +6,63 @@ Motorola M68HC05EVS evaluation system Chips: Main board: XC68HC26P, R65C52P2, MS62256l-70PC, MS6264L-70PC, eprom. Xtal = 3.6864MHz -Emulator board: MC68C705P9CP, undumped 28-pin prom. Xtal = 4MHz +Emulator board: MC68HC705P9CP, undumped 28-pin prom. Xtal = 4MHz R65C52 = Dual ACIA with inbuilt baud rate divider, uses 8 addresses, uses the 3.6864MHz crystal XC68HC26P = PPI (3 ports), uses 8 addresses. 2014-01-12 Skeleton driver -The rom is larger than the available address space, but not all of it is programmed. The code -ranges are 800-18FF,1FF0-1FFF. There must be a banking scheme in use. +Memory map: +0000, 0000 PORTA Port A data register +0001, 0001 PORTB Port B data register +0002, 0002 PORTC Port C data register +0003, 0003 PORTD Port D data register +0004, 0004 DDRA Data direction register A +0005, 0005 DDRB Data direction register B +0006, 0006 DDRC Data direction register C +0007, 0007 DDRD Data direction register D +0008, 0009 unimplemented +000A, 000A SCR SIOP control register +000B, 000B SSR SIOP status register +0009, 0009 SDR SIOP data register +000D, 0011 unimplemented +0012, 0012 TCR Timer control register +0013, 0013 TDR Timer data register +0014, 0014 ICRH Input capture register high +0015, 0015 ICRL Input capture register low +0016, 0016 OCRH Output compare register high +0017, 0017 OCRL Output compare register low +0018, 0018 TRH Timer register high +0019, 0019 TRL Timer register low +001A, 001A ATRH Alternate timer register high +001B, 001B ATRL Alternate timer register low +001C, 001C EPROG EPROM programming register +001D, 001D ADDR ADC data register +001E, 001E ADSCR ADC status/control register +001F, 001F reserved +0020, 004F Page zero user EPROM +0050, 007F unimplemented +0080, 00FF RAM +0100, 08FF User EPROM +0900, 0900 MOR Mask option register +0901, 1EFF unimplemented +1F00, 1FEF Bootloader ROM +1FF1, 1FF7 reserved +1FF8, 1FF9 Timer interrupt vector +1FFA, 1FFB External interrupt vector +1FFC, 1FFD Software interrupt vector +1FFE, 1FFF Reset vector -Memory map guess -000-07F Stack (and user ram?) -080-0FF RAM (or devices?) -100-FFF ROM ToDo: +- Add CMOS family support to M6085 CPU core (different timings, different peripherals) - Everything ******************************************************************************************************/ #include "emu.h" -#include "cpu/m6805/m68705.h" +#include "cpu/m6805/m6805.h" class m6805evs_state : public driver_device @@ -45,10 +80,15 @@ private: static ADDRESS_MAP_START( m6805evs_mem, AS_PROGRAM, 8, m6805evs_state ) - AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x07ff) AM_ROM AM_REGION("roms", 0x1100) - AM_RANGE(0x0800, 0x0fef) AM_ROM AM_REGION("roms", 0x0800) - AM_RANGE(0x0ff0, 0x0fff) AM_ROM AM_REGION("roms", 0x1ff0) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + ADDRESS_MAP_UNMAP_HIGH + + // AM_RANGE(0x0000, 0x001f) I/O registers live here + AM_RANGE(0x0020, 0x004f) AM_ROM AM_REGION("eprom", 0x0020) + AM_RANGE(0x0080, 0x00ff) AM_RAM + AM_RANGE(0x0100, 0x0900) AM_ROM AM_REGION("eprom", 0x0100) + // AM_RANGE(0x1f00, 0x1fef) bootloader ROM lives here + AM_RANGE(0x1ff8, 0x1fff) AM_ROM AM_REGION("eprom", 0x1ff0) ADDRESS_MAP_END static INPUT_PORTS_START( m6805evs ) @@ -60,12 +100,12 @@ void m6805evs_state::machine_reset() static MACHINE_CONFIG_START( m6805evs, m6805evs_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68705, XTAL_4MHz) + MCFG_CPU_ADD("maincpu", M6805, XTAL_4MHz) MCFG_CPU_PROGRAM_MAP(m6805evs_mem) MACHINE_CONFIG_END ROM_START(m6805evs) - ROM_REGION(0x2000, "roms", 0) + ROM_REGION(0x2000, "eprom", 0) ROM_LOAD( "evsbug12.bin", 0x0000, 0x2000, CRC(8b581aef) SHA1(eacf425cc8a042085ccc4097cc61570b633b1e38) ) ROM_END diff --git a/src/mame/drivers/marineb.cpp b/src/mame/drivers/marineb.cpp index d01ce880e39..f6b2133a475 100644 --- a/src/mame/drivers/marineb.cpp +++ b/src/mame/drivers/marineb.cpp @@ -94,8 +94,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( wanted_io_map, AS_IO, 8, marineb_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay1", ay8910_device, address_data_w) - AM_RANGE(0x02, 0x03) AM_DEVWRITE("ay2", ay8910_device, address_data_w) + AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay1", ay8912_device, address_data_w) + AM_RANGE(0x02, 0x03) AM_DEVWRITE("ay2", ay8912_device, address_data_w) ADDRESS_MAP_END @@ -605,11 +605,11 @@ static MACHINE_CONFIG_DERIVED( wanted, marineb ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(marineb_state, screen_update_springer) - /* sound hardware */ - MCFG_SOUND_REPLACE("ay1", AY8910, 1500000) + // sound hardware (PSG type verified only for bcruzm12) + MCFG_SOUND_REPLACE("ay1", AY8912, 1500000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay2", AY8910, 1500000) + MCFG_SOUND_ADD("ay2", AY8912, 1500000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -807,6 +807,9 @@ All roms type 2764 Both proms type MB7052 (compatible to 82s129) RAM: 1 x 8416, 1 x AM9122, 2 x D2125, 4 x M5L2114 +The topmost row is entirely unpopulated. This includes a space (at 19D) for +a MC68705P3. + PCB Layout: NECD780C D-84_4 D-84_5 D-84_6 D-84_7 @@ -833,8 +836,8 @@ ROM_START( bcruzm12 ) ROM_LOAD( "d-84_4.17ef", 0x2000, 0x2000, CRC(fe186459) SHA1(3b0ee1fe98c835271f5b67de5ca0507827e25d71) ) ROM_REGION( 0x4000, "gfx2", 0 ) - ROM_LOAD( "d-84_7.17h", 0x0000, 0x2000, CRC(a5be90ef) SHA1(6037d924296ba62999aafe665396fef142d73df2) ) - ROM_LOAD( "d-84_6.17fh", 0x2000, 0x2000, CRC(1337dc01) SHA1(c55bfc6dd15a499dd71da0acc5016035a7c51f16) ) + ROM_LOAD( "d-84_6.17fh", 0x0000, 0x2000, CRC(1337dc01) SHA1(c55bfc6dd15a499dd71da0acc5016035a7c51f16) ) + ROM_LOAD( "d-84_7.17h", 0x2000, 0x2000, CRC(a5be90ef) SHA1(6037d924296ba62999aafe665396fef142d73df2) ) ROM_REGION( 0x0200, "proms", 0 ) ROM_LOAD( "bcm12col.7k", 0x0000, 0x0100, CRC(bf4f2671) SHA1(dde6da568ecf0121910f4b507c83fe6230b07c8d) ) /* palette low 4 bits */ diff --git a/src/mame/drivers/maxaflex.cpp b/src/mame/drivers/maxaflex.cpp index a5760a9e949..aa86318b42c 100644 --- a/src/mame/drivers/maxaflex.cpp +++ b/src/mame/drivers/maxaflex.cpp @@ -13,12 +13,16 @@ ******************************************************************************/ #include "emu.h" +#include "includes/atari400.h" + #include "cpu/m6502/m6502.h" #include "cpu/m6805/m68705.h" -#include "includes/atari400.h" + +#include "machine/6821pia.h" + #include "sound/speaker.h" #include "sound/pokey.h" -#include "machine/6821pia.h" + #include "video/gtia.h" #include "maxaflex.lh" @@ -28,54 +32,37 @@ class maxaflex_state : public atari_common_state { public: maxaflex_state(const machine_config &mconfig, device_type type, const char *tag) - : atari_common_state(mconfig, type, tag), - m_mcu(*this, "mcu"), - m_speaker(*this, "speaker"), - m_region_maincpu(*this, "maincpu"), - m_dsw(*this, "dsw"), - m_coin(*this, "coin"), - m_console(*this, "console"), - m_joy01(*this, "djoy_0_1"), - m_joy23(*this, "djoy_2_3") - { } - - uint8_t m_portA_in; - uint8_t m_portA_out; - uint8_t m_ddrA; - uint8_t m_portB_in; + : atari_common_state(mconfig, type, tag) + , m_mcu(*this, "mcu") + , m_speaker(*this, "speaker") + , m_region_maincpu(*this, "maincpu") + , m_dsw(*this, "dsw") + , m_coin(*this, "coin") + , m_console(*this, "console") + , m_joy01(*this, "djoy_0_1") + , m_joy23(*this, "djoy_2_3") + { + } + uint8_t m_portB_out; - uint8_t m_ddrB; - uint8_t m_portC_in; uint8_t m_portC_out; - uint8_t m_ddrC; - uint8_t m_tdr; - uint8_t m_tcr; - timer_device *m_mcu_timer; - void mmu(uint8_t new_mmu); DECLARE_READ8_MEMBER(mcu_portA_r); DECLARE_WRITE8_MEMBER(mcu_portA_w); - DECLARE_READ8_MEMBER(mcu_portB_r); DECLARE_WRITE8_MEMBER(mcu_portB_w); - DECLARE_READ8_MEMBER(mcu_portC_r); DECLARE_WRITE8_MEMBER(mcu_portC_w); - DECLARE_READ8_MEMBER(mcu_ddr_r); - DECLARE_WRITE8_MEMBER(mcu_portA_ddr_w); - DECLARE_WRITE8_MEMBER(mcu_portB_ddr_w); - DECLARE_WRITE8_MEMBER(mcu_portC_ddr_w); - DECLARE_READ8_MEMBER(mcu_tdr_r); - DECLARE_WRITE8_MEMBER(mcu_tdr_w); - DECLARE_READ8_MEMBER(mcu_tcr_r); - DECLARE_WRITE8_MEMBER(mcu_tcr_w); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); DECLARE_READ8_MEMBER(pia_pa_r); DECLARE_READ8_MEMBER(pia_pb_r); WRITE8_MEMBER(pia_pb_w) { mmu(data); } WRITE_LINE_MEMBER(pia_cb2_w) { } // This is used by Floppy drive on Atari 8bits Home Computers TIMER_DEVICE_CALLBACK_MEMBER(mf_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc); - int atari_input_disabled(); + +protected: virtual void machine_reset() override; - //required_device<cpu_device> m_maincpu; // maincpu is already contained in atari_common_state + + bool atari_input_disabled() const { return !BIT(m_portB_out, 7); } + void mmu(uint8_t new_mmu); + required_device<cpu_device> m_mcu; required_device<speaker_sound_device> m_speaker; required_region_ptr<uint8_t> m_region_maincpu; @@ -120,14 +107,16 @@ void maxaflex_state::mmu(uint8_t new_mmu) READ8_MEMBER(maxaflex_state::mcu_portA_r) { - m_portA_in = m_dsw->read() | (m_coin->read() << 4) | (m_console->read() << 5); - return (m_portA_in & ~m_ddrA) | (m_portA_out & m_ddrA); + return + ((m_dsw->read() << 0) & 0x0f) | + ((m_coin->read() << 4) & 0x10) | + ((m_console->read() << 5) & 0x20) | + 0xc0; } WRITE8_MEMBER(maxaflex_state::mcu_portA_w) { - m_portA_out = data; - m_speaker->level_w(data >> 7); + m_speaker->level_w(BIT(data, 7)); } /* Port B: @@ -141,34 +130,29 @@ WRITE8_MEMBER(maxaflex_state::mcu_portA_w) 7 (out) TOFF - enables/disables user controls */ -READ8_MEMBER(maxaflex_state::mcu_portB_r) -{ - return (m_portB_in & ~m_ddrB) | (m_portB_out & m_ddrB); -} - WRITE8_MEMBER(maxaflex_state::mcu_portB_w) { - uint8_t diff = data ^ m_portB_out; + const uint8_t diff = data ^ m_portB_out; m_portB_out = data; /* clear coin interrupt */ - if (data & 0x04) - m_mcu->set_input_line(M6805_IRQ_LINE, CLEAR_LINE ); - - /* AUDMUTE */ - machine().sound().system_enable((data >> 5) & 1); + if (BIT(data, 2)) + m_mcu->set_input_line(M6805_IRQ_LINE, CLEAR_LINE); /* RES600 */ - if (diff & 0x10) - m_maincpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); + if (BIT(diff, 4)) + m_maincpu->set_input_line(INPUT_LINE_RESET, BIT(data, 4) ? CLEAR_LINE : ASSERT_LINE); + + /* AUDMUTE */ + machine().sound().system_enable(BIT(data, 5)); /* latch for lamps */ - if ((diff & 0x40) && !(data & 0x40)) + if (BIT(diff, 6) && !BIT(data, 6)) { - output().set_lamp_value(0, (m_portC_out >> 0) & 1); - output().set_lamp_value(1, (m_portC_out >> 1) & 1); - output().set_lamp_value(2, (m_portC_out >> 2) & 1); - output().set_lamp_value(3, (m_portC_out >> 3) & 1); + output().set_lamp_value(0, BIT(m_portC_out, 0)); + output().set_lamp_value(1, BIT(m_portC_out, 1)); + output().set_lamp_value(2, BIT(m_portC_out, 2)); + output().set_lamp_value(3, BIT(m_portC_out, 3)); } } @@ -178,117 +162,28 @@ WRITE8_MEMBER(maxaflex_state::mcu_portB_w) 2 (out) lamp START 3 (out) lamp OVER */ -READ8_MEMBER(maxaflex_state::mcu_portC_r) -{ - return (m_portC_in & ~m_ddrC) | (m_portC_out & m_ddrC); -} - WRITE8_MEMBER(maxaflex_state::mcu_portC_w) { /* uses a 7447A, which is equivalent to an LS47/48 */ - static const uint8_t ls48_map[16] = - { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 }; + constexpr static uint8_t ls48_map[16] = + { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x69, 0x78, 0x00 }; m_portC_out = data & 0x0f; /* displays */ - switch( m_portB_out & 0x3 ) + switch (m_portB_out & 0x03) { - case 0x0: output().set_digit_value(0, ls48_map[m_portC_out]); break; - case 0x1: output().set_digit_value(1, ls48_map[m_portC_out]); break; - case 0x2: output().set_digit_value(2, ls48_map[m_portC_out]); break; - case 0x3: break; - } -} - -READ8_MEMBER(maxaflex_state::mcu_ddr_r) -{ - return 0xff; -} - -WRITE8_MEMBER(maxaflex_state::mcu_portA_ddr_w) -{ - m_ddrA = data; -} - -WRITE8_MEMBER(maxaflex_state::mcu_portB_ddr_w) -{ - m_ddrB = data; -} - -WRITE8_MEMBER(maxaflex_state::mcu_portC_ddr_w) -{ - m_ddrC = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(maxaflex_state::mcu_timer_proc) -{ - if ( --m_tdr == 0x00 ) - { - if ( (m_tcr & 0x40) == 0 ) - { - //timer interrupt! - generic_pulse_irq_line(*m_mcu, M68705_INT_TIMER, 1); - } - } -} - -/* Timer Data Reg */ -READ8_MEMBER(maxaflex_state::mcu_tdr_r) -{ - return m_tdr; -} - -WRITE8_MEMBER(maxaflex_state::mcu_tdr_w) -{ - m_tdr = data; -} - -/* Timer control reg */ -READ8_MEMBER(maxaflex_state::mcu_tcr_r) -{ - return m_tcr & ~0x08; -} - -WRITE8_MEMBER(maxaflex_state::mcu_tcr_w) -{ - m_tcr = data; - if ( (m_tcr & 0x40) == 0 ) - { - int divider; - attotime period; - - if ( !(m_tcr & 0x20) ) - { - /* internal clock / 4*/ - divider = 4; - } - else - { - /* external clock */ - divider = 1; - } - - if ( m_tcr & 0x07 ) - { - /* use prescaler */ - divider = divider * (1 << (m_tcr & 0x7)); - } - - period = attotime::from_hz(3579545) * divider; - m_mcu_timer->adjust(period, 0, period); + case 0x0: output().set_digit_value(0, ls48_map[m_portC_out]); break; + case 0x1: output().set_digit_value(1, ls48_map[m_portC_out]); break; + case 0x2: output().set_digit_value(2, ls48_map[m_portC_out]); break; + case 0x3: break; } } INPUT_CHANGED_MEMBER(maxaflex_state::coin_inserted) { if (!newval) - m_mcu->set_input_line(M6805_IRQ_LINE, HOLD_LINE ); -} - -int maxaflex_state::atari_input_disabled() -{ - return (m_portB_out & 0x80) == 0x00; + m_mcu->set_input_line(M6805_IRQ_LINE, ASSERT_LINE); } @@ -307,20 +202,6 @@ static ADDRESS_MAP_START(a600xl_mem, AS_PROGRAM, 8, maxaflex_state ) AM_RANGE(0xd800, 0xffff) AM_ROM /* OS */ ADDRESS_MAP_END -static ADDRESS_MAP_START( mcu_mem, AS_PROGRAM, 8, maxaflex_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0000) AM_READ(mcu_portA_r) AM_WRITE(mcu_portA_w) - AM_RANGE(0x0001, 0x0001) AM_READ(mcu_portB_r) AM_WRITE(mcu_portB_w) - AM_RANGE(0x0002, 0x0002) AM_READ(mcu_portC_r) AM_WRITE(mcu_portC_w) - AM_RANGE(0x0004, 0x0004) AM_READ(mcu_ddr_r) AM_WRITE(mcu_portA_ddr_w) - AM_RANGE(0x0005, 0x0005) AM_READ(mcu_ddr_r) AM_WRITE(mcu_portB_ddr_w) - AM_RANGE(0x0006, 0x0006) AM_READ(mcu_ddr_r) AM_WRITE(mcu_portC_ddr_w) - AM_RANGE(0x0008, 0x0008) AM_READ(mcu_tdr_r) AM_WRITE(mcu_tdr_w) - AM_RANGE(0x0009, 0x0009) AM_READ(mcu_tcr_r) AM_WRITE(mcu_tcr_w) - AM_RANGE(0x0010, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x07ff) AM_ROM -ADDRESS_MAP_END - static INPUT_PORTS_START( a600xl ) @@ -363,7 +244,7 @@ static INPUT_PORTS_START( a600xl ) /* Max-A-Flex specific ports */ PORT_START("coin") - PORT_BIT(0x1, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, maxaflex_state,coin_inserted, 0) + PORT_BIT(0x1, IP_ACTIVE_LOW, IPT_COIN1) PORT_CHANGED_MEMBER(DEVICE_SELF, maxaflex_state, coin_inserted, 0) PORT_START("dsw") PORT_DIPNAME(0xf, 0x9, "Coin/Time" ) @@ -404,11 +285,8 @@ void maxaflex_state::machine_reset() pokey->write(15,0); // Supervisor board reset - m_portA_in = m_portA_out = m_ddrA = 0; - m_portB_in = m_portB_out = m_ddrB = 0; - m_portC_in = m_portC_out = m_ddrC = 0; - m_tdr = m_tcr = 0; - m_mcu_timer = machine().device<timer_device>("mcu_timer"); + m_portB_out = 0xff; + m_portC_out = 0xff; output().set_lamp_value(0, 0); output().set_lamp_value(1, 0); @@ -430,8 +308,11 @@ static MACHINE_CONFIG_START( maxaflex, maxaflex_state ) MCFG_CPU_PROGRAM_MAP(a600xl_mem) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", maxaflex_state, mf_interrupt, "screen", 0, 1) - MCFG_CPU_ADD("mcu", M68705, 3579545) - MCFG_CPU_PROGRAM_MAP(mcu_mem) + MCFG_CPU_ADD("mcu", M68705P3, 3579545) + MCFG_M68705_PORTA_R_CB(READ8(maxaflex_state, mcu_portA_r)) + MCFG_M68705_PORTA_W_CB(WRITE8(maxaflex_state, mcu_portA_w)) + MCFG_M68705_PORTB_W_CB(WRITE8(maxaflex_state, mcu_portB_w)) + MCFG_M68705_PORTC_W_CB(WRITE8(maxaflex_state, mcu_portC_w)) MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0) MCFG_GTIA_READ_CB(IOPORT("console")) @@ -445,8 +326,6 @@ static MACHINE_CONFIG_START( maxaflex, maxaflex_state ) MCFG_PIA_WRITEPB_HANDLER(WRITE8(maxaflex_state, pia_pb_w)) MCFG_PIA_CB2_HANDLER(WRITELINE(maxaflex_state, pia_cb2_w)) - MCFG_TIMER_DRIVER_ADD("mcu_timer", maxaflex_state, mcu_timer_proc) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) @@ -536,7 +415,7 @@ ROM_END GAME( 1984, maxaflex, 0, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy", "Max-A-Flex", MACHINE_IS_BIOS_ROOT ) -GAME( 1982, mf_achas, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Astro Chase (Max-A-Flex)", 0 ) -GAME( 1983, mf_brist, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Bristles (Max-A-Flex)", 0 ) -GAME( 1983, mf_flip, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Flip & Flop (Max-A-Flex)", 0 ) +GAME( 1982, mf_achas, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Astro Chase (Max-A-Flex)", 0 ) +GAME( 1983, mf_brist, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Bristles (Max-A-Flex)", 0 ) +GAME( 1983, mf_flip, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Flip & Flop (Max-A-Flex)", 0 ) GAME( 1984, mf_bdash, maxaflex, maxaflex, a600xl, driver_device, 0, ROT0, "Exidy / First Star Software", "Boulder Dash (Max-A-Flex)", 0 ) diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp index 94f2b2985d4..0c4f68a93a0 100644 --- a/src/mame/drivers/metro.cpp +++ b/src/mame/drivers/metro.cpp @@ -94,7 +94,34 @@ Notes: - Sprite zoom in Mouja at the end of a match looks wrong, but it's been verified to be the same on the original board - vmetal: has Sega and Taito logos in the roms ?! +- vmetal: Many samples in the ADPCM ROM are actually not used. + Snd Offset Writes Sample Range + 0000 0004 0002 0006 000a 0008 000c + -- ---------------------------------- ------------- + 00 006e 0001 00ab 003c 0002 003a 003a 01ab6e-023a3c + 01 003d 0002 003a 001d 0002 007e 007e 023a3d-027e1d + 02 00e2 0003 0005 002e 0003 00f3 00f3 0305e2-03f32e + 03 000a 0005 001e 00f6 0005 00ec 00ec 051e0a-05ecf6 + 04 00f7 0005 00ec 008d 0006 0060 0060 05ecf7-06608d + 05 0016 0008 002e 0014 0009 0019 0019 082e16-091914 + 06 0015 0009 0019 0094 000b 0015 0015 091915-0b1594 + 07 0010 000d 0012 00bf 000d 0035 0035 0d1210-0d35bf + 08 00ce 000e 002f 0074 000f 0032 0032 0e2fce-0f3274 + 09 0000 0000 0000 003a 0000 007d 007d 000000-007d3a + 0a 0077 0000 00fa 008d 0001 00b6 00b6 00fa77-01b68d + 0b 008e 0001 00b6 00b3 0002 0021 0021 01b68e-0221b3 + 0c 0062 0002 00f7 0038 0003 00de 00de 02f762-03de38 + 0d 00b9 0005 00ab 00ef 0006 0016 0016 05abb9-0616ef + 0e 00dd 0007 0058 00db 0008 001a 001a 0758dd-081adb + 0f 00dc 0008 001a 002e 0008 008a 008a 081adc-088a2e + 10 00db 0009 00d7 00ff 000a 0046 0046 09d7db-0a46ff + 11 0077 000c 0003 006d 000c 0080 0080 0c0377-0c806d + 12 006e 000c 0080 006c 000d 0002 0002 0c806e-0d026c + 13 006d 000d 0002 002b 000d 0041 0041 0d026d-0d412b + 14 002c 000d 0041 002a 000d 00be 00be 0d412c-0dbe2a + 15 002b 000d 00be 0029 000e 0083 0083 0dbe2b-0e8329 + 16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee driver modified by Hau ***************************************************************************/ @@ -1897,40 +1924,9 @@ WRITE8_MEMBER(metro_state::vmetal_control_w) logerror("%s: Writing unknown bits %04x to $200000\n",machine().describe_context(),data); } -WRITE8_MEMBER(metro_state::vmetal_es8712_w) +WRITE8_MEMBER(metro_state::vmetal_se_control_w) { - /* Many samples in the ADPCM ROM are actually not used. - - Snd Offset Writes Sample Range - 0000 0004 0002 0006 000a 0008 000c - -- ---------------------------------- ------------- - 00 006e 0001 00ab 003c 0002 003a 003a 01ab6e-023a3c - 01 003d 0002 003a 001d 0002 007e 007e 023a3d-027e1d - 02 00e2 0003 0005 002e 0003 00f3 00f3 0305e2-03f32e - 03 000a 0005 001e 00f6 0005 00ec 00ec 051e0a-05ecf6 - 04 00f7 0005 00ec 008d 0006 0060 0060 05ecf7-06608d - 05 0016 0008 002e 0014 0009 0019 0019 082e16-091914 - 06 0015 0009 0019 0094 000b 0015 0015 091915-0b1594 - 07 0010 000d 0012 00bf 000d 0035 0035 0d1210-0d35bf - 08 00ce 000e 002f 0074 000f 0032 0032 0e2fce-0f3274 - 09 0000 0000 0000 003a 0000 007d 007d 000000-007d3a - 0a 0077 0000 00fa 008d 0001 00b6 00b6 00fa77-01b68d - 0b 008e 0001 00b6 00b3 0002 0021 0021 01b68e-0221b3 - 0c 0062 0002 00f7 0038 0003 00de 00de 02f762-03de38 - 0d 00b9 0005 00ab 00ef 0006 0016 0016 05abb9-0616ef - 0e 00dd 0007 0058 00db 0008 001a 001a 0758dd-081adb - 0f 00dc 0008 001a 002e 0008 008a 008a 081adc-088a2e - 10 00db 0009 00d7 00ff 000a 0046 0046 09d7db-0a46ff - 11 0077 000c 0003 006d 000c 0080 0080 0c0377-0c806d - 12 006e 000c 0080 006c 000d 0002 0002 0c806e-0d026c - 13 006d 000d 0002 002b 000d 0041 0041 0d026d-0d412b - 14 002c 000d 0041 002a 000d 00be 00be 0d412c-0dbe2a - 15 002b 000d 00be 0029 000e 0083 0083 0dbe2b-0e8329 - 16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee - */ - - m_essnd->es8712_w(space, offset, data); - logerror("%s: Writing %04x to ES8712 offset %02x\n", machine().describe_context(), data, offset); + logerror("%s: Writing %02x to $500000\n", machine().describe_context(), data); } static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state ) @@ -1958,7 +1954,8 @@ static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state ) AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r) // DSW x 3 AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff ) AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff) - AM_RANGE(0x500000, 0x50000d) AM_WRITE8(vmetal_es8712_w, 0x00ff) + AM_RANGE(0x500000, 0x500001) AM_WRITE8(vmetal_se_control_w, 0xff00) + AM_RANGE(0x500000, 0x50000d) AM_DEVWRITE8("essnd", es8712_device, write, 0x00ff) AM_RANGE(0xf00000, 0xf0ffff) AM_RAM AM_MIRROR(0x0f0000) // RAM (mirrored) ADDRESS_MAP_END diff --git a/src/mame/drivers/micro20.cpp b/src/mame/drivers/micro20.cpp index 8365956a3c5..8f4f9b7f7f5 100644 --- a/src/mame/drivers/micro20.cpp +++ b/src/mame/drivers/micro20.cpp @@ -55,7 +55,7 @@ public: DECLARE_WRITE_LINE_MEMBER(h4_w); DECLARE_WRITE8_MEMBER(portb_w); DECLARE_WRITE8_MEMBER(portc_w); - + DECLARE_WRITE_LINE_MEMBER(timerirq_w) { m_maincpu->set_input_line(M68K_IRQ_4, state); diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index 038ecbeba7f..be32aecb1a1 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -481,7 +481,7 @@ WRITE16_MEMBER( microvision_state::tms1100_write_r ) } -static const uint16_t microvision_output_pla_0[0x20] = +static const u16 microvision_output_pla_0[0x20] = { /* O output PLA configuration currently unknown */ 0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E, @@ -491,7 +491,7 @@ static const uint16_t microvision_output_pla_0[0x20] = }; -static const uint16_t microvision_output_pla_1[0x20] = +static const u16 microvision_output_pla_1[0x20] = { /* O output PLA configuration currently unknown */ /* Reversed bit order */ diff --git a/src/mame/drivers/miniforce.cpp b/src/mame/drivers/miniforce.cpp index 7b9d2a50274..141276284a8 100644 --- a/src/mame/drivers/miniforce.cpp +++ b/src/mame/drivers/miniforce.cpp @@ -97,6 +97,7 @@ */ #include "emu.h" #include "bus/vme/vme.h" +#include "bus/vme/vme_fccpu20.h" #include "bus/vme/vme_fcisio.h" #include "bus/vme/vme_fcscsi.h" #include "machine/clock.h" @@ -138,11 +139,11 @@ miniforce_state(const machine_config &mconfig, device_type type, const char *tag static ADDRESS_MAP_START (miniforce_mem, AS_PROGRAM, 32, miniforce_state) ADDRESS_MAP_UNMAP_HIGH /* The ROMs contains an OS9 bootloader. It is position independent but reset vector suggests that it sits flat on adress 0 (zero) */ -// AM_RANGE (0x000000, 0x003fff) AM_ROM AM_REGION("roms", 0x000000) /* System EPROM Area 16Kb OS9 DEBUG - not verified */ -// AM_RANGE (0x004000, 0x01ffff) AM_ROM AM_REGION("roms", 0x004000)/* System EPROM Area 112Kb for System ROM - not verified */ -// AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */ -// AM_RANGE (0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ -// AM_RANGE (0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ +// AM_RANGE (0x000000, 0x003fff) AM_ROM AM_REGION("roms", 0x000000) /* System EPROM Area 16Kb OS9 DEBUG - not verified */ +// AM_RANGE (0x004000, 0x01ffff) AM_ROM AM_REGION("roms", 0x004000)/* System EPROM Area 112Kb for System ROM - not verified */ +// AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */ +// AM_RANGE (0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ +// AM_RANGE (0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ ADDRESS_MAP_END #endif @@ -163,17 +164,18 @@ static INPUT_PORTS_START (miniforce) INPUT_PORTS_END static SLOT_INTERFACE_START(miniforce_vme_cards) + SLOT_INTERFACE("fccpu20", VME_FCCPU20) SLOT_INTERFACE("fcisio", VME_FCISIO1) SLOT_INTERFACE("fcscsi", VME_FCSCSI1) -SLOT_INTERFACE_END +SLOT_INTERFACE_END /* * Machine configuration */ MACHINE_CONFIG_START (miniforce, miniforce_state) -// MCFG_CPU_PROGRAM_MAP (miniforce_mem) +// MCFG_CPU_PROGRAM_MAP (miniforce_mem) MCFG_VME_DEVICE_ADD("vme") - MCFG_VME_SLOT_ADD ("vme", "slot1", miniforce_vme_cards, nullptr) + MCFG_VME_SLOT_ADD ("vme", "slot1", miniforce_vme_cards, "fccpu20") MCFG_VME_SLOT_ADD ("vme", "slot2", miniforce_vme_cards, nullptr) MCFG_VME_SLOT_ADD ("vme", "slot3", miniforce_vme_cards, nullptr) MCFG_VME_SLOT_ADD ("vme", "slot4", miniforce_vme_cards, nullptr) diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index b0268101d15..64abc50e377 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -353,7 +353,7 @@ Super Missile Attack Board Layout #include "cpu/m6502/m6502.h" #include "machine/watchdog.h" #include "sound/pokey.h" - +#include "sound/ay8910.h" class missile_state : public driver_device { @@ -379,7 +379,7 @@ public: required_device<m6502_device> m_maincpu; required_shared_ptr<uint8_t> m_videoram; required_device<watchdog_timer_device> m_watchdog; - required_device<pokey_device> m_pokey; + optional_device<pokey_device> m_pokey; required_ioport m_in0; required_ioport m_in1; required_ioport m_r10; @@ -402,6 +402,8 @@ public: DECLARE_WRITE8_MEMBER(missile_w); DECLARE_READ8_MEMBER(missile_r); + DECLARE_WRITE8_MEMBER(bootleg_w); + DECLARE_READ8_MEMBER(bootleg_r); DECLARE_CUSTOM_INPUT_MEMBER(get_vblank); DECLARE_DRIVER_INIT(missilem); DECLARE_DRIVER_INIT(suprmatk); @@ -705,8 +707,6 @@ uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind1 WRITE8_MEMBER(missile_state::missile_w) { - uint8_t *videoram = m_videoram; - /* if this is a MADSEL cycle, write to video RAM */ if (get_madsel()) { @@ -719,12 +719,13 @@ WRITE8_MEMBER(missile_state::missile_w) /* RAM */ if (offset < 0x4000) - videoram[offset] = data; + m_videoram[offset] = data; /* POKEY */ else if (offset < 0x4800) { - m_pokey->write(m_maincpu->space(), offset, data, 0xff); + if (m_pokey.found()) + m_pokey->write(space, offset, data, 0xff); } /* OUT0 */ @@ -738,7 +739,7 @@ WRITE8_MEMBER(missile_state::missile_w) output().set_led_value(0, ~data & 0x02); m_ctrld = data & 1; } - + /* color RAM */ else if (offset >= 0x4b00 && offset < 0x4c00) m_palette->set_pen_color(offset & 7, pal1bit(~data >> 3), pal1bit(~data >> 2), pal1bit(~data >> 1)); @@ -765,7 +766,6 @@ WRITE8_MEMBER(missile_state::missile_w) READ8_MEMBER(missile_state::missile_r) { - uint8_t *videoram = m_videoram; uint8_t result = 0xff; /* if this is a MADSEL cycle, read from video RAM */ @@ -777,7 +777,7 @@ READ8_MEMBER(missile_state::missile_r) /* RAM */ if (offset < 0x4000) - result = videoram[offset]; + result = m_videoram[offset]; /* ROM */ else if (offset >= 0x5000) @@ -785,7 +785,10 @@ READ8_MEMBER(missile_state::missile_r) /* POKEY */ else if (offset < 0x4800) - result = m_pokey->read(m_maincpu->space(), offset & 0x0f, 0xff); + { + if (m_pokey.found()) + result = m_pokey->read(space, offset & 0x0f, 0xff); + } /* IN0 */ else if (offset < 0x4900) @@ -822,6 +825,112 @@ READ8_MEMBER(missile_state::missile_r) } +WRITE8_MEMBER(missile_state::bootleg_w) +{ + /* if this is a MADSEL cycle, write to video RAM */ + if (get_madsel()) + { + write_vram(space, offset, data); + return; + } + + /* otherwise, strip A15 and handle manually */ + offset &= 0x7fff; + + /* RAM */ + if (offset < 0x4000) + m_videoram[offset] = data; + + /* OUT0 */ + else if (offset >= 0x4800 && offset < 0x4900) + { + m_flipscreen = ~data & 0x40; + machine().bookkeeping().coin_counter_w(0, data & 0x20); + machine().bookkeeping().coin_counter_w(1, data & 0x10); + machine().bookkeeping().coin_counter_w(2, data & 0x08); + output().set_led_value(1, ~data & 0x04); + output().set_led_value(0, ~data & 0x02); + m_ctrld = data & 1; + } + + /* watchdog */ + else if (offset >= 0x4900 && offset < 0x4a00) + m_watchdog->watchdog_reset(); + + /* color RAM */ + else if (offset >= 0x4b00 && offset < 0x4c00) + m_palette->set_pen_color(offset & 7, pal1bit(~data >> 3), pal1bit(~data >> 2), pal1bit(~data >> 1)); + + /* interrupt ack */ + else if (offset >= 0x4d00 && offset < 0x4e00) + { + if (m_irq_state) + { + m_maincpu->set_input_line(0, CLEAR_LINE); + m_irq_state = 0; + } + } + + /* anything else */ + else + logerror("%04X:Unknown write to %04X = %02X\n", space.device().safe_pc(), offset, data); +} + + +READ8_MEMBER(missile_state::bootleg_r) +{ + uint8_t result = 0xff; + + /* if this is a MADSEL cycle, read from video RAM */ + if (get_madsel()) + return read_vram(space, offset); + + /* otherwise, strip A15 and handle manually */ + offset &= 0x7fff; + + /* RAM */ + if (offset < 0x4000) + result = m_videoram[offset]; + + /* ROM */ + else if (offset >= 0x5000) + result = m_mainrom[offset]; + + /* IN0 */ + else if (offset >= 0x4800 && offset < 0x4900) // doesn't seem ok + { + if (m_ctrld) /* trackball */ + { + if (!m_flipscreen) + result = ((m_track0_y->read() << 4) & 0xf0) | (m_track0_x->read() & 0x0f); + else + result = ((m_track1_y->read() << 4) & 0xf0) | (m_track1_x->read() & 0x0f); + } + else /* buttons */ + result = m_in0->read(); + } + + /* IN1 */ + else if (offset >= 0x4900 && offset < 0x4a00) // seems ok + result = m_in1->read(); + + /* IN2 */ + else if (offset >= 0x4b00 && offset < 0x4c00) // seems ok + result = m_r10->read(); + + + /* anything else */ + else + logerror("%04X:Unknown read from %04X\n", space.device().safe_pc(), offset); + + + /* update the MADSEL state */ + if (!m_irq_state && ((result & 0x1f) == 0x01) && m_maincpu->get_sync()) + m_madsel_lastcycles = m_maincpu->total_cycles(); + + return result; +} + /************************************* * @@ -834,7 +943,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, missile_state ) AM_RANGE(0x0000, 0xffff) AM_READWRITE(missile_r, missile_w) AM_SHARE("videoram") ADDRESS_MAP_END - +/* adjusted from the above to get the bootlegs to boot */ +static ADDRESS_MAP_START( bootleg_main_map, AS_PROGRAM, 8, missile_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(bootleg_r, bootleg_w) AM_SHARE("videoram") +ADDRESS_MAP_END /************************************* * @@ -924,6 +1036,14 @@ static INPUT_PORTS_START( missile ) INPUT_PORTS_END +static INPUT_PORTS_START( missileb ) + + PORT_INCLUDE(missile) + + PORT_MODIFY("IN1") + PORT_SERVICE( 0x40, IP_ACTIVE_HIGH ) +INPUT_PORTS_END + static INPUT_PORTS_START( suprmatk ) PORT_START("IN0") /* IN0 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL @@ -1039,6 +1159,20 @@ static MACHINE_CONFIG_START( missile, missile_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( missilea, missile ) + + MCFG_DEVICE_REMOVE("pokey") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( missileb, missilea ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bootleg_main_map) + + MCFG_SOUND_ADD("ay8912", AY8912, MASTER_CLOCK/8) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + +MACHINE_CONFIG_END /************************************* @@ -1088,7 +1222,6 @@ ROM_START( missile1 ) ROM_LOAD( "035826-01.l6", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) ) ROM_END - ROM_START( suprmatk ) ROM_REGION( 0x9000, "maincpu", 0 ) /* ROM's located on the enhancement board */ ROM_LOAD( "035820-02.c1", 0x5000, 0x0800, CRC(7a62ce6a) SHA1(9a39978138dc28fdefe193bfae1b226391e471db) ) @@ -1200,7 +1333,47 @@ ROM_START( mcombats ) /* bootleg (Sidam) @ $ */ ROM_LOAD( "mmi6331.6f", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) ) ROM_END +/* +CPUs +QTY Type clock position function +1x 6502 2B 8-bit Microprocessor - main +1x LM380 12B Audio Amplifier - sound +1x oscillator 10.000 6C + +ROMs +QTY Type position status +2x F2708 10C, 10E dumped +6x MCM2716C 1-6 dumped +1x DM74S288N 6L dumped + +RAMs +QTY Type position +8x TMS4116 4F,4H,4J,4K,4L,4M,4N,4P +1x 74S189N 7L + +Others + +1x 22x2 edge connector +1x trimmer (volume)(12E) +2x 8x2 switches DIP(8R,10R) +*/ +ROM_START( missilea ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "1.1h", 0x5000, 0x0800, CRC(49d66ca1) SHA1(59e20a048ac76aff5843dc8253fe61cdb65f94fb) ) + ROM_LOAD( "2.1j", 0x5800, 0x0800, CRC(8008918d) SHA1(a72ce8997ba66c0f51d94e4f2cb3cf2734612ac9) ) + ROM_LOAD( "3.1k", 0x6000, 0x0800, CRC(b87c02f7) SHA1(748fa3aa2e7314407ded0d6c0fc24f9015c66c28) ) + ROM_LOAD( "4.1l", 0x6800, 0x0800, CRC(33bc6f47) SHA1(5753fbfbcd65a4863f877cd3a07400bd61ffb8ce) ) + ROM_LOAD( "5.1n", 0x7000, 0x0800, CRC(df8c58f4) SHA1(44a0cdb0e5222e14e3e91547c35e73b2cf2df174) ) + ROM_LOAD( "6.1r", 0x7800, 0x0800, CRC(96a21c1f) SHA1(6e43ce8d53aa6d38cef920e7fa2e0683ce42cdb4) ) + + ROM_REGION( 0x800, "unknown", 0 ) + ROM_LOAD( "2708.10c", 0x0000, 0x0400, CRC(9f6978c4) SHA1(34b356fddd86b8b73ee1415b3ad6b00dc4be60e2) ) + ROM_LOAD( "2708.10e", 0x0400, 0x0400, CRC(90eb28c8) SHA1(c82bc0a00d9e54004b0210f95343c8d7dc1f2050) ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "dm74s288n.6l", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) ) +ROM_END /************************************* @@ -1316,8 +1489,11 @@ GAME( 1980, missile1, missile, missile, missile, driver_device, 0, ROT0, GAME( 1981, suprmatk, missile, missile, suprmatk, missile_state, suprmatk, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (for rev 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, suprmatkd,missile, missile, suprmatk, driver_device, 0, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (not encrypted)", MACHINE_SUPPORTS_SAVE ) -/* the bootlegs are on different hardware and don't work */ -GAME( 1980, mcombat, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 1)", MACHINE_NOT_WORKING ) -GAME( 1980, mcombata, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 2)", MACHINE_NOT_WORKING ) -GAME( 1980, mcombats, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Sidam)", "Missile Combat (Sidam bootleg)", MACHINE_NOT_WORKING ) -GAME( 2005, missilem, missile, missile, missile, missile_state, missilem, ROT0, "hack (Braze Technologies)", "Missile Command Multigame", MACHINE_NOT_WORKING ) +/* the following bootleg has extremely similar program ROMs to missile1, but has different unknown sound hardware and 2 more ROMs */ +GAME( 1981, missilea, missile, missilea, missile, driver_device, 0, ROT0, "bootleg (Ugames)", "Missile Attack", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) + +/* the following bootlegs are on different hardware and don't work */ +GAME( 1980, mcombat, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 1)", MACHINE_NOT_WORKING ) +GAME( 1980, mcombata, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 2)", MACHINE_NOT_WORKING ) +GAME( 1980, mcombats, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Sidam)", "Missile Combat (Sidam bootleg)", MACHINE_NOT_WORKING ) +GAME( 2005, missilem, missile, missilea, missileb, missile_state, missilem, ROT0, "hack (Braze Technologies)", "Missile Command Multigame", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mmodular.cpp b/src/mame/drivers/mmodular.cpp index 15450bad8a8..0c9a576d708 100644 --- a/src/mame/drivers/mmodular.cpp +++ b/src/mame/drivers/mmodular.cpp @@ -27,10 +27,6 @@ Academy 65C02 4.9152mhz Monte Carlo IV, Mega IV and any others not listed above have correct ROM/RAM and maybe LCD, not much else for now - Novag boards: (should go in different .c eventually) - Super Forte and Super Expert are the same, except one is touch board, other is magnetic. - The Diablo 68000 is Super Expert board but 68K based - Notes by Cowering (2011) TODO: add Bavaria sensor support (unknown1,2,3 handlers in current driver) @@ -105,8 +101,6 @@ static uint8_t montecivtopnew = 0, montecivbotnew = 0; //Mephisto Mega IV latch uint8_t latch2400 = 0; -uint8_t diablo68_3c0000 = 0; - INPUT_PORTS_EXTERN( chessboard ); @@ -133,10 +127,6 @@ public: DECLARE_WRITE8_MEMBER(write_polgar_IO); DECLARE_WRITE8_MEMBER(write_LCD_polgar); DECLARE_WRITE8_MEMBER(write_LCD_academy); -// DECLARE_WRITE16_MEMBER(diablo68_aciawrite); -// DECLARE_READ16_MEMBER(diablo68_aciaread); - DECLARE_WRITE16_MEMBER(diablo68_reg_select); - DECLARE_WRITE16_MEMBER(diablo68_write_LCD); DECLARE_WRITE8_MEMBER(milano_write_LED); DECLARE_WRITE8_MEMBER(megaiv_write_LED); DECLARE_WRITE8_MEMBER(academy_write_LED); @@ -178,7 +168,6 @@ public: DECLARE_MACHINE_START(van32); DECLARE_MACHINE_RESET(van16); DECLARE_MACHINE_RESET(monteciv); - DECLARE_MACHINE_START(diablo68); DECLARE_MACHINE_START(van16); DECLARE_MACHINE_RESET(academy); DECLARE_PALETTE_INIT(chess_lcd); @@ -266,60 +255,6 @@ WRITE8_MEMBER(polgar_state::write_LCD_academy) m_lcdc->write(space, offset & 1, data); } -// AM_RANGE( 0x3a0000,0x3a0000 ) AM_READ(diablo68_write_LCD) -// AM_RANGE( 0x3c0000,0x3c0000 ) AM_READ(diablo68_reg_select) - -/*WRITE16_MEMBER(polgar_state::diablo68_aciawrite) -{ -// device_t *acia = machine().device("acia65c51"); -// acia_6551_w(acia, offset & 0x03, data >> 8); -// printf("ACIA write data %04x offset %02x\n",data,offset); - logerror("ACIA write data %04x offset %02x\n",data,offset); -} - -READ16_MEMBER(polgar_state::diablo68_aciaread) -{ -// device_t *acia = machine().device("acia65c51"); - uint16_t result; -// result = acia_6551_r(acia, offset & 0x03); -// logerror("ACIA read offset %02x\n",offset); -// printf("ACIA read offset %02x\n",offset); - - result <<= 8; - - return result; -} -*/ - -WRITE16_MEMBER(polgar_state::diablo68_reg_select) -{ - diablo68_3c0000 = data >> 8; - //printf("3c0000 = %04x\n",data>>8); - logerror("3c0000 = %04x\n",data>>8); - -} - - -WRITE16_MEMBER(polgar_state::diablo68_write_LCD) -{ - data >>= 8; - if (!(diablo68_3c0000 & 0x02)) { - if (BIT(data,7)) { - if ((data & 0x7f) >= 0x40) data -= 56; // adjust for 16x1 display as 2 sets of 8 - } - m_lcdc->control_write(space, 0, data); -// logerror("Control %02x\n", data); -// printf("Control %02x\n", data); - } else { - m_lcdc->data_write(space, 0, data); -// printf("LCDdata %04x [%c]\n", data,data); -// logerror("LCDdata %04x [%c]\n", data,data); - } - - //logerror("LCD Status Data = %d\n",data); - -} - WRITE8_MEMBER(polgar_state::milano_write_LED) { uint8_t LED_offset = 100; @@ -923,11 +858,6 @@ MACHINE_START_MEMBER(polgar_state,polgar) common_chess_start(); } -MACHINE_START_MEMBER(polgar_state,diablo68) -{ - common_chess_start(); -} - MACHINE_START_MEMBER(polgar_state,van16) { } @@ -1166,19 +1096,6 @@ static ADDRESS_MAP_START(megaiv_mem , AS_PROGRAM, 8, polgar_state ) AM_RANGE( 0x8000, 0xffff ) AM_ROM ADDRESS_MAP_END -static ADDRESS_MAP_START(diablo68_mem , AS_PROGRAM, 16, polgar_state ) - AM_RANGE( 0x00000000, 0x0000ffff ) AM_ROM // OS -// AM_RANGE( 0x00200000, 0x0020ffff ) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE( 0x00ff0000, 0x00ff7fff ) AM_ROM AM_REGION("maincpu",10000) // Opening Book -// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciaread) -// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciawrite) -// AM_RANGE( 0x00300002, 0x00300003 ) AM_READ(diablo68_flags) - AM_RANGE( 0x003a0000, 0x003a0001 ) AM_WRITE(diablo68_write_LCD) - AM_RANGE( 0x003c0000, 0x003c0001 ) AM_WRITE(diablo68_reg_select) - AM_RANGE( 0x00280000, 0x0028ffff ) AM_RAM // hash tables - AM_RANGE( 0x00ff8000, 0x00ffffff ) AM_RAM -ADDRESS_MAP_END - /* Input ports */ @@ -1205,39 +1122,6 @@ static INPUT_PORTS_START( polgar ) INPUT_PORTS_END -static INPUT_PORTS_START( sfortea ) - PORT_START("BUTTONS_SFOR1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) - - PORT_START("BUTTONS_SFOR2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_F8) - -/* PORT_START("BUTTONS_SFOR3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) -*/ -INPUT_PORTS_END - static INPUT_PORTS_START( academy ) PORT_START("BUTTONS_ACAD") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) @@ -1457,22 +1341,6 @@ static MACHINE_CONFIG_DERIVED( megaiv, monteciv ) MCFG_CPU_PROGRAM_MAP(megaiv_mem) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( diablo68, polgar_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(diablo68_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,diablo68) - MCFG_FRAGMENT_ADD( chess_common ) - - /* acia */ -// MCFG_MOS6551_ADD("acia65c51", XTAL_1_8432MHz, nullptr) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq2, attotime::from_hz(60)) - MCFG_TIMER_START_DELAY(attotime::from_hz(30)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - -MACHINE_CONFIG_END - static MACHINE_CONFIG_START( van16, polgar_state ) MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) MCFG_CPU_PROGRAM_MAP(van16_mem) @@ -1589,13 +1457,6 @@ ROM_START(monteciv) ROM_END -ROM_START( diablo68 ) - ROM_REGION16_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE("evenurom.bin", 0x00000, 0x8000,CRC(03477746) SHA1(8bffcb159a61e59bfc45411e319aea6501ebe2f9)) - ROM_LOAD16_BYTE("oddlrom.bin", 0x00001, 0x8000,CRC(e182dbdd) SHA1(24dacbef2173fa737636e4729ff22ec1e6623ca5)) - ROM_LOAD16_BYTE("book.bin", 0x10000, 0x8000,CRC(553a5c8c) SHA1(ccb5460ff10766a5ca8008ae2cffcff794318108)) -ROM_END - ROM_START( van16 ) ROM_REGION16_BE( 0x40000, "maincpu", 0 ) ROM_LOAD16_BYTE("va16even.bin", 0x00000, 0x20000,CRC(E87602D5) SHA1(90CB2767B4AE9E1B265951EB2569B9956B9F7F44)) @@ -1655,7 +1516,6 @@ DRIVER_INIT_MEMBER(polgar_state,polgar) 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_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/model2.cpp b/src/mame/drivers/model2.cpp index 5be07f60c5d..39cae4f09b1 100644 --- a/src/mame/drivers/model2.cpp +++ b/src/mame/drivers/model2.cpp @@ -4830,7 +4830,7 @@ ROM_START( overrev ) /* Over Rev Revision A, Model 2C */ ROM_LOAD( "mpr-20004.34", 0x400000, 0x400000, CRC(0b9c5410) SHA1(e5bb30702fc853ccc03316be07a334269d3ebb4a) ) ROM_END -ROM_START( overrevb ) /* Over Rev Revision B, Model 2B, rom board stickered as 836-13275 */ +ROM_START( overrevb ) /* Over Rev Revision B, Model 2B, Sega Game ID# 836-13274, ROM board ID# 836-13275 */ ROM_REGION( 0x200000, "maincpu", 0 ) // i960 program ROM_LOAD32_WORD( "epr-19992b.15", 0x000000, 0x080000, CRC(6d3e78d5) SHA1(40d18ee284ea2e038f7e3d04db56e793ab3e3dd5) ) /* sum16 492A printed on label */ ROM_LOAD32_WORD( "epr-19993b.16", 0x000002, 0x080000, CRC(765dc9ce) SHA1(a718c32ca27ec1fb5ed2d7d3797ea7e906510a04) ) /* sum16 B955 printed on label */ diff --git a/src/mame/drivers/mquake.cpp b/src/mame/drivers/mquake.cpp index 4f6c20ce618..064e66bd19d 100644 --- a/src/mame/drivers/mquake.cpp +++ b/src/mame/drivers/mquake.cpp @@ -326,11 +326,13 @@ static MACHINE_CONFIG_START( mquake, mquake_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) MCFG_ES5503_ADD("es5503", amiga_state::CLK_7M_NTSC) /* ES5503 is likely mono due to channel strobe used as bank select */ MCFG_ES5503_OUTPUT_CHANNELS(1) diff --git a/src/mame/drivers/mvme147.cpp b/src/mame/drivers/mvme147.cpp index 9f3568104b2..b8ad2aa3e7b 100644 --- a/src/mame/drivers/mvme147.cpp +++ b/src/mame/drivers/mvme147.cpp @@ -385,19 +385,19 @@ READ8_MEMBER (mvme147_state::pcc8_r){ LOG("Call to %s[%04x] ", FUNCNAME, offset); switch(offset + P8BASE) { - case P8_TIMER1_INT_CNTL : LOG(" -> %02x - Timer 1 Interrupt Control - not implemented\n", ret); break; - case P8_TIMER1_CNTL : LOG(" -> %02x - Timer 1 Control - not implemented\n", ret); break; - case P8_TIMER2_INT_CNTL : LOG(" -> %02x - Timer 2 Interrupt Control - not implemented\n", ret); break; - case P8_TIMER2_CNTL : LOG(" -> %02x - Timer 2 Control - not implemented\n", ret); break; - case P8_ACFAIL_INT_CNTL : LOG(" -> %02x - AC Fail Interrupt Control Register - not implemented\n", ret); break; - case P8_WDOG_TIMER_CNTL : LOG(" -> %02x - Watchdog Timer Control Register - not implemented\n", ret); break; - case P8_PRINTER_INT_CNTL : LOG(" -> %02x - Printer Interrupt Control Register - not implemented\n", ret); break; - case P8_PRINTER_CNTL : LOG(" -> %02x - Printer Control Register - not implemented\n", ret); break; - case P8_DMA_INT_CNTL : LOG(" -> %02x - DMA Interrupt Control Register - not implemented\n", ret); break; - case P8_DMA_CNTL_STAT : LOG(" -> %02x - DMA Control and Status Register - not implemented\n", ret); break; - case P8_BUSERR_CNTL : LOG(" -> %02x - Bus Error Interrupt Control Register - not implemented\n", ret); break; - case P8_DMA_STATUS : LOG(" -> %02x - DMA Status Register - not implemented\n", ret); break; - case P8_ABORT_INT_CNTL : LOG(" -> %02x - Abort Interrupt Control Register - not fully implemented\n", ret); + case P8_TIMER1_INT_CNTL : LOG(" -> %02x - Timer 1 Interrupt Control - not implemented\n", ret); break; + case P8_TIMER1_CNTL : LOG(" -> %02x - Timer 1 Control - not implemented\n", ret); break; + case P8_TIMER2_INT_CNTL : LOG(" -> %02x - Timer 2 Interrupt Control - not implemented\n", ret); break; + case P8_TIMER2_CNTL : LOG(" -> %02x - Timer 2 Control - not implemented\n", ret); break; + case P8_ACFAIL_INT_CNTL : LOG(" -> %02x - AC Fail Interrupt Control Register - not implemented\n", ret); break; + case P8_WDOG_TIMER_CNTL : LOG(" -> %02x - Watchdog Timer Control Register - not implemented\n", ret); break; + case P8_PRINTER_INT_CNTL : LOG(" -> %02x - Printer Interrupt Control Register - not implemented\n", ret); break; + case P8_PRINTER_CNTL : LOG(" -> %02x - Printer Control Register - not implemented\n", ret); break; + case P8_DMA_INT_CNTL : LOG(" -> %02x - DMA Interrupt Control Register - not implemented\n", ret); break; + case P8_DMA_CNTL_STAT : LOG(" -> %02x - DMA Control and Status Register - not implemented\n", ret); break; + case P8_BUSERR_CNTL : LOG(" -> %02x - Bus Error Interrupt Control Register - not implemented\n", ret); break; + case P8_DMA_STATUS : LOG(" -> %02x - DMA Status Register - not implemented\n", ret); break; + case P8_ABORT_INT_CNTL : LOG(" -> %02x - Abort Interrupt Control Register - not fully implemented\n", ret); /* Bit 3 When this bit is high, the interrupt is enabled. The interrupt is disabled when this bit is low. This bit is cleared by reset. Bit 6 This bit indicates the current state of the ABORT switch. When this bit is low, the ABORT switch is not pressed. When this bit is high, the ABORT switch is pressed. @@ -415,9 +415,9 @@ READ8_MEMBER (mvme147_state::pcc8_r){ break; case P8_SCSI_INT_CNTL : LOG(" -> %02x - SCSI Port Interrupt Control Register - not implemented\n", ret); break; case P8_SLAVE_BASE_ADDR : LOG(" -> %02x - Slave Base Address Register - not implemented\n", ret); break; - case P8_SWI_1_CNTL : LOG(" -> %02x - Software Interrupt 1 Control Register - not implemented\n", ret); break; + case P8_SWI_1_CNTL : LOG(" -> %02x - Software Interrupt 1 Control Register - not implemented\n", ret); break; case P8_INT_VECT_BASE : LOG(" -> %02x - Interrupt Vector Base - not implemented\n", ret); break; - case P8_SWI_2_CNTL : LOG(" -> %02x - Software Interrupt 2 Control Register - not implemented\n", ret); break; + case P8_SWI_2_CNTL : LOG(" -> %02x - Software Interrupt 2 Control Register - not implemented\n", ret); break; case P8_REVISION_LEVEL : LOG(" -> %02x - PCC Revision Level Register - not implemented\n", ret); break; case P8_PRINTER_STATUS : LOG(" -> %02x - Printer Status Register - not implemented\n", ret); break; default: @@ -431,17 +431,17 @@ WRITE8_MEMBER (mvme147_state::pcc8_w){ switch(offset + P8BASE) { case P8_TIMER1_INT_CNTL : LOG("Timer 1 Interrupt Control - not implemented\n"); break; - case P8_TIMER1_CNTL : LOG("Timer 1 Control - not implemented\n"); break; + case P8_TIMER1_CNTL : LOG("Timer 1 Control - not implemented\n"); break; case P8_TIMER2_INT_CNTL : LOG("Timer 2 Interrupt Control - not implemented\n"); break; - case P8_TIMER2_CNTL : LOG("Timer 2 Control - not implemented\n"); break; + case P8_TIMER2_CNTL : LOG("Timer 2 Control - not implemented\n"); break; case P8_ACFAIL_INT_CNTL : LOG("AC Fail Interrupt Control Register - not implemented\n"); break; case P8_WDOG_TIMER_CNTL : LOG("Watchdog Timer Control Register - not implemented\n"); break; case P8_PRINTER_INT_CNTL: LOG("Printer Interrupt Control Register - not implemented\n"); break; case P8_PRINTER_CNTL : LOG("Printer Control Register - not implemented\n"); break; case P8_DMA_INT_CNTL : LOG("DMA Interrupt Control Register - not implemented\n"); break; case P8_DMA_CNTL_STAT : LOG("DMA Control and Status Register - not implemented\n"); break; - case P8_BUSERR_CNTL : LOG("Bus Error Interrupt Control Register - not implemented\n"); break; - case P8_DMA_STATUS : LOG("DMA Status Register - not implemented\n"); break; + case P8_BUSERR_CNTL : LOG("Bus Error Interrupt Control Register - not implemented\n"); break; + case P8_DMA_STATUS : LOG("DMA Status Register - not implemented\n"); break; case P8_ABORT_INT_CNTL : LOG("Abort Interrupt Control Register - not implemented\n"); break; case P8_TABADD_FC_CNTL : LOG("Table Address Function Code Register - not implemented\n"); break; case P8_SERIAL_INT_CNTL : LOG("Serial Port Interrupt Control Register - not implemented\n"); break; @@ -472,9 +472,9 @@ WRITE8_MEMBER (mvme147_state::pcc8_w){ break; case P8_SCSI_INT_CNTL : LOG("SCSI Port Interrupt Control Register - not implemented\n"); break; case P8_SLAVE_BASE_ADDR : LOG("Slave Base Address Register - not implemented\n"); break; - case P8_SWI_1_CNTL : LOG("Software Interrupt 1 Control Register - not implemented\n"); break; + case P8_SWI_1_CNTL : LOG("Software Interrupt 1 Control Register - not implemented\n"); break; case P8_INT_VECT_BASE : LOG("Interrupt Vector Base - not implemented\n"); break; - case P8_SWI_2_CNTL : LOG("Software Interrupt 2 Control Register - not implemented\n"); break; + case P8_SWI_2_CNTL : LOG("Software Interrupt 2 Control Register - not implemented\n"); break; case P8_REVISION_LEVEL : LOG("PCC Revision Level Register - not implemented\n"); break; case P8_PRINTER_DATA : LOG("Printer Data Register - not implemented\n"); break; default: @@ -579,7 +579,7 @@ READ8_MEMBER (mvme147_state::vmechip_r){ case VC_INT_HNDL_MASK : LOG(" -> %02x - Interrupt Handler Mask Register - not implemented\n", ret); break; case VC_UTIL_INT_MASK : LOG(" -> %02x - Utility Interrupt Mask Register - not implemented\n", ret); break; case VC_UTIL_INT_VECT : LOG(" -> %02x - Utility Interrupt Vector Register - not implemented\n", ret); break; - case VC_INT_REQUEST : LOG(" -> %02x - Interrupt Request Register - not implemented\n", ret); break; + case VC_INT_REQUEST : LOG(" -> %02x - Interrupt Request Register - not implemented\n", ret); break; case VC_VMEBUS_STAT_ID : LOG(" -> %02x - VMEbus Status/ID Register - not implemented\n", ret); break; case VC_BUS_ERR_STATUS : LOG(" -> %02x - Bus Error Status Register - not implemented\n", ret); break; case VC_GCSR_BASE_ADR : LOG(" -> %02x - GCSR Base Address Configuration Register - not implemented\n", ret); break; @@ -598,15 +598,15 @@ WRITE8_MEMBER (mvme147_state::vmechip_w){ m_vc_cntl_conf = data & 0xff; break; case VC_VMEBUS_REQ_CONF : LOG("VMEbus Requester Configuration Register - not implemented\n"); break; - case VC_MASTER_CONF : LOG("Master Configuration Register - not implemented\n"); break; - case VC_SLAVE_CONF : LOG("Slave Configuration Register - not implemented\n"); break; - case VC_TIMER_CONF : LOG("Timer Configuration Register - not implemented\n"); break; + case VC_MASTER_CONF : LOG("Master Configuration Register - not implemented\n"); break; + case VC_SLAVE_CONF : LOG("Slave Configuration Register - not implemented\n"); break; + case VC_TIMER_CONF : LOG("Timer Configuration Register - not implemented\n"); break; case VC_SLAVE_ADR_MOD : LOG("Slave Address Modifier Register - not implemented\n"); break; case VC_MASTER_ADR_MOD : LOG("Master Address Modifier Register - not implemented\n"); break; case VC_INT_HNDL_MASK : LOG("Interrupt Handler Mask Register - not implemented\n"); break; case VC_UTIL_INT_MASK : LOG("Utility Interrupt Mask Register - not implemented\n"); break; case VC_UTIL_INT_VECT : LOG("Utility Interrupt Vector Register - not implemented\n"); break; - case VC_INT_REQUEST : LOG("Interrupt Request Register - not implemented\n"); break; + case VC_INT_REQUEST : LOG("Interrupt Request Register - not implemented\n"); break; case VC_VMEBUS_STAT_ID : LOG("VMEbus Status/ID Register - not implemented\n"); break; case VC_BUS_ERR_STATUS : LOG("Bus Error Status Register - not implemented\n"); break; case VC_GCSR_BASE_ADR : LOG("GCSR Base Address Configuration Register - not implemented\n"); break; @@ -639,7 +639,7 @@ WRITE16_MEMBER (mvme147_state::vme_a16_w){ static SLOT_INTERFACE_START(mvme147_vme_cards) SLOT_INTERFACE("mvme350", VME_MVME350) -SLOT_INTERFACE_END +SLOT_INTERFACE_END /* * Machine configuration diff --git a/src/mame/drivers/mzr8105.cpp b/src/mame/drivers/mzr8105.cpp index 3eeb35ca1e9..38beb8b2c03 100644 --- a/src/mame/drivers/mzr8105.cpp +++ b/src/mame/drivers/mzr8105.cpp @@ -188,8 +188,8 @@ static ADDRESS_MAP_START (mzr8105_mem, AS_PROGRAM, 16, mzr8105_state) AM_RANGE (0x000000, 0x003fff) AM_ROM AM_REGION("roms", 0x000000) /* System EPROM Area 16Kb OS9 DEBUG - not verified */ AM_RANGE (0x004000, 0x01ffff) AM_ROM AM_REGION("roms", 0x004000)/* System EPROM Area 112Kb for System ROM - not verified */ AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */ -// AM_RANGE (0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ -// AM_RANGE (0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ +// AM_RANGE (0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ +// AM_RANGE (0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ ADDRESS_MAP_END /* Input ports */ @@ -198,7 +198,7 @@ INPUT_PORTS_END static SLOT_INTERFACE_START(mzr8105_vme_cards) SLOT_INTERFACE("mzr8300", VME_MZR8300) -SLOT_INTERFACE_END +SLOT_INTERFACE_END /* * Machine configuration diff --git a/src/mame/drivers/namcos2.cpp b/src/mame/drivers/namcos2.cpp index 5184630ca12..84044e5c1a0 100644 --- a/src/mame/drivers/namcos2.cpp +++ b/src/mame/drivers/namcos2.cpp @@ -1701,7 +1701,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(namcos2_state::screen_scanline) m_master_intc->vblank_irq_trigger(); m_slave_intc->vblank_irq_trigger(); } - + if(scanline == cur_posirq) { m_master_intc->pos_irq_trigger(); @@ -1736,7 +1736,7 @@ static MACHINE_CONFIG_START( default, namcos2_state ) MCFG_FRAGMENT_ADD(configure_c148_standard) MCFG_NAMCO_C139_ADD("sci") - + MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE( (49152000.0 / 8) / (384 * 264) ) MCFG_SCREEN_SIZE(384, 264) diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index 1e99e5b9ee3..808cbb501b0 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -1476,7 +1476,7 @@ static ADDRESS_MAP_START( winrun_master_map, AS_PROGRAM, 16, namcos21_state ) AM_RANGE(0x800000, 0x87ffff) AM_ROM AM_REGION("data", 0) AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_SHARE("sharedram") AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) - AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) + AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) AM_RANGE(0xb80000, 0xb8000f) AM_DEVICE("sci", namco_c139_device, regs_map) ADDRESS_MAP_END @@ -1488,7 +1488,7 @@ static ADDRESS_MAP_START( winrun_slave_map, AS_PROGRAM, 16, namcos21_state ) AM_RANGE(0x800000, 0x87ffff) AM_ROM AM_REGION("data", 0) AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_SHARE("sharedram") AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) - AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) + AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) AM_RANGE(0xb80000, 0xb8000f) AM_DEVICE("sci", namco_c139_device, regs_map) ADDRESS_MAP_END @@ -1568,10 +1568,10 @@ static ADDRESS_MAP_START( driveyes_common_map, AS_PROGRAM, 16, namcos21_state ) AM_RANGE(0x800000, 0x8fffff) AM_ROM AM_REGION("data", 0) AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_SHARE("sharedram") AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(namcos2_68k_dualportram_word_r,namcos2_68k_dualportram_word_w) - AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) + AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("sci", namco_c139_device, ram_r, ram_w) AM_RANGE(0xb80000, 0xb8000f) AM_DEVICE("sci", namco_c139_device, regs_map) ADDRESS_MAP_END - + static ADDRESS_MAP_START( driveyes_master_map, AS_PROGRAM, 16, namcos21_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM /* private work RAM */ @@ -1716,7 +1716,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( winrungp ) PORT_INCLUDE(winrun) - + PORT_MODIFY("DSW") PORT_DIPNAME( 0x20, 0x00, "PCM ROM") PORT_DIPSETTING( 0x20, "2M" ) @@ -1733,7 +1733,7 @@ static INPUT_PORTS_START( driveyes ) PORT_MODIFY("DIAL0") PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("gearbox", namcoio_gearbox_device, in_r, nullptr ) PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - + PORT_MODIFY("PORTH") /* 63B05Z0 - PORT H */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1850,8 +1850,8 @@ MACHINE_START_MEMBER(namcos21_state,namcos21) TIMER_DEVICE_CALLBACK_MEMBER(namcos21_state::screen_scanline) { int scanline = param; -// int cur_posirq = get_posirq_scanline()*2; - +// int cur_posirq = get_posirq_scanline()*2; + if(scanline == 240*2) { m_master_intc->vblank_irq_trigger(); @@ -1859,7 +1859,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(namcos21_state::screen_scanline) if(m_gpu_intc) m_gpu_intc->vblank_irq_trigger(); } - + if(m_gpu_intc != nullptr) { if(scanline == (0xff-m_gpu_intc->get_posirq_line())*2) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 435748e73be..493626a3926 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -1,5 +1,5 @@ // license:LGPL-2.1+ -// copyright-holders:Angelo Salese, Olivier Galibert, David Haywood, Samuele Zannoli, R. Belmont, ElSemi +// copyright-holders: Samuele Zannoli, R. Belmont, ElSemi, David Haywood, Angelo Salese, Olivier Galibert, MetalliC /* Sega Naomi / Naomi 2 / Atomiswave @@ -22,28 +22,6 @@ Sega Naomi is Dreamcast based Arcade hardware. -Compatibility list (as per 26-jun-2013) -- sfz3ugd: currently dies at disclaimer screen (regression); -- sprtjam: garbage on initial attract mode screen (regression). -- puyofev: hangs after pressing start (bp 0C03F490, similar if not same snippet as Tetris 4d on DC). -- vtennisg: crashes after stage screen. - -(25-mar-2015) -- sl2007: -0C04697A: MOV.L @($28,R14),R0 ;8c167734 -0C04697C: TST R0,R0 -0C04697E: BT $0C046998 -0C046980: BRA $0C046990 -0C04698E: BT $0C046998 -0C046990: MOV.L @($28,R14),R3 -0C046992: MOV #$FD,R5 -0C046994: JSR R3 -0C046608: NOP -0C04660A: BRA $0C04660A ;tight loops there, NOP-ing this opcode makes to go further, perhaps not supposed to go here in the first place? -0C046608: NOP - -(24-jun-2016) -- shangril: swapped mahjong inputs (M -> N, C -> B etc.) TODO (general): - all games that uses YUV just updates one frame then dies, why? @@ -83,16 +61,33 @@ TODO (game-specific): - Giant Gram 2: no VMU emulation; - Gun Survivor 2: crashes during game loading; - Lupin the Shooting: "com. error between Naomi BD and i/o BD" after some secs. of gameplay; - - Monkey Ball: dies when attempts to load the gameplay; + - marstv: temporary lock ups during anchor talking (does same in Demul); + - marstv: missing graphics at stage select, renderer fault or something else? + - monkeyba: CPU jumps to la la land when attempts to load a stage (bp c09e950, uses FPU opcodes for calculating the return address?); - Oinori-Daimyoujin Matsuri: reports "B. RAM error" in test mode, inputs doesn't seem to work after that point; - OutTrigger: crashes on naomibd_r(); + - puyofev: hangs after pressing start (bp 0C03F490, similar if not same snippet as Tetris 4d on DC). - Ringout 4x4: needs cabinet set to 4p, moans about not having two jamma i/o boards; - Super Major League '99: attract mode/gameplay bogusly have stop-motions from time to time; + - sfz3ugd: currently dies at disclaimer screen (regression); + - shangril: swapped mahjong inputs (M -> N, C -> B etc.); + - sprtjam: garbage on initial attract mode screen (regression). - The House of the Dead 2: game uses an earlier PVR so it has extra gfx issues; - The Typing of the Dead: missing keyboard inputs, doesn't enter into attract/test mode anymore (JVS issue); - - Virtua Tennis: dies when accessing the gameplay or the attract mode (PVR or SH-4 bug, most likely); + - vtennisg: crashes after stage screen or the attract mode (PVR or SH-4 bug, most likely); - World Kicks (both sets): "NAOMIM2: unhandled board write a0800600, 0000" after Naomi logo - (more will come up soon ...) + - sl2007: + 0C04697A: MOV.L @($28,R14),R0 ;8c167734 + 0C04697C: TST R0,R0 + 0C04697E: BT $0C046998 + 0C046980: BRA $0C046990 + 0C04698E: BT $0C046998 + 0C046990: MOV.L @($28,R14),R3 + 0C046992: MOV #$FD,R5 + 0C046994: JSR R3 + 0C046608: NOP + 0C04660A: BRA $0C04660A ;tight loops there, NOP-ing this opcode makes to go further, perhaps not supposed to go here in the first place? + 0C046608: NOP --------------------------------------------------------------------------------------------------------------------------------------------------- Guru's Readmes @@ -312,7 +307,7 @@ Notes: JP1 - JUMPER unknown function JP3 - JUMPER unknown function JP3 - JUMPER unknown function - JP4 - JUMPER unknown function + JP4 - JUMPER master (1-2) / slave (2-3) switch, then slave data accessed at +0x10000000 at cart address space IC1S-IC21S - FlashROM (SOP56), either 32Mb or 64Mb. Not all positions are populated IC22 - EPROM (DIP42), either 27C160 or 27C322 IC37 - FlashROM (SOIC8) Xicor X76F100 Secure SerialFlash @@ -336,7 +331,8 @@ House of the Dead 2 (prototype) no cart A1E2 21 (64Mb) pre Inu No Osanpo / Dog Walking (Rev A) 840-0073C 22294A 16 (64Mb) present 315-6206 317-0316-JPN requires 837-13844 JVS IO with DIPSW 1 ON Samba de Amigo (prototype) no cart * 21*(64Mb) present 315-6206 317-0270-COM * only first 14 flash roms contain game data, instead of EPROM have tiny PCB with 2 flashroms on it Soul Surfer (Rev A) 840-0095C 23838C 21 (64Mb) present 315-6206 not present -Star Horse (server) 840-0055C 23626 17 (64Mb) present 315-6206 not present requires 837-13785 ARCNET&IO BD +Star Horse (live and backup) 840-0055B 23626 17 (64Mb) present 315-6206 not present requires 837-13785 ARCNET&IO BD +Horse Data 840-0034B - 2 (64Mb) present 315-6206 not present not contain game data, used in stack with 840-0121(sound&backup) ROM board as game backup data storage, have JP3 and JP4 in position 2-3 The King of Route 66 (Rev A) 840-0087C 23819A 20 (64Mb) present 315-6206 not present content is the same as regular 171-8132A cart The Maze of the Kings (prototype) no cart * 21 (64Mb) present 315-6206 FRI * flash-PCB, not dumped but known to exist Tokyo Bus Guide (Rev A) 840-0045C 23468A 18 (64Mb) present 315-6206 317-0290-COM requires 837-13844 JVS IO @@ -597,11 +593,15 @@ Giga Wing 2 841-0014C 22270 5 (128Mb) 3 Mobile Suit Gundam: Federation Vs. Zeon 841-0017C 23638 10 (128Mb) 315-6319A 315-6213 317-5070-COM not present Moero! Justice Gakuen / Project Justice (Rev A) 841-0015C 23548A 11 (128Mb) 315-6319A 315-6213 317-5065-COM present MushiKing - The King Of Beetle 2K5 1ST 840-0158C 24286 7 (128Mb) 315-6319A 315-6213 not present not present requires 610-0669 barcode reader -Oinori-daimyoujin Matsuri 840-0126C 24053 5 (128Mb) 315-6319A 315-6213 not present not present requires 837-14274 "G2 EXPANSION BD" (similar to hopper 837-14381 but with ARC NET chip) +Oinori-daimyoujin Matsuri 840-0126B 24053 5 (128Mb) 315-6319A 315-6213 not present not present requires 837-14274 "G2 EXPANSION BD" (similar to hopper 837-14381 but with ARC NET chip) Samba de Amigo Ver. 2000 840-0047C 23600 11 (128Mb) 315-6319A 315-6213 317-0295-COM ? -Star Horse (big screens) 840-0054C 23625 4 (128Mb) 315-6319 315-6213 not present present requires 837-13785 ARCNET&IO BD +Star Horse (main screens) 840-0054C 23625 4 (128Mb) 315-6319 315-6213 not present present requires 837-13785 ARCNET&IO BD Star Horse (satellite) 840-0056C 23627 6 (128Mb)* 315-6319 315-6213 not present present * +1 (64Mb), requires 837-13785 ARCNET&IO BD -Star Horse Progress (satellite) (Rev A) 840-0123C 24122A 7 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD +Star Horse 2001 (satellite) (Rev B) 840-0078B 23739B 7 (128Mb) 315-6319 315-6213 not present present requires 837-13785 ARCNET&IO BD +Star Horse Progress (main screen, Rev B) 840-0120B 24087B 6 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD +Star Horse Progress (sound & backup, Rev A) 840-0121B 24097A 6 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD +Star Horse Progress (live, Rev A) 840-0122B 24107A 11 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD +Star Horse Progress (satellite, Rev A) 840-0123B 24122A 7 (128Mb) 315-6319A 315-6213 not present not present requires 837-13785 ARCNET&IO BD The King of Route 66 (Rev A) 840-0087C 23819A 10 (128Mb) 315-6319A 315-6213 not present present Virtua Fighter 4 840-0080C 23785 11 (128Mb) ? ? 317-0324-COM ? Virtua Striker 3 840-0061C 23663 11 (128Mb) 315-6319A 315-6213 317-0310-COM ? @@ -716,7 +716,7 @@ Notes: /Shin Nihon Prowrestling Toukon /FL0 & FL1 have pin55 raised from PCB. \Retsuden 4 Arcade Edition (Japan, Ver.A) F2X 25349801 2 (64Mb) 15 (128Mb) not present NAODEC2A NAODEC1B 317-5040-COM TRF1 \They are connected together and go to pin89 on 2K. World Kicks PCB (Japan, WKC1 Ver.A) F2 25509801 2 (64Mb) 9 (128Mb) not present NAODEC2A NAODEC1B 317-5040-COM WKC1 uses Namco V226 JVS I/O (not dumped) -World Kicks (Japan, WK1 Ver.A) F2 25209801 2 (64Mb) 9 (128Mb) not present NAODEC2A NAODEC1A 317-5040-COM WK1 not dumped, FL1.2D sums E8F1 B057 +World Kicks (Japan, WK1 Ver.A) F2 25209801 2 (64Mb) 9 (128Mb) not present NAODEC2A NAODEC1A 317-5040-COM WK1 World Kicks (Asia, WK2 Ver.A) F2 25209801 2 (64Mb) 9 (128Mb) not present NAODEC2A NAODEC1A 317-5040-COM WK2 World Kicks (US, WK3 Ver.A) F2 25209801 2 (64Mb) 9 (128Mb) not present NAODEC2A NAODEC1A 317-5040-COM WK3 @@ -1574,27 +1574,30 @@ Premier Eleven #define CPU_CLOCK (200000000) -READ64_MEMBER(naomi_state::naomi_arm_r ) +READ64_MEMBER(naomi_state::naomi_unknown1_r ) { - return *(reinterpret_cast<uint64_t *>(dc_sound_ram.target())+offset); + if ((offset * 8) == 0xc0) // trick so that it does not "wait for multiboard sync" + return -1; + return 0; } -WRITE64_MEMBER(naomi_state::naomi_arm_w ) +WRITE64_MEMBER(naomi_state::naomi_unknown1_w ) { - COMBINE_DATA(reinterpret_cast<uint64_t *>(dc_sound_ram.target()) + offset); } -READ64_MEMBER(naomi_state::naomi_unknown1_r ) +// TODO: was using same handler as Naomi, tbd +READ64_MEMBER(atomiswave_state::aw_unknown1_r ) { if ((offset * 8) == 0xc0) // trick so that it does not "wait for multiboard sync" return -1; return 0; } -WRITE64_MEMBER(naomi_state::naomi_unknown1_w ) +WRITE64_MEMBER(atomiswave_state::aw_unknown1_w ) { } + /* * Non-volatile memories */ @@ -1691,7 +1694,7 @@ static ADDRESS_MAP_START( naomi_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) - AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) + AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(sh4_soundram_r, sh4_soundram_w ) // sound RAM (8 MB) /* External Device */ AM_RANGE(0x01010098, 0x0101009f) AM_MIRROR(0x02000000) AM_RAM // Naomi 2 BIOS tests this, needs to read back as written @@ -1728,7 +1731,14 @@ ADDRESS_MAP_END * Naomi 2 address map */ -static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) +// example hookup for accessing both PVRs, to be extended to everything else. +WRITE32_MEMBER(naomi2_state::both_pvr2_ta_w) +{ + space.write_dword(0x005f8000|offset*4,data,mem_mask); + space.write_dword(0x025f8000|offset*4,data,mem_mask); +} + +static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi2_state ) /* Area 0 */ AM_RANGE(0x00000000, 0x001fffff) AM_MIRROR(0xa2000000) AM_ROM AM_REGION("maincpu", 0) // BIOS @@ -1738,20 +1748,22 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, 0x0000ffff0000ffffU ) AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) - AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) + AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(sh4_soundram_r, sh4_soundram_w ) // sound RAM (8 MB) /* External Device */ AM_RANGE(0x01010098, 0x0101009f) AM_MIRROR(0x02000000) AM_RAM // Naomi 2 BIOS tests this, needs to read back as written AM_RANGE(0x0103ff00, 0x0103ffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known + AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVICE32("powervr2_slave", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x025f8000, 0x025f9fff) AM_DEVICE32("powervr2_slave", powervr2_device, ta_map, 0xffffffffffffffffU) // AM_RANGE(0x025f6800, 0x025f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) // second PVR DMA! // AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, 0xffffffffffffffffU) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) +// AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) /* Area 1 */ AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE("dc_texture_ram") // texture memory 64 bit access @@ -1760,8 +1772,8 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x07000000, 0x07ffffff) AM_RAM AM_SHARE("frameram2")// 32 bit access 2nd PVR RAM /* Area 2*/ - AM_RANGE(0x085f6800, 0x085f69ff) AM_WRITE(dc_sysctrl_w ) // writes to BOTH PVRs - AM_RANGE(0x085f8000, 0x805f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) + AM_RANGE(0x085f6800, 0x085f69ff) AM_WRITE(dc_sysctrl_w ) // TODO: writes to BOTH PVRs + AM_RANGE(0x085f8000, 0x085f9fff) AM_WRITE32(both_pvr2_ta_w, 0xffffffffffffffffU) AM_RANGE(0x08800000, 0x088000ff) AM_DEVREADWRITE32("powervr2", powervr2_device, elan_regs_r, elan_regs_w, 0xffffffffffffffffU) // T&L chip registers // AM_RANGE(0x09000000, 0x09??????) T&L command processing AM_RANGE(0x0a000000, 0x0bffffff) AM_RAM AM_SHARE("elan_ram") // T&L chip RAM @@ -1795,13 +1807,13 @@ ADDRESS_MAP_END * Atomiswave address map, almost identical to Dreamcast */ -READ64_MEMBER(naomi_state::aw_flash_r ) +READ64_MEMBER(atomiswave_state::aw_flash_r ) { return (uint64_t)m_awflash->read(offset*8) | (uint64_t)m_awflash->read((offset*8)+1)<<8 | (uint64_t)m_awflash->read((offset*8)+2)<<16 | (uint64_t)m_awflash->read((offset*8)+3)<<24 | (uint64_t)m_awflash->read((offset*8)+4)<<32 | (uint64_t)m_awflash->read((offset*8)+5)<<40 | (uint64_t)m_awflash->read((offset*8)+6)<<48 | (uint64_t)m_awflash->read((offset*8)+7)<<56; } -WRITE64_MEMBER(naomi_state::aw_flash_w ) +WRITE64_MEMBER(atomiswave_state::aw_flash_w ) { int i; uint32_t addr = offset * 8; @@ -1820,7 +1832,8 @@ WRITE64_MEMBER(naomi_state::aw_flash_w ) m_awflash->write(addr, data); } -inline int naomi_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift) +// TODO: don't we have a common function for this? +inline int atomiswave_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift) { int reg = offset * 2; @@ -1842,7 +1855,7 @@ inline int naomi_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint return reg; } -READ64_MEMBER(naomi_state::aw_modem_r ) +READ64_MEMBER(atomiswave_state::aw_modem_r ) { int reg; uint64_t shift; @@ -1868,7 +1881,7 @@ READ64_MEMBER(naomi_state::aw_modem_r ) return 0; } -WRITE64_MEMBER(naomi_state::aw_modem_w ) +WRITE64_MEMBER(atomiswave_state::aw_modem_w ) { int reg; uint64_t shift; @@ -1900,7 +1913,7 @@ WRITE64_MEMBER(naomi_state::aw_modem_w ) osd_printf_verbose("%s",string_format("MODEM: [%08x=%x] write %I64x to %x, mask %I64x\n", 0x600000+reg*4, dat, data, offset, mem_mask).c_str()); } -static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, naomi_state ) +static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, atomiswave_state ) /* Area 0 */ AM_RANGE(0x00000000, 0x0001ffff) AM_READWRITE(aw_flash_r, aw_flash_w ) AM_REGION("awflash", 0) AM_RANGE(0xa0000000, 0xa001ffff) AM_READWRITE(aw_flash_r, aw_flash_w ) AM_REGION("awflash", 0) @@ -1916,10 +1929,10 @@ static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(aw_modem_r, aw_modem_w ) AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) - AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) + AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE(sh4_soundram_r, sh4_soundram_w ) // sound RAM (8 MB) - AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE(naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known + AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE(aw_unknown1_r, aw_unknown1_w ) // ??? /* Area 1 - half the texture memory, like dreamcast, not naomi */ AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_MIRROR(0x00800000) AM_SHARE("dc_texture_ram") // texture memory 64 bit access @@ -1955,25 +1968,11 @@ static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, naomi_state ) //AM_RANGE(0x1c000000, 0x1fffffff) AM_NOP // SH4 Internal ADDRESS_MAP_END -/* - * Aica - */ -WRITE_LINE_MEMBER(naomi_state::aica_irq) -{ - m_soundcpu->set_input_line(ARM7_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(naomi_state::sh4_aica_irq) -{ - if(state) - dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_AICA; - else - dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_AICA; - - dc_update_interrupt_status(); -} +static ADDRESS_MAP_START( aw_port, AS_IO, 64, atomiswave_state ) +// ??? +ADDRESS_MAP_END -static ADDRESS_MAP_START( dc_audio_map, AS_PROGRAM, 32, naomi_state ) +static ADDRESS_MAP_START( dc_audio_map, AS_PROGRAM, 32, dc_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("dc_sound_ram") /* shared with SH-4 */ AM_RANGE(0x00800000, 0x00807fff) AM_READWRITE(dc_arm_aica_r, dc_arm_aica_w) @@ -1985,12 +1984,17 @@ ADDRESS_MAP_END INPUT_PORTS_START( naomi_debug ) PORT_START("MAMEDEBUG") - PORT_DIPNAME( 0x01, 0x00, "Bilinear Filtering" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "Disable Render Calls" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_CONFNAME( 0x01, 0x00, "Bilinear Filtering" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x01, DEF_STR( Yes ) ) + PORT_CONFNAME( 0x02, 0x00, "Disable Render Calls" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x02, DEF_STR( Yes ) ) + PORT_CONFNAME( 0x0c, 0x00, "Master CPU Clock Rate (Cheat)") PORT_CHANGED_MEMBER(DEVICE_SELF, dc_state, mastercpu_cheat_r, nullptr) + PORT_CONFSETTING( 0x00, "100%" ) + PORT_CONFSETTING( 0x04, "50%" ) + PORT_CONFSETTING( 0x08, "25%" ) + PORT_CONFSETTING( 0x0c, "12.5%" ) INPUT_PORTS_END static INPUT_PORTS_START( naomi_mie ) @@ -2081,6 +2085,27 @@ static INPUT_PORTS_START( naomi ) PORT_BIT( 0x07ff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END +static INPUT_PORTS_START( marstv ) + PORT_INCLUDE( naomi ) + + PORT_MODIFY("P1") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_START1 ) PORT_PLAYER(1) PORT_NAME("P1 Start") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME(u8"P1 Red Large Button \u5927") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME(u8"P1 Yellow Medium Button \u4E2D") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME(u8"P1 Blue Small Button \u5C0F") + PORT_BIT( 0x53ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_MODIFY("P2") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_START2 ) PORT_PLAYER(2) PORT_NAME("P2 Start") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME(u8"P2 Red Large Button \u5927") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME(u8"P2 Yellow Medium Button \u4E2D") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME(u8"P2 Blue Small Button \u5C0F") + PORT_BIT( 0x53ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + // TODO: Player 3 +INPUT_PORTS_END + + static INPUT_PORTS_START( hotd2 ) PORT_INCLUDE( naomi_mie ) PORT_INCLUDE( naomi_debug ) @@ -2555,6 +2580,7 @@ static INPUT_PORTS_START( aw2c ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_START("P1.1") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW ) @@ -2574,6 +2600,7 @@ static INPUT_PORTS_START( aw2c ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_START("P2.1") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -2641,7 +2668,8 @@ MACHINE_RESET_MEMBER(naomi_state,naomi) * Common for Naomi 1, Naomi GD-Rom, Naomi 2, Atomiswave ... */ -MACHINE_CONFIG_START( naomi_aw_base, naomi_state ) + // TODO: merge with Dreamcast base machine + MACHINE_CONFIG_START( naomi_aw_base, dc_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", SH4LE, CPU_CLOCK) // SH4!!! MCFG_SH4_MD0(1) @@ -2663,11 +2691,6 @@ MACHINE_CONFIG_START( naomi_aw_base, naomi_state ) MCFG_MAPLE_DC_ADD( "maple_dc", "maincpu", dc_maple_irq ) - MCFG_MACHINE_RESET_OVERRIDE(naomi_state,naomi) - - MCFG_EEPROM_SERIAL_93C46_ADD("main_eeprom") - MCFG_EEPROM_SERIAL_DEFAULT_VALUE(0) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(13458568*2, 820, 0, 640, 532, 0, 480) /* TODO: where pclk actually comes? */ @@ -2678,8 +2701,8 @@ MACHINE_CONFIG_START( naomi_aw_base, naomi_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("aica", AICA, 0) MCFG_AICA_MASTER - MCFG_AICA_IRQ_CB(WRITELINE(naomi_state, aica_irq)) - MCFG_AICA_MAIN_IRQ_CB(WRITELINE(naomi_state, sh4_aica_irq)) + MCFG_AICA_IRQ_CB(WRITELINE(dc_state, aica_irq)) + MCFG_AICA_MAIN_IRQ_CB(WRITELINE(dc_state, sh4_aica_irq)) MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) MCFG_SOUND_ROUTE(1, "rspeaker", 2.0) @@ -2687,13 +2710,19 @@ MACHINE_CONFIG_START( naomi_aw_base, naomi_state ) MCFG_AICARTC_ADD("aicartc", XTAL_32_768kHz ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( naomi_base, naomi_aw_base ) +static MACHINE_CONFIG_START( naomi_base, naomi_state ) + MCFG_FRAGMENT_ADD( naomi_aw_base ) + + MCFG_EEPROM_SERIAL_93C46_ADD("main_eeprom") + MCFG_EEPROM_SERIAL_DEFAULT_VALUE(0) + MCFG_MIE_ADD("mie", XTAL_32MHz/2, "maple_dc", 0, nullptr, nullptr, nullptr, ":MIE.3", nullptr, ":MIE.5", nullptr, nullptr) // Actual frequency unknown, most likely 1/2 of 32MHz XTAL or even 2/3 (yes, 21MHz Z80 core) MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "mie", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT") MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("mie_eeprom") MCFG_X76F100_ADD("naomibd_eeprom") MCFG_M3COMM_ADD("comm_board") + MCFG_MACHINE_RESET_OVERRIDE(naomi_state,naomi) MACHINE_CONFIG_END /* @@ -2749,7 +2778,16 @@ MACHINE_CONFIG_END * Naomi 2 GD-Rom */ -static MACHINE_CONFIG_DERIVED( naomi2gd, naomigd ) +static MACHINE_CONFIG_START( naomi2_base, naomi2_state ) + MCFG_POWERVR2_ADD("powervr2_slave", WRITE8(dc_state, pvr_irq)) + + // TODO: ELAN device +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( naomi2gd, naomi2_state ) + MCFG_FRAGMENT_ADD( naomigd ) + MCFG_FRAGMENT_ADD( naomi2_base ) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(naomi2_map) MACHINE_CONFIG_END @@ -2758,7 +2796,10 @@ MACHINE_CONFIG_END * Naomi 2, M1 sub-board */ -static MACHINE_CONFIG_DERIVED( naomi2m1, naomim1 ) +static MACHINE_CONFIG_START( naomi2m1, naomi2_state ) + MCFG_FRAGMENT_ADD( naomim1 ) + MCFG_FRAGMENT_ADD( naomi2_base ) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(naomi2_map) MACHINE_CONFIG_END @@ -2767,7 +2808,10 @@ MACHINE_CONFIG_END * Naomi 2, M2/3 sub-board */ -static MACHINE_CONFIG_DERIVED( naomi2m2, naomim2 ) +static MACHINE_CONFIG_START( naomi2m2, naomi2_state ) + MCFG_FRAGMENT_ADD( naomim2 ) + MCFG_FRAGMENT_ADD( naomi2_base ) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(naomi2_map) MACHINE_CONFIG_END @@ -2776,15 +2820,24 @@ MACHINE_CONFIG_END * Atomiswave */ -static MACHINE_CONFIG_DERIVED( aw_base, naomi_aw_base ) +static MACHINE_CONFIG_START( aw_base, atomiswave_state ) + MCFG_FRAGMENT_ADD( naomi_aw_base ) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(aw_map) + MCFG_CPU_IO_MAP(aw_port) MCFG_MACRONIX_29L001MC_ADD("awflash") MCFG_AW_ROM_BOARD_ADD("rom_board", "rom_key", WRITE8(dc_state, g1_irq)) + + //MCFG_CPU_MODIFY("soundcpu") + //MCFG_CPU_PROGRAM_MAP(aw_sound_map) + + MCFG_MACHINE_RESET_OVERRIDE(dc_state,dc_console) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( aw1c, aw_base ) MCFG_DC_CONTROLLER_ADD("dcctrl0", "maple_dc", 0, ":P1.0", ":P1.1", ":P1.A0", ":P1.A1", ":P1.A2", ":P1.A3", ":P1.A4", ":P1.A5") + // TODO: isn't it supposed to be just one controller? MCFG_DC_CONTROLLER_ADD("dcctrl1", "maple_dc", 1, ":P2.0", ":P2.1", ":P2.A0", ":P2.A1", ":P2.A2", ":P2.A3", ":P2.A4", ":P2.A5") MACHINE_CONFIG_END @@ -5408,20 +5461,20 @@ ROM_START( sambap ) ROM_REGION( 0x7800000, "rom_board", ROMREGION_ERASEFF) ROM_LOAD( "sambaproto.ic22",0x000000, 0x0400000, CRC(ca069449) SHA1(03c2498664df187a98b335f1757979ebcf45c591) ) - ROM_LOAD("ic1s", 0x00800000, 0x00800000, CRC(992a8390) SHA1(5842aaf0c9ed25f58429cae71f90d8e3e41a3efd) ) - ROM_LOAD("ic2s", 0x01000000, 0x00800000, CRC(330f9185) SHA1(dd2ee044a62179160cd69799ce3727e7cb401da8) ) - ROM_LOAD("ic3s", 0x01800000, 0x00800000, CRC(719ae0f9) SHA1(f08d1764f19023d510be5e02183eef18a9294a99) ) - ROM_LOAD("ic4s", 0x02000000, 0x00800000, CRC(941b8208) SHA1(4409d4d83546c57e7c046de2e8a1b25f40acb246) ) - ROM_LOAD("ic5s", 0x02800000, 0x00800000, CRC(6d12335e) SHA1(9d58040182d7f185733a3aebc833e98d2daec3a5) ) - ROM_LOAD("ic6s", 0x03000000, 0x00800000, CRC(197540ed) SHA1(b993344b4091c86bc823d6e73814baeab01b9c43) ) - ROM_LOAD("ic7s", 0x03800000, 0x00800000, CRC(2e0912ba) SHA1(fe010f41f7498a417d143b95617d1cbc8d5c5ec7) ) - ROM_LOAD("ic8s", 0x04000000, 0x00800000, CRC(10f6b6a2) SHA1(d73fef5edac937b8d294781bbd6197fd8185c589) ) - ROM_LOAD("ic9s", 0x04800000, 0x00800000, CRC(2b57ce5f) SHA1(0fcf78b3497b918dc1fbc62ffdd2863489eea3ab) ) - ROM_LOAD("ic10s", 0x05000000, 0x00800000, CRC(7d61643c) SHA1(e48023ec78143e85bdf4605deaba3f355601a856) ) - ROM_LOAD("ic11s", 0x05800000, 0x00800000, CRC(ca391126) SHA1(a3324b865c134ba9ec3ef33cd158107b55b8bd2e) ) - ROM_LOAD("ic12s", 0x06000000, 0x00800000, CRC(f028ae87) SHA1(ff868e33d8765c076d687af416a8d658169af2fb) ) - ROM_LOAD("ic13s", 0x06800000, 0x00800000, CRC(37a15a54) SHA1(11c247caf0cd0ed098d408d273affab87d794169) ) - ROM_LOAD("ic14s", 0x07000000, 0x00800000, CRC(e0730a2b) SHA1(79ac165cf8d8095ff1661e86d03ad6fd04d2d63c) ) + ROM_LOAD("rom1.ic1s", 0x00800000, 0x00800000, CRC(992a8390) SHA1(5842aaf0c9ed25f58429cae71f90d8e3e41a3efd) ) + ROM_LOAD("rom2.ic2s", 0x01000000, 0x00800000, CRC(330f9185) SHA1(dd2ee044a62179160cd69799ce3727e7cb401da8) ) + ROM_LOAD("rom3.ic3s", 0x01800000, 0x00800000, CRC(719ae0f9) SHA1(f08d1764f19023d510be5e02183eef18a9294a99) ) + ROM_LOAD("rom4.ic4s", 0x02000000, 0x00800000, CRC(941b8208) SHA1(4409d4d83546c57e7c046de2e8a1b25f40acb246) ) + ROM_LOAD("rom5.ic5s", 0x02800000, 0x00800000, CRC(6d12335e) SHA1(9d58040182d7f185733a3aebc833e98d2daec3a5) ) + ROM_LOAD("rom6.ic6s", 0x03000000, 0x00800000, CRC(197540ed) SHA1(b993344b4091c86bc823d6e73814baeab01b9c43) ) + ROM_LOAD("rom7.ic7s", 0x03800000, 0x00800000, CRC(2e0912ba) SHA1(fe010f41f7498a417d143b95617d1cbc8d5c5ec7) ) + ROM_LOAD("rom8.ic8s", 0x04000000, 0x00800000, CRC(10f6b6a2) SHA1(d73fef5edac937b8d294781bbd6197fd8185c589) ) + ROM_LOAD("rom9.ic9s", 0x04800000, 0x00800000, CRC(2b57ce5f) SHA1(0fcf78b3497b918dc1fbc62ffdd2863489eea3ab) ) + ROM_LOAD("rom10.ic10s", 0x05000000, 0x00800000, CRC(7d61643c) SHA1(e48023ec78143e85bdf4605deaba3f355601a856) ) + ROM_LOAD("rom11.ic11s", 0x05800000, 0x00800000, CRC(ca391126) SHA1(a3324b865c134ba9ec3ef33cd158107b55b8bd2e) ) + ROM_LOAD("rom12.ic12s", 0x06000000, 0x00800000, CRC(f028ae87) SHA1(ff868e33d8765c076d687af416a8d658169af2fb) ) + ROM_LOAD("rom13.ic13s", 0x06800000, 0x00800000, CRC(37a15a54) SHA1(11c247caf0cd0ed098d408d273affab87d794169) ) + ROM_LOAD("rom14.ic14s", 0x07000000, 0x00800000, CRC(e0730a2b) SHA1(79ac165cf8d8095ff1661e86d03ad6fd04d2d63c) ) ROM_REGION(0x84, "some_eeprom", 0) ROM_LOAD( "sflash.ic37", 0x000000, 0x000084, CRC(69d54cc4) SHA1(e036b8537390b9941dbfcb8d3b42ded68c8e9d29) ) @@ -6131,21 +6184,6 @@ ROM_START( rhytngk ) ROM_PARAMETER( ":rom_board:id", "5504" ) ROM_END -// this is satellite unit of the main game, server/control and lagre screen units required and need to be dumped -ROM_START( starhrpr ) - NAOMI_BIOS - NAOMI_DEFAULT_EEPROM - - ROM_REGION( 0x8000000, "rom_board", ROMREGION_ERASEFF) - ROM_LOAD( "fpr-24489.ic8", 0x00000000, 0x4000000, CRC(156797a4) SHA1(b20da57726974c5d772885fe809c4bbf89012db6) ) - ROM_LOAD( "fpr-24790.ic9", 0x04000000, 0x4000000, CRC(b6c40348) SHA1(37b5b334c24536e5b2062c233423f0e3d338e1f2) ) - - // PIC not populated - ROM_REGION( 0x800, "pic_readout", ROMREGION_ERASE00 ) - - ROM_PARAMETER( ":rom_board:id", "5502" ) -ROM_END - /* SYSTEMID: NAOMI @@ -6299,6 +6337,28 @@ ROM_START( gunsur2 ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "000680d0" ) ROM_END +ROM_START( wldkicksj ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD( "wk1vera.2d", 0x0800000, 0x800000, CRC(eb4d7fe1) SHA1(14378c3f6926b7709902a3073ed4274c7ac5ead8) ) + ROM_LOAD( "wk2vera.2c", 0x1000000, 0x800000, CRC(ad2577d5) SHA1(f7b6bab001c5f5cf0b33a70cd0dfdca8f7d25921) ) + + ROM_LOAD( "wk1ma2.4m", 0x2000000, 0x1000000, CRC(3b340dc0) SHA1(2412e41d5bd74d1233fb91f8ce2276a318bfc53d) ) + ROM_LOAD( "wk1ma3.4l", 0x3000000, 0x1000000, CRC(263fbb16) SHA1(b5d3a3d085f9623d70030ca3c49afb84e25549e3) ) + ROM_LOAD( "wk1ma4.4k", 0x4000000, 0x1000000, CRC(9697db68) SHA1(7926e2acff0519403afcba9bdb5f68de28b06c79) ) + ROM_LOAD( "wk1ma5.4j", 0x5000000, 0x1000000, CRC(65017db3) SHA1(a66cd73cdfc9355df63da781a46aa832889f583a) ) + ROM_LOAD( "wk1ma6.4h", 0x6000000, 0x1000000, CRC(902eea85) SHA1(aa7964eb85b468d4fe112f9f0faaf2fa3f1aa96b) ) + ROM_LOAD( "wk1ma7.4f", 0x7000000, 0x1000000, CRC(90e917ed) SHA1(53d32ce0ae2b05fa55a95b8697927045d07f4e8a) ) + ROM_LOAD( "wk1ma8.4e", 0x8000000, 0x1000000, CRC(1d227a05) SHA1(9f816bcdf0279785e0b37ab2f3c5eb5912114dd5) ) + ROM_LOAD( "wk1ma9.4d", 0x9000000, 0x1000000, CRC(29635a54) SHA1(a3109d0f8f271e2183316846df2a6a819f6a9b20) ) + ROM_LOAD( "wk1ma10.4c", 0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) ) + + // 25209801 2000 317-5040-COM Naomi + ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" ) +ROM_END + ROM_START( wldkicksa ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM @@ -6343,7 +6403,7 @@ ROM_START( wldkicks ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "052e2901" ) ROM_END -ROM_START( wldkicksj ) +ROM_START( wldkickspj ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM @@ -6700,22 +6760,22 @@ ROM_START( inunoos ) ROM_REGION( 0x8800000, "rom_board", ROMREGION_ERASEFF) ROM_LOAD( "epr-22294a.ic22", 0x000000, 0x400000, CRC(bc3a1397) SHA1(73747f10ea034bd0fc952939c6c7576dab9640a6) ) - ROM_LOAD( "ic1s.bin", 0x0800000, 0x800000, CRC(0afec6d7) SHA1(fad13f7c205d048006b48c1f262f272a9d653630) ) - ROM_LOAD( "ic2s.bin", 0x1000000, 0x800000, CRC(80b4a397) SHA1(c7d41a48c327b8ae9fefb15149ad5341b86ff933) ) - ROM_LOAD( "ic3s.bin", 0x1800000, 0x800000, CRC(a58fde28) SHA1(db271690131f093a329a457aa234659cbdba4ad1) ) - ROM_LOAD( "ic4s.bin", 0x2000000, 0x800000, CRC(6fcc34f6) SHA1(28f4d69fdd4e151cf1d98303d5f7ac8ff6d4c141) ) - ROM_LOAD( "ic5s.bin", 0x2800000, 0x800000, CRC(d5582d3e) SHA1(b21eda63314983fff7b88d2ad6ddcd8a2ef20e32) ) - ROM_LOAD( "ic6s.bin", 0x3000000, 0x800000, CRC(24b9fa3b) SHA1(b85be6085c476c8683c6d9e9b72e6021385a376a) ) - ROM_LOAD( "ic7s.bin", 0x3800000, 0x800000, CRC(bb80e02a) SHA1(73e7fda34295eb3b67ac04e46206a3a399b7b88a) ) - ROM_LOAD( "ic8s.bin", 0x4000000, 0x800000, CRC(59e2e25b) SHA1(e32d59dca85f246781a411bd8d0bec8fabc3b26d) ) - ROM_LOAD( "ic9s.bin", 0x4800000, 0x800000, CRC(41eac8af) SHA1(594efd94ea053229f0c807591b4f38643f0995c2) ) - ROM_LOAD( "ic10s.bin", 0x5000000, 0x800000, CRC(811f6e65) SHA1(71448b91d2c68df119a767fc29692bbf115edb37) ) - ROM_LOAD( "ic11s.bin", 0x5800000, 0x800000, CRC(ad1375e8) SHA1(17eeaad1becbf0ad0d68e10457c0d3dac9f168da) ) - ROM_LOAD( "ic12s.bin", 0x6000000, 0x800000, CRC(7e7826c0) SHA1(6a13fb7471555732292ee8e4709ee191aee2528c) ) - ROM_LOAD( "ic13s.bin", 0x6800000, 0x800000, CRC(38a192da) SHA1(501c25190af153d1364a90762c7994ac797a498d) ) - ROM_LOAD( "ic14s.bin", 0x7000000, 0x800000, CRC(79ca1d44) SHA1(449509110a7e181e0e495fe3e1d21762b6e4ce08) ) - ROM_LOAD( "ic15s.bin", 0x7800000, 0x800000, CRC(b85e13ef) SHA1(974f6b8f24efe79d72ea9d7a2cfccf479704243d) ) - ROM_LOAD( "ic16s.bin", 0x8000000, 0x800000, CRC(b8493dbe) SHA1(b641417e1bda49341e7ff86340072d74e3330665) ) + ROM_LOAD( "rom1.ic1s", 0x0800000, 0x800000, CRC(0afec6d7) SHA1(fad13f7c205d048006b48c1f262f272a9d653630) ) + ROM_LOAD( "rom2.ic2s", 0x1000000, 0x800000, CRC(80b4a397) SHA1(c7d41a48c327b8ae9fefb15149ad5341b86ff933) ) + ROM_LOAD( "rom3.ic3s", 0x1800000, 0x800000, CRC(a58fde28) SHA1(db271690131f093a329a457aa234659cbdba4ad1) ) + ROM_LOAD( "rom4.ic4s", 0x2000000, 0x800000, CRC(6fcc34f6) SHA1(28f4d69fdd4e151cf1d98303d5f7ac8ff6d4c141) ) + ROM_LOAD( "rom5.ic5s", 0x2800000, 0x800000, CRC(d5582d3e) SHA1(b21eda63314983fff7b88d2ad6ddcd8a2ef20e32) ) + ROM_LOAD( "rom6.ic6s", 0x3000000, 0x800000, CRC(24b9fa3b) SHA1(b85be6085c476c8683c6d9e9b72e6021385a376a) ) + ROM_LOAD( "rom7.ic7s", 0x3800000, 0x800000, CRC(bb80e02a) SHA1(73e7fda34295eb3b67ac04e46206a3a399b7b88a) ) + ROM_LOAD( "rom8.ic8s", 0x4000000, 0x800000, CRC(59e2e25b) SHA1(e32d59dca85f246781a411bd8d0bec8fabc3b26d) ) + ROM_LOAD( "rom9.ic9s", 0x4800000, 0x800000, CRC(41eac8af) SHA1(594efd94ea053229f0c807591b4f38643f0995c2) ) + ROM_LOAD( "rom10.ic10s", 0x5000000, 0x800000, CRC(811f6e65) SHA1(71448b91d2c68df119a767fc29692bbf115edb37) ) + ROM_LOAD( "rom11.ic11s", 0x5800000, 0x800000, CRC(ad1375e8) SHA1(17eeaad1becbf0ad0d68e10457c0d3dac9f168da) ) + ROM_LOAD( "rom12.ic12s", 0x6000000, 0x800000, CRC(7e7826c0) SHA1(6a13fb7471555732292ee8e4709ee191aee2528c) ) + ROM_LOAD( "rom13.ic13s", 0x6800000, 0x800000, CRC(38a192da) SHA1(501c25190af153d1364a90762c7994ac797a498d) ) + ROM_LOAD( "rom14.ic14s", 0x7000000, 0x800000, CRC(79ca1d44) SHA1(449509110a7e181e0e495fe3e1d21762b6e4ce08) ) + ROM_LOAD( "rom15.ic15s", 0x7800000, 0x800000, CRC(b85e13ef) SHA1(974f6b8f24efe79d72ea9d7a2cfccf479704243d) ) + ROM_LOAD( "rom16.ic16s", 0x8000000, 0x800000, CRC(b8493dbe) SHA1(b641417e1bda49341e7ff86340072d74e3330665) ) // 840-0073 2001 317-0316-JPN Naomi ROM_PARAMETER( ":rom_board:segam2crypt:key", "294bc3e3" ) @@ -6792,58 +6852,66 @@ ROM_START( derbyo2k ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END -ROM_START( starhrse ) + +/***** Star Horse *****/ +// complete game set, 3 unit types + +// Main Screens +// ROM board ID# 840-0054B +ROM_START( shorsem ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM ROM_REGION( 0x4800000, "rom_board", ROMREGION_ERASEFF) - ROM_LOAD( "epr-23625.ic22", 0x000000, 0x0400000, CRC(7300bc6c) SHA1(f0bfff190c9f02895cc1f98eb695f327c948fca3) ) + ROM_LOAD( "epr-23625.ic22", 0x0000000, 0x0400000, CRC(7300bc6c) SHA1(f0bfff190c9f02895cc1f98eb695f327c948fca3) ) ROM_LOAD( "mpr-23231.ic1", 0x0800000, 0x1000000, CRC(e41ddc53) SHA1(f565d68d8ce4010a2181b0343fa49bfdc81ba4cf) ) ROM_LOAD( "mpr-23232.ic2", 0x1800000, 0x1000000, CRC(30f963a0) SHA1(dc56203ceae20f7a7354e505dd7f27cbce5c70e0) ) ROM_LOAD( "mpr-23233.ic3", 0x2800000, 0x1000000, CRC(d6451cab) SHA1(6508e27d0370b19df01150da7baf4875479c166a) ) ROM_LOAD( "mpr-23234.ic4", 0x3800000, 0x1000000, CRC(44044c14) SHA1(4934cb8d5f9b4085ffb5ddc711343f488aae4c4d) ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes ROM_REGION(0x84, "some_eeprom", 0) - ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(951684e4) SHA1(0beaf5827064252293223b946c04b8698e7207bb) ) + ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(951684e4) SHA1(0beaf5827064252293223b946c04b8698e7207bb) ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END -ROM_START( starhrct ) +// Live and Backup - game logic and player's progress storage, likely there also was 2nd flash ROM board, 840-0034 or similar. +// ROM board ID# 840-0055B +ROM_START( shorsel ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM ROM_REGION( 0x9800000, "rom_board", ROMREGION_ERASEFF) ROM_LOAD( "epr-23626.ic22", 0x0000000, 0x200000, CRC(d5893a19) SHA1(861624ef3e5061b6ed9d6c4714e35fa508643b05) ) ROM_RELOAD( 0x0200000, 0x200000 ) - ROM_LOAD( "ic1s.bin", 0x0800000, 0x800000, CRC(e45ab26f) SHA1(1e40ae9778a026b0f4c3c9681cf5d08397b72c48) ) - ROM_LOAD( "ic2s.bin", 0x1000000, 0x800000, CRC(4d0e4e64) SHA1(4fe1c35f4cf34391eb1e4486bde92bd6104f05f2) ) - ROM_LOAD( "ic3s.bin", 0x1800000, 0x800000, CRC(a18c7ce7) SHA1(1e4fb63c0d8f901b077590ccc0af4bba3135f56c) ) - ROM_LOAD( "ic4s.bin", 0x2000000, 0x800000, CRC(82001b50) SHA1(d06e70d2ae4cf0635872663c5b6f1dbbd12897e0) ) - ROM_LOAD( "ic5s.bin", 0x2800000, 0x800000, CRC(5e4af8b2) SHA1(98598a0f5932cf79f54ff79cfa03632550dee373) ) - ROM_LOAD( "ic6s.bin", 0x3000000, 0x800000, CRC(2950c543) SHA1(041548e79afcadc1b0e3524432ed52320f395f3e) ) - ROM_LOAD( "ic7s.bin", 0x3800000, 0x800000, CRC(a2bb8ebb) SHA1(c5329cedf5f746c0d684d8dea301a0786909ea1d) ) - ROM_LOAD( "ic8s.bin", 0x4000000, 0x800000, CRC(fde9b537) SHA1(b186da26bef43b483fd32c486bb018dc631bf485) ) - ROM_LOAD( "ic9s.bin", 0x4800000, 0x800000, CRC(4db3e79a) SHA1(de2480792e7dfc01195000607be90fd4b29fdcc0) ) - ROM_LOAD( "ic10s.bin", 0x5000000, 0x800000, CRC(37167167) SHA1(e379d20bcda84e6aaa0b930dce95d97812cd45d6) ) - ROM_LOAD( "ic11s.bin", 0x5800000, 0x800000, CRC(927f1edb) SHA1(64f2f2f4546cc6b45ee78aeae68ce829cb57a124) ) - ROM_LOAD( "ic12s.bin", 0x6000000, 0x800000, CRC(05de610d) SHA1(715124a3e7a23589c4ca9f0dccd55a21f7d48123) ) - ROM_LOAD( "ic13s.bin", 0x6800000, 0x800000, CRC(17ed44c3) SHA1(ec34276006c3be7bd6d23c11314b0369a082e1ef) ) - ROM_LOAD( "ic14s.bin", 0x7000000, 0x800000, CRC(66d7e2a1) SHA1(69178d4995ac3c2d73d953544101d23da1812f65) ) - ROM_LOAD( "ic15s.bin", 0x7800000, 0x800000, CRC(0c701416) SHA1(6c9e882e2a00768f5e0a28d38a5695c65594d8dd) ) - ROM_LOAD( "ic16s.bin", 0x8000000, 0x800000, CRC(5d8e6e8d) SHA1(03045f3a9257632c325eba9752855b42355dff6c) ) - ROM_LOAD( "ic17s.bin", 0x8800000, 0x800000, CRC(b4c40606) SHA1(4f187dfe44bd89c90b6fa4b90f16222bc0a74d22) ) + ROM_LOAD( "rom1.ic1s", 0x0800000, 0x800000, CRC(e45ab26f) SHA1(1e40ae9778a026b0f4c3c9681cf5d08397b72c48) ) + ROM_LOAD( "rom2.ic2s", 0x1000000, 0x800000, CRC(4d0e4e64) SHA1(4fe1c35f4cf34391eb1e4486bde92bd6104f05f2) ) + ROM_LOAD( "rom3.ic3s", 0x1800000, 0x800000, CRC(a18c7ce7) SHA1(1e4fb63c0d8f901b077590ccc0af4bba3135f56c) ) + ROM_LOAD( "rom4.ic4s", 0x2000000, 0x800000, CRC(82001b50) SHA1(d06e70d2ae4cf0635872663c5b6f1dbbd12897e0) ) + ROM_LOAD( "rom5.ic5s", 0x2800000, 0x800000, CRC(5e4af8b2) SHA1(98598a0f5932cf79f54ff79cfa03632550dee373) ) + ROM_LOAD( "rom6.ic6s", 0x3000000, 0x800000, CRC(2950c543) SHA1(041548e79afcadc1b0e3524432ed52320f395f3e) ) + ROM_LOAD( "rom7.ic7s", 0x3800000, 0x800000, CRC(a2bb8ebb) SHA1(c5329cedf5f746c0d684d8dea301a0786909ea1d) ) + ROM_LOAD( "rom8.ic8s", 0x4000000, 0x800000, CRC(fde9b537) SHA1(b186da26bef43b483fd32c486bb018dc631bf485) ) + ROM_LOAD( "rom9.ic9s", 0x4800000, 0x800000, CRC(4db3e79a) SHA1(de2480792e7dfc01195000607be90fd4b29fdcc0) ) + ROM_LOAD( "rom10.ic10s", 0x5000000, 0x800000, CRC(37167167) SHA1(e379d20bcda84e6aaa0b930dce95d97812cd45d6) ) + ROM_LOAD( "rom11.ic11s", 0x5800000, 0x800000, CRC(927f1edb) SHA1(64f2f2f4546cc6b45ee78aeae68ce829cb57a124) ) + ROM_LOAD( "rom12.ic12s", 0x6000000, 0x800000, CRC(05de610d) SHA1(715124a3e7a23589c4ca9f0dccd55a21f7d48123) ) + ROM_LOAD( "rom13.ic13s", 0x6800000, 0x800000, CRC(17ed44c3) SHA1(ec34276006c3be7bd6d23c11314b0369a082e1ef) ) + ROM_LOAD( "rom14.ic14s", 0x7000000, 0x800000, CRC(66d7e2a1) SHA1(69178d4995ac3c2d73d953544101d23da1812f65) ) + ROM_LOAD( "rom15.ic15s", 0x7800000, 0x800000, CRC(0c701416) SHA1(6c9e882e2a00768f5e0a28d38a5695c65594d8dd) ) + ROM_LOAD( "rom16.ic16s", 0x8000000, 0x800000, CRC(5d8e6e8d) SHA1(03045f3a9257632c325eba9752855b42355dff6c) ) + ROM_LOAD( "rom17.ic17s", 0x8800000, 0x800000, CRC(b4c40606) SHA1(4f187dfe44bd89c90b6fa4b90f16222bc0a74d22) ) // .18s chip is not present but is tested for an FF fill (pull-up resistors on the PCB's data bus presumably accomplish this) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes ROM_REGION(0x84, "some_eeprom", 0) - ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(1557297e) SHA1(41e8a7a8eaf5076b124d378afdf97e328d100e72) ) + ROM_LOAD( "sflash.ic37", 0x000000, 0x000084, CRC(1557297e) SHA1(41e8a7a8eaf5076b124d378afdf97e328d100e72) ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END -ROM_START( starhrcl ) +// Satellite +// ROM board ID# 840-0056B +ROM_START( shorse ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM @@ -6857,15 +6925,124 @@ ROM_START( starhrcl ) ROM_LOAD( "mpr-23280.ic6", 0x5800000, 0x1000000, CRC(b1c8daa2) SHA1(a05fb374156ea013e35502abccc92f5117c39daa) ) ROM_LOAD( "mpr-23281.ic7", 0x6800000, 0x0800000, CRC(c0378369) SHA1(c728a181eddb01b9f8574669d4550baed559a5a4) ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes ROM_REGION(0x84, "some_eeprom", 0) - ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(4929e940) SHA1(f8c4277ca0ae5e36b2eed033cc731b8fc4fccafc) ) + ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(4929e940) SHA1(f8c4277ca0ae5e36b2eed033cc731b8fc4fccafc) ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END -// this is satellite unit of the main game, server/control and lagre screen units required and need to be dumped -ROM_START( starhrsp ) + +/***** Star Horse 2001 *****/ +// currently we have only Satellite unit ROM board dumped, server/control and large screen units is missing. +// ID# 837-14114-01-91 +// ROM board ID# 840-0078B REV.B +ROM_START( shors2k1 ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x7800000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD("epr-23739b.ic22", 0x00000000, 0x00400000, CRC(2d19b6a2) SHA1(1cf0294a32a870b34164786db9df29dd23cf790a) ) + ROM_LOAD("mpr-23740.ic1", 0x00800000, 0x01000000, CRC(e84f8611) SHA1(4b6f174cac37b6c50d2151e25bba52c87ac738fe) ) + ROM_LOAD("mpr-23741.ic2", 0x01800000, 0x01000000, CRC(5fd84c54) SHA1(2913a1d67674de2cc0165ec0e7556288ca2ea6c6) ) + ROM_LOAD("mpr-23742.ic3", 0x02800000, 0x01000000, CRC(240e1779) SHA1(ac25c217e9772d16465f26d1ad7f514d745e9ec2) ) + ROM_LOAD("mpr-23743.ic4", 0x03800000, 0x01000000, CRC(d9dc0a12) SHA1(d374a09d6e7a94075720b137879e64daca197ef8) ) + ROM_LOAD("mpr-23744.ic5", 0x04800000, 0x01000000, CRC(95759982) SHA1(e09c20d1acad55f8cfb38dfec7c55ec97165190c) ) + ROM_LOAD("mpr-23745.ic6", 0x05800000, 0x01000000, CRC(0eda5807) SHA1(589aac6262dc4168793fd41bb88760123408328f) ) + ROM_LOAD("mpr-23746.ic7", 0x06800000, 0x01000000, CRC(955bb184) SHA1(05436d4eed330bc0b71897650d9df601453cde6f) ) + + ROM_REGION(0x84, "some_eeprom", 0) + ROM_LOAD( "sflash.ic46", 0x000000, 0x000084, CRC(bfce576f) SHA1(c3aa638c280a12df71a09c55adc2b87c37cf4f90) ) + + ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated +ROM_END + + +/***** Star Horse 2002 *****/ +// nothing dumped + + +/***** Star Horse Progress *****/ +// complete game set, this game setup have 4 following unit types and 5 different ROM boards. + +// Main Screens, ID# 837-14373-01 and 837-14374-01 +// ROM board ID# 840-0120B REV.B +ROM_START( shorsepm ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x6800000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD("epr-24087b.ic22", 0x00000000, 0x00400000, CRC(9388f109) SHA1(b441bacd1af14ba0488c0f25fd6e6657b1de0cf6) ) + ROM_LOAD("mpr-24088.ic1", 0x00800000, 0x01000000, CRC(386d9a06) SHA1(c923be8a60a15bc7a747aa4a3c0ed66cc00aae79) ) + ROM_LOAD("mpr-24089.ic2", 0x01800000, 0x01000000, CRC(404e231b) SHA1(fa6f4c9a8463c3216468330a819efe8ecf31e278) ) + ROM_LOAD("mpr-24090.ic3", 0x02800000, 0x01000000, CRC(48fb173d) SHA1(e5de093c96b6aebafe6ec8f36bad5a033590ad34) ) + ROM_LOAD("mpr-24091.ic4", 0x03800000, 0x01000000, CRC(7c92174c) SHA1(8e53f31a2a9e088caf46344e6850dfbb2b9cc638) ) + ROM_LOAD("mpr-24092.ic5", 0x04800000, 0x01000000, CRC(d32299a6) SHA1(e9bf05f9e8691d0ee4fb15346958b5bea738da30) ) + ROM_LOAD("mpr-24093.ic6", 0x05800000, 0x01000000, CRC(6491dd68) SHA1(8777ceae12d8267bd9867385d0dc1facc6dac66c) ) + + ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated +ROM_END + +// Sound & Backup, ID# 837-14375-01, have 2 stacked ROM boards +// ROM board ID# 840-0121B REV.A +ROM_START( shorseps ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x6800000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD("epr-24097a.ic22", 0x00000000, 0x00400000, CRC(ec61a9e8) SHA1(a418be12eeaa4a9c43d1c5dc87ecb5c48857a436) ) + ROM_LOAD("mpr-24098.ic1", 0x00800000, 0x01000000, CRC(c55b45be) SHA1(3dd42a8e21323026742ae764f0a22d96475b55e0) ) + ROM_LOAD("mpr-24099.ic2", 0x01800000, 0x01000000, CRC(e3f0f02e) SHA1(66bcbc251b43688bdc0000a1a9fd463d01ee4e04) ) + ROM_LOAD("mpr-24100.ic3", 0x02800000, 0x01000000, CRC(a5f3cbe9) SHA1(a290d0b1c2c249cbc0473357bde73e4187c96c0d) ) + ROM_LOAD("mpr-24101.ic4", 0x03800000, 0x01000000, CRC(daaf9531) SHA1(5a9651c69d3dd6367cf7f92546ffbb4be65635de) ) + ROM_LOAD("mpr-24102.ic5", 0x04800000, 0x01000000, CRC(55121ff3) SHA1(c5bc7839b8f9c93a2e600589ce5e158742afda0e) ) + ROM_LOAD("mpr-24103.ic6", 0x05800000, 0x01000000, CRC(bfbc3569) SHA1(c8ba7df05d675a15b3eb7c941e9ba231a30e746a) ) + + ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated +ROM_END + +// HORSE DATA +// ROM board ID# 840-0034B +// flash ROM board, used to store backup data, probably players saves, mostly empty +ROM_START( shorsepb ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x1800000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD("rom1.ic1s", 0x00800000, 0x00800000, CRC(d1305180) SHA1(07078484ba938af9c1124521e90b1b4540c63fbd) ) + ROM_LOAD("rom2.ic2s", 0x01000000, 0x00800000, CRC(cfb9881d) SHA1(97632db5a99e15fd9256db195bf6ae60f848df74) ) + + ROM_REGION(0x84, "some_eeprom", 0) + ROM_LOAD( "sflash.ic37", 0x000000, 0x000084, CRC(fe8f8f5c) SHA1(839461ab736e0228dec7e2512e1692d6ecc4e664) ) + + ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated +ROM_END + +// Live (game logic server), ID# 837-14376-01 +// ROM board ID# 840-0122B +ROM_START( shorsepl ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0xb800000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD("epr-24107a.ic22", 0x00000000, 0x00400000, CRC(8df0f545) SHA1(b89c0d4bf1d5e95176251b6ea42b1d9f885d14bf) ) + ROM_LOAD("mpr-24108.ic1", 0x00800000, 0x01000000, CRC(e8e9c09c) SHA1(5e3d938fa5958c40c59511eef1f2607af7768cc9) ) + ROM_LOAD("mpr-24109.ic2", 0x01800000, 0x01000000, CRC(a5c103d0) SHA1(8f138146a95553c725298c179776ee312beda6d0) ) + ROM_LOAD("mpr-24110.ic3", 0x02800000, 0x01000000, CRC(58a5a8c2) SHA1(913d9e5f00a657e407855f00bf6db0af621ae2ca) ) + ROM_LOAD("mpr-24111.ic4", 0x03800000, 0x01000000, CRC(dcb17013) SHA1(f5523089f0844d43c1bab2044b5de241455e7526) ) + ROM_LOAD("mpr-24112.ic5", 0x04800000, 0x01000000, CRC(711e656b) SHA1(ef3dc54c92a3347da3c5ca697f2ad550906bd44b) ) + ROM_LOAD("mpr-24113.ic6", 0x05800000, 0x01000000, CRC(d6c7d611) SHA1(48955388e86a9f5aa44319501fd339cc662d5647) ) + ROM_LOAD("mpr-24114.ic7", 0x06800000, 0x01000000, CRC(cb1846b7) SHA1(49d0e51921c2c48b07290cd344b5df73df6d333e) ) + ROM_LOAD("mpr-24115.ic8", 0x07800000, 0x01000000, CRC(73c5168d) SHA1(d999b8d2c3b554ca4c256c1da2a5ad3741a6b3fd) ) + ROM_LOAD("mpr-24116.ic9", 0x08800000, 0x01000000, CRC(e074c41a) SHA1(77d8c5a98bd42d199e8e5a5e53b40fe3a1d5a349) ) + ROM_LOAD("mpr-24117.ic10", 0x09800000, 0x01000000, CRC(d6d33ab2) SHA1(1f4c182ac9eebe7b3d0a14f8984f59ffd6979ac0) ) + ROM_LOAD("mpr-24118.ic11", 0x0a800000, 0x01000000, CRC(99b64022) SHA1(e324f8f042dac1849692a05d8d7aa71d80c36ff3) ) + + ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated +ROM_END + +// Satellite, ID# 837-14377-01 +// ROM board ID# 840-0123B REV.A +ROM_START( shorsep ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM @@ -6882,6 +7059,24 @@ ROM_START( starhrsp ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END + +/***** Star Horse Progress Returns *****/ +// currently we have only Satellite unit ROM board dumped, server/control and large screen units is missing. +// ROM board ID# 840-0186B +ROM_START( shorsepr ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x8000000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD( "fpr-24489.ic8", 0x00000000, 0x4000000, CRC(156797a4) SHA1(b20da57726974c5d772885fe809c4bbf89012db6) ) + ROM_LOAD( "fpr-24490.ic9", 0x04000000, 0x4000000, CRC(b6c40348) SHA1(37b5b334c24536e5b2062c233423f0e3d338e1f2) ) + + // PIC not populated + ROM_REGION( 0x800, "pic_readout", ROMREGION_ERASE00 ) + + ROM_PARAMETER( ":rom_board:id", "5502" ) +ROM_END + /* prototype cartridges for games released on GD-ROM */ ROM_START( puyofevp ) @@ -6914,7 +7109,6 @@ ROM_START( puyofevp ) ROM_COPY( "rom_board", 0x01000000, 0x400000, 0xc00000 ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes ROM_REGION(0x84, "some_eeprom", 0) ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(17150bc9) SHA1(c3af7d91e12141938d2b9e67eb9f5ff961cd09ff) ) @@ -8237,29 +8431,29 @@ ROM_START( soulsurf ) NAOMI_DEFAULT_EEPROM ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) - // Cart has a Sega factory EPROM sticker stating "EPR-23838C" and a Sega factory sticker stating "Rev. A". Seriously. + // Cart has a Sega factory EPROM sticker stating "EPR-23838C" and a Sega factory sticker on cart case stating "Rev. A". ROM_LOAD( "epr-23838c.ic22", 0x000000, 0x400000, CRC(5e5fb00f) SHA1(c5e81ebead9072cc08f09d1715d609cb0f7631ba) ) - ROM_LOAD( "ic1s.bin", 0x0800000, 0x800000, CRC(4f12f789) SHA1(7b79b687fc61e2e981b9e5e8e0939c4ad24a98f0) ) - ROM_LOAD( "ic2s.bin", 0x1000000, 0x800000, CRC(a255d41a) SHA1(3e932527eb68edf3e8538c1ad264a1c599f6a9d5) ) - ROM_LOAD( "ic3s.bin", 0x1800000, 0x800000, CRC(0f8d6577) SHA1(afaf440e667bacc941c0a5418a0e3b0f2bb725b7) ) - ROM_LOAD( "ic4s.bin", 0x2000000, 0x800000, CRC(bdf25bd0) SHA1(f79b1fdba9c48969c49617c43c1919637adb13ba) ) - ROM_LOAD( "ic5s.bin", 0x2800000, 0x800000, CRC(a74b3bb4) SHA1(0ce7cef849061a9af7a61d69dc633f6971a3a63d) ) - ROM_LOAD( "ic6s.bin", 0x3000000, 0x800000, CRC(3cd1f5d5) SHA1(77573c3a60af64e6e6a0eb85d5b8176ed98b0723) ) - ROM_LOAD( "ic7s.bin", 0x3800000, 0x800000, CRC(00d240f5) SHA1(43010fc596f2cdffdff35a6122f2ab02a5251bc0) ) - ROM_LOAD( "ic8s.bin", 0x4000000, 0x800000, CRC(d4907fa1) SHA1(79b1c771819f6e4baa048010bfb940a45370eba2) ) - ROM_LOAD( "ic9s.bin", 0x4800000, 0x800000, CRC(6327d49e) SHA1(a10e3c27f70dbf18e63cf51962b6a79a52eba26c) ) - ROM_LOAD( "ic10s.bin", 0x5000000, 0x800000, CRC(7975dc80) SHA1(81bda50968f0153a0c4432d8d81e817c1e82e5b2) ) - ROM_LOAD( "ic11s.bin", 0x5800000, 0x800000, CRC(a242f682) SHA1(435ea5bb1b3667f9ef3d7de081b15f4e8e6a0d01) ) - ROM_LOAD( "ic12s.bin", 0x6000000, 0x800000, CRC(45fa259e) SHA1(8d7e708e7a2cbc2d60b68715dd79bac28d894d4c) ) - ROM_LOAD( "ic13s.bin", 0x6800000, 0x800000, CRC(e9578063) SHA1(618f66d01f6bdacbf2a3242774a316b130594e02) ) - ROM_LOAD( "ic14s.bin", 0x7000000, 0x800000, CRC(2edc1311) SHA1(bceb54dd29012580e2e6f15f16c6b31195010153) ) - ROM_LOAD( "ic15s.bin", 0x7800000, 0x800000, CRC(416db320) SHA1(34536716a35260d9457703704bb9174fb1616d60) ) - ROM_LOAD( "ic16s.bin", 0x8000000, 0x800000, CRC(2530cc04) SHA1(6425c031e5a129a3c9451bc694b5da8553f154c2) ) - ROM_LOAD( "ic17s.bin", 0x8800000, 0x800000, CRC(9e6afcc2) SHA1(4fb69d834ea12c82e897af47a22dcc47f3c83768) ) - ROM_LOAD( "ic18s.bin", 0x9000000, 0x800000, CRC(854ed5e5) SHA1(e445599f6a9e9d05c279259307edc08bce5d6d1f) ) - ROM_LOAD( "ic19s.bin", 0x9800000, 0x800000, CRC(4f8ec86a) SHA1(406ab9eeccd99fa5515d4a2c229c8db1a5cb8f83) ) - ROM_LOAD( "ic20s.bin", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) ) - ROM_LOAD( "ic21s.bin", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) ) + ROM_LOAD( "rom1.ic1s", 0x0800000, 0x800000, CRC(4f12f789) SHA1(7b79b687fc61e2e981b9e5e8e0939c4ad24a98f0) ) + ROM_LOAD( "rom2.ic2s", 0x1000000, 0x800000, CRC(a255d41a) SHA1(3e932527eb68edf3e8538c1ad264a1c599f6a9d5) ) + ROM_LOAD( "rom3.ic3s", 0x1800000, 0x800000, CRC(0f8d6577) SHA1(afaf440e667bacc941c0a5418a0e3b0f2bb725b7) ) + ROM_LOAD( "rom4.ic4s", 0x2000000, 0x800000, CRC(bdf25bd0) SHA1(f79b1fdba9c48969c49617c43c1919637adb13ba) ) + ROM_LOAD( "rom5.ic5s", 0x2800000, 0x800000, CRC(a74b3bb4) SHA1(0ce7cef849061a9af7a61d69dc633f6971a3a63d) ) + ROM_LOAD( "rom6.ic6s", 0x3000000, 0x800000, CRC(3cd1f5d5) SHA1(77573c3a60af64e6e6a0eb85d5b8176ed98b0723) ) + ROM_LOAD( "rom7.ic7s", 0x3800000, 0x800000, CRC(00d240f5) SHA1(43010fc596f2cdffdff35a6122f2ab02a5251bc0) ) + ROM_LOAD( "rom8.ic8s", 0x4000000, 0x800000, CRC(d4907fa1) SHA1(79b1c771819f6e4baa048010bfb940a45370eba2) ) + ROM_LOAD( "rom9.ic9s", 0x4800000, 0x800000, CRC(6327d49e) SHA1(a10e3c27f70dbf18e63cf51962b6a79a52eba26c) ) + ROM_LOAD( "rom10.ic10s", 0x5000000, 0x800000, CRC(7975dc80) SHA1(81bda50968f0153a0c4432d8d81e817c1e82e5b2) ) + ROM_LOAD( "rom11.ic11s", 0x5800000, 0x800000, CRC(a242f682) SHA1(435ea5bb1b3667f9ef3d7de081b15f4e8e6a0d01) ) + ROM_LOAD( "rom12.ic12s", 0x6000000, 0x800000, CRC(45fa259e) SHA1(8d7e708e7a2cbc2d60b68715dd79bac28d894d4c) ) + ROM_LOAD( "rom13.ic13s", 0x6800000, 0x800000, CRC(e9578063) SHA1(618f66d01f6bdacbf2a3242774a316b130594e02) ) + ROM_LOAD( "rom14.ic14s", 0x7000000, 0x800000, CRC(2edc1311) SHA1(bceb54dd29012580e2e6f15f16c6b31195010153) ) + ROM_LOAD( "rom15.ic15s", 0x7800000, 0x800000, CRC(416db320) SHA1(34536716a35260d9457703704bb9174fb1616d60) ) + ROM_LOAD( "rom16.ic16s", 0x8000000, 0x800000, CRC(2530cc04) SHA1(6425c031e5a129a3c9451bc694b5da8553f154c2) ) + ROM_LOAD( "rom17.ic17s", 0x8800000, 0x800000, CRC(9e6afcc2) SHA1(4fb69d834ea12c82e897af47a22dcc47f3c83768) ) + ROM_LOAD( "rom18.ic18s", 0x9000000, 0x800000, CRC(854ed5e5) SHA1(e445599f6a9e9d05c279259307edc08bce5d6d1f) ) + ROM_LOAD( "rom19.ic19s", 0x9800000, 0x800000, CRC(4f8ec86a) SHA1(406ab9eeccd99fa5515d4a2c229c8db1a5cb8f83) ) + ROM_LOAD( "rom20.ic20s", 0xa000000, 0x800000, CRC(c90b960d) SHA1(66e9f09d1f7f6a991371574a2e095c0e22fb7031) ) + ROM_LOAD( "rom21.ic21s", 0xa800000, 0x800000, CRC(1477c064) SHA1(87fb8d8a91d6bed70b246a8df88fa77fbf3db443) ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END @@ -8304,10 +8498,11 @@ ROM_START( hopper ) ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) ROM_LOAD( "epr-24083.ic11", 0x000000, 0x400000, CRC(2733e65a) SHA1(4a5d109d0531bebd8e8f585789adce98cac2ab93) ) - ROM_REGION( 0x40000, "flash", ROMREGION_ERASEFF) + // Xilinx Spartan XC2S50 configuration EEPROM dump + ROM_REGION( 0x40000, "fpga", ROMREGION_ERASEFF) ROM_LOAD( "315-6358a.ic2", 0x000000, 0x020008, CRC(ef442e67) SHA1(70ac91e2ca1ff2dfba48d566e4de68bd8b82f282) ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes + // actual ROM board doesnt have X76F100 EEPROM, it seems simulated by Actel FPGA ROM_REGION(0x84, "some_eeprom", 0) ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(ddedf494) SHA1(f1529615711a9871051cd09c2a9b95c90d356874) ) @@ -8406,7 +8601,7 @@ ROM_START( clubkprz ) ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes + // actual ROM board doesnt have X76F100 EEPROM, it seems simulated by Actel FPGA ROM_REGION(0x84, "some_eeprom", 0) ROM_LOAD( "at25010.ic3s", 0x000000, 0x000084, CRC(0142d8be) SHA1(5922b6c47b12b19e1fa7bbe9aae391905038a7ff) ) @@ -8439,7 +8634,7 @@ ROM_START( clubkpzb ) ROM_COPY( "rom_board", 0x1000000, 0x400000, 0xc00000 ) - // this dump can't be used as main_eeprom, because that's exactly 0x80 bytes + // actual ROM board doesnt have X76F100 EEPROM, it seems simulated by Actel FPGA ROM_REGION(0x84, "some_eeprom", 0) ROM_LOAD( "sflash.bin", 0x000000, 0x000084, CRC(afff6471) SHA1(c1e1d349ff25191eba09cd7d7186fbe2c6565b81) ) @@ -8985,7 +9180,7 @@ ROM_END // EN cartridges have this area empty (FF-filled), i.e. AW-NET features not used. // JP cartridges have it filled with unique ID, which also means dumps of several JP cartridges will differ by this few bytes. -DRIVER_INIT_MEMBER(naomi_state,atomiswave) +DRIVER_INIT_MEMBER(atomiswave_state,atomiswave) { uint64_t *ROM = (uint64_t *)memregion("awflash")->base(); @@ -8995,7 +9190,7 @@ DRIVER_INIT_MEMBER(naomi_state,atomiswave) aw_ctrl_type = 0; } -READ64_MEMBER(naomi_state::xtrmhnt2_hack_r) +READ64_MEMBER(atomiswave_state::xtrmhnt2_hack_r) { // disable ALL.Net board check if (space.device().safe_pc() == 0xc03cb30) @@ -9010,10 +9205,10 @@ READ64_MEMBER(naomi_state::xtrmhnt2_hack_r) return 0; } -DRIVER_INIT_MEMBER(naomi_state,xtrmhnt2) +DRIVER_INIT_MEMBER(atomiswave_state,xtrmhnt2) { DRIVER_INIT_CALL(atomiswave); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000000, 0x100011f, read64_delegate(FUNC(naomi_state::xtrmhnt2_hack_r), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000000, 0x100011f, read64_delegate(FUNC(atomiswave_state::xtrmhnt2_hack_r), this)); } ROM_START( fotns ) @@ -9597,117 +9792,122 @@ ROM_END /* GDROM */ GAME( 2001, naomigd, 0, naomi, naomi, naomi_state, naomi, ROT0, "Sega", "Naomi GD-ROM Bios", GAME_FLAGS|MACHINE_IS_BIOS_ROOT ) /* 834-xxxxx (Sega Naomi cart with game specific BIOS sets) */ -/* 13636-01 */ GAME( 1998, hotd2, hod2bios, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (USA)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ -/* 13636 */ GAME( 1998, hotd2o, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ -/* none */ GAME( 1998, hotd2p, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (prototype)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ -/* 13842 */ GAME( 1999, f355, f355dlx, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (deluxe, no link)", GAME_FLAGS ) /* specific BIOS "f355dlx" needed */ -/* 13950 */ GAME( 1999, f355twin, f355bios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (twin/deluxe)", GAME_FLAGS ) /* specific BIOS "f355bios" needed */ -/* none */ GAME( 2001, f355twn2, f355bios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge 2 - International Course Edition (twin/deluxe)", GAME_FLAGS ) /* specific BIOS "f355bios" needed */ -/* ????? */ GAME( 1999, alpiltdx, airlbios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Airline Pilots (deluxe) (Rev B)", GAME_FLAGS ) /* specific BIOS "airlbios" needed */ +/* 13636-01 */ GAME( 1998, hotd2, hod2bios, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (USA)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ +/* 13636 */ GAME( 1998, hotd2o, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ +/* none */ GAME( 1998, hotd2p, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (prototype)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ +/* 13842 */ GAME( 1999, f355, f355dlx, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (deluxe, no link)", GAME_FLAGS ) /* specific BIOS "f355dlx" needed */ +/* 13950 */ GAME( 1999, f355twin, f355bios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (twin/deluxe)", GAME_FLAGS ) /* specific BIOS "f355bios" needed */ +/* none */ GAME( 2001, f355twn2, f355bios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge 2 - International Course Edition (twin/deluxe)", GAME_FLAGS ) /* specific BIOS "f355bios" needed */ +/* ????? */ GAME( 1999, alpiltdx, airlbios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Airline Pilots (deluxe) (Rev B)", GAME_FLAGS ) /* specific BIOS "airlbios" needed */ /* 840-xxxxx (Sega Naomi cart games)*/ -/* 0001 */ GAME( 1998, dybbnao, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball NAOMI (Japan)", GAME_FLAGS ) -/* 0002 */ GAME( 1999, crzytaxi, naomi, naomim2, crzytaxi,naomi_state, naomi, ROT0, "Sega", "Crazy Taxi", GAME_FLAGS ) -/* 0003 */ GAME( 1999, zombrvno, zombrvn, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge", GAME_FLAGS ) -/* 0003 */ GAME( 1999, zombrvn, naomi, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge (Rev A)", GAME_FLAGS ) -/* 0004 */ GAME( 1999, ringout, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Ring Out 4x4", GAME_FLAGS ) -/* 0005 */ GAME( 1999, alpilota, naomi, naomim2, alpilota,naomi_state, naomi, ROT0, "Sega", "Airline Pilots (Rev A)", GAME_FLAGS ) /* specific BIOS "airlbios" needed */ -/* 0007 */ GAME( 1999, ggram2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram: All Japan Pro Wrestling 2 (Japan)", GAME_FLAGS ) -/* 0008 */ GAME( 1999, tduno, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! / Unou Nouryoku Check Machine (Japan)", GAME_FLAGS ) -/* 0010 */ GAME( 1999, vs2_2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Striker 2 Ver. 2000 (Rev C)", GAME_FLAGS ) -/* 0011 */ GAME( 1999, toyfight, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Toy Fighter", GAME_FLAGS ) -/* 0012 -01*/GAME( 1999, smlg99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "World Series 99 / Super Major League 99", GAME_FLAGS ) -/* 0013 */ GAME( 1999, jambo, naomi, naomim2, jambo, naomi_state, naomi, ROT0, "Sega", "Jambo! Safari (Rev A)", GAME_FLAGS ) -/* 0015 */ GAME( 1999, vtennis, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Tennis / Power Smash", GAME_FLAGS ) -/* 0016 */ GAME( 1999, derbyoc, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club (Japan, Rev B)", GAME_FLAGS ) -/* 0017 */ GAME( 1999, otrigger, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "OutTrigger", GAME_FLAGS ) -/* 0018 */ GAME( 1999, sgtetris, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Tetris", GAME_FLAGS ) -/* 0019 */ GAME( 1999, dybb99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball '99 (Japan, Rev B)", GAME_FLAGS ) -/* 0020 */ GAME( 1999, samba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (Rev B)", GAME_FLAGS ) -/* none */ GAME( 1999, sambap, samba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (USA, prototype)", GAME_FLAGS ) -/* none */ GAME( 2000, virnbap, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (prototype)", GAME_FLAGS ) -/* 0021 */ GAME( 2000, virnbao, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA", GAME_FLAGS ) -/* 0021-01*/GAME( 2000,virnba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (USA)", GAME_FLAGS ) -/* 0022 */ GAME( 2000, tduno2, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! 2 (Japan)", GAME_FLAGS ) -/* 0023 */ GAME( 2000, 18wheelr, naomi, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (deluxe) (Rev A)", GAME_FLAGS ) -/* 0025 */ GAME( 1999, marstv, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Mars TV (Japan)", GAME_FLAGS ) -/* 0026 */ GAME( 2000, totdo, totd, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead", GAME_FLAGS ) -/* 0026 */ GAME( 2000, totd, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead (Rev A)", GAME_FLAGS ) -/* 0027 */ GAME( 2000, smarinef, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Marine Fishing", GAME_FLAGS ) -/* 0028 */ GAME( 2000, vonot, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtual On Oratorio Tangram M.S.B.S. ver5.66 2000 Edition", GAME_FLAGS ) -/* 0030 */ GAME( 2000, qmegamis, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Quiz Ah Megamisama", GAME_FLAGS ) -/* 0035 */ GAME( 2000, sstrkfgt, naomi, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A)", GAME_FLAGS ) -/* 0035 */ GAME( 2000, sstrkfgta,sstrkfgt, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A, no training mode)", GAME_FLAGS ) -/* 0036 */ GAME( 2000, 18wheels, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (standard)", GAME_FLAGS ) -/* 0037 */ GAME( 2000, 18wheelu, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (upright)", GAME_FLAGS ) -/* 0039 */ GAME( 2000, gram2000, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram 2000", GAME_FLAGS ) -/* 0040 */ GAME( 2000, wwfroyal, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "WWF Royal Rumble", GAME_FLAGS ) -/* 0041 */ GAME( 2000, slasho, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Slashout", GAME_FLAGS ) +/* 0001 */ GAME( 1998, dybbnao, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball NAOMI (Japan)", GAME_FLAGS ) +/* 0002 */ GAME( 1999, crzytaxi, naomi, naomim2, crzytaxi,naomi_state, naomi, ROT0, "Sega", "Crazy Taxi", GAME_FLAGS ) +/* 0003 */ GAME( 1999, zombrvno, zombrvn, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge", GAME_FLAGS ) +/* 0003 */ GAME( 1999, zombrvn, naomi, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge (Rev A)", GAME_FLAGS ) +/* 0004 */ GAME( 1999, ringout, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Ring Out 4x4", GAME_FLAGS ) +/* 0005 */ GAME( 1999, alpilota, naomi, naomim2, alpilota,naomi_state, naomi, ROT0, "Sega", "Airline Pilots (Rev A)", GAME_FLAGS ) /* specific BIOS "airlbios" needed */ +/* 0007 */ GAME( 1999, ggram2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram: All Japan Pro Wrestling 2 (Japan)", GAME_FLAGS ) +/* 0008 */ GAME( 1999, tduno, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! / Unou Nouryoku Check Machine (Japan)", GAME_FLAGS ) +/* 0010 */ GAME( 1999, vs2_2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Striker 2 Ver. 2000 (Rev C)", GAME_FLAGS ) +/* 0011 */ GAME( 1999, toyfight, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Toy Fighter", GAME_FLAGS ) +/* 0012 -01*/ GAME( 1999, smlg99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "World Series 99 / Super Major League 99", GAME_FLAGS ) +/* 0013 */ GAME( 1999, jambo, naomi, naomim2, jambo, naomi_state, naomi, ROT0, "Sega", "Jambo! Safari (Rev A)", GAME_FLAGS ) +/* 0015 */ GAME( 1999, vtennis, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Tennis / Power Smash", GAME_FLAGS ) +/* 0016 */ GAME( 1999, derbyoc, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club (Japan, Rev B)", GAME_FLAGS ) +/* 0017 */ GAME( 1999, otrigger, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "OutTrigger", GAME_FLAGS ) +/* 0018 */ GAME( 1999, sgtetris, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Tetris", GAME_FLAGS ) +/* 0019 */ GAME( 1999, dybb99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball '99 (Japan, Rev B)", GAME_FLAGS ) +/* 0020 */ GAME( 1999, samba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (Rev B)", GAME_FLAGS ) +/* none */ GAME( 1999, sambap, samba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (USA, prototype)", GAME_FLAGS ) +/* none */ GAME( 2000, virnbap, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (prototype)", GAME_FLAGS ) +/* 0021 */ GAME( 2000, virnbao, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA", GAME_FLAGS ) +/* 0021-01 */ GAME( 2000, virnba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (USA)", GAME_FLAGS ) +/* 0022 */ GAME( 2000, tduno2, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! 2 (Japan)", GAME_FLAGS ) +/* 0023 */ GAME( 2000, 18wheelr, naomi, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (deluxe) (Rev A)", GAME_FLAGS ) +/* 0025 */ GAME( 1999, marstv, naomi, naomim2, marstv, naomi_state, naomi, ROT0, "Sega", "Mars TV (Japan)", GAME_FLAGS ) +/* 0026 */ GAME( 2000, totdo, totd, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead", GAME_FLAGS ) +/* 0026 */ GAME( 2000, totd, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead (Rev A)", GAME_FLAGS ) +/* 0027 */ GAME( 2000, smarinef, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Marine Fishing", GAME_FLAGS ) +/* 0028 */ GAME( 2000, vonot, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtual On Oratorio Tangram M.S.B.S. ver5.66 2000 Edition", GAME_FLAGS ) +/* 0030 */ GAME( 2000, qmegamis, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Quiz Ah Megamisama", GAME_FLAGS ) +/* 0034 */ GAME( 2000, shorsepb, shorsep, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse Progress (backup data)", GAME_FLAGS ) +/* 0035 */ GAME( 2000, sstrkfgt, naomi, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A)", GAME_FLAGS ) +/* 0035 */ GAME( 2000, sstrkfgta, sstrkfgt, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A, no training mode)", GAME_FLAGS ) +/* 0036 */ GAME( 2000, 18wheels, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (standard)", GAME_FLAGS ) +/* 0037 */ GAME( 2000, 18wheelu, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (upright)", GAME_FLAGS ) +/* 0039 */ GAME( 2000, gram2000, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram 2000", GAME_FLAGS ) +/* 0040 */ GAME( 2000, wwfroyal, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "WWF Royal Rumble", GAME_FLAGS ) +/* 0041 */ GAME( 2000, slasho, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Slashout", GAME_FLAGS ) // 0042 Ferrari F355 Challenge 2 - International Course Edition (twin/deluxe) - identical to f355twn2 listed above. -/* 0043 */ GAME( 2000, crackndj, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ", GAME_FLAGS ) -/* 0044 */ GAME( 2000, csmasho, csmash, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash", GAME_FLAGS ) -/* 0044 */ GAME( 2000, csmash, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash (Rev A)", GAME_FLAGS ) -/* 0045 */ GAME( 1999, tokyobus, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Fortyfive", "Tokyo Bus Guide (Japan, Rev A)", GAME_FLAGS ) -/* 0047 */ GAME( 2000, samba2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba de Amigo ver. 2000 (Japan)", GAME_FLAGS ) -/* 0048 */ GAME( 2001, alienfnt, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Alien Front (Rev T)", GAME_FLAGS ) -/* 0048 */ GAME( 2001, alienfnta,alienfnt, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Alien Front (Rev A)", GAME_FLAGS ) -/* 0052 */ GAME( 2000, derbyo2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club 2000 Ver.2 (Japan, Rev A)", GAME_FLAGS ) -/* 0054 */ GAME( 2000, starhrse, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (big screens)", GAME_FLAGS ) -/* 0055 */ GAME( 2000, starhrct, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (server)", GAME_FLAGS ) -/* 0056 */ GAME( 2000, starhrcl, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse (satellite)", GAME_FLAGS ) -/* 0064 */ GAME( 2001, wrungpo, wrungp, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP (USA, Rev A)", GAME_FLAGS ) -/* 0064 */ GAME( 2001, wrungp, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP", GAME_FLAGS ) -/* 0068 */ GAME( 2001, crakndj2, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ Part 2 (Japan)", GAME_FLAGS ) -/* 0073 */ GAME( 2001, inunoos, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Inu No Osanpo / Dog Walking (Japan, Export, Rev A)", GAME_FLAGS ) -/* 0083 */ GAME( 2001, derbyoc2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club II Ver.2.1 (Japan, Rev B)", GAME_FLAGS ) -/* 0084 */ GAME( 2001, vtenis2c, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Tennis 2 / Power Smash 2 (Rev A)", GAME_FLAGS ) -/* 0088 */ GAME( 2001, drbyocwc, derbyocw, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club World Edition (Rev C)", GAME_FLAGS ) -/* 0088 */ GAME( 2005, derbyocw, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club World Edition EX (Rev D)", GAME_FLAGS ) -/* 0098 */ GAME( 2002, shootopl, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool", GAME_FLAGS ) -/* 0123 */ GAME( 2003, starhrsp, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse Progress (satellite) (Rev A)", GAME_FLAGS ) -/* 0126 */ GAME( 2003, oinori, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Oinori-daimyoujin Matsuri", GAME_FLAGS ) -/* 0128 */ GAME( 2003, shootpl, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool The Medal / Shootout Pool Prize (Export, Japan, Rev A)", GAME_FLAGS ) -/* 0130 */ GAME( 2002, hopper, naomi, naomi, naomi, naomi_state, naomi, ROT0, "Sega", "SWP Hopper Board", GAME_FLAGS ) -/* 0136 */ GAME( 2004, shootplm, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool The Medal Version B / Shootout Pool Prize Version B (Export, Japan)", GAME_FLAGS ) -/* 0140 */ GAME( 2004, kick4csh, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Kick '4' Cash (Export)", GAME_FLAGS ) -/* 0150 */ GAME( 2003, mtkob2, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Mushiking The King Of Beetle 2K3 2nd (World)", GAME_FLAGS ) // not for Japan -/* 0158 */ GAME( 2005, mushi2k5, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Mushiking The King Of Beetle 2K5 1st (Japan)", GAME_FLAGS ) -/* 0164 */ GAME( 2005, mushi2eo, mushik2e, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 1.001) (World)", GAME_FLAGS ) // not for Japan -/* 0164 */ GAME( 2005, mushik2e, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 2.001) (World)", GAME_FLAGS ) // not for Japan -/* 0166 */ GAME( 2006, zunou, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Touch De Zunou (Japan, Rev A)", GAME_FLAGS ) -/* 0170-01*/GAME( 2007,manicpnc, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Manic Panic Ghosts! (USA, Export)", GAME_FLAGS ) -/* 0170 */ GAME( 2007, pokasuka, manicpnc, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Pokasuka Ghost! (Japan)", GAME_FLAGS ) -/* 0175 */ GAME( 2007, asndynmt, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Asian Dynamite / Dynamite Deka EX", GAME_FLAGS ) -/* 0177 */ GAME( 2007, rhytngk, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega / Nintendo - J.P ROOM", "Rhythm Tengoku (Japan)", GAME_FLAGS ) -/* 0186 */ GAME( 2009, starhrpr, naomi, naomim4, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse Progress Returns (satellite)", GAME_FLAGS ) +/* 0043 */ GAME( 2000, crackndj, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ", GAME_FLAGS ) +/* 0044 */ GAME( 2000, csmasho, csmash, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash", GAME_FLAGS ) +/* 0044 */ GAME( 2000, csmash, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash (Rev A)", GAME_FLAGS ) +/* 0045 */ GAME( 1999, tokyobus, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Fortyfive", "Tokyo Bus Guide (Japan, Rev A)", GAME_FLAGS ) +/* 0047 */ GAME( 2000, samba2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba de Amigo ver. 2000 (Japan)", GAME_FLAGS ) +/* 0048 */ GAME( 2001, alienfnt, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Alien Front (Rev T)", GAME_FLAGS ) +/* 0048 */ GAME( 2001, alienfnta, alienfnt, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Alien Front (Rev A)", GAME_FLAGS ) +/* 0052 */ GAME( 2000, derbyo2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club 2000 Ver.2 (Japan, Rev A)", GAME_FLAGS ) +/* 0054 */ GAME( 2000, shorsem, shorse, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (main screens)", GAME_FLAGS ) +/* 0055 */ GAME( 2000, shorsel, shorse, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (live and backup)", GAME_FLAGS ) +/* 0056 */ GAME( 2000, shorse, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse (satellite)", GAME_FLAGS ) +/* 0064 */ GAME( 2001, wrungpo, wrungp, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP (USA, Rev A)", GAME_FLAGS ) +/* 0064 */ GAME( 2001, wrungp, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP", GAME_FLAGS ) +/* 0068 */ GAME( 2001, crakndj2, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ Part 2 (Japan)", GAME_FLAGS ) +/* 0073 */ GAME( 2001, inunoos, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Inu No Osanpo / Dog Walking (Japan, Export, Rev A)", GAME_FLAGS ) +/* 0078 */ GAME( 2002, shors2k1, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse 2001 (satellite, Rev B)", GAME_FLAGS ) +/* 0083 */ GAME( 2001, derbyoc2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club II Ver.2.1 (Japan, Rev B)", GAME_FLAGS ) +/* 0084 */ GAME( 2001, vtenis2c, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Tennis 2 / Power Smash 2 (Rev A)", GAME_FLAGS ) +/* 0088 */ GAME( 2001, drbyocwc, derbyocw, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club World Edition (Rev C)", GAME_FLAGS ) +/* 0088 */ GAME( 2005, derbyocw, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club World Edition EX (Rev D)", GAME_FLAGS ) +/* 0098 */ GAME( 2002, shootopl, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool", GAME_FLAGS ) +/* 0120 */ GAME( 2003, shorsepm, shorsep, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse Progress (main screens, Rev B)", GAME_FLAGS ) +/* 0121 */ GAME( 2003, shorseps, shorsep, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse Progress (sound & backup, Rev A)", GAME_FLAGS ) +/* 0122 */ GAME( 2003, shorsepl, shorsep, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse Progress (live, Rev A)", GAME_FLAGS ) +/* 0123 */ GAME( 2003, shorsep, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse Progress (satellite, Rev A)", GAME_FLAGS ) +/* 0126 */ GAME( 2003, oinori, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Oinori-daimyoujin Matsuri", GAME_FLAGS ) +/* 0128 */ GAME( 2003, shootpl, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool The Medal / Shootout Pool Prize (Export, Japan, Rev A)", GAME_FLAGS ) +/* 0130 */ GAME( 2002, hopper, naomi, naomi, naomi, naomi_state, naomi, ROT0, "Sega", "SWP Hopper Board", GAME_FLAGS ) +/* 0136 */ GAME( 2004, shootplm, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Shootout Pool The Medal Version B / Shootout Pool Prize Version B (Export, Japan)", GAME_FLAGS ) +/* 0140 */ GAME( 2004, kick4csh, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Kick '4' Cash (Export)", GAME_FLAGS ) +/* 0150 */ GAME( 2003, mtkob2, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Mushiking The King Of Beetle 2K3 2nd (World)", GAME_FLAGS ) // not for Japan +/* 0158 */ GAME( 2005, mushi2k5, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Mushiking The King Of Beetle 2K5 1st (Japan)", GAME_FLAGS ) +/* 0164 */ GAME( 2005, mushi2eo, mushik2e, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 1.001) (World)", GAME_FLAGS ) // not for Japan +/* 0164 */ GAME( 2005, mushik2e, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 2.001) (World)", GAME_FLAGS ) // not for Japan +/* 0166 */ GAME( 2006, zunou, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Touch De Zunou (Japan, Rev A)", GAME_FLAGS ) +/* 0170-01 */ GAME( 2007, manicpnc, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Manic Panic Ghosts! (USA, Export)", GAME_FLAGS ) +/* 0170 */ GAME( 2007, pokasuka, manicpnc, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Pokasuka Ghost! (Japan)", GAME_FLAGS ) +/* 0175 */ GAME( 2007, asndynmt, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Asian Dynamite / Dynamite Deka EX", GAME_FLAGS ) +/* 0177 */ GAME( 2007, rhytngk, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega / Nintendo - J.P ROOM", "Rhythm Tengoku (Japan)", GAME_FLAGS ) +/* 0186 */ GAME( 2009, shorsepr, naomi, naomim4, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse Progress Returns (satellite)", GAME_FLAGS ) // 00xx Mayjinsen (Formation Battle in May) - prototype, never released /* Cartridge prototypes of games released on GD-ROM */ -GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Puyo Puyo Fever (prototype ver 0.01)", GAME_FLAGS ) +/* none */ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Puyo Puyo Fever (prototype ver 0.01)", GAME_FLAGS ) /* 840-xxxxx (Sega Naomi 2 cart games) */ -/* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Wild Riders", GAME_FLAGS ) -/* 0061 */ GAME( 2001, vstrik3co,vstrik3c,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (World)", GAME_FLAGS ) // not for Japan -/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (World, Rev B)", GAME_FLAGS ) // not for Japan -/* 0062 */ GAME( 2001, clubkrto, clubkrt, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS ) -/* 0062 */ GAME( 2001, clubkrtc, clubkrt, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev C)", GAME_FLAGS ) -/* 0062 */ GAME( 2001, clubkrt, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS ) -/* 0080 */ GAME( 2002, vf4cart, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (World)", GAME_FLAGS ) // not for Japan -/* 0087 */ GAME( 2002, kingrt66, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "The King of Route 66 (Rev A)", GAME_FLAGS ) -/* 0095 */ GAME( 2002, soulsurf, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Soul Surfer (Rev A)", GAME_FLAGS ) -/* 0106 */ GAME( 2002, vf4evoct, naomi2, naomi2m1, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (World)", GAME_FLAGS ) // not for Japan -/* 0129 */ GAME( 2003, clubkprz, naomi2, naomi2m1, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart Prize (Export, Japan)", GAME_FLAGS ) -/* 0137 */ GAME( 2004, clubkpzb, naomi2, naomi2m1, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart Prize Version B (Export, Japan)", GAME_FLAGS ) -/* 0139 */ GAME( 2003, clubk2k3, naomi2, naomi2m1, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (2003, Rev A)", GAME_FLAGS ) -/* none */ GAME( 2003, clubk2kp, clubk2k3,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (2003, prototype)", GAME_FLAGS ) +/* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Wild Riders", GAME_FLAGS ) +/* 0061 */ GAME( 2001, vstrik3co,vstrik3c,naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (World)", GAME_FLAGS ) // not for Japan +/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (World, Rev B)", GAME_FLAGS ) // not for Japan +/* 0062 */ GAME( 2001, clubkrto, clubkrt, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS ) +/* 0062 */ GAME( 2001, clubkrtc, clubkrt, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev C)", GAME_FLAGS ) +/* 0062 */ GAME( 2001, clubkrt, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS ) +/* 0080 */ GAME( 2002, vf4cart, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (World)", GAME_FLAGS ) // not for Japan +/* 0087 */ GAME( 2002, kingrt66, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "The King of Route 66 (Rev A)", GAME_FLAGS ) +/* 0095 */ GAME( 2002, soulsurf, naomi2, naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Soul Surfer (Rev A)", GAME_FLAGS ) +/* 0106 */ GAME( 2002, vf4evoct, naomi2, naomi2m1, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (World)", GAME_FLAGS ) // not for Japan +/* 0129 */ GAME( 2003, clubkprz, naomi2, naomi2m1, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart Prize (Export, Japan)", GAME_FLAGS ) +/* 0137 */ GAME( 2004, clubkpzb, naomi2, naomi2m1, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart Prize Version B (Export, Japan)", GAME_FLAGS ) +/* 0139 */ GAME( 2003, clubk2k3, naomi2, naomi2m1, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart: European Session (2003, Rev A)", GAME_FLAGS ) +/* none */ GAME( 2003, clubk2kp, clubk2k3,naomi2m2, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart: European Session (2003, prototype)", GAME_FLAGS ) /* 841-xxxxx ("Licensed by Sega" Naomi cart games)*/ /* 0001 */ GAME( 1999, pstone, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone", GAME_FLAGS ) /* 0002 */ GAME( 1999, suchie3, naomi, naomim2, suchie3, naomi_state,naomi_mp,ROT0, "Jaleco", "Idol Janshi Suchie-Pai 3 (Japan)", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND ) -/* 0003 */ GAME( 1999, doa2a, doa2, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 (Rev A)", GAME_FLAGS ) -/* 0003-01 */ GAME( 1999, doa2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2", GAME_FLAGS ) -/* 0003 */ GAME( 2000, doa2m, doa2, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 Millennium", GAME_FLAGS ) -/* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0, "Marvelous Ent.", "Dengen Tenshi Taisen Janshi Shangri-la", GAME_FLAGS ) // (Build 0728) version taken from service mode +/* 0003 */ GAME( 1999, doa2a, doa2m, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 (Rev A)", GAME_FLAGS ) +/* 0003-01 */ GAME( 1999, doa2, doa2m, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2", GAME_FLAGS ) +/* 0003 */ GAME( 2000, doa2m, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 Millennium", GAME_FLAGS ) +/* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0, "Marvelous Ent.", "Dengen Tenshi Taisen Janshi Shangri-la", GAME_FLAGS ) // (Build 0728) version shown in service mode /* 0005 */ GAME( 1999, spawn, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Todd Mc Farlane / Capcom","Spawn In the Demon's Hand (Rev B)", GAME_FLAGS ) /* 0006 */ GAME( 1999, puyoda, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Compile", "Puyo Puyo Da! (Japan)", GAME_FLAGS ) /* 0007-01 */ GAME( 2000, mvsc2u, mvsc2, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / Marvel", "Marvel Vs. Capcom 2 New Age of Heroes (USA, Rev A)", GAME_FLAGS) @@ -9732,19 +9932,27 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 0062 */ GAME( 2009, radirgyn, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Milestone/Lucky", "Radirgy Noa (Japan)", GAME_FLAGS ) /* HMG016007 */ GAME( 2001, hmgeo, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Heavy Metal Geomatrix (Rev B)", GAME_FLAGS ) -/* Cart games on Namco custom ROM board */ -/* 25209801 */ GAME( 2000, wldkicksa,wldkicks,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (Asia, WK2 Ver.A)", GAME_FLAGS ) -/* 25209801 */ GAME( 2000, wldkicks, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (US, WK3 Ver.A)", GAME_FLAGS ) -/* 25349801 */ GAME( 2000, toukon4, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Shin Nihon Pro Wrestling Toukon Retsuden 4 Arcade Edition (Japan, TRF1 Ver.A)", GAME_FLAGS ) -/* 25469801 */ GAME( 2000, ninjasltj,ninjaslt,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (Japan, NJA1 Ver.A)", GAME_FLAGS ) -/* 25469801 */ GAME( 2000, ninjaslta,ninjaslt,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (Asia, NJA2 Ver.A)", GAME_FLAGS ) -/* 25469801 */ GAME( 2000, ninjasltu,ninjaslt,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (US, NJA3 Ver.A)", GAME_FLAGS ) -/* 25469801 */ GAME( 2000, ninjaslt, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (World, NJA4 Ver.A)", GAME_FLAGS ) -/* 25509801 */ GAME( 2000, wldkicksj,wldkicks,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks PCB (Japan, WKC1 Ver.A)", GAME_FLAGS ) // "PCB" means upright version, uses analog button on control panel to kick the ball -/* 25709801 */ GAME( 2001, gunsur2j, gunsur2, naomim2,naomi, naomi_state, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2 Biohazard Code: Veronica (Japan, BHF1 Ver.E)", GAME_FLAGS ) -/* 25709801 */ GAME( 2001, gunsur2, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2 Biohazard Code: Veronica (Asia, BHF2 Ver.E)", GAME_FLAGS ) -/* 25869812 */ GAME( 2002, mazana, mazan, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Mazan: Flash of the Blade (Asia, MAZ2 Ver.A)", GAME_FLAGS ) -/* 25869812 */ GAME( 2002, mazan, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Mazan: Flash of the Blade (US, MAZ3 Ver.A)", GAME_FLAGS ) +/* Cart games on Namco custom ROM board + for game descriptions below NAMCO region codes decoded as such (same as in older NAMCO hardware): + 1 - Japan + 2 - Asia + 3 - USA + 4 - World + real meaning of 2 and 4 is not clear and seems not correct, 2 more looks like "World", 4 like "some other part of World", possible Europe +*/ +/* 25209801 */ GAME( 2000, wldkicksj, wldkicks, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (Japan, WK1 Ver.A)", GAME_FLAGS ) +/* 25209801 */ GAME( 2000, wldkicksa, wldkicks, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (Asia, WK2 Ver.A)", GAME_FLAGS ) +/* 25209801 */ GAME( 2000, wldkicks, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (US, WK3 Ver.A)", GAME_FLAGS ) +/* 25349801 */ GAME( 2000, toukon4, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Shin Nihon Pro Wrestling Toukon Retsuden 4 Arcade Edition (Japan, TRF1 Ver.A)", GAME_FLAGS ) +/* 25469801 */ GAME( 2000, ninjasltj, ninjaslt, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (Japan, NJA1 Ver.A)", GAME_FLAGS ) +/* 25469801 */ GAME( 2000, ninjaslta, ninjaslt, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (Asia, NJA2 Ver.A)", GAME_FLAGS ) +/* 25469801 */ GAME( 2000, ninjasltu, ninjaslt, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (US, NJA3 Ver.A)", GAME_FLAGS ) +/* 25469801 */ GAME( 2000, ninjaslt, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Ninja Assault (World, NJA4 Ver.A)", GAME_FLAGS ) +/* 25509801 */ GAME( 2000, wldkickspj, wldkicks, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks PCB (Japan, WKC1 Ver.A)", GAME_FLAGS ) // "PCB" means upright version, uses analog button on control panel to kick the ball +/* 25709801 */ GAME( 2001, gunsur2j, gunsur2, naomim2,naomi, naomi_state, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2 Biohazard Code: Veronica (Japan, BHF1 Ver.E)", GAME_FLAGS ) +/* 25709801 */ GAME( 2001, gunsur2, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Capcom / Namco", "Gun Survivor 2 Biohazard Code: Veronica (Asia, BHF2 Ver.E)", GAME_FLAGS ) +/* 25869812 */ GAME( 2002, mazana, mazan, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Mazan: Flash of the Blade (Asia, MAZ2 Ver.A)", GAME_FLAGS ) +/* 25869812 */ GAME( 2002, mazan, naomi, naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "Mazan: Flash of the Blade (US, MAZ3 Ver.A)", GAME_FLAGS ) /* GDS-xxxx (Sega GD-ROM games) */ /* 0001 */ GAME( 2000, confmiss, naomigd, naomigd, hotd2, naomi_state, naomigd, ROT0, "Sega", "Confidential Mission (GDS-0001)", GAME_FLAGS ) @@ -9754,19 +9962,19 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 0003 */ GAME( 2000, sprtjam, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Sports Jam (GDS-0003)", GAME_FLAGS ) /* 0004 */ GAME( 2000, slashout, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Slashout (GDS-0004)", GAME_FLAGS ) /* 0005 */ GAME( 2001, spkrbtl, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Spikers Battle (GDS-0005)", GAME_FLAGS ) -/* 0006 */ GAME( 2001, vstrik3, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (GDS-0006)", GAME_FLAGS ) +/* 0006 */ GAME( 2001, vstrik3, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (GDS-0006)", GAME_FLAGS ) // 0007 /* 0008 */ GAME( 2001, monkeyba, naomigd, naomigd, monkeyba,naomi_state, naomigd, ROT0, "Sega", "Monkey Ball (GDS-0008)", GAME_FLAGS ) // 0009 Dynamic Golf / Virtua Golf (GDS-0009) /* 0009A */ GAME( 2001, dygolf, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Virtua Golf / Dynamic Golf (Rev A) (GDS-0009A)", GAME_FLAGS ) /* 0010 */ GAME( 2001, wsbbgd, naomigd, naomigd, dybbnao, naomi_state, naomigd, ROT0, "Sega", "World Series Baseball / Super Major League (GDS-0010)", GAME_FLAGS ) /* 0011 */ GAME( 1999, vtennisg, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Virtua Tennis / Power Smash (GDS-0011)", GAME_FLAGS ) -/* 0012 */ GAME( 2001, vf4o, vf4, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (GDS-0012)", GAME_FLAGS ) +/* 0012 */ GAME( 2001, vf4o, vf4, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (GDS-0012)", GAME_FLAGS ) // 0012A Virtua Fighter 4 (Rev A) (GDS-0012A) -/* 0012B */ GAME( 2001, vf4b, vf4, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (Rev B) (GDS-0012B)", GAME_FLAGS ) -/* 0012C */ GAME( 2001, vf4, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Version C (GDS-0012C)", GAME_FLAGS ) +/* 0012B */ GAME( 2001, vf4b, vf4, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 (Rev B) (GDS-0012B)", GAME_FLAGS ) +/* 0012C */ GAME( 2001, vf4, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Version C (GDS-0012C)", GAME_FLAGS ) /* 0013 */ GAME( 2001, shaktmsp, naomigd, naomigd, shaktamb, naomi_state, naomigd, ROT0, "Sega", "Shakatto Tambourine Motto Norinori Shinkyoku Tsuika (2K1 SPR) (GDS-0013)", GAME_FLAGS ) -/* 0014 */ GAME( 2001, beachspi, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Beach Spikers (GDS-0014)", GAME_FLAGS ) +/* 0014 */ GAME( 2001, beachspi, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Beach Spikers (GDS-0014)", GAME_FLAGS ) // 0015 Virtua Tennis 2 / Power Smash 2 (GDS-0015) /* 0015A */ GAME( 2001, vtennis2, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Virtua Tennis 2 / Power Smash 2 (Rev A) (GDS-0015A)", GAME_FLAGS ) /* 0016 */ GAME( 2001, shaktamb, naomigd, naomigd, shaktamb, naomi_state, naomigd, ROT0, "Sega", "Shakatto Tambourine Cho Powerup Chu (2K1 AUT) (GDS-0016)", GAME_FLAGS ) @@ -9774,9 +9982,9 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 0018 */ GAME( 2001, lupinsho, naomigd, naomigd, hotd2, naomi_state, naomigd, ROT0, "Sega / Eighting", "Lupin The Third - The Shooting (GDS-0018)", GAME_FLAGS ) // 0018A Lupin The Third - The Shooting (Rev A) (GDS-0018A) /* 0019 */ GAME( 2002, vathlete, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Virtua Athletics / Virtua Athlete (GDS-0019)", GAME_FLAGS ) -/* 0020 */ GAME( 2002, initdo, initd, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Japan) (GDS-0020)", GAME_FLAGS ) +/* 0020 */ GAME( 2002, initdo, initd, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Japan) (GDS-0020)", GAME_FLAGS ) // 0020A Initial D Arcade Stage (Rev A) (GDS-0020A) -/* 0020B */ GAME( 2002, initd, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Rev B) (Japan) (GDS-0020B)", GAME_FLAGS ) +/* 0020B */ GAME( 2002, initd, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Rev B) (Japan) (GDS-0020B)", GAME_FLAGS ) // 0021 Lupin The Third - The Typing (GDS-0021) /* 0021A */ GAME( 2002, luptype, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Lupin The Third - The Typing (Rev A) (GDS-0021A)", GAME_FLAGS ) /* 0022 */ GAME( 2002, mok, naomigd, naomigd, hotd2, naomi_state, naomigd, ROT0, "Sega", "The Maze of the Kings (GDS-0022)", GAME_FLAGS ) @@ -9787,39 +9995,39 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " // 0023D Naomi DIMM Firmware Updater (Rev D) (GDS-0023D) /* 0023E */ GAME( 2001, ngdup23e, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Naomi DIMM Firmware Updater (3.17) (GDS-0023E)", GAME_FLAGS ) // 0024 Virtua Fighter 4 Evolution (GDS-0024) -/* 0024A */ GAME( 2002, vf4evoa, vf4evo, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (Japan) (GDS-0024A)", GAME_FLAGS ) -/* 0024B */ GAME( 2002, vf4evo, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (Version B) (Japan) (GDS-0024B)", GAME_FLAGS ) -/* 0025 */ GAME( 2002, initdexpo,initdexp,naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Export) (GDS-0025)", GAME_FLAGS ) -/* 0025A */ GAME( 2002, initdexp, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Export) (Rev A) (GDS-0025A)", GAME_FLAGS ) -/* 0026 */ GAME( 2002, initdv2jo,initdv2j,naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Japan) (GDS-0026)", GAME_FLAGS ) +/* 0024A */ GAME( 2002, vf4evoa, vf4evo, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (Japan) (GDS-0024A)", GAME_FLAGS ) +/* 0024B */ GAME( 2002, vf4evo, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Evolution (Version B) (Japan) (GDS-0024B)", GAME_FLAGS ) +/* 0025 */ GAME( 2002, initdexpo,initdexp,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Export) (GDS-0025)", GAME_FLAGS ) +/* 0025A */ GAME( 2002, initdexp, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage (Export) (Rev A) (GDS-0025A)", GAME_FLAGS ) +/* 0026 */ GAME( 2002, initdv2jo,initdv2j,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Japan) (GDS-0026)", GAME_FLAGS ) // 0026A Initial D Arcade Stage Ver. 2 (Japan) (Rev A) (GDS-0026A) -/* 0026B */ GAME( 2003, initdv2j, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Japan) (Rev B) (GDS-0026B)", GAME_FLAGS ) -/* 0027 */ GAME( 2003, initdv2e, initdv2j,naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Export) (GDS-0027)", GAME_FLAGS ) +/* 0026B */ GAME( 2003, initdv2j, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Japan) (Rev B) (GDS-0026B)", GAME_FLAGS ) +/* 0027 */ GAME( 2003, initdv2e, initdv2j,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 2 (Export) (GDS-0027)", GAME_FLAGS ) // 0028 // 0029 Club Kart for Cycraft (GDS-0029) -/* 0029A */ GAME( 2003, clubkcyc, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart for Cycraft (Rev A) (GDS-0029A)", GAME_FLAGS ) +/* 0029A */ GAME( 2003, clubkcyc, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Club Kart for Cycraft (Rev A) (GDS-0029A)", GAME_FLAGS ) // 0030 /* 0031 */ GAME( 2003, puyofev, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Puyo Puyo Fever (Japan) (GDS-0031)", GAME_FLAGS ) // 0032 Initial D Arcade Stage Ver. 3 (Japan) (GDS-0032) // 0032A Initial D Arcade Stage Ver. 3 (Japan) (Rev A) (GDS-0032A) -/* 0032B */ GAME( 2004, initdv3jb,initdv3j,naomigd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev B) (GDS-0032B)", GAME_FLAGS ) -/* 0032C */ GAME( 2004, initdv3j, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev C) (GDS-0032C)", GAME_FLAGS ) -/* 0033 */ GAME( 2004, initdv3e, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Export) (GDS-0033)", GAME_FLAGS ) +/* 0032B */ GAME( 2004, initdv3jb,initdv3j,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev B) (GDS-0032B)", GAME_FLAGS ) +/* 0032C */ GAME( 2004, initdv3j, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Japan) (Rev C) (GDS-0032C)", GAME_FLAGS ) +/* 0033 */ GAME( 2004, initdv3e, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 (Export) (GDS-0033)", GAME_FLAGS ) // 0034 // 0035 // 0036 Virtua Fighter 4 Final Tuned (GDS-0036) -/* 0036A */ GAME( 2004, vf4tuneda,vf4tuned,naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (GDS-0036A)", GAME_FLAGS ) +/* 0036A */ GAME( 2004, vf4tuneda,vf4tuned,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (GDS-0036A)", GAME_FLAGS ) // 0036B Virtua Fighter 4 Final Tuned (GDS-0036B) // 0036C Virtua Fighter 4 Final Tuned (GDS-0036C) -/* 0036D */ GAME( 2004, vf4tunedd,vf4tuned,naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (Ver. A) (GDS-0036D)", GAME_FLAGS ) +/* 0036D */ GAME( 2004, vf4tunedd,vf4tuned,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (Ver. A) (GDS-0036D)", GAME_FLAGS ) // 0036E Virtua Fighter 4 Final Tuned (GDS-0036E) -/* 0036F */ GAME( 2004, vf4tuned, naomi2, naomi2gd, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (Ver. B) (GDS-0036F)", GAME_FLAGS ) +/* 0036F */ GAME( 2004, vf4tuned, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Virtua Fighter 4 Final Tuned (Ver. B) (GDS-0036F)", GAME_FLAGS ) // 0037 Dragon Treasure 2 (GDS-0037) /* 0037A */ GAME( 2004, dragntr2, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Dragon Treasure 2 (Rev A) (GDS-0037A)", GAME_FLAGS ) // 0038 // 0039 Initial D Arcade Stage Ver. 3 Cycraft Edition (GDS-0039) -/* 0039A */ GAME( 2006, inidv3ca, inidv3cy,naomigd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 Cycraft Edition (Rev A) (GDS-0039A)", GAME_FLAGS ) -/* 0039B */ GAME( 2006, inidv3cy, naomi2, naomigd, naomi, naomi_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 Cycraft Edition (Rev B) (GDS-0039B)", GAME_FLAGS ) +/* 0039A */ GAME( 2006, inidv3ca, inidv3cy,naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 Cycraft Edition (Rev A) (GDS-0039A)", GAME_FLAGS ) +/* 0039B */ GAME( 2006, inidv3cy, naomi2, naomi2gd, naomi, naomi2_state, naomi2, ROT0, "Sega", "Initial D Arcade Stage Ver. 3 Cycraft Edition (Rev B) (GDS-0039B)", GAME_FLAGS ) // 0040 // 0041 Dragon Treasure 3 (GDS-0041) /* 0041A */ GAME( 2005, dragntr3, naomigd, naomigd, naomi, naomi_state, naomigd, ROT0, "Sega", "Dragon Treasure 3 (Rev A) (GDS-0041A)", GAME_FLAGS ) @@ -9911,36 +10119,36 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* Atomiswave */ -GAME( 2001, awbios, 0, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy", "Atomiswave Bios", GAME_FLAGS|MACHINE_IS_BIOS_ROOT ) - -GAME( 2003, maxspeed, awbios, aw1c, aw1w, naomi_state, atomiswave, ROT0, "SIMS / Sammy", "Maximum Speed", GAME_FLAGS ) -GAME( 2003, sprtshot, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy USA", "Sports Shooting USA", GAME_FLAGS ) -GAME( 2003, ggx15, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Arc System Works / Sammy", "Guilty Gear X ver. 1.5", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2003, demofist, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Polygon Magic / Dimps", "Demolish Fist", GAME_FLAGS ) -GAME( 2003, dolphin, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy", "Dolphin Blue", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2003, kov7sprt, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "IGS / Sammy", "Knights of Valour - The Seven Spirits", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2003, ggisuka, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Arc System Works / Sammy", "Guilty Gear Isuka", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2003, sushibar, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy", "Sushi Bar", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND ) -GAME( 2004, dirtypig, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy", "Dirty Pigskin Football", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2004, rumblef, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2004, rumblefp, rumblef, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish (prototype)", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2004, rangrmsn, awbios, aw2c, aw1w, naomi_state, atomiswave, ROT0, "RIZ Inc./ Sammy", "Ranger Mission", GAME_FLAGS ) -GAME( 2004, salmankt, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Yuki Enterprise / Sammy", "Net Select: Salaryman Kintaro", GAME_FLAGS ) -GAME( 2004, ftspeed, awbios, aw1c, aw1w, naomi_state, atomiswave, ROT0, "Sammy", "Faster Than Speed", GAME_FLAGS ) -GAME( 2005, vfurlong, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Progress / Sammy", "Net Select Horse Racing: Victory Furlong", GAME_FLAGS ) -GAME( 2005, rumblef2, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish 2", GAME_FLAGS ) -GAME( 2005, rumblf2p, rumblef2, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish 2 (prototype)", GAME_FLAGS ) -GAME( 2005, anmlbskt, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT270, "MOSS / Sammy", "Animal Basket", GAME_FLAGS ) -GAME( 2005, ngbc, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum", GAME_FLAGS ) -GAME( 2005, ngbcj, ngbc, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum (Japan)", GAME_FLAGS ) -GAME( 2005, samsptk, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "Samurai Spirits Tenkaichi Kenkakuden", GAME_FLAGS ) -GAME( 2005, kofxi, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters XI", GAME_FLAGS ) -GAME( 2005, fotns, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Arc System Works / Sega", "Fist Of The North Star", GAME_FLAGS ) -GAME( 2005, kofnw, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave", GAME_FLAGS ) -GAME( 2005, kofnwj, kofnw, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave (Japan)", GAME_FLAGS ) -GAME( 2005, xtrmhunt, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sammy", "Extreme Hunting", GAME_FLAGS ) -GAME( 2006, mslug6, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sega / SNK Playmore", "Metal Slug 6", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) -GAME( 2006, xtrmhnt2, awbios, aw2c, aw2c, naomi_state, xtrmhnt2, ROT0, "Sega", "Extreme Hunting 2", GAME_FLAGS ) -GAME( 2008, claychal, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sega", "Sega Clay Challenge", GAME_FLAGS ) -GAME( 2009, basschalo, basschal, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sega", "Sega Bass Fishing Challenge", GAME_FLAGS ) -GAME( 2009, basschal, awbios, aw2c, aw2c, naomi_state, atomiswave, ROT0, "Sega", "Sega Bass Fishing Challenge Version A", GAME_FLAGS ) +GAME( 2001, awbios, 0, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy", "Atomiswave Bios", GAME_FLAGS|MACHINE_IS_BIOS_ROOT ) + +GAME( 2003, maxspeed, awbios, aw1c, aw1w, atomiswave_state, atomiswave, ROT0, "SIMS / Sammy", "Maximum Speed", GAME_FLAGS ) +GAME( 2003, sprtshot, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy USA", "Sports Shooting USA", GAME_FLAGS ) +GAME( 2003, ggx15, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Arc System Works / Sammy", "Guilty Gear X ver. 1.5", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2003, demofist, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Polygon Magic / Dimps", "Demolish Fist", GAME_FLAGS ) +GAME( 2003, dolphin, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy", "Dolphin Blue", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2003, kov7sprt, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "IGS / Sammy", "Knights of Valour - The Seven Spirits", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2003, ggisuka, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Arc System Works / Sammy", "Guilty Gear Isuka", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2003, sushibar, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy", "Sushi Bar", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND ) +GAME( 2004, dirtypig, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy", "Dirty Pigskin Football", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2004, rumblef, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2004, rumblefp, rumblef, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish (prototype)", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2004, rangrmsn, awbios, aw2c, aw1w, atomiswave_state, atomiswave, ROT0, "RIZ Inc./ Sammy", "Ranger Mission", GAME_FLAGS ) +GAME( 2004, salmankt, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Yuki Enterprise / Sammy", "Net Select: Salaryman Kintaro", GAME_FLAGS ) +GAME( 2004, ftspeed, awbios, aw1c, aw1w, atomiswave_state, atomiswave, ROT0, "Sammy", "Faster Than Speed", GAME_FLAGS ) +GAME( 2005, vfurlong, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Progress / Sammy", "Net Select Horse Racing: Victory Furlong", GAME_FLAGS ) +GAME( 2005, rumblef2, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish 2", GAME_FLAGS ) +GAME( 2005, rumblf2p, rumblef2, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish 2 (prototype)", GAME_FLAGS ) +GAME( 2005, anmlbskt, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT270, "MOSS / Sammy", "Animal Basket", GAME_FLAGS ) +GAME( 2005, ngbc, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum", GAME_FLAGS ) +GAME( 2005, ngbcj, ngbc, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum (Japan)", GAME_FLAGS ) +GAME( 2005, samsptk, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "Samurai Spirits Tenkaichi Kenkakuden", GAME_FLAGS ) +GAME( 2005, kofxi, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters XI", GAME_FLAGS ) +GAME( 2005, fotns, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Arc System Works / Sega", "Fist Of The North Star", GAME_FLAGS ) +GAME( 2005, kofnw, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave", GAME_FLAGS ) +GAME( 2005, kofnwj, kofnw, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave (Japan)", GAME_FLAGS ) +GAME( 2005, xtrmhunt, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sammy", "Extreme Hunting", GAME_FLAGS ) +GAME( 2006, mslug6, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sega / SNK Playmore", "Metal Slug 6", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING ) +GAME( 2006, xtrmhnt2, awbios, aw2c, aw2c, atomiswave_state, xtrmhnt2, ROT0, "Sega", "Extreme Hunting 2", GAME_FLAGS ) +GAME( 2008, claychal, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sega", "Sega Clay Challenge", GAME_FLAGS ) +GAME( 2009, basschalo, basschal, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sega", "Sega Bass Fishing Challenge", GAME_FLAGS ) +GAME( 2009, basschal, awbios, aw2c, aw2c, atomiswave_state, atomiswave, ROT0, "Sega", "Sega Bass Fishing Challenge Version A", GAME_FLAGS ) diff --git a/src/mame/drivers/neodriv.hxx b/src/mame/drivers/neodriv.hxx index e635e7e8640..3fddef2b430 100644 --- a/src/mame/drivers/neodriv.hxx +++ b/src/mame/drivers/neodriv.hxx @@ -1659,7 +1659,7 @@ ROM_START( roboarmy ) ROM_LOAD16_WORD_SWAP( "032-p1.p1", 0x000000, 0x080000, CRC(cd11cbd4) SHA1(23163e3da2f07e830a7f4a02aea1cb01a54ccbf3) ) /* TC534200 */ NEO_SFIX_128K( "032-s1.s1", CRC(ac0daa1b) SHA1(93bae4697dc403fce19422752a514326ccf66a91) ) /* TC531000 */ - + NEO_BIOS_AUDIO_128K( "032-m1.m1", CRC(35ec952d) SHA1(8aed30e26d7e2c70dbce5de752df416091066f7b) ) /* TC531001 */ ROM_REGION( 0x200000, "cslot1:ymsnd", 0 ) @@ -1676,7 +1676,7 @@ ROM_END ROM_START( roboarma ) /* MVS AND AES VERSION*/ ROM_REGION( 0x100000, "cslot1:maincpu", ROMREGION_BE|ROMREGION_16BIT ) ROM_LOAD16_WORD_SWAP( "032-epr.p1", 0x000000, 0x080000, CRC(27c773cb) SHA1(597ca73f142b1129cc7780540bb9cfacd47bc6ce) ) /* D27C4000 */ - /* Found on legitimate Robo Army MVS and AES Carts. Debug code button which check control a sound test has been patched out because in a multislot situation that code could have been enabled + /* Found on legitimate Robo Army MVS and AES Carts. Debug code button which check control a sound test has been patched out because in a multislot situation that code could have been enabled that would stop roboarmy from working, sending it into an infinite loop ; correct chip label unknown */ NEO_SFIX_128K( "032-s1.s1", CRC(ac0daa1b) SHA1(93bae4697dc403fce19422752a514326ccf66a91) ) /* TC531000 */ @@ -2828,7 +2828,7 @@ ROM_START( samsho2ka ) /* KOREAN VERSION */ ROM_LOAD16_WORD_SWAP( "063-p1-kan.p1", 0x100000, 0x100000, CRC(147cc6d7) SHA1(8e22305f41a0688786ff55437c25948e6c8fda58) ) ROM_CONTINUE( 0x000000, 0x100000 ) // Basically samsho2k without loading ep1 and ep2 over p1-kan ; The game has been confirmed to exist in this state - + NEO_SFIX_128K( "063-s1-kan.s1", CRC(ff08f80b) SHA1(240c6a1c52edebb49cc99ea08484c6a2d61ebf84) ) NEO_BIOS_AUDIO_128K( "063-m1.m1", CRC(56675098) SHA1(90429fc40d056d480d0e2bbefbc691d9fa260fc4) ) /* TC531001 */ @@ -5893,7 +5893,41 @@ ROM_START( kof99e ) /* Original Version - Encrypted Code & GFX */ ROM_LOAD16_BYTE( "251-c8.c8", 0x3000001, 0x800000, CRC(8d921c68) SHA1(42acf1d27d52a8e3b6262eb7df50693c0b135565) ) /* Plane 2,3 */ /* TC5364205 */ ROM_END -ROM_START( kof99k ) /* Original Version - Encrypted GFX */ /* KOREAN VERSION */ +ROM_START( kof99k ) /* Original Version - Encrypted Code & GFX */ /* KOREAN VERSION */ + ROM_REGION( 0x900000, "cslot1:maincpu", ROMREGION_BE|ROMREGION_16BIT ) + ROM_LOAD16_WORD_SWAP( "kb.neo-sma", 0x0c0000, 0x040000, CRC(9fccc688) SHA1(1a24d0fe7cabe7b346f538e099f1357bbf77bc89) ) /* stored in the custom chip */ + ROM_LOAD16_WORD_SWAP( "151-pg1k.p1", 0x100000, 0x400000, CRC(ef259292) SHA1(e02f2d0c71eac74424507e4845991fbc12821045) ) /* mask rom TC5332205 */ + ROM_LOAD16_WORD_SWAP( "151-pg2k.p2", 0x500000, 0x400000, CRC(f3898ec2) SHA1(c7fd230fbb97a9b171aeae8ff1a5cd39ba7fa9eb) ) /* mask rom TC5332205 */ + + ROM_Y_ZOOM + + /* The Encrypted Boards do not have an s1 rom, data for it comes from the Cx ROMs */ + ROM_REGION( 0x20000, "cslot1:fixed", 0 ) + ROM_FILL( 0x000000, 0x20000, 0x000000 ) + ROM_REGION( 0x20000, "fixedbios", 0 ) + ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) + + NEO_BIOS_AUDIO_128K( "251-m1.m1", CRC(5e74539c) SHA1(6f49a9343cbd026b2c6720ff3fa2e5b1f85e80da) ) /* TC531001 */ + + ROM_REGION( 0x0e00000, "cslot1:ymsnd", 0 ) + ROM_LOAD( "251-v1.v1", 0x000000, 0x400000, CRC(ef2eecc8) SHA1(8ed13b9db92dba3124bc5ba66e3e275885ece24a) ) /* TC5332204 */ + ROM_LOAD( "251-v2.v2", 0x400000, 0x400000, CRC(73e211ca) SHA1(0e60fa64cab6255d9721e2b4bc22e3de64c874c5) ) /* TC5332204 */ + ROM_LOAD( "251-v3.v3", 0x800000, 0x400000, CRC(821901da) SHA1(c6d4975bfaa19a62ed59126cadf2578c0a5c257f) ) /* TC5332204 */ + ROM_LOAD( "251-v4.v4", 0xc00000, 0x200000, CRC(b49e6178) SHA1(dde6f76e958841e8c99b693e13ced9aa9ef316dc) ) /* TC5316200 */ + + ROM_REGION( 0x4000000, "cslot1:sprites", 0 ) + /* Encrypted */ + ROM_LOAD16_BYTE( "251-c1.c1", 0x0000000, 0x800000, CRC(0f9e93fe) SHA1(c7d77f0833c6f526f632e4f2dce59e302f6b9a15) ) /* Plane 0,1 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c2.c2", 0x0000001, 0x800000, CRC(e71e2ea3) SHA1(39c7a326fddbcca3b29c68cdc96aad4d62295c0f) ) /* Plane 2,3 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c3.c3", 0x1000000, 0x800000, CRC(238755d2) SHA1(01125b5c7a28e350f091280b041954fd1ac7c98f) ) /* Plane 0,1 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c4.c4", 0x1000001, 0x800000, CRC(438c8b22) SHA1(ffbc643f5b27dd00f2f95d4ef4c5f29ee814722b) ) /* Plane 2,3 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c5.c5", 0x2000000, 0x800000, CRC(0b0abd0a) SHA1(d5ad324fe523bdc6f09209d236cc4932524a48f1) ) /* Plane 0,1 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c6.c6", 0x2000001, 0x800000, CRC(65bbf281) SHA1(79ae174667a23dabcfe865b6cd6133c86098452e) ) /* Plane 2,3 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c7.c7", 0x3000000, 0x800000, CRC(ff65f62e) SHA1(7cd335fede05b56e15db90ce407c1183a78da4e9) ) /* Plane 0,1 */ /* TC5364205 */ + ROM_LOAD16_BYTE( "251-c8.c8", 0x3000001, 0x800000, CRC(8d921c68) SHA1(42acf1d27d52a8e3b6262eb7df50693c0b135565) ) /* Plane 2,3 */ /* TC5364205 */ +ROM_END + +ROM_START( kof99ka ) /* Original Version - Encrypted GFX */ /* KOREAN VERSION */ ROM_REGION( 0x500000, "cslot1:maincpu", ROMREGION_BE|ROMREGION_16BIT ) ROM_LOAD16_WORD_SWAP( "152-p1.p1", 0x000000, 0x100000, CRC(f2c7ddfa) SHA1(d592eecc53d442c55c2f26a6a721fdf2924d2a5b) ) /* TC538200 */ ROM_LOAD16_WORD_SWAP( "152-p2.sp2", 0x100000, 0x400000, CRC(274ef47a) SHA1(98654b68cc85c19d4a90b46f3110f551fa2e5357) ) /* TC5332205 */ @@ -8791,8 +8825,8 @@ GAME( 1993, fatfurspa, fatfursp, neobase, neogeo, neogeo_state, neogeo, R GAME( 1995, savagere, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Savage Reign / Fu'un Mokushiroku - Kakutou Sousei", MACHINE_SUPPORTS_SAVE ) GAME( 1994, ssideki2, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Super Sidekicks 2 - The World Championship / Tokuten Ou 2 - Real Fight Football (NGM-061 ~ NGH-061)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, samsho2, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Samurai Shodown II / Shin Samurai Spirits - Haohmaru Jigokuhen (NGM-063 ~ NGH-063)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, samsho2k, samsho2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Saulabi Spirits / Jin Saulabi Tu Hon (Korean release of Samurai Shodown II, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, samsho2ka, samsho2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Saulabi Spirits / Jin Saulabi Tu Hon (Korean release of Samurai Shodown II, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, samsho2k, samsho2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Saulabi Spirits / Jin Saulabi Tu Hon (Korean release of Samurai Shodown II, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, samsho2ka, samsho2, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Saulabi Spirits / Jin Saulabi Tu Hon (Korean release of Samurai Shodown II, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, fatfury3, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Fatal Fury 3 - Road to the Final Victory / Garou Densetsu 3 - Haruka-naru Tatakai (NGM-069 ~ NGH-069)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, ssideki3, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Super Sidekicks 3 - The Next Glory / Tokuten Ou 3 - Eikou e no Michi", MACHINE_SUPPORTS_SAVE ) GAME( 1995, kof95, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '95 (NGM-084)", MACHINE_SUPPORTS_SAVE ) @@ -8832,8 +8866,8 @@ GAME( 1998, mslug2, neogeo, neobase, neogeo, neogeo_state, neogeo, R 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 ) -GAME( 1998, kof98ka, 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 2)", 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, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1998, kof98ka, 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, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, kof98h, kof98, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '98 - The Slugfest / King of Fighters '98 - Dream Match Never Ends (NGH-2420)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, lastbld2, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade 2 / Bakumatsu Roman - Dai Ni Maku Gekka no Kenshi (NGM-2430 ~ NGH-2430)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, neocup98, neogeo, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Neo-Geo Cup '98 - The Road to the Victory", MACHINE_SUPPORTS_SAVE ) @@ -8841,7 +8875,8 @@ GAME( 1999, mslugx, neogeo, mslugx, neogeo, neogeo_state, neogeo, R GAME( 1999, kof99, neogeo, kof99, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (NGM-2510)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX */ GAME( 1999, kof99h, kof99, kof99, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (NGH-2510)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX, crashes going into attract demo */ GAME( 1999, kof99e, kof99, kof99, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (earlier)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX */ -GAME( 1999, kof99k, kof99, kof99k, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (Korean release)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted GFX */ +GAME( 1999, kof99k, kof99, kof99, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (Korean release)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX */ +GAME( 1999, kof99ka, kof99, kof99k, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (Korean release, non-encrypted program)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted GFX */ GAME( 1999, kof99p, kof99, neobase, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '99 - Millennium Battle (prototype)", MACHINE_SUPPORTS_SAVE ) GAME( 1999, garou, neogeo, garou, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Garou - Mark of the Wolves (NGM-2530)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX */ GAME( 1999, garouh, garou, garouh, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Garou - Mark of the Wolves (NGM-2530 ~ NGH-2530)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code & GFX */ diff --git a/src/mame/drivers/newbrain.cpp b/src/mame/drivers/newbrain.cpp index 0e4ab95b11b..8c1fe03c27c 100644 --- a/src/mame/drivers/newbrain.cpp +++ b/src/mame/drivers/newbrain.cpp @@ -31,8 +31,8 @@ TODO: - - COPINT @ 84Hz instead of 50Hz? (with clock 3240506 is 50Hz) - - CLKINT arrives too late and COP reads the VFD data before CPU writes it + - COPINT @ 84Hz instead of 50Hz? (with clock 3240506 is 50Hz) + - CLKINT arrives too late and COP reads the VFD data before CPU writes it - VFD does not receive data from main CPU - bitmapped video - accurate video timing @@ -270,7 +270,7 @@ WRITE8_MEMBER( newbrain_state::enrg_w ) // clock enable int clk = BIT(data, 0); - + if (m_clk != clk) { m_clk = clk; check_interrupt(); @@ -497,7 +497,7 @@ WRITE8_MEMBER( newbrain_state::cop_d_w ) if (!m_cop_k6 && k6) { m_403_d = m_y[m_405_q & 0x0f]->read() & 0x0f; - + if (LOG_COP) logerror("%s %s keydata %01x\n", machine().time().as_string(), machine().describe_context(), m_403_d); } diff --git a/src/mame/drivers/nmk16.cpp b/src/mame/drivers/nmk16.cpp index 50046220893..4a9ad0fbb4f 100644 --- a/src/mame/drivers/nmk16.cpp +++ b/src/mame/drivers/nmk16.cpp @@ -7016,6 +7016,59 @@ ROM_START( redhawki ) ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) ) ROM_END +ROM_START( redhawkg ) // original Afega PCB with Delta Coin sticker + ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x002000, CRC(ccd459eb) SHA1(677b03f1e3973f0e1f09272d336c2dd9da8f843c) ) + ROM_CONTINUE(0x20000,0x2000) + ROM_CONTINUE(0x10000,0x2000) + ROM_CONTINUE(0x30000,0x2000) + ROM_CONTINUE(0x04000,0x2000) + ROM_CONTINUE(0x24000,0x2000) + ROM_CONTINUE(0x14000,0x2000) + ROM_CONTINUE(0x34000,0x2000) + ROM_CONTINUE(0x08000,0x2000) + ROM_CONTINUE(0x28000,0x2000) + ROM_CONTINUE(0x18000,0x2000) + ROM_CONTINUE(0x38000,0x2000) + ROM_CONTINUE(0x0c000,0x2000) + ROM_CONTINUE(0x2c000,0x2000) + ROM_CONTINUE(0x1c000,0x2000) + ROM_CONTINUE(0x3c000,0x2000) + + ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x002000, CRC(483802fd) SHA1(4ec2b15bc89c12806dab78ae30f5fe24e26d46eb) ) + ROM_CONTINUE(0x20001,0x2000) + ROM_CONTINUE(0x10001,0x2000) + ROM_CONTINUE(0x30001,0x2000) + ROM_CONTINUE(0x04001,0x2000) + ROM_CONTINUE(0x24001,0x2000) + ROM_CONTINUE(0x14001,0x2000) + ROM_CONTINUE(0x34001,0x2000) + ROM_CONTINUE(0x08001,0x2000) + ROM_CONTINUE(0x28001,0x2000) + ROM_CONTINUE(0x18001,0x2000) + ROM_CONTINUE(0x38001,0x2000) + ROM_CONTINUE(0x0c001,0x2000) + ROM_CONTINUE(0x2c001,0x2000) + ROM_CONTINUE(0x1c001,0x2000) + ROM_CONTINUE(0x3c001,0x2000) + + ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Code */ + ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) + + ROM_REGION( 0x100000, "sprites", 0 ) /* Sprites, 16x16x4 */ + ROM_LOAD16_BYTE( "6.bin", 0x000001, 0x080000, CRC(710c9e3c) SHA1(0fcefffa5334554729d5c278bceb48ba66921361) ) + ROM_LOAD16_BYTE( "7.bin", 0x000000, 0x080000, CRC(a28c8454) SHA1(c4e14d18c24de73da196230f8ea824300d53e64d) ) + + ROM_REGION( 0x080000, "bgtile", 0 ) /* Layer 0, 16x16x8 */ + ROM_LOAD( "4.bin", 0x000000, 0x080000, CRC(aafb3cc4) SHA1(b5f6608c1e05470fdfb22e0a35a8a74974c4d3cf) ) + + ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) /* Layer 1, 8x8x4 */ + // Unused + + ROM_REGION( 0x40000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) ) +ROM_END + ROM_START( redhawkb ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ ROM_LOAD16_BYTE( "rhb-1.bin", 0x000000, 0x020000, CRC(e733ea07) SHA1(b1ffeda633d5e701f0e97c79930a54d7b89a85c5) ) @@ -7951,6 +8004,7 @@ GAME( 1995, dolmen, 0, twinactn, dolmen, driver_device, 0, ROT GAME( 1998, stagger1, 0, stagger1, stagger1, driver_device, 0, ROT270, "Afega", "Stagger I (Japan)", 0 ) GAME( 1997, redhawk, stagger1, stagger1, stagger1, nmk16_state, redhawk, ROT270, "Afega (New Vision Ent. license)", "Red Hawk (US)", 0 ) GAME( 1997, redhawki, stagger1, redhawki, stagger1, driver_device, 0, ROT0, "Afega (Hea Dong Corp license)", "Red Hawk (Italy)", 0 ) // bootleg? strange scroll regs +GAME( 1997, redhawkg, stagger1, redhawki, stagger1, driver_device, 0, ROT0, "Afega", "Red Hawk (Greece)", 0 ) GAME( 1997, redhawke, stagger1, stagger1, stagger1, driver_device, 0, ROT270, "Afega (Excellent Co. license)", "Red Hawk (Excellent Co., Ltd)", 0 ) GAME( 1997, redhawkk, stagger1, stagger1, stagger1, driver_device, 0, ROT270, "Afega", "Red Hawk (Korea)", 0 ) GAME( 1997, redhawkb, stagger1, redhawkb, redhawkb, driver_device, 0, ROT0, "bootleg", "Red Hawk (bootleg)", 0 ) diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp index 2aff0a8543b..2d23998c0c8 100644 --- a/src/mame/drivers/novag6502.cpp +++ b/src/mame/drivers/novag6502.cpp @@ -13,7 +13,8 @@ TODO: - cforteb emulation (was initially sforteba romset) - verify supercon IRQ and beeper frequency - - why is sforte H and 1 leds always on? + - sforte irq active time (21.5us is too long) + - sforte/sexpert led handling is correct? - printer port ****************************************************************************** @@ -51,14 +52,12 @@ instead of magnet sensors. ******************************************************************************/ -#include "emu.h" +#include "includes/novagbase.h" #include "cpu/m6502/m6502.h" #include "cpu/m6502/m65c02.h" #include "bus/rs232/rs232.h" #include "machine/mos6551.h" #include "machine/nvram.h" -#include "sound/beep.h" -#include "video/hd44780.h" // internal artwork #include "novag_sexpert.lh" // clickable @@ -66,55 +65,17 @@ instead of magnet sensors. #include "novag_supercon.lh" // clickable -class novag6502_state : public driver_device +class novag6502_state : public novagbase_state { public: novag6502_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beeper(*this, "beeper"), - m_lcd(*this, "hd44780"), - m_inp_matrix(*this, "IN.%u", 0), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) + : novagbase_state(mconfig, type, tag) { } - // devices/pointers - required_device<cpu_device> m_maincpu; - optional_device<beep_device> m_beeper; - optional_device<hd44780_device> m_lcd; - optional_ioport_array<8> m_inp_matrix; - TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } - // misc common - uint16_t m_inp_mux; // multiplexed keypad mask - uint16_t m_led_select; - uint16_t m_led_data; - - uint16_t read_inputs(int columns); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) - - uint8_t m_lcd_control; - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); - - // Super Constellation + // Super Constellation DECLARE_WRITE8_MEMBER(supercon_mux_w); DECLARE_WRITE8_MEMBER(supercon_control_w); DECLARE_READ8_MEMBER(supercon_input1_r); @@ -127,8 +88,6 @@ public: DECLARE_WRITE8_MEMBER(sexpert_lcd_data_w); DECLARE_READ8_MEMBER(sexpert_input1_r); DECLARE_READ8_MEMBER(sexpert_input2_r); - DECLARE_PALETTE_INIT(sexpert); - HD44780_PIXEL_UPDATE(sexpert_pixel_update); DECLARE_MACHINE_RESET(sexpert); DECLARE_DRIVER_INIT(sexpert); DECLARE_INPUT_CHANGED_MEMBER(sexpert_cpu_freq); @@ -137,16 +96,12 @@ public: // Super Forte DECLARE_WRITE8_MEMBER(sforte_lcd_control_w); DECLARE_WRITE8_MEMBER(sforte_lcd_data_w); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; }; // machine start/reset -void novag6502_state::machine_start() +void novagbase_state::machine_start() { // zerofill memset(m_display_state, 0, sizeof(m_display_state)); @@ -175,7 +130,7 @@ void novag6502_state::machine_start() save_item(NAME(m_lcd_control)); } -void novag6502_state::machine_reset() +void novagbase_state::machine_reset() { } @@ -190,9 +145,9 @@ void novag6502_state::machine_reset() // The device may strobe the outputs very fast, it is unnoticeable to the user. // To prevent flickering here, we need to simulate a decay. -void novag6502_state::display_update() +void novagbase_state::display_update() { - uint32_t active_state[0x20]; + u32 active_state[0x20]; for (int y = 0; y < m_display_maxy; y++) { @@ -205,7 +160,7 @@ void novag6502_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - uint32_t ds = (m_display_decay[y][x] != 0) ? 1 : 0; + u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -243,7 +198,7 @@ void novag6502_state::display_update() memcpy(m_display_cache, active_state, sizeof(m_display_cache)); } -TIMER_DEVICE_CALLBACK_MEMBER(novag6502_state::display_decay_tick) +TIMER_DEVICE_CALLBACK_MEMBER(novagbase_state::display_decay_tick) { // slowly turn off unpowered segments for (int y = 0; y < m_display_maxy; y++) @@ -254,13 +209,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(novag6502_state::display_decay_tick) display_update(); } -void novag6502_state::set_display_size(int maxx, int maxy) +void novagbase_state::set_display_size(int maxx, int maxy) { m_display_maxx = maxx; m_display_maxy = maxy; } -void novag6502_state::set_display_segmask(uint32_t digits, uint32_t mask) +void novagbase_state::set_display_segmask(u32 digits, u32 mask) { // set a segment mask per selected digit, but leave unselected ones alone for (int i = 0; i < 0x20; i++) @@ -271,12 +226,12 @@ void novag6502_state::set_display_segmask(uint32_t digits, uint32_t mask) } } -void novag6502_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update) +void novagbase_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) { set_display_size(maxx, maxy); // update current state - uint32_t mask = (1 << maxx) - 1; + u32 mask = (1 << maxx) - 1; for (int y = 0; y < maxy; y++) m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; @@ -285,11 +240,34 @@ void novag6502_state::display_matrix(int maxx, int maxy, uint32_t setx, uint32_t } +// LCD + +PALETTE_INIT_MEMBER(novagbase_state, novag_lcd) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); // background + palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on + palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off +} + +HD44780_PIXEL_UPDATE(novagbase_state::novag_lcd_pixel_update) +{ + // char size is 5x8 + if (x > 4 || y > 7) + return; + + if (line < 2 && pos < 8) + { + // internal: (8+8)*1, external: 1*16 + bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + } +} + + // generic input handlers -uint16_t novag6502_state::read_inputs(int columns) +u16 novagbase_state::read_inputs(int columns) { - uint16_t ret = 0; + u16 ret = 0; // read selected input rows for (int i = 0; i < columns; i++) @@ -346,34 +324,14 @@ READ8_MEMBER(novag6502_state::supercon_input2_r) Super Expert ******************************************************************************/ -// LCD - -PALETTE_INIT_MEMBER(novag6502_state, sexpert) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); // background - palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on - palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off -} - -HD44780_PIXEL_UPDATE(novag6502_state::sexpert_pixel_update) -{ - // char size is 5x8 - if (x > 4 || y > 7) - return; - - if (line < 2 && pos < 8) - { - // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; - } -} +// TTL/generic WRITE8_MEMBER(novag6502_state::sexpert_lcd_control_w) { // d0: HD44780 RS // d1: HD44780 R/W // d2: HD44780 E - m_lcd_control = data; + m_lcd_control = data & 7; } WRITE8_MEMBER(novag6502_state::sexpert_lcd_data_w) @@ -383,8 +341,6 @@ WRITE8_MEMBER(novag6502_state::sexpert_lcd_data_w) m_lcd->write(space, m_lcd_control & 1, data); } -// TTL/generic - WRITE8_MEMBER(novag6502_state::sexpert_leds_w) { // d0-d7: chessboard leds @@ -398,7 +354,7 @@ WRITE8_MEMBER(novag6502_state::sexpert_mux_w) // d3: enable beeper m_beeper->set_state(data >> 3 & 1); - + // d4-d7: 74145 to input mux/led select m_inp_mux = 1 << (data >> 4 & 0xf) & 0xff; display_matrix(8, 8, m_led_data, m_inp_mux); @@ -427,7 +383,7 @@ void novag6502_state::sexpert_set_cpu_freq() MACHINE_RESET_MEMBER(novag6502_state, sexpert) { membank("bank1")->set_entry(0); - novag6502_state::machine_reset(); + novagbase_state::machine_reset(); } DRIVER_INIT_MEMBER(novag6502_state, sexpert) @@ -458,9 +414,10 @@ WRITE8_MEMBER(novag6502_state::sforte_lcd_data_w) // if lcd is disabled, misc control if (~m_lcd_control & 4) { - // d5,d6: led data - display_matrix(2, 8, data >> 5 & 3, m_inp_mux); - + // d5,d6: led data, but not both at same time? + if ((data & 0x60) != 0x60) + display_matrix(2, 8, data >> 5 & 3, m_inp_mux); + // d7: enable beeper m_beeper->set_state(data >> 7 & 1); } @@ -804,7 +761,7 @@ static MACHINE_CONFIG_START( supercon, novag6502_state ) MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_novag_supercon) /* sound hardware */ @@ -822,7 +779,7 @@ static MACHINE_CONFIG_START( cforte, novag6502_state ) //MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) //MCFG_DEFAULT_LAYOUT(layout_novag_cforte) /* sound hardware */ @@ -849,7 +806,7 @@ static MACHINE_CONFIG_START( sexpert, novag6502_state ) MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) - + MCFG_NVRAM_ADD_1FILL("nvram") MCFG_MACHINE_RESET_OVERRIDE(novag6502_state, sexpert) @@ -863,13 +820,13 @@ static MACHINE_CONFIG_START( sexpert, novag6502_state ) MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(novag6502_state, sexpert) + MCFG_PALETTE_INIT_OWNER(novagbase_state, novag_lcd) MCFG_HD44780_ADD("hd44780") MCFG_HD44780_LCD_SIZE(2, 8) - MCFG_HD44780_PIXEL_UPDATE_CB(novag6502_state, sexpert_pixel_update) + MCFG_HD44780_PIXEL_UPDATE_CB(novagbase_state, novag_lcd_pixel_update) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_novag_sexpert) /* sound hardware */ @@ -883,7 +840,9 @@ static MACHINE_CONFIG_DERIVED( sforte, sexpert ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(sforte_map) - + MCFG_TIMER_MODIFY("irq_on") + MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_32_768kHz/128) - attotime::from_usec(15)) // active for ?us + MCFG_DEFAULT_LAYOUT(layout_novag_sforte) MACHINE_CONFIG_END @@ -902,8 +861,8 @@ ROM_END ROM_START( cforteb ) ROM_REGION( 0x18000, "maincpu", 0 ) - ROM_LOAD("forte_b_l.u3", 0x0000, 0x8000, CRC(e3d194a1) SHA1(80457580d7c57e07895fd14bfdaf14b30952afca) ) - ROM_LOAD("forte_b_h.u1", 0x8000, 0x8000, CRC(dd824be8) SHA1(cd8666b6b525887f9fc48a730b71ceabcf07f3b9) ) + ROM_LOAD("forte_b_l.bin", 0x0000, 0x8000, CRC(e3d194a1) SHA1(80457580d7c57e07895fd14bfdaf14b30952afca) ) + ROM_LOAD("forte_b_h.bin", 0x8000, 0x8000, CRC(dd824be8) SHA1(cd8666b6b525887f9fc48a730b71ceabcf07f3b9) ) ROM_END diff --git a/src/mame/drivers/novag68k.cpp b/src/mame/drivers/novag68k.cpp new file mode 100644 index 00000000000..7319344d262 --- /dev/null +++ b/src/mame/drivers/novag68k.cpp @@ -0,0 +1,316 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/****************************************************************************** + + Novag generic 68000 based chess computer driver + + NOTE: MAME doesn't include a generalized implementation for boardpieces yet, + greatly affecting user playability of emulated electronic board games. + As workaround for the chess games, use an external chess GUI on the side, + such as Arena(in editmode). + + TODO: + - verify irq/beeper timing + - RS232 port + +****************************************************************************** + +Diablo 68000: +- M68000 @ 16MHz, IRQ ~256Hz +- 2*8KB RAM TC5565 battery-backed, 2*32KB hashtable RAM TC55257 3*32KB ROM +- HD44780 LCD controller (16x1) +- R65C51P2 ACIA @ 1.8432MHz, RS232 +- magnetic sensors, 8*8 chessboard leds + +******************************************************************************/ + +#include "includes/novagbase.h" +#include "cpu/m68000/m68000.h" +#include "machine/mos6551.h" +#include "machine/nvram.h" + +// internal artwork +#include "novag_diablo68k.lh" // clickable + + +class novag68k_state : public novagbase_state +{ +public: + novag68k_state(const machine_config &mconfig, device_type type, const char *tag) + : novagbase_state(mconfig, type, tag) + { } + + // Diablo 68000 + DECLARE_WRITE8_MEMBER(diablo68k_control_w); + DECLARE_WRITE8_MEMBER(diablo68k_lcd_data_w); + DECLARE_WRITE8_MEMBER(diablo68k_leds_w); + DECLARE_READ8_MEMBER(diablo68k_input1_r); + DECLARE_READ8_MEMBER(diablo68k_input2_r); +}; + + + +// Devices, I/O + +/****************************************************************************** + Diablo 68000 +******************************************************************************/ + +// TTL + +WRITE8_MEMBER(novag68k_state::diablo68k_control_w) +{ + // d1: HD44780 RS + // other: ? + m_lcd_control = data & 7; + + // d7: enable beeper + m_beeper->set_state(data >> 7 & 1); + + // d4-d6: input mux, led select + m_inp_mux = 1 << (data >> 4 & 0x7) & 0xff; + display_matrix(8, 8, m_led_data, m_inp_mux); + m_led_data = 0; // ? +} + +WRITE8_MEMBER(novag68k_state::diablo68k_lcd_data_w) +{ + // d0-d7: HD44780 data + m_lcd->write(space, m_lcd_control >> 1 & 1, data); +} + +WRITE8_MEMBER(novag68k_state::diablo68k_leds_w) +{ + // d0-d7: chessboard leds + m_led_data = data; +} + +READ8_MEMBER(novag68k_state::diablo68k_input1_r) +{ + // d0-d7: multiplexed inputs (chessboard squares) + return ~read_inputs(8) & 0xff; +} + +READ8_MEMBER(novag68k_state::diablo68k_input2_r) +{ + // d0-d2: multiplexed inputs (side panel) + // other: ? + return ~read_inputs(8) >> 8 & 7; +} + + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +// Diablo 68000 + +static ADDRESS_MAP_START( diablo68k_map, AS_PROGRAM, 16, novag68k_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM + AM_RANGE(0x200000, 0x20ffff) AM_ROM AM_REGION("maincpu", 0x10000) + AM_RANGE(0x280000, 0x28ffff) AM_RAM + AM_RANGE(0x300000, 0x300007) AM_DEVREADWRITE8("acia", mos6551_device, read, write, 0xff00) + AM_RANGE(0x380000, 0x380001) AM_WRITE8(diablo68k_leds_w, 0xff00) AM_READNOP + AM_RANGE(0x3a0000, 0x3a0001) AM_WRITE8(diablo68k_lcd_data_w, 0xff00) + AM_RANGE(0x3c0000, 0x3c0001) AM_READWRITE8(diablo68k_input2_r, diablo68k_control_w, 0xff00) + AM_RANGE(0x3e0000, 0x3e0001) AM_READ8(diablo68k_input1_r, 0xff00) + AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START( cb_magnets ) + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + + PORT_START("IN.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_TOGGLE PORT_NAME("Board Sensor") +INPUT_PORTS_END + + +static INPUT_PORTS_START( diablo68k ) + PORT_INCLUDE( cb_magnets ) + + PORT_MODIFY("IN.0") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Go") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Take Back / Analyze Games") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("->") + + PORT_MODIFY("IN.1") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Set Level") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Flip Display / Time Control") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("<-") + + PORT_MODIFY("IN.2") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Hint / Next Best") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Priority / Tournament Book / Pawn") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Yes/Start / Start of Game") + + PORT_MODIFY("IN.3") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Trace Forward / AutoPlay") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Pro-Op / Restore Game / Rook") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("No/End / End of Game") + + PORT_MODIFY("IN.4") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Clear Board / Delete Pro-Op") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Best Move/Random / Review / Knight") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Print Book / Store Game") + + PORT_MODIFY("IN.5") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Change Color") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Sound / Info / Bishop") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Print Moves / Print Evaluations") + + PORT_MODIFY("IN.6") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_J) PORT_NAME("Verify/Set Up / Pro-Op Book/Both Books") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Solve Mate / Infinite / Queen") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Print List / Acc. Time") + + PORT_MODIFY("IN.7") + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("New Game") + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("Player/Player / Gambit Book / King") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Print Board / Interface") +INPUT_PORTS_END + + + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( diablo68k, novag68k_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) + MCFG_CPU_PERIODIC_INT_DRIVER(novag68k_state, irq2_line_hold, 256) // guessed + MCFG_CPU_PROGRAM_MAP(diablo68k_map) + + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) // arbitrary + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(6*16+1, 10) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16, 0, 10-1) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(novagbase_state, novag_lcd) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 8) + MCFG_HD44780_PIXEL_UPDATE_CB(novagbase_state, novag_lcd_pixel_update) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_novag_diablo68k) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 1024) // guessed + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START( diablo68 ) + ROM_REGION16_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("evenurom.bin", 0x00000, 0x8000, CRC(03477746) SHA1(8bffcb159a61e59bfc45411e319aea6501ebe2f9) ) + ROM_LOAD16_BYTE("oddlrom.bin", 0x00001, 0x8000, CRC(e182dbdd) SHA1(24dacbef2173fa737636e4729ff22ec1e6623ca5) ) + ROM_LOAD16_BYTE("book.bin", 0x10000, 0x8000, CRC(553a5c8c) SHA1(ccb5460ff10766a5ca8008ae2cffcff794318108) ) // no odd rom +ROM_END + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1991, diablo68, 0, 0, diablo68k, diablo68k, driver_device, 0, "Novag", "Diablo 68000", MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/osborne1.cpp b/src/mame/drivers/osborne1.cpp index f94df70c8b5..99b68229b14 100644 --- a/src/mame/drivers/osborne1.cpp +++ b/src/mame/drivers/osborne1.cpp @@ -180,7 +180,7 @@ static INPUT_PORTS_START( osborne1 ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("RESET") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, osborne1_state, reset_key, 0) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) diff --git a/src/mame/drivers/pc.cpp b/src/mame/drivers/pc.cpp index c89282b37da..098a030929f 100644 --- a/src/mame/drivers/pc.cpp +++ b/src/mame/drivers/pc.cpp @@ -38,12 +38,12 @@ Expansion: Expansion box, with 5 ISA slots and space for a 5.25" drive and a har Bondwell BW230 (Pro28 series) ============= Links: http://gallery.fdd5-25.net/details.php?image_id=3463&sessionid=1eaeb42abdf2758a020b16204a2a8e5a ; http://www.zonadepruebas.com/viewtopic.php?t=3696 ; ftp://ftp.whtech.com/emulators/mess/old/Complete%20MESS%20Geneve%20emulation/mess/sysinfo/bondwell.htm -Info: Info is hard to come by. A BW230 is nowhere to be found, the links about the Pro28 series suggest an XT compatible built around a passive backplane and a slot CPU. This is confirmed by the old MESS info. +Info: Info is hard to come by. A BW230 is nowhere to be found, the links about the Pro28 series suggest an XT compatible built around a passive backplane and a slot CPU. This is confirmed by the old MESS info. Form Factor: Desktop CPU: 8088 @ 4.77 MHz (MESS sysinfo: 3.75)/ 8 MHz RAM: 512K / 640K -Bus: at least 2x ISA: 1) CPU, RAM, Floppy controller - 2) Graphics, Game, Parallel +Bus: at least 2x ISA: 1) CPU, RAM, Floppy controller + 2) Graphics, Game, Parallel Video: Hercules/CGA Mass storage: 1x 5.25" 360K and 20/30MB Harddisk. @@ -57,7 +57,7 @@ RAM: 512K / 640K Bus: Proprietary expansion slot, carrying almost all ISA signals Video: On board, MDA/Hercules/CGA Mass storage: 1x 5.25" 360K -On board ports: Floppy, floppy expansion (for Amiga A1010/1011 (720 KB, 3.5") or A1020 (360 KB, 5.25" drives), speaker (but no speaker fitted), mouse, +On board ports: Floppy, floppy expansion (for Amiga A1010/1011 (720 KB, 3.5") or A1020 (360 KB, 5.25" drives), speaker (but no speaker fitted), mouse, Options: 8087 FPU Expansion: Expansion box: 2x ISA @@ -78,8 +78,8 @@ Options: 8087 FPU Zenith SuperSport ======================= -Links: http://www.focushacks.com/zenith/myzenith.html , http://retro-computing.blogspot.de/2006/08/zds-supersport-laptop.html , http://www.minuszerodegrees.net/manuals/Zenith%20Data%20Systems/ZDS%20SupersPort%20-%20Service%20Manual.pdf - http://www.minuszerodegrees.net/manuals/Zenith%20Data%20Systems/ZDS%20SupersPort%20-%20User%20and%20Technical%20Manual.pdf +Links: http://www.focushacks.com/zenith/myzenith.html , http://retro-computing.blogspot.de/2006/08/zds-supersport-laptop.html , http://www.minuszerodegrees.net/manuals/Zenith%20Data%20Systems/ZDS%20SupersPort%20-%20Service%20Manual.pdf + http://www.minuszerodegrees.net/manuals/Zenith%20Data%20Systems/ZDS%20SupersPort%20-%20User%20and%20Technical%20Manual.pdf Info: ZWL-184 to distinguish it from the later 80286 based models Form Factor: Laptop CPU: 80C88 @ 4.77 MHz or 8 MHz @@ -99,9 +99,9 @@ Info: Multitech PC/700 mainboard Form Factor: Desktop CPU: 8088 @ 4.77MHz / 8 MHz RAM: 640KB -Bus: 6x ISA: 1) MDA/Hercules/CGA and parallel port - 2) Floppy, RTC and serial port - 3) (optional) MFM harddisk controller +Bus: 6x ISA: 1) MDA/Hercules/CGA and parallel port + 2) Floppy, RTC and serial port + 3) (optional) MFM harddisk controller Video: MDA/Hercules, exchangable via ISA-slot Mass storage: 1x 5.25" 360K floppy and 1x 5.25" 360K floppy or MFM hard drive (10MB or 20MB) On board ports: parallel, serial, beeper @@ -111,18 +111,18 @@ Options: 8087 FPU NCR PC4i ======== Links: http://www.minuszerodegrees.net/manuals/NCR/NCR%20PC4i%20-%20Technical%20Reference%20Manual%20-%20January%201986.pdf -Info: The earlier PC4 is not quite IBM compatible, the "i" in PC4i indicates full IBM compatibility. - The NCR Graphics card supports a special 640x400 video mode +Info: The earlier PC4 is not quite IBM compatible, the "i" in PC4i indicates full IBM compatibility. + The NCR Graphics card supports a special 640x400 video mode Form Factor: All-in-one desktop CPU: 8088 @ 4.77 MHz RAM: 256K, expandable to 640K -Bus: 7x ISA: 1) (optional) RAM expansion board - 2) empty - 3) 32K Video/Graphics board (64K option) - 4) (optional) Alpha board - 5) empty - 6) (optional) MFM harddisk controller - 7) empty +Bus: 7x ISA: 1) (optional) RAM expansion board + 2) empty + 3) 32K Video/Graphics board (64K option) + 4) (optional) Alpha board + 5) empty + 6) (optional) MFM harddisk controller + 7) empty Video: K510: 4KB Alpha for internal monitor; K511: 32KB Graphics for internal monitor; K512: 32KB upgrade for K512; K140: 16KB Graphics for external monitor; K141: 4KB Alpha for external monitor Display: Mono or color CRT 640x400 pixel Mass storage: 1x 5.25" 360K floppy and 1x 5.25" 360K floppy or 10 MB harddisk @@ -133,7 +133,7 @@ Options: 8087 FPU, K101 memory upgrade in 64K steps, 1.2MB floppy and controller Olivetti M15 ============ Links: http://www.1000bit.it/ad/bro/olivetti/olivettiM15.pdf , http://electrickery.xs4all.nl/comp/m15/ , http://electrickery.xs4all.nl/comp/m15/doc/M15_InstallationAndOperationsGuide.pdf - http://www.museotecnologicamente.it/olivetti-m-15-1987/ , http://www.museotecnologicamente.it/wp-content/uploads/M15_Depliant_inglese.pdf + http://www.museotecnologicamente.it/olivetti-m-15-1987/ , http://www.museotecnologicamente.it/wp-content/uploads/M15_Depliant_inglese.pdf Info: The info brochure has a picture of a working M15. This shows the LCD display with a green background and blue text/graphics. Form Factor: Laptop CPU: 80C88 @ 4.77 MHz @@ -145,7 +145,7 @@ Mass storage: 2x 3.5" 720K drives Ports: serial, parallel, ext. floppy, RTC Expansion: External 5.25" 360K floppy drive - + IBM5550 ======= Information can be found at http://homepage3.nifty.com/ibm5550/index-e.html @@ -169,12 +169,12 @@ Options: Modem, color video output Sanyo MBC-16 ============ -Links: +Links: Info: In the MBC-16 I had, the graphics card had a Sanyo sticker on it, so I assume that was the original graphics card for the machine. Form Factor: Desktop CPU: 8088 @ 8MHz RAM: 640KB -Bus: 3x ISA: 1) ATI Graphics Solution SR https://sites.google.com/site/atiwonderseriesdatabase/ +Bus: 3x ISA: 1) ATI Graphics Solution SR https://sites.google.com/site/atiwonderseriesdatabase/ Video: MDA/CGA/Plantronics Mass storage: 1 or 2 5.25" 360K floppies, MFM harddisk on hardcard or via seperate controller On board ports: serial, parallel, floppy @@ -211,7 +211,7 @@ Links: http://www.atari-computermuseum.de/pc1.htm , http://trelohra.blogspot.de/ Form Factor: Desktop CPU: 8088 @ 4.77 MHz or 8 MHz RAM: 640K -Bus: 5x ISA: 1) Adaptec ACB-2072 RLL Controller Card +Bus: 5x ISA: 1) Adaptec ACB-2072 RLL Controller Card Video: On-board MDA/CGA/Hercules/EGA Mass storage: 1x 5.25" 360K floppy + 30MB RLL harddisk On board ports: floppy, parallel, serial, mouse, speaker @@ -221,20 +221,20 @@ Options: 8087 FPU Eagle 1600 ========== Links: https://archive.org/details/bitsavers_eagleCompu00Brochure_9975235 , http://www.vcfed.org/forum/showthread.php?49510-Eagle-Computer-model-list , http://bitsavers.trailing-edge.com/pdf/eagleComputer/1600/1600_Series_Training_Notes.pdf -Info: Eagle 1620 - 8086/128K, 2 Quad density floppy drives, 4 Expansion slots available, ~1983, Eagle 1630 - 8086/128K, 1 Quad density floppy drive, 10MB HD, 3 Expansion Slots available (Same as 1620 with hard drive), ~1983Eagle 1640 - 8086/512K, 1 Quad density floppy drive, 32MB HD, 3 Expansion Slots available, ~1984 - The native floppy format is 780K, 2 sides, 80 tracks/side, 1024 bytes/sector, 5 sectors per track. Standard 360K disks can be read - Holding "T" and resetting starts a system diagnostics test +Info: Eagle 1620 - 8086/128K, 2 Quad density floppy drives, 4 Expansion slots available, ~1983, Eagle 1630 - 8086/128K, 1 Quad density floppy drive, 10MB HD, 3 Expansion Slots available (Same as 1620 with hard drive), ~1983Eagle 1640 - 8086/512K, 1 Quad density floppy drive, 32MB HD, 3 Expansion Slots available, ~1984 + The native floppy format is 780K, 2 sides, 80 tracks/side, 1024 bytes/sector, 5 sectors per track. Standard 360K disks can be read + Holding "T" and resetting starts a system diagnostics test Form Factor: Desktop CPU: 8086 @ 8 MHz RAM: 128K / 512K -Bus: 8xISA: 1) SASI board, connects to a XEBEC Sl410 SASI => MFM bridge board - 2) Floppy controller - 3) empty - 4) Video/graphics controller board - 5) empty - 6) empty - 7) Serial board: 2x serial, one sync/async, one async only - 8) Parallel board +Bus: 8xISA: 1) SASI board, connects to a XEBEC Sl410 SASI => MFM bridge board + 2) Floppy controller + 3) empty + 4) Video/graphics controller board + 5) empty + 6) empty + 7) Serial board: 2x serial, one sync/async, one async only + 8) Parallel board Video: 80x25 text mode, 720x352 pixel graphics mode Mass storage: 1x 5.25" QD 780K floppy and 1x 5.25" QD 820K floppy or 10/30MB MFM harddisk Options: 8087 FPU, EagleNet File server, EightPort serial card, High Resolution color board and video, Video Cassette Adapter board for 80MB backup on video cassette @@ -245,9 +245,9 @@ Links: http://minuszerodegrees.net/manuals.htm#VTech , http://minuszerodegrees.n Form Factor: Desktop CPU: 8088 @ 4.77 MHz or 10 MHz RAM: 512K / 640K, additionally 512K or 1M EMS on board -Bus: 8xISA: 1) Monochrome graphics/color graphics card - 2) Multi I/O Card (Floppy, 2x serial, parallel, game, RTC) - 3) (optional) hard disk controller +Bus: 8xISA: 1) Monochrome graphics/color graphics card + 2) Multi I/O Card (Floppy, 2x serial, parallel, game, RTC) + 3) (optional) hard disk controller Video: MDA/CGA/Hercules Mass storage: 2x 5.25" 360K floppies and 1 or 2 harddisks (20MB / 30MB / 40MB) On board ports: speaker @@ -259,9 +259,9 @@ Links: http://minuszerodegrees.net/manuals.htm#VTech , http://th99.classic-compu Form Factor: Desktop CPU: 8088 @ 4.77MHz or 10 MHz RAM: 512K / 640K, additionally 512K or 1M EMS on board -Bus: 8x ISA: 1) Monochrome graphics/color graphics card http://th99.classic-computing.de/src/v/U-Z/52547.htm , alternatively an EGA card - 2) Multi I/O Card (Floppy, 2x serial, 1x parallel, game, RTC) http://th99.classic-computing.de/src/i/U-Z/52519.htm - 3) (optional) hard disk controller +Bus: 8x ISA: 1) Monochrome graphics/color graphics card http://th99.classic-computing.de/src/v/U-Z/52547.htm , alternatively an EGA card + 2) Multi I/O Card (Floppy, 2x serial, 1x parallel, game, RTC) http://th99.classic-computing.de/src/i/U-Z/52519.htm + 3) (optional) hard disk controller Video: MDA/Hercules/CGA Mass storage: 2x 5.25" 360K or 1x 5.25" 360K and 1x 3.5" 720K, additional harddisk optional On board ports: speaker @@ -433,7 +433,7 @@ static MACHINE_CONFIG_FRAGMENT( cfg_single_360K ) MCFG_SLOT_DEFAULT_OPTION("525dd") MCFG_SLOT_FIXED(true) MCFG_DEVICE_REMOVE("fdc:1") -MACHINE_CONFIG_END +MACHINE_CONFIG_END //Data General One @@ -547,12 +547,12 @@ static MACHINE_CONFIG_DERIVED ( ncrpc4i, pccga ) //MCFG_DEVICE_MODIFY("mb:isa") MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, nullptr, false) MCFG_ISA8_SLOT_ADD("mb:isa", "isa7", pc_isa8_cards, nullptr, false) - + MCFG_DEVICE_MODIFY(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("640K") MCFG_RAM_EXTRA_OPTIONS("64K, 128K, 256K, 512K") MACHINE_CONFIG_END - + // Siemens Sicomp PC16-05 static DEVICE_INPUT_DEFAULTS_START( siemens ) @@ -844,7 +844,7 @@ ROM_START ( ataripc1 ) ROMX_LOAD( "award_atari_pc_bios_3.06.bin", 0x8000, 0x8000, CRC(256427ce) SHA1(999f6af64b79f88c1d3492f386d9bee08efb50e7), ROM_BIOS(1)) ROM_SYSTEM_BIOS( 1, "v3.08", "v3.08" ) ROMX_LOAD( "award_atari_pc_bios_3.08.bin", 0x8000, 0x8000, CRC(929a2443) SHA1(8e98f3c9180c55b1f5521727779c016083d27960), ROM_BIOS(2)) //same as on Atari PC3, also used on Atari PC2 -ROM_END +ROM_END ROM_START( ataripc3 ) ROM_REGION(0x10000,"bios", 0) @@ -888,26 +888,26 @@ ROM_END ***************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, dgone, ibm5150, 0, dgone, pccga, driver_device, 0, "Data General", "Data General/One" , MACHINE_NOT_WORKING)/* CGA, 2x 3.5" disk drives */ -COMP( 1985, bw230, ibm5150, 0, bondwell, bondwell, pc_state, bondwell, "Bondwell Holding", "BW230 (PRO28 Series)", 0 ) -COMP( 1984, compc1, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-1" , MACHINE_NOT_WORKING) -COMP( 1987, pc10iii, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-10 III" , MACHINE_NOT_WORKING) -COMP( 1992, iskr3104, ibm5150, 0, iskr3104, pccga, driver_device, 0, "Schetmash", "Iskra 3104", MACHINE_NOT_WORKING) -COMP( 1989, mk88, ibm5150, 0, mk88, pccga, driver_device, 0, "<unknown>", "MK-88", MACHINE_NOT_WORKING) -COMP( 1991, poisk2, ibm5150, 0, poisk2, pccga, driver_device, 0, "<unknown>", "Poisk-2", MACHINE_NOT_WORKING) -COMP( 1990, mc1702, ibm5150, 0, pccga, pccga, driver_device, 0, "<unknown>", "Elektronika MC-1702", MACHINE_NOT_WORKING) -COMP( 1987, zdsupers, ibm5150, 0, zenith, pccga, driver_device, 0, "Zenith Data Systems", "SuperSport", 0) -COMP( 1985, sicpc1605, ibm5150, 0, siemens, pccga, driver_device, 0, "Siemens", "Sicomp PC16-05", MACHINE_NOT_WORKING) -COMP( 1985, ncrpc4i, ibm5150, 0, ncrpc4i, pccga, driver_device, 0, "NCR", "PC4i", MACHINE_NOT_WORKING) -COMP( 198?, olivm15, ibm5150, 0, m15, pccga, driver_device, 0, "Olivetti", "M15", 0) -COMP( 1983, ibm5550, ibm5150, 0, ibm5550, pccga, driver_device, 0, "International Business Machines", "IBM 5550", MACHINE_NOT_WORKING) -COMP( 1985, pc7000, ibm5150, 0, pccga, pccga, driver_device, 0, "Sharp", "PC-7000", MACHINE_NOT_WORKING) -COMP( 1988, sx16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "SX-16", MACHINE_NOT_WORKING) -COMP( 198?, mbc16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "MBC-16" , MACHINE_NOT_WORKING) -COMP( 1987, ataripc1, ibm5150, 0, ataripc1, pccga, driver_device, 0, "Atari", "PC1" , 0) -COMP( 1988, ataripc3, ibm5150, 0, pccga, pccga, driver_device, 0, "Atari", "PC3" , 0) -COMP( 1989, ssam88s, ibm5150, 0, pccga, pccga, driver_device, 0, "Samsung", "Samtron 88S" , MACHINE_NOT_WORKING) -COMP( 1983, eagle1600, ibm5150, 0, eagle1600, pccga, driver_device, 0, "Eagle", "1600" , MACHINE_NOT_WORKING) -COMP( 1988, laser_turbo_xt, ibm5150, 0, laser_turbo_xt, 0, driver_device, 0, "VTech", "Laser Turbo XT" , 0) -COMP( 1989, laser_xt3, ibm5150, 0, laser_xt3, 0, driver_device, 0, "VTech", "Laser XT/3" , 0) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, dgone, ibm5150, 0, dgone, pccga, driver_device, 0, "Data General", "Data General/One" , MACHINE_NOT_WORKING)/* CGA, 2x 3.5" disk drives */ +COMP( 1985, bw230, ibm5150, 0, bondwell, bondwell, pc_state, bondwell, "Bondwell Holding", "BW230 (PRO28 Series)", 0 ) +COMP( 1984, compc1, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-1" , MACHINE_NOT_WORKING) +COMP( 1987, pc10iii, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-10 III" , MACHINE_NOT_WORKING) +COMP( 1992, iskr3104, ibm5150, 0, iskr3104, pccga, driver_device, 0, "Schetmash", "Iskra 3104", MACHINE_NOT_WORKING) +COMP( 1989, mk88, ibm5150, 0, mk88, pccga, driver_device, 0, "<unknown>", "MK-88", MACHINE_NOT_WORKING) +COMP( 1991, poisk2, ibm5150, 0, poisk2, pccga, driver_device, 0, "<unknown>", "Poisk-2", MACHINE_NOT_WORKING) +COMP( 1990, mc1702, ibm5150, 0, pccga, pccga, driver_device, 0, "<unknown>", "Elektronika MC-1702", MACHINE_NOT_WORKING) +COMP( 1987, zdsupers, ibm5150, 0, zenith, pccga, driver_device, 0, "Zenith Data Systems", "SuperSport", 0) +COMP( 1985, sicpc1605, ibm5150, 0, siemens, pccga, driver_device, 0, "Siemens", "Sicomp PC16-05", MACHINE_NOT_WORKING) +COMP( 1985, ncrpc4i, ibm5150, 0, ncrpc4i, pccga, driver_device, 0, "NCR", "PC4i", MACHINE_NOT_WORKING) +COMP( 198?, olivm15, ibm5150, 0, m15, pccga, driver_device, 0, "Olivetti", "M15", 0) +COMP( 1983, ibm5550, ibm5150, 0, ibm5550, pccga, driver_device, 0, "International Business Machines", "IBM 5550", MACHINE_NOT_WORKING) +COMP( 1985, pc7000, ibm5150, 0, pccga, pccga, driver_device, 0, "Sharp", "PC-7000", MACHINE_NOT_WORKING) +COMP( 1988, sx16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "SX-16", MACHINE_NOT_WORKING) +COMP( 198?, mbc16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "MBC-16" , MACHINE_NOT_WORKING) +COMP( 1987, ataripc1, ibm5150, 0, ataripc1, pccga, driver_device, 0, "Atari", "PC1" , 0) +COMP( 1988, ataripc3, ibm5150, 0, pccga, pccga, driver_device, 0, "Atari", "PC3" , 0) +COMP( 1989, ssam88s, ibm5150, 0, pccga, pccga, driver_device, 0, "Samsung", "Samtron 88S" , MACHINE_NOT_WORKING) +COMP( 1983, eagle1600, ibm5150, 0, eagle1600, pccga, driver_device, 0, "Eagle", "1600" , MACHINE_NOT_WORKING) +COMP( 1988, laser_turbo_xt, ibm5150, 0, laser_turbo_xt, 0, driver_device, 0, "VTech", "Laser Turbo XT" , 0) +COMP( 1989, laser_xt3, ibm5150, 0, laser_xt3, 0, driver_device, 0, "VTech", "Laser XT/3" , 0) diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index da1f6bebdcc..3285b30972d 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -17,7 +17,8 @@ - some later SWs put "Invalid command byte 05" (Absolutely Mahjong on Epson logo) - investigate on POR bit - test 2dd more - + - clean-ups/split into devices. + TODO (PC-9801RS): - extra features; - keyboard shift doesn't seem to disable properly; @@ -43,7 +44,7 @@ - AD&D Champions of Krynn - AI Shougi (asserts upon loading, 3'5 image?) - Aki no Tsukasa no Fushigi no Kabe (works in PC-9801RS only) - - alice + - alice - Aoki Ookami no Shiroki Mejika - Gengis Khan - Arcshu - Arcus 2 @@ -61,54 +62,54 @@ * Bokosuka Wars - Jangou 2: floppy fails to load after the title screen; - - runners (size assert) - - Sorcerian (2dd image) - - Twilight Zone 3 (2dd image) + - runners (size assert) + - Sorcerian (2dd image) + - Twilight Zone 3 (2dd image) List of per-game TODO: - 4dboxing: inputs are unresponsive; - - 4dboxing: crashes after user disk creation (regression); - - agumixsl: non-interlace mode doesn't resize graphics, has rectangle selection bugs (note: needs GDC = 5 MHz to boot); + - 4dboxing: crashes after user disk creation (regression); + - agumixsl: non-interlace mode doesn't resize graphics, has rectangle selection bugs (note: needs GDC = 5 MHz to boot); - agenesis: fails loading, attempting to read IDE RAM switch port; - - alice: doesn't set bitmap interlace properly, can't do disk swaps via the File Manager; - - applecl1: can't pass hands apparently; - - arctic, fsmoon: Doesn't detect sound board (tied to 0x00ec ports); + - alice: doesn't set bitmap interlace properly, can't do disk swaps via the File Manager; + - applecl1: can't pass hands apparently; + - arctic, fsmoon: Doesn't detect sound board (tied to 0x00ec ports); - atragon: HDD install disk swap doesn't work? - - asokokof: black screen with BGM, executes invalid opcode (previous note "waits at 0x225f6"); + - asokokof: black screen with BGM, executes invalid opcode (previous note "waits at 0x225f6"); - arquelph: beeps out at initial sound check, no voice samples, extra sound board tested; - - bandkun: can't install to HDD, has unemulated sound boards in settings (Roland MT-32 & D-10/D-110, Kawai MSB-98, Korg M1, MIDI); - - bishohzx: Soft House logo uses pseudo-ROZ effect (?), no title screen graphics? - - bishotsu: beeps out before game (missing sound board?), doesn't draw some text? - + - bandkun: can't install to HDD, has unemulated sound boards in settings (Roland MT-32 & D-10/D-110, Kawai MSB-98, Korg M1, MIDI); + - bishohzx: Soft House logo uses pseudo-ROZ effect (?), no title screen graphics? + - bishotsu: beeps out before game (missing sound board?), doesn't draw some text? + - deflektr: no sound, moans about a DIP-SW setting during loading, has timing issues (keyboard being too fast on PC-9801RS); - - edge: has gfx glitch when intro scrolls to top-left; - - edge: user disk creation is offset? + - edge: has gfx glitch when intro scrolls to top-left; + - edge: user disk creation is offset? - idolsaga: Moans with a "(program) ended. remove the floppy disk and turn off the power." - - karateka: no sound; - - lovelyho: Doesn't show kanjis in PC-9801F version (tries to read them thru the 0xa9 port); + - karateka: no sound; + - lovelyho: Doesn't show kanjis in PC-9801F version (tries to read them thru the 0xa9 port); - madoum1, madoum2, madoum3: doesn't display bitmap gfxs during gameplay; - quarth: sound cuts off at title screen, doesn't work on 9801rs (bogus "corrupt .exe" detected); - prinmak2, tim: cursor stays stuck when using mouse (works with keyboard); - puyopuyo: beeps out when it's supposed to play samples, Not supposed to use ADPCM, is it a PIT issue? - runners: wrong double height on the title screen; - - rusty: black stripes when scrolling; - - rusty: voice pitches are too slow (tested with -26 and -86); + - rusty: black stripes when scrolling; + - rusty: voice pitches are too slow (tested with -26 and -86); - win211: EGC drawing issue (byte wide writes?) - - win31: doesn't boot at - - per-game TODO (Dounjishi SW): + - win31: doesn't boot at + + per-game TODO (Dounjishi SW): - Absolutely Mahjong: Transitions are too fast. - + per-game TODO (PC-9821): - Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it; - Policenauts: CD-ROM drive not found; Notes: - - annivers: GRPH (ALT) key cycles through different color schemes (normal, b&w, legacy); + - annivers: GRPH (ALT) key cycles through different color schemes (normal, b&w, legacy); - Animahjong V3 makes advantage of the possibility of installing 2 sound boards, where SFX and BGMs are played on separate chips. - Apple Club 1/2 needs data disks to load properly; - Beast Lord: needs a titan.fnt, in MS-DOS - - fhtag2: product key is 001J0283TA 100001 + - fhtag2: product key is 001J0283TA 100001 - To deprotect BASIC modules set 0xcd7 in ram to 0 ======================================================================================== @@ -542,6 +543,8 @@ public: struct { uint8_t pal_entry; uint8_t r[0x100],g[0x100],b[0x100]; + uint16_t read_bank; + uint16_t write_bank; }m_analog256; struct { uint8_t mode; @@ -592,6 +595,13 @@ public: DECLARE_WRITE16_MEMBER(grcg_gvram_w); DECLARE_READ16_MEMBER(grcg_gvram0_r); DECLARE_WRITE16_MEMBER(grcg_gvram0_w); + + DECLARE_READ16_MEMBER(pc9821_grcg_gvram_r); + DECLARE_WRITE16_MEMBER(pc9821_grcg_gvram_w); + DECLARE_READ16_MEMBER(pc9821_grcg_gvram0_r); + DECLARE_WRITE16_MEMBER(pc9821_grcg_gvram0_w); + uint16_t m_pc9821_256vram_bank; + DECLARE_READ16_MEMBER(upd7220_grcg_r); DECLARE_WRITE16_MEMBER(upd7220_grcg_w); void egc_blit_w(uint32_t offset, uint16_t data, uint16_t mem_mask); @@ -742,7 +752,8 @@ public: #define DISPLAY_REG 7 #define ANALOG_16_MODE 0 -#define ANALOG_256_MODE 0x10 +#define ANALOG_256_MODE (0x20 >> 1) +#define GDC_IS_5MHz (0x84 >> 1) void pc9801_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { @@ -2296,7 +2307,7 @@ READ16_MEMBER(pc9801_state::timestamp_r) /* basically a read-back of various registers */ // bit 1: GDC clock select (port 0x6a, selects with 0x84 & bit 0) -// bit 0: +// bit 0: current setting READ8_MEMBER(pc9801_state::ext2_video_ff_r) { uint8_t res; @@ -2305,14 +2316,46 @@ READ8_MEMBER(pc9801_state::ext2_video_ff_r) switch(m_ext2_ff) { +// case 0x00: ? +// case 0x01: 200 line color / b&w mode (i/o 0x68 -> 0x02) +// case 0x02: Odd-numbered raster mask (i/o 0x68 -> 0x08) case 0x03: res = m_video_ff[DISPLAY_REG]; break; // display reg +// case 0x04: palette mode (i/o 0x6a -> 0x00) +// case 0x05: GDC sync mode (i/o 0x6a -> 0x40) +// case 0x06: unknown (i/o 0x6a -> 0x44) +// case 0x07: EGC compatibility mode (i/o 0x6a -> 0x04) +// case 0x08: Protected mode f/f (i/o 0x6a -> 0x06) +// case 0x09: GDC clock #0 (i/o 0x6a -> 0x82) case 0x0a: res = m_ex_video_ff[ANALOG_256_MODE]; break; // 256 color mode +// case 0x0b: VRAM access mode (i/o 0x6a -> 0x62) +// case 0x0c: unknown +// case 0x0d: VRAM boundary mode (i/o 0x6a -> 0x68) +// case 0x0e: 65536 color GFX mode (i/o 0x6a -> 0x22) +// case 0x0f: 65,536 color palette mode (i/o 0x6a -> 0x24) +// case 0x10: unknown (i/o 0x6a -> 0x6a) +// case 0x11: Reverse mode related (i/o 0x6a -> 0x26) +// case 0x12: 256 color overscan color (i/o 0x6a -> 0x2c) +// case 0x13: Reverse mode related (i/o 0x6a -> 0x28) +// case 0x14: AGDC Drawing processor selection (i/o 0x6a -> 0x66) +// case 0x15: unknown (i/o 0x6a -> 0x60) +// case 0x16: unknown (i/o 0x6a -> 0xc2) +// case 0x17: bitmap config direction (i/o 0x6a -> 0x6c) +// case 0x18: High speed palette write (i/o 0x6a -> 0x2a) +// case 0x19: unknown (i/o 0x6a -> 0x48) +// case 0x1a: unknown (i/o 0x6a -> 0xc8) +// case 0x1b: unknown (i/o 0x6a -> 0x2e) +// case 0x1c: unknown (i/o 0x6a -> 0x6e) +// case 0x1d: unknown (i/o 0x6a -> 0xc0) +// case 0x1e: unknown (i/o 0x6a -> 0x80 or 0x46?) +// case 0x1f: unknown (i/o 0x6a -> 0x08) default: if(m_ext2_ff < 0x20) popmessage("PC-9821: read ext2 f/f with value %02x",m_ext2_ff); break; } + res|= (m_ex_video_ff[GDC_IS_5MHz] << 1); + return res; } @@ -2333,15 +2376,70 @@ WRITE8_MEMBER(pc9801_state::winram_w) offset = (offset & 0x1ffff) | (m_pc9821_window_bank & 0xfe) * 0x10000; }*/ +// TODO: analog 256 mode needs HW tests +READ16_MEMBER(pc9801_state::pc9821_grcg_gvram_r) +{ + if(m_ex_video_ff[ANALOG_256_MODE]) + { + return space.read_word(0xf00000|(offset*2)|((m_analog256.write_bank)*0x8000),mem_mask); + } + + return grcg_gvram_r(space,offset,mem_mask); +} + +WRITE16_MEMBER(pc9801_state::pc9821_grcg_gvram_w) +{ + if(m_ex_video_ff[ANALOG_256_MODE]) + { + space.write_word(0xf00000|(offset*2)|(m_analog256.write_bank*0x8000),data,mem_mask); + return; + } + + grcg_gvram_w(space,offset,data,mem_mask); +} + +READ16_MEMBER(pc9801_state::pc9821_grcg_gvram0_r) +{ + if(m_ex_video_ff[ANALOG_256_MODE]) + { + switch(offset*2) + { + case 4: return m_analog256.write_bank; +// case 6: return m_analog256.read_bank; + } + + //return 0; + } + + return grcg_gvram0_r(space,offset,mem_mask); +} + +WRITE16_MEMBER(pc9801_state::pc9821_grcg_gvram0_w) +{ + if(m_ex_video_ff[ANALOG_256_MODE]) + { + //printf("%08x %08x\n",offset*2,data); + switch(offset*2) + { + case 4: COMBINE_DATA(&m_analog256.write_bank); break; +// case 6: COMBINE_DATA(&m_analog256.read_bank); break; + } + //return; + } + + grcg_gvram0_w(space,offset,data,mem_mask); +} + + static ADDRESS_MAP_START( pc9821_map, AS_PROGRAM, 32, pc9801_state ) //AM_RANGE(0x00080000, 0x0009ffff) AM_READWRITE8(winram_r, winram_w, 0xffffffff) AM_RANGE(0x000a0000, 0x000a3fff) AM_READWRITE16(tvram_r, tvram_w, 0xffffffff) AM_RANGE(0x000a4000, 0x000a4fff) AM_READWRITE8(pc9801rs_knjram_r, pc9801rs_knjram_w, 0xffffffff) - AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE16(grcg_gvram_r, grcg_gvram_w, 0xffffffff) + AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE16(pc9821_grcg_gvram_r, pc9821_grcg_gvram_w, 0xffffffff) AM_RANGE(0x000cc000, 0x000cdfff) AM_ROM AM_REGION("sound_bios",0) //sound BIOS // AM_RANGE(0x000d8000, 0x000d9fff) AM_ROM AM_REGION("ide",0) AM_RANGE(0x000da000, 0x000dbfff) AM_RAM // ide ram - AM_RANGE(0x000e0000, 0x000e7fff) AM_READWRITE16(grcg_gvram0_r,grcg_gvram0_w, 0xffffffff) + AM_RANGE(0x000e0000, 0x000e7fff) AM_READWRITE16(pc9821_grcg_gvram0_r,pc9821_grcg_gvram0_w, 0xffffffff) AM_RANGE(0x000e8000, 0x000fffff) AM_DEVICE16("ipl_bank", address_map_bank_device, amap16, 0xffffffff) AM_RANGE(0x00f00000, 0x00f9ffff) AM_RAM AM_SHARE("ext_gvram") AM_RANGE(0xffee8000, 0xffefffff) AM_DEVICE16("ipl_bank", address_map_bank_device, amap16, 0xffffffff) diff --git a/src/mame/drivers/pcfx.cpp b/src/mame/drivers/pcfx.cpp index 11a5e93e6e6..e04a460d90b 100644 --- a/src/mame/drivers/pcfx.cpp +++ b/src/mame/drivers/pcfx.cpp @@ -13,6 +13,7 @@ #include "cpu/v810/v810.h" #include "video/huc6261.h" #include "video/huc6270.h" +#include "video/huc6271.h" #include "video/huc6272.h" struct pcfx_pad_t @@ -93,7 +94,7 @@ static ADDRESS_MAP_START( pcfx_mem, AS_PROGRAM, 32, pcfx_state ) AM_RANGE( 0xE0000000, 0xE7FFFFFF ) AM_NOP /* BackUp RAM */ AM_RANGE( 0xE8000000, 0xE9FFFFFF ) AM_NOP /* Extended BackUp RAM */ AM_RANGE( 0xF8000000, 0xF8000007 ) AM_NOP /* PIO */ - AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROMBANK("bank1") /* ROM */ + AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROM AM_REGION("ipl", 0) /* ROM */ ADDRESS_MAP_END READ16_MEMBER( pcfx_state::pad_r ) @@ -164,7 +165,7 @@ WRITE16_MEMBER( pcfx_state::pad_w ) */ if(data & 1 && (!(m_pad.ctrl[port_type] & 1))) { - timer_set(attotime::from_msec(1), TIMER_PAD_FUNC, port_type); // TODO: time + timer_set(attotime::from_usec(1000), TIMER_PAD_FUNC, port_type); // TODO: time } m_pad.ctrl[port_type] = data & 7; @@ -181,7 +182,7 @@ WRITE16_MEMBER( pcfx_state::pad_w ) static ADDRESS_MAP_START( pcfx_io, AS_IO, 32, pcfx_state ) AM_RANGE( 0x00000000, 0x000000FF ) AM_READWRITE16(pad_r, pad_w, 0xffffffff) /* PAD */ AM_RANGE( 0x00000100, 0x000001FF ) AM_NOP /* HuC6230 */ - AM_RANGE( 0x00000200, 0x000002FF ) AM_NOP /* HuC6271 */ + AM_RANGE( 0x00000200, 0x000002FF ) AM_DEVICE16( "huc6271", huc6271_device, regs, 0xffff ) /* HuC6271 */ AM_RANGE( 0x00000300, 0x000003FF ) AM_DEVREADWRITE16( "huc6261", huc6261_device, read, write, 0xffff ) /* HuC6261 */ AM_RANGE( 0x00000400, 0x000004FF ) AM_DEVREADWRITE8( "huc6270_a", huc6270_device, read, write, 0xffff ) /* HuC6270-A */ AM_RANGE( 0x00000500, 0x000005FF ) AM_DEVREADWRITE8( "huc6270_b", huc6270_device, read, write, 0xffff ) /* HuC6270-B */ @@ -197,95 +198,28 @@ ADDRESS_MAP_END static INPUT_PORTS_START( pcfx ) /* - xxxx ---- ---- ---- ID (0xf = 6 button pad, 0xe = tap, 0xd = ?) + xxxx ---- ---- ---- ID (0xf = 6 button pad, 0xe = multitap, 0xd = mouse, 0 = none) */ PORT_START("P1") - PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ID - PORT_DIPNAME( 0x01000000, 0x01000000, "1" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x010000, 0x010000, "2" ) - PORT_DIPSETTING( 0x010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x020000, 0x020000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x040000, 0x040000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x080000, 0x080000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x100000, 0x100000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x200000, 0x200000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x400000, 0x400000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x800000, 0x800000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "3" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) // * - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) // * - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1) PORT_NAME("RUN button") - PORT_DIPNAME( 0x01, 0x01, "4" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ID pad + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button I") + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button II") + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button III") + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Button IV") + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Button V") + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Button VI") + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) PORT_NAME("P1 Select Button") + PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1) PORT_NAME("P1 RUN Button") + PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Up") + PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Right") + PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 Down") + PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Left") + PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Switch 1") + PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(1) PORT_NAME("P1 Switch 2") + PORT_BIT( 0x0fffa000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("P2") - PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0xf0000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // ID unconnect PORT_BIT( 0x0fffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END @@ -461,8 +395,6 @@ WRITE_LINE_MEMBER( pcfx_state::irq15_w ) void pcfx_state::machine_reset() { - membank( "bank1" )->set_base( memregion("user1")->base() ); - m_irq_mask = 0xFF; m_irq_pending = 0; } @@ -495,13 +427,18 @@ static MACHINE_CONFIG_START( pcfx, pcfx_state ) MCFG_DEVICE_ADD("huc6261", HUC6261, XTAL_21_4772MHz) MCFG_HUC6261_VDC1("huc6270_a") MCFG_HUC6261_VDC2("huc6270_b") + MCFG_HUC6261_KING("huc6272") MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz ) + MCFG_HUC6272_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq13_w)) + MCFG_HUC6272_RAINBOW("huc6271") + + MCFG_HUC6271_ADD( "huc6271", XTAL_21_4772MHz ) MACHINE_CONFIG_END ROM_START( pcfx ) - ROM_REGION( 0x100000, "user1", 0 ) + ROM_REGION( 0x100000, "ipl", 0 ) ROM_SYSTEM_BIOS( 0, "v100", "BIOS v1.00 - 2 Sep 1994" ) ROMX_LOAD( "pcfxbios.bin", 0x000000, 0x100000, CRC(76ffb97a) SHA1(1a77fd83e337f906aecab27a1604db064cf10074), ROM_BIOS(1) ) ROM_SYSTEM_BIOS( 1, "v101", "BIOS v1.01 - 5 Dec 1994" ) @@ -513,7 +450,7 @@ ROM_END ROM_START( pcfxga ) - ROM_REGION( 0x100000, "user1", 0 ) + ROM_REGION( 0x100000, "ipl", 0 ) ROM_LOAD( "pcfxga.rom", 0x000000, 0x100000, CRC(41c3776b) SHA1(a9372202a5db302064c994fcda9b24d29bb1b41c) ) ROM_REGION( 0x80000, "scsi_rom", ROMREGION_ERASEFF ) diff --git a/src/mame/drivers/peyper.cpp b/src/mame/drivers/peyper.cpp index 79795c2c192..91f5fb46bf8 100644 --- a/src/mame/drivers/peyper.cpp +++ b/src/mame/drivers/peyper.cpp @@ -15,7 +15,7 @@ Nemesis (Peyper) Odisea Paris-Dakar (Peyper) Hang-On (Sonic) - Ator (Videodens) + Ator (Video Dens) Others not emulated (need roms): Night Fever (Sonic) @@ -834,7 +834,7 @@ ROM_START(wolfman) ROM_END /*------------------------------------------------------------------- -/ Ator (198?) +/ Ator (1985) /-------------------------------------------------------------------*/ ROM_START(ator) ROM_REGION(0x6000, "maincpu", 0) @@ -869,5 +869,5 @@ GAME( 1987, wolfman, 0, peyper, wolfman, peyper_state, wolfman, ROT0 GAME( 1986, nemesisp, 0, peyper, wolfman, peyper_state, wolfman, ROT0, "Peyper", "Nemesis", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1987, odisea, 0, peyper, odisea, peyper_state, wolfman, ROT0, "Peyper", "Odisea Paris-Dakar", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) GAME( 1988, hangonp, 0, peyper, sonstwar, peyper_state, peyper, ROT0, "Sonic", "Hang-On (Sonic)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) // inputs to be checked -GAME( 198?, ator, 0, peyper, sonstwar, peyper_state, peyper, ROT0, "Videodens", "Ator", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) // initial program ROM missing; no manual found +GAME( 1985, ator, 0, peyper, sonstwar, peyper_state, peyper, ROT0, "Video Dens", "Ator", MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) // initial program ROM missing; no manual found GAME( 1994, lancelot, 0, peyper, sonstwar, driver_device,0, ROT0, "Peyper", "Sir Lancelot", MACHINE_IS_SKELETON_MECHANICAL) // different hardware (see top of file) diff --git a/src/mame/drivers/pipeline.cpp b/src/mame/drivers/pipeline.cpp index 76869986421..b7298c672b2 100644 --- a/src/mame/drivers/pipeline.cpp +++ b/src/mame/drivers/pipeline.cpp @@ -110,20 +110,20 @@ public: TIMER_CALLBACK_MEMBER(protection_deferred_w); protected: - required_device<cpu_device> m_maincpu; - required_device<m68705r_device> m_mcu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; + required_device<cpu_device> m_maincpu; + required_device<m68705r_device> m_mcu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; - required_shared_ptr<u8> m_vram1; - required_shared_ptr<u8> m_vram2; + required_shared_ptr<u8> m_vram1; + required_shared_ptr<u8> m_vram2; tilemap_t *m_tilemap1; tilemap_t *m_tilemap2; - u8 m_vidctrl; - std::unique_ptr<u8[]> m_palram; - u8 m_fromMCU; + u8 m_vidctrl; + std::unique_ptr<u8[]> m_palram; + u8 m_fromMCU; }; diff --git a/src/mame/drivers/pitnrun.cpp b/src/mame/drivers/pitnrun.cpp index 0147a3716a2..80d20ddf5b9 100644 --- a/src/mame/drivers/pitnrun.cpp +++ b/src/mame/drivers/pitnrun.cpp @@ -66,22 +66,25 @@ K1000233A */ #include "emu.h" -#include "cpu/z80/z80.h" +#include "includes/pitnrun.h" + #include "cpu/m6805/m68705.h" +#include "cpu/z80/z80.h" + #include "machine/gen_latch.h" #include "machine/watchdog.h" + #include "sound/ay8910.h" -#include "includes/pitnrun.h" INTERRUPT_GEN_MEMBER(pitnrun_state::nmi_source) { - if(m_nmi) device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_nmi) device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } WRITE8_MEMBER(pitnrun_state::nmi_enable_w) { - m_nmi = data & 1; + m_nmi = data & 1; } WRITE8_MEMBER(pitnrun_state::hflip_w) @@ -136,15 +139,6 @@ static ADDRESS_MAP_START( pitnrun_sound_io_map, AS_IO, 8, pitnrun_state ) AM_RANGE(0x98, 0x98) AM_WRITENOP ADDRESS_MAP_END -static ADDRESS_MAP_START( pitnrun_mcu_map, AS_PROGRAM, 8, pitnrun_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(m68705_portA_r,m68705_portA_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(m68705_portB_r,m68705_portB_w) - AM_RANGE(0x0002, 0x0002) AM_READ(m68705_portC_r) - AM_RANGE(0x0003, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x07ff) AM_ROM -ADDRESS_MAP_END - static INPUT_PORTS_START( pitnrun ) PORT_START("SYSTEM") @@ -231,8 +225,12 @@ static MACHINE_CONFIG_START( pitnrun, pitnrun_state ) MCFG_CPU_IO_MAP(pitnrun_sound_io_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", pitnrun_state, irq0_line_hold) - MCFG_CPU_ADD("mcu", M68705,XTAL_18_432MHz/6) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(pitnrun_mcu_map) + MCFG_CPU_ADD("mcu", M68705P5, XTAL_18_432MHz/6) /* verified on pcb */ + MCFG_M68705_PORTA_R_CB(READ8(pitnrun_state, m68705_portA_r)) + MCFG_M68705_PORTB_R_CB(READ8(pitnrun_state, m68705_portB_r)) + MCFG_M68705_PORTC_R_CB(READ8(pitnrun_state, m68705_portC_r)) + MCFG_M68705_PORTA_W_CB(WRITE8(pitnrun_state, m68705_portA_w)) + MCFG_M68705_PORTB_W_CB(WRITE8(pitnrun_state, m68705_portB_w)) MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp index b6952cf028d..e038e2db0df 100644 --- a/src/mame/drivers/polepos.cpp +++ b/src/mame/drivers/polepos.cpp @@ -343,9 +343,6 @@ WRITE16_MEMBER(polepos_state::polepos_z8002_nvi_enable_w) space.device().execute().set_input_line(0, CLEAR_LINE); } - -CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return ioport((const char *)param)->read() >> 4; } -CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return ioport((const char *)param)->read() & 0x0f; } CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r) { return m_auto_start_mask; @@ -491,17 +488,15 @@ ADDRESS_MAP_END *********************************************************************/ static INPUT_PORTS_START( polepos ) - PORT_START("IN0L") + PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) POLEPOS_TOGGLE /* Gear */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,auto_start_r, nullptr) // start 1, program controlled PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN0H") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_START("DSWA") PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") @@ -527,9 +522,6 @@ static INPUT_PORTS_START( polepos ) PORT_DIPSETTING( 0x80, "3" ) /* Manufacturer's recommended settings for Upright cabinet */ PORT_DIPSETTING( 0x00, "4" ) /* Manufacturer's recommended settings for Sit-Down cabinet */ - PORT_START("DSWA_HI") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA") - PORT_START("DSWB") PORT_DIPNAME( 0x07, 0x03, "Extended Rank" ) PORT_DIPLOCATION("SW2:1,2,3") PORT_DIPSETTING( 0x07, "A" ) @@ -556,9 +548,6 @@ static INPUT_PORTS_START( polepos ) PORT_DIPSETTING( 0x80, DEF_STR( Off )) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("DSWB_HI") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB") - PORT_START("BRAKE") PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) @@ -635,12 +624,6 @@ static INPUT_PORTS_START( topracern ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) - PORT_START("IN0L") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,low_port_r, "IN0") - - PORT_START("IN0H") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "IN0") - PORT_START("DSWA") PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) @@ -665,9 +648,6 @@ static INPUT_PORTS_START( topracern ) PORT_DIPSETTING( 0x80, "3" ) PORT_DIPSETTING( 0x00, "4" ) - PORT_START("DSWA_HI") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA") - /* FIXME: these dips don't work and may not even exist on this bootleg */ PORT_START("DSWB") PORT_DIPNAME( 0x07, 0x07, "Extended Rank" ) @@ -695,9 +675,6 @@ static INPUT_PORTS_START( topracern ) PORT_DIPSETTING( 0x80, DEF_STR( Off )) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("DSWB_HI") - PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB") - PORT_START("BRAKE") PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) @@ -772,6 +749,59 @@ static INPUT_PORTS_START( polepos2j ) INPUT_PORTS_END +static INPUT_PORTS_START( polepos2bi ) + PORT_INCLUDE( topracern ) + + PORT_MODIFY("DSWA") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:1,3,5") + PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 1C_6C ) ) + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWA:7,2") + 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_DIPNAME( 0x20, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SWA:4") + PORT_DIPSETTING( 0x20, "mph" ) + PORT_DIPSETTING( 0x00, "km/h" ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:6") + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Speed" ) PORT_DIPLOCATION("SWA:8") + PORT_DIPSETTING( 0x80, "Average" ) + PORT_DIPSETTING( 0x00, DEF_STR( High ) ) + + PORT_MODIFY("DSWB") + PORT_DIPNAME( 0x03, 0x01, "Extended Rank" ) PORT_DIPLOCATION("SWB:1,3") + PORT_DIPSETTING( 0x00, "A" ) + PORT_DIPSETTING( 0x01, "B" ) + PORT_DIPSETTING( 0x02, "C" ) + PORT_DIPSETTING( 0x03, "D" ) + PORT_DIPNAME( 0x0c, 0x04, "Practice Rank" ) PORT_DIPLOCATION("SWB:5,7") + PORT_DIPSETTING( 0x00, "A" ) + PORT_DIPSETTING( 0x04, "B" ) + PORT_DIPSETTING( 0x08, "C" ) + PORT_DIPSETTING( 0x0c, "D" ) + PORT_DIPNAME( 0x30, 0x10, "Goal" ) PORT_DIPLOCATION("SWB:2,4") + PORT_DIPSETTING( 0x00, "3" ) + PORT_DIPSETTING( 0x10, "4" ) + PORT_DIPSETTING( 0x20, "5" ) + PORT_DIPSETTING( 0x30, "6" ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SWB:6") + PORT_DIPSETTING( 0x00, "90 secs." ) + PORT_DIPSETTING( 0x40, "120 secs." ) + PORT_DIPNAME( 0x80, 0x00, "Always On" ) PORT_DIPLOCATION("SWB:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + /********************************************************************* * Graphics layouts @@ -845,10 +875,10 @@ static MACHINE_CONFIG_START( polepos, polepos_state ) MCFG_CPU_PROGRAM_MAP(z8002_map) MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ - MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L")) - MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H")) - MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB")) - MCFG_NAMCO_51XX_INPUT_3_CB(IOPORT("DSWB_HI")) + MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0")) MCFG_DEVCB_MASK(0x0f) + MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4) + MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f) + MCFG_NAMCO_51XX_INPUT_3_CB(IOPORT("DSWB")) MCFG_DEVCB_RSHIFT(4) MCFG_NAMCO_51XX_OUTPUT_0_CB(WRITE8(polepos_state,out_0)) MCFG_NAMCO_51XX_OUTPUT_1_CB(WRITE8(polepos_state,out_1)) @@ -862,8 +892,8 @@ static MACHINE_CONFIG_START( polepos, polepos_state ) MCFG_NAMCO_53XX_K_CB(READ8(polepos_state,namco_53xx_k_r)) MCFG_NAMCO_53XX_INPUT_0_CB(READ8(polepos_state,steering_changed_r)) MCFG_NAMCO_53XX_INPUT_1_CB(READ8(polepos_state,steering_delta_r)) - MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWA")) - MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWA_HI")) + MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWA")) MCFG_DEVCB_MASK(0x0f) + MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWA")) MCFG_DEVCB_RSHIFT(4) MCFG_NAMCO_54XX_ADD("54xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ MCFG_NAMCO_54XX_DISCRETE("discrete") @@ -942,8 +972,8 @@ static ADDRESS_MAP_START( topracern_io, AS_IO, 8, polepos_state ) // extra direct mapped inputs read AM_RANGE(0x02, 0x02) AM_READ_PORT("STEER") AM_WRITENOP AM_RANGE(0x03, 0x03) AM_READ_PORT("IN0") AM_DEVWRITE("dac", dac_byte_interface, write) - AM_RANGE(0x04, 0x04) AM_READ_PORT("DSWA") AM_WRITENOP - AM_RANGE(0x05, 0x05) AM_READ_PORT("DSWB") /* ??? */ AM_WRITE(bootleg_soundlatch_w) + AM_RANGE(0x04, 0x04) AM_READ_PORT("DSWA") AM_WRITENOP // explosion sound trigger + AM_RANGE(0x05, 0x05) AM_READ_PORT("DSWB") AM_WRITE(bootleg_soundlatch_w) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_z80_bootleg_map, AS_PROGRAM, 8, polepos_state ) @@ -975,7 +1005,7 @@ static MACHINE_CONFIG_START( topracern, polepos_state ) /* doesn't exist on the bootleg, but required for now or the game only boots in test mode! they probably simulate some of the logic */ MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ - MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H")) + MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4) MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/8/64) MCFG_NAMCO_06XX_MAINCPU("maincpu") @@ -2208,6 +2238,39 @@ ROM_END | 4 | | OFF | | ON | | | 3 | | ON | | ON | | '-------------------------------+-----+-----+-----+-----+-----------------------' + + + Pinouts / Edge Connectors.... + + + 'A' board connector. 'B' board connector. 'C' board connector. + ---------------+--+------------------ ---------------+--+------------------ ---------------+--+------------------ + Solder Side |PN| Components Side Solder Side |PN| Components Side Solder Side |PN| Components Side + ---------------+--+------------------ ---------------+--+------------------ ---------------+--+------------------ + |01| GND GND |01| GND +5V |01| +5V + GEARS SWITCH |02| GND |02| +5V |02| +5V + 50 PTS COIN-IN |03| GND |03| |03| + |04| GND +5V |04| +5V |04| + 25 PTS COIN-IN |05| GND |05| COMMON ACCEL + BREAK (HI) |05| + +5V |06| +5V BRAKE POT |06| ACCEL POT |06| + +5V |07| +5V |07| COMMON ACCEL + BREAK (LO) |07| GND + +5V |08| +5V |08| GND |08| VIDEO GND + |09| AUDIO SIGNAL 4(***) |09| AUDIO SIGNAL 1(***) VIDEO SYNC |09| VIDEO BLUE + |10| AUDIO SIGNAL 3(***) |10| AUDIO SIGNAL 2(***) VIDEO GREEN |10| VIDEO RED + +12V |11| GND |11| GND |11| + WHEEL X SIGNAL |12| |12| |12| + WHEEL Z SIGNAL |13| |13| |13| + -5V |14| |14| |14| + AUDIO SIGNAL 1(*) |15| AMP AUDIO SIGNAL (**) |15| GND |15| GND + AUDIO SIGNAL 2(*) |16| AMP AUDIO SIGNAL (**) |16| GND |16| GND + AUDIO SIGNAL 3(*) |17| |17| GND |17| GND + AUDIO SIGNAL 4(*) |18| |18| GND |18| GND + + + (*) To 'B' connector. + (**) To 'D' connector. + (***) To 'A' connector. + */ ROM_START( polepos2bs ) /* Z80 memory/ROM data */ @@ -2288,7 +2351,7 @@ ROM_START( polepos2bs ) ROM_REGION( 0x2000, "soundz80bl", 0 ) ROM_LOAD( "aboard-spi.11", 0x0000, 0x2000, CRC(47226cda) SHA1(03115ead04b11e7ef3ef08d32d4d61a56dc35190) ) /* redumped. the former one has bit6 stuck */ -// ROM_REGION( 0x2000, "pals", 0 ) +// ROM_REGION( 0x2000, "pals", 0 ) // ...not dumped yet... ROM_END @@ -2317,10 +2380,10 @@ GAME( 1982, poleposa2, polepos, polepos, poleposa, driver_device, 0, GAME( 1984, topracer, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Top Racer (with MB8841 + MB8842, 1984)", 0 ) // the NAMCO customs have been cloned on these bootlegs GAME( 1983, topracera, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Top Racer (with MB8841 + MB8842, 1983)", 0 ) // the only difference between them is the year displayed on the title screen GAME( 1983, ppspeed, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Speed Up (Spanish bootleg of Pole Position)", 0 ) // very close to topracer / topracera -GAME( 1982, topracern, polepos, topracern, topracern, driver_device, 0, ROT0, "bootleg", "Top Racer (no MB8841 + MB8842)", MACHINE_IMPERFECT_SOUND ) // is there any explosion sound generator here? +GAME( 1982, topracern, polepos, topracern, topracern, driver_device, 0, ROT0, "bootleg", "Top Racer (no MB8841 + MB8842)", MACHINE_IMPERFECT_SOUND ) // explosion sound generator missing GAME( 1983, polepos2, 0, polepos, polepos2j, polepos_state, polepos2, ROT0, "Namco", "Pole Position II (Japan)", 0 ) GAME( 1983, polepos2a, polepos2, polepos, polepos2, polepos_state, polepos2, ROT0, "Namco (Atari license)", "Pole Position II (Atari)", 0 ) GAME( 1983, polepos2b, polepos2, polepos, polepos2, driver_device, 0, ROT0, "bootleg", "Pole Position II (bootleg)", 0 ) -GAME( 1984, polepos2bi, polepos2, polepos2bi, topracern, driver_device, 0, ROT0, "bootleg", "Gran Premio F1 (Italian bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, polepos2bs, polepos2, polepos2bi, topracern, driver_device, 0, ROT0, "BCN Internacional S.A.)", "Gran Premio F1 (Spanish bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, polepos2bi, polepos2, polepos2bi, polepos2bi,driver_device, 0, ROT0, "bootleg", "Gran Premio F1 (Italian bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, polepos2bs, polepos2, polepos2bi, polepos2bi,driver_device, 0, ROT0, "bootleg (BCN Internacional S.A.)", "Gran Premio F1 (Spanish bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 90d5c11b305..21b9b290775 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -23,10 +23,10 @@ TODO: - get other rom versions and games - document the light-organ related stuff - -NOTES: - The hardware is based on the K1520 PC system, with video output coming through a standard Colormat TV. - + +NOTES: + The hardware is based on the K1520 PC system, with video output coming through a standard Colormat TV. + There are at least two revisions: - Revision 1 - @@ -35,14 +35,14 @@ NOTES: 012-7100 ZRE CPU-Board K2521 (3KiB ROM, 1KiB RAM) 012-7040 PFS-1 ROM Board K3820 #1 - Games 1 to 4 (16KiB ROM) 012-7040 PFS-2 ROM Board K3820 #2 - Games 5 to 8 (16KiB ROM) - + - Revision 2 - 2319-84-01 FAZ Graphics card (Color and Sound Logic) 2319-84-02 ABS Graphics card (1KiB ROM for Charset) 02 899-0101 ZRE-PP CPU-Board (56KiB ROM, 64KiB* RAM) Basically revision 2 combines the ZRE, PFS-1 and PFS-2 onto a single board. - + memory map: - Revision 1 - @@ -55,7 +55,7 @@ memory map: Hirschjagd (1c00 - 27ff) Hase und Wolf (2800 - 3fff) Schmetterlingsfang (4000 - 4fff) - + 5000 - 8fff PFS-2 Schiessbude (5000 - 5fff) Autorennen (6000 - 73ff) opto-akust. Merkspiel (7400 - 7fff) @@ -88,7 +88,7 @@ i/o ports: 80 - 83 ZRE-PP UB857D (Z80 CTC) 84 - 87 ZRE-PP UB855D (Z80 PIO) ?? - ?? ZRE-PP UB8560D (Z80 SIO) - + read: 83 CTC COUNT 3 (IN1) used as hardware random number generator @@ -103,10 +103,10 @@ i/o ports: bit 6 = bookkeeping (Summe Spiele) bit 7 = coin sensor (+IRQ to make the game acknowledge it) - 85 PIO PORT B - bit 0-4 = light organ (unemulated :)) ) - bit 5-7 = sound parameter (unemulated, it's very difficult to - figure out how those work) + 85 PIO PORT B + bit 0-2 = light organ + bit 3-4 = control panel (not connected) + bit 5-7 = sound parameter (not used on production units?) 86 PIO CTRL A @@ -135,6 +135,7 @@ this.) #include "cpu/z80/z80.h" #include "cpu/z80/z80daisy.h" #include "includes/polyplay.h" +#include "polyplay.lh" static const z80_daisy_config daisy_chain_zre[] = { @@ -151,6 +152,11 @@ static const z80_daisy_config daisy_chain_zrepp[] = { nullptr } }; +INTERRUPT_GEN_MEMBER(polyplay_state::nmi_handler) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + /* I/O Port handling */ WRITE_LINE_MEMBER(polyplay_state::ctc_zc2_w) { @@ -176,14 +182,47 @@ READ8_MEMBER(polyplay_state::pio_portb_r) WRITE8_MEMBER(polyplay_state::pio_portb_w) { - /* ZRE -pio_portb_w: 78 - */ - - /* ZRE-PP -pio_portb_w: f8 - */ - osd_printf_verbose("pio_portb_w: %02x\n", data); + uint8_t lightState = data & 0x07; + //uint8_t soundState = data & 0xe0; + + // there is a DS8205D attached to bit 0 and 1 + switch (lightState) + { + case 0: + output().set_lamp_value(1, 1); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + + case 1: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 1); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + + case 2: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 1); + output().set_lamp_value(4, 0); + break; + + case 3: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 1); + break; + + default: + output().set_lamp_value(1, 0); + output().set_lamp_value(2, 0); + output().set_lamp_value(3, 0); + output().set_lamp_value(4, 0); + break; + } } INPUT_CHANGED_MEMBER(polyplay_state::input_changed) @@ -203,11 +242,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( polyplay_mem_zrepp, AS_PROGRAM, 8, polyplay_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM - + AM_RANGE(0xc000, 0xcfff) AM_RAM - + AM_RANGE(0xd000, 0xd7ff) AM_ROM AM_REGION("gfx1", 0) - + AM_RANGE(0xea00, 0xebff) AM_RAM AM_RANGE(0xec00, 0xf7ff) AM_RAM_WRITE(polyplay_characterram_w) AM_SHARE("characterram") @@ -274,6 +313,7 @@ static MACHINE_CONFIG_START( polyplay_zre, polyplay_state ) MCFG_Z80_DAISY_CHAIN(daisy_chain_zre) MCFG_CPU_PROGRAM_MAP(polyplay_mem_zre) MCFG_CPU_IO_MAP(polyplay_io_zre) + MCFG_CPU_PERIODIC_INT_DRIVER(polyplay_state, nmi_handler, 100) /* A302 - zero cross detection from AC (50Hz) */ /* devices */ MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, POLYPLAY_MAIN_CLOCK / 4) /* UB857D */ @@ -281,14 +321,14 @@ static MACHINE_CONFIG_START( polyplay_zre, polyplay_state ) MCFG_Z80CTC_ZC0_CB(WRITELINE(polyplay_state, ctc_zc0_w)) MCFG_Z80CTC_ZC1_CB(WRITELINE(polyplay_state, ctc_zc1_w)) //MCFG_Z80CTC_ZC2_CB(WRITELINE(polyplay_state, ctc_zc2_w)) - + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, POLYPLAY_MAIN_CLOCK / 4) /* UB855D */ MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80CPU_TAG, INPUT_LINE_IRQ0)) MCFG_Z80PIO_IN_PA_CB(READ8(polyplay_state, pio_porta_r)) MCFG_Z80PIO_OUT_PA_CB(WRITE8(polyplay_state, pio_porta_w)) MCFG_Z80PIO_IN_PB_CB(READ8(polyplay_state, pio_portb_r)) MCFG_Z80PIO_OUT_PB_CB(WRITE8(polyplay_state, pio_portb_w)) - + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) @@ -369,8 +409,20 @@ ROM_END ROM_START( polyplay2 ) ROM_REGION( 0x10000, Z80CPU_TAG, 0 ) + ROM_LOAD( "2_1.ROM", 0x0000, 0x2000, CRC(d728ca42) SHA1(7359a59ba7f205b3ac95c8a0946093f24bdaa4da) ) + ROM_LOAD( "2_2.ROM", 0x2000, 0x2000, CRC(52316236) SHA1(88c159621d40953240c5d2f1d6dcebb8f5e1ee81) ) + ROM_LOAD( "2_3.ROM", 0x4000, 0x2000, CRC(e199d303) SHA1(fea2c3c659222553f36b3e922c6ac017f7111025) ) + ROM_LOAD( "2_4.ROM", 0x6000, 0x2000, CRC(1324c2e2) SHA1(c0102d5abbb2f4dbb5b8dff5ad515bc3f2af9166) ) + ROM_LOAD( "2_5.ROM", 0x8000, 0x2000, CRC(2e959fe9) SHA1(1f0a80bb26d0ae332d4a4313ec22ab7eefcf1e34) ) + ROM_LOAD( "2_6.ROM", 0xA000, 0x2000, CRC(85774542) SHA1(420349a0d812bc0052a77cbc6c5ab84262e58b32) ) + + ROM_REGION( 0x800, "gfx1", 0 ) + ROM_LOAD( "1_1.bin", 0x0000, 0x0800, CRC(4f028af9) SHA1(319537234069b43cfffafe567cc599ae05f24e23) ) +ROM_END + +ROM_START( polyplay2c ) + ROM_REGION( 0x10000, Z80CPU_TAG, 0 ) ROM_LOAD( "2_1.bin", 0x0000, 0x2000, CRC(bf22f44f) SHA1(dd412b45f49ceffe336d905043c7af2447c577a0) ) - ROM_LOAD( "2_2.bin", 0x2000, 0x2000, CRC(e54b8be8) SHA1(23037102eab60fd03c349ad154b2498139e84dd4) ) ROM_LOAD( "2_3.bin", 0x4000, 0x2000, CRC(ac43ec6b) SHA1(1662e10d80d47c1e3c54d4ef232c0d671fecce96) ) ROM_LOAD( "2_4.bin", 0x6000, 0x2000, CRC(703f3d46) SHA1(5ab571cb63ffdbce86b6e452988402e5c1098009) ) @@ -381,5 +433,6 @@ ROM_START( polyplay2 ) ROM_END /* game driver */ -GAME( 1986, polyplay, 0, polyplay_zre, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE)", 0 ) -GAME( 1989, polyplay2, 0, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP - Czech)", 0 ) +GAMEL( 1986, polyplay, 0, polyplay_zre, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE)", 0, layout_polyplay ) +GAMEL( 1989, polyplay2, 0, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP)", 0, layout_polyplay ) +GAMEL( 1989, polyplay2c, polyplay2, polyplay_zrepp, polyplay, driver_device, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play (ZRE-PP - Czech)", 0, layout_polyplay ) diff --git a/src/mame/drivers/pse.cpp b/src/mame/drivers/pse.cpp index 830c9493e18..0f9edfa6000 100644 --- a/src/mame/drivers/pse.cpp +++ b/src/mame/drivers/pse.cpp @@ -124,24 +124,24 @@ ROM_START( bazooka ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) ROM_REGION( 0x0840, "roms", ROMREGION_ERASE00 ) - ROM_LOAD( "bd2.k1", 0x0000, 0x0200, CRC(c9e9ed15) SHA1(624bbc10942a386040aef161b96d64021a842c9f) ) // 6341-1 - gfx: tank, truck, jeep motorcycle - ROM_LOAD( "bd2.k4", 0x0200, 0x0200, CRC(c5a74df9) SHA1(2846a039e9bf372f3aa0b88ed89f9029eb7f797c) ) // 6341-1 - gfx: ambulance, stretcher, explosion - ROM_LOAD( "bd1.d2", 0x0400, 0x0200, CRC(4fc10886) SHA1(b1c6f890994ba2182a4e7fc17582d6797dbd6ce9) ) // 6341-1 or 82s115 - ROM_LOAD( "bd1.e2", 0x0600, 0x0200, CRC(00179936) SHA1(e5417b8d3814dafe1278179b307a1b563a378cbe) ) // 6341-1 or 82s115 - ROM_LOAD( "bd2.e6", 0x0800, 0x0020, CRC(14b84564) SHA1(69cdd14e23094678c4b280f60cec963609181b00) ) // 82123 - ROM_LOAD( "bd2.e7", 0x0820, 0x0020, CRC(1bfb073f) SHA1(f6b26dcece71b2cf2ed4a537434edbe31cb10399) ) // 82123 + ROM_LOAD( "bd2.k1", 0x0000, 0x0200, CRC(c9e9ed15) SHA1(624bbc10942a386040aef161b96d64021a842c9f) ) // 6341-1 - gfx: tank, truck, jeep motorcycle + ROM_LOAD( "bd2.k4", 0x0200, 0x0200, CRC(c5a74df9) SHA1(2846a039e9bf372f3aa0b88ed89f9029eb7f797c) ) // 6341-1 - gfx: ambulance, stretcher, explosion + ROM_LOAD( "bd1.d2", 0x0400, 0x0200, CRC(4fc10886) SHA1(b1c6f890994ba2182a4e7fc17582d6797dbd6ce9) ) // 6341-1 or 82s115 + ROM_LOAD( "bd1.e2", 0x0600, 0x0200, CRC(00179936) SHA1(e5417b8d3814dafe1278179b307a1b563a378cbe) ) // 6341-1 or 82s115 + ROM_LOAD( "bd2.e6", 0x0800, 0x0020, CRC(14b84564) SHA1(69cdd14e23094678c4b280f60cec963609181b00) ) // 82123 + ROM_LOAD( "bd2.e7", 0x0820, 0x0020, CRC(1bfb073f) SHA1(f6b26dcece71b2cf2ed4a537434edbe31cb10399) ) // 82123 ROM_END ROM_START( bazookabr ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) ROM_REGION( 0x0840, "roms", ROMREGION_ERASE00 ) - ROM_LOAD( "1", 0x0000, 0x0200, CRC(edc34cb0) SHA1(f76a81833b015784e55b33189e9058cd24922f9b) ) - ROM_LOAD( "2", 0x0200, 0x0200, CRC(3e78e4c2) SHA1(814509eb773bfa87f1df933214f079e7dd2a8fa2) ) - ROM_LOAD( "3", 0x0400, 0x0200, CRC(4fc10886) SHA1(b1c6f890994ba2182a4e7fc17582d6797dbd6ce9) ) - ROM_LOAD( "4", 0x0600, 0x0200, CRC(00179936) SHA1(e5417b8d3814dafe1278179b307a1b563a378cbe) ) - ROM_LOAD( "bd2.e6", 0x0800, 0x0020, BAD_DUMP CRC(14b84564) SHA1(69cdd14e23094678c4b280f60cec963609181b00) ) // not dumped, taken from PSE set - ROM_LOAD( "bd2.e7", 0x0820, 0x0020, BAD_DUMP CRC(1bfb073f) SHA1(f6b26dcece71b2cf2ed4a537434edbe31cb10399) ) // not dumped, taken from PSE set + ROM_LOAD( "bk01.1l", 0x0000, 0x0200, CRC(edc34cb0) SHA1(f76a81833b015784e55b33189e9058cd24922f9b) ) // 74S473 + ROM_LOAD( "bk02.4l", 0x0200, 0x0200, CRC(3e78e4c2) SHA1(814509eb773bfa87f1df933214f079e7dd2a8fa2) ) // 74S473 + ROM_LOAD( "bk03.8j", 0x0400, 0x0200, CRC(4fc10886) SHA1(b1c6f890994ba2182a4e7fc17582d6797dbd6ce9) ) // 74S473 + ROM_LOAD( "bk04.8h", 0x0600, 0x0200, CRC(00179936) SHA1(e5417b8d3814dafe1278179b307a1b563a378cbe) ) // 74S473 + ROM_LOAD( "bk05.6c", 0x0800, 0x0020, CRC(4193d32e) SHA1(d9e3392a8681198e110cfcd68ef20ae3dc366527) ) // 82S123 or 6331-1J + ROM_LOAD( "bk06.6d", 0x0820, 0x0020, CRC(1bfb073f) SHA1(f6b26dcece71b2cf2ed4a537434edbe31cb10399) ) // 82S123 or 6331-1J ROM_END ROM_START( dpatrol ) diff --git a/src/mame/drivers/qix.cpp b/src/mame/drivers/qix.cpp index f0caba1b9f2..494878f171e 100644 --- a/src/mame/drivers/qix.cpp +++ b/src/mame/drivers/qix.cpp @@ -296,10 +296,10 @@ ADDRESS_MAP_END *************************************/ #define COIN_PORT \ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Advance") PORT_CODE(KEYCODE_F1) \ - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Next line") PORT_CODE(KEYCODE_F2) \ - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Slew Up") PORT_CODE(KEYCODE_F5) \ - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Slew Down") PORT_CODE(KEYCODE_F6) \ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Test Advance") \ + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Test Next line") \ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Test Slew Up") \ + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE4 ) PORT_NAME("Test Slew Down") \ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) \ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) \ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 ) \ diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index fc1e39320ad..6ec195e768d 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -44,7 +44,7 @@ NB.: a single hard disk (5 - 67 MB, 512 byte sectors) may be attached before sta until shutdown. "Hot swapping" wasn't possible on the original system (our GUI just doesn't forbid it). To create a DEC RD50/ST506 compatible image (153 cylinders, 4 heads, 16 sectors, standard 512 byte sectors) enter ->chdman64 createhd - c none - chs 153, 4, 16 - ss 512 - o RD50_ST506.chd +>chdman createhd -c none -chs 153,4,16 -ss 512 -o RD50_ST506.chd NOTE: use -c none parameter for no compression. No more than 8 heads or 1024 cylinders. Some BUGS remain: BIOS autoboot doesnt work at all. It is not possible to boot from a properly formatted @@ -56,34 +56,32 @@ handled wrongly, so shared mem. just below $8000 is tainted by Z80 stack data. A Occassionally, ERROR 13 -keyboard stuck- appears (for reasons yet unknown). -CORVUS HARD DISK (CP/M 1.x only) --------------------------------- -In theory, it should be possible to use up to 4 Corvus Disks with up to 20 MB each. -MS DOS 2.x and CP/M 2.0 were once supported, but are untested (in part because no drivers have survived). +CORVUS HARD DISK +---------------- +Up to 4 Corvus Disks with up to 20 MB each can be emulated (to be mounted as hard disks 2 - 5). +MS DOS 2.x and CP/M v2.x were once supported, but are untested (in part because no binary drivers have survived). To get a Corvus 11 drive up and running under CP/M 1.x, you'll need drcdutil.td0 from Donald Maslin's Archive. First, create a 11 MB hard disk: >Chdman createhd -c none -chs 306,4,20 -ss 512 -o CORVUS11.chd -(worked for me, definitive CHS parameters for Corvus B/H drives are hard to come by) - -HINT: hard disk 1 is linked to DEC's controller. So it is vital that CORVUS11.chd is mounted as hard disk 2 in emulation! - -Then make a copy of your CP/M 86-80 V1.x boot disk. This copy will be patched to make the Corvus hard drive usable! +[ -chs 306,2,20 for the 6 MB model and -chs 306,6,20 for the 20 MB type ] +Then make a copy of your CP/M 86-80 V1.x boot disk. This copy must be patched to make the Corvus hard drive usable! With 'drcdutil.td0' mounted in A: and a write enabled (non TeleDisk) image of CPM 1.x in B: type: b:>SUBMIT A:hinstall -This should replace the following CP/M files on B: +This replaces the following CP/M files on B: B:Z80CCP.SYS <- A:HZ80CCP.SYS B:Z80.SYS <- A:HZ80.SYS B:PRMTVPV.SYS <- A:HPRMTVPV.SYS -Due to a typo in HINSTALL.SUB, the last PIP must be executed manually: +Due to a missing drive specification in HINSTALL.SUB, the last PIP must be invoked manually: b:>PIP B:PRMTVPVT.SYS=A:HPRMTVPV.SYS[V] -Finally, boot from the newly patched CP/M disk and invoke CLINK2TN (command must be invoked after each cold boot). -CLINK2TN has hard coded params valid for a Corvus 11 MB hard disk only. It needs a patched CP/M 1.x and will not run on CP/M 2. +Finally, boot from the newly patched CP/M disk and type CLINK2TN (a step necessary after each cold boot). +CLINK2TN can only be used together with a Corvus 11 MB hard disk. It needs a patched CP/M 1.x disk and won't run on CP/M 2.x. +[ use CLINK2FV for the 6 MB model and CLINK2TW for the 20 MB type ] Two steps are needed to initialize the new disk: Step 1: invoke PUTGET, then press "f". Enter "Drive no: 1", "HEX BYTE? e5", "Starting disc address? 2320", "Number of Sectors? 64" @@ -91,7 +89,7 @@ Step 2: invoke PUTGET, then press "f". Enter "Drive no: 1", "HEX BYTE? e5", "Sta Done. Required steps vary with 5 and 20 MB models (look into the *.DOC files in DRCDUTIL.TD0 / CLINK86.A86 / DRIVEL.COM). -Parameters for initialization can be taken from Chapter 2 of the Disk System Installion Guide for TRS-80 II (uses same type H drives). +Parameters for initialization can be taken from Chapter 2 of the Disk System Installion Guide for TRS-80 II (same type H drives). COLOR EMULATION (NEC 7220 + extra hardware) @@ -112,7 +110,7 @@ COLOR EMULATION (NEC 7220 + extra hardware) THE DEC 'R-M-B' COLOR CABLE VS. THE UNOFFICIAL 'R-G-B' MODE (A BIT OF HISTORY) The standard DEC "color cable" connected the green gun of a VR241 to the mono output of the Rainbow (DIP setting COLOR_MONITOR). - + An unofficial DIY cable enabled R-G-B graphics + seperate text (emulated by DIP setting DUAL MONITOR). As DEC decided not to endorse R-G-B, many commercial programs show incorrect colors. A patch from one of the archives corrects the GWBASIC palette problem when using 2 monitors [Bavarese]. @@ -457,7 +455,7 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). #include "imagedev/harddriv.h" #include "machine/wd2010.h" -#include "machine/corvushd.h" +#include "machine/corvushd.h" #include "machine/z80dart.h" #include "bus/rs232/rs232.h" @@ -490,8 +488,8 @@ public: m_inp2(*this, "W14"), m_inp3(*this, "W15"), m_inp4(*this, "W18"), - m_inp5(*this, "DEC HARD DISK"), // DO NOT CHANGE ORDER - m_inp6(*this, "CORVUS HARD DISKS"), // DO NOT CHANGE ORDER + m_inp5(*this, "DEC HARD DISK"), // DO NOT CHANGE ORDER + m_inp6(*this, "CORVUS HARD DISKS"), // DO NOT CHANGE ORDER m_inp7(*this, "GRAPHICS OPTION"), // DO NOT CHANGE ORDER m_inp8(*this, "MEMORY PRESENT"), // DO NOT CHANGE ORDER m_inp9(*this, "MONO MONITOR TYPE"), @@ -507,7 +505,7 @@ public: m_fdc(*this, FD1793_TAG), m_hdc(*this, "hdc"), - m_corvus_hdc(*this, "corvus"), + m_corvus_hdc(*this, "corvus"), m_mpsc(*this, "upd7201"), m_dbrg_A(*this, "com8116_a"), @@ -662,7 +660,7 @@ private: required_device<fd1793_t> m_fdc; optional_device<wd2010_device> m_hdc; - required_device<corvus_hdc_t> m_corvus_hdc; + required_device<corvus_hdc_t> m_corvus_hdc; required_device<upd7201_device> m_mpsc; required_device<com8116_device> m_dbrg_A; @@ -956,7 +954,7 @@ AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("kbdser", i8251_device, status_r, control_w // See boot rom @1EA6: 0x27 (<- RESET EXTENDED COMM OPTION ) // Corvus B/H harddisk controller (incompatible with EXT.COMM OPTION): -AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("corvus", corvus_hdc_t, read, write) +AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("corvus", corvus_hdc_t, read, write) AM_RANGE(0x21, 0x21) AM_READ(corvus_status_r) // =========================================================== @@ -1076,7 +1074,7 @@ PORT_DIPNAME(0x01, 0x00, "DEC HARD DISK") PORT_TOGGLE PORT_DIPSETTING(0x00, DEF_STR(Off)) PORT_DIPSETTING(0x01, DEF_STR(On)) -PORT_START("CORVUS HARD DISKS") +PORT_START("CORVUS HARD DISKS") PORT_DIPNAME(0x01, 0x00, "CORVUS HARD DISKS") PORT_TOGGLE PORT_DIPSETTING(0x00, DEF_STR(Off)) PORT_DIPSETTING(0x01, DEF_STR(On)) @@ -1231,7 +1229,7 @@ void rainbow_state::machine_reset() } if (m_inp6->read() == 0x00) // Unmap port if Corvus not present - io.unmap_readwrite(0x20, 0x20); + io.unmap_readwrite(0x20, 0x20); // *********** FLOPPY DISK CONTROLLER [ NOT OPTIONAL ] m_unit = INVALID_DRIVE; @@ -2150,7 +2148,7 @@ READ8_MEMBER(rainbow_state::system_parameter_r) BIOS uses a seperate IRQ vector for RAM board detection (at least on a 100-B). */ return (((m_inp5->read() == 1) ? 0 : 1) | - ((m_inp7->read() == 1) ? 0 : 4) | // Floppy is always present (bit 1 zero) + ((m_inp7->read() == 1) ? 0 : 4) | // Floppy is always present (bit 1 zero) #ifdef OLD_RAM_BOARD_PRESENT ((m_inp8->read() > MOTHERBOARD_RAM) ? 0 : 8) | #else @@ -3290,7 +3288,7 @@ MCFG_WD2010_IN_INDEX_CB(VCC) // " MCFG_HARDDISK_ADD("decharddisk1") /// ******************************** / HARD DISK CONTROLLER **************************************** -MCFG_DEVICE_ADD("corvus", CORVUS_HDC, 0) +MCFG_DEVICE_ADD("corvus", CORVUS_HDC, 0) MCFG_HARDDISK_ADD("harddisk1") MCFG_HARDDISK_INTERFACE("corvus_hdd") MCFG_HARDDISK_ADD("harddisk2") diff --git a/src/mame/drivers/retofinv.cpp b/src/mame/drivers/retofinv.cpp index ce56ec15ff2..eefdd9f1dfc 100644 --- a/src/mame/drivers/retofinv.cpp +++ b/src/mame/drivers/retofinv.cpp @@ -6,7 +6,16 @@ Return of the Invaders driver by Jarek Parchanski, Andrea Mazzoleni -the game was developed by UPL for Taito. +UPL is said to have developed Return of the Invaders for Taito, but some digging +in the ROMs reveals the following strings: + + Programed by NAKAKUMA AKIRA + V 1.0 (85.3.15) + + NOBUO KODERA + AKIRA NAKAKUMA + HIKARU KASAHARA + COMIX LTD. 1985. Notes: - I derived the ROM names from the board diagram in the manual. There might @@ -31,11 +40,11 @@ Notes: ***************************************************************************/ #include "emu.h" +#include "includes/retofinv.h" + #include "cpu/z80/z80.h" -#include "cpu/m6805/m68705.h" #include "machine/watchdog.h" #include "sound/sn76496.h" -#include "includes/retofinv.h" void retofinv_state::machine_start() @@ -43,23 +52,6 @@ void retofinv_state::machine_start() save_item(NAME(m_main_irq_mask)); save_item(NAME(m_sub_irq_mask)); save_item(NAME(m_cpu2_m6000)); - - if (m_68705 != nullptr) // only for the parent (with MCU) - { - save_item(NAME(m_from_main)); - save_item(NAME(m_from_mcu)); - save_item(NAME(m_mcu_sent)); - save_item(NAME(m_main_sent)); - save_item(NAME(m_portA_in)); - save_item(NAME(m_portA_out)); - save_item(NAME(m_ddrA)); - save_item(NAME(m_portB_in)); - save_item(NAME(m_portB_out)); - save_item(NAME(m_ddrB)); - save_item(NAME(m_portC_in)); - save_item(NAME(m_portC_out)); - save_item(NAME(m_ddrC)); - } } WRITE8_MEMBER(retofinv_state::cpu1_reset_w) @@ -74,9 +66,7 @@ WRITE8_MEMBER(retofinv_state::cpu2_reset_w) WRITE8_MEMBER(retofinv_state::mcu_reset_w) { - /* the bootlegs don't have a MCU, so make sure it's there before trying to reset it */ - if (m_68705 != nullptr) - m_68705->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); + m_68705->reset_w(data ? CLEAR_LINE : ASSERT_LINE); } WRITE8_MEMBER(retofinv_state::cpu2_m6000_w) @@ -91,8 +81,8 @@ READ8_MEMBER(retofinv_state::cpu0_mf800_r) WRITE8_MEMBER(retofinv_state::soundcommand_w) { - m_soundlatch->write(space, 0, data); - m_audiocpu->set_input_line(0, HOLD_LINE); + m_soundlatch->write(space, 0, data); + m_audiocpu->set_input_line(0, HOLD_LINE); } WRITE8_MEMBER(retofinv_state::irq0_ack_w) @@ -119,8 +109,17 @@ WRITE8_MEMBER(retofinv_state::coinlockout_w) machine().bookkeeping().coin_lockout_w(0,~data & 1); } +READ8_MEMBER(retofinv_state::mcu_status_r) +{ + /* bit 4 = when 1, mcu is ready to receive data from main cpu */ + /* bit 5 = when 1, mcu has sent data to the main cpu */ + return + ((CLEAR_LINE == m_68705->host_semaphore_r()) ? 0x10 : 0x00) | + ((CLEAR_LINE != m_68705->mcu_semaphore_r()) ? 0x20 : 0x00); +} -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) + +static ADDRESS_MAP_START( bootleg_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x7fff, 0x7fff) AM_WRITE(coincounter_w) AM_RANGE(0x7b00, 0x7bff) AM_ROM /* space for diagnostic ROM? The code looks */ @@ -132,7 +131,6 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2") AM_RANGE(0xc002, 0xc002) AM_READNOP /* bit 7 must be 0, otherwise game resets */ - AM_RANGE(0xc003, 0xc003) AM_READ(mcu_status_r) AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM") AM_RANGE(0xc005, 0xc005) AM_READ_PORT("DSW1") AM_RANGE(0xc006, 0xc006) AM_READ_PORT("DSW2") @@ -140,16 +138,21 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0xc800, 0xc800) AM_WRITE(irq0_ack_w) AM_RANGE(0xc801, 0xc801) AM_WRITE(coinlockout_w) AM_RANGE(0xc802, 0xc802) AM_WRITE(cpu2_reset_w) - AM_RANGE(0xc803, 0xc803) AM_WRITE(mcu_reset_w) // AM_RANGE(0xc804, 0xc804) AM_WRITE(irq1_ack_w) // presumably (meaning memory map is shared with cpu 1) AM_RANGE(0xc805, 0xc805) AM_WRITE(cpu1_reset_w) AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) AM_RANGE(0xd800, 0xd800) AM_WRITE(soundcommand_w) - AM_RANGE(0xe000, 0xe000) AM_READ(mcu_r) - AM_RANGE(0xe800, 0xe800) AM_WRITE(mcu_w) AM_RANGE(0xf800, 0xf800) AM_READ(cpu0_mf800_r) ADDRESS_MAP_END +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) + AM_IMPORT_FROM(bootleg_map) + AM_RANGE(0xc003, 0xc003) AM_READ(mcu_status_r) + AM_RANGE(0xc803, 0xc803) AM_WRITE(mcu_reset_w) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("68705", taito68705_mcu_device, data_r) + AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("68705", taito68705_mcu_device, data_w) +ADDRESS_MAP_END + static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram") @@ -168,18 +171,6 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0xe000, 0xffff) AM_ROM /* space for diagnostic ROM */ ADDRESS_MAP_END -static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, retofinv_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(mcu_portA_r, mcu_portA_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(mcu_portB_r, mcu_portB_w) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(mcu_portC_r, mcu_portC_w) - AM_RANGE(0x0004, 0x0004) AM_WRITE(mcu_ddrA_w) - AM_RANGE(0x0005, 0x0005) AM_WRITE(mcu_ddrB_w) - AM_RANGE(0x0006, 0x0006) AM_WRITE(mcu_ddrC_w) - AM_RANGE(0x0010, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x07ff) AM_ROM -ADDRESS_MAP_END - static INPUT_PORTS_START( retofinv ) @@ -382,8 +373,7 @@ static MACHINE_CONFIG_START( retofinv, retofinv_state ) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_CPU_PERIODIC_INT_DRIVER(retofinv_state, nmi_line_pulse, 2*60) - MCFG_CPU_ADD("68705", M68705,18432000/6) /* 3.072 MHz? */ - MCFG_CPU_PROGRAM_MAP(mcu_map) + MCFG_CPU_ADD("68705", TAITO68705_MCU, 18432000/6) /* 3.072 MHz? */ MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - enough for the sound CPU to read all commands */ @@ -418,8 +408,10 @@ MACHINE_CONFIG_END /* bootleg has no mcu */ static MACHINE_CONFIG_DERIVED( retofinb, retofinv ) - MCFG_DEVICE_REMOVE("68705") + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bootleg_map) + MCFG_DEVICE_REMOVE("68705") MACHINE_CONFIG_END @@ -441,7 +433,7 @@ ROM_START( retofinv ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "a37-05.17", 0x0000, 0x2000, CRC(9025abea) SHA1(2f03e8572f23624d7cd1215a55109e97fd66e271) ) - ROM_REGION( 0x0800, "68705", 0 ) /* 8k for the microcontroller */ + ROM_REGION( 0x0800, "68705:mcu", 0 ) /* 2k for the microcontroller */ /* the only available dump is from a bootleg board, and is not the real thing (see notes at top of driver) */ ROM_LOAD( "a37-09.37", 0x00000, 0x0800, BAD_DUMP CRC(79bd6ded) SHA1(4967e95b4461c1bfb4e933d1804677799014f77b) ) diff --git a/src/mame/drivers/rm380z.cpp b/src/mame/drivers/rm380z.cpp index 4ff3e935878..61528ba1065 100644 --- a/src/mame/drivers/rm380z.cpp +++ b/src/mame/drivers/rm380z.cpp @@ -245,7 +245,7 @@ static MACHINE_CONFIG_START( rm380z, rm380z_state ) /* cassette */ MCFG_CASSETTE_ADD( "cassette" ) -// MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) +// MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED) //m_cassette->change_state((BIT(data,x)) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); @@ -272,19 +272,19 @@ static MACHINE_CONFIG_START( rm480z, rm380z_state ) MCFG_MACHINE_RESET_OVERRIDE(rm380z_state, rm480z) /* video hardware */ -// MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(50) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) -// MCFG_SCREEN_SIZE((RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1)), (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))) -// MCFG_SCREEN_VISIBLE_AREA(0, (RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1))-1, 0, (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))-1) -// MCFG_SCREEN_UPDATE_DRIVER(rm380z_state, screen_update_rm480z) -// MCFG_SCREEN_PALETTE("palette") +// MCFG_SCREEN_ADD("screen", RASTER) +// MCFG_SCREEN_REFRESH_RATE(50) +// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) +// MCFG_SCREEN_SIZE((RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1)), (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))) +// MCFG_SCREEN_VISIBLE_AREA(0, (RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1))-1, 0, (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))-1) +// MCFG_SCREEN_UPDATE_DRIVER(rm380z_state, screen_update_rm480z) +// MCFG_SCREEN_PALETTE("palette") -// MCFG_PALETTE_ADD_MONOCHROME("palette") +// MCFG_PALETTE_ADD_MONOCHROME("palette") /* keyboard */ -// MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) -// MCFG_GENERIC_KEYBOARD_CB(WRITE8(rm380z_state, keyboard_put)) +// MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) +// MCFG_GENERIC_KEYBOARD_CB(WRITE8(rm380z_state, keyboard_put)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp index 8a60990ca51..b0dab8dd151 100644 --- a/src/mame/drivers/s11c.cpp +++ b/src/mame/drivers/s11c.cpp @@ -478,6 +478,36 @@ ROM_START(rollr_g3) ROM_LOAD("rolr_u20.l3", 0x30000, 0x10000, CRC(77f89aff) SHA1(dcd9fe233f33ef8f97cdeaaa365532e485a28944)) ROM_END +ROM_START(rollr_f2) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("rolr-u26.lf2", 0x4000, 0x4000, CRC(a33a3a39) SHA1(fa67cede5fe9f86ce8772e49dba8d929d2b53ecb)) + ROM_LOAD("rolr_u27.l2", 0x8000, 0x8000, CRC(f3bac2b8) SHA1(9f0ff32ea83e43097de42065909137a362b29d49)) + ROM_REGION(0x50000, "bgcpu", ROMREGION_ERASEFF) + ROM_LOAD("rolr_u4.l3", 0x10000, 0x10000, CRC(d366c705) SHA1(76018305b5040b2e5d8c45cc81a18f13e1a8f8da)) + ROM_LOAD("rolr_u19.l3", 0x20000, 0x10000, CRC(45a89e55) SHA1(3aff897514d242c83a8e7575d430d594a873736e)) + ROM_LOAD("rolr_u20.l3", 0x30000, 0x10000, CRC(77f89aff) SHA1(dcd9fe233f33ef8f97cdeaaa365532e485a28944)) +ROM_END + +ROM_START(rollr_f3) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("rolr-u26.lf3", 0x4000, 0x4000, CRC(0c54de2a) SHA1(764a0986bb1966ddfd547ee6380debaaa1ea3769)) + ROM_LOAD("rolr_u27.l2", 0x8000, 0x8000, CRC(f3bac2b8) SHA1(9f0ff32ea83e43097de42065909137a362b29d49)) + ROM_REGION(0x50000, "bgcpu", ROMREGION_ERASEFF) + ROM_LOAD("rolr_u4.l3", 0x10000, 0x10000, CRC(d366c705) SHA1(76018305b5040b2e5d8c45cc81a18f13e1a8f8da)) + ROM_LOAD("rolr_u19.l3", 0x20000, 0x10000, CRC(45a89e55) SHA1(3aff897514d242c83a8e7575d430d594a873736e)) + ROM_LOAD("rolr_u20.l3", 0x30000, 0x10000, CRC(77f89aff) SHA1(dcd9fe233f33ef8f97cdeaaa365532e485a28944)) +ROM_END + +ROM_START(rollr_d2) // American Drops 2 - sample/prototype with 8 drop targets + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("rolr-u26.ad2", 0x4000, 0x4000, CRC(913574ac) SHA1(52e2b398d087e998ba5c16a623c7d1a02b99ca55)) + ROM_LOAD("rolr_u27.ad2", 0x8000, 0x8000, CRC(92d2172f) SHA1(73f15d338f2680ee2dd961e9e4d4ea97e9328b6e)) + ROM_REGION(0x50000, "bgcpu", ROMREGION_ERASEFF) + ROM_LOAD("rolr_u4.l3", 0x10000, 0x10000, CRC(d366c705) SHA1(76018305b5040b2e5d8c45cc81a18f13e1a8f8da)) + ROM_LOAD("rolr_u19.l3", 0x20000, 0x10000, CRC(45a89e55) SHA1(3aff897514d242c83a8e7575d430d594a873736e)) + ROM_LOAD("rolr_u20.l3", 0x30000, 0x10000, CRC(77f89aff) SHA1(dcd9fe233f33ef8f97cdeaaa365532e485a28944)) +ROM_END + /*-------------------- / The Bally Game Show 4/90 /--------------------*/ @@ -544,6 +574,9 @@ GAME(1991, rollr_e1, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, GAME(1991, rollr_p2, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (PA-2 / PA-1 Sound)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1990, rollr_l3, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (LU-3) Europe", MACHINE_IS_SKELETON_MECHANICAL) GAME(1990, rollr_g3, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (LG-3) Germany", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1991, rollr_f2, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (LF-2) French", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1990, rollr_f3, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (LF-3) French", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1990, rollr_d2, rollr_l2, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Rollergames (AD-2) Prototype", MACHINE_IS_SKELETON_MECHANICAL) GAME(1990, gs_l3, gs_l4, s11c, s11c, s11c_state, s11c, ROT0, "Bally", "The Bally Game Show (L-3)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1990, gs_l4, 0, s11c, s11c, s11c_state, s11c, ROT0, "Bally", "The Bally Game Show (L-4)", MACHINE_IS_SKELETON_MECHANICAL) GAME(1990, strax_p7, 0, s11c, s11c, s11c_state, s11c, ROT0, "Williams", "Star Trax (domestic prototype)", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/sdk85.cpp b/src/mame/drivers/sdk85.cpp index aa64dbb4e42..7a899e067c1 100644 --- a/src/mame/drivers/sdk85.cpp +++ b/src/mame/drivers/sdk85.cpp @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** +/************************************************************************************************************************************** Intel SDK-85 @@ -20,7 +20,19 @@ then press NEXT to increment the address. ToDo: - Artwork -****************************************************************************/ + +Notes on Mastermind bios. +Original author: Paolo Forlani +Ported to SDK85 by: Stefano Bodrato + +Game instructions (from Stefano): +Start up, press 0 to begin. Game shows ----. You need to guess a number between 0000 and 9999. +Enter your guess, "computer" will answer showing on left with the number of found digits. +On the right you'll get a "clue", slightly different than on the standard game (making it a bit more tricky and more intriguing). +Once you find the number, you'll see it flashing. Press the 2 key and you'll get your score (number of attempts before guessing). +Press 0 to restart. + +*************************************************************************************************************************************/ #include "emu.h" #include "cpu/i8085/i8085.h" @@ -32,14 +44,19 @@ class sdk85_state : public driver_device { public: sdk85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_keyboard(*this, "X%u", 0) + { } DECLARE_WRITE8_MEMBER(scanlines_w); DECLARE_WRITE8_MEMBER(digit_w); DECLARE_READ8_MEMBER(kbd_r); - uint8_t m_digit; + +private: + u8 m_digit; required_device<cpu_device> m_maincpu; + required_ioport_array<3> m_keyboard; }; static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8, sdk85_state) @@ -80,12 +97,12 @@ static INPUT_PORTS_START( sdk85 ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END @@ -103,14 +120,7 @@ WRITE8_MEMBER( sdk85_state::digit_w ) READ8_MEMBER( sdk85_state::kbd_r ) { - uint8_t data = 0xff; - - if (m_digit < 3) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_digit); - data = ioport(kbdrow)->read(); - } + u8 data = (m_digit < 3) ? m_keyboard[m_digit]->read() : 0xff; return data; } @@ -136,7 +146,10 @@ MACHINE_CONFIG_END /* ROM definition */ ROM_START( sdk85 ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sdk85.a14", 0x0000, 0x0800, CRC(9d5a983f) SHA1(54e218560fbec009ac3de5cfb64b920241ef2eeb)) + ROM_SYSTEM_BIOS(0, "default", "Default") + ROMX_LOAD( "sdk85.a14", 0x0000, 0x0800, CRC(9d5a983f) SHA1(54e218560fbec009ac3de5cfb64b920241ef2eeb), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "mastermind", "Mastermind") + ROMX_LOAD( "mastermind.a14", 0x0000, 0x0800, CRC(36b694ae) SHA1(4d8a5ae5d10e8f72a6e349c7eeaf1aa00c4e45e1), ROM_BIOS(2) ) ROM_END /* Driver */ diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 1fe88f41c31..b8770aaf79b 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -956,15 +956,16 @@ ROM_START( fantzn2 ) ROM_LOAD( "317-0057.key", 0x0000, 0x2000, CRC(ee43d0f0) SHA1(72cb75a4d8352fe372db12046a59ea044360d5c3) ) ROM_END +// Game ID# 833-6407-01 OPA OPA ROM_START( opaopa ) ROM_REGION( 0x50000, "maincpu", 0 ) - ROM_LOAD( "epr11224.ic7", 0x00000, 0x08000, CRC(024b1244) SHA1(59a522ac3d98982cc4ddb1c81f9584d3da453649) ) /* encrypted */ + ROM_LOAD( "epr-11054.ic7", 0x00000, 0x08000, CRC(024b1244) SHA1(59a522ac3d98982cc4ddb1c81f9584d3da453649) ) /* encrypted */ /* The following are 8 0x4000 banks that get mapped to reads from 0x8000 - 0xbfff */ - ROM_LOAD( "epr11223.ic5", 0x10000, 0x08000, CRC(6bc41d6e) SHA1(8997a4ac2a9704f1400d0ec16b259ee496a7efef) ) /* encrypted */ - ROM_LOAD( "epr11222.ic4", 0x18000, 0x08000, CRC(395c1d0a) SHA1(1594bad13e78c5fad4db644cd85a6bac1eaddbad) ) /* encrypted */ - ROM_LOAD( "epr11221.ic3", 0x20000, 0x08000, CRC(4ca132a2) SHA1(cb4e4c01b6ab070eef37c0603190caafe6236ccd) ) /* encrypted */ - ROM_LOAD( "epr11220.ic2", 0x28000, 0x08000, CRC(a165e2ef) SHA1(498ff4c5d3a2658567393378c56be6ed86ac0384) ) /* encrypted */ + ROM_LOAD( "epr-11053.ic5", 0x10000, 0x08000, CRC(6bc41d6e) SHA1(8997a4ac2a9704f1400d0ec16b259ee496a7efef) ) /* encrypted */ + ROM_LOAD( "epr-11052.ic4", 0x18000, 0x08000, CRC(395c1d0a) SHA1(1594bad13e78c5fad4db644cd85a6bac1eaddbad) ) /* encrypted */ + ROM_LOAD( "epr-11051.ic3", 0x20000, 0x08000, CRC(4ca132a2) SHA1(cb4e4c01b6ab070eef37c0603190caafe6236ccd) ) /* encrypted */ + ROM_LOAD( "epr-11050.ic2", 0x28000, 0x08000, CRC(a165e2ef) SHA1(498ff4c5d3a2658567393378c56be6ed86ac0384) ) /* encrypted */ ROM_REGION( 0x2000, "key", 0 ) /* MC8123 key */ ROM_LOAD( "317-0042.key", 0x0000, 0x2000, CRC(d6312538) SHA1(494ac7f080775c21dc7d369e6ea78f3299e6975a) ) diff --git a/src/mame/drivers/segasp.cpp b/src/mame/drivers/segasp.cpp index 761cd8fa34e..00d72f509a2 100644 --- a/src/mame/drivers/segasp.cpp +++ b/src/mame/drivers/segasp.cpp @@ -190,7 +190,7 @@ static ADDRESS_MAP_START( segasp_map, AS_PROGRAM, 64, segasp_state ) AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) - AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) + AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(sh4_soundram_r, sh4_soundram_w) // sound RAM (8 MB) /* External Device */ AM_RANGE(0x01000000, 0x0100ffff) AM_RAM // banked access to ROM/NET board address space, mainly backup SRAM and ATA @@ -298,6 +298,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( segasp, naomi_aw_base, segasp_state ) MCFG_CPU_PROGRAM_MAP(segasp_map) MCFG_CPU_IO_MAP(onchip_port) + MCFG_EEPROM_SERIAL_93C46_ADD("main_eeprom") MCFG_EEPROM_SERIAL_93C46_ADD("sp_eeprom") // todo, not exactly NaomiM4 (see notes at top of driver) use custom board type here instead diff --git a/src/mame/drivers/slapfght.cpp b/src/mame/drivers/slapfght.cpp index ef1702a5bc9..276f9592ce5 100644 --- a/src/mame/drivers/slapfght.cpp +++ b/src/mame/drivers/slapfght.cpp @@ -785,7 +785,7 @@ void slapfght_state::machine_reset() MACHINE_RESET_MEMBER(slapfght_state,getstar) { // don't boot the mcu since we don't have a dump yet -// m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +// m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); machine_reset(); } diff --git a/src/mame/drivers/stadhero.cpp b/src/mame/drivers/stadhero.cpp index 61d04c0fc2d..0b96752214f 100644 --- a/src/mame/drivers/stadhero.cpp +++ b/src/mame/drivers/stadhero.cpp @@ -6,8 +6,6 @@ Emulation by Bryan McPhail, mish@tendril.co.uk - Are the colours correct on the scoreboard screen? they look strange - === PCB Info === The OSC on the CPU board(DE-0303-3) is 20MHz @@ -263,8 +261,8 @@ ROM_START( stadhero ) ROM_LOAD( "ef09.4j", 0x10000, 0x08000, CRC(2ade874d) SHA1(5c884535214438a4ea79fd262700a346bc12ad81) ) ROM_REGION( 0x30000, "gfx2", 0 ) - ROM_LOAD( "ef10.11j", 0x00000, 0x10000, CRC(dca3d599) SHA1(2b97a70065f3065e7fbb54fb53cb120d9e5013b3) ) /* tiles */ - ROM_LOAD( "ef11.13j", 0x10000, 0x10000, CRC(af563e96) SHA1(c88eaff4a1ea133d708f4511bb1dbc99ef066eed) ) + ROM_LOAD( "ef11.13j", 0x00000, 0x10000, CRC(af563e96) SHA1(c88eaff4a1ea133d708f4511bb1dbc99ef066eed) ) /* tiles */ + ROM_LOAD( "ef10.11j", 0x10000, 0x10000, CRC(dca3d599) SHA1(2b97a70065f3065e7fbb54fb53cb120d9e5013b3) ) ROM_LOAD( "ef12.14j", 0x20000, 0x10000, CRC(9a1bf51c) SHA1(e733c193b305496878551fc6eefc21587ba75c82) ) ROM_REGION( 0x80000, "gfx3", 0 ) diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index d3efae464cc..59320b60504 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -204,7 +204,7 @@ static INPUT_PORTS_START( starwars ) PORT_START("IN1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Diagnostic Step") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) diff --git a/src/mame/drivers/stfight.cpp b/src/mame/drivers/stfight.cpp index 6b0e86508b3..2f6586d9bcd 100644 --- a/src/mame/drivers/stfight.cpp +++ b/src/mame/drivers/stfight.cpp @@ -1055,13 +1055,13 @@ ROM_END // Note: Marked MACHINE_IMPERFECT_SOUND due to YM2203 clock issue -GAME( 1986, empcity, 0, stfight, stfight, stfight_state, empcity, ROT0, "Seibu Kaihatsu", "Empire City: 1931 (bootleg?)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, empcityu, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito / Romstar license)", "Empire City: 1931 (US)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // different title logo -GAME( 1986, empcityj, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito license)", "Empire City: 1931 (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, empcityi, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Eurobed license)", "Empire City: 1931 (Italy)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, stfight, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, stfighta, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu", "Street Fight (bootleg?)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, stfightgb,empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany - Benelux)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) - -/* Cross Shooter uses the same base board, but different video board */ -GAME( 1987, cshootert, airraid, cshooter, cshooter, stfight_state, cshooter, ROT270, "Seibu Kaihatsu (Taito license)", "Cross Shooter (2 PCB Stack)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, empcity, 0, stfight, stfight, stfight_state, empcity, ROT0, "Seibu Kaihatsu", "Empire City: 1931 (bootleg?)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, empcityu, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito / Romstar license)", "Empire City: 1931 (US)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // different title logo +GAME( 1986, empcityj, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito license)", "Empire City: 1931 (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, empcityi, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Eurobed license)", "Empire City: 1931 (Italy)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, stfight, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, stfighta, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu", "Street Fight (bootleg?)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1986, stfightgb,empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany - Benelux)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) + +// Cross Shooter uses the same base board, but different video board +GAME( 1987, cshootert,airraid, cshooter, cshooter, stfight_state, cshooter, ROT270, "Seibu Kaihatsu (Taito license)", "Cross Shooter (2 PCB Stack)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/stlforce.cpp b/src/mame/drivers/stlforce.cpp index 5dd6e2ae888..196684e83f1 100644 --- a/src/mame/drivers/stlforce.cpp +++ b/src/mame/drivers/stlforce.cpp @@ -210,7 +210,7 @@ static MACHINE_CONFIG_START( stlforce, stlforce_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_OKIM6295_ADD("oki", 937500 , OKIM6295_PIN7_HIGH) + MCFG_OKIM6295_ADD("oki", XTAL_32MHz/32 , OKIM6295_PIN7_HIGH) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 30dd4ec6e68..9abc3fe9b6c 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -2540,7 +2540,25 @@ ROM_START( znpwfv ) STV_BIOS ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ - ROM_LOAD16_BYTE( "epr20398.13", 0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // bad + ROM_LOAD16_BYTE( "epr20398.13", 0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // good + ROM_RELOAD_PLAIN( 0x0200000, 0x0100000) + ROM_RELOAD_PLAIN( 0x0300000, 0x0100000) + ROM_LOAD16_WORD_SWAP( "mpr20400.2", 0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20401.3", 0x0800000, 0x0400000, CRC(99e98937) SHA1(e1b4d12a0b4d0fe97a62fcc085e19cce77657c99) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20402.4", 0x0c00000, 0x0400000, CRC(4572aa60) SHA1(8b2d76ea8c6e2f472c6ee7c9b6ad6e80e6a1a85a) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20403.5", 0x1000000, 0x0400000, CRC(26a8e13e) SHA1(07f5564b704598e3c3580d3d620ecc4f14549dbd) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20404.6", 0x1400000, 0x0400000, CRC(0b70275d) SHA1(47b8672e19c698dc948760f7091f4c6280e728d0) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20399.1", 0x1800000, 0x0400000, CRC(c178a96e) SHA1(65f4aa05187d48ba8ad4fe75ff6ffe1f8524831d) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20405.8", 0x1c00000, 0x0400000, CRC(f53337b7) SHA1(09a21f81016ee54f10554ae1f790415d7436afe0) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20406.9", 0x2000000, 0x0400000, CRC(b677c175) SHA1(d0de7b5a29928036df0bdfced5a8021c0999eb26) ) // good + ROM_LOAD16_WORD_SWAP( "mpr20407.10", 0x2400000, 0x0400000, CRC(58356050) SHA1(f8fb5a14f4ec516093c785891b05d55ae345754e) ) // good +ROM_END + +ROM_START( znpwfvt ) + STV_BIOS + + ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */ + ROM_LOAD16_BYTE( "epr20408.13", 0x0000001, 0x0100000, CRC(1d62fcf6) SHA1(3651261aa755da27b11462f2705311b7c639a687) ) // good ROM_RELOAD_PLAIN( 0x0200000, 0x0100000) ROM_RELOAD_PLAIN( 0x0300000, 0x0100000) ROM_LOAD16_WORD_SWAP( "mpr20400.2", 0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good @@ -3424,6 +3442,7 @@ GAME( 1996, vfkids, stvbios, stv, stv, stv_state, stv, ROT GAME( 1997, vmahjong, stvbios, stv, vmahjong, stv_state, stvmp, ROT0, "Micronet", "Virtual Mahjong (J 961214 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, winterht, stvbios, stv, stv, stv_state, winterht, ROT0, "Sega", "Winter Heat (JUET 971012 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1997, znpwfvt, znpwfv, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (T 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) /* Unemulated printer / camera devices */ // USA sets @@ -3450,7 +3469,7 @@ GAME( 1998, prc298sp, stvbios, stv, stv, stv_state, stv, ROT0 GAME( 1998, prc298su, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Summer Ver (J 980603 V1.100)", MACHINE_NOT_WORKING ) // GAME( 1998, prc298au, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 '98 Autumn Ver (J 980827 V1.000)", MACHINE_NOT_WORKING ) GAME( 2000, prc2ksu, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club 2 2000 Summer (J 000509 V1.000) ", MACHINE_NOT_WORKING ) // internal string 2000_SUMMER - + GAME( 1999, pclubor, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Goukakenran (J 991104 V1.000)", MACHINE_NOT_WORKING ) GAME( 1999, pclubol, stvbios, stv, stv, stv_state, stv, ROT0, "Atlus", "Print Club Olive (J 980717 V1.000)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/suprnova.cpp b/src/mame/drivers/suprnova.cpp index ba70e1ef641..34a3e480ce2 100644 --- a/src/mame/drivers/suprnova.cpp +++ b/src/mame/drivers/suprnova.cpp @@ -1272,7 +1272,33 @@ ROM_START( galpanisk ) ROM_LOAD( "gps30000.u4", 0x000000, 0x400000, CRC(9e4da8e3) SHA1(6506d9300a442883357003a05fd2c78d364c35bb) ) ROM_END -ROM_START( galpans2 ) +ROM_START( galpans2 ) //only the 2 program ROMs were dumped, but mask ROMs are supposed to match. + SKNS_EUROPE + + ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */ + ROM_LOAD16_BYTE( "GPS2E_U6__Ver.3.u6", 0x000000, 0x100000, CRC(72fff5d1) SHA1(57001e04c469281a82a2956c6bc33502d5a3b882) ) + ROM_LOAD16_BYTE( "GPS2E_U4__Ver.3.u4", 0x000001, 0x100000, CRC(95061601) SHA1(f98f1af9877b097e97acc5a3844ef9c523a92843) ) + + ROM_REGION( 0x1000000, "gfx1", 0 ) + ROM_LOAD( "gs210000.u21", 0x000000, 0x400000, CRC(294b2f14) SHA1(90cbd0acdaa2d89d208c28aae33ab57c03624089) ) + ROM_LOAD( "gs210100.u20", 0x400000, 0x400000, CRC(f75c5a9a) SHA1(3919643cee6c88185a1aa3c58c5bc80599bf734e) ) + ROM_LOAD( "gs210200.u8", 0x800000, 0x400000, CRC(25b4f56b) SHA1(f9a33d5ed54a04ecece3035e75508d191bbe74b1) ) + ROM_LOAD( "gs210300.u32", 0xc00000, 0x400000, CRC(db6d4424) SHA1(0a88dafd0ee2490ff2ef39ce8eb1931c41bdda42) ) + + ROM_REGION( 0x800000, "gfx2", 0 ) + ROM_LOAD( "gs220000.u17", 0x000000, 0x400000, CRC(5caae1c0) SHA1(8f77e4cf018d7290b2d804cbff9fccf0bf4d2404) ) + ROM_LOAD( "gs220100.u9", 0x400000, 0x400000, CRC(8d51f197) SHA1(19d2afab823ea179918e7bcbf4df2283e77570f0) ) + + ROM_REGION( 0x800000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */ + /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */ + /* 0x040000 - 0x3fffff empty? */ + ROM_LOAD( "gs221000.u3", 0x400000, 0x400000, CRC(58800a18) SHA1(5e6d55ecd12275662d6f59559e137b759f23fff6) ) + + ROM_REGION( 0x400000, "ymz", 0 ) /* Samples */ + ROM_LOAD( "gs230000.u1", 0x000000, 0x400000, CRC(0348e8e1) SHA1(8a21c7e5cea0bc08a2595213d689c58c0251fdb5) ) +ROM_END + +ROM_START( galpans2j ) SKNS_JAPAN ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */ @@ -1761,6 +1787,28 @@ ROM_START( ryourano ) ROM_END ROM_START( vblokbrk ) + SKNS_EUROPE + + ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */ + ROM_LOAD16_BYTE( "sk000e2-e.u10", 0x000000, 0x080000, CRC(5a278f10) SHA1(6f1be0657da76144b0feeed672d92a85091289b6) ) /* labeled SK000e2/E */ + ROM_LOAD16_BYTE( "sk000e-o.u8", 0x000001, 0x080000, CRC(aecf0647) SHA1(4752e5012bae8e7af3972b455b4346499ec2b49c) ) /* labeled SK000e/O */ + + ROM_REGION( 0x0400000, "gfx1", 0 ) + ROM_LOAD( "sk-100-00.u24", 0x000000, 0x200000, CRC(151dd88a) SHA1(87bb1039a9883f721a315760eb2c4abe4a94046f) ) + ROM_LOAD( "sk-101.u20", 0x200000, 0x100000, CRC(779cce23) SHA1(70147b36d982524ba9921823e481ce8fbb5daa26) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_LOAD( "sk-200-00.u16", 0x000000, 0x200000, CRC(2e297c61) SHA1(4071b945a1294fbc3d18fab1f144bf09af4349e8) ) + + ROM_REGION( 0x400000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */ + /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */ + /* 0x040000 - 0x3fffff empty? */ + + ROM_REGION( 0x200000, "ymz", 0 ) /* Samples */ + ROM_LOAD( "sk-300-00.u4", 0x000000, 0x200000, CRC(e6535c05) SHA1(8895b7c326e0261691cb184887ac1ca637302460) ) +ROM_END + +ROM_START( vblokbrka ) SKNS_ASIA ROM_REGION32_BE( 0x200000, "user1", 0 ) /* SH-2 Code mapped at 0x04000000 */ @@ -1768,18 +1816,18 @@ ROM_START( vblokbrk ) ROM_LOAD16_BYTE( "sk01a.u8", 0x000001, 0x080000, CRC(461e0197) SHA1(003573a4abdbecc6dd234a13c61ef07a25d980e2) ) ROM_REGION( 0x0400000, "gfx1", 0 ) - ROM_LOAD( "sk100-00.u24", 0x000000, 0x200000, CRC(151dd88a) SHA1(87bb1039a9883f721a315760eb2c4abe4a94046f) ) - ROM_LOAD( "sk-101.u20", 0x200000, 0x100000, CRC(779cce23) SHA1(70147b36d982524ba9921823e481ce8fbb5daa26) ) + ROM_LOAD( "sk-100-00.u24", 0x000000, 0x200000, CRC(151dd88a) SHA1(87bb1039a9883f721a315760eb2c4abe4a94046f) ) + ROM_LOAD( "sk-101.u20", 0x200000, 0x100000, CRC(779cce23) SHA1(70147b36d982524ba9921823e481ce8fbb5daa26) ) ROM_REGION( 0x200000, "gfx2", 0 ) - ROM_LOAD( "sk200-00.u16", 0x000000, 0x200000, CRC(2e297c61) SHA1(4071b945a1294fbc3d18fab1f144bf09af4349e8) ) + ROM_LOAD( "sk-200-00.u16", 0x000000, 0x200000, CRC(2e297c61) SHA1(4071b945a1294fbc3d18fab1f144bf09af4349e8) ) ROM_REGION( 0x400000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */ /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */ /* 0x040000 - 0x3fffff empty? */ ROM_REGION( 0x200000, "ymz", 0 ) /* Samples */ - ROM_LOAD( "sk300-00.u4", 0x000000, 0x200000, CRC(e6535c05) SHA1(8895b7c326e0261691cb184887ac1ca637302460) ) + ROM_LOAD( "sk-300-00.u4", 0x000000, 0x200000, CRC(e6535c05) SHA1(8895b7c326e0261691cb184887ac1ca637302460) ) ROM_END ROM_START( sarukani ) @@ -1790,18 +1838,18 @@ ROM_START( sarukani ) ROM_LOAD16_BYTE( "sk1j1.u8", 0x000001, 0x080000, CRC(3b6aa343) SHA1(a969b20b1170d82351024cab9e37f2fbfd01ddeb) ) ROM_REGION( 0x0400000, "gfx1", 0 ) - ROM_LOAD( "sk100-00.u24", 0x000000, 0x200000, CRC(151dd88a) SHA1(87bb1039a9883f721a315760eb2c4abe4a94046f) ) - ROM_LOAD( "sk-101.u20", 0x200000, 0x100000, CRC(779cce23) SHA1(70147b36d982524ba9921823e481ce8fbb5daa26) ) + ROM_LOAD( "sk-100-00.u24", 0x000000, 0x200000, CRC(151dd88a) SHA1(87bb1039a9883f721a315760eb2c4abe4a94046f) ) + ROM_LOAD( "sk-101.u20", 0x200000, 0x100000, CRC(779cce23) SHA1(70147b36d982524ba9921823e481ce8fbb5daa26) ) ROM_REGION( 0x200000, "gfx2", 0 ) - ROM_LOAD( "sk200-00.u16", 0x000000, 0x200000, CRC(2e297c61) SHA1(4071b945a1294fbc3d18fab1f144bf09af4349e8) ) + ROM_LOAD( "sk-200-00.u16", 0x000000, 0x200000, CRC(2e297c61) SHA1(4071b945a1294fbc3d18fab1f144bf09af4349e8) ) ROM_REGION( 0x400000, "gfx3", ROMREGION_ERASE00 ) /* Tiles Plane B */ /* First 0x040000 bytes (0x03ff Tiles) are RAM Based Tiles */ /* 0x040000 - 0x3fffff empty? */ ROM_REGION( 0x200000, "ymz", 0 ) /* Samples */ - ROM_LOAD( "sk300-00.u4", 0x000000, 0x200000, CRC(e6535c05) SHA1(8895b7c326e0261691cb184887ac1ca637302460) ) + ROM_LOAD( "sk-300-00.u4", 0x000000, 0x200000, CRC(e6535c05) SHA1(8895b7c326e0261691cb184887ac1ca637302460) ) ROM_END @@ -1825,7 +1873,8 @@ GAME( 1997, jjparad2, skns, sknsj, skns_1p, skns_state, jjparad2, ROT0, GAME( 1997, sengekis, skns, sknsa, skns, skns_state, sengekis, ROT90, "Kaneko / Warashi", "Sengeki Striker (Asia)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, sengekisj, sengekis, sknsj, skns, skns_state, sengekij, ROT90, "Kaneko / Warashi", "Sengeki Striker (Japan)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1997, vblokbrk, skns, sknsa, vblokbrk, skns_state, sarukani, ROT0, "Kaneko / Mediaworks", "VS Block Breaker (Asia)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1997, vblokbrk, skns, sknse, vblokbrk, skns_state, sarukani, ROT0, "Kaneko / Mediaworks", "VS Block Breaker (Europe)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1997, vblokbrka, vblokbrk, sknsa, vblokbrk, skns_state, sarukani, ROT0, "Kaneko / Mediaworks", "VS Block Breaker (Asia)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, sarukani, vblokbrk, sknsj, vblokbrk, skns_state, sarukani, ROT0, "Kaneko / Mediaworks", "Saru-Kani-Hamu-Zou (Japan)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1998, cyvern, skns, sknsu, cyvern, skns_state, cyvern, ROT90, "Kaneko", "Cyvern (US)", MACHINE_IMPERFECT_GRAPHICS ) @@ -1841,7 +1890,8 @@ GAME( 1998, puzzloopu, puzzloop, sknsu, puzzloop, skns_state, puzzloopu, ROT0, GAME( 1998, ryouran , skns, sknsj, skns_1p, skns_state, ryouran, ROT0, "Electro Design", "VS Mahjong Otome Ryouran (set 1)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1998, ryourano, ryouran, sknsj, skns_1p, skns_state, ryouran, ROT0, "Electro Design", "VS Mahjong Otome Ryouran (set 2)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1999, galpans2, skns, sknsj, galpanis, skns_state, galpans2, ROT0, "Kaneko", "Gals Panic S2 (Japan)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1999, galpans2, skns, sknse, galpanis, skns_state, galpans2, ROT0, "Kaneko", "Gals Panic S2 (Europe)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1999, galpans2j, galpans2, sknsj, galpanis, skns_state, galpans2, ROT0, "Kaneko", "Gals Panic S2 (Japan)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1999, galpans2a, galpans2, sknsa, galpanis, skns_state, galpans2, ROT0, "Kaneko", "Gals Panic S2 (Asia)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1999, galpansu, galpans2, sknsk, galpanis, skns_state, galpans2, ROT0, "Kaneko", "Gals Panic SU (Korea)", MACHINE_IMPERFECT_GRAPHICS ) // official or hack? diff --git a/src/mame/drivers/taito_f3.cpp b/src/mame/drivers/taito_f3.cpp index e3cecd934c1..0606a1e194f 100644 --- a/src/mame/drivers/taito_f3.cpp +++ b/src/mame/drivers/taito_f3.cpp @@ -4208,11 +4208,11 @@ GAME( 1994, hthero94, intcup94, f3_224a, f3, taito_f3_state, intcup94, ROT0, " GAME( 1994, kaiserkn, 0, f3_224a, kn, taito_f3_state, kaiserkn, ROT0, "Taito Corporation Japan", "Kaiser Knuckle (Ver 2.1O 1994/07/29)", 0 ) GAME( 1994, kaiserknj,kaiserkn, f3_224a, kn, taito_f3_state, kaiserkn, ROT0, "Taito Corporation", "Kaiser Knuckle (Ver 2.1J 1994/07/29)", 0 ) GAME( 1994, gblchmp, kaiserkn, f3_224a, kn, taito_f3_state, kaiserkn, ROT0, "Taito America Corporation", "Global Champion (Ver 2.1A 1994/07/29)", 0 ) -GAME( 1994, dankuga, kaiserkn, f3_224a, kn, taito_f3_state, kaiserkn, ROT0, "Taito Corporation", "Dan-Ku-Ga (Ver 0.0J 1994/12/13, prototype)", 0 ) +GAME( 1994, dankuga, 0, f3_224a, kn, taito_f3_state, kaiserkn, ROT0, "Taito Corporation", "Dan-Ku-Ga (Ver 0.0J 1994/12/13, prototype)", 0 ) GAME( 1994, dariusg, 0, f3, f3, taito_f3_state, dariusg, ROT0, "Taito Corporation Japan", "Darius Gaiden - Silver Hawk (Ver 2.5O 1994/09/19)", 0 ) GAME( 1994, dariusgj, dariusg, f3, f3, taito_f3_state, dariusg, ROT0, "Taito Corporation", "Darius Gaiden - Silver Hawk (Ver 2.5J 1994/09/19)", 0 ) GAME( 1994, dariusgu, dariusg, f3, f3, taito_f3_state, dariusg, ROT0, "Taito America Corporation", "Darius Gaiden - Silver Hawk (Ver 2.5A 1994/09/19)", 0 ) -GAME( 1994, dariusgx, dariusg, f3, f3, taito_f3_state, dariusg, ROT0, "Taito Corporation", "Darius Gaiden - Silver Hawk Extra Version (Ver 2.7J 1995/03/06) (Official Hack)", 0 ) +GAME( 1994, dariusgx, 0, f3, f3, taito_f3_state, dariusg, ROT0, "Taito Corporation", "Darius Gaiden - Silver Hawk Extra Version (Ver 2.7J 1995/03/06) (Official Hack)", 0 ) GAME( 1994, bublbob2, 0, f3_224a, f3, taito_f3_state, bubsymph, ROT0, "Taito Corporation Japan", "Bubble Bobble II (Ver 2.6O 1994/12/16)", 0 ) GAME( 1994, bublbob2o,bublbob2, f3_224a, f3, taito_f3_state, bubsymph, ROT0, "Taito Corporation Japan", "Bubble Bobble II (Ver 2.5O 1994/10/05)", 0 ) GAME( 1994, bublbob2p,bublbob2, f3_224a, f3, taito_f3_state, bubsymph, ROT0, "Taito Corporation Japan", "Bubble Bobble II (Ver 0.0J 1993/12/13, prototype)", 0 ) diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp index e2366c02cb0..268e222bdc3 100644 --- a/src/mame/drivers/taito_l.cpp +++ b/src/mame/drivers/taito_l.cpp @@ -1881,7 +1881,7 @@ static MACHINE_CONFIG_DERIVED( puzznic, plotting ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(puzznic_map) - MCFG_DEVICE_ADD("mcu", ARKANOID_68705P3, XTAL_13_33056MHz / 4) /* clock is complete guess */ + MCFG_DEVICE_ADD("mcu", ARKANOID_68705P3, XTAL_3MHz) MCFG_MACHINE_RESET_OVERRIDE(taitol_1cpu_state, puzznic) MACHINE_CONFIG_END @@ -2291,7 +2291,7 @@ ROM_START( puzznic ) ROM_LOAD( "c20-09.ic11", 0x00000, 0x20000, CRC(156d6de1) SHA1(c247936b62ef354851c9bace76a7a0aa14194d5f) ) ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */ - ROM_LOAD( "mc68705p3.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) ) + ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) ) ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD16_BYTE( "c20-07.ic10", 0x00000, 0x10000, CRC(be12749a) SHA1(c67d1a434486843a6776d89e905362b7db595d8d) ) @@ -2301,12 +2301,27 @@ ROM_START( puzznic ) ROM_LOAD( "mmipal20l8.ic3", 0x0000, 0x0800, NO_DUMP ) ROM_END +ROM_START( puzznicu ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "c20-10.ic11", 0x00000, 0x20000, CRC(3522d2e5) SHA1(2428663d1d71f2920c69cd2cd907f0750c22af77) ) + + ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */ + ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) ) + + ROM_REGION( 0x40000, "gfx1", 0 ) + ROM_LOAD16_BYTE( "c20-03.ic10", 0x00000, 0x20000, CRC(4264056c) SHA1(d2d8a170ae0f361093a5384935238605a59e5938) ) + ROM_LOAD16_BYTE( "c20-02.ic9", 0x00001, 0x20000, CRC(3c115f8b) SHA1(8d518be01b7c4d6d993d5d9b62aab719a5c8baca) ) + + ROM_REGION( 0x0800, "pals", 0 ) + ROM_LOAD( "mmipal20l8.ic3", 0x0000, 0x0800, NO_DUMP ) +ROM_END + ROM_START( puzznicj ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "c20-04.ic11", 0x00000, 0x20000, CRC(a4150b6c) SHA1(27719b8993735532cd59f4ed5693ff3143ee2336) ) ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */ - ROM_LOAD( "mc68705p3.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) ) + ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) ) ROM_REGION( 0x40000, "gfx1", 0 ) ROM_LOAD16_BYTE( "c20-03.ic10", 0x00000, 0x20000, CRC(4264056c) SHA1(d2d8a170ae0f361093a5384935238605a59e5938) ) @@ -2555,6 +2570,7 @@ GAME( 1989, plottingu, plotting, plotting, plottingu, driver_device, 0, GAME( 1989, flipull, plotting, plotting, plotting, driver_device, 0, ROT0, "Taito Corporation", "Flipull (Japan)", 0 ) GAME( 1989, puzznic, 0, puzznic, puzznic, driver_device, 0, ROT0, "Taito Corporation Japan", "Puzznic (World)", 0 ) +GAME( 1989, puzznicu, puzznic, puzznic, puzznic, driver_device, 0, ROT0, "Taito America Corporation", "Puzznic (US)", 0 ) GAME( 1989, puzznicj, puzznic, puzznic, puzznic, driver_device, 0, ROT0, "Taito Corporation", "Puzznic (Japan)", 0 ) GAME( 1989, puzznici, puzznic, puzznici, puzznic, driver_device, 0, ROT0, "bootleg", "Puzznic (Italian bootleg)", 0 ) GAME( 1989, puzznicb, puzznic, puzznici, puzznic, driver_device, 0, ROT0, "bootleg", "Puzznic (bootleg, set 1)", 0 ) diff --git a/src/mame/drivers/taitosj.cpp b/src/mame/drivers/taitosj.cpp index a61b3187e1b..1e3d6578a6a 100644 --- a/src/mame/drivers/taitosj.cpp +++ b/src/mame/drivers/taitosj.cpp @@ -557,7 +557,7 @@ static INPUT_PORTS_START( spacecr ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Continue") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -567,7 +567,7 @@ static INPUT_PORTS_START( spacecr ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Continue") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) diff --git a/src/mame/drivers/tb303.cpp b/src/mame/drivers/tb303.cpp index f76c39e5dc0..c15c61e1dab 100644 --- a/src/mame/drivers/tb303.cpp +++ b/src/mame/drivers/tb303.cpp @@ -26,8 +26,8 @@ public: : hh_ucom4_state(mconfig, type, tag) { } - uint8_t m_ram[0xc00]; - uint16_t m_ram_address; + u8 m_ram[0xc00]; + u16 m_ram_address; bool m_ram_ce; bool m_ram_we; @@ -67,7 +67,7 @@ void tb303_state::refresh_ram() // MCU E2,E3 goes through a 4556 IC(pin 14,13) to one of uPD444 _CE: // _Q0: N/C, _Q1: IC-5, _Q2: IC-3, _Q3: IC-4 m_ram_ce = true; - uint8_t hi = 0; + u8 hi = 0; switch (m_port[NEC_UCOM4_PORTE] >> 2 & 3) { case 0: m_ram_ce = false; break; diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp index ed90b761427..52aa2e411b1 100644 --- a/src/mame/drivers/tempest.cpp +++ b/src/mame/drivers/tempest.cpp @@ -477,7 +477,7 @@ static INPUT_PORTS_START( tempest ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT ) PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") /* bit 6 is the VG HALT bit. We set it to "low" */ /* per default (busy vector processor). */ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_tempest_device, done_r, nullptr) diff --git a/src/mame/drivers/thayers.cpp b/src/mame/drivers/thayers.cpp index 3b978e2d41f..5a6653b750a 100644 --- a/src/mame/drivers/thayers.cpp +++ b/src/mame/drivers/thayers.cpp @@ -19,6 +19,7 @@ #include "cpu/cop400/cop400.h" #include "thayers.lh" +#define LOG 0 struct ssi263_t { @@ -56,6 +57,9 @@ public: uint8_t m_laserdisc_data; int m_rx_bit; int m_keylatch; + uint8_t m_keydata; + bool m_kbdata; + bool m_kbclk; uint8_t m_cop_data_latch; int m_cop_data_latch_enable; uint8_t m_cop_l; @@ -78,8 +82,8 @@ public: DECLARE_READ8_MEMBER(cop_g_r); DECLARE_WRITE8_MEMBER(control_w); DECLARE_WRITE8_MEMBER(cop_g_w); - DECLARE_READ_LINE_MEMBER(cop_si_r); - DECLARE_WRITE_LINE_MEMBER(cop_so_w); + DECLARE_READ_LINE_MEMBER(kbdata_r); + DECLARE_WRITE_LINE_MEMBER(kbclk_w); DECLARE_WRITE8_MEMBER(control2_w); DECLARE_READ8_MEMBER(dsw_b_r); DECLARE_READ8_MEMBER(laserdsc_data_r); @@ -125,7 +129,7 @@ void thayers_state::check_interrupt() { if (!m_timer_int || !m_data_rdy_int || !m_ssi_data_request) { - m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); } else { @@ -137,7 +141,7 @@ WRITE8_MEMBER(thayers_state::intrq_w) { // T = 1.1 * R30 * C53 = 1.1 * 750K * 0.01uF = 8.25 ms - m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); timer_set(attotime::from_usec(8250), TIMER_INTRQ_TICK); } @@ -159,11 +163,13 @@ READ8_MEMBER(thayers_state::irqstate_r) */ - return (m_data_rdy_int << 5) | (m_timer_int << 4) | 0x08 | (m_ssi_data_request << 2); + return m_cart_present << 6 | (m_data_rdy_int << 5) | (m_timer_int << 4) | 0x08 | (m_ssi_data_request << 2); } WRITE8_MEMBER(thayers_state::timer_int_ack_w) { + if (LOG) logerror("%s %s TIMER INT ACK\n", machine().time().as_string(), machine().describe_context()); + m_timer_int = 1; check_interrupt(); @@ -171,6 +177,8 @@ WRITE8_MEMBER(thayers_state::timer_int_ack_w) WRITE8_MEMBER(thayers_state::data_rdy_int_ack_w) { + if (LOG) logerror("%s %s DATA RDY INT ACK\n", machine().time().as_string(), machine().describe_context()); + m_data_rdy_int = 1; check_interrupt(); @@ -191,11 +199,13 @@ WRITE8_MEMBER(thayers_state::cop_d_w) if (!BIT(data, 0)) { + if (LOG) logerror("%s %s TIMER INT\n", machine().time().as_string(), machine().describe_context()); m_timer_int = 0; } if (!BIT(data, 1)) { + if (LOG) logerror("%s %s DATA RDY INT\n", machine().time().as_string(), machine().describe_context()); m_data_rdy_int = 0; } @@ -219,6 +229,7 @@ READ8_MEMBER(thayers_state::cop_data_r) WRITE8_MEMBER(thayers_state::cop_data_w) { m_cop_data_latch = data; + if (LOG) logerror("COP DATA %02x\n", m_cop_data_latch); } READ8_MEMBER(thayers_state::cop_l_r) @@ -236,6 +247,7 @@ READ8_MEMBER(thayers_state::cop_l_r) WRITE8_MEMBER(thayers_state::cop_l_w) { m_cop_l = data; + if (LOG) logerror("COP L %02x\n", m_cop_l); } READ8_MEMBER(thayers_state::cop_g_r) @@ -272,6 +284,7 @@ WRITE8_MEMBER(thayers_state::control_w) */ m_cop_cmd_latch = (data >> 5) & 0x07; + if (LOG) logerror("COP G0..2 %u\n", m_cop_cmd_latch); } WRITE8_MEMBER(thayers_state::cop_g_w) @@ -288,63 +301,66 @@ WRITE8_MEMBER(thayers_state::cop_g_w) */ m_cop_data_latch_enable = BIT(data, 3); + if (LOG) logerror("U17 enable %u\n", m_cop_data_latch_enable); } /* Keyboard */ -READ_LINE_MEMBER(thayers_state::cop_si_r) +READ_LINE_MEMBER(thayers_state::kbdata_r) { - /* keyboard data */ - - /* - - Serial communications format - - 1, 1, 0, 1, Q8, P0, P1, P2, P3, 0 - - */ - - switch (m_rx_bit) - { - case 0: - case 1: - case 3: - return 1; - - case 4: - return (m_keylatch == 9); - - case 5: - case 6: - case 7: - case 8: - return BIT(m_row[m_keylatch]->read(), m_rx_bit - 5); - - default: - return 0; - } + if (LOG) logerror("%s KBDATA %u BIT %u\n",machine().time().as_string(),m_kbdata,m_rx_bit); + return m_kbdata; } -WRITE_LINE_MEMBER(thayers_state::cop_so_w) +WRITE_LINE_MEMBER(thayers_state::kbclk_w) { - /* keyboard clock */ + if (m_kbclk != state) { + if (LOG) logerror("%s %s KBCLK %u\n", machine().time().as_string(), machine().describe_context(),state); + } - if (state) - { + if (!m_kbclk && state) { m_rx_bit++; - if (m_rx_bit == 10) + // 1, 1, 0, 1, Q9, P3, P2, P1, P0, 0 + switch (m_rx_bit) { + case 0: case 1: case 3: + m_kbdata = 1; + break; + + case 2: case 9: + m_kbdata = 0; + break; + + case 10: m_rx_bit = 0; + m_kbdata = 1; m_keylatch++; - if (m_keylatch == 10) - { + if (m_keylatch == 10) { m_keylatch = 0; } + + m_keydata = m_row[m_keylatch]->read(); + + if (LOG) logerror("keylatch %u\n",m_keylatch); + break; + + case 4: + m_kbdata = (m_keylatch == 9); + break; + + default: + m_kbdata = BIT(m_keydata, 3); + m_keydata <<= 1; + + if (LOG) logerror("keydata %02x shift\n",m_keydata); + break; } } + + m_kbclk = state; } /* I/O Board */ @@ -477,13 +493,11 @@ WRITE8_MEMBER(thayers_state::den2_w) #define SSI263_CLOCK (XTAL_4MHz/2) -#if 0 static const char SSI263_PHONEMES[0x40][5] = { "PA", "E", "E1", "Y", "YI", "AY", "IE", "I", "A", "AI", "EH", "EH1", "AE", "AE1", "AH", "AH1", "W", "O", "OU", "OO", "IU", "IU1", "U", "U1", "UH", "UH1", "UH2", "UH3", "ER", "R", "R1", "R2", "L", "L1", "LF", "W", "B", "D", "KV", "P", "T", "K", "HV", "HVC", "HF", "HFC", "HN", "Z", "S", "J", "SCH", "V", "F", "THV", "TH", "M", "N", "NG", ":A", ":OH", ":U", ":UH", "E2", "LB" }; -#endif WRITE8_MEMBER(thayers_state::ssi263_register_w) { @@ -520,6 +534,7 @@ WRITE8_MEMBER(thayers_state::ssi263_register_w) //logerror("SSI263 Phoneme Duration: %u\n", ssi263.dr); //logerror("SSI263 Phoneme: %02x %s\n", ssi263.p, SSI263_PHONEMES[ssi263.p]); + if (LOG && ssi263.p) printf("%s ", SSI263_PHONEMES[ssi263.p]); } break; @@ -677,64 +692,64 @@ static INPUT_PORTS_START( thayers ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, thayers_state,laserdisc_ready_r, nullptr) PORT_START("ROW.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "2" ) PORT_CODE( KEYCODE_F2 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "1 - Clear" ) PORT_CODE( KEYCODE_BACKSPACE ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Q" ) PORT_CODE( KEYCODE_Q ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( Yes ) ) PORT_CODE( KEYCODE_0_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 YES") PORT_CODE(KEYCODE_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1 CLEAR") PORT_CODE(KEYCODE_F1) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_START("ROW.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Z - Spell of Release" ) PORT_CODE( KEYCODE_Z ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "A" ) PORT_CODE( KEYCODE_A ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "W - Amulet" ) PORT_CODE( KEYCODE_W ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Items" ) PORT_CODE( KEYCODE_1_PAD ) - + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 ITEMS") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W AMULET") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z SPELL OF RELEASE") PORT_CODE(KEYCODE_Z) + PORT_START("ROW.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "X - Scepter" ) PORT_CODE( KEYCODE_X ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "S - Dagger" ) PORT_CODE( KEYCODE_S ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "E - Black Mace" ) PORT_CODE( KEYCODE_E ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Drop Item" ) PORT_CODE( KEYCODE_2_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 DROP ITEM") PORT_CODE(KEYCODE_3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E BLACK MACE") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S DAGGER") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X SCEPTER") PORT_CODE(KEYCODE_X) PORT_START("ROW.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "C - Spell of Seeing" ) PORT_CODE( KEYCODE_C ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "D - Great Circlet" ) PORT_CODE( KEYCODE_D ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "R - Blood Sword" ) PORT_CODE( KEYCODE_R ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Give Score" ) PORT_CODE( KEYCODE_3_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 GIVE SCORE") PORT_CODE(KEYCODE_4) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R BLOOD SWORD") PORT_CODE(KEYCODE_R) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D GREAT CIRCLET") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C SPELL OF SEEING") PORT_CODE(KEYCODE_C) PORT_START("ROW.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "V - Shield" ) PORT_CODE( KEYCODE_V ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "F - Hunting Horn" ) PORT_CODE( KEYCODE_F ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "T - Chalice" ) PORT_CODE( KEYCODE_T ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Replay" ) PORT_CODE( KEYCODE_4_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 REPLAY") PORT_CODE(KEYCODE_5) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T CHALICE") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F HUNTING HORN") PORT_CODE(KEYCODE_F) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V SHIELD") PORT_CODE(KEYCODE_V) PORT_START("ROW.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "B - Silver Wheat" ) PORT_CODE( KEYCODE_B ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "G - Long Bow" ) PORT_CODE( KEYCODE_G ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Y - Coins" ) PORT_CODE( KEYCODE_Y ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Combine Action" ) PORT_CODE( KEYCODE_6_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 COMBINE ACTION") PORT_CODE(KEYCODE_6) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y COINS") PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G LONG BOW") PORT_CODE(KEYCODE_G) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B SILVER WHEAT") PORT_CODE(KEYCODE_B) PORT_START("ROW.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "N - Staff" ) PORT_CODE( KEYCODE_N ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "H - Medallion" ) PORT_CODE( KEYCODE_H ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "U - Cold Fire" ) PORT_CODE( KEYCODE_U ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Save Game" ) PORT_CODE( KEYCODE_7_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 SAVE GAME") PORT_CODE(KEYCODE_7) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U COLD FIRE") PORT_CODE(KEYCODE_U) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H MEDALLION") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N STAFF") PORT_CODE(KEYCODE_N) PORT_START("ROW.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "M - Spell of Understanding" ) PORT_CODE( KEYCODE_M ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "J - Onyx Seal" ) PORT_CODE( KEYCODE_J ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "I - Crown" ) PORT_CODE( KEYCODE_I ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Update" ) PORT_CODE( KEYCODE_8_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 UPDATE") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I CROWN") PORT_CODE(KEYCODE_I) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J ONYX SEAL") PORT_CODE(KEYCODE_J) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M SPELL OF UNDERSTANDING") PORT_CODE(KEYCODE_M) PORT_START("ROW.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "3 - Enter" ) PORT_CODE( KEYCODE_ENTER ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "K - Orb of Quoid" ) PORT_CODE( KEYCODE_K ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "O - Crystal" ) PORT_CODE( KEYCODE_O ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "Hint" ) PORT_CODE( KEYCODE_9_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 HINT") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O CRYSTAL") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K ORB OF QUOID") PORT_CODE(KEYCODE_K) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4 SPACE") PORT_CODE(KEYCODE_F4) PORT_CODE(KEYCODE_SPACE) PORT_START("ROW.9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "4 - Space" ) PORT_CODE( KEYCODE_SPACE ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "L" ) PORT_CODE( KEYCODE_L ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "P" ) PORT_CODE( KEYCODE_P ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( DEF_STR( No ) ) PORT_CODE( KEYCODE_0_PAD ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 NO") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3 ENTER") PORT_CODE(KEYCODE_F3) PORT_CODE(KEYCODE_ENTER) INPUT_PORTS_END /* Machine Initialization */ @@ -749,7 +764,9 @@ void thayers_state::machine_reset() m_laserdisc_data = 0; m_rx_bit = 0; + m_kbdata = 1; m_keylatch = 0; + m_keydata = m_row[m_keylatch]->read(); m_cop_data_latch = 0; m_cop_data_latch_enable = 0; @@ -762,9 +779,6 @@ void thayers_state::machine_reset() m_cart_present = 0; m_pr7820_enter = 0; - -// newtype = (ioport("DSWB")->read() & 0x18) ? LASERDISC_TYPE_PIONEER_LDV1000 : LASERDISC_TYPE_PIONEER_PR7820; -// laserdisc_set_type(m_laserdisc, newtype); } /* Machine Driver */ @@ -783,8 +797,8 @@ static MACHINE_CONFIG_START( thayers, thayers_state ) MCFG_COP400_READ_G_CB(READ8(thayers_state, cop_g_r)) MCFG_COP400_WRITE_G_CB(WRITE8(thayers_state, cop_g_w)) MCFG_COP400_WRITE_D_CB(WRITE8(thayers_state, cop_d_w)) - MCFG_COP400_READ_SI_CB(READLINE(thayers_state, cop_si_r)) - MCFG_COP400_WRITE_SO_CB(WRITELINE(thayers_state, cop_so_w)) + MCFG_COP400_READ_SI_CB(READLINE(thayers_state, kbdata_r)) + MCFG_COP400_WRITE_SO_CB(WRITELINE(thayers_state, kbclk_w)) MCFG_LASERDISC_PR7820_ADD("laserdisc") diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index 3307a0d3473..7ae4ab0b623 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -97,10 +97,10 @@ public: required_ioport_array<8> m_key_matrix; required_ioport m_battery_inp; - uint8_t m_key_select; - uint8_t m_power; + u8 m_key_select; + u8 m_power; - void update_lcd_indicator(uint8_t y, uint8_t x, int state); + void update_lcd_indicator(u8 y, u8 x, int state); void update_battery_status(int state); DECLARE_READ8_MEMBER(keyboard_r); @@ -126,7 +126,7 @@ public: DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge) { - uint32_t size = m_cart->common_get_size("rom"); + u32 size = m_cart->common_get_size("rom"); // max size is 32KB if (size > 0x8000) @@ -156,7 +156,7 @@ PALETTE_INIT_MEMBER(ti74_state, ti74) palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off } -void ti74_state::update_lcd_indicator(uint8_t y, uint8_t x, int state) +void ti74_state::update_lcd_indicator(u8 y, u8 x, int state) { // TI-74 ref._________________... // output# |10 11 12 13 14 2 3 4 @@ -229,7 +229,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) READ8_MEMBER(ti74_state::keyboard_r) { - uint8_t ret = 0; + u8 ret = 0; // read selected keyboard rows for (int i = 0; i < 8; i++) @@ -266,7 +266,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("sysram.ic3") - //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot + //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank") ADDRESS_MAP_END diff --git a/src/mame/drivers/ticalc1x.cpp b/src/mame/drivers/ticalc1x.cpp index 5a56e557238..2eec28f1d22 100644 --- a/src/mame/drivers/ticalc1x.cpp +++ b/src/mame/drivers/ticalc1x.cpp @@ -76,11 +76,11 @@ void cmulti8_state::prepare_display() set_display_segmask(0xfffff, 0xff); // M-digit is on in memory mode, upper row is off in single mode - uint32_t m = (m_inp_matrix[10]->read() & 0x10) ? 0x100000 : 0; - uint32_t mask = (m_inp_matrix[10]->read() & 0x20) ? 0xfffff : 0xffc00; + u32 m = (m_inp_matrix[10]->read() & 0x10) ? 0x100000 : 0; + u32 mask = (m_inp_matrix[10]->read() & 0x20) ? 0xfffff : 0xffc00; // R10 selects display row - uint32_t sel = (m_r & 0x400) ? (m_r & 0x3ff) : (m_r << 10 & 0xffc00); + u32 sel = (m_r & 0x400) ? (m_r & 0x3ff) : (m_r << 10 & 0xffc00); display_matrix(8, 21, m_o, (sel & mask) | m); } @@ -865,8 +865,8 @@ public: WRITE16_MEMBER(lilprof78_state::write_r) { // update leds state - uint8_t seg = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; - uint16_t r = (data & 7) | (data << 1 & 0x1f0); + u8 seg = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; + u16 r = (data & 7) | (data << 1 & 0x1f0); set_display_segmask(0x1ff, 0x7f); display_matrix(7, 9, seg, r, false); diff --git a/src/mame/drivers/tigeroad.cpp b/src/mame/drivers/tigeroad.cpp index ae4d234dfac..25164f91ad0 100644 --- a/src/mame/drivers/tigeroad.cpp +++ b/src/mame/drivers/tigeroad.cpp @@ -84,9 +84,18 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, tigeroad_state ) AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("ram16") ADDRESS_MAP_END -static ADDRESS_MAP_START( bballs_map, AS_PROGRAM, 16, tigeroad_state ) +static ADDRESS_MAP_START( pushman_map, AS_PROGRAM, 16, pushman_state ) + AM_IMPORT_FROM(main_map) + + AM_RANGE(0x060000, 0x060007) AM_READ(mcu_comm_r) + AM_RANGE(0x060000, 0x060003) AM_WRITE(pushman_mcu_comm_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bballs_map, AS_PROGRAM, 16, pushman_state ) ADDRESS_MAP_GLOBAL_MASK(0xfffff) AM_RANGE(0x00000, 0x3ffff) AM_ROM + AM_RANGE(0x60000, 0x60007) AM_READ(mcu_comm_r) + AM_RANGE(0x60000, 0x60001) AM_WRITE(bballs_mcu_comm_w) // are these mirror addresses or does this PCB have a different addressing? AM_RANGE(0xe0800, 0xe17ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xe4000, 0xe4001) AM_READ_PORT("P1_P2") AM_WRITE(tigeroad_videoctrl_w) @@ -125,13 +134,6 @@ static ADDRESS_MAP_START( sample_port_map, AS_IO, 8, tigeroad_state ) AM_RANGE(0x01, 0x01) AM_WRITE(msm5205_w) ADDRESS_MAP_END -/* Pushman ONLY */ -static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, tigeroad_state ) - AM_RANGE(0x0000, 0x0007) AM_READWRITE(pushman_68000_r, pushman_68000_w) - AM_RANGE(0x0010, 0x007f) AM_RAM - AM_RANGE(0x0080, 0x0fff) AM_ROM -ADDRESS_MAP_END - /* Pushman / Bouncing Balls */ static ADDRESS_MAP_START( comad_sound_map, AS_PROGRAM, 8, tigeroad_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM @@ -570,25 +572,6 @@ static GFXDECODE_START( tigeroad ) GFXDECODE_ENTRY( "sprites", 0, sprite_layout, 0x200, 16 ) GFXDECODE_END -void tigeroad_state::machine_start() -{ - save_item(NAME(m_control)); - save_item(NAME(m_shared_ram)); - save_item(NAME(m_latch)); - save_item(NAME(m_new_latch)); -} - -MACHINE_RESET_MEMBER(tigeroad_state,pushman) -{ - // todo, move to an MCU sim reset function in machine/tigeroad.c - m_latch = 0; - m_new_latch = 0; - m_control[0] = 0; - m_control[1] = 0; - - memset(m_shared_ram, 0, ARRAY_LENGTH(m_shared_ram)); -} - static MACHINE_CONFIG_START( tigeroad, tigeroad_state ) /* basic machine hardware */ @@ -699,25 +682,31 @@ static MACHINE_CONFIG_START( f1dream_comad, tigeroad_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( pushman, f1dream_comad ) - MCFG_CPU_ADD("mcu", M68705, 4000000) /* No idea */ - MCFG_CPU_PROGRAM_MAP(mcu_map) - MCFG_MACHINE_RESET_OVERRIDE(tigeroad_state,pushman) -MACHINE_CONFIG_END - -MACHINE_RESET_MEMBER(tigeroad_state,bballs) +void pushman_state::machine_start() { - MACHINE_RESET_CALL_MEMBER(pushman); - - m_latch = 0x400; + save_item(NAME(m_host_semaphore)); + save_item(NAME(m_mcu_semaphore)); + save_item(NAME(m_host_latch)); + save_item(NAME(m_mcu_latch)); + save_item(NAME(m_mcu_output)); + save_item(NAME(m_mcu_latch_ctl)); } -static MACHINE_CONFIG_DERIVED( bballs, f1dream_comad ) +static MACHINE_CONFIG_DERIVED_CLASS(pushman, f1dream_comad, pushman_state) MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(bballs_map) + MCFG_CPU_PROGRAM_MAP(pushman_map) + + MCFG_CPU_ADD("mcu", M68705R3, 4000000) /* No idea */ + MCFG_M68705_PORTA_W_CB(WRITE8(pushman_state, mcu_pa_w)) + MCFG_M68705_PORTB_W_CB(WRITE8(pushman_state, mcu_pb_w)) + MCFG_M68705_PORTC_W_CB(WRITE8(pushman_state, mcu_pc_w)) +MACHINE_CONFIG_END - MCFG_MACHINE_RESET_OVERRIDE(tigeroad_state,bballs) + +static MACHINE_CONFIG_DERIVED(bballs, pushman) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bballs_map) MACHINE_CONFIG_END @@ -1120,8 +1109,8 @@ ROM_START( bballs ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "bb13.n4", 0x00000, 0x08000, CRC(1ef78175) SHA1(2e7dcbab3a572c2a6bb67a36ba283a5faeb14a88) ) - ROM_REGION( 0x01000, "cpu2", 0 ) - ROM_LOAD( "68705.uc", 0x00000, 0x01000, NO_DUMP ) + ROM_REGION( 0x01000, "mcu", 0 ) /* using dump from bballsa set */ + ROM_LOAD( "mc68705r3.bin", 0x00000, 0x01000, CRC(4b37b853) SHA1(c95b7b1dcc6f4730fd08535001e2f02b34ea14c2) BAD_DUMP ) ROM_REGION( 0x10000, "text", 0 ) ROM_LOAD( "bb1.g20", 0x00000, 0x08000, CRC(b62dbcb8) SHA1(121613f6d2bcd226e71d4ae71830b9b0d15c2331) ) @@ -1153,8 +1142,8 @@ ROM_START( bballsa ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "13.ic216", 0x00000, 0x08000, CRC(1ef78175) SHA1(2e7dcbab3a572c2a6bb67a36ba283a5faeb14a88) ) - ROM_REGION( 0x01000, "cpu2", 0 ) - ROM_LOAD( "68705.uc", 0x00000, 0x01000, NO_DUMP ) + ROM_REGION( 0x01000, "mcu", 0 ) + ROM_LOAD( "mc68705r3.bin", 0x00000, 0x01000, CRC(4b37b853) SHA1(c95b7b1dcc6f4730fd08535001e2f02b34ea14c2) ) ROM_REGION( 0x10000, "text", 0 ) ROM_LOAD( "1.ic130", 0x00000, 0x08000, CRC(67672444) SHA1(f1d4681999d44e8d3cbf26b8a9c05f50573e0df6) ) @@ -1179,41 +1168,29 @@ ROM_START( bballsa ) ROM_END -DRIVER_INIT_MEMBER(tigeroad_state,f1dream) +DRIVER_INIT_MEMBER(tigeroad_state, f1dream) { m_maincpu->space(AS_PROGRAM).install_write_handler(0xfe4002, 0xfe4003, write16_delegate(FUNC(tigeroad_state::f1dream_control_w),this)); } -DRIVER_INIT_MEMBER(tigeroad_state,pushman) -{ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x060000, 0x060007, read16_delegate(FUNC(tigeroad_state::pushman_68705_r),this), write16_delegate(FUNC(tigeroad_state::pushman_68705_w),this) ); - m_has_coinlock = 0; -} - -DRIVER_INIT_MEMBER(tigeroad_state,bballs) -{ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x060000, 0x060007, read16_delegate(FUNC(tigeroad_state::bballs_68705_r),this), write16_delegate(FUNC(tigeroad_state::bballs_68705_w),this) ); - m_has_coinlock = 0; -} - /***************************************************************************/ -GAME( 1987, tigeroad, 0, tigeroad, tigeroad, driver_device, 0, ROT0, "Capcom", "Tiger Road (US)", 0 ) -GAME( 1987, tigeroadu,tigeroad, tigeroad, tigeroad, driver_device, 0, ROT0, "Capcom (Romstar license)", "Tiger Road (US, Romstar license)", 0 ) -GAME( 1987, toramich, tigeroad, toramich, toramich, driver_device, 0, ROT0, "Capcom", "Tora e no Michi (Japan)", 0 ) -GAME( 1987, tigeroadb,tigeroad, tigeroad, tigeroad, driver_device, 0, ROT0, "bootleg", "Tiger Road (US bootleg)", 0 ) +GAME( 1987, tigeroad, 0, tigeroad, tigeroad, driver_device, 0, ROT0, "Capcom", "Tiger Road (US)", 0 ) +GAME( 1987, tigeroadu,tigeroad, tigeroad, tigeroad, driver_device, 0, ROT0, "Capcom (Romstar license)", "Tiger Road (US, Romstar license)", 0 ) +GAME( 1987, toramich, tigeroad, toramich, toramich, driver_device, 0, ROT0, "Capcom", "Tora e no Michi (Japan)", 0 ) +GAME( 1987, tigeroadb,tigeroad, tigeroad, tigeroad, driver_device, 0, ROT0, "bootleg", "Tiger Road (US bootleg)", 0 ) /* F1 Dream has an Intel 8751 microcontroller for protection */ -GAME( 1988, f1dream, 0, tigeroad, f1dream, tigeroad_state, f1dream, ROT0, "Capcom (Romstar license)", "F-1 Dream", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) // collisions are wrong -GAME( 1988, f1dreamb, f1dream, tigeroad, f1dream, driver_device, 0, ROT0, "bootleg", "F-1 Dream (bootleg, set 1)", 0 ) -GAME( 1988, f1dreamba,f1dream, tigeroad, f1dream, driver_device, 0, ROT0, "bootleg", "F-1 Dream (bootleg, set 2)", 0 ) +GAME( 1988, f1dream, 0, tigeroad, f1dream, tigeroad_state, f1dream, ROT0, "Capcom (Romstar license)", "F-1 Dream", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) // collisions are wrong +GAME( 1988, f1dreamb, f1dream, tigeroad, f1dream, driver_device, 0, ROT0, "bootleg", "F-1 Dream (bootleg, set 1)", 0 ) +GAME( 1988, f1dreamba,f1dream, tigeroad, f1dream, driver_device, 0, ROT0, "bootleg", "F-1 Dream (bootleg, set 2)", 0 ) /* This Comad hardware is based around the F1 Dream design */ -GAME( 1990, pushman, 0, pushman, pushman, tigeroad_state, pushman, ROT0, "Comad", "Pushman (Korea, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pushmana, pushman, pushman, pushman, tigeroad_state, pushman, ROT0, "Comad", "Pushman (Korea, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pushmans, pushman, pushman, pushman, tigeroad_state, pushman, ROT0, "Comad (American Sammy license)", "Pushman (American Sammy license)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, pushmant, pushman, pushman, pushman, tigeroad_state, pushman, ROT0, "Comad (Top Tronic license)", "Pushman (Top Tronic license)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pushman, 0, pushman, pushman, driver_device, 0, ROT0, "Comad", "Pushman (Korea, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pushmana, pushman, pushman, pushman, driver_device, 0, ROT0, "Comad", "Pushman (Korea, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pushmans, pushman, pushman, pushman, driver_device, 0, ROT0, "Comad (American Sammy license)", "Pushman (American Sammy license)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, pushmant, pushman, pushman, pushman, driver_device, 0, ROT0, "Comad (Top Tronic license)", "Pushman (Top Tronic license)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, bballs, 0, bballs, bballs, tigeroad_state, bballs, ROT0, "Comad", "Bouncing Balls", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, bballsa, bballs, bballs, bballs, tigeroad_state, bballs, ROT0, "Comad", "Bouncing Balls (Adult)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, bballs, 0, bballs, bballs, driver_device, 0, ROT0, "Comad", "Bouncing Balls", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, bballsa, bballs, bballs, bballs, driver_device, 0, ROT0, "Comad", "Bouncing Balls (Adult)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp index d51c44dee0e..e5fe4410109 100644 --- a/src/mame/drivers/tispeak.cpp +++ b/src/mame/drivers/tispeak.cpp @@ -452,21 +452,21 @@ public: DECLARE_WRITE16_MEMBER(snspellc_write_r); DECLARE_READ8_MEMBER(tntell_read_k); - void k28_prepare_display(uint8_t old, uint8_t data); + void k28_prepare_display(u8 old, u8 data); DECLARE_READ8_MEMBER(k28_read_k); DECLARE_WRITE16_MEMBER(k28_write_o); DECLARE_WRITE16_MEMBER(k28_write_r); // cartridge - uint32_t m_cart_max_size; - uint8_t* m_cart_base; + u32 m_cart_max_size; + u8* m_cart_base; void init_cartridge(); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); DECLARE_DRIVER_INIT(snspell); DECLARE_DRIVER_INIT(tntell); DECLARE_DRIVER_INIT(lantutor); - uint8_t m_overlay; + u8 m_overlay; TIMER_DEVICE_CALLBACK_MEMBER(tntell_get_overlay); protected: @@ -504,7 +504,7 @@ void tispeak_state::init_cartridge() DEVICE_IMAGE_LOAD_MEMBER(tispeak_state, tispeak_cartridge) { - uint32_t size = m_cart->common_get_size("rom"); + u32 size = m_cart->common_get_size("rom"); if (size > m_cart_max_size) { @@ -549,7 +549,7 @@ DRIVER_INIT_MEMBER(tispeak_state, lantutor) void tispeak_state::prepare_display() { - uint16_t gridmask = vfd_filament_on() ? 0xffff : 0x8000; + u16 gridmask = vfd_filament_on() ? 0xffff : 0x8000; set_display_segmask(0x21ff, 0x3fff); display_matrix(16+1, 16, m_plate | 1<<16, m_grid & gridmask); } @@ -640,7 +640,7 @@ WRITE16_MEMBER(tispeak_state::snspellc_write_o) READ8_MEMBER(tispeak_state::snspellc_read_k) { // K4: TMS5100 CTL1 - uint8_t k4 = m_tms5100->ctl_r(space, 0) << 2 & 4; + u8 k4 = m_tms5100->ctl_r(space, 0) << 2 & 4; // K: multiplexed inputs (note: the Vss row is always on) return k4 | m_inp_matrix[9]->read() | read_inputs(9); @@ -652,7 +652,7 @@ READ8_MEMBER(tispeak_state::snspellc_read_k) READ8_MEMBER(tispeak_state::tntell_read_k) { // K8: overlay code from R5,O4-O7 - uint8_t k8 = (((m_r >> 1 & 0x10) | (m_o >> 4 & 0xf)) & m_overlay) ? 8 : 0; + u8 k8 = (((m_r >> 1 & 0x10) | (m_o >> 4 & 0xf)) & m_overlay) ? 8 : 0; // rest is same as snpellc return k8 | snspellc_read_k(space, offset); @@ -678,7 +678,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) // k28 specific -void tispeak_state::k28_prepare_display(uint8_t old, uint8_t data) +void tispeak_state::k28_prepare_display(u8 old, u8 data) { // ? } diff --git a/src/mame/drivers/tispellb.cpp b/src/mame/drivers/tispellb.cpp index 40936b78e14..dfe0439207c 100644 --- a/src/mame/drivers/tispellb.cpp +++ b/src/mame/drivers/tispellb.cpp @@ -76,9 +76,9 @@ public: optional_device<cpu_device> m_subcpu; optional_device<tms6100_device> m_tms6100; - uint8_t m_rev1_ctl; - uint16_t m_sub_o; - uint16_t m_sub_r; + u8 m_rev1_ctl; + u16 m_sub_o; + u16 m_sub_r; virtual DECLARE_INPUT_CHANGED_MEMBER(power_button) override; void power_off(); @@ -140,7 +140,7 @@ void tispellb_state::power_off() void tispellb_state::prepare_display() { // almost same as snspell - uint16_t gridmask = vfd_filament_on() ? 0xffff : 0x8000; + u16 gridmask = vfd_filament_on() ? 0xffff : 0x8000; set_display_segmask(0xff, 0x3fff); display_matrix(16+1, 16, m_plate | 1<<16, m_grid & gridmask); } diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp index 46917219621..ce751775a85 100644 --- a/src/mame/drivers/toaplan2.cpp +++ b/src/mame/drivers/toaplan2.cpp @@ -39,7 +39,7 @@ Supported games: batsugun TP-030 Toaplan Batsugun batsuguna TP-030 Toaplan Batsugun (older) batsugunsp TP-030 Toaplan Batsugun (Special Version) - enmadaio TP-031 Toaplan Enma Daio + enmadaio TP-031 Toaplan Enma Daio pwrkick SW931201 Sunwise Power Kick othldrby ?????? Sunwise Othello Derby snowbro2 TP-033 Hanafram Snow Bros. 2 - With New Elves @@ -1559,7 +1559,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( enmadaio_oki, AS_0, 8, toaplan2_state ) AM_RANGE(0x00000, 0x3ffff) AM_ROMBANK("bank1") ADDRESS_MAP_END - + WRITE16_MEMBER(toaplan2_state::tekipaki_mcu_w) @@ -2661,7 +2661,7 @@ static INPUT_PORTS_START( enmadaio ) PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("yes") - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("no") + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("no") PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) diff --git a/src/mame/drivers/upscope.cpp b/src/mame/drivers/upscope.cpp index bee8ac9d886..20a79f6a81f 100644 --- a/src/mame/drivers/upscope.cpp +++ b/src/mame/drivers/upscope.cpp @@ -284,11 +284,13 @@ static MACHINE_CONFIG_START( upscope, upscope_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_NTSC) + MCFG_SOUND_ADD("amiga", PAULA_8364, amiga_state::CLK_C1_NTSC) MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) MCFG_SOUND_ROUTE(2, "lspeaker", 0.50) MCFG_SOUND_ROUTE(3, "rspeaker", 0.50) + MCFG_PAULA_MEM_READ_CB(READ16(amiga_state, chip_ram_r)) + MCFG_PAULA_INT_CB(WRITELINE(amiga_state, paula_int_w)) /* cia */ MCFG_DEVICE_ADD("cia_0", MOS8520, amiga_state::CLK_E_NTSC) diff --git a/src/mame/drivers/vcs80.cpp b/src/mame/drivers/vcs80.cpp index 9c6508c7ce1..4fe93fc9196 100644 --- a/src/mame/drivers/vcs80.cpp +++ b/src/mame/drivers/vcs80.cpp @@ -230,7 +230,7 @@ static MACHINE_CONFIG_START( vcs80, vcs80_state ) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("1K") - + /* bankdev */ MCFG_DEVICE_ADD("bdmem", ADDRESS_MAP_BANK, 0) MCFG_DEVICE_PROGRAM_MAP(vcs80_bd_mem) diff --git a/src/mame/drivers/vd.cpp b/src/mame/drivers/vd.cpp index 84521e20623..1c21b879cee 100644 --- a/src/mame/drivers/vd.cpp +++ b/src/mame/drivers/vd.cpp @@ -3,7 +3,7 @@ /************************************************************************************** PINBALL - Videodens + Video Dens S.A., Madrid PinMAME used as reference. The Break '86 manual scan available on the net includes a mostly illegible schematic. @@ -223,5 +223,5 @@ ROM_START(papillon) ROM_END -GAME(1986, break86, 0, vd, break86, driver_device, 0, ROT0, "Videodens", "Break '86", MACHINE_IS_SKELETON_MECHANICAL) -GAME(1986, papillon, 0, vd, papillon, driver_device, 0, ROT0, "Videodens", "Papillon", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, break86, 0, vd, break86, driver_device, 0, ROT0, "Video Dens", "Break '86", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1986, papillon, 0, vd, papillon, driver_device, 0, ROT0, "Video Dens", "Papillon", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/vicdual.cpp b/src/mame/drivers/vicdual.cpp index e4a76ec2f7c..a6a2d6a64a5 100644 --- a/src/mame/drivers/vicdual.cpp +++ b/src/mame/drivers/vicdual.cpp @@ -2547,24 +2547,37 @@ ROM_START( depthcho ) ROM_LOAD( "316-0014.u28", 0x0020, 0x0020, CRC(7b7a8492) SHA1(6ba8d891cc6eb0dd80051377b6b832e8894655e7) ) /* sequence PROM */ ROM_END +/* Fully working PCB set from my full-size Sub Hunter upright machine. + +Essentally this pcb set is a Taito-made license of +'Depthcharge' by Gremlin. + +PCB markings are: +- DP070001 / DPN00001 (main) (paper label DP80) +- DP070002 / DPN00002 (sound) (paper label DP80) +Serial number 430229 + +12x program Proms were harris 7643 +2x gfx proms were Harris 7603 */ + ROM_START( subhunt ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD_NIB_LOW ( "dp04", 0x0000, 0x0400, CRC(0ace1aef) SHA1(071256dd63e2e449093a65a4c9b006be5e17b786) ) - ROM_LOAD_NIB_HIGH( "dp01", 0x0000, 0x0400, CRC(da9e835b) SHA1(505c969b479aeab11bb6a21ef06837280846d90a) ) - ROM_LOAD_NIB_LOW ( "dp10", 0x0400, 0x0400, CRC(de752f20) SHA1(513a92554d14a09d6b80ba8017d161c7cda9ed8c) ) - ROM_LOAD_NIB_HIGH( "316-0028.u77", 0x0400, 0x0400, CRC(597ae441) SHA1(8d3af5e64e838a57057d46f97a7b1c1037c1a0cf) ) // dp07 - ROM_LOAD_NIB_LOW ( "dp05", 0x0800, 0x0400, CRC(1c0530cf) SHA1(b1f2b1038ee063533669341f1a71755eecc2e1a9) ) - ROM_LOAD_NIB_HIGH( "316-0023.u52", 0x0800, 0x0400, CRC(9244b613) SHA1(6587035ec22d90194cdc3efaed3571a1ab975e1c) ) // dp02 - ROM_LOAD_NIB_LOW ( "dp11", 0x0c00, 0x0400, CRC(0007044a) SHA1(c8d7c693e3059ff020563336fe712c234e94b8f9) ) - ROM_LOAD_NIB_HIGH( "dp08", 0x0c00, 0x0400, CRC(4d4e3ec8) SHA1(a0d5392fe5795cc6bf7373f194186506283c947c) ) - ROM_LOAD_NIB_LOW ( "dp06", 0x1000, 0x0400, CRC(63e1184b) SHA1(91934cb041365dabdc58a831312577fdb0dc923b) ) - ROM_LOAD_NIB_HIGH( "dp03", 0x1000, 0x0400, CRC(d70dbfd8) SHA1(0183a6b1ffd87a9e28588a7a9aa18aeb003560f0) ) - ROM_LOAD_NIB_LOW ( "dp12", 0x1400, 0x0400, CRC(170d7718) SHA1(4348e4e2dbb1edd9a4228fd3ccef58c50f1ae129) ) - ROM_LOAD_NIB_HIGH( "dp09", 0x1400, 0x0400, CRC(97466803) SHA1(f04ba4a1a960836974a85832596fc3a92a711094) ) + ROM_LOAD_NIB_LOW ( "dp04.u63", 0x0000, 0x0400, CRC(0ace1aef) SHA1(071256dd63e2e449093a65a4c9b006be5e17b786) ) + ROM_LOAD_NIB_HIGH( "dp01.u51", 0x0000, 0x0400, CRC(da9e835b) SHA1(505c969b479aeab11bb6a21ef06837280846d90a) ) + ROM_LOAD_NIB_LOW ( "dp10.u89", 0x0400, 0x0400, CRC(de752f20) SHA1(513a92554d14a09d6b80ba8017d161c7cda9ed8c) ) + ROM_LOAD_NIB_HIGH( "316-0028.u77", 0x0400, 0x0400, CRC(597ae441) SHA1(8d3af5e64e838a57057d46f97a7b1c1037c1a0cf) ) // dp07.u77 + ROM_LOAD_NIB_LOW ( "dp05.u64", 0x0800, 0x0400, CRC(1c0530cf) SHA1(b1f2b1038ee063533669341f1a71755eecc2e1a9) ) + ROM_LOAD_NIB_HIGH( "316-0023.u52", 0x0800, 0x0400, CRC(9244b613) SHA1(6587035ec22d90194cdc3efaed3571a1ab975e1c) ) // dp02.u52 + ROM_LOAD_NIB_LOW ( "dp11.u90", 0x0c00, 0x0400, CRC(0007044a) SHA1(c8d7c693e3059ff020563336fe712c234e94b8f9) ) + ROM_LOAD_NIB_HIGH( "dp08.u78", 0x0c00, 0x0400, CRC(4d4e3ec8) SHA1(a0d5392fe5795cc6bf7373f194186506283c947c) ) + ROM_LOAD_NIB_LOW ( "dp06.u65", 0x1000, 0x0400, CRC(63e1184b) SHA1(91934cb041365dabdc58a831312577fdb0dc923b) ) + ROM_LOAD_NIB_HIGH( "dp03.u53", 0x1000, 0x0400, CRC(d70dbfd8) SHA1(0183a6b1ffd87a9e28588a7a9aa18aeb003560f0) ) + ROM_LOAD_NIB_LOW ( "dp12.u91", 0x1400, 0x0400, CRC(170d7718) SHA1(4348e4e2dbb1edd9a4228fd3ccef58c50f1ae129) ) + ROM_LOAD_NIB_HIGH( "dp09.u79", 0x1400, 0x0400, CRC(97466803) SHA1(f04ba4a1a960836974a85832596fc3a92a711094) ) ROM_REGION( 0x0040, "user1", 0 ) - ROM_LOAD( "316-0013.u27", 0x0000, 0x0020, CRC(690ef530) SHA1(6c0de3fa87a341cd378fefb8e06bf7918db9a074) ) /* control PROM */ - ROM_LOAD( "316-0014.u28", 0x0020, 0x0020, CRC(7b7a8492) SHA1(6ba8d891cc6eb0dd80051377b6b832e8894655e7) ) /* sequence PROM */ + ROM_LOAD( "316-0013.u27", 0x0000, 0x0020, CRC(690ef530) SHA1(6c0de3fa87a341cd378fefb8e06bf7918db9a074) ) /* dp13.u27 - control PROM */ + ROM_LOAD( "316-0014.u28", 0x0020, 0x0020, CRC(7b7a8492) SHA1(6ba8d891cc6eb0dd80051377b6b832e8894655e7) ) /* dp14.u28 - sequence PROM */ ROM_END diff --git a/src/mame/drivers/witch.cpp b/src/mame/drivers/witch.cpp index 080af26c1ce..6248da7343e 100644 --- a/src/mame/drivers/witch.cpp +++ b/src/mame/drivers/witch.cpp @@ -111,7 +111,6 @@ Sound Mapped @0x8010-0x8016 Had to patch es8712.c to start playing on 0x8016 write and to prevent continuous looping. There's a test on bit1 at offset 0 (0x8010), so this may be a "read status" kind of port. - For now reading at 8010 always reports ready. Ports @@ -286,7 +285,6 @@ public: DECLARE_WRITE8_MEMBER(write_a006); DECLARE_WRITE8_MEMBER(write_a008); DECLARE_READ8_MEMBER(prot_read_700x); - DECLARE_READ8_MEMBER(read_8010); DECLARE_WRITE8_MEMBER(xscroll_w); DECLARE_WRITE8_MEMBER(yscroll_w); DECLARE_DRIVER_INIT(witch); @@ -460,12 +458,6 @@ READ8_MEMBER(witch_state::prot_read_700x) return memregion("sub")->base()[0x7000+offset]; } -/* - * Status from ES8712? - * BIT1 is zero when no sample is playing? - */ -READ8_MEMBER(witch_state::read_8010){ return 0x00; } - WRITE8_MEMBER(witch_state::xscroll_w) { m_scrollx=data; @@ -502,7 +494,7 @@ static ADDRESS_MAP_START( map_sub, AS_PROGRAM, 8, witch_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE("ym1", ym2203_device, read, write) AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE("ym2", ym2203_device, read, write) - AM_RANGE(0x8010, 0x8016) AM_READ(read_8010) AM_DEVWRITE("essnd", es8712_device, es8712_w) + AM_RANGE(0x8010, 0x8016) AM_DEVREADWRITE("essnd", es8712_device, read, write) AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi1", i8255_device, read, write) AM_RANGE(0xa004, 0xa007) AM_DEVREADWRITE("ppi2", i8255_device, read, write) AM_RANGE(0xa008, 0xa008) AM_WRITE(write_a008) diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp index cde608c590a..c2dec9dfb9e 100644 --- a/src/mame/drivers/x1.cpp +++ b/src/mame/drivers/x1.cpp @@ -644,7 +644,7 @@ uint16_t x1_state::check_keyboard_press() if (scancode >= 0x2c && scancode <= 0x5f) scancode = kanatable[scancode - 0x2c][1]; } - + if (scancode >= 0x41 && scancode < 0x5a) scancode += 0x20; // lowercase } @@ -658,7 +658,7 @@ uint16_t x1_state::check_keyboard_press() scancode = kanatable[scancode - 0x2c][2]; } } - + if(scancode >= 0x31 && scancode < 0x3a) scancode -= 0x10; if(scancode == 0x30) diff --git a/src/mame/drivers/zn.cpp b/src/mame/drivers/zn.cpp index 31bc72c5103..38afb4cf309 100644 --- a/src/mame/drivers/zn.cpp +++ b/src/mame/drivers/zn.cpp @@ -3316,6 +3316,31 @@ ROM_START( sfex2 ) ROM_END /* 97695-1 */ +ROM_START( sfex2u1 ) + CPZN2_BIOS + + ROM_REGION32_LE( 0x80000, "countryrom", 0 ) + ROM_LOAD( "ex2u_04.2h", 0x0000000, 0x080000, CRC(eb417c2c) SHA1(bd47d0a1d911af4457c795ec348c847c2cf9e721) ) + + ROM_REGION32_LE( 0x3000000, "maskroms", 0 ) + ROM_LOAD( "ex2-05m.3h", 0x0000000, 0x800000, CRC(78726b17) SHA1(2da449df335ef133ebc3997bbad73ef4137f4771) ) + ROM_LOAD( "ex2-06m.4h", 0x0800000, 0x800000, CRC(be1075ed) SHA1(36dc673372f30f8b3ff5689ae568c5cd01fe2c07) ) + ROM_LOAD( "ex2-07m.5h", 0x1000000, 0x800000, CRC(6496c6ed) SHA1(054bcecbb04033abea14d9ffe6634b2bd11ca88b) ) + ROM_LOAD( "ex2-08m.2k", 0x1800000, 0x800000, CRC(3194132e) SHA1(d1324fcf0a8528fc683791d6342697a7e08674f4) ) + ROM_LOAD( "ex2-09m.3k", 0x2000000, 0x400000, CRC(075ae585) SHA1(6b88851db618fc3e96f1d740c46c1bc5be0ee21b) ) + + ROM_REGION( 0x50000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */ + ROM_LOAD( "ex2_02.2e", 0x00000, 0x08000, CRC(9489875e) SHA1(1fc9985ff98232c63ea8d05a69f7d77cdf72919f) ) + ROM_CONTINUE( 0x10000, 0x18000 ) + + ROM_REGION( 0x400000, "qsound", 0 ) /* Q Sound Samples */ + ROM_LOAD16_WORD_SWAP( "ex2-01m.3a", 0x0000000, 0x400000, CRC(14a5bb0e) SHA1(dfe3c3a53bd4c58743d8039b5344d3afbe2a9c24) ) + + ROM_REGION( 0x8, "cat702_2", 0 ) + ROM_LOAD( "cp08", 0x000000, 0x000008, CRC(a63d6fa6) SHA1(68995438a1e90ff9aa59090e7e031d51c68c4d73) ) +ROM_END + +/* 97695-1 */ ROM_START( sfex2a ) CPZN2_BIOS @@ -5103,6 +5128,7 @@ GAME( 1997, rvschoolu, rvschool, coh3002c, zn6b, driver_device, 0, ROT0, GAME( 1997, rvschoola, rvschool, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom", "Rival Schools: United By Fate (Asia 971117)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1997, jgakuen, rvschool, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom", "Shiritsu Justice Gakuen: Legion of Heroes (Japan 971117)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1998, sfex2, coh3002c, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom / Arika", "Street Fighter EX2 (USA 980526)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1998, sfex2u1, sfex2, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom / Arika", "Street Fighter EX2 (USA 980312)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1998, sfex2a, sfex2, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom / Arika", "Street Fighter EX2 (Asia 980312)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1998, sfex2h, sfex2, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom / Arika", "Street Fighter EX2 (Hispanic 980312)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1998, sfex2j, sfex2, coh3002c, zn6b, driver_device, 0, ROT0, "Capcom / Arika", "Street Fighter EX2 (Japan 980312)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp index cc1faf0c449..e348c55db0d 100644 --- a/src/mame/drivers/zorba.cpp +++ b/src/mame/drivers/zorba.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Robbbert +// copyright-holders:Robbbert, Vas Crabb /************************************************************************************************************ Telcon Industries/Modular Micros/Gemini Electronics Zorba @@ -36,6 +36,10 @@ The startup screen varies across each company: - Modular Micros: "ZORBA" graphical logo with "MODULAR MICROS, INC." below in normal text - Gemini: "GEMINI ZORBA" graphical logo +Strangely, the Zorba configures its keyboard UART for 8N2 but the keyboard we're emulating sends 8N1. +If you type too fast or hold down a key until it repeats, characters will be dropped/corrupted. It's +possible we have a dump of a different CP/M-compatible keyboard, not the one supplied with the Zorba. + Status: - Boots up, and the keyboard works @@ -44,8 +48,6 @@ ToDo: - Add masking feature (only used for the UARTs) - Connect devices to the above hardware - Fix the display -- Connect the PIT to the UARTs -- Replace the ascii keyboard with the real one, if possible - Dump Telcon and Gemini BIOSes - Emulate the Co-Power-88 expansion (allows PC-DOS, CP/M-86, etc. to be used) - Probably lots of other things @@ -53,105 +55,44 @@ ToDo: *************************************************************************************************************/ - #include "emu.h" +#include "includes/zorba.h" + +#include "machine/zorbakbd.h" + +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" + #include "cpu/z80/z80.h" #include "cpu/m6805/m68705.h" -#include "machine/i8251.h" -#include "machine/6821pia.h" -#include "machine/z80dma.h" + +#include "machine/input_merger.h" +#include "machine/latch.h" #include "machine/pit8253.h" -#include "video/i8275.h" -#include "sound/beep.h" -#include "machine/keyboard.h" -#include "machine/wd_fdc.h" + #include "softlist.h" -class zorba_state : public driver_device -{ -public: - zorba_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_beep(*this, "beeper") - , m_dma(*this, "dma") - , m_u0(*this, "uart0") - , m_u1(*this, "uart1") - , m_u2(*this, "uart2") - , m_pia0(*this, "pia0") - , m_pia1(*this, "pia1") - , m_crtc(*this, "crtc") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - {} - -public: - const uint8_t *m_p_chargen; - DECLARE_DRIVER_INIT(zorba); - DECLARE_MACHINE_RESET(zorba); - DECLARE_READ8_MEMBER(ram_r); - DECLARE_WRITE8_MEMBER(ram_w); - DECLARE_READ8_MEMBER(rom_r); - DECLARE_WRITE8_MEMBER(rom_w); - DECLARE_WRITE8_MEMBER(intmask_w); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE8_MEMBER(pia0_porta_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE_LINE_MEMBER(irq0_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - I8275_DRAW_CHARACTER_MEMBER(zorba_update_chr); - required_device<palette_device> m_palette; - -private: - uint8_t m_term_data; - uint8_t m_fdc_rq; - required_device<cpu_device> m_maincpu; - required_device<beep_device> m_beep; - required_device<z80dma_device> m_dma; - required_device<i8251_device> m_u0; - required_device<i8251_device> m_u1; - required_device<i8251_device> m_u2; - required_device<pia6821_device> m_pia0; - required_device<pia6821_device> m_pia1; - required_device<i8275_device> m_crtc; - required_device<fd1793_t> m_fdc; - required_device<floppy_connector> m_floppy0; - required_device<floppy_connector> m_floppy1; -}; +namespace { -static ADDRESS_MAP_START( zorba_mem, AS_PROGRAM, 8, zorba_state ) +ADDRESS_MAP_START( zorba_mem, AS_PROGRAM, 8, zorba_state ) AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") AM_RANGE( 0x4000, 0xffff ) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( zorba_kbdmem, AS_PROGRAM, 8, zorba_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE( 0x000, 0x07f ) AM_RAM // internal RAM - AM_RANGE( 0x080, 0x7ff ) AM_ROM // internal EPROM -ADDRESS_MAP_END -static ADDRESS_MAP_START( zorba_io, AS_IO, 8, zorba_state ) +ADDRESS_MAP_START( zorba_io, AS_IO, 8, zorba_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit", pit8254_device, read, write) - AM_RANGE(0x04, 0x04) AM_READWRITE(rom_r,rom_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(ram_r,ram_w) + AM_RANGE(0x04, 0x04) AM_READWRITE(rom_r, rom_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(ram_r, ram_w) AM_RANGE(0x10, 0x11) AM_DEVREADWRITE("crtc", i8275_device, read, write) AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("uart0", i8251_device, data_r, data_w) AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("uart0", i8251_device, status_r, control_w) AM_RANGE(0x22, 0x22) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) AM_RANGE(0x23, 0x23) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) - //AM_RANGE(0x24, 0x24) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) - //AM_RANGE(0x25, 0x25) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) - AM_RANGE(0x24, 0x25) AM_READ(keyboard_r) AM_WRITENOP + AM_RANGE(0x24, 0x24) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) + AM_RANGE(0x25, 0x25) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) AM_RANGE(0x26, 0x26) AM_WRITE(intmask_w) AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write) AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("fdc", fd1793_t, read, write) @@ -159,83 +100,294 @@ static ADDRESS_MAP_START( zorba_io, AS_IO, 8, zorba_state ) AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("pia1", pia6821_device, read, write) ADDRESS_MAP_END + +INPUT_PORTS_START( zorba ) + PORT_START("CNF") + PORT_CONFNAME(0x01, 0x00, "Parallel Printer") PORT_CHANGED_MEMBER(DEVICE_SELF, zorba_state, printer_type, 0) + PORT_CONFSETTING(0x00, "Centronics") + PORT_CONFSETTING(0x01, "Prowriter") +INPUT_PORTS_END + + +SLOT_INTERFACE_START( zorba_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +// F4 Character Displayer +const gfx_layout u5_charlayout = +{ + 8, 11, // 8 x 11 characters + 256, // 256 characters + 1, // 1 bits per pixel + { 0 }, // no bitplanes + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, + 8*16 // every char takes 16 bytes +}; + +GFXDECODE_START( zorba ) + GFXDECODE_ENTRY( "chargen", 0x0000, u5_charlayout, 0, 1 ) +GFXDECODE_END + + +MACHINE_CONFIG_START( zorba, zorba_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_24MHz / 6) + MCFG_CPU_PROGRAM_MAP(zorba_mem) + MCFG_CPU_IO_MAP(zorba_io) + MCFG_MACHINE_RESET_OVERRIDE(zorba_state, zorba) + + /* video hardware */ + MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green()) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", zorba) + MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 800) // should be horizontal frequency / 16, so depends on CRTC parameters + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_INPUT_MERGER_ACTIVE_HIGH("irq0") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE(zorba_state, irq_w<0>)) + MCFG_INPUT_MERGER_ACTIVE_HIGH("irq1") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE(zorba_state, irq_w<1>)) + MCFG_INPUT_MERGER_ACTIVE_HIGH("irq2") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE(zorba_state, irq_w<2>)) + + /* devices */ + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_24MHz/6) + // busack on cpu connects to bai pin + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w)) //connects to busreq on cpu + MCFG_Z80DMA_OUT_INT_CB(DEVWRITELINE("irq0", input_merger_active_high_device, in0_w)) + //ba0 - not connected + MCFG_Z80DMA_IN_MREQ_CB(READ8(zorba_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(zorba_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(zorba_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(zorba_state, io_write_byte)) + + MCFG_DEVICE_ADD("uart0", I8251, 0) // U32 COM port J2 + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) // TODO: this line has a LED attached + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<1>)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<0>)) + + MCFG_DEVICE_ADD("uart1", I8251, 0) // U31 printer port J3 + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("serprn", rs232_port_device, write_txd)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("serprn", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<3>)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<2>)) + + MCFG_DEVICE_ADD("uart2", I8251, 0) // U30 serial keyboard J6 + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", zorba_keyboard_device, txd_w)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<5>)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(zorba_state, tx_rx_rdy_w<4>)) + + // port A - disk select etc, beeper + // port B - parallel interface + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(zorba_state, pia0_porta_w)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("parprndata", output_latch_device, write)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE("parprn", centronics_device, write_strobe)) + + // IEEE488 interface + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) // TODO: gated with PB1 + MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) // TODO: gated with PB1 + MCFG_PIA_READPB_HANDLER(READ8(zorba_state, pia1_portb_r)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(zorba_state, pia1_portb_w)) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("irq1", input_merger_active_high_device, in0_w)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("irq1", input_merger_active_high_device, in1_w)) + + // PIT + MCFG_DEVICE_ADD("pit", PIT8254, 0) + MCFG_PIT8253_CLK0(XTAL_24MHz / 3) + MCFG_PIT8253_CLK1(XTAL_24MHz / 3) + MCFG_PIT8253_CLK2(XTAL_24MHz / 3) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(zorba_state, br1_w)) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("uart1", i8251_device, write_txc)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart1", i8251_device, write_rxc)) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("uart2", i8251_device, write_txc)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart2", i8251_device, write_rxc)) + + // CRTC + MCFG_DEVICE_ADD("crtc", I8275, XTAL_14_31818MHz/7) + MCFG_I8275_CHARACTER_WIDTH(8) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) + MCFG_I8275_IRQ_CALLBACK(DEVWRITELINE("irq0", input_merger_active_high_device, in1_w)) + + // Floppies + MCFG_FD1793_ADD("fdc", XTAL_24MHz / 24) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("irq2", input_merger_active_high_device, in0_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("irq2", input_merger_active_high_device, in1_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + // J1 IEEE-488 + MCFG_IEEE488_BUS_ADD() + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE("pia1", pia6821_device, ca2_w)) // TODO: gated with PB1 from PIA + + // J2 EIA RS232/internal modem + // TODO: this has additional lines compared to a regular RS232 port (TxC in, RxC in, RxC out, speaker in, power) + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart0", i8251_device, write_rxd)) // TODO: this line has a LED attached + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart0", i8251_device, write_cts)) // TODO: this line has a LED attached + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart0", i8251_device, write_dsr)) + + // J3 Parallel printer + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("parprndata", "parprn") + MCFG_CENTRONICS_ADD("parprn", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("uart1", i8251_device, write_cts)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart1", i8251_device, write_dsr)) // TODO: shared with serial CTS + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(zorba_state, printer_fault_w)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(zorba_state, printer_select_w)) + + // J3 Serial printer + MCFG_RS232_PORT_ADD("serprn", default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart1", i8251_device, write_rxd)) // TODO: this line has a LED attached + + // J6 TTL-level serial keyboard + MCFG_DEVICE_ADD("keyboard", ZORBA_KEYBOARD, 0) + MCFG_ZORBA_KEYBOARD_RXD_CB(DEVWRITELINE("uart2", i8251_device, write_rxd)) + MCFG_QUANTUM_PERFECT_CPU("keyboard:mcu") + + MCFG_SOFTWARE_LIST_ADD("flop_list", "zorba") +MACHINE_CONFIG_END + +} // anonymous namespace + + +//------------------------------------------------- +// Initialise/reset +//------------------------------------------------- + +DRIVER_INIT_MEMBER( zorba_state, zorba ) +{ + uint8_t *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(0, &main[0x0000]); + membank("bankr0")->configure_entry(1, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); + + save_item(NAME(m_intmask)); + save_item(NAME(m_tx_rx_rdy)); + save_item(NAME(m_irq)); + + save_item(NAME(m_printer_prowriter)); + save_item(NAME(m_printer_fault)); + save_item(NAME(m_printer_select)); + + save_item(NAME(m_term_data)); + + m_printer_prowriter = false; + m_printer_fault = 0; + m_printer_select = 0; +} + +MACHINE_RESET_MEMBER( zorba_state, zorba ) +{ + m_uart2->write_cts(0); // always asserted + + m_intmask = 0x00; + m_tx_rx_rdy = 0x00; + m_irq = 0x00; + + m_printer_prowriter = BIT(m_config_port->read(), 0); + m_pia0->cb1_w(m_printer_prowriter ? m_printer_select : m_printer_fault); + + m_read_bank->set_entry(1); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + + m_maincpu->reset(); +} + + +//------------------------------------------------- +// Memory banking control +//------------------------------------------------- + READ8_MEMBER( zorba_state::ram_r ) { - membank("bankr0")->set_entry(0); + if (!space.debugger_access()) + m_read_bank->set_entry(0); return 0; } WRITE8_MEMBER( zorba_state::ram_w ) { - membank("bankr0")->set_entry(0); + m_read_bank->set_entry(0); } READ8_MEMBER( zorba_state::rom_r ) { - membank("bankr0")->set_entry(1); + if (!space.debugger_access()) + m_read_bank->set_entry(1); return 0; } WRITE8_MEMBER( zorba_state::rom_w ) { - membank("bankr0")->set_entry(1); + m_read_bank->set_entry(1); } -WRITE_LINE_MEMBER( zorba_state::irq0_w ) -{ - if (state) - { - m_maincpu->set_input_line_vector(0, 0x88); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - m_maincpu->set_input_line(0, CLEAR_LINE); -} -WRITE_LINE_MEMBER( zorba_state::fdc_intrq_w ) -{ - m_fdc_rq = (m_fdc_rq & 2) | state; - if (m_fdc_rq == 1) - { - m_maincpu->set_input_line_vector(0, 0x80); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - if (m_fdc_rq == 0) - m_maincpu->set_input_line(0, CLEAR_LINE); -} +//------------------------------------------------- +// Interrupt vectoring glue +//------------------------------------------------- -WRITE_LINE_MEMBER( zorba_state::fdc_drq_w ) +WRITE8_MEMBER( zorba_state::intmask_w ) { - m_fdc_rq = (m_fdc_rq & 1) | (state << 1); - if (m_fdc_rq == 2) - { - m_maincpu->set_input_line_vector(0, 0x80); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - if (m_fdc_rq == 0) - m_maincpu->set_input_line(0, CLEAR_LINE); + m_intmask = data & 0x3f; // only six lines physically present + irq_w<3>(BIT(m_intmask & m_tx_rx_rdy, 0) | BIT(m_intmask & m_tx_rx_rdy, 1)); + irq_w<4>(BIT(m_intmask & m_tx_rx_rdy, 2) | BIT(m_intmask & m_tx_rx_rdy, 3)); + irq_w<5>(BIT(m_intmask & m_tx_rx_rdy, 4) | BIT(m_intmask & m_tx_rx_rdy, 5)); } -WRITE8_MEMBER( zorba_state::intmask_w ) +template <unsigned N> WRITE_LINE_MEMBER( zorba_state::tx_rx_rdy_w ) { + m_tx_rx_rdy = (m_tx_rx_rdy & ~(1 << N)) | ((state ? 1 : 0) << N); + irq_w<(N >> 1) + 3>(BIT(m_intmask & m_tx_rx_rdy, N & ~1) | BIT(m_intmask & m_tx_rx_rdy, N | 1)); } -static INPUT_PORTS_START( zorba ) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER( zorba_state, zorba ) +template <unsigned N> WRITE_LINE_MEMBER( zorba_state::irq_w ) { - uint8_t *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(0, &main[0x0000]); - membank("bankr0")->configure_entry(1, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); + m_irq = (m_irq & ~(1 << N)) | ((state ? 1 : 0) << N); + + // TODO: get a good dump of the interrupt vector PROM and get rid of this hack + // There are six interrupt sources: + // * IRQ0: DMAC/CRTC shared + // * IRQ1: IEEE488 (PIA IRQA/IRQB shared) + // * IRQ2: FDC INTRQ/DRQ shared + // * IRQ3: RS232 TXRDY/RXRDY selectable + // * IRQ4: Serial printer TXRDY/RXRDY selectable + // * IRQ5: Keyboard TXRDY/RXRDY selectable + // Valid vectors are 0x80, 0x84, 0x88, 0x8c, 0x90 and 0x94 + // Floppy needs to be on 0x80, and RS232 is apparently on 0x88 + // Everything else, including priority, is a complete guess + u8 vector; + if (BIT(m_irq, 2)) vector = 0x80; + else if (BIT(m_irq, 3)) vector = 0x88; + else vector = 0x84; // very wrong, need test cases for other things + + m_maincpu->set_input_line_and_vector( + INPUT_LINE_IRQ0, + m_irq ? ASSERT_LINE : CLEAR_LINE, + vector); } + //------------------------------------------------- -// Z80DMA +// DMA controller handlers //------------------------------------------------- WRITE_LINE_MEMBER( zorba_state::busreq_w ) @@ -268,19 +420,28 @@ WRITE8_MEMBER(zorba_state::io_write_byte) address_space& prog_space = m_maincpu->space(AS_IO); if (offset == 0x10) - { m_crtc->dack_w(space, 0, data); - } else - { prog_space.write_byte(offset, data); - } } -static SLOT_INTERFACE_START( zorba_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END +//------------------------------------------------- +// PIT handlers +//------------------------------------------------- + +WRITE_LINE_MEMBER( zorba_state::br1_w ) +{ + // TODO: these can be jumpered to inputs from J2 so a modem can generate Baud rates + // TODO: receive clock is exposed on J2 for external devices without Baud rate generators + m_uart0->write_txc(state); + m_uart0->write_rxc(state); +} + + +//------------------------------------------------- +// PIA handlers +//------------------------------------------------- WRITE8_MEMBER( zorba_state::pia0_porta_w ) { @@ -300,6 +461,50 @@ WRITE8_MEMBER( zorba_state::pia0_porta_w ) m_floppy1->get_device()->mon_w(BIT(data, 4)); } +READ8_MEMBER( zorba_state::pia1_portb_r ) +{ + // 0 (output only) + // 1 (output only) + // 2 (output only) + // 3 EOI gated with PB2 (active high) + // 4 (output only) + // 5 DAV gated with PB2 (active high) + // 6 NDAC gated with PB1 (active high) + // 7 NRFD gated with PB1 (active high) + + const uint8_t outputs(m_pia0->b_output()); + return + (m_ieee->eoi_r() << 3) | + (m_ieee->dav_r() << 5) | + (m_ieee->ndac_r() << 6) | + (m_ieee->nrfd_r() << 7) | + (BIT(outputs, 1) ? 0x00 : 0xc0) | + (BIT(outputs, 2) ? 0x00 : 0x28); +} + +WRITE8_MEMBER( zorba_state::pia1_portb_w ) +{ + // 0 DIO direction + // 1 NDAC/NRFD data direction, SRQ gate + // 2 EOI/DAV data direction + // 3 EOI gated with PB2 (active low) + // 4 ATN + // 5 DAV gated with PB2 (active low) + // 6 NDAC gated with PB1 (active low) + // 7 NRFD gated with PB1 (active low) + + m_ieee->eoi_w(BIT(data, 3) & BIT(~data, 2)); + m_ieee->atn_w(BIT(data, 4)); + m_ieee->dav_w(BIT(data, 5) & BIT(~data, 2)); + m_ieee->ndac_w(BIT(data, 6) & BIT(~data, 1)); + m_ieee->nrfd_w(BIT(data, 7) & BIT(~data, 1)); +} + + +//------------------------------------------------- +// Video +//------------------------------------------------- + I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) { int i; @@ -321,138 +526,47 @@ I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) } -/* F4 Character Displayer */ -static const gfx_layout u5_charlayout = -{ - 8, 11, /* 8 x 11 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( zorba ) - GFXDECODE_ENTRY( "chargen", 0x0000, u5_charlayout, 0, 1 ) -GFXDECODE_END +//------------------------------------------------- +// Printer port glue +//------------------------------------------------- -MACHINE_RESET_MEMBER( zorba_state, zorba ) +WRITE_LINE_MEMBER( zorba_state::printer_fault_w ) { - m_fdc_rq = 0; - m_p_chargen = memregion("chargen")->base(); - membank("bankr0")->set_entry(1); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - m_maincpu->reset(); + // connects to CB1 for Centronics + m_printer_fault = state; + if (!m_printer_prowriter) + m_pia0->cb1_w(state); } -READ8_MEMBER( zorba_state::keyboard_r ) +WRITE_LINE_MEMBER( zorba_state::printer_select_w ) { - if (offset) - return (m_term_data) ? 0x87 : 0x85; - - uint8_t data = m_term_data; - m_term_data = 0; - return data; + // connects to CB1 for Prowriter + m_printer_select = state; + if (m_printer_prowriter) + m_pia0->cb1_w(state); } -WRITE8_MEMBER( zorba_state::kbd_put ) +INPUT_CHANGED_MEMBER( zorba_state::printer_type ) { - m_term_data = data; + m_printer_prowriter = newval; + m_pia0->cb1_w(m_printer_prowriter ? m_printer_select : m_printer_fault); } -static MACHINE_CONFIG_START( zorba, zorba_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_24MHz / 6) - MCFG_CPU_PROGRAM_MAP(zorba_mem) - MCFG_CPU_IO_MAP(zorba_io) - MCFG_MACHINE_RESET_OVERRIDE(zorba_state, zorba) - - /* keyboard */ - MCFG_CPU_ADD("kbdcpu", M68705, XTAL_3_579545MHz) // MC68705P3S (0x80 bytes ram, 0x780 bytes of rom) - MCFG_CPU_PROGRAM_MAP(zorba_kbdmem) - - /* video hardware */ - MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green()) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", zorba) - MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 800) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_24MHz/6) - // busack on cpu connects to bai pin - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w)) //connects to busreq on cpu - MCFG_Z80DMA_OUT_INT_CB(WRITELINE(zorba_state, irq0_w)) // connects to IRQ0 on IM2 controller - //ba0 - not connected - MCFG_Z80DMA_IN_MREQ_CB(READ8(zorba_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(zorba_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(zorba_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(zorba_state, io_write_byte)) - - MCFG_DEVICE_ADD("uart0", I8251, 0) // U32 COM port J2 - - MCFG_DEVICE_ADD("uart1", I8251, 0) // U31 printer port J3 - - MCFG_DEVICE_ADD("uart2", I8251, 0) // U30 serial keyboard J6 - - // port A - disk select etc, beeper - // port B - parallel interface - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(zorba_state, pia0_porta_w)) - - // IEEE488 interface - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(XTAL_24MHz / 3) /* Timer 0: clock to J2 comm port */ - MCFG_PIT8253_CLK1(XTAL_24MHz / 3) /* Timer 1: clock to U31 */ - MCFG_PIT8253_CLK2(XTAL_24MHz / 3) /* Timer 2: clock to U30 */ - - MCFG_DEVICE_ADD("crtc", I8275, XTAL_14_31818MHz/7) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) - MCFG_I8275_IRQ_CALLBACK(WRITELINE(zorba_state, irq0_w)) - MCFG_FD1793_ADD("fdc", XTAL_24MHz / 24) - 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", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - /* Keyboard */ - MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(zorba_state, kbd_put)) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "zorba") -MACHINE_CONFIG_END ROM_START( zorba ) ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "780000.u47", 0x10000, 0x1000, CRC(6d58f2c5) SHA1(7763f08c801cd36e5a761c6dc9f30a50b3bc482d) ) - ROM_REGION( 0x800, "kbdcpu", 0 ) - ROM_LOAD( "8999-1 3-28-83", 0x080, 0x780, CRC(79fe6c0d) SHA1(4b6fca9379d5199d1347ad1187cbfdebfc4c73e7) ) - ROM_REGION( 0x1000, "chargen", 0 ) ROM_LOAD( "773000.u5", 0x0000, 0x1000, CRC(d0a2f8fc) SHA1(29aee7ee657778c46e9800abd4955e6d4b33ef68) ) ROM_REGION( 0x60, "proms", 0 ) - ROM_LOAD( "74ls288.u37", 0x0000, 0x0020, CRC(0a67edd6) SHA1(c1ece8978a3a061e0130d43907fa63a71e75e75d) ) - ROM_LOAD( "74ls288.u38", 0x0020, 0x0020, CRC(5ec93ea7) SHA1(3a84c098474b05d5cbe1939a3e15f66d06470581) ) - ROM_LOAD( "74ls288.u77", 0x0040, 0x0020, CRC(946e03b0) SHA1(24240bdd7bdf507a5b51628fb36ad1266fc53a28) ) // suspected bad dump + ROM_LOAD( "74ls288.u37", 0x0000, 0x0020, CRC(0a67edd6) SHA1(c1ece8978a3a061e0130d43907fa63a71e75e75d) BAD_DUMP ) // looks like interrupt vector PROM dumped with scrambled lines + ROM_LOAD( "74ls288.u38", 0x0020, 0x0020, CRC(5ec93ea7) SHA1(3a84c098474b05d5cbe1939a3e15f66d06470581) BAD_DUMP ) // looks like bad dump of address decode PROM + ROM_LOAD( "74ls288.u77", 0x0040, 0x0020, CRC(946e03b0) SHA1(24240bdd7bdf507a5b51628fb36ad1266fc53a28) BAD_DUMP ) // looks like bad dump of address decode PROM ROM_END -COMP( 1984?, zorba, 0, 0, zorba, zorba, zorba_state, zorba, "Modular Micros", "Zorba (Modular Micros)", MACHINE_NOT_WORKING ) +COMP( 1984?, zorba, 0, 0, zorba, zorba, zorba_state, zorba, "Modular Micros", "Zorba (Modular Micros)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // Undumped versions (see startup screen notes at top of file) // COMP( 1983, zorbat, zorba, 0, zorba, zorba, zorba_state, zorba, "Telcon Industries", "Zorba (Telcon Industries)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/zx.cpp b/src/mame/drivers/zx.cpp index cf2096e31b8..d78ec6d6a05 100644 --- a/src/mame/drivers/zx.cpp +++ b/src/mame/drivers/zx.cpp @@ -339,11 +339,15 @@ static MACHINE_CONFIG_START( zx80, zx_state ) MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(zx80_o_format) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("zx80_cass") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "zx80_cass") /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("1K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") + MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K,16K") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( zx81, zx80 ) @@ -352,7 +356,16 @@ static MACHINE_CONFIG_DERIVED( zx81, zx80 ) MCFG_CPU_IO_MAP(zx81_io_map) MCFG_CASSETTE_MODIFY( "cassette" ) - MCFG_CASSETTE_FORMATS(zx81_p_format) + MCFG_CASSETTE_FORMATS(zx81_cassette_formats) + MCFG_CASSETTE_INTERFACE("zx81_cass") + + /* software lists */ + MCFG_SOFTWARE_LIST_MODIFY("cass_list", "zx81_cass") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( zx81_spk, zx81 ) @@ -368,6 +381,10 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( ts1000, zx81 ) MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_INIT_OWNER(zx_state, ts1000) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( ts1500, ts1000 ) @@ -473,6 +490,7 @@ ROM_END /* Game Drivers */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ COMP( 1980, zx80, 0, 0, zx80, zx80, zx_state, zx, "Sinclair Research Ltd", "ZX-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) COMP( 1981, zx81, 0, 0, zx81, zx81, zx_state, zx, "Sinclair Research Ltd", "ZX-81", MACHINE_NO_SOUND_HW ) COMP( 1982, ts1000, zx81, 0, ts1000, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1000", MACHINE_NO_SOUND_HW ) @@ -482,4 +500,4 @@ COMP( 1983, ringo470, zx81, 0, ts1000, zx81, zx_state, zx, COMP( 1984, pc8300, zx81, 0, pc8300, pc8300, zx_state, zx, "Your Computer", "PC8300", MACHINE_NOT_WORKING ) COMP( 1983, pow3000, zx81, 0, pow3000, pow3000, zx_state, zx, "Creon Enterprises", "Power 3000", MACHINE_NOT_WORKING ) COMP( 1982, lambda, zx81, 0, pow3000, pow3000, zx_state, zx, "Lambda Electronics Ltd", "Lambda 8300", MACHINE_NOT_WORKING ) -COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_UNOFFICIAL ) +COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_UNOFFICIAL ) diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h index 7404cd3d689..621de27e2ad 100644 --- a/src/mame/includes/aerofgt.h +++ b/src/mame/includes/aerofgt.h @@ -29,7 +29,9 @@ public: m_spr(*this, "vsystem_spr"), m_spr_old(*this, "vsystem_spr_old"), m_spr_old2(*this, "vsystem_spr_ol2"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch"), + m_soundbank(*this, "soundbank"), + m_okibank(*this, "okibank") { } /* memory pointers */ required_shared_ptr<uint16_t> m_bg1videoram; @@ -53,7 +55,8 @@ public: optional_device<vsystem_spr2_device> m_spr_old2; // or a pair of them.. optional_device<generic_latch_8_device> m_soundlatch; - + optional_memory_bank m_soundbank; + optional_memory_bank m_okibank; /* video-related */ tilemap_t *m_bg1_tilemap; diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 5a01964f4f7..7e9c7bb852e 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -21,7 +21,7 @@ Ernesto Corvi & Mariusz Wojcieszek #include "machine/msm6242.h" #include "machine/akiko.h" #include "machine/i2cmem.h" -#include "sound/amiga.h" +#include "machine/8364_paula.h" #include "video/amigaaga.h" @@ -336,7 +336,7 @@ public: m_cia_1(*this, "cia_1"), m_rs232(*this, "rs232"), m_centronics(*this, "centronics"), - m_sound(*this, "amiga"), + m_paula(*this, "amiga"), m_fdc(*this, "fdc"), m_screen(*this, "screen"), m_palette(*this, "palette"), @@ -378,12 +378,15 @@ public: { return EXPECTED(byteoffs < m_chip_ram.bytes()) ? m_chip_ram.read(byteoffs >> 1) : 0xffff; } + void chip_ram_w(offs_t byteoffs, uint16_t data) { if (EXPECTED(byteoffs < m_chip_ram.bytes())) m_chip_ram.write(byteoffs >> 1, data); } + DECLARE_READ16_MEMBER(chip_ram_r) { return chip_ram_r(offset); } + /* sprite states */ uint8_t m_sprite_comparitor_enable_mask; uint8_t m_sprite_dma_reload_mask; @@ -467,6 +470,8 @@ public: DECLARE_READ16_MEMBER( custom_chip_r ); DECLARE_WRITE16_MEMBER( custom_chip_w ); + DECLARE_WRITE_LINE_MEMBER( paula_int_w ); + DECLARE_READ16_MEMBER( rom_mirror_r ); DECLARE_READ32_MEMBER( rom_mirror32_r ); @@ -563,7 +568,7 @@ protected: required_device<mos8520_device> m_cia_1; optional_device<rs232_port_device> m_rs232; optional_device<centronics_device> m_centronics; - required_device<amiga_sound_device> m_sound; + required_device<paula_8364_device> m_paula; optional_device<amiga_fdc> m_fdc; required_device<screen_device> m_screen; optional_device<palette_device> m_palette; diff --git a/src/mame/includes/cclimber.h b/src/mame/includes/cclimber.h index 30cf4b45d85..2b1ec8a32b6 100644 --- a/src/mame/includes/cclimber.h +++ b/src/mame/includes/cclimber.h @@ -63,6 +63,7 @@ public: DECLARE_READ8_MEMBER(yamato_p1_r); DECLARE_WRITE8_MEMBER(toprollr_rombank_w); DECLARE_WRITE8_MEMBER(nmi_mask_w); + DECLARE_READ8_MEMBER(bagmanf_a000_r); DECLARE_WRITE8_MEMBER(cclimber_colorram_w); DECLARE_WRITE8_MEMBER(cannonb_flip_screen_w); diff --git a/src/mame/includes/changela.h b/src/mame/includes/changela.h index a66adab876c..025a661153c 100644 --- a/src/mame/includes/changela.h +++ b/src/mame/includes/changela.h @@ -85,14 +85,14 @@ public: protected: // memory pointers - required_shared_ptr<u8> m_spriteram; - required_shared_ptr<u8> m_videoram; - required_shared_ptr<u8> m_colorram; + required_shared_ptr<u8> m_spriteram; + required_shared_ptr<u8> m_videoram; + required_shared_ptr<u8> m_colorram; // devices - required_device<m68705p_device> m_mcu; - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; + required_device<m68705p_device> m_mcu; + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; required_device<palette_device> m_palette; // mcu-related diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h index ccc7018b0aa..8853b3155eb 100644 --- a/src/mame/includes/coco.h +++ b/src/mame/includes/coco.h @@ -32,7 +32,6 @@ //************************************************************************** INPUT_PORTS_EXTERN( coco_analog_control ); -INPUT_PORTS_EXTERN( coco_cart_autostart ); INPUT_PORTS_EXTERN( coco_rtc ); INPUT_PORTS_EXTERN( coco_beckerport ); @@ -58,7 +57,6 @@ SLOT_INTERFACE_EXTERN( coco_cart ); // inputs #define CTRL_SEL_TAG "ctrl_sel" #define HIRES_INTF_TAG "hires_intf" -#define CART_AUTOSTART_TAG "cart_autostart" #define BECKERPORT_TAG "beckerport" #define JOYSTICK_RX_TAG "joystick_rx" #define JOYSTICK_RY_TAG "joystick_ry" diff --git a/src/mame/includes/dc.h b/src/mame/includes/dc.h index 0d4f86e300a..37d9f304f50 100644 --- a/src/mame/includes/dc.h +++ b/src/mame/includes/dc.h @@ -77,6 +77,11 @@ class dc_state : public driver_device DECLARE_WRITE64_MEMBER( dc_modem_w ); DECLARE_WRITE8_MEMBER( g1_irq ); DECLARE_WRITE8_MEMBER( pvr_irq ); + DECLARE_READ64_MEMBER( sh4_soundram_r ); + DECLARE_WRITE64_MEMBER( sh4_soundram_w ); + DECLARE_WRITE_LINE_MEMBER(aica_irq); + DECLARE_WRITE_LINE_MEMBER(sh4_aica_irq); + required_device<sh4_base_device> m_maincpu; required_device<cpu_device> m_soundcpu; @@ -87,6 +92,9 @@ class dc_state : public driver_device void generic_dma(uint32_t main_adr, void *dma_ptr, uint32_t length, uint32_t size, bool to_mainram); TIMER_DEVICE_CALLBACK_MEMBER(dc_scanline); + DECLARE_MACHINE_RESET(dc_console); + + DECLARE_INPUT_CHANGED_MEMBER(mastercpu_cheat_r); }; /*--------- Ch2-DMA Control Registers ----------*/ diff --git a/src/mame/includes/dccons.h b/src/mame/includes/dccons.h index 8c7d3ba7bb6..90767a3219b 100644 --- a/src/mame/includes/dccons.h +++ b/src/mame/includes/dccons.h @@ -24,7 +24,6 @@ public: DECLARE_READ64_MEMBER(dcus_idle_skip_r); DECLARE_READ64_MEMBER(dcjp_idle_skip_r); - DECLARE_MACHINE_RESET(dc_console); DECLARE_READ64_MEMBER(dc_pdtra_r); DECLARE_WRITE64_MEMBER(dc_pdtra_w); DECLARE_READ64_MEMBER(dc_arm_r); diff --git a/src/mame/includes/ddragon.h b/src/mame/includes/ddragon.h index 775c4bd3e55..caf4cce2bd4 100644 --- a/src/mame/includes/ddragon.h +++ b/src/mame/includes/ddragon.h @@ -6,31 +6,34 @@ *************************************************************************/ +#include "cpu/m6805/m68705.h" #include "machine/gen_latch.h" #include "sound/msm5205.h" + class ddragon_state : public driver_device { public: ddragon_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_rambase(*this, "rambase"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_comram(*this, "comram"), - m_spriteram(*this, "spriteram"), - m_scrollx_lo(*this, "scrollx_lo"), - m_scrolly_lo(*this, "scrolly_lo"), - m_darktowr_mcu_ports(*this, "darktowr_mcu"), - m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu"), - m_subcpu(*this, "sub"), - m_adpcm1(*this, "adpcm1"), - m_adpcm2(*this, "adpcm2"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + : driver_device(mconfig, type, tag) + , m_rambase(*this, "rambase") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_comram(*this, "comram") + , m_spriteram(*this, "spriteram") + , m_scrollx_lo(*this, "scrollx_lo") + , m_scrolly_lo(*this, "scrolly_lo") + , m_maincpu(*this, "maincpu") + , m_soundcpu(*this, "soundcpu") + , m_subcpu(*this, "sub") + , m_adpcm1(*this, "adpcm1") + , m_adpcm2(*this, "adpcm2") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + { + } /* memory pointers */ optional_shared_ptr<uint8_t> m_rambase; @@ -40,7 +43,6 @@ public: required_shared_ptr<uint8_t> m_spriteram; required_shared_ptr<uint8_t> m_scrollx_lo; required_shared_ptr<uint8_t> m_scrolly_lo; - optional_shared_ptr<uint8_t> m_darktowr_mcu_ports; /* video-related */ tilemap_t *m_fg_tilemap; @@ -105,15 +107,10 @@ public: DECLARE_WRITE8_MEMBER(ddragon_fgvideoram_w); DECLARE_CUSTOM_INPUT_MEMBER(subcpu_bus_free); DECLARE_WRITE8_MEMBER(ddragon_bankswitch_w); - DECLARE_WRITE8_MEMBER(toffy_bankswitch_w); - DECLARE_READ8_MEMBER(darktowr_mcu_bank_r); - DECLARE_WRITE8_MEMBER(darktowr_mcu_bank_w); - DECLARE_WRITE8_MEMBER(darktowr_bankswitch_w); DECLARE_READ8_MEMBER(ddragon_interrupt_r); DECLARE_WRITE8_MEMBER(ddragon_interrupt_w); DECLARE_WRITE8_MEMBER(ddragon2_sub_irq_ack_w); DECLARE_WRITE8_MEMBER(ddragon2_sub_irq_w); - DECLARE_WRITE8_MEMBER(darktowr_mcu_w); DECLARE_READ8_MEMBER(ddragon_hd63701_internal_registers_r); DECLARE_WRITE8_MEMBER(ddragon_hd63701_internal_registers_w); DECLARE_READ8_MEMBER(ddragon_comram_r); @@ -124,9 +121,45 @@ public: DECLARE_WRITE_LINE_MEMBER(dd_adpcm_int_1); DECLARE_WRITE_LINE_MEMBER(dd_adpcm_int_2); - DECLARE_DRIVER_INIT(toffy); - DECLARE_DRIVER_INIT(darktowr); DECLARE_DRIVER_INIT(ddragon2); DECLARE_DRIVER_INIT(ddragon); DECLARE_DRIVER_INIT(ddragon6809); }; + + +class darktowr_state : public ddragon_state +{ +public: + darktowr_state(const machine_config &mconfig, device_type type, const char *tag) + : ddragon_state(mconfig, type, tag) + , m_mcu(*this, "mcu") + , m_mcu_port_a_out(0xff) + { + } + + DECLARE_READ8_MEMBER(darktowr_mcu_bank_r); + DECLARE_WRITE8_MEMBER(darktowr_mcu_bank_w); + DECLARE_WRITE8_MEMBER(darktowr_bankswitch_w); + DECLARE_WRITE8_MEMBER(mcu_port_a_w); + + DECLARE_DRIVER_INIT(darktowr); + +protected: + required_device<m68705p_device> m_mcu; + + uint8_t m_mcu_port_a_out;; +}; + + +class toffy_state : public ddragon_state +{ +public: + toffy_state(const machine_config &mconfig, device_type type, const char *tag) + : ddragon_state(mconfig, type, tag) + { + } + + DECLARE_WRITE8_MEMBER(toffy_bankswitch_w); + + DECLARE_DRIVER_INIT(toffy); +}; diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h index af3899ff356..415ccb58174 100644 --- a/src/mame/includes/dec0.h +++ b/src/mame/includes/dec0.h @@ -10,6 +10,12 @@ class dec0_state : public driver_device { public: + enum class mcu_type { + EMULATED, + BADDUDES_SIM, + BIRDTRY_SIM + }; + dec0_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), @@ -47,9 +53,9 @@ public: optional_shared_ptr<uint8_t> m_robocop_shared_ram; optional_shared_ptr<uint8_t> m_hippodrm_shared_ram; - int m_game; - int m_i8751_return; - int m_i8751_command; + mcu_type m_game; + uint16_t m_i8751_return; + uint16_t m_i8751_command; int m_slyspy_state; int m_hippodrm_msb; int m_hippodrm_lsb; @@ -85,7 +91,7 @@ public: DECLARE_DRIVER_INIT(hbarrel); DECLARE_DRIVER_INIT(slyspy); DECLARE_DRIVER_INIT(birdtry); - DECLARE_DRIVER_INIT(baddudes); + DECLARE_DRIVER_INIT(drgninja); DECLARE_DRIVER_INIT(midresb); DECLARE_DRIVER_INIT(ffantasybl); diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index 0bf7a485dcd..07938191fdb 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -186,7 +186,7 @@ public: uint16_t port_b_tattass(int unused); void tattass_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); void deco32_set_audio_output(uint8_t raw_data); - + DECO16IC_BANK_CB_MEMBER(fghthist_bank_callback); DECO16IC_BANK_CB_MEMBER(captaven_bank_callback); DECO16IC_BANK_CB_MEMBER(tattass_bank_callback); diff --git a/src/mame/includes/fidelbase.h b/src/mame/includes/fidelbase.h new file mode 100644 index 00000000000..1f36fdc490b --- /dev/null +++ b/src/mame/includes/fidelbase.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/****************************************************************************** +* +* Fidelity Electronics chess machines base class +* +******************************************************************************/ + +#include "emu.h" +#include "sound/dac.h" +#include "sound/s14001a.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "softlist.h" + +class fidelbase_state : public driver_device +{ +public: + fidelbase_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN.%u", 0), + m_speech(*this, "speech"), + m_speech_rom(*this, "speech"), + m_dac(*this, "dac"), + m_cart(*this, "cartslot"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices/pointers + required_device<cpu_device> m_maincpu; + optional_ioport_array<11> m_inp_matrix; // max 11 + optional_device<s14001a_device> m_speech; + optional_region_ptr<u8> m_speech_rom; + optional_device<dac_bit_interface> m_dac; + optional_device<generic_slot_device> m_cart; + + // misc common + u16 m_inp_mux; // multiplexed keypad/leds mask + u16 m_led_select; + u32 m_7seg_data; // data for seg leds + u16 m_led_data; + u8 m_speech_data; + u8 m_speech_bank; // speech rom higher address bits + + u16 read_inputs(int columns); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; +}; diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h deleted file mode 100644 index 1fe4e19cb6b..00000000000 --- a/src/mame/includes/fidelz80.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco,hap -// thanks-to:Berger -/****************************************************************************** -* -* Fidelity Electronics Z80 based board driver -* -******************************************************************************/ - -#include "emu.h" -#include "sound/dac.h" -#include "sound/s14001a.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "softlist.h" - -class fidelz80base_state : public driver_device -{ -public: - fidelz80base_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN.%u", 0), - m_speech(*this, "speech"), - m_speech_rom(*this, "speech"), - m_dac(*this, "dac"), - m_cart(*this, "cartslot"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices/pointers - required_device<cpu_device> m_maincpu; - optional_ioport_array<11> m_inp_matrix; // max 11 - optional_device<s14001a_device> m_speech; - optional_region_ptr<uint8_t> m_speech_rom; - optional_device<dac_bit_interface> m_dac; - optional_device<generic_slot_device> m_cart; - - // misc common - uint16_t m_inp_mux; // multiplexed keypad/leds mask - uint16_t m_led_select; - uint32_t m_7seg_data; // data for seg leds - uint16_t m_led_data; - uint8_t m_speech_data; - uint8_t m_speech_bank; // speech rom higher address bits - - uint16_t read_inputs(int columns); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(scc_cartridge); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; -}; diff --git a/src/mame/includes/gcpinbal.h b/src/mame/includes/gcpinbal.h index 92346a6f767..e945eae55c5 100644 --- a/src/mame/includes/gcpinbal.h +++ b/src/mame/includes/gcpinbal.h @@ -1,6 +1,8 @@ // license:BSD-3-Clause // copyright-holders:David Graves, R. Belmont +#include "machine/74157.h" +#include "machine/eepromser.h" #include "sound/okim6295.h" #include "sound/msm5205.h" #include "video/excellent_spr.h" @@ -17,8 +19,10 @@ public: gcpinbal_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom"), m_oki(*this, "oki"), m_msm(*this, "msm"), + m_adpcm_select(*this, "adpcm_select"), m_tilemapram(*this, "tilemapram"), m_ioc_ram(*this, "ioc_ram"), m_gfxdecode(*this, "gfxdecode"), @@ -28,8 +32,10 @@ public: /* devices */ required_device<cpu_device> m_maincpu; + required_device<eeprom_serial_93cxx_device> m_eeprom; required_device<okim6295_device> m_oki; required_device<msm6585_device> m_msm; + required_device<hct157_device> m_adpcm_select; /* memory pointers */ required_shared_ptr<uint16_t> m_tilemapram; @@ -56,7 +62,6 @@ public: uint32_t m_adpcm_end; uint32_t m_adpcm_idle; uint8_t m_adpcm_trigger; - uint8_t m_adpcm_data; DECLARE_READ16_MEMBER(ioc_r); DECLARE_WRITE16_MEMBER(ioc_w); diff --git a/src/mame/includes/gladiatr.h b/src/mame/includes/gladiatr.h index 60166ed4b99..39c99eb8391 100644 --- a/src/mame/includes/gladiatr.h +++ b/src/mame/includes/gladiatr.h @@ -83,8 +83,6 @@ public: , m_in2(*this, "IN2") , m_coins(*this, "COINS") , m_tclk_val(false) - , m_in0_val(0xff) - , m_in1_val(0xff) , m_cctl_p1(0xff) , m_cctl_p2(0xff) , m_ucpu_p1(0xff) @@ -123,6 +121,11 @@ public: DECLARE_WRITE8_MEMBER(csnd_p1_w); DECLARE_READ8_MEMBER(csnd_p2_r); + DECLARE_INPUT_CHANGED_MEMBER(p1_s1); + DECLARE_INPUT_CHANGED_MEMBER(p1_s2); + DECLARE_INPUT_CHANGED_MEMBER(p2_s1); + DECLARE_INPUT_CHANGED_MEMBER(p2_s2); + DECLARE_DRIVER_INIT(gladiatr); DECLARE_MACHINE_RESET(gladiator); @@ -137,7 +140,6 @@ private: required_ioport m_coins; bool m_tclk_val; - u8 m_in0_val, m_in1_val; u8 m_cctl_p1, m_cctl_p2; u8 m_ucpu_p1, m_csnd_p1; diff --git a/src/mame/includes/gundealr.h b/src/mame/includes/gundealr.h index dff065de3b2..c0439ab4d57 100644 --- a/src/mame/includes/gundealr.h +++ b/src/mame/includes/gundealr.h @@ -28,7 +28,6 @@ public: /* video-related */ tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; - int m_flipscreen; uint8_t m_scroll[4]; /* misc */ @@ -40,6 +39,7 @@ public: DECLARE_WRITE8_MEMBER(gundealr_fg_scroll_w); DECLARE_WRITE8_MEMBER(yamyam_fg_scroll_w); DECLARE_WRITE8_MEMBER(gundealr_flipscreen_w); + DECLARE_WRITE8_MEMBER(yamyam_flipscreen_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILEMAP_MAPPER_MEMBER(gundealr_scan); TILE_GET_INFO_MEMBER(get_fg_tile_info); diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h index b24642aa789..35b27a579ab 100644 --- a/src/mame/includes/hh_tms1k.h +++ b/src/mame/includes/hh_tms1k.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle, Kevin Horton +// copyright-holders:hap /* TMS1000 MCU series tabletops/handhelds or other simple devices. @@ -39,35 +39,35 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint16_t m_r; // MCU R-pins data - uint16_t m_o; // MCU O-pins data - uint32_t m_inp_mux; // multiplexed inputs mask + u16 m_r; // MCU R-pins data + u16 m_o; // MCU O-pins data + u32 m_inp_mux; // multiplexed inputs mask bool m_power_on; bool m_power_led; - uint8_t read_inputs(int columns); - uint8_t read_rotated_inputs(int columns, uint8_t rowmask = 0xf); + u8 read_inputs(int columns); + u8 read_rotated_inputs(int columns, u8 rowmask = 0xf); virtual DECLARE_INPUT_CHANGED_MEMBER(power_button); virtual DECLARE_WRITE_LINE_MEMBER(auto_power_off); // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_grid; // VFD/LED current row data - uint32_t m_plate; // VFD/LED current column data + u32 m_grid; // VFD/LED current row data + u32 m_plate; // VFD/LED current column data - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void set_display_segmask(uint32_t digits, uint32_t mask); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; diff --git a/src/mame/includes/hh_ucom4.h b/src/mame/includes/hh_ucom4.h index 4a0194e3cb0..8328809c09a 100644 --- a/src/mame/includes/hh_ucom4.h +++ b/src/mame/includes/hh_ucom4.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton +// copyright-holders:hap /* NEC uCOM4 MCU tabletops/handhelds or other simple devices, @@ -35,32 +35,32 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - uint8_t m_port[9]; // MCU port A-I write data (optional) - uint8_t m_int; // MCU INT pin state - uint16_t m_inp_mux; // multiplexed inputs mask + u8 m_port[9]; // MCU port A-I write data (optional) + u8 m_int; // MCU INT pin state + u16 m_inp_mux; // multiplexed inputs mask - uint8_t read_inputs(int columns); + u8 read_inputs(int columns); void refresh_interrupts(void); void set_interrupt(int state); DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line); // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) - uint32_t m_grid; // VFD current row data - uint32_t m_plate; // VFD current column data + u32 m_grid; // VFD current row data + u32 m_plate; // VFD current column data - uint32_t m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - uint16_t m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - uint32_t m_display_cache[0x20]; // (internal use) - uint8_t m_display_decay[0x20][0x20]; // (internal use) + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); void display_update(); void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, uint32_t setx, uint32_t sety, bool update = true); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); protected: virtual void machine_start() override; diff --git a/src/mame/includes/interpro.h b/src/mame/includes/interpro.h new file mode 100644 index 00000000000..6ae135b552c --- /dev/null +++ b/src/mame/includes/interpro.h @@ -0,0 +1,131 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#pragma once + +#ifndef INTERPRO_H_ +#define INTERPRO_H_ + +#include "emu.h" + +#include "cpu/clipper/clipper.h" +#include "machine/cammu.h" + +#include "machine/interpro_ioga.h" +#include "machine/interpro_mcga.h" +#include "machine/interpro_sga.h" + +#include "machine/z80scc.h" +#include "machine/mc146818.h" +#include "machine/upd765.h" +#include "machine/ncr539x.h" + +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" +#include "bus/scsi/scsihd.h" +#include "bus/rs232/rs232.h" + +#include "formats/pc_dsk.h" + +#define INTERPRO_CPU_TAG "cpu" +#define INTERPRO_MMU_TAG "mmu" + +#define INTERPRO_RTC_TAG "rtc" +#define INTERPRO_SCC1_TAG "scc1" +#define INTERPRO_SCC2_TAG "scc2" +#define INTERPRO_ROM_TAG "rom" +#define INTERPRO_EEPROM_TAG "eeprom" +#define INTERPRO_TERMINAL_TAG "terminal" +#define INTERPRO_FDC_TAG "fdc" +#define INTERPRO_SCSI_TAG "scsi" +#define INTERPRO_IOGA_TAG "ioga" +#define INTERPRO_MCGA_TAG "mcga" +#define INTERPRO_SGA_TAG "sga" +#define INTERPRO_SCSI_ADAPTER_TAG "adapter" + +// system board register offsets +#define SREG_LED 0 +#define SREG_ERROR 0 +#define SREG_STATUS 1 +#define SREG_CTRL1 2 +#define SREG_CTRL2 3 + +// control register 1 +#define CTRL1_FLOPLOW 0x0001 +#define CTRL1_FLOPRDY 0x0002 +#define CTRL1_LEDENA 0x0004 +#define CTRL1_LEDDP 0x0008 +#define CTRL1_ETHLOOP 0x0010 +#define CTRL1_ETHDTR 0x0020 +#define CTRL1_ETHRMOD 0x0040 +#define CTRL1_CLIPRESET 0x0040 +#define CTRL1_FIFOACTIVE 0x0080 + +// control register 2 +#define CTRL2_PWRUP 0x0001 +#define CTRL2_PWRENA 0x0002 +#define CTRL2_HOLDOFF 0x0004 +#define CTRL2_EXTNMIENA 0x0008 +#define CTRL2_COLDSTART 0x0010 +#define CTRL2_RESET 0x0020 +#define CTRL2_BUSENA 0x0040 +#define CTRL2_FRCPARITY 0x0080 +#define CTRL2_FLASHEN 0x0080 +#define CTRL2_WMASK 0x000f + +class interpro_state : public driver_device +{ +public: + interpro_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, INTERPRO_CPU_TAG), + m_mmu(*this, INTERPRO_MMU_TAG), + m_scc1(*this, INTERPRO_SCC1_TAG), + m_scc2(*this, INTERPRO_SCC2_TAG), + m_rtc(*this, INTERPRO_RTC_TAG), + m_fdc(*this, INTERPRO_FDC_TAG), + m_scsi(*this, INTERPRO_SCSI_ADAPTER_TAG), + m_ioga(*this, INTERPRO_IOGA_TAG), + m_mcga(*this, INTERPRO_MCGA_TAG), + m_sga(*this, INTERPRO_SGA_TAG) + { } + + required_device<clipper_device> m_maincpu; + required_device<cammu_device> m_mmu; + + // FIXME: not sure which one is the escc + required_device<z80scc_device> m_scc1; + required_device<z80scc_device> m_scc2; + required_device<mc146818_device> m_rtc; + required_device<n82077aa_device> m_fdc; + required_device<ncr539x_device> m_scsi; + + required_device<interpro_ioga_device> m_ioga; + required_device<interpro_mcga_device> m_mcga; + required_device<interpro_sga_device> m_sga; + + DECLARE_DRIVER_INIT(ip2800); + + DECLARE_WRITE16_MEMBER(system_w); + DECLARE_READ16_MEMBER(system_r); + + DECLARE_WRITE8_MEMBER(rtc_w); + DECLARE_READ8_MEMBER(rtc_r); + + DECLARE_READ32_MEMBER(idprom_r); + DECLARE_READ32_MEMBER(slot0_r); + + DECLARE_READ8_MEMBER(scsi_r); + DECLARE_WRITE8_MEMBER(scsi_w); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + uint16_t m_system_reg[4]; +}; + +#endif
\ No newline at end of file diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h index 0cf865a564b..b0c7b45d78f 100644 --- a/src/mame/includes/metro.h +++ b/src/mame/includes/metro.h @@ -168,7 +168,7 @@ public: // vmetal DECLARE_WRITE8_MEMBER(vmetal_control_w); - DECLARE_WRITE8_MEMBER(vmetal_es8712_w); + DECLARE_WRITE8_MEMBER(vmetal_se_control_w); DECLARE_DRIVER_INIT(karatour); DECLARE_DRIVER_INIT(daitorid); diff --git a/src/mame/includes/namcos2.h b/src/mame/includes/namcos2.h index 5ad57bee517..459bd749e29 100644 --- a/src/mame/includes/namcos2.h +++ b/src/mame/includes/namcos2.h @@ -143,7 +143,7 @@ public: void reset_all_subcpus(int state); TIMER_DEVICE_CALLBACK_MEMBER(screen_scanline); - + // C123 Tilemap Emulation // TODO: merge with namcos1.cpp implementation and convert to device public: @@ -334,7 +334,7 @@ public: int get_pos_irq_scanline() { return (get_palette_register(5) - 32) & 0xff; } TIMER_DEVICE_CALLBACK_MEMBER(screen_scanline); - + required_shared_ptr<uint8_t> m_dpram; /* 2Kx8 */ required_shared_ptr<uint16_t> m_paletteram; optional_shared_ptr<uint16_t> m_spriteram; diff --git a/src/mame/includes/namcos21.h b/src/mame/includes/namcos21.h index 0ec60ea94e5..1816bf5f557 100644 --- a/src/mame/includes/namcos21.h +++ b/src/mame/includes/namcos21.h @@ -70,7 +70,7 @@ public: optional_device<cpu_device> m_dsp; optional_device<namcoio_gearbox_device> m_io_gearbox; optional_device<namco_c148_device> m_gpu_intc; - + std::unique_ptr<uint8_t[]> m_videoram; std::unique_ptr<uint8_t[]> m_maskram; std::unique_ptr<uint16_t[]> m_winrun_dspcomram; @@ -158,12 +158,12 @@ public: DECLARE_WRITE16_MEMBER(winrun_gpu_register_w); DECLARE_WRITE16_MEMBER(winrun_gpu_videoram_w); DECLARE_READ16_MEMBER(winrun_gpu_videoram_r); - + TIMER_DEVICE_CALLBACK_MEMBER(screen_scanline); uint8_t m_gearbox_state; DECLARE_CUSTOM_INPUT_MEMBER(driveyes_gearbox_r); - + DECLARE_DRIVER_INIT(driveyes); DECLARE_DRIVER_INIT(winrun); DECLARE_DRIVER_INIT(starblad); diff --git a/src/mame/includes/naomi.h b/src/mame/includes/naomi.h index c9f1b7ba16d..5fa4de38c37 100644 --- a/src/mame/includes/naomi.h +++ b/src/mame/includes/naomi.h @@ -35,59 +35,36 @@ enum { JVSBD_MAHJONG, JVSBD_KEYBOARD }; + class naomi_state : public dc_state { public: naomi_state(const machine_config &mconfig, device_type type, const char *tag) : dc_state(mconfig, type, tag), - pvr2_texture_ram(*this, "textureram2"), - pvr2_framebuffer_ram(*this, "frameram2"), - elan_ram(*this, "elan_ram"), - m_awflash(*this, "awflash"), m_eeprom(*this, "main_eeprom") { } - /* Naomi 2 specific (To be moved) */ - optional_shared_ptr<uint64_t> pvr2_texture_ram; - optional_shared_ptr<uint64_t> pvr2_framebuffer_ram; - optional_shared_ptr<uint64_t> elan_ram; - optional_device<macronix_29l001mc_device> m_awflash; - optional_device<eeprom_serial_93cxx_device> m_eeprom; + required_device<eeprom_serial_93cxx_device> m_eeprom; - DECLARE_WRITE_LINE_MEMBER(aica_irq); - DECLARE_WRITE_LINE_MEMBER(sh4_aica_irq); DECLARE_MACHINE_RESET(naomi); - DECLARE_DRIVER_INIT(atomiswave); - DECLARE_DRIVER_INIT(xtrmhnt2); DECLARE_DRIVER_INIT(naomigd); DECLARE_DRIVER_INIT(ggxx); DECLARE_DRIVER_INIT(ggxxrl); DECLARE_DRIVER_INIT(ggxxsla); - DECLARE_DRIVER_INIT(naomi2); DECLARE_DRIVER_INIT(naomi); DECLARE_DRIVER_INIT(naomigd_mp); DECLARE_DRIVER_INIT(sfz3ugd); DECLARE_DRIVER_INIT(hotd2); DECLARE_DRIVER_INIT(naomi_mp); - DECLARE_READ64_MEMBER( naomi_arm_r ); - DECLARE_WRITE64_MEMBER( naomi_arm_w ); DECLARE_READ64_MEMBER( naomi_unknown1_r ); DECLARE_WRITE64_MEMBER( naomi_unknown1_w ); DECLARE_READ64_MEMBER( eeprom_93c46a_r ); DECLARE_WRITE64_MEMBER( eeprom_93c46a_w ); - DECLARE_READ64_MEMBER( aw_flash_r ); - DECLARE_WRITE64_MEMBER( aw_flash_w ); - DECLARE_READ64_MEMBER( aw_modem_r ); - DECLARE_WRITE64_MEMBER( aw_modem_w ); uint8_t m_mp_mux; DECLARE_CUSTOM_INPUT_MEMBER(naomi_mp_r); DECLARE_INPUT_CHANGED_MEMBER(naomi_mp_w); - inline int decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift); - - uint8_t aw_ctrl_type; - uint8_t asciihex_to_dec(uint8_t in); void create_pic_from_retdat(); @@ -99,8 +76,53 @@ class naomi_state : public dc_state DECLARE_READ64_MEMBER( naomigd_ggxxrl_idle_skip_r ); DECLARE_READ64_MEMBER( naomigd_sfz3ugd_idle_skip_r ); DECLARE_READ64_MEMBER( hotd2_idle_skip_r ); +}; + +class naomi2_state : public naomi_state +{ +public: + naomi2_state(const machine_config &mconfig, device_type type, const char *tag) + : naomi_state(mconfig, type, tag), + m_pvr2_texture_ram(*this, "textureram2"), + m_pvr2_framebuffer_ram(*this, "frameram2"), + m_elan_ram(*this, "elan_ram"), + m_powervr2_slave(*this, "powervr2_slave") { } + + required_shared_ptr<uint64_t> m_pvr2_texture_ram; + required_shared_ptr<uint64_t> m_pvr2_framebuffer_ram; + required_shared_ptr<uint64_t> m_elan_ram; + required_device<powervr2_device> m_powervr2_slave; + + DECLARE_DRIVER_INIT(naomi2); + DECLARE_WRITE32_MEMBER(both_pvr2_ta_w); +}; + +class atomiswave_state : public dc_state +{ +public: + atomiswave_state(const machine_config &mconfig, device_type type, const char *tag) + : dc_state(mconfig, type, tag), + m_awflash(*this, "awflash") + { } + + required_device<macronix_29l001mc_device> m_awflash; + + DECLARE_READ64_MEMBER( aw_flash_r ); + DECLARE_WRITE64_MEMBER( aw_flash_w ); + DECLARE_READ64_MEMBER( aw_modem_r ); + DECLARE_WRITE64_MEMBER( aw_modem_w ); + DECLARE_READ64_MEMBER( aw_unknown1_r ); + DECLARE_WRITE64_MEMBER( aw_unknown1_w ); + + DECLARE_DRIVER_INIT(atomiswave); + DECLARE_DRIVER_INIT(xtrmhnt2); + DECLARE_READ64_MEMBER( xtrmhnt2_hack_r ); + +protected: + uint8_t aw_ctrl_type; + inline int decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift); }; -MACHINE_CONFIG_EXTERN(naomi_aw_base); +MACHINE_CONFIG_EXTERN( naomi_aw_base ); INPUT_PORTS_EXTERN( naomi_debug ); diff --git a/src/mame/includes/novagbase.h b/src/mame/includes/novagbase.h new file mode 100644 index 00000000000..6516525804e --- /dev/null +++ b/src/mame/includes/novagbase.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/****************************************************************************** +* +* Novag chess machines base class +* +******************************************************************************/ + +#include "emu.h" +#include "sound/beep.h" +#include "video/hd44780.h" + +class novagbase_state : public driver_device +{ +public: + novagbase_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beeper(*this, "beeper"), + m_lcd(*this, "hd44780"), + m_inp_matrix(*this, "IN.%u", 0), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices/pointers + required_device<cpu_device> m_maincpu; + optional_device<beep_device> m_beeper; + optional_device<hd44780_device> m_lcd; + optional_ioport_array<8> m_inp_matrix; + + // misc common + u16 m_inp_mux; // multiplexed keypad mask + u16 m_led_select; + u16 m_led_data; + u8 m_lcd_control; + + u16 read_inputs(int columns); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + u32 m_display_cache[0x20]; // (internal use) + u8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void set_display_segmask(u32 digits, u32 mask); + void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); + + DECLARE_PALETTE_INIT(novag_lcd); + HD44780_PIXEL_UPDATE(novag_lcd_pixel_update); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; +}; diff --git a/src/mame/includes/osborne1.h b/src/mame/includes/osborne1.h index bbe12f9efcb..56754a43e82 100644 --- a/src/mame/includes/osborne1.h +++ b/src/mame/includes/osborne1.h @@ -81,6 +81,8 @@ public: DECLARE_WRITE_LINE_MEMBER(serial_acia_irq_func); + DECLARE_INPUT_CHANGED_MEMBER(reset_key); + DECLARE_DRIVER_INIT(osborne1); virtual void machine_reset() override; virtual void video_start() override; diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h index cdfd6b4b704..c6c4f0dc5e3 100644 --- a/src/mame/includes/polepos.h +++ b/src/mame/includes/polepos.h @@ -106,8 +106,6 @@ public: DECLARE_WRITE16_MEMBER(polepos_alpha16_w); DECLARE_READ8_MEMBER(polepos_alpha_r); DECLARE_WRITE8_MEMBER(polepos_alpha_w); - DECLARE_CUSTOM_INPUT_MEMBER(high_port_r); - DECLARE_CUSTOM_INPUT_MEMBER(low_port_r); DECLARE_CUSTOM_INPUT_MEMBER(auto_start_r); DECLARE_WRITE8_MEMBER(out_0); DECLARE_WRITE8_MEMBER(out_1); diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h index 93852b1c409..4f66519b51d 100644 --- a/src/mame/includes/polyplay.h +++ b/src/mame/includes/polyplay.h @@ -7,7 +7,7 @@ #include "machine/z80sio.h" #include "sound/speaker.h" -#define POLYPLAY_MAIN_CLOCK XTAL_9_8304MHz +#define POLYPLAY_MAIN_CLOCK XTAL_9_8304MHz #define Z80CPU_TAG "maincpu" #define Z80CTC_TAG "z80ctc" @@ -42,6 +42,8 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + INTERRUPT_GEN_MEMBER(nmi_handler); + /* devices */ DECLARE_WRITE_LINE_MEMBER(ctc_zc0_w); DECLARE_WRITE_LINE_MEMBER(ctc_zc1_w); @@ -59,10 +61,10 @@ public: uint8_t m_flipflop2; required_device<speaker_sound_device> m_speaker1; required_device<speaker_sound_device> m_speaker2; - + /* video */ virtual void video_start() override; - DECLARE_WRITE8_MEMBER(polyplay_characterram_w); + DECLARE_WRITE8_MEMBER(polyplay_characterram_w); DECLARE_PALETTE_INIT(polyplay); uint32_t screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/retofinv.h b/src/mame/includes/retofinv.h index 6ff49e40255..77405bec825 100644 --- a/src/mame/includes/retofinv.h +++ b/src/mame/includes/retofinv.h @@ -1,56 +1,28 @@ // license:BSD-3-Clause // copyright-holders:Jarek Parchanski, Andrea Mazzoleni +#include "machine/taito68705interface.h" + #include "machine/gen_latch.h" + class retofinv_state : public driver_device { public: retofinv_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_68705(*this, "68705"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_fg_videoram(*this, "fg_videoram"), - m_sharedram(*this, "sharedram"), - m_bg_videoram(*this, "bg_videoram") { } - - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_audiocpu; - required_device<cpu_device> m_subcpu; - optional_device<cpu_device> m_68705; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; - required_device<generic_latch_8_device> m_soundlatch; - - required_shared_ptr<uint8_t> m_fg_videoram; - required_shared_ptr<uint8_t> m_sharedram; - required_shared_ptr<uint8_t> m_bg_videoram; - - uint8_t m_main_irq_mask; - uint8_t m_sub_irq_mask; - uint8_t m_cpu2_m6000; - uint8_t m_from_main; - uint8_t m_from_mcu; - int m_mcu_sent; - int m_main_sent; - uint8_t m_portA_in; - uint8_t m_portA_out; - uint8_t m_ddrA; - uint8_t m_portB_in; - uint8_t m_portB_out; - uint8_t m_ddrB; - uint8_t m_portC_in; - uint8_t m_portC_out; - uint8_t m_ddrC; - int m_fg_bank; - int m_bg_bank; - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_subcpu(*this, "sub") + , m_68705(*this, "68705") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_fg_videoram(*this, "fg_videoram") + , m_sharedram(*this, "sharedram") + , m_bg_videoram(*this, "bg_videoram") + { + } DECLARE_WRITE8_MEMBER(cpu1_reset_w); DECLARE_WRITE8_MEMBER(cpu2_reset_w); @@ -62,17 +34,6 @@ public: DECLARE_WRITE8_MEMBER(irq1_ack_w); DECLARE_WRITE8_MEMBER(coincounter_w); DECLARE_WRITE8_MEMBER(coinlockout_w); - DECLARE_READ8_MEMBER(mcu_portA_r); - DECLARE_WRITE8_MEMBER(mcu_portA_w); - DECLARE_WRITE8_MEMBER(mcu_ddrA_w); - DECLARE_READ8_MEMBER(mcu_portB_r); - DECLARE_WRITE8_MEMBER(mcu_portB_w); - DECLARE_WRITE8_MEMBER(mcu_ddrB_w); - DECLARE_READ8_MEMBER(mcu_portC_r); - DECLARE_WRITE8_MEMBER(mcu_portC_w); - DECLARE_WRITE8_MEMBER(mcu_ddrC_w); - DECLARE_WRITE8_MEMBER(mcu_w); - DECLARE_READ8_MEMBER(mcu_r); DECLARE_READ8_MEMBER(mcu_status_r); DECLARE_WRITE8_MEMBER(bg_videoram_w); DECLARE_WRITE8_MEMBER(fg_videoram_w); @@ -82,13 +43,36 @@ public: TILE_GET_INFO_MEMBER(bg_get_tile_info); TILE_GET_INFO_MEMBER(fg_get_tile_info); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(retofinv); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap); INTERRUPT_GEN_MEMBER(main_vblank_irq); INTERRUPT_GEN_MEMBER(sub_vblank_irq); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + void draw_sprites(bitmap_ind16 &bitmap); + + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_audiocpu; + required_device<cpu_device> m_subcpu; + optional_device<taito68705_mcu_device> m_68705; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + required_device<generic_latch_8_device> m_soundlatch; + + required_shared_ptr<uint8_t> m_fg_videoram; + required_shared_ptr<uint8_t> m_sharedram; + required_shared_ptr<uint8_t> m_bg_videoram; + + uint8_t m_main_irq_mask; + uint8_t m_sub_irq_mask; + uint8_t m_cpu2_m6000; + int m_fg_bank; + int m_bg_bank; + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; }; diff --git a/src/mame/includes/rm380z.h b/src/mame/includes/rm380z.h index a55abdea6a8..7448b710ad4 100644 --- a/src/mame/includes/rm380z.h +++ b/src/mame/includes/rm380z.h @@ -125,7 +125,7 @@ public: DECLARE_WRITE8_MEMBER(disk_0_control); DECLARE_WRITE8_MEMBER( keyboard_put ); - + DECLARE_DRIVER_INIT(rm380z); DECLARE_DRIVER_INIT(rm380z34d); DECLARE_DRIVER_INIT(rm380z34e); diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index 145b9d54f4a..7197093f469 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -13,37 +13,26 @@ public: }; stfight_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_mcu(*this, "mcu"), - m_msm(*this, "msm"), - m_palette(*this, "palette"), - m_decrypted_opcodes(*this, "decrypted_opcodes"), - m_stfight_video(*this, "stfight_vid"), - m_airraid_video(*this, "airraid_vid") - { } - - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_audiocpu; - required_device<cpu_device> m_mcu; - required_device<msm5205_device> m_msm; - required_device<palette_device> m_palette; - - optional_shared_ptr<uint8_t> m_decrypted_opcodes; - optional_device<stfight_video_device> m_stfight_video; - optional_device<airraid_video_device> m_airraid_video; - - uint8_t *m_decrypt; - uint8_t m_fm_data; - uint8_t m_cpu_to_mcu_data; - uint8_t m_cpu_to_mcu_empty; - - uint16_t m_adpcm_data_offs; - uint8_t m_adpcm_nibble; - uint8_t m_adpcm_reset; - - uint8_t m_coin_state; + : driver_device(mconfig, type, tag) + , m_coin_mech(*this, "COIN") + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_mcu(*this, "mcu") + , m_msm(*this, "msm") + , m_main_bank(*this, "mainbank") + , m_samples(*this, "adpcm") + , m_decrypted_opcodes(*this, "decrypted_opcodes") + , m_coin_state(0) + , m_fm_data(0) + , m_cpu_to_mcu_empty(true) + , m_cpu_to_mcu_data(0x0f) + , m_port_a_out(0xff) + , m_port_c_out(0xff) + , m_vck2(false) + , m_adpcm_reset(true) + , m_adpcm_data_offs(0x0000) + { + } DECLARE_WRITE_LINE_MEMBER(stfight_adpcm_int); @@ -59,13 +48,8 @@ public: DECLARE_WRITE8_MEMBER(stfight_bank_w); - DECLARE_READ8_MEMBER(stfight_fm_r); - - virtual void machine_start() override; - virtual void machine_reset() override; - INTERRUPT_GEN_MEMBER(stfight_vb_interrupt); // MCU specifics @@ -74,8 +58,34 @@ public: DECLARE_WRITE8_MEMBER(stfight_68705_port_b_w); DECLARE_WRITE8_MEMBER(stfight_68705_port_c_w); - uint8_t m_portC_out; - 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; + + required_ioport m_coin_mech; + + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_audiocpu; + required_device<cpu_device> m_mcu; + required_device<msm5205_device> m_msm; + + required_memory_bank m_main_bank; + + required_region_ptr<uint8_t> m_samples; + optional_shared_ptr<uint8_t> m_decrypted_opcodes; + + uint8_t m_coin_state; + + uint8_t m_fm_data; + + bool m_cpu_to_mcu_empty; + uint8_t m_cpu_to_mcu_data; + uint8_t m_port_a_out; + uint8_t m_port_c_out; + + bool m_vck2; + bool m_adpcm_reset; + uint16_t m_adpcm_data_offs; }; diff --git a/src/mame/includes/superqix.h b/src/mame/includes/superqix.h index acdd694d3ec..147086de778 100644 --- a/src/mame/includes/superqix.h +++ b/src/mame/includes/superqix.h @@ -159,21 +159,21 @@ protected: void pbillian_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - required_ioport_array<2> m_dsw; - required_ioport_array<2> m_dials; - optional_ioport_array<2> m_plungers; - optional_device<m68705p_device> m_mcu; - optional_device<samples_device> m_samples; - optional_region_ptr<u8> m_samples_region; + required_ioport_array<2> m_dsw; + required_ioport_array<2> m_dials; + optional_ioport_array<2> m_plungers; + optional_device<m68705p_device> m_mcu; + optional_device<samples_device> m_samples; + optional_region_ptr<u8> m_samples_region; - std::unique_ptr<s16[]> m_samplebuf; + std::unique_ptr<s16[]> m_samplebuf; // HLE-related for prebillian int m_curr_player; // 68705 related - u8 m_portB_out; - u8 m_portC_out; + u8 m_portB_out; + u8 m_portC_out; // spinner quadrature stuff int m_oldpos[2]; diff --git a/src/mame/includes/tigeroad.h b/src/mame/includes/tigeroad.h index 4a41ebcd907..7e2e04fa337 100644 --- a/src/mame/includes/tigeroad.h +++ b/src/mame/includes/tigeroad.h @@ -1,22 +1,26 @@ // license:BSD-3-Clause // copyright-holders:Phil Stroffolino -#include "video/bufsprite.h" -#include "sound/msm5205.h" +#include "video/tigeroad_spr.h" + #include "cpu/m68000/m68000.h" +#include "cpu/m6805/m68705.h" #include "cpu/z80/z80.h" + #include "machine/gen_latch.h" + #include "sound/2203intf.h" #include "sound/msm5205.h" -#include "cpu/m6805/m68705.h" -#include "video/tigeroad_spr.h" + +#include "video/bufsprite.h" + class tigeroad_state : public driver_device { public: tigeroad_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram") , + m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_ram16(*this, "ram16"), m_maincpu(*this, "maincpu"), @@ -24,10 +28,9 @@ public: m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_mcu(*this, "mcu"), m_spritegen(*this, "spritegen"), m_soundlatch(*this, "soundlatch"), - m_has_coinlock(1) + m_has_coinlock(true) { } required_device<buffered_spriteram16_device> m_spriteram; @@ -43,8 +46,6 @@ public: DECLARE_WRITE16_MEMBER(tigeroad_scroll_w); DECLARE_WRITE8_MEMBER(msm5205_w); DECLARE_DRIVER_INIT(f1dream); - DECLARE_DRIVER_INIT(pushman); - DECLARE_DRIVER_INIT(bballs); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); TILEMAP_MAPPER_MEMBER(tigeroad_tilemap_scan); @@ -56,28 +57,46 @@ public: optional_device<msm5205_device> m_msm; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - optional_device<cpu_device> m_mcu; required_device<tigeroad_spr_device> m_spritegen; required_device<generic_latch_8_device> m_soundlatch; - uint16_t m_control[2]; - +protected: /* misc */ - uint8_t m_shared_ram[8]; - uint16_t m_latch; - uint16_t m_new_latch; - int m_has_coinlock; - - /* protection handling */ - DECLARE_READ16_MEMBER(pushman_68705_r); - DECLARE_WRITE16_MEMBER(pushman_68705_w); - DECLARE_READ16_MEMBER(bballs_68705_r); - DECLARE_WRITE16_MEMBER(bballs_68705_w); - DECLARE_READ8_MEMBER(pushman_68000_r); - DECLARE_WRITE8_MEMBER(pushman_68000_w); - DECLARE_MACHINE_RESET(pushman); - DECLARE_MACHINE_RESET(bballs); + bool m_has_coinlock; +}; + + +class pushman_state : public tigeroad_state +{ +public: + pushman_state(const machine_config &mconfig, device_type type, const char *tag) + : tigeroad_state(mconfig, type, tag) + , m_mcu(*this, "mcu") + , m_host_semaphore(false) + , m_mcu_semaphore(false) + , m_host_latch(0xffff) + , m_mcu_latch(0xffff) + , m_mcu_output(0xffff) + , m_mcu_latch_ctl(0xff) + { + m_has_coinlock = false; + } + + DECLARE_READ16_MEMBER(mcu_comm_r); + DECLARE_WRITE16_MEMBER(pushman_mcu_comm_w); + DECLARE_WRITE16_MEMBER(bballs_mcu_comm_w); + DECLARE_WRITE8_MEMBER(mcu_pa_w); + DECLARE_WRITE8_MEMBER(mcu_pb_w); + DECLARE_WRITE8_MEMBER(mcu_pc_w); + +protected: virtual void machine_start() override; + required_device<m68705u_device> m_mcu; + + bool m_host_semaphore, m_mcu_semaphore; + u16 m_host_latch, m_mcu_latch; + u16 m_mcu_output; + u8 m_mcu_latch_ctl; }; diff --git a/src/mame/includes/vcs80.h b/src/mame/includes/vcs80.h index fa1f3d1ce8d..adb956251a2 100644 --- a/src/mame/includes/vcs80.h +++ b/src/mame/includes/vcs80.h @@ -43,13 +43,13 @@ public: DECLARE_WRITE8_MEMBER( pio_w ); DECLARE_READ8_MEMBER( pio_pa_r ); DECLARE_WRITE8_MEMBER( pio_pb_w ); - + DECLARE_READ8_MEMBER( mem_r ) { m_pio->port_b_write((!BIT(offset, 0)) << 7); return m_bdmem->read8(space, offset); } - + DECLARE_WRITE8_MEMBER( mem_w ) { m_pio->port_b_write((!BIT(offset, 0)) << 7); @@ -65,7 +65,7 @@ public: } return 0xff; } - + DECLARE_WRITE8_MEMBER( io_w ) { m_pio->port_b_write((!BIT(offset, 0)) << 7); diff --git a/src/mame/includes/xbox_nv2a.h b/src/mame/includes/xbox_nv2a.h index 65d3b79048d..e56e586f495 100644 --- a/src/mame/includes/xbox_nv2a.h +++ b/src/mame/includes/xbox_nv2a.h @@ -108,7 +108,7 @@ public: { union { - uint32_t i; + uint32_t i; float f; } cnv; diff --git a/src/mame/includes/zorba.h b/src/mame/includes/zorba.h new file mode 100644 index 00000000000..1c14b8399b3 --- /dev/null +++ b/src/mame/includes/zorba.h @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert, Vas Crabb + +#include "sound/beep.h" + +#include "bus/ieee488/ieee488.h" + +#include "machine/6821pia.h" +#include "machine/i8251.h" +#include "machine/wd_fdc.h" +#include "machine/z80dma.h" + +#include "video/i8275.h" + + +class zorba_state : public driver_device +{ +public: + zorba_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_config_port(*this, "CNF") + , m_read_bank(*this, "bankr0") + , m_p_chargen(*this, "chargen") + , m_maincpu(*this, "maincpu") + , m_dma(*this, "dma") + , m_uart0(*this, "uart0") + , m_uart1(*this, "uart1") + , m_uart2(*this, "uart2") + , m_pia0(*this, "pia0") + , m_pia1(*this, "pia1") + , m_palette(*this, "palette") + , m_crtc(*this, "crtc") + , m_beep(*this, "beeper") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_ieee(*this, IEEE488_TAG) + { + } + +public: + DECLARE_DRIVER_INIT(zorba); + DECLARE_MACHINE_RESET(zorba); + + // Memory banking control + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(rom_r); + DECLARE_WRITE8_MEMBER(rom_w); + + // Interrupt vectoring glue + DECLARE_WRITE8_MEMBER(intmask_w); + template <unsigned N> DECLARE_WRITE_LINE_MEMBER(tx_rx_rdy_w); + template <unsigned N> DECLARE_WRITE_LINE_MEMBER(irq_w); + + // DMA controller handlers + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + + // PIT handlers + DECLARE_WRITE_LINE_MEMBER(br1_w); + + // PIA handlers + DECLARE_WRITE8_MEMBER(pia0_porta_w); + DECLARE_READ8_MEMBER(pia1_portb_r); + DECLARE_WRITE8_MEMBER(pia1_portb_w); + + // Video + I8275_DRAW_CHARACTER_MEMBER(zorba_update_chr); + + // Printer port glue + DECLARE_WRITE_LINE_MEMBER(printer_fault_w); + DECLARE_WRITE_LINE_MEMBER(printer_select_w); + DECLARE_INPUT_CHANGED_MEMBER(printer_type); + +private: + required_ioport m_config_port; + + required_memory_bank m_read_bank; + required_region_ptr<uint8_t> m_p_chargen; + + required_device<cpu_device> m_maincpu; + required_device<z80dma_device> m_dma; + required_device<i8251_device> m_uart0; + required_device<i8251_device> m_uart1; + required_device<i8251_device> m_uart2; + required_device<pia6821_device> m_pia0; + required_device<pia6821_device> m_pia1; + + required_device<palette_device> m_palette; + required_device<i8275_device> m_crtc; + + required_device<beep_device> m_beep; + + required_device<fd1793_t> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; + + required_device<ieee488_device> m_ieee; + + uint8_t m_intmask; + uint8_t m_tx_rx_rdy; + uint8_t m_irq; + + bool m_printer_prowriter; + int m_printer_fault; + int m_printer_select; + + uint8_t m_term_data; +}; diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h index d8717e0371c..b695f82f9ab 100644 --- a/src/mame/includes/zx.h +++ b/src/mame/includes/zx.h @@ -15,6 +15,7 @@ #include "sound/wave.h" #include "imagedev/cassette.h" #include "formats/zx81_p.h" +#include "formats/tzx_cas.h" #include "machine/ram.h" diff --git a/src/mame/layout/aristmk5.lay b/src/mame/layout/aristmk5.lay index 2f48631a00f..d6b099ffa53 100644 --- a/src/mame/layout/aristmk5.lay +++ b/src/mame/layout/aristmk5.lay @@ -1,23 +1,23 @@ <?xml version="1.0"?> <mamelayout version="2"> - <element name="CASHOUT"> - <rect state="1"> + <element name="COLLECT"> + <rect state="0"> <color red="1.0" green="1.0" blue="0.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.0" /> </rect> - <text string="CASHOUT"> + <text string="COLLECT"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> <element name="1LINE"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="1 LINE"> @@ -26,63 +26,63 @@ </text> </element> - <element name="3LINES"> - <rect state="1"> + <element name="5LINES"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> - <text string="3 LINES"> + <text string="5 LINES"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - <element name="5LINES"> - <rect state="1"> + <element name="10LINES"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> - <text string="5 LINES"> + <text string="10 LINES"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - <element name="7LINES"> - <rect state="1"> + <element name="15LINES"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> - <text string="7 LINES"> + <text string="15 LINES"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - <element name="9LINES"> - <rect state="1"> + <element name="20LINES"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> - <text string="9 LINES"> + <text string="20 LINES"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> <element name="GAMBLE"> - <rect state="1"> + <rect state="0"> <color red="0.5" green="0.0" blue="0.7" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.25" green="0.0" blue="0.35" /> </rect> @@ -92,24 +92,24 @@ </text> </element> - <element name="SERVICE"> - <rect state="1"> + <element name="RESERVE"> + <rect state="0"> <color red="0.0" green="1.0" blue="0.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.0" green="0.5" blue="0.0" /> </rect> - <text string="SERVICE"> + <text string="RESERVE"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> <element name="BET1"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="BET 1"> @@ -119,10 +119,10 @@ </element> <element name="BET2"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="BET 2"> @@ -132,10 +132,10 @@ </element> <element name="BET3"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="BET 3"> @@ -145,10 +145,10 @@ </element> <element name="BET5"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="BET 5"> @@ -158,10 +158,10 @@ </element> <element name="BET10"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="1.0" blue="1.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.5" blue="0.5" /> </rect> <text string="BET 10"> @@ -171,10 +171,10 @@ </element> <element name="TAKE_WIN"> - <rect state="1"> + <rect state="0"> <color red="1.0" green="0.7" blue="0.0" /> </rect> - <rect state="0"> + <rect state="1"> <color red="0.5" green="0.35" blue="0.0" /> </rect> <text string="TAKE WIN"> @@ -183,20 +183,11 @@ </text> </element> - <element name="WHITELAMP" defstate="0"> - <disk state="0"> - <color red="0.2" green="0.2" blue="0.2" /> - </disk> + <element name="REDLAMP"> <disk state="1"> - <color red="1.0" green="1.0" blue="1.0" /> - </disk> - </element> - - <element name="REDLAMP" defstate="0"> - <disk state="0"> <color red="0.2" green="0.0" blue="0.0" /> </disk> - <disk state="1"> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> @@ -207,55 +198,62 @@ </screen> <!-- Buttons lamps --> - <bezel name="lamp8" element="CASHOUT" inputtag="P2" inputmask="0x01"> - <bounds x="0.27" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp8" element="COLLECT" inputtag="P1" inputmask="0x100"> + <bounds x="0.47" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp9" element="1LINE" inputtag="P2" inputmask="0x02"> - <bounds x="0.68" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp9" element="BET1" inputtag="P1" inputmask="0x200"> + <bounds x="0.88" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp10" element="3LINES" inputtag="P2" inputmask="0x04"> - <bounds x="1.09" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp10" element="BET2" inputtag="P1" inputmask="0x400"> + <bounds x="1.29" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp11" element="5LINES" inputtag="P2" inputmask="0x08"> - <bounds x="1.51" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp11" element="BET3" inputtag="P1" inputmask="0x800"> + <bounds x="1.71" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp12" element="7LINES" inputtag="P2" inputmask="0x10"> - <bounds x="1.91" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp12" element="BET5" inputtag="P1" inputmask="0x1000"> + <bounds x="2.11" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp13" element="9LINES" inputtag="P2" inputmask="0x20"> - <bounds x="2.32" y="3.02" width="0.31" height="0.24" /> + <bezel name="lamp13" element="BET10" inputtag="P1" inputmask="0x2000"> + <bounds x="2.52" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp7" element="SERVICE" inputtag="P1" inputmask="0x80"> - <bounds x="0.27" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp0" element="GAMBLE" inputtag="P1" inputmask="0x01"> + <bounds x="2.93" y="3.02" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp6" element="BET1" inputtag="P1" inputmask="0x40"> - <bounds x="0.68" y="3.28" width="0.31" height="0.24" /> + + <bezel name="lamp7" element="RESERVE" inputtag="P1" inputmask="0x80"> + <bounds x="0.47" y="3.28" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp5" element="BET2" inputtag="P1" inputmask="0x20"> - <bounds x="1.09" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp6" element="1LINE" inputtag="P1" inputmask="0x40"> + <bounds x="0.88" y="3.28" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp4" element="BET3" inputtag="P1" inputmask="0x10"> - <bounds x="1.51" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp5" element="5LINES" inputtag="P1" inputmask="0x20"> + <bounds x="1.29" y="3.28" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp3" element="BET5" inputtag="P1" inputmask="0x08"> - <bounds x="1.91" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp4" element="10LINES" inputtag="P1" inputmask="0x10"> + <bounds x="1.71" y="3.28" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp2" element="BET10" inputtag="P1" inputmask="0x04"> - <bounds x="2.32" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp3" element="15LINES" inputtag="P1" inputmask="0x08"> + <bounds x="2.11" y="3.28" width="0.31" height="0.24" /> </bezel> - <bezel name="lamp0" element="GAMBLE" inputtag="P1" inputmask="0x01"> - <bounds x="2.73" y="3.28" width="0.31" height="0.24" /> + <bezel name="lamp2" element="20LINES" inputtag="P1" inputmask="0x04"> + <bounds x="2.52" y="3.28" width="0.31" height="0.24" /> </bezel> <bezel name="lamp1" element="TAKE_WIN" inputtag="P1" inputmask="0x02"> - <bounds x="3.14" y="3.28" width="0.31" height="0.24" /> + <bounds x="2.93" y="3.28" width="0.31" height="0.24" /> </bezel> <!-- Tower lamps --> - <bezel name="lamp17" element="WHITELAMP"> - <bounds x="3.68" y="3.24" width="0.10" height="0.10" /> + <bezel name="lamp32" element="REDLAMP"> + <bounds x="3.57" y="3.25" width="0.10" height="0.10" /> + </bezel> + <bezel name="lamp33" element="REDLAMP"> + <bounds x="3.57" y="3.36" width="0.10" height="0.10" /> + </bezel> + <bezel name="lamp34" element="REDLAMP"> + <bounds x="3.67" y="3.25" width="0.10" height="0.10" /> </bezel> - <bezel name="lamp16" element="REDLAMP"> - <bounds x="3.68" y="3.36" width="0.10" height="0.10" /> + <bezel name="lamp35" element="REDLAMP"> + <bounds x="3.67" y="3.36" width="0.10" height="0.10" /> </bezel> </view> diff --git a/src/mame/layout/aristmk5_us.lay b/src/mame/layout/aristmk5_us.lay new file mode 100644 index 00000000000..2f48631a00f --- /dev/null +++ b/src/mame/layout/aristmk5_us.lay @@ -0,0 +1,267 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + <element name="CASHOUT"> + <rect state="1"> + <color red="1.0" green="1.0" blue="0.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.0" /> + </rect> + <text string="CASHOUT"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="1LINE"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="1 LINE"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="3LINES"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="3 LINES"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="5LINES"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="5 LINES"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="7LINES"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="7 LINES"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="9LINES"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="9 LINES"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="GAMBLE"> + <rect state="1"> + <color red="0.5" green="0.0" blue="0.7" /> + </rect> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.35" /> + + </rect> + <text string="GAMBLE"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="SERVICE"> + <rect state="1"> + <color red="0.0" green="1.0" blue="0.0" /> + </rect> + <rect state="0"> + <color red="0.0" green="0.5" blue="0.0" /> + </rect> + <text string="SERVICE"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="BET1"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="BET 1"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="BET2"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="BET 2"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="BET3"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="BET 3"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="BET5"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="BET 5"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="BET10"> + <rect state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.5" blue="0.5" /> + </rect> + <text string="BET 10"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="TAKE_WIN"> + <rect state="1"> + <color red="1.0" green="0.7" blue="0.0" /> + </rect> + <rect state="0"> + <color red="0.5" green="0.35" blue="0.0" /> + </rect> + <text string="TAKE WIN"> + <color red="0.0" green="0.0" blue="0.0" /> + <bounds x="0" y="0.1" width="1" height="0.8" /> + </text> + </element> + + <element name="WHITELAMP" defstate="0"> + <disk state="0"> + <color red="0.2" green="0.2" blue="0.2" /> + </disk> + <disk state="1"> + <color red="1.0" green="1.0" blue="1.0" /> + </disk> + </element> + + <element name="REDLAMP" defstate="0"> + <disk state="0"> + <color red="0.2" green="0.0" blue="0.0" /> + </disk> + <disk state="1"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> + </element> + + <view name="Button Lamps"> + <screen index="0"> + <bounds left="0" top="0" right="4" bottom="3" /> + </screen> + + <!-- Buttons lamps --> + <bezel name="lamp8" element="CASHOUT" inputtag="P2" inputmask="0x01"> + <bounds x="0.27" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp9" element="1LINE" inputtag="P2" inputmask="0x02"> + <bounds x="0.68" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp10" element="3LINES" inputtag="P2" inputmask="0x04"> + <bounds x="1.09" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp11" element="5LINES" inputtag="P2" inputmask="0x08"> + <bounds x="1.51" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp12" element="7LINES" inputtag="P2" inputmask="0x10"> + <bounds x="1.91" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp13" element="9LINES" inputtag="P2" inputmask="0x20"> + <bounds x="2.32" y="3.02" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp7" element="SERVICE" inputtag="P1" inputmask="0x80"> + <bounds x="0.27" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp6" element="BET1" inputtag="P1" inputmask="0x40"> + <bounds x="0.68" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp5" element="BET2" inputtag="P1" inputmask="0x20"> + <bounds x="1.09" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp4" element="BET3" inputtag="P1" inputmask="0x10"> + <bounds x="1.51" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp3" element="BET5" inputtag="P1" inputmask="0x08"> + <bounds x="1.91" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp2" element="BET10" inputtag="P1" inputmask="0x04"> + <bounds x="2.32" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp0" element="GAMBLE" inputtag="P1" inputmask="0x01"> + <bounds x="2.73" y="3.28" width="0.31" height="0.24" /> + </bezel> + <bezel name="lamp1" element="TAKE_WIN" inputtag="P1" inputmask="0x02"> + <bounds x="3.14" y="3.28" width="0.31" height="0.24" /> + </bezel> + + <!-- Tower lamps --> + <bezel name="lamp17" element="WHITELAMP"> + <bounds x="3.68" y="3.24" width="0.10" height="0.10" /> + </bezel> + <bezel name="lamp16" element="REDLAMP"> + <bounds x="3.68" y="3.36" width="0.10" height="0.10" /> + </bezel> + </view> + + <view name="Screen"> + <screen index="0"> + <bounds left="0" top="0" right="4" bottom="3" /> + </screen> + </view> +</mamelayout> diff --git a/src/mame/layout/cnsector.lay b/src/mame/layout/cnsector.lay index 8bca9c3ab7a..15ca5c92e40 100644 --- a/src/mame/layout/cnsector.lay +++ b/src/mame/layout/cnsector.lay @@ -242,8 +242,8 @@ <bezel element="static_red"><bounds x="199" y="98" width="24" height="31" /></bezel> <bezel element="button" inputtag="IN.0" inputmask="0x01"><bounds x="107" y="33" width="16" height="8" /></bezel> - <bezel element="button" inputtag="IN.2" inputmask="0x08"><bounds x="155" y="33" width="16" height="8" /></bezel> - <bezel element="button" inputtag="IN.4" inputmask="0x08"><bounds x="203" y="33" width="16" height="8" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x01"><bounds x="155" y="33" width="16" height="8" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x01"><bounds x="203" y="33" width="16" height="8" /></bezel> <bezel element="button" inputtag="IN.0" inputmask="0x02"><bounds x="107" y="55" width="16" height="8" /></bezel> <bezel element="button" inputtag="IN.1" inputmask="0x02"><bounds x="131" y="55" width="16" height="8" /></bezel> @@ -252,10 +252,10 @@ <bezel element="button" inputtag="IN.4" inputmask="0x02"><bounds x="203" y="55" width="16" height="8" /></bezel> <bezel element="button" inputtag="IN.0" inputmask="0x08"><bounds x="107" y="102" width="16" height="8" /></bezel> - <bezel element="button" inputtag="IN.1" inputmask="0x01"><bounds x="131" y="102" width="16" height="8" /></bezel> - <bezel element="button" inputtag="IN.2" inputmask="0x01"><bounds x="155" y="102" width="16" height="8" /></bezel> - <bezel element="buttond" inputtag="IN.3" inputmask="0x01"><bounds x="185" y="104" width="4" height="4" /></bezel> - <bezel element="button" inputtag="IN.4" inputmask="0x01"><bounds x="207" y="102" width="8" height="8" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x08"><bounds x="131" y="102" width="16" height="8" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x08"><bounds x="155" y="102" width="16" height="8" /></bezel> + <bezel element="buttond" inputtag="IN.3" inputmask="0x08"><bounds x="185" y="104" width="4" height="4" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x08"><bounds x="207" y="102" width="8" height="8" /></bezel> <bezel element="text_rnext"><bounds x="127" y="32" width="18" height="5" /></bezel> <bezel element="text_rship"><bounds x="127" y="37" width="18" height="5" /></bezel> diff --git a/src/mame/layout/einvader.lay b/src/mame/layout/einvader.lay index 81021899dbf..7f2d4f87dd0 100644 --- a/src/mame/layout/einvader.lay +++ b/src/mame/layout/einvader.lay @@ -4,82 +4,29 @@ <!-- define elements --> <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + <element name="static_white"><rect><color red="0.8" green="0.8" blue="0.8" /></rect></element> + <element name="text_score"><text string="SCORE"><color red="0.8" green="0.8" blue="0.8" /></text></element> <element name="digit" defstate="0"> - <led7seg><color red="1.0" green="0.20" blue="0.22" /></led7seg> - </element> - <element name="led" defstate="0"> - <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk> - <disk state="1"><color red="1.0" green="0.20" blue="0.22" /></disk> + <led7seg><color red="1.0" green="0.165" blue="0.165" /></led7seg> </element> <!-- build screen --> - <view name="Test Layout"> - <bounds left="0" right="12" top="0" bottom="28" /> - <bezel element="static_black"> - <bounds left="0" right="12" top="0" bottom="28" /> - </bezel> - - <bezel name="digit9" element="digit"><bounds x="0" y="0" width="4" height="6" /></bezel> - <bezel name="digit8" element="digit"><bounds x="4" y="0" width="4" height="6" /></bezel> - <bezel name="digit7" element="digit"><bounds x="8" y="0" width="4" height="6" /></bezel> - - <!-- led matrix --> - - <bezel name="lamp0" element="led"><bounds x="0" y="10" width="1" height="1" /></bezel> - <bezel name="lamp1" element="led"><bounds x="2" y="10" width="1" height="1" /></bezel> - <bezel name="lamp2" element="led"><bounds x="4" y="10" width="1" height="1" /></bezel> - <bezel name="lamp3" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel> - <bezel name="lamp4" element="led"><bounds x="8" y="10" width="1" height="1" /></bezel> - <bezel name="lamp5" element="led"><bounds x="10" y="10" width="1" height="1" /></bezel> - - <bezel name="lamp10" element="led"><bounds x="0" y="12" width="1" height="1" /></bezel> - <bezel name="lamp11" element="led"><bounds x="2" y="12" width="1" height="1" /></bezel> - <bezel name="lamp12" element="led"><bounds x="4" y="12" width="1" height="1" /></bezel> - <bezel name="lamp13" element="led"><bounds x="6" y="12" width="1" height="1" /></bezel> - <bezel name="lamp14" element="led"><bounds x="8" y="12" width="1" height="1" /></bezel> - <bezel name="lamp15" element="led"><bounds x="10" y="12" width="1" height="1" /></bezel> - - <bezel name="lamp20" element="led"><bounds x="0" y="14" width="1" height="1" /></bezel> - <bezel name="lamp21" element="led"><bounds x="2" y="14" width="1" height="1" /></bezel> - <bezel name="lamp22" element="led"><bounds x="4" y="14" width="1" height="1" /></bezel> - <bezel name="lamp23" element="led"><bounds x="6" y="14" width="1" height="1" /></bezel> - <bezel name="lamp24" element="led"><bounds x="8" y="14" width="1" height="1" /></bezel> - <bezel name="lamp25" element="led"><bounds x="10" y="14" width="1" height="1" /></bezel> - - <bezel name="lamp30" element="led"><bounds x="0" y="16" width="1" height="1" /></bezel> - <bezel name="lamp31" element="led"><bounds x="2" y="16" width="1" height="1" /></bezel> - <bezel name="lamp32" element="led"><bounds x="4" y="16" width="1" height="1" /></bezel> - <bezel name="lamp33" element="led"><bounds x="6" y="16" width="1" height="1" /></bezel> - <bezel name="lamp34" element="led"><bounds x="8" y="16" width="1" height="1" /></bezel> - <bezel name="lamp35" element="led"><bounds x="10" y="16" width="1" height="1" /></bezel> - - <bezel name="lamp40" element="led"><bounds x="0" y="18" width="1" height="1" /></bezel> - <bezel name="lamp41" element="led"><bounds x="2" y="18" width="1" height="1" /></bezel> - <bezel name="lamp42" element="led"><bounds x="4" y="18" width="1" height="1" /></bezel> - <bezel name="lamp43" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel> - <bezel name="lamp44" element="led"><bounds x="8" y="18" width="1" height="1" /></bezel> - <bezel name="lamp45" element="led"><bounds x="10" y="18" width="1" height="1" /></bezel> - - <bezel name="lamp50" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel> - <bezel name="lamp51" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel> - <bezel name="lamp52" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel> - <bezel name="lamp53" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel> - <bezel name="lamp54" element="led"><bounds x="8" y="20" width="1" height="1" /></bezel> - <bezel name="lamp55" element="led"><bounds x="10" y="20" width="1" height="1" /></bezel> - - <bezel name="lamp6" element="led"><bounds x="2" y="22" width="1" height="1" /></bezel> - <bezel name="lamp7" element="led"><bounds x="8" y="22" width="1" height="1" /></bezel> + <view name="Internal Layout"> + <bounds left="-0.1" right="20.1" top="4.6" bottom="33.1" /> + <screen index="0"> + <bounds x="0" y="10" width="20" height="23" /> + </screen> - <bezel name="lamp60" element="led"><bounds x="0" y="24" width="1" height="1" /></bezel> - <bezel name="lamp61" element="led"><bounds x="2" y="24" width="1" height="1" /></bezel> - <bezel name="lamp62" element="led"><bounds x="4" y="24" width="1" height="1" /></bezel> - <bezel name="lamp63" element="led"><bounds x="6" y="24" width="1" height="1" /></bezel> - <bezel name="lamp64" element="led"><bounds x="8" y="24" width="1" height="1" /></bezel> - <bezel name="lamp65" element="led"><bounds x="10" y="24" width="1" height="1" /></bezel> + <bezel element="static_white"><bounds x="6.6" y="4.59" width="6.8" height="3.81" /></bezel> + <bezel element="static_black"><bounds x="6.8" y="4.8" width="6.4" height="3.4" /></bezel> + <bezel element="text_score"><bounds x="2" y="5.75" width="4.6" height="1.5" /></bezel> + <bezel name="digit9" element="digit"><bounds x="7" y="5" width="2" height="3" /></bezel> + <bezel name="digit8" element="digit"><bounds x="9" y="5" width="2" height="3" /></bezel> + <bezel name="digit7" element="digit"><bounds x="11" y="5" width="2" height="3" /></bezel> </view> </mamelayout> diff --git a/src/mame/layout/einvaderc.lay b/src/mame/layout/einvaderc.lay index 0916b783796..3eb8570986e 100644 --- a/src/mame/layout/einvaderc.lay +++ b/src/mame/layout/einvaderc.lay @@ -4,82 +4,29 @@ <!-- define elements --> <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + <element name="static_white"><rect><color red="0.8" green="0.8" blue="0.8" /></rect></element> + <element name="text_score"><text string="SCORE"><color red="0.8" green="0.8" blue="0.8" /></text></element> <element name="digit" defstate="0"> - <led7seg><color red="1.0" green="0.20" blue="0.22" /></led7seg> - </element> - <element name="led" defstate="0"> - <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk> - <disk state="1"><color red="1.0" green="0.20" blue="0.22" /></disk> + <led7seg><color red="1.0" green="0.165" blue="0.165" /></led7seg> </element> <!-- build screen --> - <view name="Test Layout"> - <bounds left="0" right="12" top="0" bottom="28" /> - <bezel element="static_black"> - <bounds left="0" right="12" top="0" bottom="28" /> - </bezel> - - <bezel name="digit0" element="digit"><bounds x="0" y="0" width="4" height="6" /></bezel> - <bezel name="digit1" element="digit"><bounds x="4" y="0" width="4" height="6" /></bezel> - <bezel name="digit2" element="digit"><bounds x="8" y="0" width="4" height="6" /></bezel> - - <!-- led matrix --> - - <bezel name="lamp90" element="led"><bounds x="0" y="10" width="1" height="1" /></bezel> - <bezel name="lamp91" element="led"><bounds x="2" y="10" width="1" height="1" /></bezel> - <bezel name="lamp92" element="led"><bounds x="4" y="10" width="1" height="1" /></bezel> - <bezel name="lamp93" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel> - <bezel name="lamp94" element="led"><bounds x="8" y="10" width="1" height="1" /></bezel> - <bezel name="lamp95" element="led"><bounds x="10" y="10" width="1" height="1" /></bezel> - - <bezel name="lamp80" element="led"><bounds x="0" y="12" width="1" height="1" /></bezel> - <bezel name="lamp81" element="led"><bounds x="2" y="12" width="1" height="1" /></bezel> - <bezel name="lamp82" element="led"><bounds x="4" y="12" width="1" height="1" /></bezel> - <bezel name="lamp83" element="led"><bounds x="6" y="12" width="1" height="1" /></bezel> - <bezel name="lamp84" element="led"><bounds x="8" y="12" width="1" height="1" /></bezel> - <bezel name="lamp85" element="led"><bounds x="10" y="12" width="1" height="1" /></bezel> - - <bezel name="lamp40" element="led"><bounds x="0" y="14" width="1" height="1" /></bezel> - <bezel name="lamp41" element="led"><bounds x="2" y="14" width="1" height="1" /></bezel> - <bezel name="lamp42" element="led"><bounds x="4" y="14" width="1" height="1" /></bezel> - <bezel name="lamp43" element="led"><bounds x="6" y="14" width="1" height="1" /></bezel> - <bezel name="lamp44" element="led"><bounds x="8" y="14" width="1" height="1" /></bezel> - <bezel name="lamp45" element="led"><bounds x="10" y="14" width="1" height="1" /></bezel> - - <bezel name="lamp50" element="led"><bounds x="0" y="16" width="1" height="1" /></bezel> - <bezel name="lamp51" element="led"><bounds x="2" y="16" width="1" height="1" /></bezel> - <bezel name="lamp52" element="led"><bounds x="4" y="16" width="1" height="1" /></bezel> - <bezel name="lamp53" element="led"><bounds x="6" y="16" width="1" height="1" /></bezel> - <bezel name="lamp54" element="led"><bounds x="8" y="16" width="1" height="1" /></bezel> - <bezel name="lamp55" element="led"><bounds x="10" y="16" width="1" height="1" /></bezel> - - <bezel name="lamp60" element="led"><bounds x="0" y="18" width="1" height="1" /></bezel> - <bezel name="lamp61" element="led"><bounds x="2" y="18" width="1" height="1" /></bezel> - <bezel name="lamp62" element="led"><bounds x="4" y="18" width="1" height="1" /></bezel> - <bezel name="lamp63" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel> - <bezel name="lamp64" element="led"><bounds x="8" y="18" width="1" height="1" /></bezel> - <bezel name="lamp65" element="led"><bounds x="10" y="18" width="1" height="1" /></bezel> - - <bezel name="lamp70" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel> - <bezel name="lamp71" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel> - <bezel name="lamp72" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel> - <bezel name="lamp73" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel> - <bezel name="lamp74" element="led"><bounds x="8" y="20" width="1" height="1" /></bezel> - <bezel name="lamp75" element="led"><bounds x="10" y="20" width="1" height="1" /></bezel> - - <bezel name="lamp97" element="led"><bounds x="2" y="22" width="1" height="1" /></bezel> - <bezel name="lamp96" element="led"><bounds x="8" y="22" width="1" height="1" /></bezel> + <view name="Internal Layout"> + <bounds left="-0.1" right="20.1" top="4.6" bottom="33.76" /> + <screen index="0"> + <bounds x="0" y="10" width="20" height="23.66" /> + </screen> - <bezel name="lamp30" element="led"><bounds x="0" y="24" width="1" height="1" /></bezel> - <bezel name="lamp31" element="led"><bounds x="2" y="24" width="1" height="1" /></bezel> - <bezel name="lamp32" element="led"><bounds x="4" y="24" width="1" height="1" /></bezel> - <bezel name="lamp33" element="led"><bounds x="6" y="24" width="1" height="1" /></bezel> - <bezel name="lamp34" element="led"><bounds x="8" y="24" width="1" height="1" /></bezel> - <bezel name="lamp35" element="led"><bounds x="10" y="24" width="1" height="1" /></bezel> + <bezel element="static_white"><bounds x="6.6" y="4.59" width="6.8" height="3.81" /></bezel> + <bezel element="static_black"><bounds x="6.8" y="4.8" width="6.4" height="3.4" /></bezel> + <bezel element="text_score"><bounds x="2" y="5.75" width="4.6" height="1.5" /></bezel> + <bezel name="digit0" element="digit"><bounds x="7" y="5" width="2" height="3" /></bezel> + <bezel name="digit1" element="digit"><bounds x="9" y="5" width="2" height="3" /></bezel> + <bezel name="digit2" element="digit"><bounds x="11" y="5" width="2" height="3" /></bezel> </view> </mamelayout> diff --git a/src/mame/layout/f2pbball.lay b/src/mame/layout/f2pbball.lay new file mode 100644 index 00000000000..e62927601e1 --- /dev/null +++ b/src/mame/layout/f2pbball.lay @@ -0,0 +1,328 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + <element name="static_red"><rect><color red="0.2" green="0.04" blue="0.05" /></rect></element> + <element name="disk_red"><disk><color red="0.2" green="0.04" blue="0.05" /></disk></element> + <element name="static_green"><rect><color red="0.0" green="0.38" blue="0.15" /></rect></element> + <element name="static_white"><rect><color red="0.75" green="0.75" blue="0.75" /></rect></element> + <element name="disk_white"><disk><color red="0.75" green="0.75" blue="0.75" /></disk></element> + <element name="static_white2"><rect><color red="0.8" green="0.8" blue="0.8" /></rect></element> + + <element name="ledo" defstate="0"> + <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk> + <disk state="1"><color red="1.0" green="0.20" blue="0.22" /></disk> + </element> + <element name="led" defstate="0"> + <disk> + <bounds x="0.0" y="0.0" width="1.0" height="1.0" /> + <color red="0.2" green="0.04" blue="0.05" /> + </disk> + <disk state="1"> + <bounds x="0.25" y="0.25" width="0.5" height="0.5" /> + <color red="1.0" green="0.20" blue="0.22" /> + </disk> + </element> + + <element name="digit" defstate="0"> + <led7seg><color red="1.0" green="0.20" blue="0.22" /></led7seg> + </element> + + <element name="text_p"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="P"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_1st"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="1st"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_2nd"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="2nd"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_3rd"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="3rd"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_foul"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="FOUL"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_curve"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="CURVE"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_ball"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="BALL"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_strike"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="STRIKE"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_flyout"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="FLY OUT"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_homerun"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="HOME RUN"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_grout"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="GR. OUT"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_single"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="SINGLE"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_double"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="DOUBLE"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + <element name="text_triple"> + <rect><color red="0.0" green="0.38" blue="0.15" /></rect> + <text string="TRIPLE"><color red="0.8" green="0.8" blue="0.8" /></text> + </element> + + <element name="text_visitor"><text string="VISITOR"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_hometeam"><text string="HOME TEAM"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_balls"><text string="BALLS"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_strikes"><text string="STKS"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_atbat"><text string="ATBAT"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_outs"><text string="OUTS"><color red="0.8" green="0.8" blue="0.8" /></text></element> + <element name="text_innings"><text string="INGS"><color red="0.8" green="0.8" blue="0.8" /></text></element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="3" right="28" top="-2" bottom="33" /> + + <bezel element="static_white2"><bounds x="2" y="3.6" width="27" height="1" /></bezel> + <bezel element="static_green"><bounds x="2" y="4" width="27" height="30" /></bezel> + + <!-- score panel --> + + <bezel element="text_visitor"><bounds x="6.55" y="-1.7" width="6.4" height="1.2" /></bezel> + <bezel element="static_white"><bounds x="6.55" y="-0.5" width="6.4" height="3.65" /></bezel> + <bezel element="static_black"><bounds x="6.75" y="-0.3" width="6" height="3.25" /></bezel> + + <bezel element="text_balls"><bounds x="6.75" y="-0.3" width="2" height="0.7" /></bezel> + <bezel element="text_strikes"><bounds x="8.75" y="-0.3" width="2" height="0.7" /></bezel> + <bezel element="text_atbat"><bounds x="10.85" y="-0.3" width="2" height="0.7" /></bezel> + + <bezel name="digit8" element="digit"><bounds x="7" y="0.5" width="1.5" height="2.25" /></bezel> + <bezel name="digit7" element="digit"><bounds x="9" y="0.5" width="1.5" height="2.25" /></bezel> + <bezel name="8.7" element="ledo"><bounds x="11.5" y="1.4" width="0.5" height="0.5" /></bezel> + + <bezel element="static_white"><bounds x="8.65" y="-0.4" width="0.2" height="3.45" /></bezel> + <bezel element="static_white"><bounds x="10.65" y="-0.4" width="0.2" height="3.45" /></bezel> + + <bezel element="text_hometeam"><bounds x="18" y="-1.7" width="6.4" height="1.2" /></bezel> + <bezel element="static_white"><bounds x="18" y="-0.5" width="6.4" height="3.65" /></bezel> + <bezel element="static_black"><bounds x="18.2" y="-0.3" width="6" height="3.25" /></bezel> + + <bezel element="text_atbat"><bounds x="18.2" y="-0.3" width="2" height="0.7" /></bezel> + <bezel element="text_outs"><bounds x="20.2" y="-0.3" width="2" height="0.7" /></bezel> + <bezel element="text_innings"><bounds x="22.2" y="-0.3" width="2" height="0.7" /></bezel> + + + <bezel name="6.7" element="ledo"><bounds x="18.95" y="1.4" width="0.5" height="0.5" /></bezel> + <bezel name="digit6" element="digit"><bounds x="20.45" y="0.5" width="1.5" height="2.25" /></bezel> + <bezel name="digit5" element="digit"><bounds x="22.45" y="0.5" width="1.5" height="2.25" /></bezel> + + <bezel element="static_white"><bounds x="20.1" y="-0.4" width="0.2" height="3.45" /></bezel> + <bezel element="static_white"><bounds x="22.1" y="-0.4" width="0.2" height="3.45" /></bezel> + + <!-- upper part --> + + <bezel element="text_flyout"><bounds x="4.5" y="8.1" width="4" height="0.7" /></bezel> + <bezel element="text_homerun"><bounds x="7.5" y="7.1" width="4" height="0.7" /></bezel> + <bezel element="text_grout"><bounds x="10.5" y="6.1" width="4" height="0.7" /></bezel> + <bezel element="text_triple"><bounds x="4.5" y="11.1" width="4" height="0.7" /></bezel> + <bezel element="text_grout"><bounds x="7.5" y="10.1" width="4" height="0.7" /></bezel> + <bezel element="text_single"><bounds x="10.5" y="9.1" width="4" height="0.7" /></bezel> + + <bezel element="text_flyout"><bounds x="16.5" y="6.1" width="4" height="0.7" /></bezel> + <bezel element="text_flyout"><bounds x="19.5" y="7.1" width="4" height="0.7" /></bezel> + <bezel element="text_double"><bounds x="22.5" y="8.1" width="4" height="0.7" /></bezel> + <bezel element="text_single"><bounds x="16.5" y="9.1" width="4" height="0.7" /></bezel> + <bezel element="text_single"><bounds x="19.5" y="10.1" width="4" height="0.7" /></bezel> + <bezel element="text_grout"><bounds x="22.5" y="11.1" width="4" height="0.7" /></bezel> + + <bezel name="0.3" element="led"><bounds x="6" y="7" width="1" height="1" /></bezel> + <bezel name="3.2" element="led"><bounds x="9" y="6" width="1" height="1" /></bezel> + <bezel name="2.3" element="led"><bounds x="12" y="5" width="1" height="1" /></bezel> + <bezel name="1.2" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel> + <bezel name="2.2" element="led"><bounds x="9" y="9" width="1" height="1" /></bezel> + <bezel name="1.3" element="led"><bounds x="12" y="8" width="1" height="1" /></bezel> + + <bezel name="0.4" element="led"><bounds x="18" y="5" width="1" height="1" /></bezel> + <bezel name="0.5" element="led"><bounds x="21" y="6" width="1" height="1" /></bezel> + <bezel name="3.4" element="led"><bounds x="24" y="7" width="1" height="1" /></bezel> + <bezel name="1.4" element="led"><bounds x="18" y="8" width="1" height="1" /></bezel> + <bezel name="3.3" element="led"><bounds x="21" y="9" width="1" height="1" /></bezel> + <bezel name="2.4" element="led"><bounds x="24" y="10" width="1" height="1" /></bezel> + + <!-- field labels --> + + <bezel element="text_p"><bounds x="14" y="13.2" width="3" height="1.2" /></bezel> + <bezel element="text_2nd"><bounds x="14" y="7" width="3" height="1.2" /></bezel> + <bezel element="text_3rd"><bounds x="2.9" y="17.9" width="3" height="1.2" /></bezel> + <bezel element="text_1st"><bounds x="25.1" y="17.9" width="3" height="1.2" /></bezel> + <bezel element="text_strike"><bounds x="13" y="31.2" width="5" height="1.2" /></bezel> + + <bezel element="text_foul"><bounds x="6.8" y="24" width="2.2" height="1" /></bezel> + <bezel element="text_foul"><bounds x="22.1" y="24" width="2.2" height="1" /></bezel> + + <bezel element="text_curve"><bounds x="8.8" y="27" width="3" height="1" /></bezel> + <bezel element="text_ball"><bounds x="9.2" y="30" width="3" height="1" /></bezel> + <bezel element="text_curve"><bounds x="19.3" y="27" width="3" height="1" /></bezel> + <bezel element="text_ball"><bounds x="18.9" y="30" width="3" height="1" /></bezel> + + <bezel element="static_white"><bounds x="11.8" y="26.8" width="1.4" height="4.4" /></bezel> + <bezel element="static_green"><bounds x="12" y="27" width="1" height="4" /></bezel> + <bezel element="static_white"><bounds x="17.8" y="26.8" width="1.4" height="4.4" /></bezel> + <bezel element="static_green"><bounds x="18" y="27" width="1" height="4" /></bezel> + + <bezel element="disk_red"><bounds x="14.5" y="8.5" width="2" height="2" /></bezel> + <bezel element="disk_red"><bounds x="5.5" y="17.5" width="2" height="2" /></bezel> + <bezel element="disk_red"><bounds x="23.5" y="17.5" width="2" height="2" /></bezel> + + <bezel element="disk_red"><bounds x="14.5" y="14.5" width="2" height="2" /></bezel> + <bezel element="static_red"><bounds x="14.99" y="15.5" width="1.02" height="12" /></bezel> + + <bezel element="static_white"><bounds x="14.5" y="26.5" width="2" height="2.5" /></bezel> + <bezel element="static_red"><bounds x="14.7" y="26.7" width="1.6" height="2.1" /></bezel> + + <!-- diamond city --> + + <bezel element="disk_white"><bounds x="5.9" y="17.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="6.4" y="17.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="6.9" y="16.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="7.4" y="16.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="7.9" y="15.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="8.4" y="15.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="8.9" y="14.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="9.4" y="14.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="9.9" y="13.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="10.4" y="13.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="10.9" y="12.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="11.4" y="12.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="11.9" y="11.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="12.4" y="11.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="12.9" y="10.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="13.4" y="10.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="13.9" y="9.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="14.4" y="9.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="14.9" y="8.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="15.4" y="8.4" width="0.2" height="0.2" /></bezel> + + <bezel element="disk_white"><bounds x="15.9" y="8.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="16.4" y="9.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="16.9" y="9.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="17.4" y="10.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="17.9" y="10.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="18.4" y="11.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="18.9" y="11.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="19.4" y="12.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="19.9" y="12.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="20.4" y="13.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="20.9" y="13.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="21.4" y="14.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="21.9" y="14.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="22.4" y="15.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="22.9" y="15.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="23.4" y="16.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="23.9" y="16.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="24.4" y="17.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="24.9" y="17.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="25.4" y="18.4" width="0.2" height="0.2" /></bezel> + + <bezel element="disk_white"><bounds x="24.9" y="18.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="24.4" y="19.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="23.9" y="19.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="23.4" y="20.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="22.9" y="20.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="22.4" y="21.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="21.9" y="21.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="21.4" y="22.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="20.9" y="22.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="20.4" y="23.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="19.9" y="23.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="19.4" y="24.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="18.9" y="24.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="18.4" y="25.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="17.9" y="25.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="17.4" y="26.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="16.9" y="26.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="16.4" y="27.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="15.9" y="27.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="15.4" y="28.4" width="0.2" height="0.2" /></bezel> + + <bezel element="disk_white"><bounds x="14.9" y="27.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="14.4" y="27.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="13.9" y="26.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="13.4" y="26.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="12.9" y="25.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="12.4" y="25.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="11.9" y="24.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="11.4" y="24.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="10.9" y="23.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="10.4" y="23.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="9.9" y="22.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="9.4" y="22.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="8.9" y="21.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="8.4" y="21.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="7.9" y="20.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="7.4" y="20.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="6.9" y="19.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="6.4" y="19.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="5.9" y="18.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="5.4" y="18.4" width="0.2" height="0.2" /></bezel> + + <bezel element="disk_white"><bounds x="4.9" y="17.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="4.4" y="17.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="3.9" y="16.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="3.4" y="16.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="2.9" y="15.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="2.4" y="15.4" width="0.2" height="0.2" /></bezel> + + <bezel element="disk_white"><bounds x="28.4" y="15.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="27.9" y="15.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="27.4" y="16.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="26.9" y="16.9" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="26.4" y="17.4" width="0.2" height="0.2" /></bezel> + <bezel element="disk_white"><bounds x="25.9" y="17.9" width="0.2" height="0.2" /></bezel> + + <!-- field leds --> + + <bezel name="1.7" element="led"><bounds x="15" y="9" width="1" height="1" /></bezel> + <bezel name="1.0" element="led"><bounds x="12" y="12" width="1" height="1" /></bezel> + <bezel name="2.1" element="led"><bounds x="18" y="12" width="1" height="1" /></bezel> + <bezel name="1.1" element="led"><bounds x="9" y="15" width="1" height="1" /></bezel> + <bezel name="4.7" element="led"><bounds x="15" y="15" width="1" height="1" /></bezel> + <bezel name="2.0" element="led"><bounds x="21" y="15" width="1" height="1" /></bezel> + <bezel name="0.7" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel> + <bezel name="4.0" element="led"><bounds x="15" y="18" width="1" height="1" /></bezel> + <bezel name="2.7" element="led"><bounds x="24" y="18" width="1" height="1" /></bezel> + <bezel name="0.0" element="led"><bounds x="9" y="21" width="1" height="1" /></bezel> + <bezel name="4.1" element="led"><bounds x="15" y="21" width="1" height="1" /></bezel> + <bezel name="3.1" element="led"><bounds x="21" y="21" width="1" height="1" /></bezel> + <bezel name="0.2" element="led"><bounds x="9" y="24" width="1" height="1" /></bezel> + <bezel name="0.1" element="led"><bounds x="12" y="24" width="1" height="1" /></bezel> + <bezel name="4.2" element="led"><bounds x="15" y="24" width="1" height="1" /></bezel> + <bezel name="3.0" element="led"><bounds x="18" y="24" width="1" height="1" /></bezel> + <bezel name="1.5" element="led"><bounds x="21" y="24" width="1" height="1" /></bezel> + <bezel name="4.4" element="led"><bounds x="12" y="27" width="1" height="1" /></bezel> + <bezel name="3.7" element="led"><bounds x="15" y="27" width="1" height="1" /></bezel> + <bezel name="4.3" element="led"><bounds x="18" y="27" width="1" height="1" /></bezel> + <bezel name="4.6" element="led"><bounds x="12" y="30" width="1" height="1" /></bezel> + <bezel name="3.5" element="led"><bounds x="15" y="30" width="1" height="1" /></bezel> + <bezel name="4.5" element="led"><bounds x="18" y="30" width="1" height="1" /></bezel> + + </view> +</mamelayout> diff --git a/src/mame/layout/hh_cop400_test.lay b/src/mame/layout/hh_cop400_test.lay new file mode 100644 index 00000000000..691c91e1aa1 --- /dev/null +++ b/src/mame/layout/hh_cop400_test.lay @@ -0,0 +1,556 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + + <element name="led" defstate="2"> + <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk> + <disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk> + + <disk state="2"><color red="0" green="0" blue="0" /></disk> + </element> + + +<!-- build screen --> + + <view name="Test Layout"> + <bounds left="0" right="64" top="0" bottom="64" /> + <bezel element="static_black"> + <bounds left="0" right="64" top="0" bottom="64" /> + </bezel> + + <!-- max 16*32 matrix --> + + <bezel name="0.0" element="led"><bounds x="0" y="0" width="1" height="1" /></bezel> + <bezel name="0.1" element="led"><bounds x="0" y="2" width="1" height="1" /></bezel> + <bezel name="0.2" element="led"><bounds x="0" y="4" width="1" height="1" /></bezel> + <bezel name="0.3" element="led"><bounds x="0" y="6" width="1" height="1" /></bezel> + <bezel name="0.4" element="led"><bounds x="0" y="8" width="1" height="1" /></bezel> + <bezel name="0.5" element="led"><bounds x="0" y="10" width="1" height="1" /></bezel> + <bezel name="0.6" element="led"><bounds x="0" y="12" width="1" height="1" /></bezel> + <bezel name="0.7" element="led"><bounds x="0" y="14" width="1" height="1" /></bezel> + <bezel name="0.8" element="led"><bounds x="0" y="16" width="1" height="1" /></bezel> + <bezel name="0.9" element="led"><bounds x="0" y="18" width="1" height="1" /></bezel> + <bezel name="0.10" element="led"><bounds x="0" y="20" width="1" height="1" /></bezel> + <bezel name="0.11" element="led"><bounds x="0" y="22" width="1" height="1" /></bezel> + <bezel name="0.12" element="led"><bounds x="0" y="24" width="1" height="1" /></bezel> + <bezel name="0.13" element="led"><bounds x="0" y="26" width="1" height="1" /></bezel> + <bezel name="0.14" element="led"><bounds x="0" y="28" width="1" height="1" /></bezel> + <bezel name="0.15" element="led"><bounds x="0" y="30" width="1" height="1" /></bezel> + <bezel name="0.16" element="led"><bounds x="0" y="32" width="1" height="1" /></bezel> + <bezel name="0.17" element="led"><bounds x="0" y="34" width="1" height="1" /></bezel> + <bezel name="0.18" element="led"><bounds x="0" y="36" width="1" height="1" /></bezel> + <bezel name="0.19" element="led"><bounds x="0" y="38" width="1" height="1" /></bezel> + <bezel name="0.20" element="led"><bounds x="0" y="40" width="1" height="1" /></bezel> + <bezel name="0.21" element="led"><bounds x="0" y="42" width="1" height="1" /></bezel> + <bezel name="0.22" element="led"><bounds x="0" y="44" width="1" height="1" /></bezel> + <bezel name="0.23" element="led"><bounds x="0" y="46" width="1" height="1" /></bezel> + <bezel name="0.24" element="led"><bounds x="0" y="48" width="1" height="1" /></bezel> + <bezel name="0.25" element="led"><bounds x="0" y="50" width="1" height="1" /></bezel> + <bezel name="0.26" element="led"><bounds x="0" y="52" width="1" height="1" /></bezel> + <bezel name="0.27" element="led"><bounds x="0" y="54" width="1" height="1" /></bezel> + <bezel name="0.28" element="led"><bounds x="0" y="56" width="1" height="1" /></bezel> + <bezel name="0.29" element="led"><bounds x="0" y="58" width="1" height="1" /></bezel> + <bezel name="0.30" element="led"><bounds x="0" y="60" width="1" height="1" /></bezel> + <bezel name="0.31" element="led"><bounds x="0" y="62" width="1" height="1" /></bezel> + + <bezel name="1.0" element="led"><bounds x="2" y="0" width="1" height="1" /></bezel> + <bezel name="1.1" element="led"><bounds x="2" y="2" width="1" height="1" /></bezel> + <bezel name="1.2" element="led"><bounds x="2" y="4" width="1" height="1" /></bezel> + <bezel name="1.3" element="led"><bounds x="2" y="6" width="1" height="1" /></bezel> + <bezel name="1.4" element="led"><bounds x="2" y="8" width="1" height="1" /></bezel> + <bezel name="1.5" element="led"><bounds x="2" y="10" width="1" height="1" /></bezel> + <bezel name="1.6" element="led"><bounds x="2" y="12" width="1" height="1" /></bezel> + <bezel name="1.7" element="led"><bounds x="2" y="14" width="1" height="1" /></bezel> + <bezel name="1.8" element="led"><bounds x="2" y="16" width="1" height="1" /></bezel> + <bezel name="1.9" element="led"><bounds x="2" y="18" width="1" height="1" /></bezel> + <bezel name="1.10" element="led"><bounds x="2" y="20" width="1" height="1" /></bezel> + <bezel name="1.11" element="led"><bounds x="2" y="22" width="1" height="1" /></bezel> + <bezel name="1.12" element="led"><bounds x="2" y="24" width="1" height="1" /></bezel> + <bezel name="1.13" element="led"><bounds x="2" y="26" width="1" height="1" /></bezel> + <bezel name="1.14" element="led"><bounds x="2" y="28" width="1" height="1" /></bezel> + <bezel name="1.15" element="led"><bounds x="2" y="30" width="1" height="1" /></bezel> + <bezel name="1.16" element="led"><bounds x="2" y="32" width="1" height="1" /></bezel> + <bezel name="1.17" element="led"><bounds x="2" y="34" width="1" height="1" /></bezel> + <bezel name="1.18" element="led"><bounds x="2" y="36" width="1" height="1" /></bezel> + <bezel name="1.19" element="led"><bounds x="2" y="38" width="1" height="1" /></bezel> + <bezel name="1.20" element="led"><bounds x="2" y="40" width="1" height="1" /></bezel> + <bezel name="1.21" element="led"><bounds x="2" y="42" width="1" height="1" /></bezel> + <bezel name="1.22" element="led"><bounds x="2" y="44" width="1" height="1" /></bezel> + <bezel name="1.23" element="led"><bounds x="2" y="46" width="1" height="1" /></bezel> + <bezel name="1.24" element="led"><bounds x="2" y="48" width="1" height="1" /></bezel> + <bezel name="1.25" element="led"><bounds x="2" y="50" width="1" height="1" /></bezel> + <bezel name="1.26" element="led"><bounds x="2" y="52" width="1" height="1" /></bezel> + <bezel name="1.27" element="led"><bounds x="2" y="54" width="1" height="1" /></bezel> + <bezel name="1.28" element="led"><bounds x="2" y="56" width="1" height="1" /></bezel> + <bezel name="1.29" element="led"><bounds x="2" y="58" width="1" height="1" /></bezel> + <bezel name="1.30" element="led"><bounds x="2" y="60" width="1" height="1" /></bezel> + <bezel name="1.31" element="led"><bounds x="2" y="62" width="1" height="1" /></bezel> + + <bezel name="2.0" element="led"><bounds x="4" y="0" width="1" height="1" /></bezel> + <bezel name="2.1" element="led"><bounds x="4" y="2" width="1" height="1" /></bezel> + <bezel name="2.2" element="led"><bounds x="4" y="4" width="1" height="1" /></bezel> + <bezel name="2.3" element="led"><bounds x="4" y="6" width="1" height="1" /></bezel> + <bezel name="2.4" element="led"><bounds x="4" y="8" width="1" height="1" /></bezel> + <bezel name="2.5" element="led"><bounds x="4" y="10" width="1" height="1" /></bezel> + <bezel name="2.6" element="led"><bounds x="4" y="12" width="1" height="1" /></bezel> + <bezel name="2.7" element="led"><bounds x="4" y="14" width="1" height="1" /></bezel> + <bezel name="2.8" element="led"><bounds x="4" y="16" width="1" height="1" /></bezel> + <bezel name="2.9" element="led"><bounds x="4" y="18" width="1" height="1" /></bezel> + <bezel name="2.10" element="led"><bounds x="4" y="20" width="1" height="1" /></bezel> + <bezel name="2.11" element="led"><bounds x="4" y="22" width="1" height="1" /></bezel> + <bezel name="2.12" element="led"><bounds x="4" y="24" width="1" height="1" /></bezel> + <bezel name="2.13" element="led"><bounds x="4" y="26" width="1" height="1" /></bezel> + <bezel name="2.14" element="led"><bounds x="4" y="28" width="1" height="1" /></bezel> + <bezel name="2.15" element="led"><bounds x="4" y="30" width="1" height="1" /></bezel> + <bezel name="2.16" element="led"><bounds x="4" y="32" width="1" height="1" /></bezel> + <bezel name="2.17" element="led"><bounds x="4" y="34" width="1" height="1" /></bezel> + <bezel name="2.18" element="led"><bounds x="4" y="36" width="1" height="1" /></bezel> + <bezel name="2.19" element="led"><bounds x="4" y="38" width="1" height="1" /></bezel> + <bezel name="2.20" element="led"><bounds x="4" y="40" width="1" height="1" /></bezel> + <bezel name="2.21" element="led"><bounds x="4" y="42" width="1" height="1" /></bezel> + <bezel name="2.22" element="led"><bounds x="4" y="44" width="1" height="1" /></bezel> + <bezel name="2.23" element="led"><bounds x="4" y="46" width="1" height="1" /></bezel> + <bezel name="2.24" element="led"><bounds x="4" y="48" width="1" height="1" /></bezel> + <bezel name="2.25" element="led"><bounds x="4" y="50" width="1" height="1" /></bezel> + <bezel name="2.26" element="led"><bounds x="4" y="52" width="1" height="1" /></bezel> + <bezel name="2.27" element="led"><bounds x="4" y="54" width="1" height="1" /></bezel> + <bezel name="2.28" element="led"><bounds x="4" y="56" width="1" height="1" /></bezel> + <bezel name="2.29" element="led"><bounds x="4" y="58" width="1" height="1" /></bezel> + <bezel name="2.30" element="led"><bounds x="4" y="60" width="1" height="1" /></bezel> + <bezel name="2.31" element="led"><bounds x="4" y="62" width="1" height="1" /></bezel> + + <bezel name="3.0" element="led"><bounds x="6" y="0" width="1" height="1" /></bezel> + <bezel name="3.1" element="led"><bounds x="6" y="2" width="1" height="1" /></bezel> + <bezel name="3.2" element="led"><bounds x="6" y="4" width="1" height="1" /></bezel> + <bezel name="3.3" element="led"><bounds x="6" y="6" width="1" height="1" /></bezel> + <bezel name="3.4" element="led"><bounds x="6" y="8" width="1" height="1" /></bezel> + <bezel name="3.5" element="led"><bounds x="6" y="10" width="1" height="1" /></bezel> + <bezel name="3.6" element="led"><bounds x="6" y="12" width="1" height="1" /></bezel> + <bezel name="3.7" element="led"><bounds x="6" y="14" width="1" height="1" /></bezel> + <bezel name="3.8" element="led"><bounds x="6" y="16" width="1" height="1" /></bezel> + <bezel name="3.9" element="led"><bounds x="6" y="18" width="1" height="1" /></bezel> + <bezel name="3.10" element="led"><bounds x="6" y="20" width="1" height="1" /></bezel> + <bezel name="3.11" element="led"><bounds x="6" y="22" width="1" height="1" /></bezel> + <bezel name="3.12" element="led"><bounds x="6" y="24" width="1" height="1" /></bezel> + <bezel name="3.13" element="led"><bounds x="6" y="26" width="1" height="1" /></bezel> + <bezel name="3.14" element="led"><bounds x="6" y="28" width="1" height="1" /></bezel> + <bezel name="3.15" element="led"><bounds x="6" y="30" width="1" height="1" /></bezel> + <bezel name="3.16" element="led"><bounds x="6" y="32" width="1" height="1" /></bezel> + <bezel name="3.17" element="led"><bounds x="6" y="34" width="1" height="1" /></bezel> + <bezel name="3.18" element="led"><bounds x="6" y="36" width="1" height="1" /></bezel> + <bezel name="3.19" element="led"><bounds x="6" y="38" width="1" height="1" /></bezel> + <bezel name="3.20" element="led"><bounds x="6" y="40" width="1" height="1" /></bezel> + <bezel name="3.21" element="led"><bounds x="6" y="42" width="1" height="1" /></bezel> + <bezel name="3.22" element="led"><bounds x="6" y="44" width="1" height="1" /></bezel> + <bezel name="3.23" element="led"><bounds x="6" y="46" width="1" height="1" /></bezel> + <bezel name="3.24" element="led"><bounds x="6" y="48" width="1" height="1" /></bezel> + <bezel name="3.25" element="led"><bounds x="6" y="50" width="1" height="1" /></bezel> + <bezel name="3.26" element="led"><bounds x="6" y="52" width="1" height="1" /></bezel> + <bezel name="3.27" element="led"><bounds x="6" y="54" width="1" height="1" /></bezel> + <bezel name="3.28" element="led"><bounds x="6" y="56" width="1" height="1" /></bezel> + <bezel name="3.29" element="led"><bounds x="6" y="58" width="1" height="1" /></bezel> + <bezel name="3.30" element="led"><bounds x="6" y="60" width="1" height="1" /></bezel> + <bezel name="3.31" element="led"><bounds x="6" y="62" width="1" height="1" /></bezel> + + <bezel name="4.0" element="led"><bounds x="8" y="0" width="1" height="1" /></bezel> + <bezel name="4.1" element="led"><bounds x="8" y="2" width="1" height="1" /></bezel> + <bezel name="4.2" element="led"><bounds x="8" y="4" width="1" height="1" /></bezel> + <bezel name="4.3" element="led"><bounds x="8" y="6" width="1" height="1" /></bezel> + <bezel name="4.4" element="led"><bounds x="8" y="8" width="1" height="1" /></bezel> + <bezel name="4.5" element="led"><bounds x="8" y="10" width="1" height="1" /></bezel> + <bezel name="4.6" element="led"><bounds x="8" y="12" width="1" height="1" /></bezel> + <bezel name="4.7" element="led"><bounds x="8" y="14" width="1" height="1" /></bezel> + <bezel name="4.8" element="led"><bounds x="8" y="16" width="1" height="1" /></bezel> + <bezel name="4.9" element="led"><bounds x="8" y="18" width="1" height="1" /></bezel> + <bezel name="4.10" element="led"><bounds x="8" y="20" width="1" height="1" /></bezel> + <bezel name="4.11" element="led"><bounds x="8" y="22" width="1" height="1" /></bezel> + <bezel name="4.12" element="led"><bounds x="8" y="24" width="1" height="1" /></bezel> + <bezel name="4.13" element="led"><bounds x="8" y="26" width="1" height="1" /></bezel> + <bezel name="4.14" element="led"><bounds x="8" y="28" width="1" height="1" /></bezel> + <bezel name="4.15" element="led"><bounds x="8" y="30" width="1" height="1" /></bezel> + <bezel name="4.16" element="led"><bounds x="8" y="32" width="1" height="1" /></bezel> + <bezel name="4.17" element="led"><bounds x="8" y="34" width="1" height="1" /></bezel> + <bezel name="4.18" element="led"><bounds x="8" y="36" width="1" height="1" /></bezel> + <bezel name="4.19" element="led"><bounds x="8" y="38" width="1" height="1" /></bezel> + <bezel name="4.20" element="led"><bounds x="8" y="40" width="1" height="1" /></bezel> + <bezel name="4.21" element="led"><bounds x="8" y="42" width="1" height="1" /></bezel> + <bezel name="4.22" element="led"><bounds x="8" y="44" width="1" height="1" /></bezel> + <bezel name="4.23" element="led"><bounds x="8" y="46" width="1" height="1" /></bezel> + <bezel name="4.24" element="led"><bounds x="8" y="48" width="1" height="1" /></bezel> + <bezel name="4.25" element="led"><bounds x="8" y="50" width="1" height="1" /></bezel> + <bezel name="4.26" element="led"><bounds x="8" y="52" width="1" height="1" /></bezel> + <bezel name="4.27" element="led"><bounds x="8" y="54" width="1" height="1" /></bezel> + <bezel name="4.28" element="led"><bounds x="8" y="56" width="1" height="1" /></bezel> + <bezel name="4.29" element="led"><bounds x="8" y="58" width="1" height="1" /></bezel> + <bezel name="4.30" element="led"><bounds x="8" y="60" width="1" height="1" /></bezel> + <bezel name="4.31" element="led"><bounds x="8" y="62" width="1" height="1" /></bezel> + + <bezel name="5.0" element="led"><bounds x="10" y="0" width="1" height="1" /></bezel> + <bezel name="5.1" element="led"><bounds x="10" y="2" width="1" height="1" /></bezel> + <bezel name="5.2" element="led"><bounds x="10" y="4" width="1" height="1" /></bezel> + <bezel name="5.3" element="led"><bounds x="10" y="6" width="1" height="1" /></bezel> + <bezel name="5.4" element="led"><bounds x="10" y="8" width="1" height="1" /></bezel> + <bezel name="5.5" element="led"><bounds x="10" y="10" width="1" height="1" /></bezel> + <bezel name="5.6" element="led"><bounds x="10" y="12" width="1" height="1" /></bezel> + <bezel name="5.7" element="led"><bounds x="10" y="14" width="1" height="1" /></bezel> + <bezel name="5.8" element="led"><bounds x="10" y="16" width="1" height="1" /></bezel> + <bezel name="5.9" element="led"><bounds x="10" y="18" width="1" height="1" /></bezel> + <bezel name="5.10" element="led"><bounds x="10" y="20" width="1" height="1" /></bezel> + <bezel name="5.11" element="led"><bounds x="10" y="22" width="1" height="1" /></bezel> + <bezel name="5.12" element="led"><bounds x="10" y="24" width="1" height="1" /></bezel> + <bezel name="5.13" element="led"><bounds x="10" y="26" width="1" height="1" /></bezel> + <bezel name="5.14" element="led"><bounds x="10" y="28" width="1" height="1" /></bezel> + <bezel name="5.15" element="led"><bounds x="10" y="30" width="1" height="1" /></bezel> + <bezel name="5.16" element="led"><bounds x="10" y="32" width="1" height="1" /></bezel> + <bezel name="5.17" element="led"><bounds x="10" y="34" width="1" height="1" /></bezel> + <bezel name="5.18" element="led"><bounds x="10" y="36" width="1" height="1" /></bezel> + <bezel name="5.19" element="led"><bounds x="10" y="38" width="1" height="1" /></bezel> + <bezel name="5.20" element="led"><bounds x="10" y="40" width="1" height="1" /></bezel> + <bezel name="5.21" element="led"><bounds x="10" y="42" width="1" height="1" /></bezel> + <bezel name="5.22" element="led"><bounds x="10" y="44" width="1" height="1" /></bezel> + <bezel name="5.23" element="led"><bounds x="10" y="46" width="1" height="1" /></bezel> + <bezel name="5.24" element="led"><bounds x="10" y="48" width="1" height="1" /></bezel> + <bezel name="5.25" element="led"><bounds x="10" y="50" width="1" height="1" /></bezel> + <bezel name="5.26" element="led"><bounds x="10" y="52" width="1" height="1" /></bezel> + <bezel name="5.27" element="led"><bounds x="10" y="54" width="1" height="1" /></bezel> + <bezel name="5.28" element="led"><bounds x="10" y="56" width="1" height="1" /></bezel> + <bezel name="5.29" element="led"><bounds x="10" y="58" width="1" height="1" /></bezel> + <bezel name="5.30" element="led"><bounds x="10" y="60" width="1" height="1" /></bezel> + <bezel name="5.31" element="led"><bounds x="10" y="62" width="1" height="1" /></bezel> + + <bezel name="6.0" element="led"><bounds x="12" y="0" width="1" height="1" /></bezel> + <bezel name="6.1" element="led"><bounds x="12" y="2" width="1" height="1" /></bezel> + <bezel name="6.2" element="led"><bounds x="12" y="4" width="1" height="1" /></bezel> + <bezel name="6.3" element="led"><bounds x="12" y="6" width="1" height="1" /></bezel> + <bezel name="6.4" element="led"><bounds x="12" y="8" width="1" height="1" /></bezel> + <bezel name="6.5" element="led"><bounds x="12" y="10" width="1" height="1" /></bezel> + <bezel name="6.6" element="led"><bounds x="12" y="12" width="1" height="1" /></bezel> + <bezel name="6.7" element="led"><bounds x="12" y="14" width="1" height="1" /></bezel> + <bezel name="6.8" element="led"><bounds x="12" y="16" width="1" height="1" /></bezel> + <bezel name="6.9" element="led"><bounds x="12" y="18" width="1" height="1" /></bezel> + <bezel name="6.10" element="led"><bounds x="12" y="20" width="1" height="1" /></bezel> + <bezel name="6.11" element="led"><bounds x="12" y="22" width="1" height="1" /></bezel> + <bezel name="6.12" element="led"><bounds x="12" y="24" width="1" height="1" /></bezel> + <bezel name="6.13" element="led"><bounds x="12" y="26" width="1" height="1" /></bezel> + <bezel name="6.14" element="led"><bounds x="12" y="28" width="1" height="1" /></bezel> + <bezel name="6.15" element="led"><bounds x="12" y="30" width="1" height="1" /></bezel> + <bezel name="6.16" element="led"><bounds x="12" y="32" width="1" height="1" /></bezel> + <bezel name="6.17" element="led"><bounds x="12" y="34" width="1" height="1" /></bezel> + <bezel name="6.18" element="led"><bounds x="12" y="36" width="1" height="1" /></bezel> + <bezel name="6.19" element="led"><bounds x="12" y="38" width="1" height="1" /></bezel> + <bezel name="6.20" element="led"><bounds x="12" y="40" width="1" height="1" /></bezel> + <bezel name="6.21" element="led"><bounds x="12" y="42" width="1" height="1" /></bezel> + <bezel name="6.22" element="led"><bounds x="12" y="44" width="1" height="1" /></bezel> + <bezel name="6.23" element="led"><bounds x="12" y="46" width="1" height="1" /></bezel> + <bezel name="6.24" element="led"><bounds x="12" y="48" width="1" height="1" /></bezel> + <bezel name="6.25" element="led"><bounds x="12" y="50" width="1" height="1" /></bezel> + <bezel name="6.26" element="led"><bounds x="12" y="52" width="1" height="1" /></bezel> + <bezel name="6.27" element="led"><bounds x="12" y="54" width="1" height="1" /></bezel> + <bezel name="6.28" element="led"><bounds x="12" y="56" width="1" height="1" /></bezel> + <bezel name="6.29" element="led"><bounds x="12" y="58" width="1" height="1" /></bezel> + <bezel name="6.30" element="led"><bounds x="12" y="60" width="1" height="1" /></bezel> + <bezel name="6.31" element="led"><bounds x="12" y="62" width="1" height="1" /></bezel> + + <bezel name="7.0" element="led"><bounds x="14" y="0" width="1" height="1" /></bezel> + <bezel name="7.1" element="led"><bounds x="14" y="2" width="1" height="1" /></bezel> + <bezel name="7.2" element="led"><bounds x="14" y="4" width="1" height="1" /></bezel> + <bezel name="7.3" element="led"><bounds x="14" y="6" width="1" height="1" /></bezel> + <bezel name="7.4" element="led"><bounds x="14" y="8" width="1" height="1" /></bezel> + <bezel name="7.5" element="led"><bounds x="14" y="10" width="1" height="1" /></bezel> + <bezel name="7.6" element="led"><bounds x="14" y="12" width="1" height="1" /></bezel> + <bezel name="7.7" element="led"><bounds x="14" y="14" width="1" height="1" /></bezel> + <bezel name="7.8" element="led"><bounds x="14" y="16" width="1" height="1" /></bezel> + <bezel name="7.9" element="led"><bounds x="14" y="18" width="1" height="1" /></bezel> + <bezel name="7.10" element="led"><bounds x="14" y="20" width="1" height="1" /></bezel> + <bezel name="7.11" element="led"><bounds x="14" y="22" width="1" height="1" /></bezel> + <bezel name="7.12" element="led"><bounds x="14" y="24" width="1" height="1" /></bezel> + <bezel name="7.13" element="led"><bounds x="14" y="26" width="1" height="1" /></bezel> + <bezel name="7.14" element="led"><bounds x="14" y="28" width="1" height="1" /></bezel> + <bezel name="7.15" element="led"><bounds x="14" y="30" width="1" height="1" /></bezel> + <bezel name="7.16" element="led"><bounds x="14" y="32" width="1" height="1" /></bezel> + <bezel name="7.17" element="led"><bounds x="14" y="34" width="1" height="1" /></bezel> + <bezel name="7.18" element="led"><bounds x="14" y="36" width="1" height="1" /></bezel> + <bezel name="7.19" element="led"><bounds x="14" y="38" width="1" height="1" /></bezel> + <bezel name="7.20" element="led"><bounds x="14" y="40" width="1" height="1" /></bezel> + <bezel name="7.21" element="led"><bounds x="14" y="42" width="1" height="1" /></bezel> + <bezel name="7.22" element="led"><bounds x="14" y="44" width="1" height="1" /></bezel> + <bezel name="7.23" element="led"><bounds x="14" y="46" width="1" height="1" /></bezel> + <bezel name="7.24" element="led"><bounds x="14" y="48" width="1" height="1" /></bezel> + <bezel name="7.25" element="led"><bounds x="14" y="50" width="1" height="1" /></bezel> + <bezel name="7.26" element="led"><bounds x="14" y="52" width="1" height="1" /></bezel> + <bezel name="7.27" element="led"><bounds x="14" y="54" width="1" height="1" /></bezel> + <bezel name="7.28" element="led"><bounds x="14" y="56" width="1" height="1" /></bezel> + <bezel name="7.29" element="led"><bounds x="14" y="58" width="1" height="1" /></bezel> + <bezel name="7.30" element="led"><bounds x="14" y="60" width="1" height="1" /></bezel> + <bezel name="7.31" element="led"><bounds x="14" y="62" width="1" height="1" /></bezel> + + <bezel name="8.0" element="led"><bounds x="16" y="0" width="1" height="1" /></bezel> + <bezel name="8.1" element="led"><bounds x="16" y="2" width="1" height="1" /></bezel> + <bezel name="8.2" element="led"><bounds x="16" y="4" width="1" height="1" /></bezel> + <bezel name="8.3" element="led"><bounds x="16" y="6" width="1" height="1" /></bezel> + <bezel name="8.4" element="led"><bounds x="16" y="8" width="1" height="1" /></bezel> + <bezel name="8.5" element="led"><bounds x="16" y="10" width="1" height="1" /></bezel> + <bezel name="8.6" element="led"><bounds x="16" y="12" width="1" height="1" /></bezel> + <bezel name="8.7" element="led"><bounds x="16" y="14" width="1" height="1" /></bezel> + <bezel name="8.8" element="led"><bounds x="16" y="16" width="1" height="1" /></bezel> + <bezel name="8.9" element="led"><bounds x="16" y="18" width="1" height="1" /></bezel> + <bezel name="8.10" element="led"><bounds x="16" y="20" width="1" height="1" /></bezel> + <bezel name="8.11" element="led"><bounds x="16" y="22" width="1" height="1" /></bezel> + <bezel name="8.12" element="led"><bounds x="16" y="24" width="1" height="1" /></bezel> + <bezel name="8.13" element="led"><bounds x="16" y="26" width="1" height="1" /></bezel> + <bezel name="8.14" element="led"><bounds x="16" y="28" width="1" height="1" /></bezel> + <bezel name="8.15" element="led"><bounds x="16" y="30" width="1" height="1" /></bezel> + <bezel name="8.16" element="led"><bounds x="16" y="32" width="1" height="1" /></bezel> + <bezel name="8.17" element="led"><bounds x="16" y="34" width="1" height="1" /></bezel> + <bezel name="8.18" element="led"><bounds x="16" y="36" width="1" height="1" /></bezel> + <bezel name="8.19" element="led"><bounds x="16" y="38" width="1" height="1" /></bezel> + <bezel name="8.20" element="led"><bounds x="16" y="40" width="1" height="1" /></bezel> + <bezel name="8.21" element="led"><bounds x="16" y="42" width="1" height="1" /></bezel> + <bezel name="8.22" element="led"><bounds x="16" y="44" width="1" height="1" /></bezel> + <bezel name="8.23" element="led"><bounds x="16" y="46" width="1" height="1" /></bezel> + <bezel name="8.24" element="led"><bounds x="16" y="48" width="1" height="1" /></bezel> + <bezel name="8.25" element="led"><bounds x="16" y="50" width="1" height="1" /></bezel> + <bezel name="8.26" element="led"><bounds x="16" y="52" width="1" height="1" /></bezel> + <bezel name="8.27" element="led"><bounds x="16" y="54" width="1" height="1" /></bezel> + <bezel name="8.28" element="led"><bounds x="16" y="56" width="1" height="1" /></bezel> + <bezel name="8.29" element="led"><bounds x="16" y="58" width="1" height="1" /></bezel> + <bezel name="8.30" element="led"><bounds x="16" y="60" width="1" height="1" /></bezel> + <bezel name="8.31" element="led"><bounds x="16" y="62" width="1" height="1" /></bezel> + + <bezel name="9.0" element="led"><bounds x="18" y="0" width="1" height="1" /></bezel> + <bezel name="9.1" element="led"><bounds x="18" y="2" width="1" height="1" /></bezel> + <bezel name="9.2" element="led"><bounds x="18" y="4" width="1" height="1" /></bezel> + <bezel name="9.3" element="led"><bounds x="18" y="6" width="1" height="1" /></bezel> + <bezel name="9.4" element="led"><bounds x="18" y="8" width="1" height="1" /></bezel> + <bezel name="9.5" element="led"><bounds x="18" y="10" width="1" height="1" /></bezel> + <bezel name="9.6" element="led"><bounds x="18" y="12" width="1" height="1" /></bezel> + <bezel name="9.7" element="led"><bounds x="18" y="14" width="1" height="1" /></bezel> + <bezel name="9.8" element="led"><bounds x="18" y="16" width="1" height="1" /></bezel> + <bezel name="9.9" element="led"><bounds x="18" y="18" width="1" height="1" /></bezel> + <bezel name="9.10" element="led"><bounds x="18" y="20" width="1" height="1" /></bezel> + <bezel name="9.11" element="led"><bounds x="18" y="22" width="1" height="1" /></bezel> + <bezel name="9.12" element="led"><bounds x="18" y="24" width="1" height="1" /></bezel> + <bezel name="9.13" element="led"><bounds x="18" y="26" width="1" height="1" /></bezel> + <bezel name="9.14" element="led"><bounds x="18" y="28" width="1" height="1" /></bezel> + <bezel name="9.15" element="led"><bounds x="18" y="30" width="1" height="1" /></bezel> + <bezel name="9.16" element="led"><bounds x="18" y="32" width="1" height="1" /></bezel> + <bezel name="9.17" element="led"><bounds x="18" y="34" width="1" height="1" /></bezel> + <bezel name="9.18" element="led"><bounds x="18" y="36" width="1" height="1" /></bezel> + <bezel name="9.19" element="led"><bounds x="18" y="38" width="1" height="1" /></bezel> + <bezel name="9.20" element="led"><bounds x="18" y="40" width="1" height="1" /></bezel> + <bezel name="9.21" element="led"><bounds x="18" y="42" width="1" height="1" /></bezel> + <bezel name="9.22" element="led"><bounds x="18" y="44" width="1" height="1" /></bezel> + <bezel name="9.23" element="led"><bounds x="18" y="46" width="1" height="1" /></bezel> + <bezel name="9.24" element="led"><bounds x="18" y="48" width="1" height="1" /></bezel> + <bezel name="9.25" element="led"><bounds x="18" y="50" width="1" height="1" /></bezel> + <bezel name="9.26" element="led"><bounds x="18" y="52" width="1" height="1" /></bezel> + <bezel name="9.27" element="led"><bounds x="18" y="54" width="1" height="1" /></bezel> + <bezel name="9.28" element="led"><bounds x="18" y="56" width="1" height="1" /></bezel> + <bezel name="9.29" element="led"><bounds x="18" y="58" width="1" height="1" /></bezel> + <bezel name="9.30" element="led"><bounds x="18" y="60" width="1" height="1" /></bezel> + <bezel name="9.31" element="led"><bounds x="18" y="62" width="1" height="1" /></bezel> + + <bezel name="10.0" element="led"><bounds x="20" y="0" width="1" height="1" /></bezel> + <bezel name="10.1" element="led"><bounds x="20" y="2" width="1" height="1" /></bezel> + <bezel name="10.2" element="led"><bounds x="20" y="4" width="1" height="1" /></bezel> + <bezel name="10.3" element="led"><bounds x="20" y="6" width="1" height="1" /></bezel> + <bezel name="10.4" element="led"><bounds x="20" y="8" width="1" height="1" /></bezel> + <bezel name="10.5" element="led"><bounds x="20" y="10" width="1" height="1" /></bezel> + <bezel name="10.6" element="led"><bounds x="20" y="12" width="1" height="1" /></bezel> + <bezel name="10.7" element="led"><bounds x="20" y="14" width="1" height="1" /></bezel> + <bezel name="10.8" element="led"><bounds x="20" y="16" width="1" height="1" /></bezel> + <bezel name="10.9" element="led"><bounds x="20" y="18" width="1" height="1" /></bezel> + <bezel name="10.10" element="led"><bounds x="20" y="20" width="1" height="1" /></bezel> + <bezel name="10.11" element="led"><bounds x="20" y="22" width="1" height="1" /></bezel> + <bezel name="10.12" element="led"><bounds x="20" y="24" width="1" height="1" /></bezel> + <bezel name="10.13" element="led"><bounds x="20" y="26" width="1" height="1" /></bezel> + <bezel name="10.14" element="led"><bounds x="20" y="28" width="1" height="1" /></bezel> + <bezel name="10.15" element="led"><bounds x="20" y="30" width="1" height="1" /></bezel> + <bezel name="10.16" element="led"><bounds x="20" y="32" width="1" height="1" /></bezel> + <bezel name="10.17" element="led"><bounds x="20" y="34" width="1" height="1" /></bezel> + <bezel name="10.18" element="led"><bounds x="20" y="36" width="1" height="1" /></bezel> + <bezel name="10.19" element="led"><bounds x="20" y="38" width="1" height="1" /></bezel> + <bezel name="10.20" element="led"><bounds x="20" y="40" width="1" height="1" /></bezel> + <bezel name="10.21" element="led"><bounds x="20" y="42" width="1" height="1" /></bezel> + <bezel name="10.22" element="led"><bounds x="20" y="44" width="1" height="1" /></bezel> + <bezel name="10.23" element="led"><bounds x="20" y="46" width="1" height="1" /></bezel> + <bezel name="10.24" element="led"><bounds x="20" y="48" width="1" height="1" /></bezel> + <bezel name="10.25" element="led"><bounds x="20" y="50" width="1" height="1" /></bezel> + <bezel name="10.26" element="led"><bounds x="20" y="52" width="1" height="1" /></bezel> + <bezel name="10.27" element="led"><bounds x="20" y="54" width="1" height="1" /></bezel> + <bezel name="10.28" element="led"><bounds x="20" y="56" width="1" height="1" /></bezel> + <bezel name="10.29" element="led"><bounds x="20" y="58" width="1" height="1" /></bezel> + <bezel name="10.30" element="led"><bounds x="20" y="60" width="1" height="1" /></bezel> + <bezel name="10.31" element="led"><bounds x="20" y="62" width="1" height="1" /></bezel> + + <bezel name="11.0" element="led"><bounds x="22" y="0" width="1" height="1" /></bezel> + <bezel name="11.1" element="led"><bounds x="22" y="2" width="1" height="1" /></bezel> + <bezel name="11.2" element="led"><bounds x="22" y="4" width="1" height="1" /></bezel> + <bezel name="11.3" element="led"><bounds x="22" y="6" width="1" height="1" /></bezel> + <bezel name="11.4" element="led"><bounds x="22" y="8" width="1" height="1" /></bezel> + <bezel name="11.5" element="led"><bounds x="22" y="10" width="1" height="1" /></bezel> + <bezel name="11.6" element="led"><bounds x="22" y="12" width="1" height="1" /></bezel> + <bezel name="11.7" element="led"><bounds x="22" y="14" width="1" height="1" /></bezel> + <bezel name="11.8" element="led"><bounds x="22" y="16" width="1" height="1" /></bezel> + <bezel name="11.9" element="led"><bounds x="22" y="18" width="1" height="1" /></bezel> + <bezel name="11.10" element="led"><bounds x="22" y="20" width="1" height="1" /></bezel> + <bezel name="11.11" element="led"><bounds x="22" y="22" width="1" height="1" /></bezel> + <bezel name="11.12" element="led"><bounds x="22" y="24" width="1" height="1" /></bezel> + <bezel name="11.13" element="led"><bounds x="22" y="26" width="1" height="1" /></bezel> + <bezel name="11.14" element="led"><bounds x="22" y="28" width="1" height="1" /></bezel> + <bezel name="11.15" element="led"><bounds x="22" y="30" width="1" height="1" /></bezel> + <bezel name="11.16" element="led"><bounds x="22" y="32" width="1" height="1" /></bezel> + <bezel name="11.17" element="led"><bounds x="22" y="34" width="1" height="1" /></bezel> + <bezel name="11.18" element="led"><bounds x="22" y="36" width="1" height="1" /></bezel> + <bezel name="11.19" element="led"><bounds x="22" y="38" width="1" height="1" /></bezel> + <bezel name="11.20" element="led"><bounds x="22" y="40" width="1" height="1" /></bezel> + <bezel name="11.21" element="led"><bounds x="22" y="42" width="1" height="1" /></bezel> + <bezel name="11.22" element="led"><bounds x="22" y="44" width="1" height="1" /></bezel> + <bezel name="11.23" element="led"><bounds x="22" y="46" width="1" height="1" /></bezel> + <bezel name="11.24" element="led"><bounds x="22" y="48" width="1" height="1" /></bezel> + <bezel name="11.25" element="led"><bounds x="22" y="50" width="1" height="1" /></bezel> + <bezel name="11.26" element="led"><bounds x="22" y="52" width="1" height="1" /></bezel> + <bezel name="11.27" element="led"><bounds x="22" y="54" width="1" height="1" /></bezel> + <bezel name="11.28" element="led"><bounds x="22" y="56" width="1" height="1" /></bezel> + <bezel name="11.29" element="led"><bounds x="22" y="58" width="1" height="1" /></bezel> + <bezel name="11.30" element="led"><bounds x="22" y="60" width="1" height="1" /></bezel> + <bezel name="11.31" element="led"><bounds x="22" y="62" width="1" height="1" /></bezel> + + <bezel name="12.0" element="led"><bounds x="24" y="0" width="1" height="1" /></bezel> + <bezel name="12.1" element="led"><bounds x="24" y="2" width="1" height="1" /></bezel> + <bezel name="12.2" element="led"><bounds x="24" y="4" width="1" height="1" /></bezel> + <bezel name="12.3" element="led"><bounds x="24" y="6" width="1" height="1" /></bezel> + <bezel name="12.4" element="led"><bounds x="24" y="8" width="1" height="1" /></bezel> + <bezel name="12.5" element="led"><bounds x="24" y="10" width="1" height="1" /></bezel> + <bezel name="12.6" element="led"><bounds x="24" y="12" width="1" height="1" /></bezel> + <bezel name="12.7" element="led"><bounds x="24" y="14" width="1" height="1" /></bezel> + <bezel name="12.8" element="led"><bounds x="24" y="16" width="1" height="1" /></bezel> + <bezel name="12.9" element="led"><bounds x="24" y="18" width="1" height="1" /></bezel> + <bezel name="12.10" element="led"><bounds x="24" y="20" width="1" height="1" /></bezel> + <bezel name="12.11" element="led"><bounds x="24" y="22" width="1" height="1" /></bezel> + <bezel name="12.12" element="led"><bounds x="24" y="24" width="1" height="1" /></bezel> + <bezel name="12.13" element="led"><bounds x="24" y="26" width="1" height="1" /></bezel> + <bezel name="12.14" element="led"><bounds x="24" y="28" width="1" height="1" /></bezel> + <bezel name="12.15" element="led"><bounds x="24" y="30" width="1" height="1" /></bezel> + <bezel name="12.16" element="led"><bounds x="24" y="32" width="1" height="1" /></bezel> + <bezel name="12.17" element="led"><bounds x="24" y="34" width="1" height="1" /></bezel> + <bezel name="12.18" element="led"><bounds x="24" y="36" width="1" height="1" /></bezel> + <bezel name="12.19" element="led"><bounds x="24" y="38" width="1" height="1" /></bezel> + <bezel name="12.20" element="led"><bounds x="24" y="40" width="1" height="1" /></bezel> + <bezel name="12.21" element="led"><bounds x="24" y="42" width="1" height="1" /></bezel> + <bezel name="12.22" element="led"><bounds x="24" y="44" width="1" height="1" /></bezel> + <bezel name="12.23" element="led"><bounds x="24" y="46" width="1" height="1" /></bezel> + <bezel name="12.24" element="led"><bounds x="24" y="48" width="1" height="1" /></bezel> + <bezel name="12.25" element="led"><bounds x="24" y="50" width="1" height="1" /></bezel> + <bezel name="12.26" element="led"><bounds x="24" y="52" width="1" height="1" /></bezel> + <bezel name="12.27" element="led"><bounds x="24" y="54" width="1" height="1" /></bezel> + <bezel name="12.28" element="led"><bounds x="24" y="56" width="1" height="1" /></bezel> + <bezel name="12.29" element="led"><bounds x="24" y="58" width="1" height="1" /></bezel> + <bezel name="12.30" element="led"><bounds x="24" y="60" width="1" height="1" /></bezel> + <bezel name="12.31" element="led"><bounds x="24" y="62" width="1" height="1" /></bezel> + + <bezel name="13.0" element="led"><bounds x="26" y="0" width="1" height="1" /></bezel> + <bezel name="13.1" element="led"><bounds x="26" y="2" width="1" height="1" /></bezel> + <bezel name="13.2" element="led"><bounds x="26" y="4" width="1" height="1" /></bezel> + <bezel name="13.3" element="led"><bounds x="26" y="6" width="1" height="1" /></bezel> + <bezel name="13.4" element="led"><bounds x="26" y="8" width="1" height="1" /></bezel> + <bezel name="13.5" element="led"><bounds x="26" y="10" width="1" height="1" /></bezel> + <bezel name="13.6" element="led"><bounds x="26" y="12" width="1" height="1" /></bezel> + <bezel name="13.7" element="led"><bounds x="26" y="14" width="1" height="1" /></bezel> + <bezel name="13.8" element="led"><bounds x="26" y="16" width="1" height="1" /></bezel> + <bezel name="13.9" element="led"><bounds x="26" y="18" width="1" height="1" /></bezel> + <bezel name="13.10" element="led"><bounds x="26" y="20" width="1" height="1" /></bezel> + <bezel name="13.11" element="led"><bounds x="26" y="22" width="1" height="1" /></bezel> + <bezel name="13.12" element="led"><bounds x="26" y="24" width="1" height="1" /></bezel> + <bezel name="13.13" element="led"><bounds x="26" y="26" width="1" height="1" /></bezel> + <bezel name="13.14" element="led"><bounds x="26" y="28" width="1" height="1" /></bezel> + <bezel name="13.15" element="led"><bounds x="26" y="30" width="1" height="1" /></bezel> + <bezel name="13.16" element="led"><bounds x="26" y="32" width="1" height="1" /></bezel> + <bezel name="13.17" element="led"><bounds x="26" y="34" width="1" height="1" /></bezel> + <bezel name="13.18" element="led"><bounds x="26" y="36" width="1" height="1" /></bezel> + <bezel name="13.19" element="led"><bounds x="26" y="38" width="1" height="1" /></bezel> + <bezel name="13.20" element="led"><bounds x="26" y="40" width="1" height="1" /></bezel> + <bezel name="13.21" element="led"><bounds x="26" y="42" width="1" height="1" /></bezel> + <bezel name="13.22" element="led"><bounds x="26" y="44" width="1" height="1" /></bezel> + <bezel name="13.23" element="led"><bounds x="26" y="46" width="1" height="1" /></bezel> + <bezel name="13.24" element="led"><bounds x="26" y="48" width="1" height="1" /></bezel> + <bezel name="13.25" element="led"><bounds x="26" y="50" width="1" height="1" /></bezel> + <bezel name="13.26" element="led"><bounds x="26" y="52" width="1" height="1" /></bezel> + <bezel name="13.27" element="led"><bounds x="26" y="54" width="1" height="1" /></bezel> + <bezel name="13.28" element="led"><bounds x="26" y="56" width="1" height="1" /></bezel> + <bezel name="13.29" element="led"><bounds x="26" y="58" width="1" height="1" /></bezel> + <bezel name="13.30" element="led"><bounds x="26" y="60" width="1" height="1" /></bezel> + <bezel name="13.31" element="led"><bounds x="26" y="62" width="1" height="1" /></bezel> + + <bezel name="14.0" element="led"><bounds x="28" y="0" width="1" height="1" /></bezel> + <bezel name="14.1" element="led"><bounds x="28" y="2" width="1" height="1" /></bezel> + <bezel name="14.2" element="led"><bounds x="28" y="4" width="1" height="1" /></bezel> + <bezel name="14.3" element="led"><bounds x="28" y="6" width="1" height="1" /></bezel> + <bezel name="14.4" element="led"><bounds x="28" y="8" width="1" height="1" /></bezel> + <bezel name="14.5" element="led"><bounds x="28" y="10" width="1" height="1" /></bezel> + <bezel name="14.6" element="led"><bounds x="28" y="12" width="1" height="1" /></bezel> + <bezel name="14.7" element="led"><bounds x="28" y="14" width="1" height="1" /></bezel> + <bezel name="14.8" element="led"><bounds x="28" y="16" width="1" height="1" /></bezel> + <bezel name="14.9" element="led"><bounds x="28" y="18" width="1" height="1" /></bezel> + <bezel name="14.10" element="led"><bounds x="28" y="20" width="1" height="1" /></bezel> + <bezel name="14.11" element="led"><bounds x="28" y="22" width="1" height="1" /></bezel> + <bezel name="14.12" element="led"><bounds x="28" y="24" width="1" height="1" /></bezel> + <bezel name="14.13" element="led"><bounds x="28" y="26" width="1" height="1" /></bezel> + <bezel name="14.14" element="led"><bounds x="28" y="28" width="1" height="1" /></bezel> + <bezel name="14.15" element="led"><bounds x="28" y="30" width="1" height="1" /></bezel> + <bezel name="14.16" element="led"><bounds x="28" y="32" width="1" height="1" /></bezel> + <bezel name="14.17" element="led"><bounds x="28" y="34" width="1" height="1" /></bezel> + <bezel name="14.18" element="led"><bounds x="28" y="36" width="1" height="1" /></bezel> + <bezel name="14.19" element="led"><bounds x="28" y="38" width="1" height="1" /></bezel> + <bezel name="14.20" element="led"><bounds x="28" y="40" width="1" height="1" /></bezel> + <bezel name="14.21" element="led"><bounds x="28" y="42" width="1" height="1" /></bezel> + <bezel name="14.22" element="led"><bounds x="28" y="44" width="1" height="1" /></bezel> + <bezel name="14.23" element="led"><bounds x="28" y="46" width="1" height="1" /></bezel> + <bezel name="14.24" element="led"><bounds x="28" y="48" width="1" height="1" /></bezel> + <bezel name="14.25" element="led"><bounds x="28" y="50" width="1" height="1" /></bezel> + <bezel name="14.26" element="led"><bounds x="28" y="52" width="1" height="1" /></bezel> + <bezel name="14.27" element="led"><bounds x="28" y="54" width="1" height="1" /></bezel> + <bezel name="14.28" element="led"><bounds x="28" y="56" width="1" height="1" /></bezel> + <bezel name="14.29" element="led"><bounds x="28" y="58" width="1" height="1" /></bezel> + <bezel name="14.30" element="led"><bounds x="28" y="60" width="1" height="1" /></bezel> + <bezel name="14.31" element="led"><bounds x="28" y="62" width="1" height="1" /></bezel> + + <bezel name="15.0" element="led"><bounds x="30" y="0" width="1" height="1" /></bezel> + <bezel name="15.1" element="led"><bounds x="30" y="2" width="1" height="1" /></bezel> + <bezel name="15.2" element="led"><bounds x="30" y="4" width="1" height="1" /></bezel> + <bezel name="15.3" element="led"><bounds x="30" y="6" width="1" height="1" /></bezel> + <bezel name="15.4" element="led"><bounds x="30" y="8" width="1" height="1" /></bezel> + <bezel name="15.5" element="led"><bounds x="30" y="10" width="1" height="1" /></bezel> + <bezel name="15.6" element="led"><bounds x="30" y="12" width="1" height="1" /></bezel> + <bezel name="15.7" element="led"><bounds x="30" y="14" width="1" height="1" /></bezel> + <bezel name="15.8" element="led"><bounds x="30" y="16" width="1" height="1" /></bezel> + <bezel name="15.9" element="led"><bounds x="30" y="18" width="1" height="1" /></bezel> + <bezel name="15.10" element="led"><bounds x="30" y="20" width="1" height="1" /></bezel> + <bezel name="15.11" element="led"><bounds x="30" y="22" width="1" height="1" /></bezel> + <bezel name="15.12" element="led"><bounds x="30" y="24" width="1" height="1" /></bezel> + <bezel name="15.13" element="led"><bounds x="30" y="26" width="1" height="1" /></bezel> + <bezel name="15.14" element="led"><bounds x="30" y="28" width="1" height="1" /></bezel> + <bezel name="15.15" element="led"><bounds x="30" y="30" width="1" height="1" /></bezel> + <bezel name="15.16" element="led"><bounds x="30" y="32" width="1" height="1" /></bezel> + <bezel name="15.17" element="led"><bounds x="30" y="34" width="1" height="1" /></bezel> + <bezel name="15.18" element="led"><bounds x="30" y="36" width="1" height="1" /></bezel> + <bezel name="15.19" element="led"><bounds x="30" y="38" width="1" height="1" /></bezel> + <bezel name="15.20" element="led"><bounds x="30" y="40" width="1" height="1" /></bezel> + <bezel name="15.21" element="led"><bounds x="30" y="42" width="1" height="1" /></bezel> + <bezel name="15.22" element="led"><bounds x="30" y="44" width="1" height="1" /></bezel> + <bezel name="15.23" element="led"><bounds x="30" y="46" width="1" height="1" /></bezel> + <bezel name="15.24" element="led"><bounds x="30" y="48" width="1" height="1" /></bezel> + <bezel name="15.25" element="led"><bounds x="30" y="50" width="1" height="1" /></bezel> + <bezel name="15.26" element="led"><bounds x="30" y="52" width="1" height="1" /></bezel> + <bezel name="15.27" element="led"><bounds x="30" y="54" width="1" height="1" /></bezel> + <bezel name="15.28" element="led"><bounds x="30" y="56" width="1" height="1" /></bezel> + <bezel name="15.29" element="led"><bounds x="30" y="58" width="1" height="1" /></bezel> + <bezel name="15.30" element="led"><bounds x="30" y="60" width="1" height="1" /></bezel> + <bezel name="15.31" element="led"><bounds x="30" y="62" width="1" height="1" /></bezel> + + + </view> +</mamelayout> diff --git a/src/mame/layout/horseran.lay b/src/mame/layout/horseran.lay new file mode 100644 index 00000000000..5f8e136a5fd --- /dev/null +++ b/src/mame/layout/horseran.lay @@ -0,0 +1,154 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- lcd colours are inverted due to 7seg element limitation --> + +<!-- define elements --> + + <element name="text_places" defstate="0"> + <text state="0" string="PLACES"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="PLACES"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_shows" defstate="0"> + <text state="0" string="SHOWS"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="SHOWS"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_earnings" defstate="0"> + <text state="0" string="EARNINGS"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="EARNINGS"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_oflast5" defstate="0"> + <text state="0" string="OF LAST 5 RACES"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="OF LAST 5 RACES"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_rating" defstate="0"> + <text state="0" string="RATING"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="RATING"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_finpos" defstate="0"> + <text state="0" string="FINISH POSITION"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="FINISH POSITION"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_finish" defstate="0"> + <text state="0" string="FINISH"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="FINISH"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_3call" defstate="0"> + <text state="0" string="3RD CALL"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="3RD CALL"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + + <element name="text_curyear" defstate="0"> + <text state="0" string="CURRENT YEAR"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="CURRENT YEAR"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_pastyear" defstate="0"> + <text state="0" string="PAST YEAR"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="PAST YEAR"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_rsl" defstate="0"> + <text state="0" string="RACES SINCE LAYOFF"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="RACES SINCE LAYOFF"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_distance" defstate="0"> + <text state="0" string="DISTANCE"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="DISTANCE"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_postpos" defstate="0"> + <text state="0" string="POST POSITION"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="POST POSITION"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_3rb" defstate="0"> + <text state="0" string="3RD RACE BACK"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="3RD RACE BACK"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_2rb" defstate="0"> + <text state="0" string="2ND RACE BACK"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="2ND RACE BACK"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_lastrace" defstate="0"> + <text state="0" string="LAST RACE"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="LAST RACE"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_purse" defstate="0"> + <text state="0" string="PURSE"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="PURSE"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + + <element name="text_lback" defstate="0"> + <text state="0" string="LENGTHS BACK"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="LENGTHS BACK"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_1call" defstate="0"> + <text state="0" string="1ST CALL"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="1ST CALL"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_2call" defstate="0"> + <text state="0" string="2ND CALL"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="2ND CALL"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_2bsr" defstate="0"> + <text state="0" string="2 BEST SPEED RATINGS"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="2 BEST SPEED RATINGS"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_daysaway" defstate="0"> + <text state="0" string="DAYS AWAY"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="DAYS AWAY"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_wins" defstate="0"> + <text state="0" string="WINS"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="WINS"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + <element name="text_races" defstate="0"> + <text state="0" string="RACES"><color red="0.1" green="0.1" blue="0.1" /></text> + <text state="1" string="RACES"><color red="0.9" green="0.9" blue="0.9" /></text> + </element> + + <element name="digit" defstate="0"> + <led7seg><color red="0.9" green="0.9" blue="0.9" /></led7seg> + </element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="0.4" right="21" top="-0.2" bottom="12.2" /> + + <bezel name="lamp124" element="text_purse"><bounds x="4" y="0" width="5" height="1" /></bezel> + <bezel name="lamp101" element="text_curyear"><bounds x="0" y="1" width="10" height="1" /></bezel> + <bezel name="lamp123" element="text_lastrace"><bounds x="0" y="2" width="10" height="1" /></bezel> + <bezel name="lamp102" element="text_pastyear"><bounds x="0" y="3" width="10" height="1" /></bezel> + <bezel name="lamp122" element="text_2rb"><bounds x="0" y="4" width="10" height="1" /></bezel> + <bezel name="lamp103" element="text_rsl"><bounds x="0" y="5" width="10" height="1" /></bezel> + <bezel name="lamp121" element="text_3rb"><bounds x="0" y="6" width="10" height="1" /></bezel> + <bezel name="lamp104" element="text_distance"><bounds x="0" y="7" width="6" height="1" /></bezel> + + <bezel name="lamp224" element="text_postpos"><bounds x="8" y="0" width="8" height="1" /></bezel> + <bezel name="lamp201" element="text_lback"><bounds x="6" y="1" width="10" height="1" /></bezel> + <bezel name="lamp223" element="text_races"><bounds x="6" y="2" width="10" height="1" /></bezel> + <bezel name="lamp202" element="text_1call"><bounds x="6" y="3" width="10" height="1" /></bezel> + <bezel name="lamp222" element="text_wins"><bounds x="6" y="4" width="10" height="1" /></bezel> + <bezel name="lamp203" element="text_2call"><bounds x="6" y="5" width="10" height="1" /></bezel> + <bezel name="lamp221" element="text_daysaway"><bounds x="6" y="6" width="10" height="1" /></bezel> + <bezel name="lamp204" element="text_2bsr"><bounds x="4.5" y="7" width="10" height="1" /></bezel> + + <bezel name="lamp1" element="text_places"><bounds x="12" y="1" width="10" height="1" /></bezel> + <bezel name="lamp23" element="text_3call"><bounds x="12" y="2" width="10" height="1" /></bezel> + <bezel name="lamp2" element="text_shows"><bounds x="12" y="3" width="10" height="1" /></bezel> + <bezel name="lamp22" element="text_finish"><bounds x="12" y="4" width="10" height="1" /></bezel> + <bezel name="lamp3" element="text_earnings"><bounds x="12" y="5" width="10" height="1" /></bezel> + <bezel name="lamp21" element="text_finpos"><bounds x="12" y="6" width="10" height="1" /></bezel> + <bezel name="lamp4" element="text_oflast5"><bounds x="12.25" y="7" width="10" height="1" /></bezel> + + <bezel name="digit3" element="digit"><bounds x="4" y="8.2" width="2" height="3" /></bezel> + <bezel name="digit5" element="digit"><bounds x="6" y="8.2" width="2" height="3" /></bezel> + <bezel name="digit1" element="digit"><bounds x="8" y="8.2" width="2" height="3" /></bezel> + <bezel name="digit2" element="digit"><bounds x="10" y="8.2" width="2" height="3" /></bezel> + <bezel name="digit4" element="digit"><bounds x="12" y="8.2" width="2" height="3" /></bezel> + <bezel name="digit0" element="digit"><bounds x="14" y="8.2" width="2" height="3" /></bezel> + + <bezel name="lamp120" element="text_postpos"><bounds x="2.5" y="11.3" width="6" height="0.66" /></bezel> + <bezel name="lamp20" element="text_rating"><bounds x="10.5" y="11.3" width="6" height="0.66" /></bezel> + + </view> +</mamelayout> diff --git a/src/mame/layout/lchicken.lay b/src/mame/layout/lchicken.lay new file mode 100644 index 00000000000..a58fe6a05de --- /dev/null +++ b/src/mame/layout/lchicken.lay @@ -0,0 +1,133 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_orange"><rect><color red="0.9" green="0.3" blue="0.2" /></rect></element> + <element name="static_white2"><rect><color red="0.7" green="0.7" blue="0.7" /></rect></element> + + <element name="hl" defstate="0"> + <text string=" "> + <bounds x="0.0" y="0.0" width="1.0" height="1.0" /> + <color red="0.0" green="0.0" blue="0.0" /> + </text> + <disk state="1"> + <bounds x="0.07" y="0.07" width="0.86" height="0.86" /> + <color red="0.0" green="0.0" blue="0.0" /> + </disk> + </element> + + <element name="led" defstate="0"> + <disk state="0"><color red="0.2" green="0.04" blue="0.05" /></disk> + <disk state="1"><color red="1.0" green="0.2" blue="0.23" /></disk> + </element> + + <element name="led1" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="1"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="1"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led2" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="2"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="2"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led3" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="3"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="3"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led4" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="4"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="4"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led5" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="5"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="5"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led6" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="6"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="6"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led7" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="7"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="7"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led8" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="8"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="8"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + <element name="led9" defstate="0"> + <rect><bounds x="0" y="0" width="1" height="1"/><color red="0.9" green="0.9" blue="0.9" /></rect> + <text state="0" string="9"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="0.15" green="0.15" blue="0.15" /></text> + <text state="1" string="9"><bounds x="0.15" y="0.12" width="0.7" height="0.7"/><color red="1.0" green="0.2" blue="0.23" /></text> + </element> + + <element name="text_chicken"><text string="CHICKEN" align="2"><color red="0.7" green="0.7" blue="0.7" /></text></element> + <element name="text_player"><text string="PLAYER" align="2"><color red="0.7" green="0.7" blue="0.7" /></text></element> + + <element name="mask" defstate="0"> + <text string=" "><color red="0.0" green="0.0" blue="0.0" /></text> + <rect state="0"><color red="0.0" green="0.0" blue="0.0" /></rect> + </element> + + <element name="text_m1"><text string="(motor pos: 0." align="1"><color red="0.7" green="0.7" blue="0.7" /></text></element> + <element name="text_m2"><text string=")" align="1"><color red="0.7" green="0.7" blue="0.7" /></text></element> + <element name="counter" defstate="0"> + <simplecounter maxstate="99" digits="2" align="1"> + <color red="0.7" green="0.7" blue="0.7" /> + </simplecounter> + </element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="0.01" right="16.99" top="7.4" bottom="31" /> + + <bezel element="static_white2"><bounds x="0" y="9.75" width="17" height="17.5" /></bezel> + <bezel element="static_orange"><bounds x="0" y="10" width="17" height="17" /></bezel> + <bezel name="0.2" element="led1"><bounds x="0" y="10" width="5" height="5" /></bezel> + <bezel name="0.1" element="led2"><bounds x="6" y="10" width="5" height="5" /></bezel> + <bezel name="0.0" element="led3"><bounds x="12" y="10" width="5" height="5" /></bezel> + <bezel name="1.2" element="led4"><bounds x="0" y="16" width="5" height="5" /></bezel> + <bezel name="1.1" element="led5"><bounds x="6" y="16" width="5" height="5" /></bezel> + <bezel name="1.0" element="led6"><bounds x="12" y="16" width="5" height="5" /></bezel> + <bezel name="2.2" element="led7"><bounds x="0" y="22" width="5" height="5" /></bezel> + <bezel name="2.1" element="led8"><bounds x="6" y="22" width="5" height="5" /></bezel> + <bezel name="2.0" element="led9"><bounds x="12" y="22" width="5" height="5" /></bezel> + + <bezel element="text_chicken"><bounds x="0" y="28" width="4.5" height="1" /></bezel> + <bezel element="text_player"><bounds x="0" y="29.5" width="4.5" height="1" /></bezel> + <bezel name="0.3" element="led"><bounds x="5" y="28" width="1" height="1" /></bezel> + <bezel name="1.3" element="led"><bounds x="5" y="29.5" width="1" height="1" /></bezel> + + <!-- in reality the keypad is under the led panel, but here just put it on top of the led panel --> + + <bezel element="hl" inputtag="IN.2" inputmask="0x01"><bounds x="0" y="10" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x01"><bounds x="6" y="10" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x01"><bounds x="12" y="10" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x02"><bounds x="0" y="16" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x02"><bounds x="6" y="16" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x02"><bounds x="12" y="16" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x04"><bounds x="0" y="22" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x04"><bounds x="6" y="22" width="5" height="5" /><color alpha="0.15" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x04"><bounds x="12" y="22" width="5" height="5" /><color alpha="0.15" /></bezel> + + <!-- motor status info --> + + <bezel element="text_m1"><bounds x="5.3" y="8" width="6" height="1" /></bezel> + <bezel name="motor_pos" element="counter"><bounds x="10.46" y="8" width="3" height="1" /></bezel> + <bezel element="text_m2"><bounds x="11.4" y="8" width="2" height="1" /></bezel> + <bezel name="motor_on" element="mask"> + <bounds x="5" y="7.5" width="10" height="2" /> + <color alpha="0.7" /> + </bezel> + + </view> +</mamelayout> diff --git a/src/mame/layout/mdallas.lay b/src/mame/layout/mdallas.lay new file mode 100644 index 00000000000..e4e2a98443e --- /dev/null +++ b/src/mame/layout/mdallas.lay @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + + <element name="digit" defstate="0"> + <led7seg><color red="1.0" green="0.15" blue="0.08" /></led7seg> + </element> + + <view name="Internal Layout"> + <bounds left="0" right="80" top="0" bottom="15" /> + + <bezel name="digit7" element="digit"> + <bounds x="0" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit6" element="digit"> + <bounds x="10" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit5" element="digit"> + <bounds x="20" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit4" element="digit"> + <bounds x="30" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit3" element="digit"> + <bounds x="40" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit2" element="digit"> + <bounds x="50" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit1" element="digit"> + <bounds x="60" y="0" width="10" height="15" /> + </bezel> + <bezel name="digit0" element="digit"> + <bounds x="70" y="0" width="10" height="15" /> + </bezel> + + </view> +</mamelayout> diff --git a/src/mame/layout/novag_diablo68k.lay b/src/mame/layout/novag_diablo68k.lay new file mode 100644 index 00000000000..f56d9de4757 --- /dev/null +++ b/src/mame/layout/novag_diablo68k.lay @@ -0,0 +1,435 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_lcd"><rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect></element> + + <element name="led" defstate="0"> + <disk state="1"><color red="1.0" green="0.1" blue="0.15" /></disk> + <disk state="0"><color red="0.1" green="0.01" blue="0.015" /></disk> + </element> + + <element name="hl" defstate="0"> + <text string=" "> + <bounds x="0.0" y="0.0" width="1.0" height="1.0" /> + <color red="0.0" green="0.0" blue="0.0" /> + </text> + <disk state="1"> + <bounds x="0.12" y="0.12" width="0.76" height="0.76" /> + <color red="1.0" green="1.0" blue="1.0" /> + </disk> + </element> + <element name="but" defstate="0"> + <disk state="0"><color red="0.17" green="0.15" blue="0.15" /></disk> + <disk state="1"><color red="0.34" green="0.3" blue="0.3" /></disk> + </element> + + <element name="black"><rect><color red="0.17" green="0.15" blue="0.15" /></rect></element> + <element name="white"><rect><color red="0.81" green="0.8" blue="0.79" /></rect></element> + + <element name="text_1"><text string="1"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_2"><text string="2"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_3"><text string="3"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_4"><text string="4"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_5"><text string="5"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_6"><text string="6"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_7"><text string="7"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_8"><text string="8"><color red="0.9" green="0.9" blue="0.9" /></text></element> + + <element name="text_a"><text string="A"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_b"><text string="B"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_c"><text string="C"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_d"><text string="D"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_e"><text string="E"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_f"><text string="F"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_g"><text string="G"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="text_h"><text string="H"><color red="0.9" green="0.9" blue="0.9" /></text></element> + + <element name="text_l1a"><text string="Print Board"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l1b"><text string="Interface"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l2a"><text string="Print List"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l2b"><text string="Acc. Time"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l3a"><text string="Print Moves"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l3b"><text string="Print"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l3bx"><text string="Evaluations"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l4a"><text string="Print Book"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l4b"><text string="Store Game"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l5a"><text string="No/End"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l5b"><text string="End of Game"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l6a"><text string="Yes/Start"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l6b"><text string="Start of Game"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l7a"><text string="<-"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l7b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l8a"><text string="->"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_l8b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + + <element name="text_m1ax"><text string="Player/"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m1a"><text string="Player"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m1b"><text string="Gambit Book"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m2a"><text string="Solve Mate"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m2b"><text string="Infinite"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m3a"><text string="Sound"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m3b"><text string="Info"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m4ax"><text string="Best Move/"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m4a"><text string="Random"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m4b"><text string="Review"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m5a"><text string="Pro-Op"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m5b"><text string="Restore Game"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m6a"><text string="Priority"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m6b"><text string="Tournament"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m6bx"><text string="Book"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m7a"><text string="Flip Display"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m7b"><text string="Time Control"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m8a"><text string="Take Back"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_m8b"><text string="Analyze Games"><color red="0.51" green="0.5" blue="0.49" /></text></element> + + <element name="text_r1a"><text string="New Game"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r1b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r2a"><text string="Verify/Set Up"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r2b"><text string="Pro-Op Book/"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r2bx"><text string="Both Books"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r3a"><text string="Change Color"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r3b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r4a"><text string="Clear Board"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r4b"><text string="Delete Pro-Op"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r5a"><text string="Trace Forward"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r5b"><text string="AutoPlay"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r6a"><text string="Hint"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r6b"><text string="Next Best"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r7a"><text string="Set Level"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r7b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r8a"><text string="Go"><color red="0.51" green="0.5" blue="0.49" /></text></element> + <element name="text_r8b"><text string=" "><color red="0.51" green="0.5" blue="0.49" /></text></element> + + <element name="text_king"><text string="♚"><color red="0.61" green="0.6" blue="0.59" /></text></element> + <element name="text_queen"><text string="♛"><color red="0.61" green="0.6" blue="0.59" /></text></element> + <element name="text_rook"><text string="♜"><color red="0.61" green="0.6" blue="0.59" /></text></element> + <element name="text_bishop"><text string="♝"><color red="0.61" green="0.6" blue="0.59" /></text></element> + <element name="text_knight"><text string="♞"><color red="0.61" green="0.6" blue="0.59" /></text></element> + <element name="text_pawn"><text string="♟"><color red="0.61" green="0.6" blue="0.59" /></text></element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="-3" right="114" top="-2" bottom="89" /> + + <!-- chessboard coords --> + + <bezel element="text_8"><bounds x="-0.8" y="7" width="2" height="2" /></bezel> + <bezel element="text_7"><bounds x="-0.8" y="17" width="2" height="2" /></bezel> + <bezel element="text_6"><bounds x="-0.8" y="27" width="2" height="2" /></bezel> + <bezel element="text_5"><bounds x="-0.8" y="37" width="2" height="2" /></bezel> + <bezel element="text_4"><bounds x="-0.8" y="47" width="2" height="2" /></bezel> + <bezel element="text_3"><bounds x="-0.8" y="57" width="2" height="2" /></bezel> + <bezel element="text_2"><bounds x="-0.8" y="67" width="2" height="2" /></bezel> + <bezel element="text_1"><bounds x="-0.8" y="77" width="2" height="2" /></bezel> + + <bezel element="text_a"><bounds x="7" y="85" width="2" height="2" /></bezel> + <bezel element="text_b"><bounds x="17" y="85" width="2" height="2" /></bezel> + <bezel element="text_c"><bounds x="27" y="85" width="2" height="2" /></bezel> + <bezel element="text_d"><bounds x="37" y="85" width="2" height="2" /></bezel> + <bezel element="text_e"><bounds x="47" y="85" width="2" height="2" /></bezel> + <bezel element="text_f"><bounds x="57" y="85" width="2" height="2" /></bezel> + <bezel element="text_g"><bounds x="67" y="85" width="2" height="2" /></bezel> + <bezel element="text_h"><bounds x="77" y="85" width="2" height="2" /></bezel> + + <!-- chessboard bezel --> + + <bezel element="black"><bounds x="2" y="2" width="82" height="82" /></bezel> + <bezel element="white"><bounds x="3" y="3" width="80" height="80" /></bezel> + + <bezel element="black"><bounds x="13" y="2.5" width="10" height="10.5" /></bezel> + <bezel element="black"><bounds x="33" y="2.5" width="10" height="10.5" /></bezel> + <bezel element="black"><bounds x="53" y="2.5" width="10" height="10.5" /></bezel> + <bezel element="black"><bounds x="73" y="2.5" width="10.5" height="10.5" /></bezel> + + <bezel element="black"><bounds x="2.5" y="13" width="10.5" height="10" /></bezel> + <bezel element="black"><bounds x="23" y="13" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="43" y="13" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="63" y="13" width="10" height="10" /></bezel> + + <bezel element="black"><bounds x="13" y="23" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="33" y="23" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="53" y="23" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="73" y="23" width="10.5" height="10" /></bezel> + + <bezel element="black"><bounds x="2.5" y="33" width="10.5" height="10" /></bezel> + <bezel element="black"><bounds x="23" y="33" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="43" y="33" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="63" y="33" width="10" height="10" /></bezel> + + <bezel element="black"><bounds x="13" y="43" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="33" y="43" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="53" y="43" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="73" y="43" width="10.5" height="10" /></bezel> + + <bezel element="black"><bounds x="2.5" y="53" width="10.5" height="10" /></bezel> + <bezel element="black"><bounds x="23" y="53" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="43" y="53" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="63" y="53" width="10" height="10" /></bezel> + + <bezel element="black"><bounds x="13" y="63" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="33" y="63" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="53" y="63" width="10" height="10" /></bezel> + <bezel element="black"><bounds x="73" y="63" width="10.5" height="10" /></bezel> + + <bezel element="black"><bounds x="2.5" y="73" width="10.5" height="10.5" /></bezel> + <bezel element="black"><bounds x="23" y="73" width="10" height="10.5" /></bezel> + <bezel element="black"><bounds x="43" y="73" width="10" height="10.5" /></bezel> + <bezel element="black"><bounds x="63" y="73" width="10" height="10.5" /></bezel> + + <!-- chessboard leds --> + + <bezel name="7.7" element="led"><bounds x=" 3.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.6" element="led"><bounds x="13.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.5" element="led"><bounds x="23.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.4" element="led"><bounds x="33.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.3" element="led"><bounds x="43.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.2" element="led"><bounds x="53.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.1" element="led"><bounds x="63.2" y="11.3" width="1.5" height="1.5" /></bezel> + <bezel name="7.0" element="led"><bounds x="73.2" y="11.3" width="1.5" height="1.5" /></bezel> + + <bezel name="6.7" element="led"><bounds x=" 3.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.6" element="led"><bounds x="13.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.5" element="led"><bounds x="23.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.4" element="led"><bounds x="33.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.3" element="led"><bounds x="43.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.2" element="led"><bounds x="53.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.1" element="led"><bounds x="63.2" y="21.3" width="1.5" height="1.5" /></bezel> + <bezel name="6.0" element="led"><bounds x="73.2" y="21.3" width="1.5" height="1.5" /></bezel> + + <bezel name="5.7" element="led"><bounds x=" 3.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.6" element="led"><bounds x="13.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.5" element="led"><bounds x="23.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.4" element="led"><bounds x="33.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.3" element="led"><bounds x="43.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.2" element="led"><bounds x="53.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.1" element="led"><bounds x="63.2" y="31.3" width="1.5" height="1.5" /></bezel> + <bezel name="5.0" element="led"><bounds x="73.2" y="31.3" width="1.5" height="1.5" /></bezel> + + <bezel name="4.7" element="led"><bounds x=" 3.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.6" element="led"><bounds x="13.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.5" element="led"><bounds x="23.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.4" element="led"><bounds x="33.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.3" element="led"><bounds x="43.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.2" element="led"><bounds x="53.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.1" element="led"><bounds x="63.2" y="41.3" width="1.5" height="1.5" /></bezel> + <bezel name="4.0" element="led"><bounds x="73.2" y="41.3" width="1.5" height="1.5" /></bezel> + + <bezel name="3.7" element="led"><bounds x=" 3.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.6" element="led"><bounds x="13.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.5" element="led"><bounds x="23.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.4" element="led"><bounds x="33.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.3" element="led"><bounds x="43.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.2" element="led"><bounds x="53.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.1" element="led"><bounds x="63.2" y="51.3" width="1.5" height="1.5" /></bezel> + <bezel name="3.0" element="led"><bounds x="73.2" y="51.3" width="1.5" height="1.5" /></bezel> + + <bezel name="2.7" element="led"><bounds x=" 3.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.6" element="led"><bounds x="13.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.5" element="led"><bounds x="23.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.4" element="led"><bounds x="33.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.3" element="led"><bounds x="43.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.2" element="led"><bounds x="53.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.1" element="led"><bounds x="63.2" y="61.3" width="1.5" height="1.5" /></bezel> + <bezel name="2.0" element="led"><bounds x="73.2" y="61.3" width="1.5" height="1.5" /></bezel> + + <bezel name="1.7" element="led"><bounds x=" 3.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.6" element="led"><bounds x="13.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.5" element="led"><bounds x="23.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.4" element="led"><bounds x="33.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.3" element="led"><bounds x="43.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.2" element="led"><bounds x="53.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.1" element="led"><bounds x="63.2" y="71.3" width="1.5" height="1.5" /></bezel> + <bezel name="1.0" element="led"><bounds x="73.2" y="71.3" width="1.5" height="1.5" /></bezel> + + <bezel name="0.7" element="led"><bounds x=" 3.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.6" element="led"><bounds x="13.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.5" element="led"><bounds x="23.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.4" element="led"><bounds x="33.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.3" element="led"><bounds x="43.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.2" element="led"><bounds x="53.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.1" element="led"><bounds x="63.2" y="81.3" width="1.5" height="1.5" /></bezel> + <bezel name="0.0" element="led"><bounds x="73.2" y="81.3" width="1.5" height="1.5" /></bezel> + + <!-- chessboard sensors --> + + <bezel element="hl" inputtag="IN.7" inputmask="0x80"><bounds x="3" y="3" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x40"><bounds x="13" y="3" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x20"><bounds x="23" y="3" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x10"><bounds x="33" y="3" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x08"><bounds x="43" y="3" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x04"><bounds x="53" y="3" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x02"><bounds x="63" y="3" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.7" inputmask="0x01"><bounds x="73" y="3" width="10" height="10" /><color alpha="0.2" /></bezel> + + <bezel element="hl" inputtag="IN.6" inputmask="0x80"><bounds x="3" y="13" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x40"><bounds x="13" y="13" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x20"><bounds x="23" y="13" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x10"><bounds x="33" y="13" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x08"><bounds x="43" y="13" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x04"><bounds x="53" y="13" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x02"><bounds x="63" y="13" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.6" inputmask="0x01"><bounds x="73" y="13" width="10" height="10" /><color alpha="0.4" /></bezel> + + <bezel element="hl" inputtag="IN.5" inputmask="0x80"><bounds x="3" y="23" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x40"><bounds x="13" y="23" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x20"><bounds x="23" y="23" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x10"><bounds x="33" y="23" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x08"><bounds x="43" y="23" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x04"><bounds x="53" y="23" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x02"><bounds x="63" y="23" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.5" inputmask="0x01"><bounds x="73" y="23" width="10" height="10" /><color alpha="0.2" /></bezel> + + <bezel element="hl" inputtag="IN.4" inputmask="0x80"><bounds x="3" y="33" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x40"><bounds x="13" y="33" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x20"><bounds x="23" y="33" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x10"><bounds x="33" y="33" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x08"><bounds x="43" y="33" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x04"><bounds x="53" y="33" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x02"><bounds x="63" y="33" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.4" inputmask="0x01"><bounds x="73" y="33" width="10" height="10" /><color alpha="0.4" /></bezel> + + <bezel element="hl" inputtag="IN.3" inputmask="0x80"><bounds x="3" y="43" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x40"><bounds x="13" y="43" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x20"><bounds x="23" y="43" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x10"><bounds x="33" y="43" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x08"><bounds x="43" y="43" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x04"><bounds x="53" y="43" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x02"><bounds x="63" y="43" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.3" inputmask="0x01"><bounds x="73" y="43" width="10" height="10" /><color alpha="0.2" /></bezel> + + <bezel element="hl" inputtag="IN.2" inputmask="0x80"><bounds x="3" y="53" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x40"><bounds x="13" y="53" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x20"><bounds x="23" y="53" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x10"><bounds x="33" y="53" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x08"><bounds x="43" y="53" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x04"><bounds x="53" y="53" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x02"><bounds x="63" y="53" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.2" inputmask="0x01"><bounds x="73" y="53" width="10" height="10" /><color alpha="0.4" /></bezel> + + <bezel element="hl" inputtag="IN.1" inputmask="0x80"><bounds x="3" y="63" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x40"><bounds x="13" y="63" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x20"><bounds x="23" y="63" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x10"><bounds x="33" y="63" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x08"><bounds x="43" y="63" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x04"><bounds x="53" y="63" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x02"><bounds x="63" y="63" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.1" inputmask="0x01"><bounds x="73" y="63" width="10" height="10" /><color alpha="0.2" /></bezel> + + <bezel element="hl" inputtag="IN.0" inputmask="0x80"><bounds x="3" y="73" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x40"><bounds x="13" y="73" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x20"><bounds x="23" y="73" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x10"><bounds x="33" y="73" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x08"><bounds x="43" y="73" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x04"><bounds x="53" y="73" width="10" height="10" /><color alpha="0.4" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x02"><bounds x="63" y="73" width="10" height="10" /><color alpha="0.2" /></bezel> + <bezel element="hl" inputtag="IN.0" inputmask="0x01"><bounds x="73" y="73" width="10" height="10" /><color alpha="0.4" /></bezel> + + <!-- lcd panel --> + + <screen index="0"> + <bounds x="86.5" y="9.5" width="24.25" height="2.5" /> + </screen> + + <bezel element="static_lcd"><bounds x="86" y="8.5" width="25.25" height="1.1" /></bezel> + <bezel element="static_lcd"><bounds x="86" y="11.9" width="25.25" height="1.1" /></bezel> + <bezel element="static_lcd"><bounds x="86" y="8.5" width="0.6" height="3.5" /></bezel> + <bezel element="static_lcd"><bounds x="110.65" y="8.5" width="0.6" height="3.5" /></bezel> + + <!-- right side buttons --> + + <bezel element="but" inputtag="IN.7" inputmask="0x400"><bounds x="87.75" y="24.00" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.6" inputmask="0x400"><bounds x="87.75" y="31.71" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.5" inputmask="0x400"><bounds x="87.75" y="39.43" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.4" inputmask="0x400"><bounds x="87.75" y="47.14" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.3" inputmask="0x400"><bounds x="87.75" y="54.86" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.2" inputmask="0x400"><bounds x="87.75" y="62.57" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.1" inputmask="0x400"><bounds x="87.75" y="70.29" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.0" inputmask="0x400"><bounds x="87.75" y="78.00" width="2.5" height="2.5" /></bezel> + + <bezel element="but" inputtag="IN.7" inputmask="0x200"><bounds x="97.38" y="24.00" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.6" inputmask="0x200"><bounds x="97.38" y="31.71" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.5" inputmask="0x200"><bounds x="97.38" y="39.43" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.4" inputmask="0x200"><bounds x="97.38" y="47.14" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.3" inputmask="0x200"><bounds x="97.38" y="54.86" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.2" inputmask="0x200"><bounds x="97.38" y="62.57" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.1" inputmask="0x200"><bounds x="97.38" y="70.29" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.0" inputmask="0x200"><bounds x="97.38" y="78.00" width="2.5" height="2.5" /></bezel> + + <bezel element="but" inputtag="IN.7" inputmask="0x100"><bounds x="107.00" y="24.00" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.6" inputmask="0x100"><bounds x="107.00" y="31.71" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.5" inputmask="0x100"><bounds x="107.00" y="39.43" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.4" inputmask="0x100"><bounds x="107.00" y="47.14" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.3" inputmask="0x100"><bounds x="107.00" y="54.86" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.2" inputmask="0x100"><bounds x="107.00" y="62.57" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.1" inputmask="0x100"><bounds x="107.00" y="70.29" width="2.5" height="2.5" /></bezel> + <bezel element="but" inputtag="IN.0" inputmask="0x100"><bounds x="107.00" y="78.00" width="2.5" height="2.5" /></bezel> + + <bezel element="text_king"><bounds x="100.38" y="23.50" width="3" height="3" /></bezel> + <bezel element="text_queen"><bounds x="100.38" y="31.21" width="3" height="3" /></bezel> + <bezel element="text_bishop"><bounds x="100.38" y="38.93" width="3" height="3" /></bezel> + <bezel element="text_knight"><bounds x="100.38" y="46.64" width="3" height="3" /></bezel> + <bezel element="text_rook"><bounds x="100.38" y="54.36" width="3" height="3" /></bezel> + <bezel element="text_pawn"><bounds x="100.38" y="62.07" width="3" height="3" /></bezel> + + <bezel element="text_l1a"><bounds x="82" y="22.35" width="14" height="1.4" /></bezel> + <bezel element="text_l1b"><bounds x="82" y="26.70" width="14" height="1.4" /></bezel> + <bezel element="text_l2a"><bounds x="82" y="30.06" width="14" height="1.4" /></bezel> + <bezel element="text_l2b"><bounds x="82" y="34.41" width="14" height="1.4" /></bezel> + <bezel element="text_l3a"><bounds x="82" y="37.78" width="14" height="1.4" /></bezel> + <bezel element="text_l3b"><bounds x="82" y="42.13" width="14" height="1.4" /></bezel> + <bezel element="text_l3bx"><bounds x="82" y="43.53" width="14" height="1.4" /></bezel> + <bezel element="text_l4a"><bounds x="82" y="45.49" width="14" height="1.4" /></bezel> + <bezel element="text_l4b"><bounds x="82" y="49.84" width="14" height="1.4" /></bezel> + <bezel element="text_l5a"><bounds x="82" y="53.21" width="14" height="1.4" /></bezel> + <bezel element="text_l5b"><bounds x="82" y="57.56" width="14" height="1.4" /></bezel> + <bezel element="text_l6a"><bounds x="82" y="60.92" width="14" height="1.4" /></bezel> + <bezel element="text_l6b"><bounds x="82" y="65.27" width="14" height="1.4" /></bezel> + <bezel element="text_l7a"><bounds x="82" y="68.64" width="14" height="1.4" /></bezel> + <bezel element="text_l7b"><bounds x="82" y="72.99" width="14" height="1.4" /></bezel> + <bezel element="text_l8a"><bounds x="82" y="76.35" width="14" height="1.4" /></bezel> + <bezel element="text_l8b"><bounds x="82" y="80.70" width="14" height="1.4" /></bezel> + + <bezel element="text_m1ax"><bounds x="91.63" y="20.95" width="14" height="1.4" /></bezel> + <bezel element="text_m1a"><bounds x="91.63" y="22.35" width="14" height="1.4" /></bezel> + <bezel element="text_m1b"><bounds x="91.63" y="26.70" width="14" height="1.4" /></bezel> + <bezel element="text_m2a"><bounds x="91.63" y="30.06" width="14" height="1.4" /></bezel> + <bezel element="text_m2b"><bounds x="91.63" y="34.41" width="14" height="1.4" /></bezel> + <bezel element="text_m3a"><bounds x="91.63" y="37.78" width="14" height="1.4" /></bezel> + <bezel element="text_m3b"><bounds x="91.63" y="42.13" width="14" height="1.4" /></bezel> + <bezel element="text_m4ax"><bounds x="91.63" y="44.09" width="14" height="1.4" /></bezel> + <bezel element="text_m4a"><bounds x="91.63" y="45.49" width="14" height="1.4" /></bezel> + <bezel element="text_m4b"><bounds x="91.63" y="49.84" width="14" height="1.4" /></bezel> + <bezel element="text_m5a"><bounds x="91.63" y="53.21" width="14" height="1.4" /></bezel> + <bezel element="text_m5b"><bounds x="91.63" y="57.56" width="14" height="1.4" /></bezel> + <bezel element="text_m6a"><bounds x="91.63" y="60.92" width="14" height="1.4" /></bezel> + <bezel element="text_m6b"><bounds x="91.63" y="65.27" width="14" height="1.4" /></bezel> + <bezel element="text_m6bx"><bounds x="91.63" y="66.67" width="14" height="1.4" /></bezel> + <bezel element="text_m7a"><bounds x="91.63" y="68.64" width="14" height="1.4" /></bezel> + <bezel element="text_m7b"><bounds x="91.63" y="72.99" width="14" height="1.4" /></bezel> + <bezel element="text_m8a"><bounds x="91.63" y="76.35" width="14" height="1.4" /></bezel> + <bezel element="text_m8b"><bounds x="91.63" y="80.70" width="14" height="1.4" /></bezel> + + <bezel element="text_r1a"><bounds x="101.25" y="22.35" width="14" height="1.4" /></bezel> + <bezel element="text_r1b"><bounds x="101.25" y="26.70" width="14" height="1.4" /></bezel> + <bezel element="text_r2a"><bounds x="101.25" y="30.06" width="14" height="1.4" /></bezel> + <bezel element="text_r2b"><bounds x="101.25" y="34.41" width="14" height="1.4" /></bezel> + <bezel element="text_r2bx"><bounds x="101.25" y="35.81" width="14" height="1.4" /></bezel> + <bezel element="text_r3a"><bounds x="101.25" y="37.78" width="14" height="1.4" /></bezel> + <bezel element="text_r3b"><bounds x="101.25" y="42.13" width="14" height="1.4" /></bezel> + <bezel element="text_r4a"><bounds x="101.25" y="45.49" width="14" height="1.4" /></bezel> + <bezel element="text_r4b"><bounds x="101.25" y="49.84" width="14" height="1.4" /></bezel> + <bezel element="text_r5a"><bounds x="101.25" y="53.21" width="14" height="1.4" /></bezel> + <bezel element="text_r5b"><bounds x="101.25" y="57.56" width="14" height="1.4" /></bezel> + <bezel element="text_r6a"><bounds x="101.25" y="60.92" width="14" height="1.4" /></bezel> + <bezel element="text_r6b"><bounds x="101.25" y="65.27" width="14" height="1.4" /></bezel> + <bezel element="text_r7a"><bounds x="101.25" y="68.64" width="14" height="1.4" /></bezel> + <bezel element="text_r7b"><bounds x="101.25" y="72.99" width="14" height="1.4" /></bezel> + <bezel element="text_r8a"><bounds x="101.25" y="76.35" width="14" height="1.4" /></bezel> + <bezel element="text_r8b"><bounds x="101.25" y="80.70" width="14" height="1.4" /></bezel> + + </view> +</mamelayout> diff --git a/src/mame/layout/polepos.lay b/src/mame/layout/polepos.lay index 50634fadfd5..91c82ed096b 100644 --- a/src/mame/layout/polepos.lay +++ b/src/mame/layout/polepos.lay @@ -52,7 +52,7 @@ <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <bezel element="shifter" inputtag="IN0L" inputmask="0x02"> + <bezel element="shifter" inputtag="IN0" inputmask="0x02"> <bounds x="606" y="414" width="32" height="64" /> <color alpha="0.6" /> </bezel> @@ -61,7 +61,7 @@ <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <bezel element="shifter" inputtag="IN0L" inputmask="0x02"> + <bezel element="shifter" inputtag="IN0" inputmask="0x02"> <bounds x="2" y="414" width="32" height="64" /> <color alpha="0.6" /> </bezel> diff --git a/src/mame/layout/polyplay.lay b/src/mame/layout/polyplay.lay new file mode 100644 index 00000000000..ef1ce3a1dff --- /dev/null +++ b/src/mame/layout/polyplay.lay @@ -0,0 +1,117 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + <element name="red1"> + <text state ="0" string="Y"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.3" green="0.1" blue="0.1" /> + </text> + <text state ="1" string="Y"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="1.0" green="0.1" blue="0.1" /> + </text> + </element> + <element name="blue1"> + <text state ="0" string="A"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.1" blue="0.3" /> + </text> + <text state ="1" string="A"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.1" blue="1.0" /> + </text> + </element> + <element name="yellow1"> + <text state ="0" string="L"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.3" green="0.3" blue="0.1" /> + </text> + <text state ="1" string="L"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="1.0" green="1.0" blue="0.1" /> + </text> + </element> + <element name="green1"> + <text state ="0" string="P"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.3" blue="0.1" /> + </text> + <text state ="1" string="P"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="1.0" blue="0.1" /> + </text> + </element> + <element name="red2"> + <text state ="0" string="Y"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.3" green="0.1" blue="0.1" /> + </text> + <text state ="1" string="Y"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="1.0" green="0.1" blue="0.1" /> + </text> + </element> + <element name="blue2"> + <text state ="0" string="L"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.1" blue="0.3" /> + </text> + <text state ="1" string="L"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.1" blue="1.0" /> + </text> + </element> + <element name="yellow2"> + <text state ="0" string="O"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.3" green="0.3" blue="0.1" /> + </text> + <text state ="1" string="O"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="1.0" green="1.0" blue="0.1" /> + </text> + </element> + <element name="green2"> + <text state ="0" string="P"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="0.3" blue="0.1" /> + </text> + <text state ="1" string="P"> + <bounds x="0" y="0" width="7" height="7" /> + <color red="0.1" green="1.0" blue="0.1" /> + </text> + </element> + <view name="Screen only"> + <screen index="0"> + <bounds x="0" y="0" width="4" height="3" /> + </screen> + </view> + <view name="Screen + Lights"> + <backdrop name="lamp1" element="red1" state="0"> + <bounds x="7" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp2" element="blue1" state="0"> + <bounds x="6" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp3" element="yellow1" state="0"> + <bounds x="5" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp4" element="green1" state="0"> + <bounds x="4" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp1" element="red2" state="0"> + <bounds x="3" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp2" element="blue2" state="0"> + <bounds x="2" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp3" element="yellow2" state="0"> + <bounds x="1" y="0" width="1" height="1"/> + </backdrop> + <backdrop name="lamp4" element="green2" state="0"> + <bounds x="0" y="0" width="1" height="1"/> + </backdrop> + <screen index="0"> + <bounds x="0" y="1" width="8" height="6" /> + </screen> + </view> +</mamelayout>
\ No newline at end of file diff --git a/src/mame/machine/alpha8201.cpp b/src/mame/machine/alpha8201.cpp index 852d4eaadd0..1acaf966405 100644 --- a/src/mame/machine/alpha8201.cpp +++ b/src/mame/machine/alpha8201.cpp @@ -282,7 +282,7 @@ const device_type ALPHA_8201 = &device_creator<alpha_8201_device>; // alpha_8201_device - constructor //------------------------------------------------- -alpha_8201_device::alpha_8201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +alpha_8201_device::alpha_8201_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, ALPHA_8201, "ALPHA-8201", tag, owner, clock, "alpha8201", __FILE__), m_mcu(*this, "mcu") { @@ -295,7 +295,7 @@ alpha_8201_device::alpha_8201_device(const machine_config &mconfig, const char * void alpha_8201_device::device_start() { - m_shared_ram = make_unique_clear<uint8_t[]>(0x400); + m_shared_ram = make_unique_clear<u8[]>(0x400); // zerofill m_bus = 0; @@ -364,7 +364,7 @@ void alpha_8201_device::mcu_update_address() READ8_MEMBER(alpha_8201_device::mcu_data_r) { - uint8_t ret = 0; + u8 ret = 0; if (m_bus && ~m_mcu_d & 4) ret = m_shared_ram[m_mcu_address]; diff --git a/src/mame/machine/alpha8201.h b/src/mame/machine/alpha8201.h index 241a6d1c3bb..9d13dba6d96 100644 --- a/src/mame/machine/alpha8201.h +++ b/src/mame/machine/alpha8201.h @@ -14,7 +14,7 @@ class alpha_8201_device : public device_t { public: - alpha_8201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + alpha_8201_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); ~alpha_8201_device() {} DECLARE_READ8_MEMBER(mcu_data_r); @@ -38,11 +38,11 @@ private: required_device<cpu_device> m_mcu; // internal state - int m_bus; // shared RAM bus direction - uint16_t m_mcu_address; // MCU side RAM address - uint16_t m_mcu_d; // MCU D output data - uint8_t m_mcu_r[4]; // MCU R0-R3 output data - std::unique_ptr<uint8_t[]> m_shared_ram; // 1KB RAM + int m_bus; // shared RAM bus direction + u16 m_mcu_address; // MCU side RAM address + u16 m_mcu_d; // MCU D output data + u8 m_mcu_r[4]; // MCU R0-R3 output data + std::unique_ptr<u8[]> m_shared_ram; // 1KB RAM void mcu_update_address(); void mcu_writeram(); diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp index 4b383a4a165..7eb00839867 100644 --- a/src/mame/machine/amiga.cpp +++ b/src/mame/machine/amiga.cpp @@ -188,7 +188,7 @@ WRITE_LINE_MEMBER( amiga_state::kbreset_w ) // this is connected to the gary chip, gary then resets the 68k, agnus, paula and the cias if (!state) { - m_sound->reset(); + m_paula->reset(); machine_reset(); m_maincpu->reset(); } @@ -293,7 +293,7 @@ TIMER_CALLBACK_MEMBER( amiga_state::scanline_callback ) m_cia_1->tod_w((scanline & 1) ^ BIT(CUSTOM_REG(REG_VPOSR), 15)); // force a sound update - m_sound->update(); + m_paula->update(); // set timer for next line scanline = (scanline + 1) % m_screen->height(); @@ -373,6 +373,11 @@ TIMER_CALLBACK_MEMBER( amiga_state::amiga_irq_proc ) m_irq_timer->reset(); } +WRITE_LINE_MEMBER( amiga_state::paula_int_w ) +{ + set_interrupt(INTENA_SETCLR | (0x80 << state)); +} + //************************************************************************** // INPUTS @@ -1267,6 +1272,9 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) if (LOG_CUSTOM) logerror("%06X:write to custom %s = %04X\n", space.device().safe_pc(), amiga_custom_names[offset & 0xff], data); + // paula will handle some of those registers + m_paula->reg_w(space, offset, data, mem_mask); + switch (offset) { case REG_BLTDDAT: case REG_DMACONR: case REG_VPOSR: case REG_VHPOSR: @@ -1427,8 +1435,6 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) break; case REG_DMACON: - m_sound->update(); - /* bits BBUSY (14) and BZERO (13) are read-only */ data &= 0x9fff; data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); @@ -1480,22 +1486,10 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) break; case REG_ADKCON: - m_sound->update(); data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); m_fdc->adkcon_set(data); break; - case REG_AUD0LCL: case REG_AUD0LCH: case REG_AUD0LEN: case REG_AUD0PER: case REG_AUD0VOL: - case REG_AUD1LCL: case REG_AUD1LCH: case REG_AUD1LEN: case REG_AUD1PER: case REG_AUD1VOL: - case REG_AUD2LCL: case REG_AUD2LCH: case REG_AUD2LEN: case REG_AUD2PER: case REG_AUD2VOL: - case REG_AUD3LCL: case REG_AUD3LCH: case REG_AUD3LEN: case REG_AUD3PER: case REG_AUD3VOL: - m_sound->update(); - break; - - case REG_AUD0DAT: case REG_AUD1DAT: case REG_AUD2DAT: case REG_AUD3DAT: - m_sound->data_w((offset - REG_AUD0DAT) / 8, data); - break; - case REG_BPL1PTH: case REG_BPL2PTH: case REG_BPL3PTH: case REG_BPL4PTH: case REG_BPL5PTH: case REG_BPL6PTH: data &= ( m_chip_ram_mask >> 16 ); @@ -1575,7 +1569,7 @@ void amiga_state::serial_adjust() amiga_state *state = this; uint32_t divisor = (CUSTOM_REG(REG_SERPER) & 0x7fff) + 1; - uint32_t baud = m_sound->clock() / divisor; + uint32_t baud = m_paula->clock() / divisor; m_serial_timer->adjust(attotime::from_hz(baud) / 2, 0, attotime::from_hz(baud)); } diff --git a/src/mame/machine/amigakbd.cpp b/src/mame/machine/amigakbd.cpp deleted file mode 100644 index 21d1c11d71e..00000000000 --- a/src/mame/machine/amigakbd.cpp +++ /dev/null @@ -1,574 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Amiga Keyboard - - We currently emulate the Amiga 500 keyboard controller, which was - also used in later Amiga 2000 keyboards. - - TODO: - Natural keyboard mode doesn't work with shifted characters, - they get sent in the wrong order (core bug?) - - Move 6500/1 to its own CPU core so that it can be shared with - other systems - - Add support for more keyboard controllers (pending on them - getting dumped) - - Amiga 1000 keyboard part numbers (manufactured by Mitsumi): - - - 327063-01 R56-2144 English - - 327063-02 British - - 327063-03 R56-2153 German - - 327063-04 R56-2152 French - - 327063-05 R56-2154 Italian - -***************************************************************************/ - -#include "amigakbd.h" -#include "machine/rescap.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type AMIGAKBD = &device_creator<amigakbd_device>; - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, amigakbd_device ) - ADDRESS_MAP_GLOBAL_MASK(0xfff) - AM_RANGE(0x000, 0x03f) AM_RAM - AM_RANGE(0x080, 0x080) AM_READWRITE(port_a_r, port_a_w) - AM_RANGE(0x081, 0x081) AM_READ_PORT("special") AM_WRITE(port_b_w) - AM_RANGE(0x082, 0x082) AM_WRITE(port_c_w) - AM_RANGE(0x083, 0x083) AM_WRITE(port_d_w) - AM_RANGE(0x084, 0x085) AM_WRITE(latch_w) - AM_RANGE(0x086, 0x087) AM_READ(counter_r) - AM_RANGE(0x088, 0x088) AM_WRITE(transfer_latch_w) - AM_RANGE(0x089, 0x089) AM_WRITE(clear_pa0_detect) - AM_RANGE(0x08a, 0x08a) AM_WRITE(clear_pa1_detect) - AM_RANGE(0x08f, 0x08f) AM_READWRITE(control_r, control_w) - AM_RANGE(0x090, 0x0ff) AM_NOP - AM_RANGE(0x800, 0xfff) AM_ROM AM_REGION("mos6570_036", 0) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( a500_keyboard ) - MCFG_CPU_ADD("mos6570_036", M6502, XTAL_3MHz / 2) - MCFG_CPU_PROGRAM_MAP(mpu6500_map) -MACHINE_CONFIG_END - -machine_config_constructor amigakbd_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( a500_keyboard ); -} - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -ROM_START( mos6570_036 ) - ROM_REGION(0x800, "mos6570_036", 0) - ROM_LOAD("328191-02.ic1", 0x000, 0x800, CRC(4a3fc332) SHA1(83b21d0c8b93fc9b9b3b287fde4ec8f3badac5a2)) -ROM_END - -const tiny_rom_entry *amigakbd_device::device_rom_region() const -{ - return ROM_NAME( mos6570_036 ); -} - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( a500_us_keyboard ) - PORT_START("special") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, nullptr) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, nullptr) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, nullptr) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("row_d6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Unused") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_NAME("Caps Lock") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("(") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME(")") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Unused") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("Help") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -ioport_constructor amigakbd_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( a500_us_keyboard ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// amigakbd_device - constructor -//------------------------------------------------- - -amigakbd_device::amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, AMIGAKBD, "Amiga 500 Keyboard with 6570-036 MPU", tag, owner, clock, "amigakbd", __FILE__), - m_write_kclk(*this), - m_write_kdat(*this), - m_write_krst(*this), - m_mpu(*this, "mos6570_036"), - m_special(*this, "special"), - m_row_d6(*this, "row_d6"), - m_row_d5(*this, "row_d5"), - m_row_d4(*this, "row_d4"), - m_row_d3(*this, "row_d3"), - m_row_d2(*this, "row_d2"), - m_row_d1(*this, "row_d1"), - m_row_d0(*this, "row_d0"), - m_row_c7(*this, "row_c7"), - m_row_c6(*this, "row_c6"), - m_row_c5(*this, "row_c5"), - m_row_c4(*this, "row_c4"), - m_row_c3(*this, "row_c3"), - m_row_c2(*this, "row_c2"), - m_row_c1(*this, "row_c1"), - m_row_c0(*this, "row_c0"), - m_timer(nullptr), - m_watchdog(nullptr), - m_reset(nullptr), - m_kdat(1), - m_kclk(1), - m_port_c(0xff), - m_port_d(0xff), - m_latch(0xffff), - m_counter(0xffff), - m_control(0x00) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void amigakbd_device::device_start() -{ - // resolve callbacks - m_write_kclk.resolve_safe(); - m_write_kdat.resolve_safe(); - m_write_krst.resolve_safe(); - - // allocate timers - m_timer = timer_alloc(0, nullptr); - m_watchdog = timer_alloc(1, nullptr); - m_reset = timer_alloc(2, nullptr); - - // register for save states - save_item(NAME(m_kdat)); - save_item(NAME(m_kclk)); - save_item(NAME(m_port_c)); - save_item(NAME(m_port_d)); - save_item(NAME(m_latch)); - save_item(NAME(m_counter)); - save_item(NAME(m_control)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void amigakbd_device::device_reset() -{ - // stack starts 0 - m_mpu->set_state_int(M6502_S, 0); - - m_kdat = 1; - m_kclk = 1; - m_port_c = 0xff; - m_port_d = 0xff; - m_latch = 0xffff; // not initialized by hardware - m_counter = 0xffff; // not initialized by hardware - m_control = 0x00; - - m_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_3MHz / 2)); - m_watchdog->adjust(attotime::from_msec(54)); -} - -void amigakbd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) -{ - switch (tid) - { - // 6500/1 internal timer - case 0: - switch (m_control & 0x03) - { - // interval timer, pulse width measurement (connected to gnd here) - case 0: - case 3: - if (m_counter-- == 0) - { - // counter overflow - m_control |= COUNTER_OVERFLOW; - m_counter = m_latch; - - // generate interrupt? - update_irqs(); - } - break; - - // pulse generator - case 1: - break; - - // event counter - case 2: - break; - } - break; - - // watchdog - case 1: - m_mpu->reset(); - m_watchdog->adjust(attotime::from_msec(54)); - break; - - // keyboard reset timer - case 2: - m_write_krst(1); - break; - } -} - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -INPUT_CHANGED_MEMBER( amigakbd_device::check_reset ) -{ - uint8_t keys = m_special->read(); - - // ctrl-amiga-amiga pressed? - if (!BIT(keys, 6) && !BIT(keys, 3) && !BIT(keys, 2)) - { - m_write_krst(0); - m_reset->adjust(PERIOD_OF_555_MONOSTABLE(RES_K(47), CAP_U(10))); - } -} - -void amigakbd_device::update_irqs() -{ - if ((m_control & PA1_INT_ENABLED) && (m_control & PA1_NEGATIVE_EDGE)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else if ((m_control & PA0_INT_ENABLED) && (m_control & PA0_POSITIVE_EDGE)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else if ((m_control & COUNTER_INT_ENABLED) && (m_control & COUNTER_OVERFLOW)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else - m_mpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); -} - -READ8_MEMBER( amigakbd_device::port_a_r ) -{ - uint8_t data = 0xfc; - - // kdat & kclk - data |= m_kdat << 0; - data |= m_kclk << 1; - - // port d rows - if (!BIT(m_port_d, 6)) data &= m_row_d6->read(); - if (!BIT(m_port_d, 5)) data &= m_row_d5->read(); - if (!BIT(m_port_d, 4)) data &= m_row_d4->read(); - if (!BIT(m_port_d, 3)) data &= m_row_d3->read(); - if (!BIT(m_port_d, 2)) data &= m_row_d2->read(); - if (!BIT(m_port_d, 1)) data &= m_row_d1->read(); - if (!BIT(m_port_d, 0)) data &= m_row_d0->read(); - - // port c rows - if (!BIT(m_port_c, 7)) data &= m_row_c7->read(); - if (!BIT(m_port_c, 6)) data &= m_row_c6->read(); - if (!BIT(m_port_c, 5)) data &= m_row_c5->read(); - if (!BIT(m_port_c, 4)) data &= m_row_c4->read(); - if (!BIT(m_port_c, 3)) data &= m_row_c3->read(); - if (!BIT(m_port_c, 2)) data &= m_row_c2->read(); - if (!BIT(m_port_c, 1)) data &= m_row_c1->read(); - if (!BIT(m_port_c, 0)) data &= m_row_c0->read(); - - return data; -} - -WRITE8_MEMBER( amigakbd_device::port_a_w ) -{ - // look for pa0 edge - if (!m_kdat && BIT(data, 0)) - { - m_control |= PA0_POSITIVE_EDGE; - update_irqs(); - } - - // and pa1 edge - if (m_kclk && !BIT(data, 1)) - { - m_control |= PA1_NEGATIVE_EDGE; - update_irqs(); - } - - // update with new values and output - if (m_kdat != BIT(data, 0)) - { - m_kdat = BIT(data, 0); - m_write_kdat(m_kdat); - } - - if (m_kclk != BIT(data, 1)) - { - m_kclk = BIT(data, 1); - m_write_kclk(m_kclk); - } -} - -WRITE8_MEMBER( amigakbd_device::port_b_w ) -{ - // caps lock led - machine().output().set_value("led0", BIT(data, 7)); -} - -WRITE8_MEMBER( amigakbd_device::port_c_w ) -{ - m_port_c = data; -} - -WRITE8_MEMBER( amigakbd_device::port_d_w ) -{ - // reset watchdog on 0 -> 1 transition - if (!BIT(m_port_d, 7) && BIT(data, 7)) - m_watchdog->adjust(attotime::from_msec(54)); - - m_port_d = data; -} - -WRITE8_MEMBER( amigakbd_device::latch_w ) -{ - if (offset == 0) - { - m_latch &= 0x00ff; - m_latch |= data << 8; - } - else - { - m_latch &= 0xff00; - m_latch |= data << 0; - } -} - -READ8_MEMBER( amigakbd_device::counter_r ) -{ - if (!space.debugger_access()) - { - m_control &= ~COUNTER_OVERFLOW; - update_irqs(); - } - - if (offset == 0) - return m_counter >> 8; - else - return m_counter >> 0; -} - -WRITE8_MEMBER( amigakbd_device::transfer_latch_w ) -{ - m_control &= ~COUNTER_OVERFLOW; - update_irqs(); - - m_latch &= 0x00ff; - m_latch |= data << 8; - - m_counter = m_latch; -} - -WRITE8_MEMBER( amigakbd_device::clear_pa0_detect ) -{ - m_control &= ~PA0_POSITIVE_EDGE; - update_irqs(); -} - -WRITE8_MEMBER( amigakbd_device::clear_pa1_detect ) -{ - m_control &= ~PA1_NEGATIVE_EDGE; - update_irqs(); -} - -READ8_MEMBER( amigakbd_device::control_r ) -{ - return m_control; -} - -WRITE8_MEMBER( amigakbd_device::control_w ) -{ - m_control = data; - update_irqs(); -} - -WRITE_LINE_MEMBER( amigakbd_device::kdat_w ) -{ - // detect positive edge - if (state && !m_kdat) - { - m_control |= PA0_POSITIVE_EDGE; - update_irqs(); - } - - m_kdat = state; -} diff --git a/src/mame/machine/amigakbd.h b/src/mame/machine/amigakbd.h deleted file mode 100644 index 687401a1c20..00000000000 --- a/src/mame/machine/amigakbd.h +++ /dev/null @@ -1,143 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Amiga Keyboard - - We currently emulate the Amiga 500 keyboard controller, which was - also used in later Amiga 2000 keyboards. - -***************************************************************************/ - -#pragma once - -#ifndef __AMIGAKBD_H__ -#define __AMIGAKBD_H__ - -#include "emu.h" -#include "cpu/m6502/m6502.h" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(_write) \ - devcb = &amigakbd_device::set_kclk_wr_callback(*device, DEVCB_##_write); - -#define MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(_write) \ - devcb = &amigakbd_device::set_kdat_wr_callback(*device, DEVCB_##_write); - -#define MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(_write) \ - devcb = &amigakbd_device::set_krst_wr_callback(*device, DEVCB_##_write); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> amigakbd_device - -class amigakbd_device : public device_t -{ -public: - // construction/destruction - amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - template<class _Object> static devcb_base &set_kclk_wr_callback(device_t &device, _Object object) - { return downcast<amigakbd_device &>(device).m_write_kclk.set_callback(object); } - template<class _Object> static devcb_base &set_kdat_wr_callback(device_t &device, _Object object) - { return downcast<amigakbd_device &>(device).m_write_kdat.set_callback(object); } - template<class _Object> static devcb_base &set_krst_wr_callback(device_t &device, _Object object) - { return downcast<amigakbd_device &>(device).m_write_krst.set_callback(object); } - - DECLARE_WRITE_LINE_MEMBER( kdat_w ); - - // 6500/1 internal - DECLARE_READ8_MEMBER( port_a_r ); - DECLARE_WRITE8_MEMBER( port_a_w ); - DECLARE_WRITE8_MEMBER( port_b_w ); - DECLARE_WRITE8_MEMBER( port_c_w ); - DECLARE_WRITE8_MEMBER( port_d_w ); - DECLARE_WRITE8_MEMBER( latch_w ); - DECLARE_READ8_MEMBER( counter_r ); - DECLARE_WRITE8_MEMBER( transfer_latch_w ); - DECLARE_WRITE8_MEMBER( clear_pa0_detect ); - DECLARE_WRITE8_MEMBER( clear_pa1_detect ); - DECLARE_READ8_MEMBER( control_r ); - DECLARE_WRITE8_MEMBER( control_w ); - - DECLARE_INPUT_CHANGED_MEMBER( check_reset ); - -protected: - // device-level overrides - virtual const tiny_rom_entry *device_rom_region() const override; - virtual machine_config_constructor device_mconfig_additions() const override; - virtual ioport_constructor device_input_ports() const override; - 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: - enum - { - // counter modes - COUNTER_INTERVAL = 0x00, - COUNTER_PULSE = 0x01, - COUNTER_EVENT = 0x02, - COUNTER_PWM = 0x03, - - // interrupt enables - PA1_INT_ENABLED = 0x04, - PA0_INT_ENABLED = 0x08, - COUNTER_INT_ENABLED = 0x10, - - // status - PA1_NEGATIVE_EDGE = 0x20, - PA0_POSITIVE_EDGE = 0x40, - COUNTER_OVERFLOW = 0x80 - }; - - void update_irqs(); - - devcb_write_line m_write_kclk; - devcb_write_line m_write_kdat; - devcb_write_line m_write_krst; - - required_device<m6502_device> m_mpu; - - required_ioport m_special; - required_ioport m_row_d6; - required_ioport m_row_d5; - required_ioport m_row_d4; - required_ioport m_row_d3; - required_ioport m_row_d2; - required_ioport m_row_d1; - required_ioport m_row_d0; - required_ioport m_row_c7; - required_ioport m_row_c6; - required_ioport m_row_c5; - required_ioport m_row_c4; - required_ioport m_row_c3; - required_ioport m_row_c2; - required_ioport m_row_c1; - required_ioport m_row_c0; - - emu_timer *m_timer; - emu_timer *m_watchdog; - emu_timer *m_reset; - - int m_kdat; - int m_kclk; - - uint8_t m_port_c; - uint8_t m_port_d; - uint16_t m_latch; - uint16_t m_counter; - uint8_t m_control; -}; - -// device type definition -extern const device_type AMIGAKBD; - -#endif // __AMIGAKBD_H__ diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp index 9d5b46951f3..38778054513 100644 --- a/src/mame/machine/archimds.cpp +++ b/src/mame/machine/archimds.cpp @@ -43,27 +43,20 @@ void archimedes_state::archimedes_request_irq_a(int mask) { m_ioc_regs[IRQ_STATUS_A] |= mask; - if (m_ioc_regs[IRQ_STATUS_A] & m_ioc_regs[IRQ_MASK_A]) - { + if ((m_ioc_regs[IRQ_STATUS_A] & m_ioc_regs[IRQ_MASK_A]) || (m_ioc_regs[IRQ_STATUS_B] & m_ioc_regs[IRQ_MASK_B])) m_maincpu->set_input_line(ARM_IRQ_LINE, ASSERT_LINE); - } - - if ((m_ioc_regs[IRQ_STATUS_A] & m_ioc_regs[IRQ_MASK_A]) == 0) - { + else m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); - } } void archimedes_state::archimedes_request_irq_b(int mask) { m_ioc_regs[IRQ_STATUS_B] |= mask; - if (m_ioc_regs[IRQ_STATUS_B] & m_ioc_regs[IRQ_MASK_B]) - { - generic_pulse_irq_line(*m_maincpu, ARM_IRQ_LINE, 1); - //m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); - //m_maincpu->set_input_line(ARM_IRQ_LINE, ASSERT_LINE); - } + if ((m_ioc_regs[IRQ_STATUS_A] & m_ioc_regs[IRQ_MASK_A]) || (m_ioc_regs[IRQ_STATUS_B] & m_ioc_regs[IRQ_MASK_B])) + m_maincpu->set_input_line(ARM_IRQ_LINE, ASSERT_LINE); + else + m_maincpu->set_input_line(ARM_IRQ_LINE, CLEAR_LINE); } void archimedes_state::archimedes_request_fiq(int mask) @@ -90,7 +83,7 @@ void archimedes_state::archimedes_clear_irq_a(int mask) void archimedes_state::archimedes_clear_irq_b(int mask) { m_ioc_regs[IRQ_STATUS_B] &= ~mask; - //archimedes_request_irq_b(0); + archimedes_request_irq_b(0); } void archimedes_state::archimedes_clear_fiq(int mask) diff --git a/src/mame/machine/cammu.cpp b/src/mame/machine/cammu.cpp new file mode 100644 index 00000000000..1ee7cdab38a --- /dev/null +++ b/src/mame/machine/cammu.cpp @@ -0,0 +1,181 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * An implementation of the Fairchild/Intergraph Cache and Memory Management Unit (CAMMU) designed for use with the CLIPPER CPU family. + * + * Primary reference: http://bitsavers.trailing-edge.com/pdf/fairchild/clipper/CLIPPER%20C300%2032-Bit%20Compute%20Engine.pdf + * Another reference: http://www.eecs.berkeley.edu/Pubs/TechRpts/1986/CSD-86-289.pdf + * + * This implementation is currently at a very early stage, and is only sufficient to handle the bare minimum of boot/diagnostic code. + * + * TODO + * - almost everything + * - map registers + * - refactor hardware tlb + * - address translation + * - faults + * - tlb + * - cache + * - bus errors + */ + +#include "cammu.h" + +#define VERBOSE 0 + +// each variant of the cammu has different registers and a different addressing map +// TODO: decode the cammu registers properly +DEVICE_ADDRESS_MAP_START(map, 32, cammu_c4t_device) + AM_RANGE(0x000, 0xfff) AM_READWRITE(cammu_r, cammu_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(map, 32, cammu_c4i_device) + AM_RANGE(0x000, 0xfff) AM_READWRITE(cammu_r, cammu_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(map, 32, cammu_c3_device) + AM_RANGE(0x000, 0xfff) AM_READWRITE(cammu_r, cammu_w) +ADDRESS_MAP_END + +const device_type CAMMU_C4T = &device_creator<cammu_c4t_device>; +const device_type CAMMU_C4I = &device_creator<cammu_c4i_device>; +const device_type CAMMU_C3 = &device_creator<cammu_c3_device>; + +cammu_c4t_device::cammu_c4t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cammu_device(mconfig, CAMMU_C4T, "C4E/C4T CAMMU", tag, owner, clock, "C4T", __FILE__) { } + +cammu_c4i_device::cammu_c4i_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cammu_device(mconfig, CAMMU_C4I, "C4I CAMMU", tag, owner, clock, "C4I", __FILE__) { } + +cammu_c3_device::cammu_c3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cammu_device(mconfig, CAMMU_C4T, "C1/C3 CAMMU", tag, owner, clock, "C3", __FILE__) { } + +cammu_device::cammu_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) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_memory_interface(mconfig, *this), + m_main_space_config("main", ENDIANNESS_LITTLE, 32, 32, 0), + m_io_space_config("io", ENDIANNESS_LITTLE, 32, 32, 0), + m_boot_space_config("boot", ENDIANNESS_LITTLE, 32, 32, 0), + m_main_space(nullptr), + m_io_space(nullptr), + m_boot_space(nullptr), + m_ssw_func(*this) +{ } + +void cammu_device::device_start() +{ + m_ssw_func.resolve_safe(0); + + m_main_space = &space(AS_0); + m_io_space = &space(AS_1); + m_boot_space = &space(AS_2); +} + +void cammu_device::device_reset() +{ +} + +const address_space_config *cammu_device::memory_space_config (address_spacenum spacenum) const +{ + switch (spacenum) + { + case AS_0: return &m_main_space_config; + case AS_1: return &m_io_space_config; + case AS_2: return &m_boot_space_config; + default: break; + } + + return nullptr; +} + +READ32_MEMBER(cammu_device::mmu_r) +{ + u32 ssw = m_ssw_func(); + u32 address = offset << 2; + + // in supervisor mode, the first 8 pages are always mapped via the hard-wired tlb + if ((ssw & 0x40000000) == 0 && (address & ~0x7fff) == 0) + { + switch (address & 0xf000) + { + case 0x0000: + case 0x1000: + case 0x2000: + case 0x3000: + // pages 0-3: main space pages 0-3 + return m_main_space->read_dword(address, mem_mask); + + case 0x4000: + case 0x5000: + // pages 4-5: i/o space pages 0-1 + return m_io_space->read_dword(address & 0x1fff, mem_mask); + + case 0x6000: + case 0x7000: + // pages 6-7: boot space pages 0-1 + return m_boot_space->read_dword(address & 0x1fff, mem_mask); + } + } + + // FIXME: currently maps addresses with upper bits 0x00 or 0x7f1 to main memory and everything else to I/O + if ((address & 0xff000000) == 0x00000000 || (address & 0xfff00000) == 0x7f100000) + { +#ifdef ICACHE_ENTRIES + // if this is an instruction fetch, check the cache first + if (space.spacenum() == AS_PROGRAM) + { + if (m_icache[offset & (ICACHE_ENTRIES-1)].offset != offset) + { + m_icache[offset & (ICACHE_ENTRIES - 1)].offset = offset; + m_icache[offset & (ICACHE_ENTRIES - 1)].data = m_main_space->read_dword(address, mem_mask); + } + + return m_icache[offset & (ICACHE_ENTRIES - 1)].data; + } + else +#endif + return m_main_space->read_dword(address, mem_mask); + } + else + return m_io_space->read_dword(address, mem_mask); +} + +WRITE32_MEMBER(cammu_device::mmu_w) +{ + u32 ssw = m_ssw_func(); + u32 address = offset << 2; + + // in supervisor mode, the first 8 pages are always mapped via the hard-wired tlb + if ((ssw & 0x40000000) == 0 && (address & ~0x7fff) == 0) + { + switch (address & 0xf000) + { + case 0x0000: + case 0x1000: + case 0x2000: + case 0x3000: + // pages 0-3: main space pages 0-3 + m_main_space->write_dword(address, data, mem_mask); + return; + + case 0x4000: + case 0x5000: + // pages 4-5: i/o space pages 0-1 + m_io_space->write_dword(address & 0x1fff, data, mem_mask); + return; + + case 0x6000: + case 0x7000: + // pages 6-7: boot space pages 0-1 + m_boot_space->write_dword(address & 0x1fff, data, mem_mask); + return; + } + } + + // FIXME: currently maps addresses with upper bits 0x00 or 0x7f1 to main memory and everything else to I/O + if ((address & 0xff000000) == 0x00000000 || (address & 0xfff00000) == 0x7f100000) + m_main_space->write_dword(address, data, mem_mask); + else + m_io_space->write_dword(address, data, mem_mask); +} diff --git a/src/mame/machine/cammu.h b/src/mame/machine/cammu.h new file mode 100644 index 00000000000..a00208efbb5 --- /dev/null +++ b/src/mame/machine/cammu.h @@ -0,0 +1,91 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#pragma once + +#ifndef CAMMU_H_ +#define CAMMU_H_ + +#include "emu.h" + +// the following enables a very crude instruction cache - it has known (future) +// problems, but speeds up cpu execution quite noticeably in the short term by +// avoiding some of the delays in the mame memory subsystem +#define ICACHE_ENTRIES 32768 + +#define MCFG_CAMMU_SSW_CB(_sswcb) \ + devcb = &cammu_device::static_set_ssw_callback(*device, DEVCB_##_sswcb); + +class cammu_device : public device_t, public device_memory_interface +{ +public: + cammu_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); + + template<class _Object> static devcb_base &static_set_ssw_callback(device_t &device, _Object object) { return downcast<cammu_device &>(device).m_ssw_func.set_callback(object); } + + virtual DECLARE_ADDRESS_MAP(map, 32) = 0; + + DECLARE_READ32_MEMBER(mmu_r); + DECLARE_WRITE32_MEMBER(mmu_w); + + DECLARE_READ32_MEMBER(cammu_r) { return m_cammu[offset]; } + DECLARE_WRITE32_MEMBER(cammu_w) { m_cammu[offset] = data; } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config (address_spacenum spacenum) const override; + +private: + address_space_config m_main_space_config; + address_space_config m_io_space_config; + address_space_config m_boot_space_config; + address_space *m_main_space; + address_space *m_io_space; + address_space *m_boot_space; + devcb_read32 m_ssw_func; + + u32 m_cammu[1024]; + +#ifdef ICACHE_ENTRIES + struct icache + { + u32 offset; + u32 data; + } m_icache[ICACHE_ENTRIES]; +#endif +}; + +class cammu_c4t_device : public cammu_device +{ +public: + cammu_c4t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual DECLARE_ADDRESS_MAP(map, 32) override; +}; + +class cammu_c4i_device : public cammu_device +{ +public: + cammu_c4i_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual DECLARE_ADDRESS_MAP(map, 32) override; +}; + +class cammu_c3_device : public cammu_device +{ +public: + cammu_c3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual DECLARE_ADDRESS_MAP(map, 32) override; +}; + +// device type definitions +extern const device_type CAMMU_C4T; +extern const device_type CAMMU_C4I; +extern const device_type CAMMU_C3; + +#endif
\ No newline at end of file diff --git a/src/mame/machine/dc.cpp b/src/mame/machine/dc.cpp index 7b5d08dd79d..135f9e0d87a 100644 --- a/src/mame/machine/dc.cpp +++ b/src/mame/machine/dc.cpp @@ -10,6 +10,7 @@ #include "debugger.h" #include "includes/dc.h" #include "cpu/sh4/sh4.h" +#include "cpu/arm7/arm7core.h" #include "machine/mie.h" #include "machine/naomig1.h" #include "video/powervr2.h" @@ -718,7 +719,46 @@ WRITE32_MEMBER(dc_state::dc_arm_aica_w) m_aica->write(space, offset*2, data, mem_mask&0xffff); } +READ64_MEMBER(dc_state::sh4_soundram_r ) +{ + return *((uint64_t *)dc_sound_ram.target()+offset); +} + +WRITE64_MEMBER(dc_state::sh4_soundram_w ) +{ + COMBINE_DATA((uint64_t *)dc_sound_ram.target() + offset); +} + +WRITE_LINE_MEMBER(dc_state::aica_irq) +{ + m_soundcpu->set_input_line(ARM7_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(dc_state::sh4_aica_irq) +{ + if(state) + dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_AICA; + else + dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_AICA; + + dc_update_interrupt_status(); +} + +MACHINE_RESET_MEMBER(dc_state,dc_console) +{ + dc_state::machine_reset(); + m_aica->set_ram_base(dc_sound_ram, 2*1024*1024); +} + TIMER_DEVICE_CALLBACK_MEMBER(dc_state::dc_scanline) { m_powervr2->pvr_scanline_timer(param); } + +// crude cheat pending SH4 DRC, especially useful for inp playback +INPUT_CHANGED_MEMBER(dc_state::mastercpu_cheat_r) +{ + const u32 CPU_CLOCK = (200000000); + const u32 timing_value[4] = { CPU_CLOCK, CPU_CLOCK/2, CPU_CLOCK/4, CPU_CLOCK/16 }; + m_maincpu->set_unscaled_clock(timing_value[newval]); +} diff --git a/src/mame/machine/dec0.cpp b/src/mame/machine/dec0.cpp index 7a1c48ee654..4aef1d1dcff 100644 --- a/src/mame/machine/dec0.cpp +++ b/src/mame/machine/dec0.cpp @@ -10,7 +10,9 @@ Data East machine functions - Bryan McPhail, mish@tendril.co.uk #include "emu.h" #include "includes/dec0.h" + #include "cpu/h6280/h6280.h" +#include "cpu/m68000/m68000.h" #include "cpu/mcs51/mcs51.h" @@ -165,39 +167,35 @@ WRITE16_MEMBER(dec0_state::hippodrm_68000_share_w) READ8_MEMBER(dec0_state::dec0_mcu_port_r) { - int latchEnable=m_i8751_ports[2]>>4; + uint8_t result = 0xff; - // P0 connected to 4 latches - if (offset==0) + // P0 connected to latches + if (offset == 0) { - if ((latchEnable&1)==0) - return m_i8751_command>>8; - else if ((latchEnable&2)==0) - return m_i8751_command&0xff; - else if ((latchEnable&4)==0) - return m_i8751_return>>8; - else if ((latchEnable&8)==0) - return m_i8751_return&0xff; + if (!BIT(m_i8751_ports[2], 4)) + result &= m_i8751_command >> 8; + if (!BIT(m_i8751_ports[2], 5)) + result &= m_i8751_command & 0x00ff; } - return 0xff; + return result; } WRITE8_MEMBER(dec0_state::dec0_mcu_port_w) { - m_i8751_ports[offset]=data; - - if (offset==2) + if (offset == 2) { - if ((data&0x4)==0) - m_maincpu->set_input_line(5, HOLD_LINE); - if ((data&0x8)==0) + if (!BIT(data, 2) && BIT(m_i8751_ports[2], 2)) + m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE); + if (!BIT(data, 3)) m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE); - if ((data&0x40)==0) - m_i8751_return=(m_i8751_return&0xff00)|(m_i8751_ports[0]); - if ((data&0x80)==0) - m_i8751_return=(m_i8751_return&0xff)|(m_i8751_ports[0]<<8); + if (BIT(data, 6) && !BIT(m_i8751_ports[2], 6)) + m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_ports[0]; + if (BIT(data, 7) && !BIT(m_i8751_ports[2], 7)) + m_i8751_return = (m_i8751_return & 0x00ff) | (m_i8751_ports[0] << 8); } + + m_i8751_ports[offset] = data; } void dec0_state::baddudes_i8751_write(int data) @@ -300,12 +298,22 @@ void dec0_state::birdtry_i8751_write(int data) void dec0_state::dec0_i8751_write(int data) { - m_i8751_command=data; + m_i8751_command = data; - /* Writes to this address cause an IRQ to the i8751 microcontroller */ - if (m_game == 1) m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); - if (m_game == 2) baddudes_i8751_write(data); - if (m_game == 3) birdtry_i8751_write(data); + /* Writes to this address raise an IRQ on the i8751 microcontroller */ + switch (m_game) + { + case mcu_type::EMULATED: + if (BIT(m_i8751_ports[2], 3)) + m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); + break; + case mcu_type::BADDUDES_SIM: + baddudes_i8751_write(data); + break; + case mcu_type::BIRDTRY_SIM: + birdtry_i8751_write(data); + break; + } //logerror("%s: warning - write %02x to i8751\n",machine().describe_context(),data); } @@ -388,17 +396,17 @@ DRIVER_INIT_MEMBER(dec0_state,robocop) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::robocop_68000_share_r),this), write16_delegate(FUNC(dec0_state::robocop_68000_share_w),this)); } -DRIVER_INIT_MEMBER(dec0_state,baddudes) +DRIVER_INIT_MEMBER(dec0_state,drgninja) { - m_game = 2; + m_game = mcu_type::BADDUDES_SIM; } DRIVER_INIT_MEMBER(dec0_state,hbarrel) { - m_game = 1; + m_game = mcu_type::EMULATED; } DRIVER_INIT_MEMBER(dec0_state,birdtry) { - m_game=3; + m_game = mcu_type::BIRDTRY_SIM; } diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp index 1aee97637e2..ee3352fb0ea 100644 --- a/src/mame/machine/egret.cpp +++ b/src/mame/machine/egret.cpp @@ -162,7 +162,7 @@ void egret_device::send_port(address_space &space, uint8_t offset, uint8_t data) printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc()); #endif via_clock = (data>>4) & 1; - write_via_clock(via_clock^1); + write_via_clock(via_clock); } } break; diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp index 9d41af07fe8..396264b5573 100644 --- a/src/mame/machine/harddriv.cpp +++ b/src/mame/machine/harddriv.cpp @@ -388,7 +388,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_wr1_write ) machine().output().set_value("SEL3", m_sel3_data); break; - case 4: /* SEL4 */ + case 4: /* SEL4 */ m_sel4_data = data; machine().output().set_value("SEL4", m_sel4_data); break; diff --git a/src/mame/machine/ibm6580_fdc.cpp b/src/mame/machine/ibm6580_fdc.cpp index 3d5fafdea73..baa10e83f37 100644 --- a/src/mame/machine/ibm6580_fdc.cpp +++ b/src/mame/machine/ibm6580_fdc.cpp @@ -30,24 +30,24 @@ const tiny_rom_entry *dw_fdc_device::device_rom_region() const } static ADDRESS_MAP_START( dw_fdc_io, AS_IO, 8, dw_fdc_device ) -// AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) +// AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w) AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) -// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) +// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) ADDRESS_MAP_END static MACHINE_CONFIG_FRAGMENT( dw_fdc ) - MCFG_CPU_ADD("mcu", I8048, XTAL_24MHz/4) // divisor is unverified + MCFG_CPU_ADD("mcu", I8048, XTAL_24MHz/4) // divisor is unverified MCFG_CPU_IO_MAP(dw_fdc_io) MCFG_DEVICE_ADD("ppi8255", I8255, 0) MCFG_UPD765A_ADD("upd765", false, false) -// MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) -// MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8257", dma8257_device, XXX)) -// MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", wangpc_state::floppy_formats) -// MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", wangpc_state::floppy_formats) +// MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) +// MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8257", dma8257_device, XXX)) +// MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", wangpc_state::floppy_formats) +// MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", wangpc_state::floppy_formats) MACHINE_CONFIG_END machine_config_constructor dw_fdc_device::device_mconfig_additions() const diff --git a/src/mame/machine/ibm6580_kbd.cpp b/src/mame/machine/ibm6580_kbd.cpp index a697bb76464..1ae0e34fe9c 100644 --- a/src/mame/machine/ibm6580_kbd.cpp +++ b/src/mame/machine/ibm6580_kbd.cpp @@ -37,7 +37,7 @@ static ADDRESS_MAP_START( dw_keyboard_io, AS_IO, 8, dw_keyboard_device ) ADDRESS_MAP_END static MACHINE_CONFIG_FRAGMENT( dw_keyboard ) - MCFG_CPU_ADD("mcu", I8049, XTAL_6MHz) // XXX RC oscillator + MCFG_CPU_ADD("mcu", I8049, XTAL_6MHz) // XXX RC oscillator MCFG_CPU_IO_MAP(dw_keyboard_io) MACHINE_CONFIG_END @@ -52,7 +52,7 @@ INPUT_PORTS_START( dw_keyboard ) * Keyboard Matrix -- p. 5-6 ('83) and p. 26 ('82) */ PORT_START("DIP") - PORT_DIPNAME( 0xff, 1, "Layout" ) + PORT_DIPNAME( 0xff, 1, "Layout" ) PORT_DIPSETTING( 1, "U.S." ) PORT_DIPSETTING( 250, "U.S. Dvorak" ) @@ -97,7 +97,7 @@ INPUT_PORTS_START( dw_keyboard ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_START("COL.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') @@ -270,7 +270,7 @@ WRITE8_MEMBER( dw_keyboard_device::bus_w ) */ if ((data & 0x72) != 0x72) - DBG_LOG(1,"bus",( "<- %02x = send %d strobe %d clock %d | dip clk %d dip load %d\n", + DBG_LOG(1,"bus",( "<- %02x = send %d strobe %d clock %d | dip clk %d dip load %d\n", data, BIT(data, 0), BIT(data, 1), BIT(data, 4), BIT(data, 5), BIT(data, 6))); m_bus = data; diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp new file mode 100644 index 00000000000..67a47f2cfd0 --- /dev/null +++ b/src/mame/machine/interpro_ioga.cpp @@ -0,0 +1,691 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * An implementation of the IOGA device found on Intergraph InterPro family workstations. There is no + * public documentation on this device, so the implementation is being built to follow the logic of the + * system boot ROM and its diagnostic tests. + * + * The device handles most of the I/O for the system, including timers, interrupts, DMA and target device + * interfacing. There remains a significant amount of work to be completed before the boot diagnostics will + * pass without errors, let alone successfully booting CLIX. + * + * Please be aware that code in here is not only broken, it's likely wrong in many cases. + * + * TODO + * - too long to list + */ +#include "interpro_ioga.h" + +#define VERBOSE 0 +#if VERBOSE +#define LOG_TIMER_MASK 0xff +#define LOG_TIMER(timer, ...) if (LOG_TIMER_MASK & (1 << timer)) logerror(__VA_ARGS__) +#define LOG_INTERRUPT(...) logerror(__VA_ARGS__) +#define LOG_IOGA(...) logerror(__VA_ARGS__) +#define LOG_DMA(...) logerror(__VA_ARGS__) +#else +#define LOG_TIMER_MASK 0x00 +#define LOG_TIMER(timer, ...) +#define LOG_INTERRUPT(...) +#define LOG_IOGA(...) +#define LOG_DMA(...) +#endif + +DEVICE_ADDRESS_MAP_START(map, 32, interpro_ioga_device) + AM_RANGE(0x0c, 0x1b) AM_READWRITE(dma_plotter_r, dma_plotter_w) + AM_RANGE(0x1c, 0x1f) AM_READWRITE(dma_plotter_eosl_r, dma_plotter_eosl_w) + AM_RANGE(0x20, 0x2f) AM_READWRITE(dma_scsi_r, dma_scsi_w) + AM_RANGE(0x30, 0x3f) AM_READWRITE(dma_floppy_r, dma_floppy_w) + + AM_RANGE(0x5c, 0x7f) AM_READWRITE16(icr_r, icr_w, 0xffffffff) + AM_RANGE(0x80, 0x83) AM_READWRITE16(icr18_r, icr18_w, 0x0000ffff) + AM_RANGE(0x80, 0x83) AM_READWRITE8(softint_r, softint_w, 0x00ff0000) + AM_RANGE(0x80, 0x83) AM_READWRITE8(nmictrl_r, nmictrl_w, 0xff000000) + + AM_RANGE(0x88, 0x8b) AM_READWRITE(timer_prescaler_r, timer_prescaler_w) + AM_RANGE(0x8c, 0x8f) AM_READWRITE(timer0_r, timer0_w) + AM_RANGE(0x90, 0x93) AM_READWRITE(timer1_r, timer1_w) + AM_RANGE(0x94, 0x97) AM_READ(error_address_r) + AM_RANGE(0x98, 0x9b) AM_READ(error_businfo_r) + AM_RANGE(0x9c, 0x9f) AM_READWRITE16(arbctl_r, arbctl_w, 0x0000ffff) + + AM_RANGE(0xa8, 0xab) AM_READWRITE(timer3_r, timer3_w) + + AM_RANGE(0xb0, 0xbf) AM_READWRITE16(softint_vector_r, softint_vector_w, 0xffffffff) +ADDRESS_MAP_END + +const device_type INTERPRO_IOGA = &device_creator<interpro_ioga_device>; + +interpro_ioga_device::interpro_ioga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, INTERPRO_IOGA, "InterPro IOGA", tag, owner, clock, "ioga", __FILE__), + m_out_nmi_func(*this), + m_out_int_func(*this), + m_memory_space(nullptr), + m_dma_channel{ + { 0,0,0,0,false, 0, {*this}, {*this} }, + { 0,0,0,0,false, 0, {*this}, {*this} }, + { 0,0,0,0,false, 0, {*this}, {*this} }, + { 0,0,0,0,false, 0, {*this}, {*this} } }, + m_fdc_tc_func(*this) +{ +} + +void interpro_ioga_device::device_start() +{ + // resolve callbacks + m_out_nmi_func.resolve(); + m_out_int_func.resolve(); + + // TODO: parameterise the cammu name and space number + // grab the main memory space from the mmu so we can do DMA to/from it + device_memory_interface *mmu; + siblingdevice("mmu")->interface(mmu); + m_memory_space = &mmu->space(AS_0); + + for (int i = 0; i < IOGA_DMA_CHANNELS; i++) + { + m_dma_channel[i].device_r.resolve_safe(0xff); + m_dma_channel[i].device_w.resolve(); + } + + m_fdc_tc_func.resolve(); + + // allocate ioga timers + m_timer[0] = timer_alloc(IOGA_TIMER_0); + m_timer[1] = timer_alloc(IOGA_TIMER_1); + m_timer[2] = timer_alloc(IOGA_TIMER_2); + m_timer[3] = timer_alloc(IOGA_TIMER_3); + + for (auto & elem : m_timer) + elem->enable(false); + + // allocate timer for DMA controller + m_dma_timer = timer_alloc(IOGA_TIMER_DMA); + m_dma_timer->adjust(attotime::never); +} + +void interpro_ioga_device::device_reset() +{ + m_nmi_pending = false; + + m_interrupt_active = 0; + m_irq_forced = 0; + + // configure timer 0 at 60Hz + m_timer_reg[0] = 0; + m_timer[0]->adjust(attotime::zero, IOGA_TIMER_0, attotime::from_hz(60)); +} + +/****************************************************************************** + Timers +******************************************************************************/ +READ32_MEMBER(interpro_ioga_device::timer1_r) +{ + uint32_t result = m_timer1_count & IOGA_TIMER1_VMASK; + + // set the start bit if the timer is currently enabled + if (m_timer[1]->enabled()) + result |= IOGA_TIMER1_START; + else if (m_timer[1]->param()) + result |= IOGA_TIMER1_EXPIRED; + + return result; +} + +READ32_MEMBER(interpro_ioga_device::timer3_r) +{ + uint32_t result = m_timer3_count & IOGA_TIMER3_VMASK; + + if (m_timer[3]->enabled()) + result |= IOGA_TIMER3_START; + else if (m_timer[3]->param()) + result |= IOGA_TIMER3_EXPIRED; + + return result; +} + +void interpro_ioga_device::write_timer(int timer, uint32_t value, device_timer_id id) +{ + switch (id) + { + case IOGA_TIMER_1: + // disable the timer + m_timer[timer]->enable(false); + + // store the timer count value + m_timer1_count = value; + + // start the timer if necessary + if (value & IOGA_TIMER1_START) + { + LOG_TIMER(1, "timer 1: started prescaler %d value %d\n", m_prescaler & 0x7fff, value & IOGA_TIMER1_VMASK); + + // FIXME: this division by 50 is sufficient to pass iogadiag timer 1 tests + m_timer[timer]->adjust(attotime::zero, false, attotime::from_usec((m_prescaler & 0x7fff) / 50)); + } + break; + + case IOGA_TIMER_3: + // stop the timer so it won't trigger while we're fiddling with it + m_timer[timer]->enable(false); + + // write the new value to the timer register + m_timer3_count = value & IOGA_TIMER3_VMASK; + + // start the timer if necessary + if (value & IOGA_TIMER3_START) + { + LOG_TIMER(3, "timer 3: started value %d\n", value & IOGA_TIMER3_VMASK); + + m_timer[timer]->adjust(attotime::zero, false, attotime::from_hz(XTAL_25MHz)); + } + break; + + default: + // save the value + m_timer_reg[timer] = value; + + // timer_set(attotime::from_usec(500), id); + + LOG_TIMER(0xf, "timer %d: set to 0x%x (%d)\n", timer, m_timer_reg[timer], m_timer_reg[timer]); + break; + } +} + +void interpro_ioga_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case IOGA_TIMER_0: + m_timer_reg[0]++; + set_irq_line(IOGA_TIMER0_IRQ, ASSERT_LINE); + break; + + case IOGA_TIMER_1: + // decrement timer count value + m_timer1_count--; + + // check if timer has expired + if (m_timer1_count == 0) + { + LOG_TIMER(1, "timer 1: stopped\n"); + + // disable timer and set the zero flag + timer.enable(false); + timer.set_param(true); + + // throw an interrupt + set_irq_line(IOGA_TIMER1_IRQ, ASSERT_LINE); + } + break; + + case IOGA_TIMER_3: + // decrement timer count value + m_timer3_count--; + + // check for expiry + if (m_timer3_count == 0) + { + LOG_TIMER(3, "timer 3: stopped\n"); + + // disable timer and set the zero flag + timer.enable(false); + timer.set_param(true); + + // throw an interrupt + set_irq_line(IOGA_TIMER3_IRQ, ASSERT_LINE); + } + break; + + case IOGA_TIMER_DMA: + // transfer data between device and main memory + + // TODO: figure out what indicates dma write (memory -> device) + // TODO: implement multiple dma channels + // TODO: virtual memory? + + if (!m_dma_channel[param].dma_active) + { + LOG_DMA("dma: transfer started, channel = %d, control 0x%08x, real address 0x%08x count 0x%08x\n", + param, m_dma_channel[param].control, m_dma_channel[param].real_address, m_dma_channel[param].transfer_count); + m_dma_channel[param].dma_active = true; + } + + // while the device is requesting a data transfer and the transfer count is not zero + while (m_dma_channel[param].drq_state && m_dma_channel[param].transfer_count) + { + // transfer a byte between device and memory + if (true) + m_memory_space->write_byte(m_dma_channel[param].real_address, m_dma_channel[param].device_r()); + else + m_dma_channel[param].device_w(m_memory_space->read_byte(m_dma_channel[param].real_address)); + + // increment addresses and decrement count + m_dma_channel[param].real_address++; + m_dma_channel[param].virtual_address++; + m_dma_channel[param].transfer_count--; + } + + // if there are no more bytes remaining, terminate the transfer + if (m_dma_channel[param].transfer_count == 0) + { + LOG_DMA("dma: transfer stopped, control 0x%08x, real address 0x%08x count 0x%08x\n", + m_dma_channel[param].control, m_dma_channel[param].fdc_real_address, m_dma_channel[param].transfer_count); + + if (param == IOGA_DMA_FLOPPY) + { + LOG_DMA("dma: asserting fdc terminal count line\n"); + + m_fdc_tc_func(ASSERT_LINE); + m_fdc_tc_func(CLEAR_LINE); + } + + m_dma_channel[param].dma_active = false; + } + break; + } +} + +/****************************************************************************** + Interrupts +******************************************************************************/ + +static const uint16_t irq_enable_mask[IOGA_INTERRUPT_COUNT] = +{ + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL | IOGA_INTERRUPT_ENABLE_INTERNAL, // external interrupt 0: SCSI + IOGA_INTERRUPT_ENABLE_EXTERNAL | IOGA_INTERRUPT_ENABLE_INTERNAL, // external interrupt 1: floppy + IOGA_INTERRUPT_ENABLE_EXTERNAL | IOGA_INTERRUPT_ENABLE_INTERNAL, // external interrupt 2: plotter + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + + // internal interrupt 5: serial DMA - one interrupt enable per DMA channel + IOGA_INTERRUPT_ENABLE_EXTERNAL << 0 | IOGA_INTERRUPT_ENABLE_EXTERNAL << 1 | IOGA_INTERRUPT_ENABLE_EXTERNAL << 2, + IOGA_INTERRUPT_ENABLE_EXTERNAL, + IOGA_INTERRUPT_ENABLE_EXTERNAL | IOGA_INTERRUPT_ENABLE_INTERNAL // external interrupt 12: Ethernet +}; + +void interpro_ioga_device::set_nmi_line(int state) +{ + switch (state) + { + case ASSERT_LINE: + + LOG_INTERRUPT("nmi: ctrl = 0x%02x\n", m_nmictrl); + + if ((m_nmictrl & IOGA_NMI_ENABLE) == IOGA_NMI_ENABLE) + { + // if edge triggered mode, clear enable in + if (m_nmictrl & IOGA_NMI_EDGE) + m_nmictrl &= ~IOGA_NMI_ENABLE_IN; + + m_nmi_pending = true; + update_interrupt(ASSERT_LINE); + } + break; + + case CLEAR_LINE: + m_nmi_pending = false; + update_interrupt(ASSERT_LINE); + break; + } +} + +void interpro_ioga_device::set_irq_line(int irq, int state) +{ + LOG_INTERRUPT("set_irq_line(%d, %d)\n", irq, state); + switch (state) + { + case ASSERT_LINE: + if (m_int_vector[irq] & irq_enable_mask[irq]) + { + // set pending bit + m_int_vector[irq] |= IOGA_INTERRUPT_PENDING; + + // update irq line state + update_interrupt(state); + } + else + LOG_INTERRUPT("received disabled interrupt irq %d vector 0x%04x\n", irq, m_int_vector[irq]); + break; + + case CLEAR_LINE: + // clear pending bit + m_int_vector[irq] &= ~IOGA_INTERRUPT_PENDING; + + // update irq line state + update_interrupt(state); + break; + } +} + +void interpro_ioga_device::set_irq_soft(int irq, int state) +{ + LOG_INTERRUPT("set_irq_soft(%d, %d)\n", irq, state); + switch (state) + { + case ASSERT_LINE: + // set pending bit + if (irq < 8) + m_softint |= 1 << irq; + else + m_softint_vector[irq - 8] |= IOGA_INTERRUPT_PENDING; + + update_interrupt(state); + break; + + case CLEAR_LINE: + // clear pending bit + if (irq < 8) + m_softint &= ~(1 << irq); + else + m_softint_vector[irq - 8] &= ~IOGA_INTERRUPT_PENDING; + + // update irq line state + update_interrupt(state); + break; + } +} + +IRQ_CALLBACK_MEMBER(interpro_ioga_device::inta_cb) +{ + switch (irqline) + { + case INPUT_LINE_IRQ0: + // FIXME: clear pending bit - can't rely on device callbacks + switch (m_interrupt_active) + { + case IOGA_INTERRUPT_INTERNAL: + case IOGA_INTERRUPT_EXTERNAL: + m_int_vector[m_irq_current] &= ~IOGA_INTERRUPT_PENDING; + break; + + case IOGA_INTERRUPT_SOFT_LO: + m_softint &= ~(1 << m_irq_current); + break; + + case IOGA_INTERRUPT_SOFT_HI: + m_softint_vector[m_irq_current] &= ~IOGA_INTERRUPT_PENDING; + break; + } + + // clear irq line + update_interrupt(CLEAR_LINE); + + // fall through to return interrupt vector + case -1: + // return vector for current interrupt without clearing irq line + switch (m_interrupt_active) + { + case IOGA_INTERRUPT_EXTERNAL: + case IOGA_INTERRUPT_INTERNAL: + return m_int_vector[m_irq_current] & 0xff; + + case IOGA_INTERRUPT_SOFT_LO: + return 0x8f + m_irq_current * 0x10; + + case IOGA_INTERRUPT_SOFT_HI: + return m_softint_vector[m_irq_current] & 0xff; + } + break; + + case INPUT_LINE_NMI: + // clear pending flag + m_nmi_pending = false; + + // clear line + update_interrupt(CLEAR_LINE); + + // return vector + return 0; + } + + return 0; +} + +void interpro_ioga_device::update_interrupt(int state) +{ + switch (state) + { + case CLEAR_LINE: + if (m_interrupt_active) + { + // the cpu has acknowledged the active interrupt, deassert the nmi/irq line + m_interrupt_active == IOGA_INTERRUPT_NMI ? m_out_nmi_func(CLEAR_LINE) : m_out_int_func(CLEAR_LINE); + + // clear the active status + m_interrupt_active = 0; + } + // fall through to handle any pending interrupts + + case ASSERT_LINE: + // if an interrupt is currently active, don't do anything + if (m_interrupt_active == 0) + { + // check for pending nmi + if (m_nmi_pending) + { + m_interrupt_active = IOGA_INTERRUPT_NMI; + + m_out_nmi_func(ASSERT_LINE); + return; + } + + // check for any pending irq + for (int i = 0; i < IOGA_INTERRUPT_COUNT; i++) + { + if (m_int_vector[i] & IOGA_INTERRUPT_PENDING) + { + m_interrupt_active = IOGA_INTERRUPT_INTERNAL; // TODO: flag internal/external + m_irq_current = i; + + m_out_int_func(ASSERT_LINE); + return; + } + } + + // check for any pending soft interrupts (low type) + for (int i = 0; i < 8; i++) + { + if (m_softint & (1 << i)) + { + m_interrupt_active = IOGA_INTERRUPT_SOFT_LO; + m_irq_current = i; + + m_out_int_func(ASSERT_LINE); + return; + } + } + + // check for any pending soft interrupts (high type) + for (int i = 0; i < 8; i++) + { + if (m_softint_vector[i] & IOGA_INTERRUPT_PENDING) + { + m_interrupt_active = IOGA_INTERRUPT_SOFT_HI; + m_irq_current = i; + + m_out_int_func(ASSERT_LINE); + return; + } + } + } + break; + } +} + +WRITE16_MEMBER(interpro_ioga_device::icr_w) +{ + LOG_INTERRUPT("interrupt vector %d set to 0x%04x at pc 0x%08x\n", offset, data, space.device().safe_pc()); + + // FIXME: now that the interrupt handling only depends on IOGA_INTERRUPT_PENDING, we might be able + // to avoid this hack + if (data & IOGA_INTERRUPT_PENDING) + { + m_irq_forced |= 1 << offset; + m_int_vector[offset] = data & ~IOGA_INTERRUPT_PENDING; + } + else if (m_irq_forced & 1 << offset) + { + m_int_vector[offset] = data; + + // clear forced flag + m_irq_forced &= ~(1 << offset); + + // force an interrupt + set_irq_line(offset, ASSERT_LINE); + } + else + m_int_vector[offset] = data; +} + +WRITE8_MEMBER(interpro_ioga_device::softint_w) +{ + // save the existing value + uint8_t previous = m_softint; + + // store the written value + m_softint = data; + + // force soft interrupt for any bit written from 1 to 0 + for (int i = 0; i < 8; i++) + { + uint8_t mask = 1 << i; + + // check for transition from 1 to 0 and force a soft interrupt + if (previous & mask && !(data & mask)) + set_irq_soft(i, ASSERT_LINE); + } +} + +WRITE8_MEMBER(interpro_ioga_device::nmictrl_w) +{ + // save the existing value + uint8_t previous = m_nmictrl; + + // store the written value + m_nmictrl = data; + + // force an nmi when pending bit is written low + if (previous & IOGA_NMI_PENDING && !(data & IOGA_NMI_PENDING)) + set_nmi_line(ASSERT_LINE); +} + +WRITE16_MEMBER(interpro_ioga_device::softint_vector_w) +{ + // save the existing value + uint16_t previous = m_softint_vector[offset]; + + // store the written value + m_softint_vector[offset] = data; + + // check for transition from 1 to 0 and force a soft interrupt + if (previous & IOGA_INTERRUPT_PENDING && !(data & IOGA_INTERRUPT_PENDING)) + set_irq_soft(offset + 8, ASSERT_LINE); +} + +/****************************************************************************** + DMA +******************************************************************************/ +void interpro_ioga_device::drq(int state, int channel) +{ + // this member is called when the device has data ready for reading via dma + m_dma_channel[channel].drq_state = state; + + if (state) + { + // TODO: check if dma is enabled + m_dma_timer->adjust(attotime::zero, channel); + } +} +/* +0x94: error address reg: expect 0x7f200000 after bus error (from dma virtual address) +0x98: error cycle type: expect 0x52f0 (after failed dma?) + 0x5331 - forced berr with nmi/interrupts disabled? + 0xc2f0 + 0x62f0 +*/ +// TODO: 7.0266 - forced BERR not working + +uint32_t interpro_ioga_device::dma_r(address_space &space, offs_t offset, uint32_t mem_mask, int channel) +{ + switch (offset) + { + case 0: + return m_dma_channel[channel].real_address; + + case 1: + return m_dma_channel[channel].virtual_address; + + case 2: + return m_dma_channel[channel].transfer_count; + + case 3: + return m_dma_channel[channel].control; + } + + logerror("dma_r: unknown channel %d\n", channel); + return 0; +} + +void interpro_ioga_device::dma_w(address_space &space, offs_t offset, uint32_t data, uint32_t mem_mask, int channel) +{ + switch (offset) + { + case 0: + m_dma_channel[channel].real_address = data; + break; + + case 1: + m_dma_channel[channel].virtual_address = data & ~0x3; + break; + + case 2: + m_dma_channel[channel].transfer_count = data; + break; + + case 3: + m_dma_channel[channel].control = data & IOGA_DMA_CTRL_WMASK; + + logerror("dma: channel = %d, control = 0x%08x, ra = 0x%08x, va = 0x%08x, tc = 0x%08x\n", + channel, data, m_dma_channel[channel].real_address, m_dma_channel[channel].virtual_address, m_dma_channel[channel].transfer_count); + + // iogadiag test 7.0265 + if (data == IOGA_DMA_CTRL_START) + { + uint32_t mask = 0; + + switch (channel) + { + case IOGA_DMA_PLOTTER: + mask = IOGA_ARBCTL_BGR_PLOT; + break; + + case IOGA_DMA_SCSI: + mask = IOGA_ARBCTL_BGR_SCSI; + break; + + case IOGA_DMA_FLOPPY: + mask = IOGA_ARBCTL_BGR_FDC; + break; + } + + // if bus grant is not enabled, set the busy flag + if (!(m_arbctl & mask)) + m_dma_channel[channel].control |= IOGA_DMA_CTRL_BUSY; + } + break; + } +} diff --git a/src/mame/machine/interpro_ioga.h b/src/mame/machine/interpro_ioga.h new file mode 100644 index 00000000000..2809601d98e --- /dev/null +++ b/src/mame/machine/interpro_ioga.h @@ -0,0 +1,255 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#pragma once + +#ifndef INTERPRO_IOGA_H_ +#define INTERPRO_IOGA_H_ + +#include "emu.h" + +#define MCFG_INTERPRO_IOGA_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, INTERPRO_IOGA, 0) + +#define MCFG_INTERPRO_IOGA_NMI_CB(_out_nmi) \ + devcb = &interpro_ioga_device::static_set_out_nmi_callback(*device, DEVCB_##_out_nmi); + +#define MCFG_INTERPRO_IOGA_IRQ_CB(_out_int) \ + devcb = &interpro_ioga_device::static_set_out_int_callback(*device, DEVCB_##_out_int); + +#define MCFG_INTERPRO_IOGA_DMA_CB(_channel, _dma_r, _dma_w) \ + devcb = &interpro_ioga_device::static_set_dma_r_callback(*device, _channel, DEVCB_##_dma_r); \ + devcb = &interpro_ioga_device::static_set_dma_w_callback(*device, _channel, DEVCB_##_dma_w); + +#define MCFG_INTERPRO_IOGA_FDCTC_CB(_tc) \ + devcb = &interpro_ioga_device::static_set_fdc_tc_callback(*device, DEVCB_##_tc); + +#define MCFG_INTERPRO_IOGA_DMA_BUS(_mmu, _space) + +// timer 0 seem to be a 60Hz cycle +#define IOGA_TIMER0_IRQ 14 + +// best guess for timer 1 is 10MHz based on typical prescaler value of 1000 and timer value of 100 for a delay of 100ms +#define IOGA_TIMER1_IRQ 15 +#define IOGA_TIMER1_VMASK 0xffff +#define IOGA_TIMER1_START 0x10000 +#define IOGA_TIMER1_EXPIRED 0x20000 + +// best guess for timer 3 is 12.5MHz based on typical value of 12500 for a delay of 1ms +#define IOGA_TIMER3_CLOCK XTAL_12_5MHz +#define IOGA_TIMER3_IRQ 1 +#define IOGA_TIMER3_VMASK 0x3fffffff +#define IOGA_TIMER3_START 0x40000000 +#define IOGA_TIMER3_EXPIRED 0x80000000 + +#define IOGA_INTERRUPT_COUNT 19 +#define IOGA_INTERRUPT_PENDING 0x0100 +#define IOGA_INTERRUPT_ENABLE_EXTERNAL 0x0200 +#define IOGA_INTERRUPT_EDGE 0x0400 +#define IOGA_INTERRUPT_NEGPOL 0x0800 +#define IOGA_INTERRUPT_ENABLE_INTERNAL 0x1000 + +#define IOGA_NMI_EDGE 0x02 +#define IOGA_NMI_PENDING 0x08 +#define IOGA_NMI_ENABLE_IN 0x10 +#define IOGA_NMI_ENABLE (IOGA_NMI_EDGE | IOGA_NMI_ENABLE_IN) + +#define IOGA_INTERRUPT_NMI 1 +#define IOGA_INTERRUPT_INTERNAL 2 +#define IOGA_INTERRUPT_EXTERNAL 3 +#define IOGA_INTERRUPT_SOFT_LO 4 +#define IOGA_INTERRUPT_SOFT_HI 5 + +#define IOGA_DMA_CHANNELS 4 +#define IOGA_DMA_PLOTTER 0 +#define IOGA_DMA_SCSI 1 +#define IOGA_DMA_FLOPPY 2 +#define IOGA_DMA_SERIAL 3 + +// dma write values +#define IOGA_DMA_CTRL_WMASK 0xfd000e00 +#define IOGA_DMA_CTRL_RESET_L 0x61000000 // do not clear bus error bit +#define IOGA_DMA_CTRL_RESET 0x60400000 // clear bus error bit + +#define IOGA_DMA_CTRL_START 0x63000800 // perhaps start a transfer? - maybe the 8 is the channel? +#define IOGA_DMA_CTRL_UNK1 0x60000000 // don't know yet +#define IOGA_DMA_CTRL_UNK2 0x67000600 // forced berr with nmi and interrupts disabled + +// read values +#define IOGA_DMA_CTRL_BUSY 0x02000000 +#define IOGA_DMA_CTRL_BERR 0x00400000 // iogadiag code expects 0x60400000 on bus error +// iogadiag expects 0x64400800 after forced berr with nmi/interrupts disabled + + +// bus arbitration bus grant bits +#define IOGA_ARBCTL_BGR_ETHC 0x0001 +#define IOGA_ARBCTL_BGR_SCSI 0x0002 +#define IOGA_ARBCTL_BGR_PLOT 0x0004 +#define IOGA_ARBCTL_BGR_FDC 0x0008 +#define IOGA_ARBCTL_BGR_SER0 0x0010 +#define IOGA_ARBCTL_BGR_SER1 0x0020 +#define IOGA_ARBCTL_BGR_SER2 0x0040 +#define IOGA_ARBCTL_BGR_ETHB 0x0080 +#define IOGA_ARBCTL_BGR_ETHA 0x0100 + +class interpro_ioga_device : public device_t +{ +public: + interpro_ioga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + template<class _Object> static devcb_base &static_set_out_nmi_callback(device_t &device, _Object object) { return downcast<interpro_ioga_device &>(device).m_out_nmi_func.set_callback(object); } + template<class _Object> static devcb_base &static_set_out_int_callback(device_t &device, _Object object) { return downcast<interpro_ioga_device &>(device).m_out_int_func.set_callback(object); } + + template<class _Object> static devcb_base &static_set_dma_r_callback(device_t &device, int channel, _Object object) { return downcast<interpro_ioga_device &>(device).m_dma_channel[channel].device_r.set_callback(object); } + template<class _Object> static devcb_base &static_set_dma_w_callback(device_t &device, int channel, _Object object) { return downcast<interpro_ioga_device &>(device).m_dma_channel[channel].device_w.set_callback(object); } + + template<class _Object> static devcb_base &static_set_fdc_tc_callback(device_t &device, _Object object) { return downcast<interpro_ioga_device &>(device).m_fdc_tc_func.set_callback(object); } + + virtual DECLARE_ADDRESS_MAP(map, 32); + + // external interrupt lines + DECLARE_WRITE_LINE_MEMBER(ir0_w) { set_irq_line(2, state); } + DECLARE_WRITE_LINE_MEMBER(ir1_w) { set_irq_line(3, state); } + DECLARE_WRITE_LINE_MEMBER(ir2_w) { set_irq_line(4, state); } + DECLARE_WRITE_LINE_MEMBER(ir3_w) { set_irq_line(5, state); } + DECLARE_WRITE_LINE_MEMBER(ir4_w) { set_irq_line(6, state); } + DECLARE_WRITE_LINE_MEMBER(ir5_w) { set_irq_line(7, state); } + DECLARE_WRITE_LINE_MEMBER(ir6_w) { set_irq_line(8, state); } + DECLARE_WRITE_LINE_MEMBER(ir7_w) { set_irq_line(9, state); } + DECLARE_WRITE_LINE_MEMBER(ir8_w) { set_irq_line(10, state); } + // FIXME: this is a workaround for the mc146818 code which inverts the normal irq state convention + DECLARE_WRITE_LINE_MEMBER(ir9_w) { set_irq_line(11, !state); } + DECLARE_WRITE_LINE_MEMBER(ir10_w) { set_irq_line(12, state); } + DECLARE_WRITE_LINE_MEMBER(ir11_w) { set_irq_line(17, state); } + DECLARE_WRITE_LINE_MEMBER(ir12_w) { set_irq_line(18, state); } + + IRQ_CALLBACK_MEMBER(inta_cb); + + DECLARE_WRITE_LINE_MEMBER(drq_plotter) { drq(state, IOGA_DMA_PLOTTER); } + DECLARE_WRITE_LINE_MEMBER(drq_scsi) { drq(state, IOGA_DMA_SCSI); } + DECLARE_WRITE_LINE_MEMBER(drq_floppy) { drq(state, IOGA_DMA_FLOPPY); } + + DECLARE_READ32_MEMBER(timer_prescaler_r) { return m_prescaler; } + DECLARE_READ32_MEMBER(timer0_r) { return m_timer_reg[0]; } + DECLARE_READ32_MEMBER(timer1_r); + DECLARE_READ16_MEMBER(arbctl_r) { return m_arbctl; } + DECLARE_WRITE16_MEMBER(arbctl_w) { m_arbctl = data; } + DECLARE_READ32_MEMBER(timer2_r) { return m_timer_reg[2]; } + DECLARE_READ32_MEMBER(timer3_r); + + DECLARE_WRITE32_MEMBER(timer_prescaler_w) { + // this logic satisfies prescaler tests, but fails timer prescaler tests + if ((data & 0x7fff) < 0x100 && (data & 0x7fff) != 0) + m_prescaler = (data ^ 0xffff0000); + else + m_prescaler = (data ^ 0xffff0000) - 0x10000; + + //logerror("prescaler: input 0x%08x output 0x%08x\n", data, m_prescaler); + } + DECLARE_WRITE32_MEMBER(timer0_w) { write_timer(0, data, IOGA_TIMER_0); } + DECLARE_WRITE32_MEMBER(timer1_w) { write_timer(1, data, IOGA_TIMER_1); } + DECLARE_WRITE32_MEMBER(timer2_w) { write_timer(2, data, IOGA_TIMER_2); } + DECLARE_WRITE32_MEMBER(timer3_w) { write_timer(3, data, IOGA_TIMER_3); } + + DECLARE_READ16_MEMBER(icr_r) { return m_int_vector[offset]; } + DECLARE_WRITE16_MEMBER(icr_w); + DECLARE_READ16_MEMBER(icr18_r) { return icr_r(space, 18, mem_mask); } + DECLARE_WRITE16_MEMBER(icr18_w) { icr_w(space, 18, data, mem_mask); } + + DECLARE_READ8_MEMBER(softint_r) { return m_softint; } + DECLARE_WRITE8_MEMBER(softint_w); + DECLARE_READ8_MEMBER(nmictrl_r) { return m_nmictrl; } + DECLARE_WRITE8_MEMBER(nmictrl_w); + + DECLARE_READ16_MEMBER(softint_vector_r) { return m_softint_vector[offset]; } + DECLARE_WRITE16_MEMBER(softint_vector_w); + + DECLARE_READ32_MEMBER(dma_plotter_r) { return dma_r(space, offset, mem_mask, IOGA_DMA_PLOTTER); } + DECLARE_WRITE32_MEMBER(dma_plotter_w) { dma_w(space, offset, data, mem_mask, IOGA_DMA_PLOTTER); } + DECLARE_READ32_MEMBER(dma_scsi_r) { return dma_r(space, offset, mem_mask, IOGA_DMA_SCSI); } + DECLARE_WRITE32_MEMBER(dma_scsi_w) { dma_w(space, offset, data, mem_mask, IOGA_DMA_SCSI); } + DECLARE_READ32_MEMBER(dma_floppy_r) { return dma_r(space, offset, mem_mask, IOGA_DMA_FLOPPY); } + DECLARE_WRITE32_MEMBER(dma_floppy_w) { dma_w(space, offset, data, mem_mask, IOGA_DMA_FLOPPY); } + + DECLARE_READ32_MEMBER(dma_plotter_eosl_r) { return m_dma_plotter_eosl; } + DECLARE_WRITE32_MEMBER(dma_plotter_eosl_w) { m_dma_plotter_eosl = data; } + + DECLARE_READ32_MEMBER(error_address_r) { return m_error_address; } + DECLARE_READ32_MEMBER(error_businfo_r) { return m_error_businfo; } + void bus_error(uint32_t address, uint32_t cycle_type) { m_error_address = address; m_error_businfo = cycle_type; } + +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: + static const device_timer_id IOGA_TIMER_0 = 0; + static const device_timer_id IOGA_TIMER_1 = 1; + static const device_timer_id IOGA_TIMER_2 = 2; + static const device_timer_id IOGA_TIMER_3 = 3; + + static const device_timer_id IOGA_TIMER_DMA = 4; + + void set_nmi_line(int state); + void set_irq_line(int irq, int state); + void set_irq_soft(int irq, int state); + void write_timer(int timer, uint32_t value, device_timer_id id); + + void update_interrupt(int state); + + void drq(int state, int channel); + devcb_write_line m_out_nmi_func; + devcb_write_line m_out_int_func; + address_space *m_memory_space; + + // dma channels + struct dma + { + uint32_t real_address; + uint32_t virtual_address; + uint32_t transfer_count; + uint32_t control; + + bool dma_active; + int drq_state; + devcb_read8 device_r; + devcb_write8 device_w; + } m_dma_channel[IOGA_DMA_CHANNELS]; + uint32_t m_dma_plotter_eosl; + + devcb_write_line m_fdc_tc_func; + + bool m_nmi_pending; + uint32_t m_interrupt_active; + uint32_t m_irq_current; + uint32_t m_irq_forced; + + uint16_t m_int_vector[IOGA_INTERRUPT_COUNT]; + uint8_t m_softint; + uint8_t m_nmictrl; + uint16_t m_softint_vector[8]; + + uint32_t m_prescaler; + uint32_t m_timer_reg[3]; + uint16_t m_timer1_count; + uint32_t m_timer3_count; + emu_timer *m_timer[4]; + + // dma state + emu_timer *m_dma_timer; + + uint32_t dma_r(address_space &space, offs_t offset, uint32_t mem_mask, int channel); + void dma_w(address_space &space, offs_t offset, uint32_t data, uint32_t mem_mask, int channel); + + uint16_t m_arbctl; + + uint32_t m_error_address; + uint32_t m_error_businfo; +}; + +// device type definition +extern const device_type INTERPRO_IOGA; + +#endif
\ No newline at end of file diff --git a/src/mame/machine/interpro_mcga.cpp b/src/mame/machine/interpro_mcga.cpp new file mode 100644 index 00000000000..d807f571bab --- /dev/null +++ b/src/mame/machine/interpro_mcga.cpp @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* +* An implementation of the MCGA device found on Intergraph InterPro family workstations. There is no +* public documentation on this device, so the implementation is being built to follow the logic of the +* system boot ROM and its diagnostic tests. +* +* Please be aware that code in here is not only broken, it's likely wrong in many cases. +* +* TODO +* - too long to list +*/ +#include "interpro_mcga.h" + +#define VERBOSE 0 +#if VERBOSE +#define LOG_MCGA(...) logerror(__VA_ARGS__) +#else +#define LOG_MCGA(...) {} +#endif + +DEVICE_ADDRESS_MAP_START(map, 16, interpro_mcga_device) + AM_RANGE(0x00, 0x3f) AM_READWRITE16(read, write, 0xffff) +ADDRESS_MAP_END + +const device_type INTERPRO_MCGA = &device_creator<interpro_mcga_device>; + +interpro_mcga_device::interpro_mcga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, INTERPRO_MCGA, "InterPro MCGA", tag, owner, clock, "mcga", __FILE__) +{ +} + +void interpro_mcga_device::device_start() +{ +} + +void interpro_mcga_device::device_reset() +{ + m_reg[0] = 0x00ff; // 0x00 + m_reg[2] = MCGA_CTRL_ENREFRESH | MCGA_CTRL_CBITFRCSUB | MCGA_CTRL_CBITFRCRD; // 0x08 ctrl + //m_mcga[4] = 0x8000; // 0x10 error + m_reg[10] = 0x00ff; // 0x28 + m_reg[14] = 0x0340; // 0x38 memsize +} + +WRITE16_MEMBER(interpro_mcga_device::write) +{ + /* + read MEMSIZE 0x38 mask 0xffff + read 0x00 mask 0x0000 + write CBSUB 0x20 mask 0x00ff data 0 + write FRCRD 0x18 mask 0x00ff data 0 + read ERROR 0x10 mask 0xffff + read 0x00 mask 0xffff + + (0x38 >> 8) & 0xF == 3? + + if (0x00 != 0xFF) -> register reset error + + 0x00 = 0x0055 (test value & 0xff) + r7 = 0x00 & 0xff + */ + LOG_MCGA("mcga write offset = 0x%08x, mask = 0x%08x, data = 0x%08x, pc = 0x%08x\n", offset, mem_mask, data, space.device().safe_pc()); + switch (offset) + { + case 0x02: // MCGA_CTRL + // HACK: set or clear error status depending on ENMMBE bit + if (data & MCGA_CTRL_ENMMBE) + m_reg[4] |= MCGA_ERROR_VALID; + // else + // m_reg[4] &= ~MCGA_ERROR_VALID; + + default: + m_reg[offset] = data; + break; + } +} + +READ16_MEMBER(interpro_mcga_device::read) +{ + LOG_MCGA("mcga read offset = 0x%08x, mask = 0x%08x, pc = 0x%08x\n", offset, mem_mask, space.device().safe_pc()); + + switch (offset) + { + default: + return m_reg[offset]; + } +}
\ No newline at end of file diff --git a/src/mame/machine/interpro_mcga.h b/src/mame/machine/interpro_mcga.h new file mode 100644 index 00000000000..4f3ecde78cc --- /dev/null +++ b/src/mame/machine/interpro_mcga.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#pragma once + +#ifndef INTERPRO_MCGA_H_ +#define INTERPRO_MCGA_H_ + +#include "emu.h" + +// mcga control register +#define MCGA_CTRL_OPTMASK 0x00000003 +#define MCGA_CTRL_CBITFRCRD 0x00000004 +#define MCGA_CTRL_CBITFRCSUB 0x00000008 +#define MCGA_CTRL_ENREFRESH 0x00000010 +#define MCGA_CTRL_ENMSBE 0x00000100 +#define MCGA_CTRL_ENMMBE 0x00000200 +#define MCGA_CTRL_ENECC 0x00000400 +#define MCGA_CTRL_WRPROT 0x00008000 + +// mcga error register +#define MCGA_ERROR_VALID 0x00008000 + +class interpro_mcga_device : public device_t +{ +public: + interpro_mcga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual DECLARE_ADDRESS_MAP(map, 32); + + DECLARE_WRITE16_MEMBER(write); + DECLARE_READ16_MEMBER(read); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + uint16_t m_reg[32]; +}; + +// device type definition +extern const device_type INTERPRO_MCGA; + +#endif
\ No newline at end of file diff --git a/src/mame/machine/interpro_sga.cpp b/src/mame/machine/interpro_sga.cpp new file mode 100644 index 00000000000..102c58a2f0b --- /dev/null +++ b/src/mame/machine/interpro_sga.cpp @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* +* An implementation of the SGA device found on Intergraph InterPro family workstations. There is no +* public documentation on this device, so the implementation is being built to follow the logic of the +* system boot ROM and its diagnostic tests. +* +* Please be aware that code in here is not only broken, it's likely wrong in many cases. +* +* TODO +* - too long to list +*/ +#include "interpro_sga.h" + +#define VERBOSE 0 + +DEVICE_ADDRESS_MAP_START(map, 32, interpro_sga_device) + AM_RANGE(0x00, 0x03) AM_READWRITE(gcs_r, gcs_w) + AM_RANGE(0x04, 0x07) AM_READWRITE(ipoll_r, ipoll_w) + AM_RANGE(0x08, 0x0b) AM_READWRITE(imask_r, imask_w) + AM_RANGE(0x0c, 0x0f) AM_READWRITE(range_base_r, range_base_w) + AM_RANGE(0x10, 0x13) AM_READWRITE(range_end_r, range_end_w) + AM_RANGE(0x14, 0x17) AM_READWRITE(cttag_r, cttag_w) + AM_RANGE(0x18, 0x1b) AM_READWRITE(address_r, address_w) + AM_RANGE(0x1c, 0x1f) AM_READWRITE(dmacs_r, dmacs_w) + AM_RANGE(0x20, 0x23) AM_READWRITE(edmacs_r, edmacs_w) + + AM_RANGE(0xa4, 0xa7) AM_READWRITE(dspad1_r, dspad1_w) + AM_RANGE(0xa8, 0xab) AM_READWRITE(dsoff1_r, dsoff1_w) + + AM_RANGE(0xb4, 0xb7) AM_READWRITE(unknown1_r, unknown1_w) + AM_RANGE(0xb8, 0xbb) AM_READWRITE(unknown2_r, unknown2_w) + AM_RANGE(0xbc, 0xbf) AM_READWRITE(ddtc1_r, ddtc1_w) +ADDRESS_MAP_END + +const device_type INTERPRO_SGA = &device_creator<interpro_sga_device>; + +interpro_sga_device::interpro_sga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, INTERPRO_SGA, "InterPro SGA", tag, owner, clock, "sga", __FILE__) +{ +} + +void interpro_sga_device::device_start() +{ +} + +void interpro_sga_device::device_reset() +{ +} + +WRITE32_MEMBER(interpro_sga_device::ddtc1_w) +{ + // we assume that when this register is written, we should start a + // memory to memory dma transfer + + logerror(" gcs = 0x%08x dmacs = 0x%08x\n", m_gcs, m_dmacs); + logerror(" ipoll = 0x%08x imask = 0x%08x\n", m_ipoll, m_imask); + logerror("dspad1 = 0x%08x dsoff1 = 0x%08x\n", m_dspad1, m_dsoff1); + logerror(" unk1 = 0x%08x unk2 = 0x%08x\n", m_unknown1, m_unknown2); + logerror(" ddtc1 = 0x%08x\n", data); + + m_ddtc1 = data; + + // when complete, we indicate by setting DMAEND(2) - 2 is probably the channel + // we also turn off the INTBERR and INTMMBE flags + m_ipoll &= ~(0x20000 | 0x10000); + m_ipoll |= 0x200; + + // if the address is invalid, fake a bus error + if (m_dspad1 == 0x40000000 || m_unknown1 == 0x40000000 + || m_dspad1 == 0x40000200 || m_unknown1 == 0x40000200) + { + m_ipoll |= 0x10000; + + // error cycle - bit 0x10 indicates source address error (dspad1) + // now expecting 0x5463? +#if 0 + if ((m_dspad1 & 0xfffff000) == 0x40000000) + m_ioga->bus_error(m_dspad1, 0x5433); + else + m_ioga->bus_error(m_unknown1, 0x5423); +#endif + // 0x5423 = BERR|SNAPOK | BG(ICAMMU)? | CT(23) + // 0x5433 = BERR|SNAPOK | BG(ICAMMU)? | CT(33) + // 0x5463 = BERR|SNAPOK | BG(ICAMMU)? | TAG(1) | CT(23) + } +} diff --git a/src/mame/machine/interpro_sga.h b/src/mame/machine/interpro_sga.h new file mode 100644 index 00000000000..06c2d1fba8f --- /dev/null +++ b/src/mame/machine/interpro_sga.h @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#pragma once + +#ifndef INTERPRO_SGA_H_ +#define INTERPRO_SGA_H_ + +#include "emu.h" + +class interpro_sga_device : public device_t +{ +public: + interpro_sga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual DECLARE_ADDRESS_MAP(map, 32); + + DECLARE_READ32_MEMBER(gcs_r) { return m_gcs; } + DECLARE_WRITE32_MEMBER(gcs_w) { m_gcs = data; } + DECLARE_READ32_MEMBER(ipoll_r) { return m_ipoll; } + DECLARE_WRITE32_MEMBER(ipoll_w) { m_ipoll = data; } + DECLARE_READ32_MEMBER(imask_r) { return m_imask; } + DECLARE_WRITE32_MEMBER(imask_w) { m_imask = data; } + DECLARE_READ32_MEMBER(range_base_r) { return m_range_base; } + DECLARE_WRITE32_MEMBER(range_base_w) { m_range_base = data; } + DECLARE_READ32_MEMBER(range_end_r) { return m_range_end; } + DECLARE_WRITE32_MEMBER(range_end_w) { m_range_end = data; } + DECLARE_READ32_MEMBER(cttag_r) { return m_cttag; } + DECLARE_WRITE32_MEMBER(cttag_w) { m_cttag = data; } + DECLARE_READ32_MEMBER(address_r) { return m_address; } + DECLARE_WRITE32_MEMBER(address_w) { m_address = data; } + DECLARE_READ32_MEMBER(dmacs_r) { return m_dmacs; } + DECLARE_WRITE32_MEMBER(dmacs_w) { m_dmacs = data; } + DECLARE_READ32_MEMBER(edmacs_r) { return m_edmacs; } + DECLARE_WRITE32_MEMBER(edmacs_w) { m_edmacs = data; } + DECLARE_READ32_MEMBER(dspad1_r) { return m_dspad1; } + DECLARE_WRITE32_MEMBER(dspad1_w) { m_dspad1 = data; } + DECLARE_READ32_MEMBER(dsoff1_r) { return m_dsoff1; } + DECLARE_WRITE32_MEMBER(dsoff1_w) { m_dsoff1 = data; } + DECLARE_READ32_MEMBER(unknown1_r) { return m_unknown1; } + DECLARE_WRITE32_MEMBER(unknown1_w) { m_unknown1 = data; } + DECLARE_READ32_MEMBER(unknown2_r) { return m_unknown2; } + DECLARE_WRITE32_MEMBER(unknown2_w) { m_unknown2 = data; } + DECLARE_READ32_MEMBER(ddtc1_r) { return m_ddtc1; } + DECLARE_WRITE32_MEMBER(ddtc1_w); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + uint32_t m_gcs; // general control/status + uint32_t m_ipoll; // interrupt poll + uint32_t m_imask; // interrupt mask + uint32_t m_range_base; + uint32_t m_range_end; + uint32_t m_cttag; // error cycletype/tag + uint32_t m_address; + uint32_t m_dmacs; // dma control/status + uint32_t m_edmacs; // extended dma control/status + uint32_t m_dspad1; + uint32_t m_dsoff1; + uint32_t m_unknown1; + uint32_t m_unknown2; + uint32_t m_ddtc1; +}; + +// device type definition +extern const device_type INTERPRO_SGA; + +#endif
\ No newline at end of file diff --git a/src/mame/machine/namco_c139.cpp b/src/mame/machine/namco_c139.cpp index 0e081a7836e..ed021210762 100644 --- a/src/mame/machine/namco_c139.cpp +++ b/src/mame/machine/namco_c139.cpp @@ -2,13 +2,13 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco C139 - Serial I/F Controller + Namco C139 - Serial I/F Controller + + + TODO: + - Make this to actually work! + - Is RAM shared with a specific CPU other than master/slave? - - TODO: - - Make this to actually work! - - Is RAM shared with a specific CPU other than master/slave? - ***************************************************************************/ #include "emu.h" @@ -35,9 +35,9 @@ ADDRESS_MAP_END DEVICE_ADDRESS_MAP_START( regs_map, 16, namco_c139_device ) AM_RANGE(0x00, 0x00) AM_READ(status_r) // WRITE clears flags AM_RANGE(0x02, 0x02) AM_NOP // settings? -// AM_RANGE(0x0a, 0x0a) // WRITE tx_w -// AM_RANGE(0x0c, 0x0c) // READ rx_r -// AM_RANGE(0x0e, 0x0e) // +// AM_RANGE(0x0a, 0x0a) // WRITE tx_w +// AM_RANGE(0x0c, 0x0c) // READ rx_r +// AM_RANGE(0x0e, 0x0e) // ADDRESS_MAP_END //------------------------------------------------- diff --git a/src/mame/machine/namco_c139.h b/src/mame/machine/namco_c139.h index 08a38e74425..bee3f51a6a3 100644 --- a/src/mame/machine/namco_c139.h +++ b/src/mame/machine/namco_c139.h @@ -2,7 +2,7 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco C139 - Serial I/F Controller + Namco C139 - Serial I/F Controller ***************************************************************************/ @@ -37,7 +37,7 @@ public: DECLARE_ADDRESS_MAP(regs_map, 16); DECLARE_READ16_MEMBER(status_r); - + DECLARE_READ16_MEMBER(ram_r); DECLARE_WRITE16_MEMBER(ram_w); diff --git a/src/mame/machine/namco_c148.cpp b/src/mame/machine/namco_c148.cpp index d09d82c7ff6..a12ece76d55 100644 --- a/src/mame/machine/namco_c148.cpp +++ b/src/mame/machine/namco_c148.cpp @@ -2,27 +2,27 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco C148 - CPU Bus Manager + Namco C148 - CPU Bus Manager - Does some Memory Decode, Interrupt Handling, 3 bit PIO port, Bus Controller + Does some Memory Decode, Interrupt Handling, 3 bit PIO port, Bus Controller + + Based off implementation from K.Wilkins and Phil Stroffolino + + TODO: + - hookup C116 device, @see mame/includes/namcoic.h - Based off implementation from K.Wilkins and Phil Stroffolino - - TODO: - - hookup C116 device, @see mame/includes/namcoic.h - ============================================================================= Interrupt Controller C148 1C0000-1FFFFF R/W D00-D02 Bus Controller? 1C0XXX ???????? 1C2XXX ???????? 1C4XXX - -x- master priority bit? + -x- master priority bit? Master/Slave IRQ level 1C6XXX D00-D02 EXIRQ level 1C8XXX D00-D02 POSIRQ level 1CAXXX D00-D02 SCIRQ level 1CCXXX D00-D02 VBLANK IRQ level 1CEXXX D00-D02 - xxx irq level for specific irq. + xxx irq level for specific irq. ???????? 1D0XXX ???????? 1D4000 trigger master/slave INT? @@ -35,9 +35,9 @@ Interrupt Controller C148 1C0000-1FFFFF R/W D00-D02 EEPROM Ready status 1E0XXX R D01 Sound CPU Reset control 1E2XXX W D01 Slave 68000 & IO CPU Reset 1E4XXX W D01 - xxx PIO ports, per-HW / CPU specific + xxx PIO ports, per-HW / CPU specific Watchdog reset kicker 1E6XXX W - xxx Unknown at current stage if internal or external to the C148 + xxx Unknown at current stage if internal or external to the C148 ***************************************************************************/ @@ -111,6 +111,14 @@ void namco_c148_device::device_start() m_out_ext2_cb.resolve_safe(); // TODO: link to SCI, EX and the screen device controller devices + + save_item(NAME(m_irqlevel.cpu)); + save_item(NAME(m_irqlevel.ex)); + save_item(NAME(m_irqlevel.sci)); + save_item(NAME(m_irqlevel.pos)); + save_item(NAME(m_irqlevel.vblank)); + save_item(NAME(m_posirq_line)); + save_item(NAME(m_bus_reg)); } @@ -131,11 +139,11 @@ void namco_c148_device::device_reset() // IRQ section //************************************************************************** -READ8_MEMBER( namco_c148_device::pos_irq_level_r ) { return m_irqlevel.pos & 7; } -READ8_MEMBER( namco_c148_device::vblank_irq_level_r ) { return m_irqlevel.vblank & 7; } -READ8_MEMBER( namco_c148_device::cpu_irq_level_r ) { return m_irqlevel.cpu & 7; } -READ8_MEMBER( namco_c148_device::ex_irq_level_r ) { return m_irqlevel.ex & 7; } -READ8_MEMBER( namco_c148_device::sci_irq_level_r ) { return m_irqlevel.sci & 7; } +READ8_MEMBER( namco_c148_device::pos_irq_level_r ) { return m_irqlevel.pos & 7; } +READ8_MEMBER( namco_c148_device::vblank_irq_level_r ) { return m_irqlevel.vblank & 7; } +READ8_MEMBER( namco_c148_device::cpu_irq_level_r ) { return m_irqlevel.cpu & 7; } +READ8_MEMBER( namco_c148_device::ex_irq_level_r ) { return m_irqlevel.ex & 7; } +READ8_MEMBER( namco_c148_device::sci_irq_level_r ) { return m_irqlevel.sci & 7; } inline void namco_c148_device::flush_irq_acks() { @@ -146,23 +154,23 @@ inline void namco_c148_device::flush_irq_acks() m_hostcpu->set_input_line(i,CLEAR_LINE); } -WRITE8_MEMBER( namco_c148_device::pos_irq_level_w ) { m_irqlevel.pos = data & 7; flush_irq_acks(); if(data != 0) { LOG(("%s: pos IRQ level = %02x\n",this->tag(),data)); } } -WRITE8_MEMBER( namco_c148_device::vblank_irq_level_w ) { m_irqlevel.vblank = data & 7; flush_irq_acks(); LOG(("%s: vblank IRQ level = %02x\n",this->tag(),data)); } -WRITE8_MEMBER( namco_c148_device::cpu_irq_level_w ) { m_irqlevel.cpu = data & 7; flush_irq_acks(); LOG(("%s: cpu IRQ level = %02x\n",this->tag(),data)); } -WRITE8_MEMBER( namco_c148_device::ex_irq_level_w ) { m_irqlevel.ex = data & 7; flush_irq_acks(); LOG(("%s: ex IRQ level = %02x\n",this->tag(),data)); } -WRITE8_MEMBER( namco_c148_device::sci_irq_level_w ) { m_irqlevel.sci = data & 7; flush_irq_acks(); LOG(("%s: sci IRQ level = %02x\n",this->tag(),data)); } - -READ16_MEMBER( namco_c148_device::vblank_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.vblank, CLEAR_LINE); return 0; } -READ16_MEMBER( namco_c148_device::pos_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.pos, CLEAR_LINE); return 0; } -READ16_MEMBER( namco_c148_device::cpu_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.cpu, CLEAR_LINE); return 0; } -READ16_MEMBER( namco_c148_device::ex_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.ex, CLEAR_LINE); return 0; } -READ16_MEMBER( namco_c148_device::sci_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.sci, CLEAR_LINE); return 0; } - -WRITE16_MEMBER( namco_c148_device::vblank_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.vblank, CLEAR_LINE); } -WRITE16_MEMBER( namco_c148_device::pos_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.pos, CLEAR_LINE); } -WRITE16_MEMBER( namco_c148_device::cpu_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.cpu, CLEAR_LINE); } -WRITE16_MEMBER( namco_c148_device::ex_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.ex, CLEAR_LINE); } -WRITE16_MEMBER( namco_c148_device::sci_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.sci, CLEAR_LINE); } +WRITE8_MEMBER( namco_c148_device::pos_irq_level_w ) { m_irqlevel.pos = data & 7; flush_irq_acks(); if(data != 0) { LOG(("%s: pos IRQ level = %02x\n",this->tag(),data)); } } +WRITE8_MEMBER( namco_c148_device::vblank_irq_level_w ) { m_irqlevel.vblank = data & 7; flush_irq_acks(); LOG(("%s: vblank IRQ level = %02x\n",this->tag(),data)); } +WRITE8_MEMBER( namco_c148_device::cpu_irq_level_w ) { m_irqlevel.cpu = data & 7; flush_irq_acks(); LOG(("%s: cpu IRQ level = %02x\n",this->tag(),data)); } +WRITE8_MEMBER( namco_c148_device::ex_irq_level_w ) { m_irqlevel.ex = data & 7; flush_irq_acks(); LOG(("%s: ex IRQ level = %02x\n",this->tag(),data)); } +WRITE8_MEMBER( namco_c148_device::sci_irq_level_w ) { m_irqlevel.sci = data & 7; flush_irq_acks(); LOG(("%s: sci IRQ level = %02x\n",this->tag(),data)); } + +READ16_MEMBER( namco_c148_device::vblank_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.vblank, CLEAR_LINE); return 0; } +READ16_MEMBER( namco_c148_device::pos_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.pos, CLEAR_LINE); return 0; } +READ16_MEMBER( namco_c148_device::cpu_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.cpu, CLEAR_LINE); return 0; } +READ16_MEMBER( namco_c148_device::ex_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.ex, CLEAR_LINE); return 0; } +READ16_MEMBER( namco_c148_device::sci_irq_ack_r ) { m_hostcpu->set_input_line(m_irqlevel.sci, CLEAR_LINE); return 0; } + +WRITE16_MEMBER( namco_c148_device::vblank_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.vblank, CLEAR_LINE); } +WRITE16_MEMBER( namco_c148_device::pos_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.pos, CLEAR_LINE); } +WRITE16_MEMBER( namco_c148_device::cpu_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.cpu, CLEAR_LINE); } +WRITE16_MEMBER( namco_c148_device::ex_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.ex, CLEAR_LINE); } +WRITE16_MEMBER( namco_c148_device::sci_irq_ack_w ) { m_hostcpu->set_input_line(m_irqlevel.sci, CLEAR_LINE); } //************************************************************************** // Comm ports diff --git a/src/mame/machine/namco_c148.h b/src/mame/machine/namco_c148.h index 3f53228ebcc..7b920708e2b 100644 --- a/src/mame/machine/namco_c148.h +++ b/src/mame/machine/namco_c148.h @@ -2,7 +2,7 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco C148 - CPU Bus Manager + Namco C148 - CPU Bus Manager ***************************************************************************/ @@ -27,7 +27,7 @@ #define MCFG_NAMCO_C148_EXT2_CB(_cb) \ devcb = &namco_c148_device::set_out_ext2_callback(*device, DEVCB_##_cb); - + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -48,20 +48,20 @@ public: dev.m_hostcpu_tag = tag; dev.m_hostcpu_master = is_master; } - + static void link_c148_device(device_t &device, const char *tag) { namco_c148_device &dev = downcast<namco_c148_device &>(device); dev.m_linked_c148_tag = tag; } - + template<class _Object> static devcb_base &set_out_ext1_callback(device_t &device, _Object object) { return downcast<namco_c148_device &>(device).m_out_ext1_cb.set_callback(object); } template<class _Object> static devcb_base &set_out_ext2_callback(device_t &device, _Object object) { return downcast<namco_c148_device &>(device).m_out_ext2_cb.set_callback(object); } devcb_write8 m_out_ext1_cb; devcb_write8 m_out_ext2_cb; - + DECLARE_READ8_MEMBER( vblank_irq_level_r ); DECLARE_WRITE8_MEMBER( vblank_irq_level_w ); DECLARE_READ16_MEMBER( vblank_irq_ack_r ); @@ -76,12 +76,12 @@ public: DECLARE_WRITE8_MEMBER( cpu_irq_level_w ); DECLARE_READ16_MEMBER( cpu_irq_ack_r ); DECLARE_WRITE16_MEMBER( cpu_irq_ack_w ); - + DECLARE_READ8_MEMBER( ex_irq_level_r ); DECLARE_WRITE8_MEMBER( ex_irq_level_w ); DECLARE_READ16_MEMBER( ex_irq_ack_r ); DECLARE_WRITE16_MEMBER( ex_irq_ack_w ); - + DECLARE_READ8_MEMBER( sci_irq_level_r ); DECLARE_WRITE8_MEMBER( sci_irq_level_w ); DECLARE_READ16_MEMBER( sci_irq_ack_r ); @@ -110,11 +110,11 @@ protected: virtual void device_start() override; virtual void device_reset() override; private: - cpu_device *m_hostcpu; /**< reference to the host cpu */ - namco_c148_device *m_linked_c148; /**< reference to linked master/slave c148 */ - const char *m_hostcpu_tag; /**< host cpu tag name */ - const char *m_linked_c148_tag; /**< other c148 tag name */ - bool m_hostcpu_master; /**< define if host cpu is master */ + cpu_device *m_hostcpu; /**< reference to the host cpu */ + namco_c148_device *m_linked_c148; /**< reference to linked master/slave c148 */ + const char *m_hostcpu_tag; /**< host cpu tag name */ + const char *m_linked_c148_tag; /**< other c148 tag name */ + bool m_hostcpu_master; /**< define if host cpu is master */ struct{ uint8_t cpu; uint8_t ex; diff --git a/src/mame/machine/namcoio_gearbox.cpp b/src/mame/machine/namcoio_gearbox.cpp index cf4c472a653..68f0c82e794 100644 --- a/src/mame/machine/namcoio_gearbox.cpp +++ b/src/mame/machine/namcoio_gearbox.cpp @@ -2,24 +2,24 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco 6-speed Gearbox device - + Namco 6-speed Gearbox device + Used in Ridge Racer deluxe cabinet, Ace Driver and Driver's Eyes - User side gear scheme: - 1 3 5 - |-|-| - 2 4 6 - - Being a mechanical part there are currently two methods hooked up, - emulated and natural. - First one just uses whatever is read in the inputs, second one - simulates clutch lock as in a real car. - - TODO: - - check clutch lock via real HW, and get a way to lock current gear via - MAME's input system; - - Custom part #; - - gear output for artwork system; + User side gear scheme: + 1 3 5 + |-|-| + 2 4 6 + + Being a mechanical part there are currently two methods hooked up, + emulated and natural. + First one just uses whatever is read in the inputs, second one + simulates clutch lock as in a real car. + + TODO: + - check clutch lock via real HW, and get a way to lock current gear via + MAME's input system; + - Custom part #; + - gear output for artwork system; ***************************************************************************/ @@ -74,7 +74,7 @@ static INPUT_PORTS_START( gearbox_inputs ) PORT_START("GEARBOX") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Gearbox Up") PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Gearbox Down") - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Gearbox Left") + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Gearbox Left") PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Gearbox Right") PORT_START("CLUTCH") @@ -105,21 +105,21 @@ CUSTOM_INPUT_MEMBER( namcoio_gearbox_device::in_r ) { if(ioport("CONFIG")->read() & 1) return ioport("GEARBOX")->read() & 0xf; - + bool clutch_pressed = (ioport("CLUTCH")->read() & 1) == 0; - const char gearbox_output[16] = { '-', '-', '-', '-', - '-', '6', '5', 'N', - '-', '2', '1', 'N', + const char gearbox_output[16] = { '-', '-', '-', '-', + '-', '6', '5', 'N', + '-', '2', '1', 'N', '-', '4', '3', 'N' }; - + if(ioport("CONFIG")->read() & 2) popmessage("%c %c",gearbox_output[m_gearbox_state],clutch_pressed == true ? '*' : '.'); - + if(clutch_pressed == false) return m_gearbox_state; - + m_gearbox_state = ioport("GEARBOX")->read() & 0xf; - + return 0xf; // return neutral while changing gear } diff --git a/src/mame/machine/namcoio_gearbox.h b/src/mame/machine/namcoio_gearbox.h index 463338930d0..5d80d09d8e4 100644 --- a/src/mame/machine/namcoio_gearbox.h +++ b/src/mame/machine/namcoio_gearbox.h @@ -2,7 +2,7 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Namco 6-speed Gearbox device + Namco 6-speed Gearbox device ***************************************************************************/ diff --git a/src/mame/machine/namcos2.cpp b/src/mame/machine/namcos2.cpp index d2c23f350ed..876b79fc799 100644 --- a/src/mame/machine/namcos2.cpp +++ b/src/mame/machine/namcos2.cpp @@ -86,7 +86,7 @@ WRITE8_MEMBER(namcos2_shared_state::sound_reset_w) /* Suspend execution */ m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } - + if (namcos2_kickstart != nullptr) { //printf( "dspkick=0x%x\n", data ); @@ -97,11 +97,11 @@ WRITE8_MEMBER(namcos2_shared_state::sound_reset_w) } } -// TODO: +// TODO: WRITE8_MEMBER(namcos2_shared_state::system_reset_w) -{ +{ reset_all_subcpus(data & 1 ? CLEAR_LINE : ASSERT_LINE); - + if (data & 0x01) { address_space &masterspace = m_maincpu->space(AS_PROGRAM); diff --git a/src/mame/machine/naomi.cpp b/src/mame/machine/naomi.cpp index ce88e041838..c1a41b66be6 100644 --- a/src/mame/machine/naomi.cpp +++ b/src/mame/machine/naomi.cpp @@ -209,7 +209,7 @@ DRIVER_INIT_MEMBER(naomi_state,naomi) create_pic_from_retdat(); } -DRIVER_INIT_MEMBER(naomi_state,naomi2) +DRIVER_INIT_MEMBER(naomi2_state,naomi2) { m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2b0600, 0xc2b0607, read64_delegate(FUNC(naomi_state::naomi2_biose_idle_skip_r),this)); // rev e bios diff --git a/src/mame/machine/naomibd.cpp b/src/mame/machine/naomibd.cpp index 2ea0d246a80..559ec53c9f7 100644 --- a/src/mame/machine/naomibd.cpp +++ b/src/mame/machine/naomibd.cpp @@ -52,6 +52,9 @@ "M1" type carts: DMA_OFFSET 0 = enable decryptyon/decompression during DMA transfer, ROM_OFFSET - ROM size/mapping select similar to M2 cart type "M4" type carts: no effect, ROM_OFFSET bit 29 always return 1 then read, used by BIOS to determine this cart is encrypted and require bit 30 set then read ROM header + * bit 28 (mode bit 0) + "M2" type carts: ROM_OFFSET - master/slave ROM board select + * bit 0 can be set for "M4" type carts, function unknown Normal address starts with 0xa0000000 to enable auto-advance and 8MB ROM addressing mode. diff --git a/src/mame/machine/naomim2.cpp b/src/mame/machine/naomim2.cpp index e4b140a7231..6061fc4763d 100644 --- a/src/mame/machine/naomim2.cpp +++ b/src/mame/machine/naomim2.cpp @@ -11,10 +11,10 @@ Naomi cartridge type M2/3 mapping NAOMI_ROM_OFFSET bit29: ROM size/mapping selection, 0 - 4MB ROM mode, 1 - 8MB ROM mode -bit28: Bank selection. - in the case of flash-based 171-7885A ROM boards two of them can be stacked at once - onto main board. each must be configured as Bank 0 or 1 via some (currently unknown) jumper. - this bit selects which one ROM board will be accessed. +bit28: master/slave ROM board select. + flash-based 171-7885A ROM board JP4 select master (access at 0xxxxxxx) or slave (access at 1xxxxxxx) mode. + then set to slave it can be stacked with another type M2/3 ROM board. + this bit selects which one ROM board will be accessed. note: if ROM is not mounted its area readed as 0xFF @@ -52,8 +52,8 @@ note: if ROM is not mounted its area readed as 0xFF |0D000000 | | | 6N MA13 (16MB) | |0E000000 | | | 6M MA14 (16MB) | |0F000000 | | | 6L MA15 (16MB) | -|10000000 | | | 6K MA16 (16MB) | -|11000000 | | | 6J MA17 (16MB) | +|10000000 | Slave ROM board | Slave ROM board | 6K MA16 (16MB) | +|11000000 | area | area | 6J MA17 (16MB) | |12000000 | | | 6H MA18 (16MB) | |13000000 | | | 6F MA19 (16MB) | |14000000 | | | 6E MA20 (16MB) | @@ -104,7 +104,7 @@ note: if ROM is not mounted its area readed as 0xFF +---------+-------------------+---------------------+----------------------------------------------------+ |08000000 | mirror (128MB) | mirror (128MB) | mirror (128MB) | +---------+-------------------+---------------------+----------------------------------------------------+ -|10000000 | FF filled (256MB) | FF filled (256MB) | FF filled (256MB) (or MA16-23 in 4MB mode?) | +|10000000 | slave ROM board | slave ROM board | FF filled (256MB) (or MA16-23 in 4MB mode?) | +---------+-------------------+---------------------+----------------------------------------------------+ ********************************************************************************************************/ diff --git a/src/mame/machine/nl_hazelvid.h b/src/mame/machine/nl_hazelvid.h index ff436aa1f8d..d394ed35f57 100644 --- a/src/mame/machine/nl_hazelvid.h +++ b/src/mame/machine/nl_hazelvid.h @@ -1,4 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +#include "netlist/nl_setup.h" + NETLIST_EXTERNAL(hazelvid) diff --git a/src/mame/machine/nl_pong.cpp b/src/mame/machine/nl_pong.cpp index d03ae825d78..f375164068c 100644 --- a/src/mame/machine/nl_pong.cpp +++ b/src/mame/machine/nl_pong.cpp @@ -7,13 +7,13 @@ ***************************************************************************/ -#include "netlist/devices/net_lib.h" - -#define FAST_CLOCK (1) - #ifndef __PLIB_PREPROCESSOR__ + #define NL_PROHIBIT_BASEH_INCLUDE 1 + #include "netlist/devices/net_lib.h" #endif +#define FAST_CLOCK (1) + NETLIST_START(pong_fast) SOLVER(Solver, 48000) diff --git a/src/mame/machine/nl_pongd.cpp b/src/mame/machine/nl_pongd.cpp index 545b7a1c5f5..e04fb89e304 100644 --- a/src/mame/machine/nl_pongd.cpp +++ b/src/mame/machine/nl_pongd.cpp @@ -87,6 +87,7 @@ CIRCUIT_LAYOUT( pongdoubles ) ANALOG_INPUT(V5, 5) #define VCC "V5", Q +#undef GND #define GND "GND", Q CHIP("F9", 7493) diff --git a/src/mame/machine/nl_stuntcyc.cpp b/src/mame/machine/nl_stuntcyc.cpp index ccbf4b2906e..7ec790eafbd 100644 --- a/src/mame/machine/nl_stuntcyc.cpp +++ b/src/mame/machine/nl_stuntcyc.cpp @@ -46,7 +46,7 @@ NETLIST_START(stuntcyc) ALIAS( 32H, L4.QB) ALIAS( 64H, L4.QC) ALIAS(128H, L4.QD) - + TTL_74107(K4_1, 128H, P, P, P) ALIAS(256H, K4_1.Q) ALIAS(256H_Q, K4_1.QQ) @@ -450,7 +450,7 @@ NETLIST_START(stuntcyc) PROM_82S123(d7, GROUND, S1, S2, S3, S4, S5) PARAM(d7.ROM, "004811.d7") - + ALIAS(MAX_SCORE_Q, d7.O6) TTL_7410_NAND(D6_1, 256H_Q, 128H, 128H) diff --git a/src/mame/machine/nl_stuntcyc.h b/src/mame/machine/nl_stuntcyc.h index 71fd5bfbb7a..1ed85be033a 100644 --- a/src/mame/machine/nl_stuntcyc.h +++ b/src/mame/machine/nl_stuntcyc.h @@ -1,4 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Ryan Holtz +#include "netlist/nl_setup.h" + NETLIST_EXTERNAL(stuntcyc) diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp index cd649cef91a..cb9f84f5bf3 100644 --- a/src/mame/machine/osborne1.cpp +++ b/src/mame/machine/osborne1.cpp @@ -252,6 +252,14 @@ WRITE_LINE_MEMBER( osborne1_state::serial_acia_irq_func ) } +INPUT_CHANGED_MEMBER( osborne1_state::reset_key ) +{ + // This key affects NMI + if (!m_ub6a_q) + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + + DRIVER_INIT_MEMBER( osborne1_state, osborne1 ) { m_bank_0xxx->configure_entries(0, 1, m_ram->pointer(), 0); @@ -443,10 +451,6 @@ TIMER_CALLBACK_MEMBER(osborne1_state::video_callback) m_beep_state = (ra & 0x04) ? 1 : 0; m_speaker->level_w((BIT(port_b, 5) && m_beep_state) ? 1 : 0); - // Check reset key if necessary - it affects NMI - if (!m_ub6a_q) - m_maincpu->set_input_line(INPUT_LINE_NMI, (m_btn_reset->read() & 0x80) ? CLEAR_LINE : ASSERT_LINE); - m_video_timer->adjust(machine().first_screen()->time_until_pos(y + 1, 0)); } diff --git a/src/mame/machine/pc9801_86.cpp b/src/mame/machine/pc9801_86.cpp index f7d9b6245b0..5a2b80ea2b7 100644 --- a/src/mame/machine/pc9801_86.cpp +++ b/src/mame/machine/pc9801_86.cpp @@ -4,8 +4,8 @@ NEC PC-9801-86 sound card - Similar to PC-9801-26, this one has YM2608 instead of YM2203 and an - additional DAC port + Similar to PC-9801-26, this one has YM2608 instead of YM2203 and an + additional DAC port TODO: - joystick code should be shared between -26, -86 and -118 diff --git a/src/mame/machine/pc9801_kbd.cpp b/src/mame/machine/pc9801_kbd.cpp index c0199096563..728c9c4b23b 100644 --- a/src/mame/machine/pc9801_kbd.cpp +++ b/src/mame/machine/pc9801_kbd.cpp @@ -9,7 +9,7 @@ - Verify untested keys: STOP, COPY, and vf-1 through vf-5 - STOP is correct, verified with branmar2 + STOP is correct, verified with branmar2 - Problems with natural keyboard (most nonprinting keys don't work) diff --git a/src/mame/machine/retofinv.cpp b/src/mame/machine/retofinv.cpp deleted file mode 100644 index 34aa9733b2a..00000000000 --- a/src/mame/machine/retofinv.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jarek Parchanski, Andrea Mazzoleni -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/retofinv.h" - - -/*************************************************************************** - - Return of Invaders 68705 protection interface - -***************************************************************************/ - - -READ8_MEMBER(retofinv_state::mcu_portA_r) -{ -//logerror("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in); - return (m_portA_out & m_ddrA) | (m_portA_in & ~m_ddrA); -} - -WRITE8_MEMBER(retofinv_state::mcu_portA_w) -{ -//logerror("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data); - m_portA_out = data; -} - -WRITE8_MEMBER(retofinv_state::mcu_ddrA_w) -{ - m_ddrA = data; -} - - - -/* - * Port B connections: - * - * all bits are logical 1 when read (+5V pullup) - * - * 1 W IRQ ack and enable latch which holds data from main Z80 memory - * 2 W loads latch to Z80 - */ - - -READ8_MEMBER(retofinv_state::mcu_portB_r) -{ - return (m_portB_out & m_ddrB) | (m_portB_in & ~m_ddrB); -} - -WRITE8_MEMBER(retofinv_state::mcu_portB_w) -{ -//logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data); - - if ((m_ddrB & 0x02) && (~data & 0x02) && (m_portB_out & 0x02)) - { - m_portA_in = m_from_main; - if (m_main_sent) m_68705->set_input_line(0, CLEAR_LINE); - m_main_sent = 0; -//logerror("read command %02x from main cpu\n",m_portA_in); - } - if ((m_ddrB & 0x04) && (data & 0x04) && (~m_portB_out & 0x04)) - { -//logerror("send command %02x to main cpu\n",m_portA_out); - m_from_mcu = m_portA_out; - m_mcu_sent = 1; - } - - m_portB_out = data; -} - -WRITE8_MEMBER(retofinv_state::mcu_ddrB_w) -{ - m_ddrB = data; -} - - -/* - * Port C connections: - * - * all bits are logical 1 when read (+5V pullup) - * - * 0 R 1 when pending command Z80->68705 - * 1 R 0 when pending command 68705->Z80 - */ - - -READ8_MEMBER(retofinv_state::mcu_portC_r) -{ - m_portC_in = 0; - if (m_main_sent) m_portC_in |= 0x01; - if (!m_mcu_sent) m_portC_in |= 0x02; -//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),m_portC_in); - return (m_portC_out & m_ddrC) | (m_portC_in & ~m_ddrC); -} - -WRITE8_MEMBER(retofinv_state::mcu_portC_w) -{ -logerror("%04x: 68705 port C write %02x\n",space.device().safe_pc(),data); - m_portC_out = data; -} - -WRITE8_MEMBER(retofinv_state::mcu_ddrC_w) -{ - m_ddrC = data; -} - - -WRITE8_MEMBER(retofinv_state::mcu_w) -{ -logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data); - m_from_main = data; - m_main_sent = 1; - m_68705->set_input_line(0, ASSERT_LINE); -} - -READ8_MEMBER(retofinv_state::mcu_r) -{ -logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),m_from_mcu); - m_mcu_sent = 0; - return m_from_mcu; -} - -READ8_MEMBER(retofinv_state::mcu_status_r) -{ - int res = 0; - - /* bit 4 = when 1, mcu is ready to receive data from main cpu */ - /* bit 5 = when 1, mcu has sent data to the main cpu */ -//logerror("%04x: mcu_status_r\n",space.device().safe_pc()); - if (!m_main_sent) res |= 0x10; - if (m_mcu_sent) res |= 0x20; - - return res; -} diff --git a/src/mame/machine/rm380z.cpp b/src/mame/machine/rm380z.cpp index 5bcf5c50004..a6931c93677 100644 --- a/src/mame/machine/rm380z.cpp +++ b/src/mame/machine/rm380z.cpp @@ -33,8 +33,8 @@ WRITE8_MEMBER( rm380z_state::port_write ) case 0xFC: // PORT0 //printf("FBFCw[%2.2x] FBFD [%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",data,m_fbfd,m_fbfe,m_maincpu->safe_pc(),writenum); m_port0 = data; - - m_cassette->output((m_port0 & 0xEF) ? +1.0 : -1.0); // set 2400hz, bit 4 + + m_cassette->output((m_port0 & 0xEF) ? +1.0 : -1.0); // set 2400hz, bit 4 if (data&0x01) { @@ -64,7 +64,7 @@ WRITE8_MEMBER( rm380z_state::port_write ) case 0xFE: // line on screen to write to divided by 2 //printf("FBFC [%2.2x] FBFD [%2.2x] FBFEw[%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,m_fbfd,data,m_maincpu->safe_pc(),writenum); m_fbfe=data; - + break; case 0xFF: // user I/O port @@ -98,10 +98,10 @@ READ8_MEMBER( rm380z_state::port_read ) case 0xFE: // PORT1 if ((m_cassette)->input() < +0.0) - m_port1 &= 0xDF; // bit 5 off + m_port1 &= 0xDF; // bit 5 off else - m_port1 |= 0x20; // bit 5 on - + m_port1 |= 0x20; // bit 5 on + data = m_port1; //printf("read of port1 from PC [%x]\n",m_maincpu->safe_pc()); break; @@ -251,14 +251,14 @@ DRIVER_INIT_MEMBER( rm380z_state, rm380z34d ) { m_videomode=RM380Z_VIDEOMODE_40COL; m_old_videomode=m_videomode; - m_port0_mask=0xdf; // disable 80 column mode + m_port0_mask=0xdf; // disable 80 column mode } DRIVER_INIT_MEMBER( rm380z_state, rm380z34e ) { m_videomode=RM380Z_VIDEOMODE_40COL; m_old_videomode=m_videomode; - m_port0_mask=0xdf; // disable 80 column mode + m_port0_mask=0xdf; // disable 80 column mode } @@ -273,8 +273,8 @@ void rm380z_state::machine_reset() m_old_old_fbfd=0x00; writenum=0; -// m_videomode=RM380Z_VIDEOMODE_80COL; -// m_old_videomode=m_videomode; +// m_videomode=RM380Z_VIDEOMODE_80COL; +// m_old_videomode=m_videomode; m_rasterlineCtr=0; // note: from COS 4.0 videos, screen seems to show garbage at the beginning diff --git a/src/mame/machine/stfight.cpp b/src/mame/machine/stfight.cpp index d90cbc127bc..521555bbc33 100644 --- a/src/mame/machine/stfight.cpp +++ b/src/mame/machine/stfight.cpp @@ -10,11 +10,11 @@ ***************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/msm5205.h" #include "includes/stfight.h" - +#include "cpu/m6805/m68705.h" +#include "cpu/z80/z80.h" +#include "sound/msm5205.h" /* @@ -37,7 +37,7 @@ Encryption PAL 16R4 on CPU board */ -DRIVER_INIT_MEMBER(stfight_state,empcity) +DRIVER_INIT_MEMBER(stfight_state, empcity) { uint8_t *rom = memregion("maincpu")->base(); @@ -64,35 +64,40 @@ DRIVER_INIT_MEMBER(stfight_state,empcity) } -DRIVER_INIT_MEMBER(stfight_state,stfight) +DRIVER_INIT_MEMBER(stfight_state, stfight) { DRIVER_INIT_CALL(empcity); } -DRIVER_INIT_MEMBER(stfight_state,cshooter) +DRIVER_INIT_MEMBER(stfight_state, cshooter) { } void stfight_state::machine_start() { - membank("mainbank")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); - membank("mainbank")->set_entry(0); + m_main_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); + m_main_bank->set_entry(0); + + save_item(NAME(m_coin_state)); save_item(NAME(m_fm_data)); + save_item(NAME(m_cpu_to_mcu_empty)); - save_item(NAME(m_adpcm_data_offs)); - save_item(NAME(m_adpcm_nibble)); + save_item(NAME(m_cpu_to_mcu_data)); + save_item(NAME(m_port_a_out)); + save_item(NAME(m_port_c_out)); + + save_item(NAME(m_vck2)); save_item(NAME(m_adpcm_reset)); - save_item(NAME(m_coin_state)); - save_item(NAME(m_portC_out)); + save_item(NAME(m_adpcm_data_offs)); } void stfight_state::machine_reset() { m_fm_data = 0; - m_adpcm_reset = 1; - m_cpu_to_mcu_empty = 1; + m_cpu_to_mcu_empty = true; + m_adpcm_reset = true; // Coin signals are active low m_coin_state = 3; @@ -102,15 +107,7 @@ void stfight_state::machine_reset() // - in fact I don't even know how/where it's switched in! WRITE8_MEMBER(stfight_state::stfight_bank_w) { - uint8_t bank_num = 0; - - if(data & 0x80) - bank_num |= 2; - - if(data & 0x04) - bank_num |= 1; - - membank("mainbank")->set_entry(bank_num); + m_main_bank->set_entry(bitswap(data, 7, 2)); } /* @@ -169,26 +166,19 @@ WRITE8_MEMBER(stfight_state::stfight_coin_w) WRITE_LINE_MEMBER(stfight_state::stfight_adpcm_int) { - static int m_vck2 = 0; - // Falling edge triggered interrupt at half the rate of /VCK? - if (m_vck2) - m_mcu->set_input_line(0, HOLD_LINE); - - m_vck2 ^= 1; + m_mcu->set_input_line(M68705_IRQ_LINE, m_vck2 ? ASSERT_LINE : CLEAR_LINE); + m_vck2 = !m_vck2; if (!m_adpcm_reset) { - const uint8_t *samples = memregion("adpcm")->base(); - uint8_t adpcm_data = samples[m_adpcm_data_offs & 0x7fff]; + uint8_t adpcm_data = m_samples[(m_adpcm_data_offs >> 1) & 0x7fff]; - if (m_adpcm_nibble == 0) + if (!BIT(m_adpcm_data_offs, 0)) adpcm_data >>= 4; - else - ++m_adpcm_data_offs; + ++m_adpcm_data_offs; m_msm->data_w(adpcm_data & 0x0f); - m_adpcm_nibble ^= 1; } } @@ -205,10 +195,11 @@ WRITE8_MEMBER(stfight_state::stfight_fm_w) READ8_MEMBER(stfight_state::stfight_fm_r) { - uint8_t data = m_fm_data; + uint8_t const data = m_fm_data; // Acknowledge the command - m_fm_data &= ~0x80; + if (!space.debugger_access()) + m_fm_data &= ~0x80; return data; } @@ -221,51 +212,45 @@ READ8_MEMBER(stfight_state::stfight_fm_r) WRITE8_MEMBER(stfight_state::stfight_mcu_w) { m_cpu_to_mcu_data = data & 0x0f; - m_cpu_to_mcu_empty = 0; + m_cpu_to_mcu_empty = false; } WRITE8_MEMBER(stfight_state::stfight_68705_port_a_w) { - m_adpcm_data_offs = data << 8; + m_port_a_out = data; } READ8_MEMBER(stfight_state::stfight_68705_port_b_r) { - return (ioport("COIN")->read() << 6) | (m_cpu_to_mcu_empty << 4) | m_cpu_to_mcu_data; + return + (m_coin_mech->read() << 6) | + (m_cpu_to_mcu_empty ? 0x10 : 0x00) | + (m_cpu_to_mcu_data & 0x0f); } WRITE8_MEMBER(stfight_state::stfight_68705_port_b_w) { // Acknowledge Z80 command - if (BIT(mem_mask, 5) && !BIT(data, 5)) - m_cpu_to_mcu_empty = 1; + if (!BIT(data, 5)) + m_cpu_to_mcu_empty = true; } WRITE8_MEMBER(stfight_state::stfight_68705_port_c_w) { // Signal a valid coin on the falling edge - if (BIT(mem_mask, 0) && BIT(m_portC_out, 0) && !BIT(data, 0)) + if (BIT(m_port_c_out, 0) && !BIT(data, 0)) m_coin_state &= ~1; - if (BIT(mem_mask, 1) && BIT(m_portC_out, 1) && !BIT(data, 1)) + if (BIT(m_port_c_out, 1) && !BIT(data, 1)) m_coin_state &= ~2; - if (BIT(mem_mask, 2)) - { - if (BIT(data, 2)) - { - m_adpcm_reset = 1; - m_adpcm_nibble = 0; - m_msm->reset_w(1); - } - else - { - m_adpcm_reset = 0; - m_msm->reset_w(0); - } - } + // Latch ADPCM data address when dropping the reset line + m_adpcm_reset = BIT(data, 2); + if (!m_adpcm_reset && BIT(m_port_c_out, 2)) + m_adpcm_data_offs = m_port_a_out << 9; + m_msm->reset_w(m_adpcm_reset ? ASSERT_LINE : CLEAR_LINE); - if (BIT(mem_mask, 3)) - m_maincpu->set_input_line(INPUT_LINE_NMI, BIT(data, 3) ? CLEAR_LINE : ASSERT_LINE); + // Generate NMI on host CPU (used on handshake error or stuck coin) + m_maincpu->set_input_line(INPUT_LINE_NMI, BIT(data, 3) ? CLEAR_LINE : ASSERT_LINE); - m_portC_out = data; + m_port_c_out = data; } diff --git a/src/mame/machine/taito68705interface.cpp b/src/mame/machine/taito68705interface.cpp index 7605053dbe8..3cb18183b9a 100644 --- a/src/mame/machine/taito68705interface.cpp +++ b/src/mame/machine/taito68705interface.cpp @@ -21,6 +21,7 @@ matmania.cpp - maniach nycaptor.cpp - nycaptor renegade.cpp - renegade + retofinv.cpp - retofinv slapfght.cpp - slapfght xain.cpp - xsleena @@ -37,7 +38,6 @@ bublbobl.cpp - bub68705 - this is a bootleg, not an official Taito hookup changela.cpp - changela - looks like an ancestor of arkanoid without automatic semaphores mexico86.cpp - knightb, mexico86 - bootleg 68705s - retofinv.cpp - the current MCU dump is a bootleg at least sqix.cpp - hotsmash - kaneko hookup, different from Taito ones. there are other drivers (and games in existing drivers) that could hookup here, but currently lack MCU dumps. diff --git a/src/mame/machine/tigeroad.cpp b/src/mame/machine/tigeroad.cpp index d19b4e11dba..6153306b34d 100644 --- a/src/mame/machine/tigeroad.cpp +++ b/src/mame/machine/tigeroad.cpp @@ -124,91 +124,75 @@ WRITE16_MEMBER(tigeroad_state::f1dream_control_w) } -READ16_MEMBER(tigeroad_state::pushman_68705_r) +READ16_MEMBER(pushman_state::mcu_comm_r) { - if (offset == 0) - return m_latch; - - if (offset == 3 && m_new_latch) + switch (offset & 0x03) { - m_new_latch = 0; - return 0; + case 0: // read and acknowledge MCU reply + if (!space.debugger_access()) + m_mcu_semaphore = false; + return m_mcu_latch; + case 2: // expects bit 0 to be high when MCU has accepted command (other bits ignored) + return m_host_semaphore ? 0xfffe : 0xffff; + case 3: // expects bit 0 to be low when MCU has sent response (other bits ignored) + return m_mcu_semaphore ? 0xfffe : 0xffff; } - if (offset == 3 && !m_new_latch) - return 0xff; - - return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset]; + logerror("unknown MCU read offset %X & %04X\n", offset, mem_mask); + return 0xffff; } -WRITE16_MEMBER(tigeroad_state::pushman_68705_w) +WRITE16_MEMBER(pushman_state::pushman_mcu_comm_w) { - if (ACCESSING_BITS_8_15) - m_shared_ram[2 * offset] = data >> 8; - if (ACCESSING_BITS_0_7) - m_shared_ram[2 * offset + 1] = data & 0xff; - - if (offset == 1) + switch (offset & 0x01) { - m_mcu->set_input_line(M68705_IRQ_LINE, HOLD_LINE); - space.device().execute().spin(); - m_new_latch = 0; + case 0: + m_host_latch = flipendian_int16(data); + break; + case 1: + m_mcu->pd_w(space, 0, data & 0x00ff); + m_host_semaphore = true; + m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); + break; } } -/* ElSemi - Bouncing balls protection. */ -READ16_MEMBER(tigeroad_state::bballs_68705_r) +WRITE16_MEMBER(pushman_state::bballs_mcu_comm_w) { - if (offset == 0) - return m_latch; - if (offset == 3 && m_new_latch) - { - m_new_latch = 0; - return 0; - } - if (offset == 3 && !m_new_latch) - return 0xff; - - return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset]; + m_host_latch = data; + m_host_semaphore = true; + m_mcu->set_input_line(M68705_IRQ_LINE, ASSERT_LINE); } -WRITE16_MEMBER(tigeroad_state::bballs_68705_w) +WRITE8_MEMBER(pushman_state::mcu_pa_w) { - if (ACCESSING_BITS_8_15) - m_shared_ram[2 * offset] = data >> 8; - if (ACCESSING_BITS_0_7) - m_shared_ram[2 * offset + 1] = data & 0xff; - - if (offset == 0) - { - m_latch = 0; - if (m_shared_ram[0] <= 0xf) - { - m_latch = m_shared_ram[0] << 2; - if (m_shared_ram[1]) - m_latch |= 2; - m_new_latch = 1; - } - else if (m_shared_ram[0]) - { - if (m_shared_ram[1]) - m_latch |= 2; - m_new_latch = 1; - } - } + m_mcu_output = (m_mcu_output & 0xff00) | (u16(data) & 0x00ff); } - -READ8_MEMBER(tigeroad_state::pushman_68000_r) +WRITE8_MEMBER(pushman_state::mcu_pb_w) { - return m_shared_ram[offset]; + m_mcu_output = (m_mcu_output & 0x00ff) | (u16(data) << 8); } -WRITE8_MEMBER(tigeroad_state::pushman_68000_w) +WRITE8_MEMBER(pushman_state::mcu_pc_w) { - if (offset == 2 && (m_shared_ram[2] & 2) == 0 && data & 2) + if (BIT(data, 0)) + { + m_mcu->pa_w(space, 0, 0xff); + m_mcu->pb_w(space, 0, 0xff); + } + else { - m_latch = (m_shared_ram[1] << 8) | m_shared_ram[0]; - m_new_latch = 1; + m_host_semaphore = false; + m_mcu->set_input_line(M68705_IRQ_LINE, CLEAR_LINE); + m_mcu->pa_w(space, 0, (m_host_latch >> 0) & 0x00ff); + m_mcu->pb_w(space, 0, (m_host_latch >> 8) & 0x00ff); } - m_shared_ram[offset] = data; + + if (BIT(m_mcu_latch_ctl, 1) && !BIT(data, 1)) + { + m_mcu_latch = m_mcu_output & (BIT(m_mcu_latch_ctl, 0) ? 0xffff : m_host_latch); + m_mcu_semaphore = true; + } + + m_mcu_latch_ctl = data; } diff --git a/src/mame/machine/zorbakbd.cpp b/src/mame/machine/zorbakbd.cpp new file mode 100644 index 00000000000..1cb8be7ce20 --- /dev/null +++ b/src/mame/machine/zorbakbd.cpp @@ -0,0 +1,315 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/* + * TTL-level serial matrix keyboard + * + * The keyboard MCU handles scanning the matrix and converting key down/ + * up events to high-level characters for the host computer. The DIP + * switches are only read on startup. + * + * TODO: the eight "holes" generate control codes, six of them are break, home and the arrows + * + * Strangely, the Zorba configures its keyboard UART for 8N2 but this + * keyboard sends 8N1. If you type too fast or hold down a key until it + * repeats, characters will be dropped/corrupted. It's possible this is + * a dump of a different CP/M-compatible keyboard, not the one supplied + * with the Zorba. + * + * The Zorba manual describes a keyboard PROM with enough space to map + * all eight modifier combinations independently, however this keyboard + * contains no PROMs (just the MCU and demultiplexer), and the internal + * MCU EPROM only contains three tables for normal, shift, and control + * (caps lock is computed off the normal table by checking for letter + * characters). + * + * 0 1 2 3 4 5 6 7 + * 0 F1 F13 3 # KP8 i I s S KP2 , < + * 1 F2 F14 4 $ KP9 o O d D KP3 . > + * 2 F3 F15 5 % p P f F / ? + * 3 F4 F16 6 ^ [ { g G KP0 + * 4 F5 F17 7 & tab ] } h H shift KP. + * 5 F6 F18 8 * q Q KP4 j J z Z + * 6 F7 F19 9 ( w W KP5 k K x X + * 7 F8 ~ 0 ) e E KP6 l L c C space + * 8 F9 \ | - _ r R s-lock ; : v V newline + * 9 F10 ESC = + t T ctrl ' " b B KP- + * 10 F11 1 ! del y Y c-lock return n N + * 11 F12 2 @ KP7 u U a A KP1 m M + */ +#include "emu.h" +#include "zorbakbd.h" + +#include "cpu/m6805/m68705.h" + + +namespace { + +INPUT_PORTS_START(zorba_keyboard) + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13") PORT_CODE(KEYCODE_F13) PORT_CHAR(UCHAR_MAMEKEY(F13)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14") PORT_CODE(KEYCODE_F14) PORT_CHAR(UCHAR_MAMEKEY(F14)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15") PORT_CODE(KEYCODE_F15) PORT_CHAR(UCHAR_MAMEKEY(F15)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b9 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b3 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F16") PORT_CODE(KEYCODE_F16) PORT_CHAR(UCHAR_MAMEKEY(F16)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b7 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b4 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F17") PORT_CODE(KEYCODE_F17) PORT_CHAR(UCHAR_MAMEKEY(F17)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F18") PORT_CODE(KEYCODE_F18) PORT_CHAR(UCHAR_MAMEKEY(F18)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b5 + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F19") PORT_CODE(KEYCODE_F19) PORT_CHAR(UCHAR_MAMEKEY(F19)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // b6 + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("~ PRINT") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("ROW8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW LINE") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + + PORT_START("ROW9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + + PORT_START("ROW10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // e0 + + PORT_START("ROW11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("KP 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // e1 + + PORT_START("ROW12") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) // scanned but the tables are too small so it would post garbage + + PORT_START("ROW13") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) // scanned but the tables are too small so it would post garbage + + PORT_START("ROW14") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) // scanned but the tables are too small so it would post garbage + + PORT_START("ROW15") + PORT_DIPNAME( 0x07, 0x07, "Diagnostic Mode" ) + PORT_DIPSETTING( 0x07, "0 (Normal)" ) + PORT_DIPSETTING( 0x06, "1 (Dump Tables)" ) + PORT_DIPSETTING( 0x05, "2 (Report Revision)" ) + PORT_DIPSETTING( 0x04, "3 (Serial Test)" ) + PORT_DIPSETTING( 0x03, "4 (Serial Echo)" ) + PORT_DIPSETTING( 0x02, "5 (Output Test)" ) + PORT_DIPSETTING( 0x01, "6 (Normal)" ) + PORT_DIPSETTING( 0x00, "7 (Dump Tables)" ) + PORT_DIPNAME( 0x08, 0x08, "Key Repeat" ) + PORT_DIPSETTING( 0x08, DEF_STR(On) ) + PORT_DIPSETTING( 0x00, DEF_STR(Off) ) + PORT_DIPNAME( 0x10, 0x10, "Baud Rate" ) + PORT_DIPSETTING( 0x10, "1200" ) + PORT_DIPSETTING( 0x00, "300" ) + PORT_DIPNAME( 0x20, 0x20, "Key Click" ) + PORT_DIPSETTING( 0x20, DEF_STR(On) ) + PORT_DIPSETTING( 0x00, DEF_STR(Off) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR(Unknown) ) + PORT_DIPSETTING( 0x40, DEF_STR(Off) ) + PORT_DIPSETTING( 0x00, DEF_STR(On) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR(Unknown) ) + PORT_DIPSETTING( 0x80, DEF_STR(Off) ) + PORT_DIPSETTING( 0x00, DEF_STR(On) ) +INPUT_PORTS_END + + +MACHINE_CONFIG_FRAGMENT(zorba_keyboard) + // MC68705P3S + MCFG_CPU_ADD("mcu", M68705P3, XTAL_3_579545MHz * 1.05) // the 1.05 is a hack to get better sync with the host's USART - something's off in our timings + MCFG_M68705_PORTA_R_CB(READ8(zorba_keyboard_device, mcu_pa_r)); + MCFG_M68705_PORTB_R_CB(READ8(zorba_keyboard_device, mcu_pb_r)); + MCFG_M68705_PORTB_W_CB(WRITE8(zorba_keyboard_device, mcu_pb_w)); + MCFG_M68705_PORTC_W_CB(WRITE8(zorba_keyboard_device, mcu_pc_w)); + + // TODO: beeper frequency is unknown, using value from Sun keyboard for now + MCFG_SPEAKER_STANDARD_MONO("bell") + MCFG_SOUND_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.4) +MACHINE_CONFIG_END + + +ROM_START(zorba_keyboard) + ROM_REGION(0x0800, "mcu", 0) + ROM_LOAD( "8999-1 3-28-83", 0x080, 0x780, CRC(79fe6c0d) SHA1(4b6fca9379d5199d1347ad1187cbfdebfc4c73e7) ) +ROM_END + +} // anonymous namespace + + +device_type const ZORBA_KEYBOARD = &device_creator<zorba_keyboard_device>; + + +zorba_keyboard_device::zorba_keyboard_device( + machine_config const &mconfig, + char const *tag, + device_t *owner, + uint32_t clock) + : device_t( + mconfig, + ZORBA_KEYBOARD, + "Zorba Keyboard", + tag, + owner, + clock, + "zorba_kbd", + __FILE__) + , m_rows(*this, "ROW%u", 0) + , m_beeper(*this, "beeper") + , m_rxd_cb(*this) + , m_txd_high(true) + , m_row_select(0) +{ +} + + +WRITE_LINE_MEMBER(zorba_keyboard_device::txd_w) +{ + m_txd_high = CLEAR_LINE != state; +} + + +READ8_MEMBER(zorba_keyboard_device::mcu_pa_r) +{ + return m_rows[m_row_select]->read(); +} + + +READ8_MEMBER(zorba_keyboard_device::mcu_pb_r) +{ + return m_txd_high ? 0x7f : 0xff; +} + + +WRITE8_MEMBER(zorba_keyboard_device::mcu_pb_w) +{ + // TODO: bits 2/3/4 do something; some photos show F17/F18/F19 with LED windows + m_rxd_cb(BIT(data, 6) ? 0 : 1); + m_beeper->set_state(BIT(data, 5) ? 0 : 1); + machine().output().set_value("led_key_caps_lock", BIT(data, 1) ? 0 : 1); + machine().output().set_value("led_key_shift_lock", BIT(data, 0) ? 0 : 1); +} + + +WRITE8_MEMBER(zorba_keyboard_device::mcu_pc_w) +{ + m_row_select = data & 0x0f; +} + + +void zorba_keyboard_device::device_start() +{ + m_rxd_cb.resolve_safe(); + + save_item(NAME(m_txd_high)); + save_item(NAME(m_row_select)); + + m_txd_high = true; + m_row_select = 0; +} + + +machine_config_constructor zorba_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(zorba_keyboard); +} + + +ioport_constructor zorba_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(zorba_keyboard); +} + + +tiny_rom_entry const *zorba_keyboard_device::device_rom_region() const +{ + return ROM_NAME(zorba_keyboard); +} diff --git a/src/mame/machine/zorbakbd.h b/src/mame/machine/zorbakbd.h new file mode 100644 index 00000000000..6d03fc5a9c5 --- /dev/null +++ b/src/mame/machine/zorbakbd.h @@ -0,0 +1,43 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#ifndef MAME_MACHINE_ZORBAKBD_H +#define MAME_MACHINE_ZORBAKBD_H + +#include "sound/beep.h" + + +extern device_type const ZORBA_KEYBOARD; + +#define MCFG_ZORBA_KEYBOARD_RXD_CB(cb) \ + zorba_keyboard_device::set_rxd_cb(*device, DEVCB_##cb); + +class zorba_keyboard_device : public device_t +{ +public: + template <typename Obj> static devcb_base &set_rxd_cb(device_t &device, Obj &&object) + { return downcast<zorba_keyboard_device &>(device).m_rxd_cb.set_callback(std::forward<Obj>(object)); } + + zorba_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock); + + DECLARE_WRITE_LINE_MEMBER(txd_w); + + DECLARE_READ8_MEMBER(mcu_pa_r); + DECLARE_READ8_MEMBER(mcu_pb_r); + DECLARE_WRITE8_MEMBER(mcu_pb_w); + DECLARE_WRITE8_MEMBER(mcu_pc_w); + +protected: + virtual void device_start() override; + virtual machine_config_constructor device_mconfig_additions() const override; + virtual ioport_constructor device_input_ports() const override; + virtual tiny_rom_entry const *device_rom_region() const override; + + required_ioport_array<16> m_rows; + required_device<beep_device> m_beeper; + devcb_write_line m_rxd_cb; + + bool m_txd_high; + u8 m_row_select; +}; + +#endif // MAME_MACHINE_ZORBAKBD_H diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 0e4f922f41d..449a4744036 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -1414,6 +1414,8 @@ dolphntr // (c) 1996 dolphntra // (c) 1996 dolphntrb dolphntru // (c) 1996 +dolphntrce +drgneye dynajack eldorda5 eforsta5 // (c) 1995 @@ -1425,6 +1427,7 @@ genmagi gnomeatw goldpyr // (c) 1997 goldpyra // (c) 1997 +goldpyrb goldenra incasun incasunsp @@ -1444,6 +1447,7 @@ magimaska // (c) 2000 magtcha5 marmagic // (c) 2000 marmagicu // (c) 2000 +marmagicua minemine // (c) 1996 monmouse montree @@ -1453,6 +1457,7 @@ mystgard orchidms oscara5 pantmag +pantmaga partygrs // (c) 2001 partygrsa // (c) 2001 peaflut @@ -1460,7 +1465,10 @@ pengpay pengpaya pengpayb pengpayu // (c) 1997 +penpir2 petshop +petshopa +phantpay przfight qcash qnile @@ -1469,6 +1477,7 @@ qnileb // (c) 1997 qnilec qnileu // (c) 1997 qnilemax +qtbird rainwrce reelrock // (c) 1998 retrsam @@ -1493,6 +1502,8 @@ wamazonv wildbill wcougar wcougaru // (c) 1997 +wizways +wnpost wthing wtiger // (c) 1999 @@ -11965,6 +11976,7 @@ deluxe5a // (c) 2000 ESD deluxe5b // (c) 2000 ESD deluxe4u // (c) 2000 ESD hedpanic // (c) 2000 ESD +hedpanica // (c) 1999 ESD hedpanicf // (c) 2000 ESD + Fuuki, Co. Ltd. hedpanico // (c) 1999 ESD jumppop // (c) 2001 ESD @@ -12060,6 +12072,7 @@ fax // (c) 1983 fax2 // (c) 1983 hardhat // (c) 1982 mtrap // (c) 1981 +mtrap2 // (c) 1981 mtrap3 // (c) 1981 mtrap4 // (c) 1981 mtrapb // bootleg @@ -12215,7 +12228,13 @@ fb01 // 1986 FB-01 fc100 // @source:fccpu20.cpp -fccpu20 +fccpu20sbc +fccpu21ssbc +fccpu21sbc +fccpu21asbc +fccpu21yasbc +fccpu21bsbc +fccpu21ybsbc @source:fccpu30.cpp fccpu30 @@ -12557,6 +12576,7 @@ magicrd2 // (c) 1996 Impera magicrd2a // (c) 1996 Impera magicrd2b // (c) 1996 Impera magicrd2c // (c) 1996 Impera +megacard // (c) 1993 Fun World mongolnw // 199? bootleg multiwin // (c) 1992 Fun World novoplay // (c) 1986 Novomatic @@ -13958,6 +13978,7 @@ jamesb // jamesb2 // marsp // marspf // +marspp // panthera // pnkpnthr // s80tst // @@ -13997,37 +14018,71 @@ touchdn // @source:gts80b.cpp amazonh2 // amazonh3 // +amazonh3a // arena // arenaa // +arenaf // +arenag // badgirls // +badgirlsf // +badgirlsg // bighouse // +bighousef // +bighouseg // bonebstr // bonebstrf // +bonebstrg // bountyh // +bountyhg // diamondp // +diamondpf // +diamondpg // excalibr // +excalibrf // genesisp // +genesispf // +genesispg // goldwing // +goldwingf // +goldwingg // hlywoodh // +hlywoodhf // +hlywoodhg // hotshots // +hotshotsf // +hotshotsg // mntecrlo // +mntecrlo2 // mntecrloa // +mntecrlof // +mntecrlog // nmoves // raven // ravena // +raveng // robowars // +robowarsf // rock // +rockg // rock_enc // +rock_encg // s80btest // sprbreak // sprbreaka // +sprbreakf // +sprbreakg // sprbreaks // tagteamp // tagteamp2 // +tagteampg // triplay // triplaya // txsector // +txsectorf // +txsectorg // victoryp // +victorypf // +victorypg // @source:guab.cpp crisscrs // (c) 1986 @@ -14200,7 +14255,9 @@ einvaderc // Entex funjacks // Mattel funrlgl // Mattel h2hbaskb // Coleco +lchicken // LJN lightfgt // Milton Bradley +mdallas // Mattel plus1 // Milton Bradley qkracer // National Semiconductor @@ -14286,6 +14343,7 @@ elecbowl // Marx elecdet // Ideal esbattle // Entex esoccer // Entex +f2pbball // Fonas fxmcr165 // Gakken ginv1000 // Gakken gjackpot // Gakken @@ -14293,6 +14351,7 @@ gpoker // Gakken h2hbaseb // Coleco h2hboxing // Coleco h2hfootb // Coleco +horseran // Mattel lostreas // Parker Bros matchnum // A-One mathmagi // APF @@ -14667,6 +14726,7 @@ lhbv33c // (c) 1995 nkishusp // (c) 1998 ryukobou // (c) 1995 vbowl // (c) 1996 +vbowlhk // (c) 1996 vbowlj // (c) 1996 wlcc // (c) 1996 xymg // (c) 1996 @@ -14768,6 +14828,9 @@ instruct // hector1 // interact // +@source:interpro.cpp +ip2800 // Intergraph InterPro 28xx workstation + @source:intrscti.cpp intrscti // ???? @@ -20411,6 +20474,7 @@ mcombats // bootleg missile // 035820-035825 (c) 1980, 1 ROM update to rev 2 board missile1 // 035820-035825 (c) 1980 missile2 // 035820-035825 (c) 1980 +missilea // bootleg (Ugames) missilem // hack suprmatk // (c) 1980 + (c) 1981 Gencomp suprmatkd // (c) 1980 + (c) 1981 Gencomp @@ -20497,7 +20561,6 @@ alm16 // 1988 Mephisto Almeria 68000 alm32 // 1988 Mephisto Alimera 68020 berlinp // 1994 Mephisto Berlin Pro 68020 bpl32 // 1996 Mephisto Berlin Pro London Upgrade V5.00 -diablo68 // 1991 Novag Diablo 68000 Chess Computer gen32 // 1993 Mephisto Genius030 V4.00 gen32_41 // 1993 Mephisto Genius030 V4.01 lond020 // 1996 Mephisto London 68020 32 Bit @@ -28431,11 +28494,16 @@ ss2005 // 2005.04 Super Shanghai 2005 (Rev A) ss2005o // 2005.03 Super Shanghai 2005 sstrkfgt // 2000.10 Sega Strike Fighter (Rev A) sstrkfgta // 2000.10 Sega Strike Fighter (Rev A, no training mode) -starhrcl // 2000.11.28 Star Horse (satellite) -starhrct // 2000.12 Star Horse (server) -starhrpr // 2009.07.27 Star Horse Progress Returns (satellite) -starhrse // 2000.?? Star Horse (big screens) -starhrsp // 2003.12.01 Star Horse Progress (satellite) (Rev A) +shorse // 2000.11.28 Star Horse (satellite) +shorsem // 2000.?? Star Horse (main screens) +shorsel // 2000.12 Star Horse (live and backup) +shors2k1 // 2002.01.09 Star Horse 2001 (satellite, Rev B) +shorsep // 2003.12.01 Star Horse Progress (satellite, Rev A) +shorsepm // 2003.?? Star Horse Progress (main screens, Rev B) +shorseps // 2003.12.02 Star Horse Progress (sound & backup, Rev A) +shorsepb // 2000.?? Star Horse Progress (backup data) +shorsepl // 2003.12.02 Star Horse Progress (live, Rev A) +shorsepr // 2009.07.27 Star Horse Progress Returns (satellite) starseek // 2001.07 Dokidoki Idol Star Seeker suchie3 // 1999.09 Idol Janshi Su-Chi-Pi 3 sushibar // 2003 Sushi Bar @@ -28487,7 +28555,8 @@ wccf331e // 2005.06 World Club Champion Football European wccf420e // 2006.08 World Club Champion Football European Clubs 2005-2006 wldkicks // 2000.03 World Kicks (US, WK3 Ver.A) wldkicksa // 2000.03 World Kicks (Asia, WK2 Ver.A) -wldkicksj // 2000.03 World Kicks PCB (Japan, WKC1 Ver.A) +wldkicksj // 2000.03 World Kicks (Japan, WK1 Ver.A) +wldkickspj // 2000.03 World Kicks PCB (Japan, WKC1 Ver.A) wldrider // 2001.05 Wild Riders wrungp // 2001.08 Wave Runner GP wrungpo // 2001.?? Wave Runner GP (USA, Rev A) @@ -28798,6 +28867,7 @@ kof99 // 0251 (c) 1999 SNK kof99e // 0251 (c) 1999 SNK kof99h // 0251 (c) 1999 SNK kof99k // 0152 (c) 1999 SNK +kof99ka // 0152 (c) 1999 SNK kof99p // 0251 (c) 1999 SNK kog // bootleg of kof97 kotm // 0016 (c) 1991 SNK @@ -29119,6 +29189,7 @@ redfoxwp2a // (c) 1998 (China) redhawk // (c) 1997 New Vision Ent. license redhawkb // (c) 1997 redhawke // (c) 1997 Excellent Co., Ltd license +redhawkg // (c) 1997 redhawki // (c) 1997 Haedong Corp. license redhawkk // (c) 1997 sabotenb // (c) 1992 NMK / Tecmo @@ -29220,6 +29291,9 @@ sforteb // sfortec // supercon // +@source:novag68k.cpp +diablo68 // + @source:nsm.cpp firebird // @@ -31019,6 +31093,7 @@ poly880 // @source:polyplay.cpp polyplay // polyplay2 // +polyplay2c // @source:pong.cpp breakout // (c) 1976 Atari @@ -31981,8 +32056,11 @@ pool_p7 // radcl_g1 // radcl_l1 // radcl_p3 // +rollr_d2 // rollr_e1 // rollr_ex // +rollr_f2 // +rollr_f3 // rollr_g3 // rollr_l2 // rollr_l3 // @@ -34435,6 +34513,7 @@ vfremix // 1995.06 Virtua Fighter Remix vmahjong // 1997.02 Virtual Mahjong (Micronet) winterht // 1997.10 Winter Heat (Data East) znpwfv // 1997.12 Zen Nippon Pro Wrestling featuring Virtua +znpwfvt // 1997.12 Zen Nippon Pro Wrestling featuring Virtua @source:su2000.cpp su2000 // (c) 1993 Virtuality @@ -34630,8 +34709,9 @@ galpanis // 1997.04 (c) 1997 Kaneko (Europe) galpanise // 1997.04 (c) 1997 Kaneko (Europe) galpanisj // 1997.04 (c) 1997 Kaneko (Japan) galpanisk // 1997.04 (c) 1997 Kaneko (Korea) -galpans2 // 1999.02 (c) 1999 Kaneko (Japan) +galpans2 // 1999.?? (c) 1999 Kaneko (Europe) galpans2a // 1999.?? (c) 1999 Kaneko (Asia) +galpans2j // 1999.02 (c) 1999 Kaneko (Japan) galpans3 // 2002.07 (c) 2002 Kaneko (Japan) galpansu // 1999.?? (c) 1999 Kaneko (Korea) gutsn // 2000.06 (c) 2000 Kaneko / Kouyousha (Japan) @@ -34650,9 +34730,11 @@ sarukani // 1997.01 (c) 1997 Kaneko / Mediaworks (Japan) sengekis // 1997.?? (c) 1997 Kaneko / Warashi (Asia) sengekisj // 1997.07 (c) 1997 Kaneko / Warashi (Japan) senknow // 1999.04 (c) 1999 Kaneko / Kouyousha (Japan) -skns // +skns // - BIOS - various regions teljan // 1999.11 (c) 1999 Electro Design Co. (Japan) -vblokbrk // 1997.?? (c) 1997 Kaneko / Mediaworks (Asia) +vblokbrk // 1997.?? (c) 1997 Kaneko / Mediaworks (Europe) +vblokbrka // 1997.?? (c) 1997 Kaneko / Mediaworks (Asia) + @source:suprridr.cpp suprridr // (c) 1983 Venture Line + Taito license @@ -35101,6 +35183,7 @@ puzznicb // bootleg puzznicba // bootleg puzznici // bootleg puzznicj // C20 (c) 1989 Taito Corporation (Japan) +puzznicu // C20 (c) 1989 Taito America Corporation (US) raimais // B36 (c) 1988 Taito Corporation (Japan) raimaisj // B36 (c) 1988 Taito Corporation raimaisjo // B36 (c) 1988 Taito Corporation @@ -37978,6 +38061,7 @@ sfex2p // Street Fighter EX 2 Plus (USA 990611) sfex2pa // Street Fighter EX 2 Plus (ASIA 990611) sfex2ph // Street Fighter EX 2 Plus (HISPANIC 990611) sfex2pj // Street Fighter EX 2 Plus (JAPAN 990611) +sfex2u1 // Street Fighter EX 2 (USA 980312) sfexa // Street Fighter EX (ASIA 961219) sfexj // Street Fighter EX (JAPAN 961130) sfexp // Street Fighter EX Plus (USA 970407) diff --git a/src/mame/mess.flt b/src/mame/mess.flt index 66b57c88741..d9ef0963233 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -268,6 +268,7 @@ indigo.cpp indy_indigo2.cpp instruct.cpp interact.cpp +interpro.cpp intv.cpp ipc.cpp ipds.cpp @@ -398,6 +399,7 @@ ngp.cpp nokia_3310.cpp notetaker.cpp novag6502.cpp +novag68k.cpp ob68k1a.cpp octopus.cpp odyssey2.cpp diff --git a/src/mame/video/combatsc.cpp b/src/mame/video/combatsc.cpp index e53b1c5fa14..cae826bfec7 100644 --- a/src/mame/video/combatsc.cpp +++ b/src/mame/video/combatsc.cpp @@ -431,7 +431,7 @@ uint32_t combatsc_state::screen_update_combatsc(screen_device &screen, bitmap_in { rectangle clip; clip = cliprect; - + for (i = 0; i < 32; i++) { // scrollram [0x20]-[0x3f]: char enable (presumably bit 0 only) @@ -439,7 +439,7 @@ uint32_t combatsc_state::screen_update_combatsc(screen_device &screen, bitmap_in if(m_scrollram[base_scroll] == 0) continue; - + clip.min_y = i * 8; clip.max_y = clip.min_y + 7; diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index 5549b11e137..8cd4f6c57ee 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -735,7 +735,7 @@ static int deco16_pf_update( if (tilemap_8x8) { int numrows = rows; - + // wolffang uses a larger 8x8 tilemap for the Japanese intro text, everything else seems to need this logic tho? if (!(tilemapsizes & 4)) numrows = rows >> 1; diff --git a/src/mame/video/goldstar.cpp b/src/mame/video/goldstar.cpp index f7c4477e57e..369c6f89de1 100644 --- a/src/mame/video/goldstar.cpp +++ b/src/mame/video/goldstar.cpp @@ -487,9 +487,9 @@ uint32_t wingco_state::screen_update_mbstar(screen_device &screen, bitmap_ind16 const rectangle visible2(0*8, (14+48)*8-1, 14*8, (36+7)*8-1); // seems to be the one used... const rectangle visible3(0*8, (14+48)*8-1, 4*8, (4+7)*8-1); -// m_reel1_tilemap->draw(screen, bitmap, visible1, 0, 0); +// m_reel1_tilemap->draw(screen, bitmap, visible1, 0, 0); m_reel2_tilemap->draw(screen, bitmap, visible2, 0, 0); -// m_reel3_tilemap->draw(screen, bitmap, visible3, 0, 0); +// m_reel3_tilemap->draw(screen, bitmap, visible3, 0, 0); } if (m_cm_enable_reg & 0x02) diff --git a/src/mame/video/gundealr.cpp b/src/mame/video/gundealr.cpp index 5f528fd44bb..0f92327b189 100644 --- a/src/mame/video/gundealr.cpp +++ b/src/mame/video/gundealr.cpp @@ -111,8 +111,12 @@ WRITE8_MEMBER(gundealr_state::yamyam_fg_scroll_w) WRITE8_MEMBER(gundealr_state::gundealr_flipscreen_w) { - m_flipscreen = data; - machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + machine().tilemap().set_flip_all(BIT(data, 0) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); +} + +WRITE8_MEMBER(gundealr_state::yamyam_flipscreen_w) +{ + machine().tilemap().set_flip_all(BIT(data, 7) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); } diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp index ac784a06431..66449ac7425 100644 --- a/src/mame/video/n64.cpp +++ b/src/mame/video/n64.cpp @@ -151,6 +151,8 @@ uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitma } */ + m_rdp->mark_frame(); + if (n64->vi_blank) { bitmap.fill(0, screen.visible_area()); @@ -168,6 +170,7 @@ void n64_state::screen_eof_n64(screen_device &screen, bool state) void n64_periphs::video_update(bitmap_rgb32 &bitmap) { + if(vi_control & 0x40) /* Interlace */ { field ^= 1; @@ -1095,15 +1098,15 @@ uint32_t n64_rdp::get_log2(uint32_t lod_clamp) /*****************************************************************************/ -uint32_t n64_rdp::read_data(uint32_t address) +uint64_t n64_rdp::read_data(uint32_t address) { if (m_status & 0x1) // XBUS_DMEM_DMA enabled { - return m_dmem[(address & 0xfff) / 4]; + return (uint64_t(m_dmem[(address & 0xfff) / 4]) << 32) | m_dmem[((address + 4) & 0xfff) / 4]; } else { - return m_rdram[((address & 0xffffff) / 4)]; + return (uint64_t(m_rdram[((address & 0xffffff) / 4)]) << 32) | m_rdram[(((address + 4) & 0xffffff) / 4)]; } } @@ -1192,39 +1195,38 @@ void n64_rdp::disassemble(char* buffer) char drdy[32], dgdy[32], dbdy[32], dady[32]; char drde[32], dgde[32], dbde[32], dade[32]; - uint32_t cmd[64]; + uint64_t cmd[32]; - const uint32_t length = m_cmd_ptr * 4; + const uint32_t length = m_cmd_ptr * 8; if (length < 8) { sprintf(buffer, "ERROR: length = %d\n", length); return; } - cmd[0] = m_cmd_data[m_cmd_cur+0]; - cmd[1] = m_cmd_data[m_cmd_cur+1]; + cmd[0] = m_cmd_data[m_cmd_cur]; - const int32_t tile = (cmd[1] >> 24) & 0x7; - sprintf(sl, "%4.2f", (float)((cmd[0] >> 12) & 0xfff) / 4.0f); - sprintf(tl, "%4.2f", (float)((cmd[0] >> 0) & 0xfff) / 4.0f); - sprintf(sh, "%4.2f", (float)((cmd[1] >> 12) & 0xfff) / 4.0f); - sprintf(th, "%4.2f", (float)((cmd[1] >> 0) & 0xfff) / 4.0f); + const int32_t tile = (cmd[0] >> 56) & 0x7; + sprintf(sl, "%4.2f", (float)((cmd[0] >> 44) & 0xfff) / 4.0f); + sprintf(tl, "%4.2f", (float)((cmd[0] >> 32) & 0xfff) / 4.0f); + sprintf(sh, "%4.2f", (float)((cmd[0] >> 12) & 0xfff) / 4.0f); + sprintf(th, "%4.2f", (float)((cmd[0] >> 0) & 0xfff) / 4.0f); - const char* format = s_image_format[(cmd[0] >> 21) & 0x7]; - const char* size = s_image_size[(cmd[0] >> 19) & 0x3]; + const char* format = s_image_format[(cmd[0] >> 53) & 0x7]; + const char* size = s_image_size[(cmd[0] >> 51) & 0x3]; - const uint32_t r = (cmd[1] >> 24) & 0xff; - const uint32_t g = (cmd[1] >> 16) & 0xff; - const uint32_t b = (cmd[1] >> 8) & 0xff; - const uint32_t a = (cmd[1] >> 0) & 0xff; + const uint32_t r = (cmd[0] >> 24) & 0xff; + const uint32_t g = (cmd[0] >> 16) & 0xff; + const uint32_t b = (cmd[0] >> 8) & 0xff; + const uint32_t a = (cmd[0] >> 0) & 0xff; - const uint32_t command = (cmd[0] >> 24) & 0x3f; + const uint32_t command = (cmd[0] >> 56) & 0x3f; switch (command) { case 0x00: sprintf(buffer, "No Op"); break; case 0x08: // Tri_NoShade { - const int32_t lft = (command >> 23) & 0x1; + const int32_t lft = (cmd[0] >> 55) & 0x1; if (length != s_rdp_command_length[command]) { @@ -1232,29 +1234,26 @@ void n64_rdp::disassemble(char* buffer) return; } + cmd[1] = m_cmd_data[m_cmd_cur+1]; cmd[2] = m_cmd_data[m_cmd_cur+2]; cmd[3] = m_cmd_data[m_cmd_cur+3]; - cmd[4] = m_cmd_data[m_cmd_cur+4]; - cmd[5] = m_cmd_data[m_cmd_cur+5]; - cmd[6] = m_cmd_data[m_cmd_cur+6]; - cmd[7] = m_cmd_data[m_cmd_cur+7]; - - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)(cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)(cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)(cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)(cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)(cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)(cmd[7] / 65536.0f)); + + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); sprintf(buffer, "Tri_NoShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); break; } case 0x09: // Tri_NoShadeZ { - const int32_t lft = (command >> 23) & 0x1; + const int32_t lft = (cmd[0] >> 55) & 0x1; if (length != s_rdp_command_length[command]) { @@ -1262,29 +1261,26 @@ void n64_rdp::disassemble(char* buffer) return; } + cmd[1] = m_cmd_data[m_cmd_cur+1]; cmd[2] = m_cmd_data[m_cmd_cur+2]; cmd[3] = m_cmd_data[m_cmd_cur+3]; - cmd[4] = m_cmd_data[m_cmd_cur+4]; - cmd[5] = m_cmd_data[m_cmd_cur+5]; - cmd[6] = m_cmd_data[m_cmd_cur+6]; - cmd[7] = m_cmd_data[m_cmd_cur+7]; - - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)(cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)(cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)(cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)(cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)(cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)(cmd[7] / 65536.0f)); + + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); sprintf(buffer, "Tri_NoShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); break; } case 0x0a: // Tri_Tex { - const int32_t lft = (command >> 23) & 0x1; + const int32_t lft = (cmd[0] >> 55) & 0x1; if (length < s_rdp_command_length[command]) { @@ -1292,34 +1288,33 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 24; i++) + for (int32_t i = 1; i < 12; i++) { cmd[i] = m_cmd_data[m_cmd_cur+i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - - sprintf(s, "%4.4f", (float)(int32_t)((cmd[ 8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(t, "%4.4f", (float)(int32_t)(((cmd[ 8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(w, "%4.4f", (float)(int32_t)((cmd[ 9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_Tex %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1334,7 +1329,7 @@ void n64_rdp::disassemble(char* buffer) } case 0x0b: // Tri_TexZ { - const int32_t lft = (command >> 23) & 0x1; + const int32_t lft = (cmd[0] >> 55) & 0x1; if (length < s_rdp_command_length[command]) { @@ -1342,34 +1337,33 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 24; i++) + for (int32_t i = 1; i < 12; i++) { cmd[i] = m_cmd_data[m_cmd_cur+i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - - sprintf(s, "%4.4f", (float)(int32_t)((cmd[ 8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(t, "%4.4f", (float)(int32_t)(((cmd[ 8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(w, "%4.4f", (float)(int32_t)((cmd[ 9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_TexZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1392,36 +1386,37 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 24; i++) + for (int32_t i = 1; i < 12; i++) { cmd[i] = m_cmd_data[i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f); - sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f); - sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f); - sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f); + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f); + sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f); + sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f); + sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); + sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_Shade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1444,36 +1439,37 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 24; i++) + for (int32_t i = 1; i < 12; i++) { cmd[i] = m_cmd_data[i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f); - sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f); - sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f); - sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f); + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f); + sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f); + sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f); + sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); + sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_ShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1496,50 +1492,50 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 40; i++) + for (int32_t i = 1; i < 20; i++) { cmd[i] = m_cmd_data[m_cmd_cur+i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f); - sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f); - sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f); - sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f); - - sprintf(s, "%4.4f", (float)(int32_t)((cmd[24] & 0xffff0000) | ((cmd[28] >> 16) & 0xffff)) / 65536.0f); - sprintf(t, "%4.4f", (float)(int32_t)(((cmd[24] & 0xffff) << 16) | (cmd[28] & 0xffff)) / 65536.0f); - sprintf(w, "%4.4f", (float)(int32_t)((cmd[25] & 0xffff0000) | ((cmd[29] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[26] & 0xffff0000) | ((cmd[30] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[26] & 0xffff) << 16) | (cmd[30] & 0xffff)) / 65536.0f); - sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[27] & 0xffff0000) | ((cmd[31] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[32] & 0xffff0000) | ((cmd[36] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[32] & 0xffff) << 16) | (cmd[36] & 0xffff)) / 65536.0f); - sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[33] & 0xffff0000) | ((cmd[37] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[34] & 0xffff0000) | ((cmd[38] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[34] & 0xffff) << 16) | (cmd[38] & 0xffff)) / 65536.0f); - sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[35] & 0xffff0000) | ((cmd[39] >> 16) & 0xffff)) / 65536.0f); - + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f); + sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f); + sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f); + sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); + sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f); + + sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_TexShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1571,50 +1567,50 @@ void n64_rdp::disassemble(char* buffer) return; } - for (int32_t i = 2; i < 40; i++) + for (int32_t i = 1; i < 20; i++) { cmd[i] = m_cmd_data[m_cmd_cur+i]; } - sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); - sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f); - sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f); - sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f)); - sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f)); - sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f)); - sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f)); - sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f)); - sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f)); - sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f); - sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f); - sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f); - sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f); - sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f); - sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f); - sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f); - sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f); - sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f); - sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f); - sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f); - sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f); - sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f); - sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f); - - sprintf(s, "%4.4f", (float)(int32_t)((cmd[24] & 0xffff0000) | ((cmd[28] >> 16) & 0xffff)) / 65536.0f); - sprintf(t, "%4.4f", (float)(int32_t)(((cmd[24] & 0xffff) << 16) | (cmd[28] & 0xffff)) / 65536.0f); - sprintf(w, "%4.4f", (float)(int32_t)((cmd[25] & 0xffff0000) | ((cmd[29] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[26] & 0xffff0000) | ((cmd[30] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[26] & 0xffff) << 16) | (cmd[30] & 0xffff)) / 65536.0f); - sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[27] & 0xffff0000) | ((cmd[31] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[32] & 0xffff0000) | ((cmd[36] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[32] & 0xffff) << 16) | (cmd[36] & 0xffff)) / 65536.0f); - sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[33] & 0xffff0000) | ((cmd[37] >> 16) & 0xffff)) / 65536.0f); - sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[34] & 0xffff0000) | ((cmd[38] >> 16) & 0xffff)) / 65536.0f); - sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[34] & 0xffff) << 16) | (cmd[38] & 0xffff)) / 65536.0f); - sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[35] & 0xffff0000) | ((cmd[39] >> 16) & 0xffff)) / 65536.0f); - + sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f); + sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f); + sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f); + sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f); + sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f); + sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f); + sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f); + sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f); + sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f); + + sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f); + sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f); + sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f); + sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); + sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f); + + sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f); + sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f); + sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f); + sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f); + sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f); + sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f); buffer+=sprintf(buffer, "Tri_TexShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh); buffer+=sprintf(buffer, " "); @@ -1644,12 +1640,12 @@ void n64_rdp::disassemble(char* buffer) sprintf(buffer, "ERROR: Texture_Rectangle length = %d\n", length); return; } - cmd[2] = m_cmd_data[m_cmd_cur+2]; - cmd[3] = m_cmd_data[m_cmd_cur+3]; - sprintf(s, "%4.4f", (float)(int16_t)((cmd[2] >> 16) & 0xffff) / 32.0f); - sprintf(t, "%4.4f", (float)(int16_t)((cmd[2] >> 0) & 0xffff) / 32.0f); - sprintf(dsdx, "%4.4f", (float)(int16_t)((cmd[3] >> 16) & 0xffff) / 1024.0f); - sprintf(dtdy, "%4.4f", (float)(int16_t)((cmd[3] >> 16) & 0xffff) / 1024.0f); + + cmd[1] = m_cmd_data[m_cmd_cur+1]; + sprintf(s, "%4.4f", (float)int16_t((cmd[1] >> 48) & 0xffff) / 32.0f); + sprintf(t, "%4.4f", (float)int16_t((cmd[1] >> 32) & 0xffff) / 32.0f); + sprintf(dsdx, "%4.4f", (float)int16_t((cmd[1] >> 16) & 0xffff) / 1024.0f); + sprintf(dtdy, "%4.4f", (float)int16_t((cmd[1] >> 0) & 0xffff) / 1024.0f); if (command == 0x24) sprintf(buffer, "Texture_Rectangle %d, %s, %s, %s, %s, %s, %s, %s, %s", tile, sh, th, sl, tl, s, t, dsdx, dtdy); @@ -1663,24 +1659,24 @@ void n64_rdp::disassemble(char* buffer) case 0x28: sprintf(buffer, "Sync_Tile"); break; case 0x29: sprintf(buffer, "Sync_Full"); break; case 0x2d: sprintf(buffer, "Set_Scissor %s, %s, %s, %s", sl, tl, sh, th); break; - case 0x2e: sprintf(buffer, "Set_Prim_Depth %04X, %04X", (cmd[1] >> 16) & 0xffff, cmd[1] & 0xffff); break; - case 0x2f: sprintf(buffer, "Set_Other_Modes %08X %08X", cmd[0], cmd[1]); break; + case 0x2e: sprintf(buffer, "Set_Prim_Depth %04X, %04X", uint32_t(cmd[0] >> 16) & 0xffff, (uint32_t)cmd[0] & 0xffff); break; + case 0x2f: sprintf(buffer, "Set_Other_Modes %08X %08X", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break; case 0x30: sprintf(buffer, "Load_TLUT %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break; case 0x32: sprintf(buffer, "Set_Tile_Size %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break; - case 0x33: sprintf(buffer, "Load_Block %d, %03X, %03X, %03X, %03X", tile, (cmd[0] >> 12) & 0xfff, cmd[0] & 0xfff, (cmd[1] >> 12) & 0xfff, cmd[1] & 0xfff); break; + case 0x33: sprintf(buffer, "Load_Block %d, %03X, %03X, %03X, %03X", tile, uint32_t(cmd[0] >> 44) & 0xfff, uint32_t(cmd[0] >> 32) & 0xfff, uint32_t(cmd[0] >> 12) & 0xfff, uint32_t(cmd[1]) & 0xfff); break; case 0x34: sprintf(buffer, "Load_Tile %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break; - case 0x35: sprintf(buffer, "Set_Tile %d, %s, %s, %d, %04X", tile, format, size, ((cmd[0] >> 9) & 0x1ff) * 8, (cmd[0] & 0x1ff) * 8); break; + case 0x35: sprintf(buffer, "Set_Tile %d, %s, %s, %d, %04X", tile, format, size, (uint32_t(cmd[0] >> 41) & 0x1ff) * 8, (uint32_t(cmd[0] >> 32) & 0x1ff) * 8); break; case 0x36: sprintf(buffer, "Fill_Rectangle %s, %s, %s, %s", sh, th, sl, tl); break; case 0x37: sprintf(buffer, "Set_Fill_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break; case 0x38: sprintf(buffer, "Set_Fog_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break; case 0x39: sprintf(buffer, "Set_Blend_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break; - case 0x3a: sprintf(buffer, "Set_Prim_Color %d, %d, R: %d, G: %d, B: %d, A: %d", (cmd[0] >> 8) & 0x1f, cmd[0] & 0xff, r, g, b, a); break; + case 0x3a: sprintf(buffer, "Set_Prim_Color %d, %d, R: %d, G: %d, B: %d, A: %d", uint32_t(cmd[0] >> 40) & 0x1f, uint32_t(cmd[0] >> 32) & 0xff, r, g, b, a); break; case 0x3b: sprintf(buffer, "Set_Env_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break; - case 0x3c: sprintf(buffer, "Set_Combine %08X %08X", cmd[0], cmd[1]); break; - case 0x3d: sprintf(buffer, "Set_Texture_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break; - case 0x3e: sprintf(buffer, "Set_Mask_Image %08X", cmd[1]); break; - case 0x3f: sprintf(buffer, "Set_Color_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break; - default: sprintf(buffer, "Unknown (%08X %08X)", cmd[0], cmd[1]); break; + case 0x3c: sprintf(buffer, "Set_Combine %08X %08X", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break; + case 0x3d: sprintf(buffer, "Set_Texture_Image %s, %s, %d, %08X", format, size, (uint32_t(cmd[0] >> 32) & 0x1ff) + 1, (uint32_t)cmd[0]); break; + case 0x3e: sprintf(buffer, "Set_Mask_Image %08X", (uint32_t)cmd[0]); break; + case 0x3f: sprintf(buffer, "Set_Color_Image %s, %s, %d, %08X", format, size, (uint32_t(cmd[0] >> 32) & 0x1ff) + 1, (uint32_t)cmd[0]); break; + default: sprintf(buffer, "Unknown (%08X %08X)", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break; } } @@ -1865,16 +1861,17 @@ void n64_rdp::compute_cvg_flip(extent_t* spans, int32_t* majorx, int32_t* minorx } } +#define SIGN(x, numb) (((x) & ((1 << numb) - 1)) | -((x) & (1 << (numb - 1)))) + void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect) { - const uint32_t* cmd_data = rect ? m_temp_rect_data : m_cmd_data; + const uint64_t* cmd_data = rect ? m_temp_rect_data : m_cmd_data; const uint32_t fifo_index = rect ? 0 : m_cmd_cur; - const uint32_t w1 = cmd_data[fifo_index + 0]; - const uint32_t w2 = cmd_data[fifo_index + 1]; + const uint64_t w1 = cmd_data[fifo_index + 0]; - int32_t flip = (w1 & 0x00800000) ? 1 : 0; - m_misc_state.m_max_level = ((w1 >> 19) & 7); - int32_t tilenum = (w1 >> 16) & 0x7; + int32_t flip = int32_t(w1 >> 55) & 1; + m_misc_state.m_max_level = uint32_t(w1 >> 51) & 7; + int32_t tilenum = int32_t(w1 >> 48) & 0x7; int32_t dsdiff = 0, dtdiff = 0, dwdiff = 0, drdiff = 0, dgdiff = 0, dbdiff = 0, dadiff = 0, dzdiff = 0; int32_t dsdeh = 0, dtdeh = 0, dwdeh = 0, drdeh = 0, dgdeh = 0, dbdeh = 0, dadeh = 0, dzdeh = 0; @@ -1886,36 +1883,33 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect) int32_t maxxhx = 0; int32_t minxhx = 0; - int32_t shade_base = fifo_index + 8; - int32_t texture_base = fifo_index + 8; - int32_t zbuffer_base = fifo_index + 8; + int32_t shade_base = fifo_index + 4; + int32_t texture_base = fifo_index + 4; + int32_t zbuffer_base = fifo_index + 4; if(shade) { - texture_base += 16; - zbuffer_base += 16; + texture_base += 8; + zbuffer_base += 8; } if(texture) { - zbuffer_base += 16; + zbuffer_base += 8; } - uint32_t w3 = cmd_data[fifo_index + 2]; - uint32_t w4 = cmd_data[fifo_index + 3]; - uint32_t w5 = cmd_data[fifo_index + 4]; - uint32_t w6 = cmd_data[fifo_index + 5]; - uint32_t w7 = cmd_data[fifo_index + 6]; - uint32_t w8 = cmd_data[fifo_index + 7]; + uint64_t w2 = cmd_data[fifo_index + 1]; + uint64_t w3 = cmd_data[fifo_index + 2]; + uint64_t w4 = cmd_data[fifo_index + 3]; - int32_t yl = (w1 & 0x3fff); - int32_t ym = ((w2 >> 16) & 0x3fff); - int32_t yh = ((w2 >> 0) & 0x3fff); - int32_t xl = (int32_t)(w3 & 0x3fffffff); - int32_t xh = (int32_t)(w5 & 0x3fffffff); - int32_t xm = (int32_t)(w7 & 0x3fffffff); + int32_t yl = int32_t(w1 >> 32) & 0x3fff; + int32_t ym = int32_t(w1 >> 16) & 0x3fff; + int32_t yh = int32_t(w1 >> 0) & 0x3fff; + int32_t xl = (int32_t)(w2 >> 32) & 0x3fffffff; + int32_t xh = (int32_t)(w3 >> 32) & 0x3fffffff; + int32_t xm = (int32_t)(w4 >> 32) & 0x3fffffff; // Inverse slopes in 16.16 format - int32_t dxldy = (int32_t)(w4); - int32_t dxhdy = (int32_t)(w6); - int32_t dxmdy = (int32_t)(w8); + int32_t dxldy = (int32_t)w2; + int32_t dxhdy = (int32_t)w3; + int32_t dxmdy = (int32_t)w4; if (yl & 0x2000) yl |= 0xffffc000; if (ym & 0x2000) ym |= 0xffffc000; @@ -1925,38 +1919,40 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect) if (xm & 0x20000000) xm |= 0xc0000000; if (xh & 0x20000000) xh |= 0xc0000000; - int32_t r = (cmd_data[shade_base+0 ] & 0xffff0000) | ((cmd_data[shade_base+4 ] >> 16) & 0x0000ffff); - int32_t g = ((cmd_data[shade_base+0 ] << 16) & 0xffff0000) | (cmd_data[shade_base+4 ] & 0x0000ffff); - int32_t b = (cmd_data[shade_base+1 ] & 0xffff0000) | ((cmd_data[shade_base+5 ] >> 16) & 0x0000ffff); - int32_t a = ((cmd_data[shade_base+1 ] << 16) & 0xffff0000) | (cmd_data[shade_base+5 ] & 0x0000ffff); - const int32_t drdx = (cmd_data[shade_base+2 ] & 0xffff0000) | ((cmd_data[shade_base+6 ] >> 16) & 0x0000ffff); - const int32_t dgdx = ((cmd_data[shade_base+2 ] << 16) & 0xffff0000) | (cmd_data[shade_base+6 ] & 0x0000ffff); - const int32_t dbdx = (cmd_data[shade_base+3 ] & 0xffff0000) | ((cmd_data[shade_base+7 ] >> 16) & 0x0000ffff); - const int32_t dadx = ((cmd_data[shade_base+3 ] << 16) & 0xffff0000) | (cmd_data[shade_base+7 ] & 0x0000ffff); - const int32_t drde = (cmd_data[shade_base+8 ] & 0xffff0000) | ((cmd_data[shade_base+12] >> 16) & 0x0000ffff); - const int32_t dgde = ((cmd_data[shade_base+8 ] << 16) & 0xffff0000) | (cmd_data[shade_base+12] & 0x0000ffff); - const int32_t dbde = (cmd_data[shade_base+9 ] & 0xffff0000) | ((cmd_data[shade_base+13] >> 16) & 0x0000ffff); - const int32_t dade = ((cmd_data[shade_base+9 ] << 16) & 0xffff0000) | (cmd_data[shade_base+13] & 0x0000ffff); - const int32_t drdy = (cmd_data[shade_base+10] & 0xffff0000) | ((cmd_data[shade_base+14] >> 16) & 0x0000ffff); - const int32_t dgdy = ((cmd_data[shade_base+10] << 16) & 0xffff0000) | (cmd_data[shade_base+14] & 0x0000ffff); - const int32_t dbdy = (cmd_data[shade_base+11] & 0xffff0000) | ((cmd_data[shade_base+15] >> 16) & 0x0000ffff); - const int32_t dady = ((cmd_data[shade_base+11] << 16) & 0xffff0000) | (cmd_data[shade_base+15] & 0x0000ffff); - int32_t s = (cmd_data[texture_base+0 ] & 0xffff0000) | ((cmd_data[texture_base+4 ] >> 16) & 0x0000ffff); - int32_t t = ((cmd_data[texture_base+0 ] << 16) & 0xffff0000) | (cmd_data[texture_base+4 ] & 0x0000ffff); - int32_t w = (cmd_data[texture_base+1 ] & 0xffff0000) | ((cmd_data[texture_base+5 ] >> 16) & 0x0000ffff); - const int32_t dsdx = (cmd_data[texture_base+2 ] & 0xffff0000) | ((cmd_data[texture_base+6 ] >> 16) & 0x0000ffff); - const int32_t dtdx = ((cmd_data[texture_base+2 ] << 16) & 0xffff0000) | (cmd_data[texture_base+6 ] & 0x0000ffff); - const int32_t dwdx = (cmd_data[texture_base+3 ] & 0xffff0000) | ((cmd_data[texture_base+7 ] >> 16) & 0x0000ffff); - const int32_t dsde = (cmd_data[texture_base+8 ] & 0xffff0000) | ((cmd_data[texture_base+12] >> 16) & 0x0000ffff); - const int32_t dtde = ((cmd_data[texture_base+8 ] << 16) & 0xffff0000) | (cmd_data[texture_base+12] & 0x0000ffff); - const int32_t dwde = (cmd_data[texture_base+9 ] & 0xffff0000) | ((cmd_data[texture_base+13] >> 16) & 0x0000ffff); - const int32_t dsdy = (cmd_data[texture_base+10] & 0xffff0000) | ((cmd_data[texture_base+14] >> 16) & 0x0000ffff); - const int32_t dtdy = ((cmd_data[texture_base+10] << 16) & 0xffff0000) | (cmd_data[texture_base+14] & 0x0000ffff); - const int32_t dwdy = (cmd_data[texture_base+11] & 0xffff0000) | ((cmd_data[texture_base+15] >> 16) & 0x0000ffff); - int32_t z = cmd_data[zbuffer_base+0]; - const int32_t dzdx = cmd_data[zbuffer_base+1]; - const int32_t dzde = cmd_data[zbuffer_base+2]; - const int32_t dzdy = cmd_data[zbuffer_base+3]; + int32_t r = int32_t(((cmd_data[shade_base] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 2] >> 48) & 0x0000ffff)); + int32_t g = int32_t(((cmd_data[shade_base] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 2] >> 32) & 0x0000ffff)); + int32_t b = int32_t( (cmd_data[shade_base] & 0xffff0000) | ((cmd_data[shade_base + 2] >> 16) & 0x0000ffff)); + int32_t a = int32_t(((cmd_data[shade_base] << 16) & 0xffff0000) | (cmd_data[shade_base + 2] & 0x0000ffff)); + const int32_t drdx = int32_t(((cmd_data[shade_base + 1] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 3] >> 48) & 0x0000ffff)); + const int32_t dgdx = int32_t(((cmd_data[shade_base + 1] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 3] >> 32) & 0x0000ffff)); + const int32_t dbdx = int32_t( (cmd_data[shade_base + 1] & 0xffff0000) | ((cmd_data[shade_base + 3] >> 16) & 0x0000ffff)); + const int32_t dadx = int32_t(((cmd_data[shade_base + 1] << 16) & 0xffff0000) | (cmd_data[shade_base + 3] & 0x0000ffff)); + const int32_t drde = int32_t(((cmd_data[shade_base + 4] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 6] >> 48) & 0x0000ffff)); + const int32_t dgde = int32_t(((cmd_data[shade_base + 4] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 6] >> 32) & 0x0000ffff)); + const int32_t dbde = int32_t( (cmd_data[shade_base + 4] & 0xffff0000) | ((cmd_data[shade_base + 6] >> 16) & 0x0000ffff)); + const int32_t dade = int32_t(((cmd_data[shade_base + 4] << 16) & 0xffff0000) | (cmd_data[shade_base + 6] & 0x0000ffff)); + const int32_t drdy = int32_t(((cmd_data[shade_base + 5] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 7] >> 48) & 0x0000ffff)); + const int32_t dgdy = int32_t(((cmd_data[shade_base + 5] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 7] >> 32) & 0x0000ffff)); + const int32_t dbdy = int32_t( (cmd_data[shade_base + 5] & 0xffff0000) | ((cmd_data[shade_base + 7] >> 16) & 0x0000ffff)); + const int32_t dady = int32_t(((cmd_data[shade_base + 5] << 16) & 0xffff0000) | (cmd_data[shade_base + 7] & 0x0000ffff)); + + int32_t s = int32_t(((cmd_data[texture_base] >> 32) & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 48) & 0x0000ffff)); + int32_t t = int32_t(((cmd_data[texture_base] >> 16) & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 32) & 0x0000ffff)); + int32_t w = int32_t( (cmd_data[texture_base] & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 16) & 0x0000ffff)); + const int32_t dsdx = int32_t(((cmd_data[texture_base + 1] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 3] >> 48) & 0x0000ffff)); + const int32_t dtdx = int32_t(((cmd_data[texture_base + 1] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 3] >> 32) & 0x0000ffff)); + const int32_t dwdx = int32_t( (cmd_data[texture_base + 1] & 0xffff0000) | ((cmd_data[texture_base + 3] >> 16) & 0x0000ffff)); + const int32_t dsde = int32_t(((cmd_data[texture_base + 4] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 6] >> 48) & 0x0000ffff)); + const int32_t dtde = int32_t(((cmd_data[texture_base + 4] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 6] >> 32) & 0x0000ffff)); + const int32_t dwde = int32_t( (cmd_data[texture_base + 4] & 0xffff0000) | ((cmd_data[texture_base + 6] >> 16) & 0x0000ffff)); + const int32_t dsdy = int32_t(((cmd_data[texture_base + 5] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 7] >> 48) & 0x0000ffff)); + const int32_t dtdy = int32_t(((cmd_data[texture_base + 5] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 7] >> 32) & 0x0000ffff)); + const int32_t dwdy = int32_t( (cmd_data[texture_base + 5] & 0xffff0000) | ((cmd_data[texture_base + 7] >> 16) & 0x0000ffff)); + + int32_t z = int32_t(cmd_data[zbuffer_base] >> 32); + const int32_t dzdx = int32_t(cmd_data[zbuffer_base]); + const int32_t dzde = int32_t(cmd_data[zbuffer_base+1] >> 32); + const int32_t dzdy = int32_t(cmd_data[zbuffer_base+1]); const int32_t dzdy_dz = (dzdy >> 16) & 0xffff; const int32_t dzdx_dz = (dzdx >> 16) & 0xffff; @@ -2215,207 +2211,180 @@ void n64_rdp::triangle(bool shade, bool texture, bool zbuffer) m_pipe_clean = false; } -void n64_rdp::cmd_triangle(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle(uint64_t w1) { triangle(false, false, false); } -void n64_rdp::cmd_triangle_z(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_z(uint64_t w1) { triangle(false, false, true); } -void n64_rdp::cmd_triangle_t(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_t(uint64_t w1) { triangle(false, true, false); } -void n64_rdp::cmd_triangle_tz(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_tz(uint64_t w1) { triangle(false, true, true); } -void n64_rdp::cmd_triangle_s(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_s(uint64_t w1) { triangle(true, false, false); } -void n64_rdp::cmd_triangle_sz(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_sz(uint64_t w1) { triangle(true, false, true); } -void n64_rdp::cmd_triangle_st(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_st(uint64_t w1) { triangle(true, true, false); } -void n64_rdp::cmd_triangle_stz(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_triangle_stz(uint64_t w1) { triangle(true, true, true); } -void n64_rdp::cmd_tex_rect(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_tex_rect(uint64_t w1) { - const uint32_t* data = m_cmd_data + m_cmd_cur; + const uint64_t* data = m_cmd_data + m_cmd_cur; - const uint32_t w3 = data[2]; - const uint32_t w4 = data[3]; + const uint64_t w2 = data[1]; - const int32_t tilenum = (w2 >> 24) & 0x7; - const int32_t xh = (w2 >> 12) & 0xfff; - const int32_t xl = (w1 >> 12) & 0xfff; - const int32_t yh = (w2 >> 0) & 0xfff; - int32_t yl = (w1 >> 0) & 0xfff; + const uint64_t tilenum = (w1 >> 24) & 0x7; + const uint64_t xh = (w1 >> 12) & 0xfff; + const uint64_t xl = (w1 >> 44) & 0xfff; + const uint64_t yh = (w1 >> 0) & 0xfff; + uint64_t yl = (w1 >> 32) & 0xfff; - const int32_t s = (w3 >> 16) & 0xffff; - const int32_t t = (w3 >> 0) & 0xffff; - const int32_t dsdx = SIGN16((w4 >> 16) & 0xffff); - const int32_t dtdy = SIGN16((w4 >> 0) & 0xffff); + const uint64_t s = (w2 >> 48) & 0xffff; + const uint64_t t = (w2 >> 32) & 0xffff; + const uint64_t dsdx = SIGN16((w2 >> 16) & 0xffff); + const uint64_t dtdy = SIGN16((w2 >> 0) & 0xffff); if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY) { yl |= 3; } - const int32_t xlint = (xl >> 2) & 0x3ff; - const int32_t xhint = (xh >> 2) & 0x3ff; - - uint32_t* ewdata = m_temp_rect_data; - ewdata[0] = (0x24 << 24) | ((0x80 | tilenum) << 16) | yl; // command, flipped, tile, yl - ewdata[1] = (yl << 16) | yh; // ym, yh - ewdata[2] = (xlint << 16) | ((xl & 3) << 14); // xl, xl frac - // ewdata[3] = 0; dxldy, dxldy frac - ewdata[4] = (xhint << 16) | ((xh & 3) << 14); // xh, xh frac - // ewdata[5] = 0; dxhdy, dxhdy frac - ewdata[6] = (xlint << 16) | ((xl & 3) << 14); // xm, xm frac - //ewdata[7] = 0; dxmdy, dxmdy frac - memset(&ewdata[8], 0, 16 * sizeof(uint32_t)); // shade - ewdata[24] = (s << 16) | t; // s, t - // ewdata[25] = 0; w - ewdata[26] = ((dsdx >> 5) << 16); // dsdx, dtdx - // ewdata[27] = 0; dwdx - // ewdata[28] = 0; s frac, t frac - // ewdata[29] = 0; w frac - ewdata[30] = ((dsdx & 0x1f) << 11) << 16; // dsdx frac, dtdx frac - // ewdata[31] = 0; dwdx frac - ewdata[32] = (dtdy >> 5) & 0xffff; // dsde, dtde - // ewdata[33] = 0; dwde - ewdata[34] = (dtdy >> 5) & 0xffff; // dsdy, dtdy - // ewdata[35] = 0; dwdy - ewdata[36] = (dtdy & 0x1f) << 11; // dsde frac, dtde frac - // ewdata[37] = 0; dwde frac - ewdata[38] = (dtdy & 0x1f) << 11; // dsdy frac, dtdy frac - // ewdata[39] = 0; // dwdy frac + const uint64_t xlint = (xl >> 2) & 0x3ff; + const uint64_t xhint = (xh >> 2) & 0x3ff; + + uint64_t* ewdata = m_temp_rect_data; + ewdata[0] = ((uint64_t)0x24 << 56) | ((0x80L | tilenum) << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl + ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0) + ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0) + ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0) + memset(&ewdata[4], 0, 8 * sizeof(uint64_t)); // shade + ewdata[12] = (s << 48) | (t << 32); // s, t, w (0) + ewdata[13] = (dsdx >> 5) << 48; // dsdx, dtdx, dwdx (0) + ewdata[14] = 0; // s frac (0), t frac (0), w frac (0) + ewdata[15] = (dsdx & 0x1f) << 59; // dsdx frac, dtdx frac, dwdx frac (0) + ewdata[16] = ((dtdy >> 5) & 0xffff) << 32; // dsde, dtde, dwde (0) + ewdata[17] = ((dtdy >> 5) & 0xffff) << 32; // dsdy, dtdy, dwdy (0) + ewdata[18] = ((dtdy & 0x1f) << 11) << 32; // dsde frac, dtde frac, dwde frac (0) + ewdata[38] = ((dtdy & 0x1f) << 11) << 32; // dsdy frac, dtdy frac, dwdy frac (0) // ewdata[40-43] = 0; // depth draw_triangle(true, true, false, true); } -void n64_rdp::cmd_tex_rect_flip(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_tex_rect_flip(uint64_t w1) { - const uint32_t* data = m_cmd_data + m_cmd_cur; + const uint64_t* data = m_cmd_data + m_cmd_cur; - const uint32_t w3 = data[2]; - const uint32_t w4 = data[3]; + const uint64_t w2 = data[1]; - const int32_t tilenum = (w2 >> 24) & 0x7; - const int32_t xh = (w2 >> 12) & 0xfff; - const int32_t xl = (w1 >> 12) & 0xfff; - const int32_t yh = (w2 >> 0) & 0xfff; - int32_t yl = (w1 >> 0) & 0xfff; + const uint64_t tilenum = (w1 >> 56) & 0x7; + const uint64_t xh = (w1 >> 12) & 0xfff; + const uint64_t xl = (w1 >> 44) & 0xfff; + const uint64_t yh = (w1 >> 0) & 0xfff; + uint64_t yl = (w1 >> 32) & 0xfff; - const int32_t s = (w3 >> 16) & 0xffff; - const int32_t t = (w3 >> 0) & 0xffff; - const int32_t dsdx = SIGN16((w4 >> 16) & 0xffff); - const int32_t dtdy = SIGN16((w4 >> 0) & 0xffff); + const uint64_t s = (w2 >> 48) & 0xffff; + const uint64_t t = (w2 >> 32) & 0xffff; + const uint64_t dsdx = SIGN16((w2 >> 16) & 0xffff); + const uint64_t dtdy = SIGN16((w2 >> 0) & 0xffff); if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY) { yl |= 3; } - const int32_t xlint = (xl >> 2) & 0x3ff; - const int32_t xhint = (xh >> 2) & 0x3ff; - - uint32_t* ewdata = m_temp_rect_data; - ewdata[0] = (0x25 << 24) | ((0x80 | tilenum) << 16) | yl; // command, flipped, tile, yl - ewdata[1] = (yl << 16) | yh; // ym, yh - ewdata[2] = (xlint << 16) | ((xl & 3) << 14); // xl, xl frac - // ewdata[3] = 0; dxldy, dxldy frac - ewdata[4] = (xhint << 16) | ((xh & 3) << 14); // xh, xh frac - // ewdata[5] = 0; dxhdy, dxhdy frac - ewdata[6] = (xlint << 16) | ((xl & 3) << 14); // xm, xm frac - // ewdata[7] = 0; dxmdy, dxmdy frac - memset(&ewdata[8], 0, 16 * sizeof(uint32_t)); // shade - ewdata[24] = (s << 16) | t; // s, t - // ewdata[25] = 0; // w - ewdata[26] = (dtdy >> 5) & 0xffff; // dsdx, dtdx - // ewdata[27] = 0; dwdx - // ewdata[28] = 0; s frac, t frac - // ewdata[29] = 0; w frac - ewdata[30] = ((dtdy & 0x1f) << 11); // dsdx frac, dtdx frac - // ewdata[31] = 0; dwdx frac - ewdata[32] = (dsdx >> 5) << 16; // dsde, dtde - // ewdata[33] = 0; dwde - ewdata[34] = (dsdx >> 5) << 16; // dsdy, dtdy - // ewdata[35] = 0; dwdy - ewdata[36] = (dsdx & 0x1f) << 27; // dsde frac, dtde frac - // ewdata[37] = 0; dwde frac - ewdata[38] = (dsdx & 0x1f) << 27; // dsdy frac, dtdy frac - // ewdata[39] = 0; // dwdy frac - // ewdata[40-43] = 0; // depth + const uint64_t xlint = (xl >> 2) & 0x3ff; + const uint64_t xhint = (xh >> 2) & 0x3ff; + + uint64_t* ewdata = m_temp_rect_data; + ewdata[0] = ((uint64_t)0x25 << 56) | ((0x80L | tilenum) << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl + ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0) + ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0) + ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0) + memset(&ewdata[4], 0, 8 * sizeof(uint64_t)); // shade + ewdata[12] = (s << 48) | (t << 32); // s, t, w (0) + ewdata[13] = ((dtdy >> 5) & 0xffff) << 32; // dsdx, dtdx, dwdx (0) + ewdata[14] = 0; // s frac (0), t frac (0), w frac (0) + ewdata[15] = ((dtdy & 0x1f) << 43); // dsdx frac, dtdx frac, dwdx frac (0) + ewdata[16] = (dsdx >> 5) << 48; // dsde, dtde, dwde (0) + ewdata[17] = (dsdx >> 5) << 48; // dsdy, dtdy, dwdy (0) + ewdata[18] = (dsdx & 0x1f) << 59; // dsde frac, dtde frac, dwde frac (0) + ewdata[19] = (dsdx & 0x1f) << 59; // dsdy frac, dtdy frac, dwdy frac (0) draw_triangle(true, true, false, true); } -void n64_rdp::cmd_sync_load(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_sync_load(uint64_t w1) { //wait("SyncLoad"); } -void n64_rdp::cmd_sync_pipe(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_sync_pipe(uint64_t w1) { //wait("SyncPipe"); } -void n64_rdp::cmd_sync_tile(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_sync_tile(uint64_t w1) { //wait("SyncTile"); } -void n64_rdp::cmd_sync_full(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_sync_full(uint64_t w1) { //wait("SyncFull"); dp_full_sync(*m_machine); } -void n64_rdp::cmd_set_key_gb(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_key_gb(uint64_t w1) { - m_key_scale.set_b(w2 & 0xff); - m_key_scale.set_g((w2 >> 16) & 0xff); + m_key_scale.set_b(uint32_t(w1 >> 0) & 0xff); + m_key_scale.set_g(uint32_t(w1 >> 16) & 0xff); } -void n64_rdp::cmd_set_key_r(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_key_r(uint64_t w1) { - m_key_scale.set_r(w2 & 0xff); + m_key_scale.set_r(uint32_t(w1 & 0xff)); } -void n64_rdp::cmd_set_fill_color32(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_fill_color32(uint64_t w1) { //wait("SetFillColor"); - m_fill_color = w2; + m_fill_color = (uint32_t)w1; } -void n64_rdp::cmd_set_convert(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_convert(uint64_t w1) { if(!m_pipe_clean) { m_pipe_clean = true; wait("SetConvert"); } - int32_t k0 = (w1 >> 13) & 0x1ff; - int32_t k1 = (w1 >> 4) & 0x1ff; - int32_t k2 = ((w1 & 0xf) << 5) | ((w2 >> 27) & 0x1f); - int32_t k3 = (w2 >> 18) & 0x1ff; - int32_t k4 = (w2 >> 9) & 0x1ff; - int32_t k5 = w2 & 0x1ff; + int32_t k0 = int32_t(w1 >> 45) & 0x1ff; + int32_t k1 = int32_t(w1 >> 36) & 0x1ff; + int32_t k2 = int32_t(w1 >> 27) & 0x1ff; + int32_t k3 = int32_t(w1 >> 18) & 0x1ff; + int32_t k4 = int32_t(w1 >> 9) & 0x1ff; + int32_t k5 = int32_t(w1 >> 0) & 0x1ff; k0 = (SIGN9(k0) << 1) + 1; k1 = (SIGN9(k1) << 1) + 1; @@ -2425,81 +2394,83 @@ void n64_rdp::cmd_set_convert(uint32_t w1, uint32_t w2) set_yuv_factors(rgbaint_t(0, k0, k2, k3), rgbaint_t(0, 0, k1, 0), rgbaint_t(k4, k4, k4, k4), rgbaint_t(k5, k5, k5, k5)); } -void n64_rdp::cmd_set_scissor(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_scissor(uint64_t w1) { - m_scissor.m_xh = ((w1 >> 12) & 0xfff) >> 2; - m_scissor.m_yh = ((w1 >> 0) & 0xfff) >> 2; - m_scissor.m_xl = ((w2 >> 12) & 0xfff) >> 2; - m_scissor.m_yl = ((w2 >> 0) & 0xfff) >> 2; + m_scissor.m_xh = ((w1 >> 44) & 0xfff) >> 2; + m_scissor.m_yh = ((w1 >> 32) & 0xfff) >> 2; + m_scissor.m_xl = ((w1 >> 12) & 0xfff) >> 2; + m_scissor.m_yl = ((w1 >> 0) & 0xfff) >> 2; // TODO: handle f & o? } -void n64_rdp::cmd_set_prim_depth(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_prim_depth(uint64_t w1) { - m_misc_state.m_primitive_z = w2 & 0x7fff0000; - m_misc_state.m_primitive_dz = (uint16_t)(w1); + m_misc_state.m_primitive_z = (uint32_t)(w1 & 0x7fff0000); + m_misc_state.m_primitive_dz = (uint16_t)(w1 >> 32); } -void n64_rdp::cmd_set_other_modes(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_other_modes(uint64_t w1) { //wait("SetOtherModes"); - m_other_modes.cycle_type = (w1 >> 20) & 0x3; // 01 - m_other_modes.persp_tex_en = (w1 & 0x80000) ? 1 : 0; // 1 - m_other_modes.detail_tex_en = (w1 & 0x40000) ? 1 : 0; // 0 - m_other_modes.sharpen_tex_en = (w1 & 0x20000) ? 1 : 0; // 0 - m_other_modes.tex_lod_en = (w1 & 0x10000) ? 1 : 0; // 0 - m_other_modes.en_tlut = (w1 & 0x08000) ? 1 : 0; // 0 - m_other_modes.tlut_type = (w1 & 0x04000) ? 1 : 0; // 0 - m_other_modes.sample_type = (w1 & 0x02000) ? 1 : 0; // 1 - m_other_modes.mid_texel = (w1 & 0x01000) ? 1 : 0; // 0 - m_other_modes.bi_lerp0 = (w1 & 0x00800) ? 1 : 0; // 1 - m_other_modes.bi_lerp1 = (w1 & 0x00400) ? 1 : 0; // 1 - m_other_modes.convert_one = (w1 & 0x00200) ? 1 : 0; // 0 - m_other_modes.key_en = (w1 & 0x00100) ? 1 : 0; // 0 - m_other_modes.rgb_dither_sel = (w1 >> 6) & 0x3; // 00 - m_other_modes.alpha_dither_sel = (w1 >> 4) & 0x3; // 01 - m_other_modes.blend_m1a_0 = (w2 >> 30) & 0x3; // 11 - m_other_modes.blend_m1a_1 = (w2 >> 28) & 0x3; // 00 - m_other_modes.blend_m1b_0 = (w2 >> 26) & 0x3; // 10 - m_other_modes.blend_m1b_1 = (w2 >> 24) & 0x3; // 00 - m_other_modes.blend_m2a_0 = (w2 >> 22) & 0x3; // 00 - m_other_modes.blend_m2a_1 = (w2 >> 20) & 0x3; // 01 - m_other_modes.blend_m2b_0 = (w2 >> 18) & 0x3; // 00 - m_other_modes.blend_m2b_1 = (w2 >> 16) & 0x3; // 01 - m_other_modes.force_blend = (w2 >> 14) & 1; // 0 - m_other_modes.blend_shift = m_other_modes.force_blend ? 5 : 2; - m_other_modes.alpha_cvg_select = (w2 >> 13) & 1; // 1 - m_other_modes.cvg_times_alpha = (w2 >> 12) & 1; // 0 - m_other_modes.z_mode = (w2 >> 10) & 0x3; // 00 - m_other_modes.cvg_dest = (w2 >> 8) & 0x3; // 00 - m_other_modes.color_on_cvg = (w2 >> 7) & 1; // 0 - m_other_modes.image_read_en = (w2 >> 6) & 1; // 1 - m_other_modes.z_update_en = (w2 >> 5) & 1; // 1 - m_other_modes.z_compare_en = (w2 >> 4) & 1; // 1 - m_other_modes.antialias_en = (w2 >> 3) & 1; // 1 - m_other_modes.z_source_sel = (w2 >> 2) & 1; // 0 - m_other_modes.dither_alpha_en = (w2 >> 1) & 1; // 0 - m_other_modes.alpha_compare_en = (w2) & 1; // 0 + m_other_modes.cycle_type = (w1 >> 52) & 0x3; // 01 + m_other_modes.persp_tex_en = (w1 >> 51) & 1; // 1 + m_other_modes.detail_tex_en = (w1 >> 50) & 1; // 0 + m_other_modes.sharpen_tex_en = (w1 >> 49) & 1; // 0 + m_other_modes.tex_lod_en = (w1 >> 48) & 1; // 0 + m_other_modes.en_tlut = (w1 >> 47) & 1; // 0 + m_other_modes.tlut_type = (w1 >> 46) & 1; // 0 + m_other_modes.sample_type = (w1 >> 45) & 1; // 1 + m_other_modes.mid_texel = (w1 >> 44) & 1; // 0 + m_other_modes.bi_lerp0 = (w1 >> 43) & 1; // 1 + m_other_modes.bi_lerp1 = (w1 >> 42) & 1; // 1 + m_other_modes.convert_one = (w1 >> 41) & 1; // 0 + m_other_modes.key_en = (w1 >> 40) & 1; // 0 + m_other_modes.rgb_dither_sel = (w1 >> 38) & 0x3; // 00 + m_other_modes.alpha_dither_sel = (w1 >> 36) & 0x3; // 01 + m_other_modes.blend_m1a_0 = (w1 >> 30) & 0x3; // 11 + m_other_modes.blend_m1a_1 = (w1 >> 28) & 0x3; // 00 + m_other_modes.blend_m1b_0 = (w1 >> 26) & 0x3; // 10 + m_other_modes.blend_m1b_1 = (w1 >> 24) & 0x3; // 00 + m_other_modes.blend_m2a_0 = (w1 >> 22) & 0x3; // 00 + m_other_modes.blend_m2a_1 = (w1 >> 20) & 0x3; // 01 + m_other_modes.blend_m2b_0 = (w1 >> 18) & 0x3; // 00 + m_other_modes.blend_m2b_1 = (w1 >> 16) & 0x3; // 01 + m_other_modes.force_blend = (w1 >> 14) & 1; // 0 + m_other_modes.blend_shift = m_other_modes.force_blend ? 5 : 2; + m_other_modes.alpha_cvg_select = (w1 >> 13) & 1; // 1 + m_other_modes.cvg_times_alpha = (w1 >> 12) & 1; // 0 + m_other_modes.z_mode = (w1 >> 10) & 0x3; // 00 + m_other_modes.cvg_dest = (w1 >> 8) & 0x3; // 00 + m_other_modes.color_on_cvg = (w1 >> 7) & 1; // 0 + m_other_modes.image_read_en = (w1 >> 6) & 1; // 1 + m_other_modes.z_update_en = (w1 >> 5) & 1; // 1 + m_other_modes.z_compare_en = (w1 >> 4) & 1; // 1 + m_other_modes.antialias_en = (w1 >> 3) & 1; // 1 + m_other_modes.z_source_sel = (w1 >> 2) & 1; // 0 + m_other_modes.dither_alpha_en = (w1 >> 1) & 1; // 0 + m_other_modes.alpha_compare_en = (w1 >> 0) & 1; // 0 m_other_modes.alpha_dither_mode = (m_other_modes.alpha_compare_en << 1) | m_other_modes.dither_alpha_en; } -void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_load_tlut(uint64_t w1) { //wait("LoadTLUT"); n64_tile_t* tile = m_tiles; - const int32_t tilenum = (w2 >> 24) & 0x7; - const int32_t sl = tile[tilenum].sl = ((w1 >> 12) & 0xfff); - const int32_t tl = tile[tilenum].tl = w1 & 0xfff; - const int32_t sh = tile[tilenum].sh = ((w2 >> 12) & 0xfff); - const int32_t th = tile[tilenum].th = w2 & 0xfff; + const int32_t tilenum = (w1 >> 24) & 0x7; + const int32_t sl = tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff; + const int32_t tl = tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff; + const int32_t sh = tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff; + const int32_t th = tile[tilenum].th = int32_t(w1 >> 0) & 0xfff; if (tl != th) { fatalerror("Load tlut: tl=%d, th=%d\n",tl,th); } + m_capture.data_begin(); + const int32_t count = ((sh >> 2) - (sl >> 2) + 1) << 2; switch (m_misc_state.m_ti_size) @@ -2519,6 +2490,7 @@ void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2) if (dststart < 2048) { dst[dststart] = U_RREADIDX16(srcstart); + m_capture.data_block()->put16(dst[dststart]); dst[dststart + 1] = dst[dststart]; dst[dststart + 2] = dst[dststart]; dst[dststart + 3] = dst[dststart]; @@ -2531,37 +2503,39 @@ void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2) default: fatalerror("RDP: load_tlut: size = %d\n", m_misc_state.m_ti_size); } + m_capture.data_end(); + m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th); m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl); } -void n64_rdp::cmd_set_tile_size(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_tile_size(uint64_t w1) { //wait("SetTileSize"); - const int32_t tilenum = (w2 >> 24) & 0x7; + const int32_t tilenum = int32_t(w1 >> 24) & 0x7; - m_tiles[tilenum].sl = (w1 >> 12) & 0xfff; - m_tiles[tilenum].tl = (w1 >> 0) & 0xfff; - m_tiles[tilenum].sh = (w2 >> 12) & 0xfff; - m_tiles[tilenum].th = (w2 >> 0) & 0xfff; + m_tiles[tilenum].sl = int32_t(w1 >> 44) & 0xfff; + m_tiles[tilenum].tl = int32_t(w1 >> 32) & 0xfff; + m_tiles[tilenum].sh = int32_t(w1 >> 12) & 0xfff; + m_tiles[tilenum].th = int32_t(w1 >> 0) & 0xfff; m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th); m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl); } -void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_load_block(uint64_t w1) { //wait("LoadBlock"); n64_tile_t* tile = m_tiles; - const int32_t tilenum = (w2 >> 24) & 0x7; + const int32_t tilenum = int32_t(w1 >> 24) & 0x7; uint16_t* tc = get_tmem16(); - int32_t sl = tile[tilenum].sl = ((w1 >> 12) & 0xfff); - int32_t tl = tile[tilenum].tl = ((w1 >> 0) & 0xfff); - int32_t sh = tile[tilenum].sh = ((w2 >> 12) & 0xfff); - const int32_t dxt = ((w2 >> 0) & 0xfff); + int32_t sl = tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff; + int32_t tl = tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff; + int32_t sh = tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff; + const int32_t dxt = int32_t(w1 >> 0) & 0xfff; if (sh < sl) { @@ -2584,6 +2558,8 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) const uint32_t src = (m_misc_state.m_ti_address >> 1) + (tl * tiwinwords) + slinwords; + m_capture.data_begin(); + if (dxt != 0) { int32_t j = 0; @@ -2608,6 +2584,12 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) tc[((ptr + 1) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 1); tc[((ptr + 2) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 2); tc[((ptr + 3) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 3); + + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); + j += dxt; } } @@ -2636,6 +2618,10 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) tc[ptr] = ((first >> 8) << 8) | (sec >> 8); tc[ptr | 0x400] = ((first & 0xff) << 8) | (sec & 0xff); + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); j += dxt; } } @@ -2657,6 +2643,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) tc[ptr] = U_RREADIDX16(srcptr + 2); tc[ptr | 0x400] = U_RREADIDX16(srcptr + 3); + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); + j += dxt; } } @@ -2674,6 +2665,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) tc[((ptr + 1) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 1); tc[((ptr + 2) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 2); tc[((ptr + 3) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 3); + + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); } } else if (tile[tilenum].format == FORMAT_YUV) @@ -2692,6 +2688,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) sec = U_RREADIDX16(srcptr + 3); tc[ptr] = ((first >> 8) << 8) | (sec >> 8); tc[ptr | 0x400] = ((first & 0xff) << 8) | (sec & 0xff); + + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); } } else @@ -2706,25 +2707,32 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2) ptr = ((tb + (i << 1) + 1) ^ WORD_ADDR_XOR) & 0x3ff; tc[ptr] = U_RREADIDX16(srcptr + 2); tc[ptr | 0x400] = U_RREADIDX16(srcptr + 3); + + m_capture.data_block()->put16(U_RREADIDX16(srcptr)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+1)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+2)); + m_capture.data_block()->put16(U_RREADIDX16(srcptr+3)); } } tile[tilenum].th = tl; } + m_capture.data_end(); + m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th); m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl); } -void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_load_tile(uint64_t w1) { //wait("LoadTile"); n64_tile_t* tile = m_tiles; - const int32_t tilenum = (w2 >> 24) & 0x7; + const int32_t tilenum = int32_t(w1 >> 24) & 0x7; - tile[tilenum].sl = ((w1 >> 12) & 0xfff); - tile[tilenum].tl = ((w1 >> 0) & 0xfff); - tile[tilenum].sh = ((w2 >> 12) & 0xfff); - tile[tilenum].th = ((w2 >> 0) & 0xfff); + tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff; + tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff; + tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff; + tile[tilenum].th = int32_t(w1 >> 0) & 0xfff; const int32_t sl = tile[tilenum].sl >> 2; const int32_t tl = tile[tilenum].tl >> 2; @@ -2746,6 +2754,8 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) topad = 0; // ???? */ + m_capture.data_begin(); + switch (m_misc_state.m_ti_size) { case PIXEL_SIZE_8BIT: @@ -2762,7 +2772,9 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) for (int32_t i = 0; i < width; i++) { - tc[((tline + i) ^ xorval8) & 0xfff] = U_RREADADDR8(src + s + i); + const uint8_t data = U_RREADADDR8(src + s + i); + m_capture.data_block()->put8(data); + tc[((tline + i) ^ xorval8) & 0xfff] = data; } } break; @@ -2783,8 +2795,10 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) for (int32_t i = 0; i < width; i++) { - uint32_t taddr = (tline + i) ^ xorval16; - tc[taddr & 0x7ff] = U_RREADIDX16(src + s + i); + const uint32_t taddr = (tline + i) ^ xorval16; + const uint16_t data = U_RREADIDX16(src + s + i); + m_capture.data_block()->put16(data); + tc[taddr & 0x7ff] = data; } } } @@ -2801,6 +2815,7 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) { uint32_t taddr = ((tline + i) ^ xorval8) & 0x7ff; uint16_t yuvword = U_RREADIDX16(src + s + i); + m_capture.data_block()->put16(yuvword); get_tmem8()[taddr] = yuvword >> 8; get_tmem8()[taddr | 0x800] = yuvword & 0xff; } @@ -2823,6 +2838,7 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) for (int32_t i = 0; i < width; i++) { uint32_t c = U_RREADIDX32(src + s + i); + m_capture.data_block()->put32(c); uint32_t ptr = ((tline + i) ^ xorval32cur) & 0x3ff; tc16[ptr] = c >> 16; tc16[ptr | 0x400] = c & 0xffff; @@ -2834,29 +2850,31 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2) default: fatalerror("RDP: load_tile: size = %d\n", m_misc_state.m_ti_size); } + m_capture.data_end(); + m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th); m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl); } -void n64_rdp::cmd_set_tile(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_tile(uint64_t w1) { //wait("SetTile"); - const int32_t tilenum = (w2 >> 24) & 0x7; + const int32_t tilenum = int32_t(w1 >> 24) & 0x7; n64_tile_t* tex_tile = &m_tiles[tilenum]; - tex_tile->format = (w1 >> 21) & 0x7; - tex_tile->size = (w1 >> 19) & 0x3; - tex_tile->line = (w1 >> 9) & 0x1ff; - tex_tile->tmem = (w1 >> 0) & 0x1ff; - tex_tile->palette = (w2 >> 20) & 0xf; - tex_tile->ct = (w2 >> 19) & 0x1; - tex_tile->mt = (w2 >> 18) & 0x1; - tex_tile->mask_t = (w2 >> 14) & 0xf; - tex_tile->shift_t = (w2 >> 10) & 0xf; - tex_tile->cs = (w2 >> 9) & 0x1; - tex_tile->ms = (w2 >> 8) & 0x1; - tex_tile->mask_s = (w2 >> 4) & 0xf; - tex_tile->shift_s = (w2 >> 0) & 0xf; + tex_tile->format = int32_t(w1 >> 53) & 0x7; + tex_tile->size = int32_t(w1 >> 51) & 0x3; + tex_tile->line = int32_t(w1 >> 41) & 0x1ff; + tex_tile->tmem = int32_t(w1 >> 32) & 0x1ff; + tex_tile->palette = int32_t(w1 >> 20) & 0xf; + tex_tile->ct = int32_t(w1 >> 19) & 0x1; + tex_tile->mt = int32_t(w1 >> 18) & 0x1; + tex_tile->mask_t = int32_t(w1 >> 14) & 0xf; + tex_tile->shift_t = int32_t(w1 >> 10) & 0xf; + tex_tile->cs = int32_t(w1 >> 9) & 0x1; + tex_tile->ms = int32_t(w1 >> 8) & 0x1; + tex_tile->mask_s = int32_t(w1 >> 4) & 0xf; + tex_tile->shift_s = int32_t(w1 >> 0) & 0xf; tex_tile->lshift_s = (tex_tile->shift_s >= 11) ? (16 - tex_tile->shift_s) : 0; tex_tile->rshift_s = (tex_tile->shift_s < 11) ? tex_tile->shift_s : 0; @@ -2892,106 +2910,104 @@ void n64_rdp::cmd_set_tile(uint32_t w1, uint32_t w2) //m_pending_mode_block = true; } -void n64_rdp::cmd_fill_rect(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_fill_rect(uint64_t w1) { //if(m_pending_mode_block) { wait("Block on pending mode-change"); m_pending_mode_block = false; } - const uint32_t xh = (w2 >> 12) & 0xfff; - const uint32_t xl = (w1 >> 12) & 0xfff; - const uint32_t yh = (w2 >> 0) & 0xfff; - uint32_t yl = (w1 >> 0) & 0xfff; + const uint64_t xh = (w1 >> 12) & 0xfff; + const uint64_t xl = (w1 >> 44) & 0xfff; + const uint64_t yh = (w1 >> 0) & 0xfff; + uint64_t yl = (w1 >> 32) & 0xfff; if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY) { yl |= 3; } - const uint32_t xlint = (xl >> 2) & 0x3ff; - const uint32_t xhint = (xh >> 2) & 0x3ff; + const uint64_t xlint = (xl >> 2) & 0x3ff; + const uint64_t xhint = (xh >> 2) & 0x3ff; - uint32_t* ewdata = m_temp_rect_data; - ewdata[0] = (0x3680 << 16) | yl;//command, flipped, tile, yl - ewdata[1] = (yl << 16) | yh;//ym, yh - ewdata[2] = (xlint << 16) | ((xl & 3) << 14);//xl, xl frac - ewdata[3] = 0;//dxldy, dxldy frac - ewdata[4] = (xhint << 16) | ((xh & 3) << 14);//xh, xh frac - ewdata[5] = 0;//dxhdy, dxhdy frac - ewdata[6] = (xlint << 16) | ((xl & 3) << 14);//xm, xm frac - ewdata[7] = 0;//dxmdy, dxmdy frac - memset(&ewdata[8], 0, 36 * sizeof(uint32_t));//shade, texture, depth + uint64_t* ewdata = m_temp_rect_data; + ewdata[0] = ((uint64_t)0x3680 << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl, ym, yh + ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0) + ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0) + ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0) + memset(&ewdata[4], 0, 18 * sizeof(uint64_t));//shade, texture, depth draw_triangle(false, false, false, true); } -void n64_rdp::cmd_set_fog_color(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_fog_color(uint64_t w1) { - m_fog_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_fog_color.set(uint8_t(w1), uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8)); } -void n64_rdp::cmd_set_blend_color(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_blend_color(uint64_t w1) { - m_blend_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_blend_color.set(uint8_t(w1), uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8)); } -void n64_rdp::cmd_set_prim_color(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_prim_color(uint64_t w1) { - m_misc_state.m_min_level = (w1 >> 8) & 0x1f; - const uint8_t prim_lod_fraction = w1 & 0xff; + m_misc_state.m_min_level = uint32_t(w1 >> 40) & 0x1f; + const uint8_t prim_lod_fraction(w1 >> 32); m_prim_lod_fraction.set(prim_lod_fraction, prim_lod_fraction, prim_lod_fraction, prim_lod_fraction); - m_prim_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); - m_prim_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); + const uint8_t alpha(w1); + m_prim_color.set(alpha, uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8)); + m_prim_alpha.set(alpha, alpha, alpha, alpha); } -void n64_rdp::cmd_set_env_color(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_env_color(uint64_t w1) { - m_env_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); - m_env_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); + const uint8_t alpha(w1); + m_env_color.set(alpha, uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8)); + m_env_alpha.set(alpha, alpha, alpha, alpha); } -void n64_rdp::cmd_set_combine(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_combine(uint64_t w1) { - m_combine.sub_a_rgb0 = (w1 >> 20) & 0xf; - m_combine.mul_rgb0 = (w1 >> 15) & 0x1f; - m_combine.sub_a_a0 = (w1 >> 12) & 0x7; - m_combine.mul_a0 = (w1 >> 9) & 0x7; - m_combine.sub_a_rgb1 = (w1 >> 5) & 0xf; - m_combine.mul_rgb1 = (w1 >> 0) & 0x1f; + m_combine.sub_a_rgb0 = uint32_t(w1 >> 52) & 0xf; + m_combine.mul_rgb0 = uint32_t(w1 >> 47) & 0x1f; + m_combine.sub_a_a0 = uint32_t(w1 >> 44) & 0x7; + m_combine.mul_a0 = uint32_t(w1 >> 41) & 0x7; + m_combine.sub_a_rgb1 = uint32_t(w1 >> 37) & 0xf; + m_combine.mul_rgb1 = uint32_t(w1 >> 32) & 0x1f; - m_combine.sub_b_rgb0 = (w2 >> 28) & 0xf; - m_combine.sub_b_rgb1 = (w2 >> 24) & 0xf; - m_combine.sub_a_a1 = (w2 >> 21) & 0x7; - m_combine.mul_a1 = (w2 >> 18) & 0x7; - m_combine.add_rgb0 = (w2 >> 15) & 0x7; - m_combine.sub_b_a0 = (w2 >> 12) & 0x7; - m_combine.add_a0 = (w2 >> 9) & 0x7; - m_combine.add_rgb1 = (w2 >> 6) & 0x7; - m_combine.sub_b_a1 = (w2 >> 3) & 0x7; - m_combine.add_a1 = (w2 >> 0) & 0x7; + m_combine.sub_b_rgb0 = uint32_t(w1 >> 28) & 0xf; + m_combine.sub_b_rgb1 = uint32_t(w1 >> 24) & 0xf; + m_combine.sub_a_a1 = uint32_t(w1 >> 21) & 0x7; + m_combine.mul_a1 = uint32_t(w1 >> 18) & 0x7; + m_combine.add_rgb0 = uint32_t(w1 >> 15) & 0x7; + m_combine.sub_b_a0 = uint32_t(w1 >> 12) & 0x7; + m_combine.add_a0 = uint32_t(w1 >> 9) & 0x7; + m_combine.add_rgb1 = uint32_t(w1 >> 6) & 0x7; + m_combine.sub_b_a1 = uint32_t(w1 >> 3) & 0x7; + m_combine.add_a1 = uint32_t(w1 >> 0) & 0x7; } -void n64_rdp::cmd_set_texture_image(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_texture_image(uint64_t w1) { - m_misc_state.m_ti_format = (w1 >> 21) & 0x7; - m_misc_state.m_ti_size = (w1 >> 19) & 0x3; - m_misc_state.m_ti_width = (w1 & 0x3ff) + 1; - m_misc_state.m_ti_address = w2 & 0x01ffffff; + m_misc_state.m_ti_format = uint32_t(w1 >> 53) & 0x7; + m_misc_state.m_ti_size = uint32_t(w1 >> 51) & 0x3; + m_misc_state.m_ti_width = (uint32_t(w1 >> 32) & 0x3ff) + 1; + m_misc_state.m_ti_address = uint32_t(w1) & 0x01ffffff; } -void n64_rdp::cmd_set_mask_image(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_mask_image(uint64_t w1) { //wait("SetMaskImage"); - m_misc_state.m_zb_address = w2 & 0x01ffffff; + m_misc_state.m_zb_address = uint32_t(w1) & 0x01ffffff; } -void n64_rdp::cmd_set_color_image(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_set_color_image(uint64_t w1) { //wait("SetColorImage"); - m_misc_state.m_fb_format = (w1 >> 21) & 0x7; - m_misc_state.m_fb_size = (w1 >> 19) & 0x3; - m_misc_state.m_fb_width = (w1 & 0x3ff) + 1; - m_misc_state.m_fb_address = w2 & 0x01ffffff; + m_misc_state.m_fb_format = uint32_t(w1 >> 53) & 0x7; + m_misc_state.m_fb_size = uint32_t(w1 >> 51) & 0x3; + m_misc_state.m_fb_width = (uint32_t(w1 >> 32) & 0x3ff) + 1; + m_misc_state.m_fb_address = uint32_t(w1) & 0x01ffffff; if (m_misc_state.m_fb_format < 2 || m_misc_state.m_fb_format > 32) // Jet Force Gemini sets the format to 4, Intensity. Protection? { @@ -3001,12 +3017,12 @@ void n64_rdp::cmd_set_color_image(uint32_t w1, uint32_t w2) /*****************************************************************************/ -void n64_rdp::cmd_invalid(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_invalid(uint64_t w1) { - fatalerror("n64_rdp::Invalid: %d, %08x %08x\n", (w1 >> 24) & 0x3f, w1, w2); + fatalerror("n64_rdp::Invalid: %d, %08x %08x\n", uint32_t(w1 >> 56) & 0x3f, uint32_t(w1 >> 32), (uint32_t)w1); } -void n64_rdp::cmd_noop(uint32_t w1, uint32_t w2) +void n64_rdp::cmd_noop(uint64_t w1) { // Do nothing } @@ -3023,15 +3039,15 @@ void n64_rdp::process_command_list() } // load command data - for(int32_t i = 0; i < length; i += 4) + for(int32_t i = 0; i < length; i += 8) { m_cmd_data[m_cmd_ptr++] = read_data((m_current & 0x1fffffff) + i); } m_current = m_end; - uint32_t cmd = (m_cmd_data[0] >> 24) & 0x3f; - uint32_t cmd_length = (m_cmd_ptr + 1) * 4; + uint32_t cmd = (m_cmd_data[0] >> 56) & 0x3f; + uint32_t cmd_length = uint32_t(m_cmd_ptr + 1) * 8; set_status(get_status() &~ DP_STATUS_FREEZE); @@ -3043,78 +3059,79 @@ void n64_rdp::process_command_list() while (m_cmd_cur < m_cmd_ptr) { - cmd = (m_cmd_data[m_cmd_cur] >> 24) & 0x3f; + cmd = (m_cmd_data[m_cmd_cur] >> 56) & 0x3f; - if (((m_cmd_ptr - m_cmd_cur) * 4) < s_rdp_command_length[cmd]) + if (((m_cmd_ptr - m_cmd_cur) * 8) < s_rdp_command_length[cmd]) { return; //fatalerror("rdp_process_list: not enough rdp command data: cur = %d, ptr = %d, expected = %d\n", m_cmd_cur, m_cmd_ptr, s_rdp_command_length[cmd]); } + m_capture.command(&m_cmd_data[m_cmd_cur], s_rdp_command_length[cmd] / 8); + if (LOG_RDP_EXECUTION) { char string[4000]; disassemble(string); - fprintf(rdp_exec, "%08X: %08X %08X %s\n", m_start+(m_cmd_cur * 4), m_cmd_data[m_cmd_cur+0], m_cmd_data[m_cmd_cur+1], string); + fprintf(rdp_exec, "%08X: %08X%08X %s\n", m_start+(m_cmd_cur * 8), uint32_t(m_cmd_data[m_cmd_cur] >> 32), (uint32_t)m_cmd_data[m_cmd_cur], string); fflush(rdp_exec); } // execute the command - uint32_t w1 = m_cmd_data[m_cmd_cur+0]; - uint32_t w2 = m_cmd_data[m_cmd_cur+1]; + uint64_t w = m_cmd_data[m_cmd_cur]; switch(cmd) { - case 0x00: cmd_noop(w1, w2); break; + case 0x00: cmd_noop(w); break; - case 0x08: cmd_triangle(w1, w2); break; - case 0x09: cmd_triangle_z(w1, w2); break; - case 0x0a: cmd_triangle_t(w1, w2); break; - case 0x0b: cmd_triangle_tz(w1, w2); break; - case 0x0c: cmd_triangle_s(w1, w2); break; - case 0x0d: cmd_triangle_sz(w1, w2); break; - case 0x0e: cmd_triangle_st(w1, w2); break; - case 0x0f: cmd_triangle_stz(w1, w2); break; + case 0x08: cmd_triangle(w); break; + case 0x09: cmd_triangle_z(w); break; + case 0x0a: cmd_triangle_t(w); break; + case 0x0b: cmd_triangle_tz(w); break; + case 0x0c: cmd_triangle_s(w); break; + case 0x0d: cmd_triangle_sz(w); break; + case 0x0e: cmd_triangle_st(w); break; + case 0x0f: cmd_triangle_stz(w); break; - case 0x24: cmd_tex_rect(w1, w2); break; - case 0x25: cmd_tex_rect_flip(w1, w2); break; + case 0x24: cmd_tex_rect(w); break; + case 0x25: cmd_tex_rect_flip(w); break; - case 0x26: cmd_sync_load(w1, w2); break; - case 0x27: cmd_sync_pipe(w1, w2); break; - case 0x28: cmd_sync_tile(w1, w2); break; - case 0x29: cmd_sync_full(w1, w2); break; + case 0x26: cmd_sync_load(w); break; + case 0x27: cmd_sync_pipe(w); break; + case 0x28: cmd_sync_tile(w); break; + case 0x29: cmd_sync_full(w); break; - case 0x2a: cmd_set_key_gb(w1, w2); break; - case 0x2b: cmd_set_key_r(w1, w2); break; + case 0x2a: cmd_set_key_gb(w); break; + case 0x2b: cmd_set_key_r(w); break; - case 0x2c: cmd_set_convert(w1, w2); break; - case 0x3c: cmd_set_combine(w1, w2); break; - case 0x2d: cmd_set_scissor(w1, w2); break; - case 0x2e: cmd_set_prim_depth(w1, w2); break; - case 0x2f: cmd_set_other_modes(w1, w2); break; + case 0x2c: cmd_set_convert(w); break; + case 0x3c: cmd_set_combine(w); break; + case 0x2d: cmd_set_scissor(w); break; + case 0x2e: cmd_set_prim_depth(w); break; + case 0x2f: cmd_set_other_modes(w);break; - case 0x30: cmd_load_tlut(w1, w2); break; - case 0x33: cmd_load_block(w1, w2); break; - case 0x34: cmd_load_tile(w1, w2); break; + case 0x30: cmd_load_tlut(w); break; + case 0x33: cmd_load_block(w); break; + case 0x34: cmd_load_tile(w); break; - case 0x32: cmd_set_tile_size(w1, w2); break; - case 0x35: cmd_set_tile(w1, w2); break; + case 0x32: cmd_set_tile_size(w); break; + case 0x35: cmd_set_tile(w); break; - case 0x36: cmd_fill_rect(w1, w2); break; + case 0x36: cmd_fill_rect(w); break; - case 0x37: cmd_set_fill_color32(w1, w2); break; - case 0x38: cmd_set_fog_color(w1, w2); break; - case 0x39: cmd_set_blend_color(w1, w2); break; - case 0x3a: cmd_set_prim_color(w1, w2); break; - case 0x3b: cmd_set_env_color(w1, w2); break; + case 0x37: cmd_set_fill_color32(w); break; + case 0x38: cmd_set_fog_color(w); break; + case 0x39: cmd_set_blend_color(w);break; + case 0x3a: cmd_set_prim_color(w); break; + case 0x3b: cmd_set_env_color(w); break; - case 0x3d: cmd_set_texture_image(w1, w2); break; - case 0x3e: cmd_set_mask_image(w1, w2); break; - case 0x3f: cmd_set_color_image(w1, w2); break; + case 0x3d: cmd_set_texture_image(w); break; + case 0x3e: cmd_set_mask_image(w); break; + case 0x3f: cmd_set_color_image(w); break; } - m_cmd_cur += s_rdp_command_length[cmd] / 4; + m_cmd_cur += s_rdp_command_length[cmd] / 8; }; m_cmd_ptr = 0; m_cmd_cur = 0; diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h index e1b0dd983ca..20eeab81fe2 100644 --- a/src/mame/video/n64.h +++ b/src/mame/video/n64.h @@ -6,6 +6,7 @@ #include "emu.h" #include "includes/n64.h" #include "video/poly.h" +#include "pin64.h" /*****************************************************************************/ @@ -128,7 +129,7 @@ class n64_rdp; #include "video/rdpblend.h" #include "video/rdptpipe.h" -typedef void (*rdp_command_t)(uint32_t w1, uint32_t w2); +typedef void (*rdp_command_t)(uint64_t w1); class n64_rdp : public poly_manager<uint32_t, rdp_poly_state, 8, 32000> { @@ -163,7 +164,7 @@ public: } void process_command_list(); - uint32_t read_data(uint32_t address); + uint64_t read_data(uint32_t address); void disassemble(char* buffer); void set_machine(running_machine& machine) { m_machine = &machine; } @@ -224,43 +225,43 @@ public: bool z_compare(uint32_t zcurpixel, uint32_t dzcurpixel, uint32_t sz, uint16_t dzpix, rdp_span_aux* userdata, const rdp_poly_state &object); // Commands - void cmd_invalid(uint32_t w1, uint32_t w2); - void cmd_noop(uint32_t w1, uint32_t w2); - void cmd_triangle(uint32_t w1, uint32_t w2); - void cmd_triangle_z(uint32_t w1, uint32_t w2); - void cmd_triangle_t(uint32_t w1, uint32_t w2); - void cmd_triangle_tz(uint32_t w1, uint32_t w2); - void cmd_triangle_s(uint32_t w1, uint32_t w2); - void cmd_triangle_sz(uint32_t w1, uint32_t w2); - void cmd_triangle_st(uint32_t w1, uint32_t w2); - void cmd_triangle_stz(uint32_t w1, uint32_t w2); - void cmd_tex_rect(uint32_t w1, uint32_t w2); - void cmd_tex_rect_flip(uint32_t w1, uint32_t w2); - void cmd_sync_load(uint32_t w1, uint32_t w2); - void cmd_sync_pipe(uint32_t w1, uint32_t w2); - void cmd_sync_tile(uint32_t w1, uint32_t w2); - void cmd_sync_full(uint32_t w1, uint32_t w2); - void cmd_set_key_gb(uint32_t w1, uint32_t w2); - void cmd_set_key_r(uint32_t w1, uint32_t w2); - void cmd_set_fill_color32(uint32_t w1, uint32_t w2); - void cmd_set_convert(uint32_t w1, uint32_t w2); - void cmd_set_scissor(uint32_t w1, uint32_t w2); - void cmd_set_prim_depth(uint32_t w1, uint32_t w2); - void cmd_set_other_modes(uint32_t w1, uint32_t w2); - void cmd_load_tlut(uint32_t w1, uint32_t w2); - void cmd_set_tile_size(uint32_t w1, uint32_t w2); - void cmd_load_block(uint32_t w1, uint32_t w2); - void cmd_load_tile(uint32_t w1, uint32_t w2); - void cmd_fill_rect(uint32_t w1, uint32_t w2); - void cmd_set_tile(uint32_t w1, uint32_t w2); - void cmd_set_fog_color(uint32_t w1, uint32_t w2); - void cmd_set_blend_color(uint32_t w1, uint32_t w2); - void cmd_set_prim_color(uint32_t w1, uint32_t w2); - void cmd_set_env_color(uint32_t w1, uint32_t w2); - void cmd_set_combine(uint32_t w1, uint32_t w2); - void cmd_set_texture_image(uint32_t w1, uint32_t w2); - void cmd_set_mask_image(uint32_t w1, uint32_t w2); - void cmd_set_color_image(uint32_t w1, uint32_t w2); + void cmd_invalid(uint64_t w1); + void cmd_noop(uint64_t w1); + void cmd_triangle(uint64_t w1); + void cmd_triangle_z(uint64_t w1); + void cmd_triangle_t(uint64_t w1); + void cmd_triangle_tz(uint64_t w1); + void cmd_triangle_s(uint64_t w1); + void cmd_triangle_sz(uint64_t w1); + void cmd_triangle_st(uint64_t w1); + void cmd_triangle_stz(uint64_t w1); + void cmd_tex_rect(uint64_t w1); + void cmd_tex_rect_flip(uint64_t w1); + void cmd_sync_load(uint64_t w1); + void cmd_sync_pipe(uint64_t w1); + void cmd_sync_tile(uint64_t w1); + void cmd_sync_full(uint64_t w1); + void cmd_set_key_gb(uint64_t w1); + void cmd_set_key_r(uint64_t w1); + void cmd_set_fill_color32(uint64_t w1); + void cmd_set_convert(uint64_t w1); + void cmd_set_scissor(uint64_t w1); + void cmd_set_prim_depth(uint64_t w1); + void cmd_set_other_modes(uint64_t w1); + void cmd_load_tlut(uint64_t w1); + void cmd_set_tile_size(uint64_t w1); + void cmd_load_block(uint64_t w1); + void cmd_load_tile(uint64_t w1); + void cmd_fill_rect(uint64_t w1); + void cmd_set_tile(uint64_t w1); + void cmd_set_fog_color(uint64_t w1); + void cmd_set_blend_color(uint64_t w1); + void cmd_set_prim_color(uint64_t w1); + void cmd_set_env_color(uint64_t w1); + void cmd_set_combine(uint64_t w1); + void cmd_set_texture_image(uint64_t w1); + void cmd_set_mask_image(uint64_t w1); + void cmd_set_color_image(uint64_t w1); void rgbaz_clip(int32_t sr, int32_t sg, int32_t sb, int32_t sa, int32_t* sz, rdp_span_aux* userdata); void rgbaz_correct_triangle(int32_t offx, int32_t offy, int32_t* r, int32_t* g, int32_t* b, int32_t* a, int32_t* z, rdp_span_aux* userdata, const rdp_poly_state &object); @@ -272,6 +273,8 @@ public: uint16_t decompress_cvmask_frombyte(uint8_t x); void lookup_cvmask_derivatives(uint32_t mask, uint8_t* offx, uint8_t* offy, rdp_span_aux* userdata); + void mark_frame() { m_capture.mark_frame(*m_machine); } + misc_state_t m_misc_state; // Color constants @@ -344,8 +347,8 @@ private: uint32_t m_z_complete_dec_table[0x4000]; //the same for decompressed z values, 14b uint8_t m_compressed_cvmasks[0x10000]; //16bit cvmask -> to byte - uint32_t m_cmd_data[0x1000]; - uint32_t m_temp_rect_data[0x1000]; + uint64_t m_cmd_data[0x800]; + uint64_t m_temp_rect_data[0x800]; int32_t m_cmd_ptr; int32_t m_cmd_cur; @@ -367,6 +370,8 @@ private: int32_t m_norm_point_rom[64]; int32_t m_norm_slope_rom[64]; + pin64_t m_capture; + static uint32_t s_special_9bit_clamptable[512]; static const z_decompress_entry_t m_z_dec_table[8]; diff --git a/src/mame/video/namcos21.cpp b/src/mame/video/namcos21.cpp index 01865fb2f62..d7f5cb7ad14 100644 --- a/src/mame/video/namcos21.cpp +++ b/src/mame/video/namcos21.cpp @@ -417,9 +417,9 @@ uint32_t namcos21_state::screen_update_driveyes(screen_device &screen, bitmap_in for( pri=pivot; pri<8; pri++ ) c355_obj_draw(screen, bitmap, cliprect, pri ); - + c355_obj_draw(screen, bitmap, cliprect, 15 ); //driver's eyes - + return 0; } @@ -444,7 +444,7 @@ void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &c { case 0xff: break; - // TODO: additive blending? winrun car select uses register [0xc] for a xscroll value + // TODO: additive blending? winrun car select uses register [0xc] for a xscroll value case 0x00: pDest[sx] = (pDest[sx]&0x1fff)+0x4000; break; @@ -469,6 +469,6 @@ uint32_t namcos21_state::screen_update_winrun(screen_device &screen, bitmap_ind1 winrun_bitmap_draw(bitmap,cliprect); //popmessage("%04x %04x %04x|%04x %04x",m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); - + return 0; } diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp index 9aa6f65cb44..817b0d162ce 100644 --- a/src/mame/video/newbrain.cpp +++ b/src/mame/video/newbrain.cpp @@ -2,9 +2,9 @@ // copyright-holders:Curt Coder /* - TODO: + TODO: - - GR is always 0 + - GR is always 0 */ @@ -99,7 +99,7 @@ void newbrain_state::screen_update(bitmap_rgb32 &bitmap, const rectangle &clipre if (rc3 && txt) { rc_ = 7; } - + uint16_t charrom_addr = (m_ucr << 11) | (rc_ << 8) | ((BIT(rd, 7) && m_fs) << 7) | (rd & 0x7f); uint8_t crd = m_char_rom->base()[charrom_addr & 0xfff]; bool crd0 = BIT(crd, 0); diff --git a/src/mame/video/pin64.cpp b/src/mame/video/pin64.cpp new file mode 100644 index 00000000000..cbc9ad934dc --- /dev/null +++ b/src/mame/video/pin64.cpp @@ -0,0 +1,506 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz + +#include "pin64.h" + +#define CAP_NAME "pin64_%d.cap" + +// pin64_fileutil_t members + +void pin64_fileutil_t::write(FILE* file, uint32_t data) { + if (!file) + return; + + uint8_t temp(data >> 24); + fwrite(&temp, 1, 1, file); + + temp = (uint8_t)(data >> 16); + fwrite(&temp, 1, 1, file); + + temp = (uint8_t)(data >> 8); + fwrite(&temp, 1, 1, file); + + temp = (uint8_t)data; + fwrite(&temp, 1, 1, file); +} + +void pin64_fileutil_t::write(FILE* file, const uint8_t* data, uint32_t size) { + if (!file) + return; + + fwrite(data, 1, size, file); +} + + + +// pin64_data_t members + +void pin64_data_t::put8(uint8_t data) { + m_data.push_back(data); + m_offset++; +} + +void pin64_data_t::put16(uint16_t data) { + put8((uint8_t)(data >> 8)); + put8((uint8_t)data); +} + +void pin64_data_t::put32(uint32_t data) { + put16((uint16_t)(data >> 16)); + put16((uint16_t)data); +} + +void pin64_data_t::put64(uint64_t data) { + put32((uint32_t)(data >> 32)); + put32((uint32_t)data); +} + +uint8_t pin64_data_t::get8() { + if (m_offset >= m_data.size()) + fatalerror("PIN64: Call to pin64_data_t::get8() at end of block (requested offset %x, size %x)\n", m_offset, (uint32_t)m_data.size()); + + uint8_t ret = m_data[m_offset]; + m_offset++; + + return ret; +} + +uint16_t pin64_data_t::get16() { + uint16_t ret = (uint16_t)get8() << 8; + return ret | get8(); +} + +uint32_t pin64_data_t::get32() { + uint32_t ret = (uint32_t)get16() << 16; + return ret | get16(); +} + +uint64_t pin64_data_t::get64() { + uint64_t ret = (uint64_t)get32() << 32; + return ret | get32(); +} + +uint8_t pin64_data_t::get8(uint32_t offset, bool temp_access) { + update_offset(offset, temp_access); + + uint8_t ret = get8(); + m_offset = m_old_offset; + return ret; +} + +uint16_t pin64_data_t::get16(uint32_t offset, bool temp_access) { + update_offset(offset, temp_access); + + uint16_t ret = get16(); + m_offset = m_old_offset; + return ret; +} + +uint32_t pin64_data_t::get32(uint32_t offset, bool temp_access) { + update_offset(offset, temp_access); + + uint32_t ret = get32(); + m_offset = m_old_offset; + return ret; +} + +uint64_t pin64_data_t::get64(uint32_t offset, bool temp_access) { + update_offset(offset, temp_access); + + uint32_t ret = get64(); + m_offset = m_old_offset; + return ret; +} + +void pin64_data_t::reset() { + m_old_offset = 0; + m_offset = 0; +} + +void pin64_data_t::clear() { + reset(); + m_data.clear(); +} + +void pin64_data_t::update_offset(uint32_t offset, bool update_current) { + m_old_offset = (update_current ? offset : m_offset); + m_offset = offset; +} + + + +// pin64_printer_t members + +void pin64_printer_t::print_data(pin64_block_t* block) { + pin64_data_t* data = block->data(); + + printf(" CRC32: %08x\n", (uint32_t)block->crc32()); fflush(stdout); + printf(" Data Size: %08x\n", (uint32_t)data->size()); fflush(stdout); + printf(" Data: "); fflush(stdout); + + const uint32_t data_size = data->size(); + const uint32_t row_count = (data_size + 31) / 32; + const uint8_t* bytes = data->bytes(); + for (uint32_t row = 0; row < row_count; row++) { + const uint32_t row_index = row * 32; + const uint32_t data_remaining = data_size - row_index; + const uint32_t col_count = (data_remaining > 32 ? 32 : data_remaining); + for (uint32_t col = 0; col < col_count; col++) { + printf("%02x ", bytes[row_index + col]); fflush(stdout); + } + + if (row == (row_count - 1)) { + printf("\n"); fflush(stdout); + } else { + printf("\n "); fflush(stdout); + } + } + + printf("\n"); fflush(stdout); +} + +void pin64_printer_t::print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands) { + pin64_block_t* block = blocks[commands[cmd]]; + pin64_data_t* data = block->data(); + + printf(" Command %d:\n", cmd - cmd_start); fflush(stdout); + const uint32_t cmd_size(data->get32()); + printf(" CRC32: %08x\n", (uint32_t)commands[cmd]); fflush(stdout); + printf(" Packet Data Size: %d words\n", cmd_size); fflush(stdout); + printf(" Packet Data: "); fflush(stdout); + + bool load_command = false; + for (int i = 0; i < cmd_size; i++) { + const uint64_t cmd_entry(data->get64()); + if (i == 0) { + const uint8_t top_byte = uint8_t(cmd_entry >> 56) & 0x3f; + if (top_byte == 0x30 || top_byte == 0x33 || top_byte == 0x34) + load_command = true; + } + printf("%08x%08x\n", uint32_t(cmd_entry >> 32), (uint32_t)cmd_entry); fflush(stdout); + + if (i < (cmd_size - 1)) { + printf(" "); fflush(stdout); + } + } + + printf(" Data Block Present: %s\n", load_command ? "Yes" : "No"); fflush(stdout); + + if (load_command) { + printf(" Data Block CRC32: %08x\n", data->get32()); fflush(stdout); + } + + data->reset(); +}; + + + +// pin64_block_t members + +void pin64_block_t::finalize() { + if (m_data.size() > 0) + m_crc32 = util::crc32_creator::simple(m_data.bytes(), m_data.size()); + else + m_crc32 = ~0; + m_data.reset(); +} + +void pin64_block_t::clear() { + m_crc32 = 0; + m_data.clear(); +} + +void pin64_block_t::write(FILE* file) { + pin64_fileutil_t::write(file, m_crc32); + pin64_fileutil_t::write(file, m_data.size()); + if (m_data.size() > 0) + pin64_fileutil_t::write(file, m_data.bytes(), m_data.size()); +} + +uint32_t pin64_block_t::size() { + return sizeof(uint32_t) // data CRC32 + + sizeof(uint32_t) // data size + + m_data.size(); // data +} + + + +// pin64_t members + +const uint8_t pin64_t::CAP_ID[8] = { 'P', 'I', 'N', '6', '4', 'C', 'A', 'P' }; + +pin64_t::~pin64_t() { + if (m_capture_file) + finish(); + + clear(); +} + +void pin64_t::start(int frames) +{ + if (m_capture_index == ~0) + init_capture_index(); + + if (m_capture_file) + fatalerror("PIN64: Call to start() while already capturing\n"); + + char name_buf[256]; + sprintf(name_buf, CAP_NAME, m_capture_index); + m_capture_index++; + + m_capture_file = fopen(name_buf, "wb"); + + m_capture_frames = frames; + + m_frames.push_back(0); +} + +void pin64_t::finish() { + if (!m_capture_file) + return; + + finalize(); + print(); + + write(m_capture_file); + fclose(m_capture_file); + m_capture_file = nullptr; + + clear(); +} + +void pin64_t::finalize() { + finish_command(); + data_end(); +} + +void pin64_t::play(int index) { +} + +void pin64_t::mark_frame(running_machine& machine) { + if (m_capture_file) { + if (m_frames.size() == m_capture_frames && m_capture_frames > 0) { + printf("\n"); + finish(); + machine.popmessage("Done recording."); + } else { + printf("%d ", (uint32_t)m_commands.size()); + m_frames.push_back((uint32_t)m_commands.size()); + } + } + +#if PIN64_ENABLE_CAPTURE + if (machine.input().code_pressed_once(KEYCODE_N) && !m_capture_file) { + start(1); + machine.popmessage("Capturing PIN64 snapshot to pin64_%d.cap", m_capture_index - 1); + } else if (machine.input().code_pressed_once(KEYCODE_M)) { + if (m_capture_file) { + finish(); + machine.popmessage("Done recording."); + } else { + start(); + machine.popmessage("Recording PIN64 movie to pin64_%d.cap", m_capture_index - 1); + } + } +#endif +} + +void pin64_t::command(uint64_t* cmd_data, uint32_t size) { + if (!capturing()) + return; + + finish_command(); + + m_current_command = new pin64_block_t(); + m_current_command->data()->put32(size); + + for (uint32_t i = 0 ; i < size; i++) + m_current_command->data()->put64(cmd_data[i]); +} + +void pin64_t::finish_command() { + if (!m_current_command) + return; + + m_current_command->finalize(); + if (m_blocks.find(m_current_command->crc32()) == m_blocks.end()) + m_blocks[m_current_command->crc32()] = m_current_command; + + m_commands.push_back(m_current_command->crc32()); +} + +void pin64_t::data_begin() { + if (!capturing()) + return; + + if (m_current_data) + data_end(); + + m_current_data = new pin64_block_t(); +} + +pin64_data_t* pin64_t::data_block() { + if (!capturing() || !m_current_data) + return &m_dummy_data; + + return m_current_data->data(); +} + +void pin64_t::data_end() { + if (!capturing() || !m_current_data) + return; + + m_current_data->finalize(); + m_current_command->data()->put32(m_current_data->crc32()); + finish_command(); + + if (m_blocks.find(m_current_data->crc32()) == m_blocks.end()) + m_blocks[m_current_data->crc32()] = m_current_data; + + m_current_data = nullptr; +} + +size_t pin64_t::size() { + return header_size() + block_directory_size() + cmdlist_directory_size() + cmdlist_size(); +} + +size_t pin64_t::header_size() { + return sizeof(uint8_t) * 8 // "PIN64CAP" + + sizeof(uint32_t) // total file size + + sizeof(uint32_t) // start of block directory data + + sizeof(uint32_t) // start of command-list directory data + + sizeof(uint32_t) // start of blocks + + sizeof(uint32_t); // start of commands +} + +size_t pin64_t::block_directory_size() { + return (m_blocks.size() + 1) * sizeof(uint32_t); +} + +size_t pin64_t::cmdlist_directory_size() { + return (m_frames.size() + 1) * sizeof(uint16_t); +} + +size_t pin64_t::blocks_size() { + size_t block_size = 0; + for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) + block_size += (block_pair.second)->size(); + + return block_size; +} + +size_t pin64_t::cmdlist_size() { + return (m_commands.size() + 1) * sizeof(uint32_t); +} + +void pin64_t::print() +{ + printf("Total Size: %9x bytes\n", (uint32_t)size()); fflush(stdout); + printf("Header Size: %9x bytes\n", (uint32_t)header_size()); fflush(stdout); + printf("Block Dir Size: %9x bytes\n", (uint32_t)block_directory_size()); fflush(stdout); + printf("Cmdlist Dir Size: %9x bytes\n", (uint32_t)cmdlist_directory_size()); fflush(stdout); + printf("Blocks Size: %9x bytes\n", (uint32_t)blocks_size()); fflush(stdout); + printf("Cmdlist Size: %9x bytes\n", (uint32_t)cmdlist_size()); fflush(stdout); + + printf("Command-List Count: %d\n", (uint32_t)m_frames.size()); fflush(stdout); + for (int i = 0; i < m_frames.size(); i++) { + printf(" List %d:\n", i); fflush(stdout); + + const int next_start = ((i == (m_frames.size() - 1)) ? m_commands.size() : m_frames[i+1]); + for (int cmd = m_frames[i]; cmd < next_start; cmd++) { + pin64_printer_t::print_command(m_frames[i], cmd, m_blocks, m_commands); + } + if (i == (m_frames.size() - 1)) { + printf("\n"); fflush(stdout); + } + } + + printf("\nData Block Count: %d\n", (uint32_t)m_blocks.size()); fflush(stdout); + int i = 0; + for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) { + printf(" Block %d:\n", i); fflush(stdout); + + pin64_printer_t::print_data((block_pair.second)); + if (i == (m_blocks.size() - 1)) { + printf("\n"); fflush(stdout); + } + i++; + } +} + +void pin64_t::write(FILE* file) { + const uint32_t size_total = size(); + const uint32_t size_header = header_size(); + const uint32_t size_block_dir = block_directory_size(); + const uint32_t size_cmdlist_dir = cmdlist_directory_size(); + const uint32_t size_blocks_dir = blocks_size(); + + pin64_fileutil_t::write(file, CAP_ID, 8); + pin64_fileutil_t::write(file, size_total); + pin64_fileutil_t::write(file, size_header); + pin64_fileutil_t::write(file, size_header + size_block_dir); + pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir); + pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir + size_blocks_dir); + + write_data_directory(file); + write_cmdlist_directory(file); + + for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) + (block_pair.second)->write(file); + + pin64_fileutil_t::write(file, m_commands.size()); + for (util::crc32_t crc : m_commands) + pin64_fileutil_t::write(file, crc); +} + +void pin64_t::write_data_directory(FILE* file) { + pin64_fileutil_t::write(file, m_blocks.size()); + size_t offset(header_size()); + for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) { + pin64_fileutil_t::write(file, offset); + offset += (block_pair.second)->size(); + } +} + +void pin64_t::write_cmdlist_directory(FILE* file) { + pin64_fileutil_t::write(file, m_frames.size()); + for (uint32_t frame : m_frames) + pin64_fileutil_t::write(file, frame); +} + +void pin64_t::clear() { + if (m_capture_file != nullptr) { + fclose(m_capture_file); + m_capture_file = nullptr; + } + + for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) + delete block_pair.second; + + m_blocks.clear(); + m_commands.clear(); + m_frames.clear(); + + m_current_data = nullptr; + m_current_command = nullptr; +} + +void pin64_t::init_capture_index() +{ + char name_buf[256]; + bool found = true; + + m_capture_index = 0; + + do { + sprintf(name_buf, CAP_NAME, m_capture_index); + + FILE* temp = fopen(name_buf, "rb"); + if (temp == nullptr) { + break; + } else { + fclose(temp); + m_capture_index++; + } + } while(found); +} diff --git a/src/mame/video/pin64.h b/src/mame/video/pin64.h new file mode 100644 index 00000000000..d8e82395f25 --- /dev/null +++ b/src/mame/video/pin64.h @@ -0,0 +1,180 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +#pragma once + +#ifndef PIN64_H +#define PIN64_H + +#include <cstdio> +#include <vector> +#include <map> + +#define PIN64_ENABLE_CAPTURE (0) + +#include "emu.h" + +class pin64_fileutil_t { +public: + static void write(FILE* file, uint32_t data); + static void write(FILE* file, const uint8_t* data, uint32_t size); +}; + +class pin64_command_t { +public: + std::vector<uint8_t> data; +}; + +class pin64_data_t { +public: + pin64_data_t() + : m_offset(0) + , m_old_offset(0) { } + + void reset(); + void clear(); + + // setters + virtual void put8(uint8_t data); + virtual void put16(uint16_t data); + virtual void put32(uint32_t data); + virtual void put64(uint64_t data); + + // getters + virtual uint8_t get8(); + virtual uint8_t get8(uint32_t offset, bool temp_access = false); + virtual uint16_t get16(); + virtual uint16_t get16(uint32_t offset, bool temp_access = false); + virtual uint32_t get32(); + virtual uint32_t get32(uint32_t offset, bool temp_access = false); + virtual uint64_t get64(); + virtual uint64_t get64(uint32_t offset, bool temp_access = false); + virtual uint32_t offset() { return m_offset; } + uint8_t* bytes() { return (m_data.size() > 0) ? &m_data[0] : nullptr; } + uint32_t size() { return m_data.size(); } + +private: + void update_offset(uint32_t offset, bool temp_access = false); + +protected: + std::vector<uint8_t> m_data; + + uint32_t m_offset; + uint32_t m_old_offset; +}; + +class pin64_dummy_data_t : public pin64_data_t { +public: + void put8(uint8_t data) override { } + void put16(uint16_t data) override { } + void put32(uint32_t data) override { } + void put64(uint64_t data) override { } + + uint8_t get8() override { return 0; } + uint8_t get8(uint32_t offset, bool update_current = true) override { return 0; } + uint16_t get16() override { return 0; } + uint16_t get16(uint32_t offset, bool update_current = true) override { return 0; } + uint32_t get32() override { return 0; } + uint32_t get32(uint32_t offset, bool update_current = true) override { return 0; } + uint64_t get64() override { return 0; } + uint64_t get64(uint32_t offset, bool update_current = true) override { return 0; } + + uint32_t offset() override { return 0; } +}; + +class pin64_block_t { +public: + pin64_block_t() + : m_crc32{0} { } + virtual ~pin64_block_t() { } + + void finalize(); + void clear(); + + void write(FILE* file); + + // getters + uint32_t size(); + pin64_data_t* data() { return &m_data; } + util::crc32_t crc32() const { return m_crc32; } + +protected: + util::crc32_t m_crc32; + pin64_data_t m_data; +}; + +class pin64_printer_t { +public: + static void print_data(pin64_block_t* block); + static void print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands); +}; + +class pin64_t +{ +public: + pin64_t() + : m_capture_file(nullptr) + , m_capture_index(~0) + , m_capture_frames(0) + , m_current_data(nullptr) + , m_current_command(nullptr) + , m_playing(false) + { } + ~pin64_t(); + + void start(int frames = 0); + void finish(); + void clear(); + void print(); + + void mark_frame(running_machine& machine); + void play(int index); + + void command(uint64_t* cmd_data, uint32_t size); + + void data_begin(); + pin64_data_t* data_block(); + pin64_block_t& block() { return *m_current_data; } + void data_end(); + + bool capturing() const { return m_capture_file != nullptr; } + bool playing() const { return m_playing; } + + size_t size(); + +private: + void start_command_block(); + + void write(FILE* file); + + size_t header_size(); + size_t block_directory_size(); + size_t cmdlist_directory_size(); + size_t blocks_size(); + size_t cmdlist_size(); + + void finish_command(); + + void write_data_directory(FILE* file); + void write_cmdlist_directory(FILE* file); + void init_capture_index(); + + void finalize(); + + FILE *m_capture_file; + int32_t m_capture_index; + int m_capture_frames; + + pin64_block_t* m_current_data; + pin64_block_t* m_current_command; + std::unordered_map<util::crc32_t, pin64_block_t*> m_blocks; + + std::vector<util::crc32_t> m_commands; + std::vector<uint32_t> m_frames; + + bool m_playing; + + pin64_dummy_data_t m_dummy_data; + static const uint8_t CAP_ID[8]; +}; + +#endif // PIN64_H
\ No newline at end of file diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index 641c2c4b60e..50a8f00a4df 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -3499,6 +3499,7 @@ WRITE32_MEMBER( powervr2_device::pvr2_ta_w ) //printf("PVR2 %08x %08x\n",reg,dat); } +// TODO: move to specific device READ32_MEMBER( powervr2_device::elan_regs_r ) { switch(offset) diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index 8a3b6442faf..b2028d09e98 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -323,7 +323,7 @@ pri_alp_bitmap */ -void taito_f3_state::device_post_load() +void taito_f3_state::device_post_load() { /* force a reread of the dynamic tiles in the pixel layer */ m_gfxdecode->gfx(3)->mark_all_dirty(); diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index a7f73bbdc32..dad7c250008 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -38,7 +38,6 @@ #define _ENABLE_SCROLLX #define _ENABLE_SCROLLY //#define _ENABLE_SCREEN_RESIZE -//#define _ENABLE_ROTATE_ZOOM //#define _SHOW_VIDEO_DEBUG #define GFX_8X8_4BIT 0 @@ -831,6 +830,31 @@ static const char *const mode[] = { static const char *const psize[] = { "8x8", "16x16", "32x32", "64x64" }; #endif +inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *source_tilemap) +{ + //int xc, yc; + //double r, alpha, sin_theta, cos_theta; + //const rectangle &visarea = screen.visible_area(); + + if( m_regs.s.r7 & r7_zron ) + { + // old code, for reference. + //xc = m_ax >> 16; + //yc = m_ay >> 16; + //r = sqrt( (double)( xc * xc + yc * yc ) ); + //alpha = atan( (double)xc / (double)yc ); + //sin_theta = (double)m_dyx / (double)0x10000; + //cos_theta = (double)m_dx / (double)0x10000; + + source_tilemap->draw_roz(screen, bitmap, cliprect, + m_ax, m_ay, + m_dx, m_dxy, m_dyx, m_dy, true, 0, 0 ); + } + else + source_tilemap->draw(screen, bitmap, cliprect, 0, 0 ); +} + + uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { #ifdef _SHOW_VIDEO_DEBUG @@ -839,21 +863,17 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma #ifdef _ENABLE_SCROLLY int col; #endif -#ifdef _ENABLE_ROTATE_ZOOM - int xc, yc; - double r, alpha, sin_theta, cos_theta; -#endif rectangle finalclip; const rectangle &visarea = screen.visible_area(); // clip to the current bitmap finalclip.set(0, screen.width() - 1, 0, screen.height() - 1); finalclip &= cliprect; - + bitmap.fill(0, visarea ); + // punt if not initialized if (m_page_x == 0 || m_page_y == 0) { - bitmap.fill(0, finalclip); return 0; } @@ -951,7 +971,6 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma * now we can render the screen */ -#if 1 // LBO - need to implement proper pen marking for sprites as well as set aside a non-transparent // pen to be used for background fills when plane B is disabled. if ((m_regs.s.r7 & r7_md) & MD_1PLANE) @@ -961,34 +980,11 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma // m_work_bitmap.fill(1, *visarea); } else -#endif - m_tilemap_B->draw(screen, m_work_bitmap, finalclip, 0, 0 ); - -#ifdef _ENABLE_ROTATE_ZOOM - - /* - * fudge - translate ax,ay to startx, starty each time - */ - - xc = m_ax >> 16; - yc = m_ay >> 16; - r = sqrt( (double)( xc * xc + yc * yc ) ); - alpha = atan( (double)xc / (double)yc ); - sin_theta = (double)m_dyx / (double)0x10000; - cos_theta = (double)m_dx / (double)0x10000; - - if( m_regs.s.zron ) - copyrozbitmap( bitmap, finalclip, &m_work_bitmap, - ( visarea.min_x << 16 ) + - m_ax + 0x10000 * r * - ( -sin( alpha ) * cos_theta + cos( alpha ) * sin_theta ), - ( visarea.min_y << 16 ) + - m_ay + 0x10000 * r * - ( cos( alpha ) * cos_theta + sin( alpha ) * sin_theta ), - m_dx, m_dxy, m_dyx, m_dy, 0); - else -#endif - copybitmap( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip); + { + draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_B); + + copybitmap( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip); + } // for some reason we can't use an opaque m_tilemap_A // so use a transparent but clear the work bitmap first @@ -999,19 +995,9 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma (m_regs.s.r11 & r11_prm) == PRM_ASEBDX ) draw_sprites(bitmap, finalclip); - m_tilemap_A->draw(screen, m_work_bitmap, finalclip, 0, 0 ); - -#ifdef _ENABLE_ROTATE_ZOOM - if( m_regs.s.zron ) - copyrozbitmap_trans( bitmap, finalclip, &m_work_bitmap, - m_ax, // + ( visarea.min_x << 16 ), - m_ay, // + ( visarea.min_y << 16 ), - m_dx, m_dxy, m_dyx, m_dy, 0, - 0 ); - else -#endif - copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0 ); - + draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_A); + copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); + if ((m_regs.s.r11 & r11_prm) == PRM_SABDEX || (m_regs.s.r11 & r11_prm) == PRM_SEABDX) draw_sprites(bitmap,finalclip ); diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index 314cdea4bf2..8d57682d491 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -312,7 +312,8 @@ private: void postload(); void register_state_save(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - + void draw_layer_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *source_tilemap); + uint8_t m_namcond1_gfxbank; tilemap_t *m_tilemap_A_cache_8[3]; diff --git a/src/osd/asio.h b/src/osd/asio.h index 61260f3f142..64acfab9674 100644 --- a/src/osd/asio.h +++ b/src/osd/asio.h @@ -32,4 +32,4 @@ #define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) #include "asio/include/asio.hpp" -#undef interface
\ No newline at end of file +#undef interface diff --git a/src/osd/modules/debugger/debugosx.mm b/src/osd/modules/debugger/debugosx.mm index 56e85e21105..60599415e69 100644 --- a/src/osd/modules/debugger/debugosx.mm +++ b/src/osd/modules/debugger/debugosx.mm @@ -8,7 +8,7 @@ // TODO: -// * Automatic scrolling for console and log views +// * Automatic scrolling for console view // * Keyboard shortcuts in error log and device windows // * Don't accept keyboard input while the game is running // * Interior focus rings - standard/exterior focus rings look really ugly here diff --git a/src/osd/modules/debugger/osx/debugconsole.mm b/src/osd/modules/debugger/osx/debugconsole.mm index e96d0757ba7..041e7fc314e 100644 --- a/src/osd/modules/debugger/osx/debugconsole.mm +++ b/src/osd/modules/debugger/osx/debugconsole.mm @@ -48,6 +48,7 @@ [regScroll setHasVerticalScroller:YES]; [regScroll setAutohidesScrollers:YES]; [regScroll setBorderType:NSBezelBorder]; + [regScroll setDrawsBackground:NO]; [regScroll setDocumentView:regView]; [regView release]; @@ -59,6 +60,7 @@ [dasmScroll setHasVerticalScroller:YES]; [dasmScroll setAutohidesScrollers:YES]; [dasmScroll setBorderType:NSBezelBorder]; + [dasmScroll setDrawsBackground:NO]; [dasmScroll setDocumentView:dasmView]; [dasmView release]; @@ -70,6 +72,7 @@ [consoleScroll setHasVerticalScroller:YES]; [consoleScroll setAutohidesScrollers:YES]; [consoleScroll setBorderType:NSBezelBorder]; + [consoleScroll setDrawsBackground:NO]; [consoleScroll setDocumentView:consoleView]; [consoleView release]; diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm index ecc55349283..97854b22d70 100644 --- a/src/osd/modules/debugger/osx/debugview.mm +++ b/src/osd/modules/debugger/osx/debugview.mm @@ -184,7 +184,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)typeCharacterAndScrollToCursor:(char)ch { debug_view_xy const oldPos = view->cursor_position(); view->process_char(ch); - if (view->cursor_supported() && view->cursor_visible()) + if (view->cursor_supported()) { debug_view_xy const newPos = view->cursor_position(); if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) diff --git a/src/osd/modules/debugger/osx/deviceinfoviewer.mm b/src/osd/modules/debugger/osx/deviceinfoviewer.mm index dc2b2114005..8a275d9c573 100644 --- a/src/osd/modules/debugger/osx/deviceinfoviewer.mm +++ b/src/osd/modules/debugger/osx/deviceinfoviewer.mm @@ -218,6 +218,7 @@ [contentScroll setHasVerticalScroller:YES]; [contentScroll setAutohidesScrollers:YES]; [contentScroll setBorderType:NSNoBorder]; + [contentScroll setDrawsBackground:NO]; [contentScroll setDocumentView:contentView]; [contentView release]; [[window contentView] addSubview:contentScroll]; diff --git a/src/osd/modules/debugger/osx/devicesviewer.mm b/src/osd/modules/debugger/osx/devicesviewer.mm index 2bdb0253299..210f353d76d 100644 --- a/src/osd/modules/debugger/osx/devicesviewer.mm +++ b/src/osd/modules/debugger/osx/devicesviewer.mm @@ -145,6 +145,7 @@ [devicesScroll setHasVerticalScroller:YES]; [devicesScroll setAutohidesScrollers:YES]; [devicesScroll setBorderType:NSNoBorder]; + [devicesScroll setDrawsBackground:NO]; [devicesScroll setDocumentView:devicesView]; [devicesView release]; [[window contentView] addSubview:devicesScroll]; diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.mm b/src/osd/modules/debugger/osx/disassemblyviewer.mm index d2c3decff11..88934ffbb8c 100644 --- a/src/osd/modules/debugger/osx/disassemblyviewer.mm +++ b/src/osd/modules/debugger/osx/disassemblyviewer.mm @@ -88,6 +88,7 @@ [dasmScroll setHasVerticalScroller:YES]; [dasmScroll setAutohidesScrollers:YES]; [dasmScroll setBorderType:NSNoBorder]; + [dasmScroll setDrawsBackground:NO]; [dasmScroll setDocumentView:dasmView]; [dasmView release]; [[window contentView] addSubview:dasmScroll]; diff --git a/src/osd/modules/debugger/osx/errorlogviewer.mm b/src/osd/modules/debugger/osx/errorlogviewer.mm index c40d9f89b69..5b78fdd7272 100644 --- a/src/osd/modules/debugger/osx/errorlogviewer.mm +++ b/src/osd/modules/debugger/osx/errorlogviewer.mm @@ -31,6 +31,7 @@ [logScroll setHasVerticalScroller:YES]; [logScroll setAutohidesScrollers:YES]; [logScroll setBorderType:NSNoBorder]; + [logScroll setDrawsBackground:NO]; [logScroll setDocumentView:logView]; [logView release]; [window setContentView:logScroll]; diff --git a/src/osd/modules/debugger/osx/memoryviewer.mm b/src/osd/modules/debugger/osx/memoryviewer.mm index b30a983ac30..8f0c87701c7 100644 --- a/src/osd/modules/debugger/osx/memoryviewer.mm +++ b/src/osd/modules/debugger/osx/memoryviewer.mm @@ -87,6 +87,7 @@ [memoryScroll setHasVerticalScroller:YES]; [memoryScroll setAutohidesScrollers:YES]; [memoryScroll setBorderType:NSNoBorder]; + [memoryScroll setDrawsBackground:NO]; [memoryScroll setDocumentView:memoryView]; [memoryView release]; [[window contentView] addSubview:memoryScroll]; diff --git a/src/osd/modules/debugger/osx/pointsviewer.mm b/src/osd/modules/debugger/osx/pointsviewer.mm index e10633076aa..7875e9c91b3 100644 --- a/src/osd/modules/debugger/osx/pointsviewer.mm +++ b/src/osd/modules/debugger/osx/pointsviewer.mm @@ -72,6 +72,7 @@ [breakScroll setHasVerticalScroller:YES]; [breakScroll setAutohidesScrollers:YES]; [breakScroll setBorderType:NSNoBorder]; + [breakScroll setDrawsBackground:NO]; [breakScroll setDocumentView:breakView]; [breakView release]; breakTab = [[NSTabViewItem alloc] initWithIdentifier:@""]; @@ -87,6 +88,7 @@ [watchScroll setHasVerticalScroller:YES]; [watchScroll setAutohidesScrollers:YES]; [watchScroll setBorderType:NSNoBorder]; + [watchScroll setDrawsBackground:NO]; [watchScroll setDocumentView:watchView]; [watchView release]; watchTab = [[NSTabViewItem alloc] initWithIdentifier:@""]; diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index dcca53b4361..5bacf0c341d 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -131,7 +131,7 @@ const options_entry osd_options::s_option_entries[] = { nullptr, nullptr, OPTION_HEADER, "PORTAUDIO OPTIONS" }, { OSDOPTION_PA_API, OSDOPTVAL_NONE, OPTION_STRING, "PortAudio API" }, { OSDOPTION_PA_DEVICE, OSDOPTVAL_NONE, OPTION_STRING, "PortAudio device" }, - { OSDOPTION_PA_LATENCY "(0.001-0.25)", "0", OPTION_FLOAT, "suggested latency in seconds, 0 for default" }, + { OSDOPTION_PA_LATENCY "(0-0.25)", "0", OPTION_FLOAT, "suggested latency in seconds, 0 for default" }, #endif #ifdef SDLMAME_MACOSX diff --git a/src/osd/modules/render/bgfx/shaders/shader.mk b/src/osd/modules/render/bgfx/shaders/shader.mk index 8f73be5445c..f9cdeb91f95 100644 --- a/src/osd/modules/render/bgfx/shaders/shader.mk +++ b/src/osd/modules/render/bgfx/shaders/shader.mk @@ -1,5 +1,5 @@ # -# Copyright 2011-2016 Branimir Karadzic. All rights reserved. +# Copyright 2011-2017 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # diff --git a/src/osd/modules/sound/pa_sound.cpp b/src/osd/modules/sound/pa_sound.cpp index fb92689504f..dfba0cfa132 100644 --- a/src/osd/modules/sound/pa_sound.cpp +++ b/src/osd/modules/sound/pa_sound.cpp @@ -2,9 +2,9 @@ // copyright-holders:intealls, R.Belmont /*************************************************************************** - pa_sound.c + pa_sound.c - PortAudio interface. + PortAudio interface. *******************************************************************c********/ @@ -13,7 +13,7 @@ #ifndef NO_USE_PORTAUDIO -#include "portaudio/include/portaudio.h" +#include <portaudio.h> #include "modules/lib/osdobj_common.h" #include <iostream> @@ -49,78 +49,75 @@ public: virtual void set_mastervolume(int attenuation); private: - /* Lock free SPSC ring buffer */ + // Lock free SPSC ring buffer template <typename T> struct audio_buffer { T* buf; int size; int reserve; - std::atomic<int> rd_pos, wr_pos; + std::atomic<int> playpos, writepos; - audio_buffer(int size, int reserve) : size(size), reserve(reserve) { - rd_pos = wr_pos = 0; - buf = new T[size](); + audio_buffer(int size, int reserve) : size(size + reserve), reserve(reserve) { + playpos = writepos = 0; + buf = new T[this->size]; } ~audio_buffer() { delete[] buf; } int count() { - int diff; - diff = wr_pos - rd_pos; - diff = diff < 0 ? size + diff : diff; - diff -= reserve; - return diff < 0 ? 0 : diff; + int diff = writepos - playpos; + return diff < 0 ? size + diff : diff; } - void increment_wrpos(int n) { - wr_pos = (wr_pos + n) % size; + void increment_writepos(int n) { + writepos.store((writepos + n) % size); } int write(const T* src, int n, int attenuation) { - n = std::min<int>(n, size - count()); + n = std::min<int>(n, size - reserve - count()); - if (wr_pos + n > size) { - att_memcpy(buf + wr_pos, src, sizeof(T) * (size - wr_pos), attenuation); - att_memcpy(buf, src + (size - wr_pos), sizeof(T) * (n - (size - wr_pos)), attenuation); + if (writepos + n > size) { + att_memcpy(buf + writepos, src, sizeof(T) * (size - writepos), attenuation); + att_memcpy(buf, src + (size - writepos), sizeof(T) * (n - (size - writepos)), attenuation); } else { - att_memcpy(buf + wr_pos, src, sizeof(T) * n, attenuation); + att_memcpy(buf + writepos, src, sizeof(T) * n, attenuation); } - increment_wrpos(n); + increment_writepos(n); return n; } - void increment_rdpos(int n) { - rd_pos = (rd_pos + n) % size; + void increment_playpos(int n) { + playpos.store((playpos + n) % size); } int read(T* dst, int n) { n = std::min<int>(n, count()); - if (rd_pos + n > size) { - std::memcpy(dst, buf + rd_pos, sizeof(T) * (size - rd_pos)); - std::memcpy(dst + (size - rd_pos), buf, sizeof(T) * (n - (size - rd_pos))); + if (playpos + n > size) { + std::memcpy(dst, buf + playpos, sizeof(T) * (size - playpos)); + std::memcpy(dst + (size - playpos), buf, sizeof(T) * (n - (size - playpos))); } else { - std::memcpy(dst, buf + rd_pos, sizeof(T) * n); + std::memcpy(dst, buf + playpos, sizeof(T) * n); } - increment_rdpos(n); + increment_playpos(n); return n; } int clear(int n) { - n = std::min<int>(n, size - count()); + n = std::min<int>(n, size - reserve - count()); - if (wr_pos + n > size) { - std::memset(buf + wr_pos, 0, sizeof(T) * (size - wr_pos)); - std::memset(buf, 0, sizeof(T) * (n - (size - wr_pos))); + if (writepos + n > size) { + std::memset(buf + writepos, 0, sizeof(T) * (size - writepos)); + std::memset(buf, 0, sizeof(T) * (n - (size - writepos))); } else { - std::memset(buf + wr_pos, 0, sizeof(T) * n); + std::memset(buf + writepos, 0, sizeof(T) * n); } - increment_wrpos(n); + increment_writepos(n); return n; } @@ -133,6 +130,12 @@ private: } }; + enum + { + LATENCY_MIN = 1, + LATENCY_MAX = 5, + }; + int callback(s16* output_buffer, size_t number_of_frames); static int _callback(const void*, void *output_buffer, @@ -185,7 +188,11 @@ int sound_pa::init(osd_options const &options) m_overflows = 0; m_has_overflowed = false; m_has_underflowed = false; + m_osd_ticks = 0; m_skip_threshold_ticks = 0; + m_osd_tps = osd_ticks_per_second(); + m_buffer_min_ct = INT_MAX; + m_audio_latency = std::min<int>(std::max<int>(m_audio_latency, LATENCY_MIN), LATENCY_MAX); try { m_ab = new audio_buffer<s16>(m_sample_rate, 2); @@ -194,8 +201,6 @@ int sound_pa::init(osd_options const &options) goto error; } - m_osd_tps = osd_ticks_per_second(); - err = Pa_Initialize(); if (err != paNoError) goto pa_error; @@ -342,7 +347,7 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples) // if adjustment is less than two milliseconds, don't bother if (adjust / 2 > sample_rate() / 500) { - m_ab->increment_rdpos(adjust); + m_ab->increment_playpos(adjust); m_has_overflowed = true; } @@ -355,9 +360,8 @@ int sound_pa::callback(s16* output_buffer, size_t number_of_samples) m_ab->read(output_buffer, buf_ct); std::memset(output_buffer + buf_ct, 0, (number_of_samples - buf_ct) * sizeof(s16)); - // rd_pos == wr_pos only happens when buffer hasn't received any samples, - // i.e. before update_audio_stream has been called - if (m_ab->rd_pos != m_ab->wr_pos) + // if update_audio_stream has been called, note the underflow + if (m_osd_ticks) m_has_underflowed = true; m_skip_threshold_ticks = m_osd_ticks; @@ -371,9 +375,6 @@ void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int sam if (!sample_rate()) return; - // for determining buffer overflows, take the sample here instead of in the callback - m_osd_ticks = osd_ticks(); - #if LOG_BUFCNT if (m_log.good()) m_log << m_ab->count() << std::endl; @@ -394,6 +395,9 @@ void sound_pa::update_audio_stream(bool is_throttled, const s16 *buffer, int sam } m_ab->write(buffer, samples_this_frame * 2, m_attenuation); + + // for determining buffer overflows, take the sample here instead of in the callback + m_osd_ticks = osd_ticks(); } void sound_pa::set_mastervolume(int attenuation) @@ -418,12 +422,15 @@ void sound_pa::exit() osd_printf_error("PortAudio: Error writing log.\n"); #endif - Pa_StopStream(m_pa_stream); - err = Pa_Terminate(); + err = Pa_StopStream(m_pa_stream); if (err != paNoError) goto error; + err = Pa_CloseStream(m_pa_stream); if (err != paNoError) goto error; + error: if (err != paNoError) osd_printf_error("PortAudio error: %s\n", Pa_GetErrorText(err)); + Pa_Terminate(); + delete m_ab; if (m_overflows || m_underflows) diff --git a/src/tools/imgtool/charconv.cpp b/src/tools/imgtool/charconv.cpp index 387d646f006..0dadc8acb88 100644 --- a/src/tools/imgtool/charconv.cpp +++ b/src/tools/imgtool/charconv.cpp @@ -78,7 +78,7 @@ void imgtool::simple_charconverter::from_utf8(std::ostream &dest, const char *sr { ch = 0xFFFD; rc = 1; - } + } iter += rc; // do the reverse lookup diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index 10d35ac34a0..a0986d6a62d 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -92,8 +92,8 @@ static std::string extract_padded_string(const char *source, size_t len) //------------------------------------------------- // extract_padded_filename - this is a common -// enough scenario that it is justified to have -// this in common code +// enough scenario that it is justified to have +// this in common code //------------------------------------------------- std::string extract_padded_filename(const char *source, size_t filename_length, size_t extension_length) diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp index 895f96145b1..c6f3056e7f0 100644 --- a/src/tools/imgtool/main.cpp +++ b/src/tools/imgtool/main.cpp @@ -35,7 +35,7 @@ static void writeusage(std::wostream &output, bool write_word_usage, const struc L"%s %s %s %s\n", (write_word_usage ? L"Usage:" : L" "), wstring_from_utf8(cmdname), - c->name, + wstring_from_utf8(c->name), c->usage ? wstring_from_utf8(c->usage) : std::wstring()); } diff --git a/src/tools/imgtool/modules/mac.cpp b/src/tools/imgtool/modules/mac.cpp index b379286438d..f94246c5e7f 100644 --- a/src/tools/imgtool/modules/mac.cpp +++ b/src/tools/imgtool/modules/mac.cpp @@ -6405,7 +6405,7 @@ static void generic_mac_get_info(const imgtool_class *imgclass, uint32_t state, case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = mac_image_geticoninfo; break; case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = mac_image_suggesttransfer; break; case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_mac; break; - case IMGTOOLINFO_PTR_CHARCONVERTER: info->charconverter = &charconverter_macos_roman; break; + case IMGTOOLINFO_PTR_CHARCONVERTER: info->charconverter = &charconverter_macos_roman; break; } } diff --git a/src/tools/imgtool/modules/rsdos.cpp b/src/tools/imgtool/modules/rsdos.cpp index 9ee8de3cf8c..4bcde9444ab 100644 --- a/src/tools/imgtool/modules/rsdos.cpp +++ b/src/tools/imgtool/modules/rsdos.cpp @@ -247,7 +247,7 @@ static imgtoolerr_t process_rsdos_file(struct rsdos_dirent *ent, imgtool::image //------------------------------------------------- // prepare_dirent - create a new directory entry -// with a specified name +// with a specified name //------------------------------------------------- static imgtoolerr_t prepare_dirent(rsdos_dirent &ent, const char *fname) diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index 2c6e58a0f74..e360f503790 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -79,10 +79,12 @@ CPU_DISASSEMBLE( avr8 ); CPU_DISASSEMBLE( ccpu ); CPU_DISASSEMBLE( cdp1801 ); CPU_DISASSEMBLE( cdp1802 ); +CPU_DISASSEMBLE( clipper ); CPU_DISASSEMBLE( coldfire ); CPU_DISASSEMBLE( cop410 ); CPU_DISASSEMBLE( cop420 ); CPU_DISASSEMBLE( cop444 ); +CPU_DISASSEMBLE( cop424 ); CPU_DISASSEMBLE( cp1610 ); CPU_DISASSEMBLE( cquestlin ); CPU_DISASSEMBLE( cquestrot ); @@ -137,6 +139,8 @@ CPU_DISASSEMBLE( m6803 ); CPU_DISASSEMBLE( m68030 ); CPU_DISASSEMBLE( m68040 ); CPU_DISASSEMBLE( m6805 ); +CPU_DISASSEMBLE( m146805 ); +CPU_DISASSEMBLE( m68hc05 ); CPU_DISASSEMBLE( m6808 ); CPU_DISASSEMBLE( m6809 ); CPU_DISASSEMBLE( m68340 ); @@ -247,10 +251,12 @@ static const dasm_table_entry dasm_table[] = { "ccpu", _8bit, 0, CPU_DISASSEMBLE_NAME(ccpu) }, { "cdp1801", _8bit, 0, CPU_DISASSEMBLE_NAME(cdp1801) }, { "cdp1802", _8bit, 0, CPU_DISASSEMBLE_NAME(cdp1802) }, + { "clipper", _16le, 0, CPU_DISASSEMBLE_NAME(clipper) }, { "coldfire", _16be, 0, CPU_DISASSEMBLE_NAME(coldfire) }, { "cop410", _8bit, 0, CPU_DISASSEMBLE_NAME(cop410) }, { "cop420", _8bit, 0, CPU_DISASSEMBLE_NAME(cop420) }, { "cop444", _8bit, 0, CPU_DISASSEMBLE_NAME(cop444) }, + { "cop424", _8bit, 0, CPU_DISASSEMBLE_NAME(cop424) }, { "cp1610", _16be, -1, CPU_DISASSEMBLE_NAME(cp1610) }, { "cquestlin", _64be, -3, CPU_DISASSEMBLE_NAME(cquestlin) }, { "cquestrot", _64be, -3, CPU_DISASSEMBLE_NAME(cquestrot) }, @@ -307,6 +313,8 @@ static const dasm_table_entry dasm_table[] = { "m68030", _16be, 0, CPU_DISASSEMBLE_NAME(m68030) }, { "m68040", _16be, 0, CPU_DISASSEMBLE_NAME(m68040) }, { "m6805", _8bit, 0, CPU_DISASSEMBLE_NAME(m6805) }, + { "m146805", _8bit, 0, CPU_DISASSEMBLE_NAME(m146805) }, + { "m68hc05", _8bit, 0, CPU_DISASSEMBLE_NAME(m68hc05) }, { "m6808", _8bit, 0, CPU_DISASSEMBLE_NAME(m6808) }, { "m6809", _8bit, 0, CPU_DISASSEMBLE_NAME(m6809) }, { "m68340", _16be, 0, CPU_DISASSEMBLE_NAME(m68340) }, |