From 32e28a68d6089c6ce1ba7084a164901065cf1730 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 11 Feb 2017 23:04:57 +1100 Subject: [PATCH] sitcom: hook up LEDs to PIA outputs to show state visually, softlist a buch of tutorial programs (mostly displaying patterns on the LEDs) --- hash/sitcom.xml | 95 ++++++++++++++++++++++++++++---- src/devices/imagedev/bitbngr.cpp | 3 +- src/devices/imagedev/bitbngr.h | 15 ++++- src/mame/drivers/sitcom.cpp | 20 +++++++ src/mame/layout/sitcom.lay | 66 +++++++++++++++++++++- 5 files changed, 182 insertions(+), 17 deletions(-) diff --git a/hash/sitcom.xml b/hash/sitcom.xml index 96c5dcd92a0..b1910abc1cd 100644 --- a/hash/sitcom.xml +++ b/hash/sitcom.xml @@ -3,17 +3,6 @@ - - Flash 1 - Izabella Malcolm - 2002 - - - - - - - San San Bergmans @@ -25,4 +14,88 @@ + + Flash 1 + Izabella Malcolm + 2002 + + + + + + + + + Lesson 1 + Izabella Malcolm + 2002 + + + + + + + + + + + + + + + + + + + Lesson 2 + Izabella Malcolm + 2002 + + + + + + + + + + + + + + + + + + + + + + + + Lesson 3 + Izabella Malcolm + 2002 + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/devices/imagedev/bitbngr.cpp b/src/devices/imagedev/bitbngr.cpp index eddf94e0fca..eb56d7251f8 100644 --- a/src/devices/imagedev/bitbngr.cpp +++ b/src/devices/imagedev/bitbngr.cpp @@ -23,7 +23,8 @@ const device_type BITBANGER = &device_creator; bitbanger_device::bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, BITBANGER, "Bitbanger", tag, owner, clock, "bitbanger", __FILE__), - device_image_interface(mconfig, *this) + device_image_interface(mconfig, *this), + m_interface(nullptr) { } diff --git a/src/devices/imagedev/bitbngr.h b/src/devices/imagedev/bitbngr.h index fd7b179b14a..85992844859 100644 --- a/src/devices/imagedev/bitbngr.h +++ b/src/devices/imagedev/bitbngr.h @@ -6,13 +6,15 @@ *********************************************************************/ -#ifndef __BITBNGR_H__ -#define __BITBNGR_H__ +#ifndef MAME_DEVICES_IMAGEDEV_BITBNGR_H +#define MAME_DEVICES_IMAGEDEV_BITBNGR_H class bitbanger_device : public device_t, public device_image_interface { public: + static void static_set_interface(device_t &device, const char *_interface) { downcast(device).m_interface = _interface; } + // construction/destruction bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -28,6 +30,7 @@ public: virtual bool is_creatable() const override { return 1; } virtual bool must_be_loaded() const override { return 0; } virtual bool is_reset_on_load() const override { return 0; } + virtual const char *image_interface() const override { return m_interface; } virtual const char *file_extensions() const override { return ""; } void output(uint8_t data); @@ -37,9 +40,15 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_config_complete() override; + +private: + char const *m_interface; }; +#define MCFG_BITBANGER_INTERFACE(_interface) \ + bitbanger_image_device::static_set_interface(*device, _interface); + // device type definition extern const device_type BITBANGER; -#endif /* __BITBNGR_H__ */ +#endif // MAME_DEVICES_IMAGEDEV_BITBNGR_H diff --git a/src/mame/drivers/sitcom.cpp b/src/mame/drivers/sitcom.cpp index 25fbf24c1a3..73db2ef3df9 100644 --- a/src/mame/drivers/sitcom.cpp +++ b/src/mame/drivers/sitcom.cpp @@ -66,6 +66,9 @@ public: DECLARE_WRITE_LINE_MEMBER(sod_led) { output().set_value("sod_led", state); } DECLARE_READ_LINE_MEMBER(sid_line) { return m_rxd ? 1 : 0; } + DECLARE_WRITE8_MEMBER(update_pia_pa); + DECLARE_WRITE8_MEMBER(update_pia_pb); + DECLARE_INPUT_CHANGED_MEMBER(buttons); protected: @@ -110,10 +113,25 @@ INPUT_PORTS_END void sitcom_state::machine_start() { save_item(NAME(m_rxd)); + + m_rxd = true; } void sitcom_state::machine_reset() { + m_bank->set_bank(0); +} + +WRITE8_MEMBER( sitcom_state::update_pia_pa ) +{ + for (int i = 0; 8 > i; ++i) + output().set_indexed_value("pa", i, BIT(data, i)); +} + +WRITE8_MEMBER( sitcom_state::update_pia_pb ) +{ + for (int i = 0; 8 > i; ++i) + output().set_indexed_value("pb", i, BIT(data, i)); } INPUT_CHANGED_MEMBER( sitcom_state::buttons ) @@ -149,6 +167,8 @@ MACHINE_CONFIG_START( sitcom, sitcom_state ) MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE("maincpu", I8085_RST75_LINE)) MCFG_DEVICE_ADD("pia", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(sitcom_state, update_pia_pa)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(sitcom_state, update_pia_pb)) // video hardware MCFG_DEVICE_ADD("ds0", DL1414T, 0) // left display diff --git a/src/mame/layout/sitcom.lay b/src/mame/layout/sitcom.lay index 3428006705e..4a6720ea3ae 100644 --- a/src/mame/layout/sitcom.lay +++ b/src/mame/layout/sitcom.lay @@ -4,9 +4,21 @@ - + + + + + + + + + + + + + @@ -25,7 +37,7 @@ - + @@ -59,6 +71,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +