diff options
Diffstat (limited to 'src/devices/cpu/cop400/cop400.h')
-rw-r--r-- | src/devices/cpu/cop400/cop400.h | 76 |
1 files changed, 16 insertions, 60 deletions
diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h index 383b89372a1..e97f8a135a7 100644 --- a/src/devices/cpu/cop400/cop400.h +++ b/src/devices/cpu/cop400/cop400.h @@ -13,46 +13,6 @@ #pragma once -// i/o pins - -// L pins: 8-bit bi-directional -#define MCFG_COP400_READ_L_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_l_callback(DEVCB_##_devcb); -#define MCFG_COP400_WRITE_L_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_write_l_callback(DEVCB_##_devcb); -// output state when pins are in tri-state, default 0 -#define MCFG_COP400_READ_L_TRISTATE_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_l_tristate_callback(DEVCB_##_devcb); - -// G pins: 4-bit bi-directional -#define MCFG_COP400_READ_G_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_g_callback(DEVCB_##_devcb); -#define MCFG_COP400_WRITE_G_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_write_g_callback(DEVCB_##_devcb); - -// D outputs: 4-bit general purpose output -#define MCFG_COP400_WRITE_D_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_write_d_callback(DEVCB_##_devcb); - -// IN inputs: 4-bit general purpose input -#define MCFG_COP400_READ_IN_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_in_callback(DEVCB_##_devcb); - -// SI/SO lines: serial in/out or counter/gen.purpose -#define MCFG_COP400_READ_SI_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_si_callback(DEVCB_##_devcb); -#define MCFG_COP400_WRITE_SO_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_write_so_callback(DEVCB_##_devcb); - -// SK output line: logic-controlled clock or gen.purpose -#define MCFG_COP400_WRITE_SK_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_write_sk_callback(DEVCB_##_devcb); - -// CKI/CKO lines: only CKO input here -#define MCFG_COP400_READ_CKO_CB(_devcb) \ - downcast<cop400_cpu_device &>(*device).set_read_cko_callback(DEVCB_##_devcb); - - /*************************************************************************** CONSTANTS ***************************************************************************/ @@ -110,40 +70,36 @@ enum cop400_cko_bond { COP400_CKO_GENERAL_PURPOSE_INPUT }; - -#define MCFG_COP400_CONFIG(_cki, _cko, _microbus) \ - downcast<cop400_cpu_device &>(*device).set_cki(_cki); \ - downcast<cop400_cpu_device &>(*device).set_cko(_cko); \ - downcast<cop400_cpu_device &>(*device).set_microbus(_microbus); - - class cop400_cpu_device : public cpu_device { public: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - // configuration helpers - template<class Object> devcb_base &set_read_l_callback(Object &&cb) { return m_read_l.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_read_l_tristate_callback(Object &&cb) { return m_read_l_tristate.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_write_l_callback(Object &&cb) { return m_write_l.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_read_g_callback(Object &&cb) { return m_read_g.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_write_g_callback(Object &&cb) { return m_write_g.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_write_d_callback(Object &&cb) { return m_write_d.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_read_in_callback(Object &&cb) { return m_read_in.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_read_si_callback(Object &&cb) { return m_read_si.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_write_so_callback(Object &&cb) { return m_write_so.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_write_sk_callback(Object &&cb) { return m_write_sk.set_callback(std::forward<Object>(cb)); } - template<class Object> devcb_base &set_read_cko_callback(Object &&cb) { return m_read_cko.set_callback(std::forward<Object>(cb)); } + // L pins: 8-bit bi-directional auto read_l() { return m_read_l.bind(); } - auto read_l_tristate() { return m_read_l_tristate.bind(); } auto write_l() { return m_write_l.bind(); } + + // output state when pins are in tri-state, default 0 + auto read_l_tristate() { return m_read_l_tristate.bind(); } + + // G pins: 4-bit bi-directional auto read_g() { return m_read_g.bind(); } auto write_g() { return m_write_g.bind(); } + + // D outputs: 4-bit general purpose output auto write_d() { return m_write_d.bind(); } + + // IN inputs: 4-bit general purpose input auto read_in() { return m_read_in.bind(); } + + // SI/SO lines: serial in/out or counter/gen.purpose auto read_si() { return m_read_si.bind(); } auto write_so() { return m_write_so.bind(); } + + // SK output line: logic-controlled clock or gen.purpose auto write_sk() { return m_write_sk.bind(); } + + // CKI/CKO lines: only CKO input here auto read_cko() { return m_read_cko.bind(); } void set_config(cop400_cki_bond cki, cop400_cko_bond cko, bool has_microbus) |