1 // license:GPL-2.0+ 2 // copyright-holders:Dirk Best,Carl 3 /*************************************************************************** 4 5 Intel 8089 I/O Processor 6 7 ***************************************************************************/ 8 9 #ifndef MAME_CPU_I8089_I8089_H 10 #define MAME_CPU_I8089_I8089_H 11 12 #pragma once 13 14 #ifdef _MSC_VER 15 // MSVC seems to want to actually instantiate templates when it gets an extern template declaration, effectively defeating the purpose of extern template declatations altogether 16 // In this case it causes a problem because the required_device template can't be instantiated for the incomplete i8089_channel_device type 17 #include "i8089_channel.h" 18 #endif 19 20 21 //************************************************************************** 22 // TYPE DEFINITIONS 23 //************************************************************************** 24 25 // forward declaration 26 class i8089_channel_device; 27 28 // ======================> i8089_device 29 30 class i8089_device : public cpu_device 31 { 32 friend class i8089_channel_device; 33 34 public: 35 // construction/destruction 36 i8089_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 37 38 // callbacks sintr1()39 auto sintr1() { return m_write_sintr1.bind(); } sintr2()40 auto sintr2() { return m_write_sintr2.bind(); } 41 42 // configuration helpers set_data_width(uint8_t data_width)43 void set_data_width(uint8_t data_width) { m_data_width = data_width; } 44 45 // input lines 46 DECLARE_WRITE_LINE_MEMBER( ca_w ); DECLARE_WRITE_LINE_MEMBER(sel_w)47 DECLARE_WRITE_LINE_MEMBER( sel_w ) { m_sel = state; } 48 DECLARE_WRITE_LINE_MEMBER( drq1_w ); 49 DECLARE_WRITE_LINE_MEMBER( drq2_w ); 50 DECLARE_WRITE_LINE_MEMBER( ext1_w ); 51 DECLARE_WRITE_LINE_MEMBER( ext2_w ); 52 53 protected: 54 // device-level overrides 55 virtual void device_start() override; 56 virtual void device_config_complete() override; 57 virtual void device_reset() override; 58 59 // device_execute_interface overrides 60 virtual void execute_run() override; 61 62 int m_icount; 63 64 // device_memory_interface overrides 65 virtual space_config_vector memory_space_config() const override; 66 67 address_space_config m_program_config; 68 address_space_config m_io_config; 69 70 // device_disasm_interface overrides 71 virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; 72 73 // device_state_interface overrides 74 virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; 75 76 // optional information overrides 77 virtual void device_add_mconfig(machine_config &config) override; 78 79 private: sysbus_width()80 bool sysbus_width() const { return BIT(m_sysbus, 0); } remotebus_width()81 bool remotebus_width() const { return BIT(m_soc, 0); } request_grant()82 bool request_grant() const { return BIT(m_soc, 1); } 83 84 // internal communication DECLARE_WRITE_LINE_MEMBER(ch1_sintr_w)85 DECLARE_WRITE_LINE_MEMBER( ch1_sintr_w ) { m_write_sintr1(state); } DECLARE_WRITE_LINE_MEMBER(ch2_sintr_w)86 DECLARE_WRITE_LINE_MEMBER( ch2_sintr_w ) { m_write_sintr2(state); } 87 88 uint8_t read_byte(bool space, offs_t address); 89 uint16_t read_word(bool space, offs_t address); 90 void write_byte(bool space, offs_t address, uint8_t data); 91 void write_word(bool space, offs_t address, uint16_t data); 92 93 required_device<i8089_channel_device> m_ch1; 94 required_device<i8089_channel_device> m_ch2; 95 96 devcb_write_line m_write_sintr1; 97 devcb_write_line m_write_sintr2; 98 99 void initialize(); 100 101 uint8_t m_data_width; 102 address_space *m_mem; 103 address_space *m_io; 104 105 // register indexes for the debugger state 106 enum 107 { 108 SYSBUS, 109 SCB, 110 SOC, 111 DIVIDER1, 112 CH1_GA, CH1_GB, CH1_GC, 113 CH1_TP, CH1_BC, CH1_IX, 114 CH1_CC, CH1_MC, CH1_CP, 115 CH1_PP, CH1_PSW, 116 DIVIDER2, 117 CH2_GA, CH2_GB, CH2_GC, 118 CH2_TP, CH2_BC, CH2_IX, 119 CH2_CC, CH2_MC, CH2_CP, 120 CH2_PP, CH2_PSW 121 }; 122 123 // system configuration 124 uint8_t m_sysbus; 125 offs_t m_scb; 126 uint8_t m_soc; 127 128 bool m_initialized; 129 bool m_master; 130 131 // task pointer for the currently executing channel 132 offs_t m_current_tp; 133 134 // state of input pins 135 int m_ca; 136 int m_sel; 137 bool m_last_chan; 138 }; 139 140 141 // device type definition 142 DECLARE_DEVICE_TYPE(I8089, i8089_device) 143 144 #endif // MAME_CPU_I8089_I8089_H 145