diff options
author | 2017-02-11 16:51:22 +1100 | |
---|---|---|
committer | 2017-02-11 16:56:25 +1100 | |
commit | b90b684cd44c5250104e1cf5fec0c0783cb95415 (patch) | |
tree | 051fd84e7286c89e6e12986a88ee539eea67ef4a /src | |
parent | bc695d75da77abc29f2b404e0dfb8afbb3fea2ca (diff) |
dl1416: clean up, support signal-level interface better, support
variants better
sitcom: implement Boot and Reset buttons, implement remapping of low
32kB, hook up PIA, implement I/O space mirrors, hook up RS232 interface
for downloading programs, add a software list with two example programs.
(nw) sitcom software list isn't hooked up right, the file won't be fed
to the -bitb input if you run with the set name; you have to run like
mame sitcom -bitb roms/sitcom/san.zip/san.hex
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/video/dl1416.cpp | 364 | ||||
-rw-r--r-- | src/devices/video/dl1416.h | 101 | ||||
-rw-r--r-- | src/mame/drivers/aim65.cpp | 13 | ||||
-rw-r--r-- | src/mame/drivers/cmi.cpp | 39 | ||||
-rw-r--r-- | src/mame/drivers/sitcom.cpp | 182 | ||||
-rw-r--r-- | src/mame/drivers/testconsole.cpp | 12 | ||||
-rw-r--r-- | src/mame/includes/aim65.h | 61 | ||||
-rw-r--r-- | src/mame/machine/aim65.cpp | 67 |
8 files changed, 454 insertions, 385 deletions
diff --git a/src/devices/video/dl1416.cpp b/src/devices/video/dl1416.cpp index 7bec9bc693f..752dbc2af13 100644 --- a/src/devices/video/dl1416.cpp +++ b/src/devices/video/dl1416.cpp @@ -1,5 +1,5 @@ // license:GPL-2.0+ -// copyright-holders:Dirk Best +// copyright-holders:Dirk Best, Vas Crabb /***************************************************************************** * * DL1416 @@ -9,22 +9,22 @@ * with Memory/Decoder/Driver * * Notes: - * - Currently supports the DL1416T and by virtue of it being nearly the same, the DL1414. - * - Partial support for DL1416B is available, it just needs the right - * character set and MAME core support for its display. + * - Currently supports the DL1416T and by virtue of it being nearly the + * same, the DL1414. + * - The DL1416B uses a simpler sequence to control cursor display, and + * has a '.' segment but is otherwise fully compatible with the DL1416T. * - Cursor support is implemented but not tested, as the AIM65 does not * seem to use it. * - * Todo: - * - Is the DL1416A identical to the DL1416T? If not, we need to add - * support for it. - * - Add proper support for DL1414 (pretty much DL1416T without the cursor) + * TODO: + * - '.' segment for DL1414T and DL1416B * * Changes: * - 2007-07-30: Initial version. [Dirk Best] * - 2008-02-25: Converted to the new device interface. [Dirk Best] * - 2008-12-18: Cleanups. [Dirk Best] * - 2011-10-08: Changed the ram to store character rather than segment data. [Lord Nightmare] + * - 2017-02-11: Better signal-level interface, better support for variants [Vas Crabb] * * * We use the following order for the segments: @@ -44,19 +44,19 @@ #include "emu.h" #include "dl1416.h" +namespace { /*************************************************************************** CONSTANTS ***************************************************************************/ -#define SEG_UNDEF (0xfffe) -#define SEG_BLANK (0) -#define SEG_CURSOR (0xffff) -#define CURSOR_ON (1) -#define CURSOR_OFF (0) +constexpr uint16_t SEG_BLANK = 0x0000; +constexpr uint16_t SEG_UNDEF = SEG_BLANK; +constexpr uint16_t SEG_CURSOR = 0xffff; + /* character set DL1416T */ -static const uint16_t dl1416t_segments[128] = { +uint16_t const dl1416t_segments[128] = { SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ @@ -92,90 +92,174 @@ static const uint16_t dl1416t_segments[128] = { }; -/***************************************************************************** - DEVICE INTERFACE -*****************************************************************************/ +class dl1414t_device : public dl1414_device +{ +public: + dl1414t_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) + : dl1414_device(mconfig, DL1414T, "DL1414T", tag, owner, clock, "dl1414t", __FILE__) + { + } -dl1416_device::dl1416_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), - m_write_enable(false), - m_chip_enable(false), - m_cursor_enable(false), - m_update(*this) +protected: + virtual uint16_t translate(uint8_t digit, bool cursor) const override + { + return dl1416t_segments[digit & 0x7f]; + } +}; + + +class dl1416b_device : public dl1416_device { - for (int i = 0; i < 4; i++) +public: + dl1416b_device(machine_config const &mconfig, const char *tag, device_t *owner, uint32_t clock) + : dl1416_device(mconfig, DL1416B, "DL1416B", tag, owner, clock, "dl1416b", __FILE__) { - m_digit_ram[i] = 0; - m_cursor_state[i] = 0; } -} -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- + virtual DECLARE_WRITE8_MEMBER(bus_w) override + { + if (!cu_in()) + set_cursor_state(offset, BIT(data, 0)); + else + dl1416_device::bus_w(space, offset, data, mem_mask); + } -void dl1416_device::device_start() +protected: + virtual uint16_t translate(uint8_t digit, bool cursor) const override + { + return cursor ? SEG_CURSOR : dl1416t_segments[digit & 0x7f]; + } +}; + + +class dl1416t_device : public dl1416_device { - /* register for state saving */ - save_item(NAME(m_chip_enable)); - save_item(NAME(m_cursor_enable)); - save_item(NAME(m_write_enable)); - save_item(NAME(m_digit_ram)); +public: + dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : dl1416_device(mconfig, DL1416T, "DL1416T", tag, owner, clock, "dl1416t", __FILE__) + { + } + + virtual DECLARE_WRITE8_MEMBER(bus_w) override + { + if (!cu_in()) + for (unsigned i = 0; 4 > i; ++i) set_cursor_state(i, BIT(data, i)); + else + dl1416_device::bus_w(space, offset, data, mem_mask); + } + +protected: + virtual uint16_t translate(uint8_t digit, bool cursor) const override + { + digit &= 0x7f; + return (cursor && (0x20 <= digit) && (0x5f >= digit)) ? SEG_CURSOR : dl1416t_segments[digit]; + } +}; + +} // anonymous namespace + + + +/***************************************************************************** + DEVICE TYPE GLOBALS +*****************************************************************************/ + +device_type const DL1414T = &device_creator<dl1414t_device>; +device_type const DL1416B = &device_creator<dl1416b_device>; +device_type const DL1416T = &device_creator<dl1416t_device>; + + - m_update.resolve(); +/***************************************************************************** + DEVICE INTERFACE +*****************************************************************************/ + +dl1414_device::dl1414_device( + machine_config const &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + uint32_t clock, + char const *shortname, + char const *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , m_update_cb(*this) + , m_digit_ram{ 0x00, 0x00, 0x00, 0x00 } + , m_cursor_state{ false, false, false, false } + , m_wr_in(true) + , m_ce_in(true) + , m_addr_in(0x00) + , m_data_in(0x00) +{ +} + +dl1416_device::dl1416_device( + machine_config const &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + uint32_t clock, + char const *shortname, + char const *source) + : dl1414_device(mconfig, type, name, tag, owner, clock, shortname, source) + , m_cu_in(true) +{ } //------------------------------------------------- -// device_reset - device-specific reset +// device_start - device-specific startup //------------------------------------------------- -void dl1416_device::device_reset() +void dl1414_device::device_start() { - int i; - uint16_t pattern; - /* disable all lines */ - m_chip_enable = false; - m_write_enable = false; - m_cursor_enable = false; - - /* randomize digit and cursor memory */ - for (i = 0; i < 4; i++) + m_update_cb.resolve_safe(); + + // register for state saving + save_item(NAME(m_digit_ram)); + save_item(NAME(m_cursor_state)); + save_item(NAME(m_wr_in)); + save_item(NAME(m_ce_in)); + save_item(NAME(m_addr_in)); + save_item(NAME(m_data_in)); + + // set initial state for input lines + m_wr_in = true; + m_ce_in = true; + m_addr_in = 0x00; + m_data_in = 0x00; + + // randomise internal RAM + for (unsigned i = 0; 4 > i; ++i) { - m_digit_ram[i] = machine().rand()&0x3F; + m_digit_ram[i] = machine().rand() & 0x3f; // TODO: only enable the following line if the device actually has a cursor (DL1416T and DL1416B), if DL1414 then cursor is always 0! - //m_cursor_state[i] = ((device->machine().rand()&0xFF) >= 0x80) ? CURSOR_ON : CURSOR_OFF; - m_cursor_state[i] = CURSOR_OFF; - pattern = dl1416t_segments[m_digit_ram[i]]; - - /* If cursor for this digit position is enabled and segment is not */ - /* undefined, replace digit with cursor */ - if ((m_cursor_state[i] == CURSOR_ON) && (pattern != SEG_UNDEF)) - pattern = SEG_CURSOR; - - /* Undefined characters are replaced by blanks */ - if (pattern == SEG_UNDEF) - pattern = SEG_BLANK; - - /* Call update function */ - if (!m_update.isnull()) - m_update((offs_t)i, pattern); + //m_cursor_state[i] = bool(BIT(device->machine().rand(), 7)); + m_cursor_state[i] = false; } } +void dl1416_device::device_start() +{ + dl1414_device::device_start(); -const device_type DL1416B = &device_creator<dl1416b_device>; + // register for state saving + save_item(NAME(m_cu_in)); -dl1416b_device::dl1416b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : dl1416_device(mconfig, DL1416B, "DL1416B", tag, owner, clock, "dl1416b", __FILE__) -{ + // set initial state for input lines + m_cu_in = true; } +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- -const device_type DL1416T = &device_creator<dl1416t_device>; - -dl1416t_device::dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : dl1416_device(mconfig, DL1416T, "DL1416T", tag, owner, clock, "dl1416t", __FILE__) +void dl1414_device::device_reset() { + // push initial display state + for (unsigned i = 0; 4 > i; ++i) + m_update_cb(i, translate(m_digit_ram[i], m_cursor_state[i]), 0xffff); } @@ -183,115 +267,55 @@ dl1416t_device::dl1416t_device(const machine_config &mconfig, const char *tag, d IMPLEMENTATION *****************************************************************************/ -/* write enable, active low */ -WRITE_LINE_MEMBER( dl1416_device::wr_w ) +WRITE_LINE_MEMBER( dl1414_device::wr_w ) { - m_write_enable = !state; + if (bool(state) != m_wr_in) + { + m_wr_in = bool(state); + if (!m_ce_in && m_wr_in) + bus_w(machine().dummy_space(), m_addr_in, m_data_in, 0x7f); + } } -/* chip enable, active low */ -WRITE_LINE_MEMBER( dl1416_device::ce_w ) +WRITE_LINE_MEMBER( dl1414_device::ce_w ) { - m_chip_enable = !state; + m_ce_in = bool(state); } -/* cursor enable, active low */ WRITE_LINE_MEMBER( dl1416_device::cu_w ) { - m_cursor_enable = !state; + m_cu_in = bool(state); +} + +void dl1414_device::addr_w(u8 state) +{ + m_addr_in = state & 0x03; +} + +void dl1414_device::data_w(u8 state) +{ + m_data_in = state & 0x7f; +} + +WRITE8_MEMBER( dl1414_device::bus_w ) +{ + offset &= 0x03; // A0-A1 + data &= 0x7f; // D0-D6 + + if (m_digit_ram[offset] != data) + { + m_digit_ram[offset] = data; + m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff); + } } -/* data */ -WRITE8_MEMBER( dl1416_device::data_w ) +void dl1414_device::set_cursor_state(offs_t offset, bool state) { - offset &= 0x03; /* A0-A1 */ - data &= 0x7f; /* D0-D6 */ + offset &= 0x03; // A0-A1 - /* Only try to update the data if we are enabled and write is enabled */ - if (m_chip_enable && m_write_enable) + if (state != m_cursor_state[offset]) { - /* fprintf(stderr,"DL1416 Write: Cursor: %d, Offset: %d, Data: %02X\n (%c)", m_cursor_enable, offset, data, data); */ - int i, pattern, previous_state; - - if (m_cursor_enable) /* cursor enable is set */ - { - if (type() == DL1416B) - { - /* DL1416B uses offset to decide cursor pos to change and D0 to hold new state */ - - /* The cursor will be set if D0 is high and the original */ - /* character restored otherwise */ - previous_state = m_cursor_state[offset]; - m_cursor_state[offset] = data & 1 ? CURSOR_ON : CURSOR_OFF; - - if (previous_state != m_cursor_state[offset]) - { - pattern = dl1416t_segments[m_digit_ram[offset]]; - - /* If cursor for this digit position is enabled and segment is not */ - /* undefined, replace digit with cursor */ - if ((m_cursor_state[offset] == CURSOR_ON) && (pattern != SEG_UNDEF)) - pattern = SEG_CURSOR; - - /* Undefined characters are replaced by blanks */ - if (pattern == SEG_UNDEF) - pattern = SEG_BLANK; - - /* Call update function */ - if (!m_update.isnull()) - m_update(offset, pattern, mem_mask); - } - } - else { - /* DL1416T uses a bitmap of 4 data bits D0,D1,D2,D3 to decide cursor pos to change and new state */ - - for (i = 0; i < 4; i++) - { - /* The cursor will be set if D0-D3 is high and the original */ - /* character at the appropriate position restored otherwise */ - previous_state = m_cursor_state[i]; - m_cursor_state[i] = data & (1<<i) ? CURSOR_ON : CURSOR_OFF; - - if (previous_state != m_cursor_state[i]) - { - pattern = dl1416t_segments[m_digit_ram[i]]; - - /* If cursor for this digit position is enabled and segment is not */ - /* undefined, replace digit with cursor */ - if ((m_cursor_state[i] == CURSOR_ON) && (pattern != SEG_UNDEF)) - pattern = SEG_CURSOR; - - /* Undefined characters are replaced by blanks */ - if (pattern == SEG_UNDEF) - pattern = SEG_BLANK; - - /* Call update function */ - if (!m_update.isnull()) - m_update(i, pattern, mem_mask); - } - } - } - } - else /* cursor enable is not set, so standard write */ - { - /* Save written value */ - m_digit_ram[offset] = data&0x3f; - - /* Load segment pattern from ROM */ - pattern = dl1416t_segments[data]; /** TODO: handle DL1416T vs DL1416B vs DL1414 here */ - - /* If cursor for this digit position is enabled and segment is not */ - /* undefined, replace digit with cursor */ - if ((m_cursor_state[offset] == CURSOR_ON) && (pattern != SEG_UNDEF)) - pattern = SEG_CURSOR; - - /* Undefined characters are replaced by blanks */ - if (pattern == SEG_UNDEF) - pattern = SEG_BLANK; - - /* Call update function */ - if (!m_update.isnull()) - m_update(offset, pattern, mem_mask); - } + m_cursor_state[offset] = state; + m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff); } } diff --git a/src/devices/video/dl1416.h b/src/devices/video/dl1416.h index 5eb084bfddb..46672fd7a85 100644 --- a/src/devices/video/dl1416.h +++ b/src/devices/video/dl1416.h @@ -1,5 +1,5 @@ // license:GPL-2.0+ -// copyright-holders:Dirk Best +// copyright-holders:Dirk Best, Vas Crabb /***************************************************************************** * * DL1416 @@ -11,68 +11,105 @@ * ****************************************************************************/ -#ifndef DL1416_H_ -#define DL1416_H_ +#ifndef MAME_DEVICES_VIDEO_DL1416_H +#define MAME_DEVICES_VIDEO_DL1416_H + + +/*************************************************************************** + DEVICE TYPES +***************************************************************************/ + +extern device_type const DL1414T; +extern device_type const DL1416B; +extern device_type const DL1416T; /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ +#define MCFG_DL1414_UPDATE_HANDLER(_devcb) \ + devcb = &dl1414_device::set_update_handler(*device, DEVCB_##_devcb); + #define MCFG_DL1416_UPDATE_HANDLER(_devcb) \ devcb = &dl1416_device::set_update_handler(*device, DEVCB_##_devcb); /*************************************************************************** - FUNCTION PROTOTYPES + TYPE DECLARATIONS ***************************************************************************/ -/* device get info callback */ -class dl1416_device : public device_t +class dl1414_device : public device_t { public: - dl1416_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); - ~dl1416_device() {} + template<typename Object> static devcb_base &set_update_handler(device_t &device, Object &&object) + { return downcast<dl1414_device &>(device).m_update_cb.set_callback(std::forward<Object>(object)); } - template<class _Object> static devcb_base &set_update_handler(device_t &device, _Object object) { return downcast<dl1416_device &>(device).m_update.set_callback(object); } + // signal-level interface + DECLARE_WRITE_LINE_MEMBER(wr_w); // write strobe (rising edge) + DECLARE_WRITE_LINE_MEMBER(ce_w); // chip enable (active low) + void addr_w(uint8_t state); + void data_w(uint8_t state); - /* inputs */ - DECLARE_WRITE_LINE_MEMBER( wr_w ); /* write enable */ - DECLARE_WRITE_LINE_MEMBER( ce_w ); /* chip enable */ - DECLARE_WRITE_LINE_MEMBER( cu_w ); /* cursor enable */ - DECLARE_WRITE8_MEMBER( data_w ); + // bus interface - still requires cu_w to set cursor enable state + virtual DECLARE_WRITE8_MEMBER(bus_w); protected: + dl1414_device( + machine_config const &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + uint32_t clock, + char const *shortname, + char const *source); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; + void set_cursor_state(offs_t offset, bool state); + virtual uint16_t translate(u8 digit, bool cursor) const = 0; + private: - // internal state - int m_write_enable; - int m_chip_enable; - int m_cursor_enable; - devcb_write16 m_update; + devcb_write16 m_update_cb; - uint16_t m_digit_ram[4]; // holds the digit code for each position - uint8_t m_cursor_state[4]; // holds the cursor state for each position, 0=off, 1=on + // internal state + uint8_t m_digit_ram[4]; // holds the digit code for each position + bool m_cursor_state[4]; // holds the cursor state for each position + + // input line state + bool m_wr_in; + bool m_ce_in; + uint8_t m_addr_in; + uint8_t m_data_in; }; -class dl1416b_device : public dl1416_device +class dl1416_device : public dl1414_device { public: - dl1416b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); -}; + DECLARE_WRITE_LINE_MEMBER(cu_w); // cursor enable (active low) -extern const device_type DL1416B; +protected: + dl1416_device( + machine_config const &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + uint32_t clock, + char const *shortname, + char const *source); -class dl1416t_device : public dl1416_device -{ -public: - dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); -}; + // device-level overrides + virtual void device_start() override; -extern const device_type DL1416T; + bool cu_in() const { return m_cu_in; } +private: + // input line state + bool m_cu_in; +}; -#endif /* DL1416_H_ */ +#endif // MAME_DEVICES_VIDEO_DL1416_H diff --git a/src/mame/drivers/aim65.cpp b/src/mame/drivers/aim65.cpp index 47186011a9e..102b556a5d7 100644 --- a/src/mame/drivers/aim65.cpp +++ b/src/mame/drivers/aim65.cpp @@ -24,6 +24,7 @@ Bugs ******************************************************************************/ +#include "emu.h" #include "includes/aim65.h" #include "softlist.h" #include "aim65.lh" @@ -181,15 +182,15 @@ static MACHINE_CONFIG_START( aim65, aim65_state ) /* alpha-numeric display */ MCFG_DEVICE_ADD("ds1", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds1)) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds<1>)) MCFG_DEVICE_ADD("ds2", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds2)) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds<2>)) MCFG_DEVICE_ADD("ds3", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds3)) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds<3>)) MCFG_DEVICE_ADD("ds4", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds4)) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds<4>)) MCFG_DEVICE_ADD("ds5", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds5)) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds<5>)) /* Sound - wave sound only */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -286,4 +287,4 @@ ROM_END ***************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP(1977, aim65, 0, 0, aim65, aim65, driver_device, 0, "Rockwell", "AIM 65", MACHINE_NO_SOUND_HW ) +COMP(1977, aim65, 0, 0, aim65, aim65, driver_device, 0, "Rockwell", "AIM 65", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 7de7e74e71c..ea3f01ea1c4 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -2438,6 +2438,11 @@ WRITE8_MEMBER( cmi_state::q133_1_portb_w ) WRITE8_MEMBER( cmi_state::cmi10_u20_a_w ) { + // low 7 bits connected to alphanumeric display data lines + m_dp1->data_w(data & 0x7f); + m_dp2->data_w(data & 0x7f); + m_dp3->data_w(data & 0x7f); + /* int bk = data; int bit = 0; @@ -2453,6 +2458,20 @@ WRITE8_MEMBER( cmi_state::cmi10_u20_a_w ) WRITE8_MEMBER( cmi_state::cmi10_u20_b_w ) { + // connected to alphanumeric display control lines + uint8_t const addr = bitswap<2>(data, 0, 1); + + m_dp1->ce_w(BIT(data, 6)); + m_dp1->cu_w(BIT(data, 7)); + m_dp1->addr_w(addr); + + m_dp2->ce_w(BIT(data, 4)); + m_dp2->cu_w(BIT(data, 5)); + m_dp2->addr_w(addr); + + m_dp3->ce_w(BIT(data, 2)); + m_dp3->cu_w(BIT(data, 3)); + m_dp3->addr_w(addr); } READ_LINE_MEMBER( cmi_state::cmi10_u20_cb1_r ) @@ -2470,28 +2489,10 @@ READ_LINE_MEMBER( cmi_state::cmi10_u20_cb1_r ) WRITE_LINE_MEMBER( cmi_state::cmi10_u20_cb2_w ) { - uint8_t data = m_cmi10_pia_u20->a_output() & 0x7f; - uint8_t b_port = m_cmi10_pia_u20->b_output(); - int addr = (BIT(b_port, 0) << 1) | BIT(b_port, 1); - address_space &space = m_maincpu1->space(AS_PROGRAM); // Just needed to call data_w - - /* DP1 */ - m_dp1->ce_w(BIT(b_port, 6)); - m_dp1->cu_w(BIT(b_port, 7)); + // connected to alphanumeric display write strobe m_dp1->wr_w(state); - m_dp1->data_w(space, addr, data, 0xff); - - /* DP2 */ - m_dp2->ce_w(BIT(b_port, 4)); - m_dp2->cu_w(BIT(b_port, 5)); m_dp2->wr_w(state); - m_dp2->data_w(space, addr & 3, data, 0xff); - - /* DP3 */ - m_dp3->ce_w(BIT(b_port, 2)); - m_dp3->cu_w(BIT(b_port, 3)); m_dp3->wr_w(state); - m_dp3->data_w(space, addr & 3, data, 0xff); } WRITE16_MEMBER( cmi_state::cmi_iix_update_dp1 ) diff --git a/src/mame/drivers/sitcom.cpp b/src/mame/drivers/sitcom.cpp index d257bd69076..25fbf24c1a3 100644 --- a/src/mame/drivers/sitcom.cpp +++ b/src/mame/drivers/sitcom.cpp @@ -1,135 +1,179 @@ // license:BSD-3-Clause -// copyright-holders:Robbbert +// copyright-holders:Robbbert,Vas Crabb /*************************************************************************** SITCOM (known as Sitcom, Sitcom85, Sitcom8085) 25/09/2011 Driver [Robbbert] - http://www.izabella.me.uk/html/sitcom_.html - http://www.sbprojects.com/sitcom/sitcom.htm + http://www.sitcom.tk/ + http://www.sbprojects.net/projects/izabella/html/sitcom_.html - The display consists of a LED connected to SOD, and a pair of - DL1414 intelligent alphanumeric displays. + The display consists of a LED connected to SOD, and a pair of DL1414 + intelligent alphanumeric displays. The idea of this device is that you write a 8085 program with an - assembler on your PC. You then compile it, and then send it to - the SITCOM via a serial cable. The program then (hopefully) runs - on the SITCOM. With the 8255 expansion, you could wire up input - devices or other hardware for your program to use. + assembler on your PC. You then compile it, and then send it to the + SITCOM via a serial cable. The program then (hopefully) runs on the + SITCOM. With the 8255 expansion, you could wire up input devices or + other hardware for your program to use. The SOD LED blinks slowly while waiting; stays on while downloading; and blinks quickly if an error occurs. - After a successful download, the ROM is switched out and the RAM - mirrored to the lower 32k. The downloaded program is then executed. - This part is not emulated. + After a successful upload, hit the Reset button to mirror RAM into + the low 32kB of the address space in place of ROM and run the + program. - In MESS, start emulation. After about 10 seconds the display will - scroll sideways with a message and a weblink. There are no input keys. + The null modem bitbanger should be configured for 9600 8N1 to upload + a program. The data should be in Intel HEX format. ****************************************************************************/ #include "emu.h" + +#include "bus/rs232/rs232.h" + #include "cpu/i8085/i8085.h" + +#include "machine/clock.h" +#include "machine/bankdev.h" +#include "machine/i8255.h" + #include "video/dl1416.h" + +#include "softlist_dev.h" + #include "sitcom.lh" +namespace { class sitcom_state : public driver_device { public: sitcom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ds0(*this, "ds0"), - m_ds1(*this, "ds1") - { } - - required_device<cpu_device> m_maincpu; - required_device<dl1416_device> m_ds0; - required_device<dl1416_device> m_ds1; - DECLARE_WRITE_LINE_MEMBER(sod_led); - DECLARE_READ_LINE_MEMBER(sid_line); + : driver_device(mconfig, type, tag) + , m_buttons(*this, "BUTTONS") + , m_maincpu(*this, "maincpu") + , m_bank(*this, "bank") + , m_rxd(true) + { + } + + template <unsigned D> DECLARE_WRITE16_MEMBER(update_ds) { output().set_digit_value((D << 2) | offset, data); } + DECLARE_WRITE_LINE_MEMBER(update_rxd) { m_rxd = bool(state); } + DECLARE_WRITE_LINE_MEMBER(sod_led) { output().set_value("sod_led", state); } + DECLARE_READ_LINE_MEMBER(sid_line) { return m_rxd ? 1 : 0; } + + DECLARE_INPUT_CHANGED_MEMBER(buttons); + +protected: + virtual void machine_start() override; virtual void machine_reset() override; - DECLARE_WRITE16_MEMBER(sitcom_update_ds0); - DECLARE_WRITE16_MEMBER(sitcom_update_ds1); + + required_ioport m_buttons; + required_device<cpu_device> m_maincpu; + required_device<address_map_bank_device> m_bank; + + bool m_rxd; }; -static ADDRESS_MAP_START( sitcom_mem, AS_PROGRAM, 8, sitcom_state ) +ADDRESS_MAP_START( sitcom_bank, AS_PROGRAM, 8, sitcom_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x8000, 0xffff) AM_RAM + AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram") ADDRESS_MAP_END -static ADDRESS_MAP_START( sitcom_io, AS_IO, 8, sitcom_state ) +ADDRESS_MAP_START( sitcom_mem, AS_PROGRAM, 8, sitcom_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_DEVICE("bank", address_map_bank_device, amap8) + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + +ADDRESS_MAP_START( sitcom_io, AS_IO, 8, sitcom_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - // AM_RANGE(0x00, 0x1f) 8255 for expansion only - AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("ds0", dl1416_device, data_w) //left display - AM_RANGE(0xe0, 0xe3) AM_DEVWRITE("ds1", dl1416_device, data_w) //right display + AM_RANGE(0x00, 0x03) AM_MIRROR(0x1c) AM_DEVREADWRITE("pia", i8255_device, read, write) + AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x1c) AM_DEVWRITE("ds0", dl1414_device, bus_w) + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x1c) AM_DEVWRITE("ds1", dl1414_device, bus_w) ADDRESS_MAP_END -/* Input ports */ -static INPUT_PORTS_START( sitcom ) + +INPUT_PORTS_START( sitcom ) + PORT_START("BUTTONS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Boot") PORT_CHANGED_MEMBER(DEVICE_SELF, sitcom_state, buttons, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, sitcom_state, buttons, 0) INPUT_PORTS_END -void sitcom_state::machine_reset() -{ - m_ds0->ce_w(0); // enable - m_ds0->wr_w(0); - m_ds0->cu_w(1); // no cursor - m_ds1->ce_w(0); - m_ds1->wr_w(0); - m_ds1->cu_w(1); -} -WRITE16_MEMBER(sitcom_state::sitcom_update_ds0) +void sitcom_state::machine_start() { - output().set_digit_value(offset, data); + save_item(NAME(m_rxd)); } -WRITE16_MEMBER(sitcom_state::sitcom_update_ds1) +void sitcom_state::machine_reset() { - output().set_digit_value(4 + offset, data); } -// SID line used as serial input from a pc -READ_LINE_MEMBER( sitcom_state::sid_line ) +INPUT_CHANGED_MEMBER( sitcom_state::buttons ) { - return 1; //idle - changing to 0 gives a FR ERROR -} + bool const boot(BIT(m_buttons->read(), 0)); + bool const reset(BIT(m_buttons->read(), 1)); -WRITE_LINE_MEMBER( sitcom_state::sod_led ) -{ - output().set_value("sod_led", state); + m_maincpu->set_input_line(INPUT_LINE_RESET, (boot || reset) ? ASSERT_LINE : CLEAR_LINE); + + if (boot) + m_bank->set_bank(0); + else if (reset) + m_bank->set_bank(1); } -static MACHINE_CONFIG_START( sitcom, sitcom_state ) - /* basic machine hardware */ + +MACHINE_CONFIG_START( sitcom, sitcom_state ) + // basic machine hardware MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz) // 3.072MHz can be used for an old slow 8085 MCFG_CPU_PROGRAM_MAP(sitcom_mem) MCFG_CPU_IO_MAP(sitcom_io) MCFG_I8085A_SID(READLINE(sitcom_state, sid_line)) MCFG_I8085A_SOD(WRITELINE(sitcom_state, sod_led)) - MCFG_DEFAULT_LAYOUT(layout_sitcom) + MCFG_DEVICE_ADD("bank", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(sitcom_bank) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000) + + MCFG_CLOCK_ADD("100hz", 100) + MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE("maincpu", I8085_RST75_LINE)) - /* video hardware */ - MCFG_DEVICE_ADD("ds0", DL1416B, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds0)) - MCFG_DEVICE_ADD("ds1", DL1416B, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds1)) + MCFG_DEVICE_ADD("pia", I8255, 0) + + // video hardware + MCFG_DEVICE_ADD("ds0", DL1414T, 0) // left display + MCFG_DL1414_UPDATE_HANDLER(WRITE16(sitcom_state, update_ds<0>)) + MCFG_DEVICE_ADD("ds1", DL1414T, 0) // right display + MCFG_DL1414_UPDATE_HANDLER(WRITE16(sitcom_state, update_ds<1>)) + + // host interface + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(WRITELINE(sitcom_state, update_rxd)) + + MCFG_SOFTWARE_LIST_ADD("bitb_list", "sitcom") + MCFG_DEFAULT_LAYOUT(layout_sitcom) MACHINE_CONFIG_END -/* ROM definition */ + ROM_START( sitcom ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "boot8085.bin", 0x0000, 0x06b8, CRC(1b5e3310) SHA1(3323b65f0c10b7ab6bb75ec824e6d5fb643693a8)) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "boot8085.bin", 0x0000, 0x06b8, CRC(1b5e3310) SHA1(3323b65f0c10b7ab6bb75ec824e6d5fb643693a8) ) ROM_END +} // anonymous namespace + + /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2002, sitcom, 0, 0, sitcom, sitcom, driver_device, 0, "San Bergmans & Izabella Malcolm", "Sitcom", MACHINE_NO_SOUND_HW) +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 2002, sitcom, 0, 0, sitcom, sitcom, driver_device, 0, "San Bergmans & Izabella Malcolm", "Sitcom", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/testconsole.cpp b/src/mame/drivers/testconsole.cpp index bf77d88225f..29bcc9450ad 100644 --- a/src/mame/drivers/testconsole.cpp +++ b/src/mame/drivers/testconsole.cpp @@ -92,11 +92,7 @@ protected: virtual void machine_reset() override { for (required_device<dl1416_device> const &dsp : m_dsp) - { - dsp->ce_w(0); - dsp->wr_w(0); dsp->cu_w(1); - } } required_device_array<dl1416_device, 4> m_dsp; @@ -106,10 +102,10 @@ protected: ADDRESS_MAP_START(program_map, AS_PROGRAM, 8, whouse_testcons_state) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x2003) AM_DEVWRITE("dsp0", dl1416_device, data_w) - AM_RANGE(0x2004, 0x2007) AM_DEVWRITE("dsp1", dl1416_device, data_w) - AM_RANGE(0x2008, 0x200b) AM_DEVWRITE("dsp2", dl1416_device, data_w) - AM_RANGE(0x200c, 0x200f) AM_DEVWRITE("dsp3", dl1416_device, data_w) + AM_RANGE(0x2000, 0x2003) AM_DEVWRITE("dsp0", dl1416_device, bus_w) + AM_RANGE(0x2004, 0x2007) AM_DEVWRITE("dsp1", dl1416_device, bus_w) + AM_RANGE(0x2008, 0x200b) AM_DEVWRITE("dsp2", dl1416_device, bus_w) + AM_RANGE(0x200c, 0x200f) AM_DEVWRITE("dsp3", dl1416_device, bus_w) AM_RANGE(0x2800, 0x28ff) AM_DEVREADWRITE("i8155", i8155_device, memory_r, memory_w) AM_RANGE(0x3000, 0x3fff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_READ_PORT("row0") diff --git a/src/mame/includes/aim65.h b/src/mame/includes/aim65.h index 0feabce17bd..2775e2130a3 100644 --- a/src/mame/includes/aim65.h +++ b/src/mame/includes/aim65.h @@ -11,7 +11,6 @@ #ifndef AIM65_H_ #define AIM65_H_ -#include "emu.h" #include "cpu/m6502/m6502.h" #include "video/dl1416.h" #include "machine/6522via.h" @@ -37,20 +36,17 @@ class aim65_state : public driver_device { public: aim65_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2"), - m_z24(*this, "z24"), - m_z25(*this, "z25"), - m_z26(*this, "z26"), - m_ram(*this, RAM_TAG), - m_ds1(*this, "ds1"), - m_ds2(*this, "ds2"), - m_ds3(*this, "ds3"), - m_ds4(*this, "ds4"), - m_ds5(*this, "ds5") - { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cassette1(*this, "cassette") + , m_cassette2(*this, "cassette2") + , m_z24(*this, "z24") + , m_z25(*this, "z25") + , m_z26(*this, "z26") + , m_ram(*this, RAM_TAG) + , m_ds(*this, "ds%u", 1) + { + } DECLARE_WRITE8_MEMBER(aim65_pia_a_w); DECLARE_WRITE8_MEMBER(aim65_pia_b_w); @@ -58,8 +54,18 @@ public: DECLARE_WRITE8_MEMBER(aim65_riot_a_w); DECLARE_WRITE8_MEMBER(aim65_pb_w); DECLARE_READ8_MEMBER(aim65_pb_r); - uint8_t m_pia_a; - uint8_t m_pia_b; + + template <unsigned D> DECLARE_WRITE16_MEMBER(aim65_update_ds); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z24_load) { return load_cart(image, m_z24, "z24"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z25_load) { return load_cart(image, m_z25, "z25"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z26_load) { return load_cart(image, m_z26, "z26"); } + +protected: + virtual void machine_start() override; + + image_init_result load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag); + uint8_t m_riot_port_a; uint8_t m_pb_save; @@ -70,26 +76,7 @@ public: required_device<generic_slot_device> m_z25; required_device<generic_slot_device> m_z26; required_device<ram_device> m_ram; - required_device<dl1416_device> m_ds1; - required_device<dl1416_device> m_ds2; - required_device<dl1416_device> m_ds3; - required_device<dl1416_device> m_ds4; - required_device<dl1416_device> m_ds5; - virtual void machine_start() override; - void aim65_pia(); - - DECLARE_WRITE16_MEMBER(aim65_update_ds1); - DECLARE_WRITE16_MEMBER(aim65_update_ds2); - DECLARE_WRITE16_MEMBER(aim65_update_ds3); - DECLARE_WRITE16_MEMBER(aim65_update_ds4); - DECLARE_WRITE16_MEMBER(aim65_update_ds5); - - void dl1416_update(dl1416_device *device, int index); - - image_init_result load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z24_load) { return load_cart(image, m_z24, "z24"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z25_load) { return load_cart(image, m_z25, "z25"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z26_load) { return load_cart(image, m_z26, "z26"); } + required_device_array<dl1416_device, 5> m_ds; }; diff --git a/src/mame/machine/aim65.cpp b/src/mame/machine/aim65.cpp index c66eee06764..d3e333db8d8 100644 --- a/src/mame/machine/aim65.cpp +++ b/src/mame/machine/aim65.cpp @@ -7,6 +7,7 @@ ******************************************************************************/ +#include "emu.h" #include "includes/aim65.h" @@ -43,63 +44,37 @@ * PB7: CU (Cursor) */ -void aim65_state::dl1416_update(dl1416_device *device, int index) -{ - device->ce_w(m_pia_a & (0x04 << index)); - device->wr_w(BIT(m_pia_a, 7)); - device->cu_w(BIT(m_pia_b, 7)); - device->data_w(generic_space(), m_pia_a & 0x03, m_pia_b & 0x7f); -} - -void aim65_state::aim65_pia() -{ - dl1416_update(m_ds1, 0); - dl1416_update(m_ds2, 1); - dl1416_update(m_ds3, 2); - dl1416_update(m_ds4, 3); - dl1416_update(m_ds5, 4); -} - - WRITE8_MEMBER( aim65_state::aim65_pia_a_w ) { - m_pia_a = data; - aim65_pia(); + for (std::size_t index = 0; m_ds.size() > index; ++index) + { + m_ds[index]->addr_w(data & 0x03); + m_ds[index]->ce_w(BIT(data, 2 + index)); + m_ds[index]->wr_w(BIT(data, 7)); + } } WRITE8_MEMBER( aim65_state::aim65_pia_b_w ) { - m_pia_b = data; - aim65_pia(); -} - - -WRITE16_MEMBER( aim65_state::aim65_update_ds1) -{ - output().set_digit_value(0 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds2) -{ - output().set_digit_value(4 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds3) -{ - output().set_digit_value(8 + (offset ^ 3), data); + for (required_device<dl1416_device> &ds : m_ds) + { + ds->cu_w(BIT(data, 7)); + ds->data_w(data & 0x7f); + } } -WRITE16_MEMBER( aim65_state::aim65_update_ds4) -{ - output().set_digit_value(12 + (offset ^ 3), data); -} -WRITE16_MEMBER( aim65_state::aim65_update_ds5) +template <unsigned D> WRITE16_MEMBER( aim65_state::aim65_update_ds ) { - output().set_digit_value(16 + (offset ^ 3), data); + output().set_digit_value(((D - 1) << 2) | (offset ^ 3), data); } +template WRITE16_MEMBER( aim65_state::aim65_update_ds<1> ); +template WRITE16_MEMBER( aim65_state::aim65_update_ds<2> ); +template WRITE16_MEMBER( aim65_state::aim65_update_ds<3> ); +template WRITE16_MEMBER( aim65_state::aim65_update_ds<4> ); +template WRITE16_MEMBER( aim65_state::aim65_update_ds<5> ); /****************************************************************************** @@ -156,6 +131,10 @@ void aim65_state::machine_start() space.install_ram(0x0000, ram->size() - 1, ram->pointer()); m_pb_save = 0; + + // Register save state + save_item(NAME(m_riot_port_a)); + save_item(NAME(m_pb_save)); } |