diff --git a/src/mame/includes/coco3.h b/src/mame/includes/coco3.h index 8522e2c966c..782c555da04 100644 --- a/src/mame/includes/coco3.h +++ b/src/mame/includes/coco3.h @@ -50,12 +50,18 @@ public: void coco3_mem(address_map &map); protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual void update_cart_base(uint8_t *cart_base) override; // miscellaneous virtual void update_keyboard_input(uint8_t value) override; virtual void cart_w(bool line) override; + uint8_t m_pia1b_control_register; + private: required_device m_gime; required_ioport m_screen_config; diff --git a/src/mame/machine/coco3.cpp b/src/mame/machine/coco3.cpp index 60595c3425d..5967617dbae 100644 --- a/src/mame/machine/coco3.cpp +++ b/src/mame/machine/coco3.cpp @@ -46,6 +46,34 @@ #include "emu.h" #include "includes/coco3.h" +//------------------------------------------------- +// device_start +//------------------------------------------------- + +void coco3_state::device_start() +{ + // call parent device_start + coco_state::device_start(); + + // save state support + save_item(NAME(m_pia1b_control_register)); + +} + +//------------------------------------------------- +// device_reset +//------------------------------------------------- + +void coco3_state::device_reset() +{ + /* call parent device_start */ + coco_state::device_reset(); + + /* reset state */ + m_pia1b_control_register = 0; + +} + //------------------------------------------------- // ff20_write //------------------------------------------------- @@ -54,7 +82,11 @@ void coco3_state::ff20_write(offs_t offset, uint8_t data) { coco_state::ff20_write(offset, data); - if (offset == 0x02) + if (offset == 0x03) + m_pia1b_control_register = data; + + /* only pass ff22 to gime if the data register is addressed */ + if (offset == 0x02 && ((m_pia1b_control_register & 0x04) == 0x04)) m_gime->ff22_write(data); }