sitcom: hook up LEDs to PIA outputs to show state visually, softlist a

buch of tutorial programs (mostly displaying patterns on the LEDs)
This commit is contained in:
Vas Crabb 2017-02-11 23:04:57 +11:00
parent f86b81cf8e
commit 32e28a68d6
5 changed files with 182 additions and 17 deletions

View file

@ -3,17 +3,6 @@
<softwarelist name="sitcom" description="SITCOM">
<software name="flash1">
<description>Flash 1</description>
<publisher>Izabella Malcolm</publisher>
<year>2002</year>
<part name="bitb1" interface="rs232">
<dataarea name="bitb" size="99">
<rom name="flash1.hex" size="99" crc="23fe0130" sha1="6f77c78d651de1c9d8d50239c50efa991970511c" offset="0" />
</dataarea>
</part>
</software>
<software name="san">
<description>San</description>
<publisher>San Bergmans</publisher>
@ -25,4 +14,88 @@
</part>
</software>
<software name="flash1">
<description>Flash 1</description>
<publisher>Izabella Malcolm</publisher>
<year>2002</year>
<part name="bitb1" interface="rs232">
<dataarea name="bitb" size="99">
<rom name="flash1.hex" size="99" crc="23fe0130" sha1="6f77c78d651de1c9d8d50239c50efa991970511c" offset="0" />
</dataarea>
</part>
</software>
<software name="lesson1">
<description>Lesson 1</description>
<publisher>Izabella Malcolm</publisher>
<year>2002</year>
<part name="lesson1a" interface="rs232">
<dataarea name="bitb" size="50">
<rom name="lesson1a.hex" size="50" crc="2027ac09" sha1="86319391baa71eb95a99d9f839a87dd589abdf72" offset="0" />
</dataarea>
</part>
<part name="lesson1b" interface="rs232">
<dataarea name="bitb" size="52">
<rom name="lesson1b.hex" size="52" crc="9b24fa27" sha1="3d8159c9c80b95f0c34318acfd666abf6d77b070" offset="0" />
</dataarea>
</part>
<part name="lesson1c" interface="rs232">
<dataarea name="bitb" size="96">
<rom name="lesson1c.hex" size="96" crc="883bc669" sha1="47ed62cb6167e3f2e007287cf28933b74f49f83c" offset="0" />
</dataarea>
</part>
</software>
<software name="lesson2">
<description>Lesson 2</description>
<publisher>Izabella Malcolm</publisher>
<year>2002</year>
<part name="lesson2a" interface="rs232">
<dataarea name="bitb" size="96">
<rom name="lesson2a.hex" size="96" crc="85fd2f2c" sha1="d4ff642d6927760ad0260f9c0aa5f48113f3b75e" offset="0" />
</dataarea>
</part>
<part name="lesson2b" interface="rs232">
<dataarea name="bitb" size="134">
<rom name="lesson2b.hex" size="134" crc="ee5e3b4a" sha1="650919f578e877baa1011f745ba8a81b4355aa4d" offset="0" />
</dataarea>
</part>
<part name="lesson2c" interface="rs232">
<dataarea name="bitb" size="226">
<rom name="lesson2c.hex" size="226" crc="faf58175" sha1="e98b8f64cc8ea02d95f8b82efce73826c20b0583" offset="0" />
</dataarea>
</part>
<part name="lesson2d" interface="rs232">
<dataarea name="bitb" size="292">
<rom name="lesson2d.hex" size="292" crc="008f8de2" sha1="8dc59171844d343e3fcbfef7adbe94757c8f3c79" offset="0" />
</dataarea>
</part>
</software>
<software name="lesson3">
<description>Lesson 3</description>
<publisher>Izabella Malcolm</publisher>
<year>2002</year>
<part name="lesson3a" interface="rs232">
<dataarea name="bitb" size="268">
<rom name="lesson3a.hex" size="268" crc="e5886094" sha1="9cccbeccc6fe6880362a2445f14c01711b27b69d" offset="0" />
</dataarea>
</part>
<part name="lesson3b" interface="rs232">
<dataarea name="bitb" size="264">
<rom name="lesson3b.hex" size="264" crc="017313bc" sha1="3c8dff51f726afb1fd92dd59ca1beddb046df53c" offset="0" />
</dataarea>
</part>
<part name="lesson3c" interface="rs232">
<dataarea name="bitb" size="310">
<rom name="lesson3c.hex" size="310" crc="d2f3345b" sha1="8fd2c959466509aedded7dd1b750535a164f7b3e" offset="0" />
</dataarea>
</part>
<part name="lesson3d" interface="rs232">
<dataarea name="bitb" size="174">
<rom name="lesson3d.hex" size="174" crc="e1f03069" sha1="0ffaea1fefc3c9e36c16525e9af4c7f50662e2a8" offset="0" />
</dataarea>
</part>
</software>
</softwarelist>

View file

@ -23,7 +23,8 @@ const device_type BITBANGER = &device_creator<bitbanger_device>;
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)
{
}

View file

@ -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<bitbanger_device &>(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

View file

@ -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

View file

@ -4,9 +4,21 @@
<mamelayout version="2">
<element name="a_led">
<disk>
<disk state="0">
<color red="0.0" green="0.75" blue="0.0" />
</disk>
<disk state="1">
<color red="0.0" green="0.15" blue="0.0" />
</disk>
</element>
<element name="b_led">
<disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
<disk state="1">
<color red="0.15" green="0.0" blue="0.0" />
</disk>
</element>
<element name="a_digit" defstate="0">
@ -25,7 +37,7 @@
<view name="Default Layout">
<!-- Black background -->
<bezel element="background">
<bounds left="34" top="60" right="341" bottom="130" />
<bounds left="34" top="60" right="341" bottom="160" />
</bezel>
<bezel name="sod_led" element="a_led">
<bounds left="46" right="56" top="90" bottom="100" />
@ -59,6 +71,56 @@
<bounds left="306" top="70" right="331" bottom="120" />
</bezel>
<bezel name="pb7" element="b_led">
<bounds left="65" top="140" right="75" bottom="150" />
</bezel>
<bezel name="pb6" element="b_led">
<bounds left="80" top="140" right="90" bottom="150" />
</bezel>
<bezel name="pb5" element="b_led">
<bounds left="95" top="140" right="105" bottom="150" />
</bezel>
<bezel name="pb4" element="b_led">
<bounds left="110" top="140" right="120" bottom="150" />
</bezel>
<bezel name="pb3" element="b_led">
<bounds left="125" top="140" right="135" bottom="150" />
</bezel>
<bezel name="pb2" element="b_led">
<bounds left="140" top="140" right="150" bottom="150" />
</bezel>
<bezel name="pb1" element="b_led">
<bounds left="155" top="140" right="165" bottom="150" />
</bezel>
<bezel name="pb0" element="b_led">
<bounds left="170" top="140" right="180" bottom="150" />
</bezel>
<bezel name="pa7" element="b_led">
<bounds left="185" top="140" right="195" bottom="150" />
</bezel>
<bezel name="pa6" element="b_led">
<bounds left="200" top="140" right="210" bottom="150" />
</bezel>
<bezel name="pa5" element="b_led">
<bounds left="215" top="140" right="225" bottom="150" />
</bezel>
<bezel name="pa4" element="b_led">
<bounds left="230" top="140" right="240" bottom="150" />
</bezel>
<bezel name="pa3" element="b_led">
<bounds left="245" top="140" right="255" bottom="150" />
</bezel>
<bezel name="pa2" element="b_led">
<bounds left="260" top="140" right="270" bottom="150" />
</bezel>
<bezel name="pa1" element="b_led">
<bounds left="275" top="140" right="285" bottom="150" />
</bezel>
<bezel name="pa0" element="b_led">
<bounds left="290" top="140" right="300" bottom="150" />
</bezel>
</view>
</mamelayout>