trunk/src/emu/bus/a2bus/ezcgi.c
| r0 | r244644 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | ezcgi.c |
| 4 | |
| 5 | "E-Z Color Graphics Interface" by Steve Ciarcia |
| 6 | from BYTE Magazine, August, 1982 |
| 7 | https://archive.org/details/byte-magazine-1982-08-rescan |
| 8 | |
| 9 | *********************************************************************/ |
| 10 | |
| 11 | #include "emu.h" |
| 12 | #include "ezcgi.h" |
| 13 | |
| 14 | |
| 15 | /*************************************************************************** |
| 16 | PARAMETERS |
| 17 | ***************************************************************************/ |
| 18 | |
| 19 | #define TMS_TAG "ezcgi_tms" |
| 20 | #define SCREEN_TAG "screen" |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // GLOBAL VARIABLES |
| 24 | //************************************************************************** |
| 25 | |
| 26 | const device_type A2BUS_EZCGI = &device_creator<a2bus_ezcgi_device>; |
| 27 | const device_type A2BUS_EZCGI_9938 = &device_creator<a2bus_ezcgi_9938_device>; |
| 28 | const device_type A2BUS_EZCGI_9958 = &device_creator<a2bus_ezcgi_9958_device>; |
| 29 | |
| 30 | MACHINE_CONFIG_FRAGMENT( ezcgi ) |
| 31 | MCFG_DEVICE_ADD( TMS_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) |
| 32 | MCFG_TMS9928A_VRAM_SIZE(0x4000) // 16k of VRAM |
| 33 | MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(a2bus_ezcgi_device, tms_irq_w)) |
| 34 | MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) |
| 35 | MCFG_SCREEN_UPDATE_DEVICE( TMS_TAG, tms9918a_device, screen_update ) |
| 36 | MACHINE_CONFIG_END |
| 37 | |
| 38 | #define MSX2_XBORDER_PIXELS 16 |
| 39 | #define MSX2_YBORDER_PIXELS 28 |
| 40 | #define MSX2_TOTAL_XRES_PIXELS 256 * 2 + (MSX2_XBORDER_PIXELS * 2) |
| 41 | #define MSX2_TOTAL_YRES_PIXELS 212 * 2 + (MSX2_YBORDER_PIXELS * 2) |
| 42 | #define MSX2_VISIBLE_XBORDER_PIXELS 8 * 2 |
| 43 | #define MSX2_VISIBLE_YBORDER_PIXELS 14 * 2 |
| 44 | |
| 45 | MACHINE_CONFIG_FRAGMENT( ezcgi9938 ) |
| 46 | MCFG_V9938_ADD(TMS_TAG, SCREEN_TAG, 0x30000) // 192K of VRAM |
| 47 | MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(a2bus_ezcgi_9938_device, tms_irq_w)) |
| 48 | |
| 49 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 50 | MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) |
| 51 | MCFG_SCREEN_REFRESH_RATE(60) |
| 52 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 53 | MCFG_SCREEN_UPDATE_DEVICE(TMS_TAG, v9938_device, screen_update) |
| 54 | MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, 262*2) |
| 55 | MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1) |
| 56 | MCFG_SCREEN_PALETTE("ezcgi_tms:palette") |
| 57 | MACHINE_CONFIG_END |
| 58 | |
| 59 | MACHINE_CONFIG_FRAGMENT( ezcgi9958 ) |
| 60 | MCFG_V9958_ADD(TMS_TAG, SCREEN_TAG, 0x30000) // 192K of VRAM |
| 61 | MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(a2bus_ezcgi_9958_device, tms_irq_w)) |
| 62 | |
| 63 | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 64 | MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) |
| 65 | MCFG_SCREEN_REFRESH_RATE(60) |
| 66 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 67 | MCFG_SCREEN_UPDATE_DEVICE(TMS_TAG, v9938_device, screen_update) |
| 68 | MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, 262*2) |
| 69 | MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1) |
| 70 | MCFG_SCREEN_PALETTE("ezcgi_tms:palette") |
| 71 | MACHINE_CONFIG_END |
| 72 | |
| 73 | //------------------------------------------------- |
| 74 | // machine_config_additions - device-specific |
| 75 | // machine configurations |
| 76 | //------------------------------------------------- |
| 77 | |
| 78 | machine_config_constructor a2bus_ezcgi_device::device_mconfig_additions() const |
| 79 | { |
| 80 | return MACHINE_CONFIG_NAME( ezcgi ); |
| 81 | } |
| 82 | |
| 83 | machine_config_constructor a2bus_ezcgi_9938_device::device_mconfig_additions() const |
| 84 | { |
| 85 | return MACHINE_CONFIG_NAME( ezcgi9938 ); |
| 86 | } |
| 87 | |
| 88 | machine_config_constructor a2bus_ezcgi_9958_device::device_mconfig_additions() const |
| 89 | { |
| 90 | return MACHINE_CONFIG_NAME( ezcgi9958 ); |
| 91 | } |
| 92 | |
| 93 | //************************************************************************** |
| 94 | // LIVE DEVICE |
| 95 | //************************************************************************** |
| 96 | |
| 97 | a2bus_ezcgi_device::a2bus_ezcgi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 98 | device_t(mconfig, A2BUS_EZCGI, "E-Z Color Graphics Interface", tag, owner, clock, "a2ezcgi", __FILE__), |
| 99 | device_a2bus_card_interface(mconfig, *this), |
| 100 | m_tms(*this, TMS_TAG) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | a2bus_ezcgi_device::a2bus_ezcgi_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 105 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 106 | device_a2bus_card_interface(mconfig, *this), |
| 107 | m_tms(*this, TMS_TAG) |
| 108 | { |
| 109 | } |
| 110 | |
| 111 | a2bus_ezcgi_9938_device::a2bus_ezcgi_9938_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 112 | device_t(mconfig, A2BUS_EZCGI_9938, "E-Z Color Graphics Interface (TMS9938)", tag, owner, clock, "a2ezcgi3", __FILE__), |
| 113 | device_a2bus_card_interface(mconfig, *this), |
| 114 | m_tms(*this, TMS_TAG) |
| 115 | { |
| 116 | } |
| 117 | |
| 118 | a2bus_ezcgi_9938_device::a2bus_ezcgi_9938_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 119 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 120 | device_a2bus_card_interface(mconfig, *this), |
| 121 | m_tms(*this, TMS_TAG) |
| 122 | { |
| 123 | } |
| 124 | |
| 125 | a2bus_ezcgi_9958_device::a2bus_ezcgi_9958_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 126 | device_t(mconfig, A2BUS_EZCGI_9958, "E-Z Color Graphics Interface (TMS9958)", tag, owner, clock, "a2ezcgi5", __FILE__), |
| 127 | device_a2bus_card_interface(mconfig, *this), |
| 128 | m_tms(*this, TMS_TAG) |
| 129 | { |
| 130 | } |
| 131 | |
| 132 | a2bus_ezcgi_9958_device::a2bus_ezcgi_9958_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 133 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 134 | device_a2bus_card_interface(mconfig, *this), |
| 135 | m_tms(*this, TMS_TAG) |
| 136 | { |
| 137 | } |
| 138 | |
| 139 | //------------------------------------------------- |
| 140 | // device_start - device-specific startup |
| 141 | //------------------------------------------------- |
| 142 | |
| 143 | void a2bus_ezcgi_device::device_start() |
| 144 | { |
| 145 | // set_a2bus_device makes m_slot valid |
| 146 | set_a2bus_device(); |
| 147 | } |
| 148 | |
| 149 | void a2bus_ezcgi_device::device_reset() |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | void a2bus_ezcgi_9938_device::device_start() |
| 154 | { |
| 155 | // set_a2bus_device makes m_slot valid |
| 156 | set_a2bus_device(); |
| 157 | } |
| 158 | |
| 159 | void a2bus_ezcgi_9938_device::device_reset() |
| 160 | { |
| 161 | } |
| 162 | |
| 163 | void a2bus_ezcgi_9958_device::device_start() |
| 164 | { |
| 165 | // set_a2bus_device makes m_slot valid |
| 166 | set_a2bus_device(); |
| 167 | } |
| 168 | |
| 169 | void a2bus_ezcgi_9958_device::device_reset() |
| 170 | { |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | C0nx map: |
| 175 | 0 - TMS read |
| 176 | 1 - TMS write |
| 177 | */ |
| 178 | |
| 179 | UINT8 a2bus_ezcgi_device::read_c0nx(address_space &space, UINT8 offset) |
| 180 | { |
| 181 | switch (offset) |
| 182 | { |
| 183 | case 0: |
| 184 | return m_tms->vram_read(space, 0); |
| 185 | |
| 186 | case 1: |
| 187 | return m_tms->register_read(space, 0); |
| 188 | } |
| 189 | |
| 190 | return 0xff; |
| 191 | } |
| 192 | |
| 193 | void a2bus_ezcgi_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 194 | { |
| 195 | switch (offset) |
| 196 | { |
| 197 | case 0: |
| 198 | m_tms->vram_write(space, 0, data); |
| 199 | break; |
| 200 | |
| 201 | case 1: |
| 202 | m_tms->register_write(space, 0, data); |
| 203 | break; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | UINT8 a2bus_ezcgi_9938_device::read_c0nx(address_space &space, UINT8 offset) |
| 208 | { |
| 209 | switch (offset) |
| 210 | { |
| 211 | case 0: |
| 212 | return m_tms->vram_r(); |
| 213 | |
| 214 | case 1: |
| 215 | return m_tms->status_r(); |
| 216 | } |
| 217 | |
| 218 | return 0xff; |
| 219 | } |
| 220 | |
| 221 | void a2bus_ezcgi_9938_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 222 | { |
| 223 | switch (offset) |
| 224 | { |
| 225 | case 0: |
| 226 | m_tms->vram_w(data); |
| 227 | break; |
| 228 | |
| 229 | case 1: |
| 230 | m_tms->command_w(data); |
| 231 | break; |
| 232 | |
| 233 | case 2: |
| 234 | m_tms->palette_w(data); |
| 235 | break; |
| 236 | |
| 237 | case 3: |
| 238 | m_tms->register_w(data); |
| 239 | break; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | UINT8 a2bus_ezcgi_9958_device::read_c0nx(address_space &space, UINT8 offset) |
| 244 | { |
| 245 | switch (offset) |
| 246 | { |
| 247 | case 0: |
| 248 | return m_tms->vram_r(); |
| 249 | |
| 250 | case 1: |
| 251 | return m_tms->status_r(); |
| 252 | } |
| 253 | |
| 254 | return 0xff; |
| 255 | } |
| 256 | |
| 257 | void a2bus_ezcgi_9958_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 258 | { |
| 259 | switch (offset) |
| 260 | { |
| 261 | case 0: |
| 262 | m_tms->vram_w(data); |
| 263 | break; |
| 264 | |
| 265 | case 1: |
| 266 | m_tms->command_w(data); |
| 267 | break; |
| 268 | |
| 269 | case 2: |
| 270 | m_tms->palette_w(data); |
| 271 | break; |
| 272 | |
| 273 | case 3: |
| 274 | m_tms->register_w(data); |
| 275 | break; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | WRITE_LINE_MEMBER( a2bus_ezcgi_device::tms_irq_w ) |
| 280 | { |
| 281 | if (state) |
| 282 | { |
| 283 | raise_slot_irq(); |
| 284 | } |
| 285 | else |
| 286 | { |
| 287 | lower_slot_irq(); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | WRITE_LINE_MEMBER( a2bus_ezcgi_9938_device::tms_irq_w ) |
| 292 | { |
| 293 | if (state) |
| 294 | { |
| 295 | raise_slot_irq(); |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | lower_slot_irq(); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | WRITE_LINE_MEMBER( a2bus_ezcgi_9958_device::tms_irq_w ) |
| 304 | { |
| 305 | if (state) |
| 306 | { |
| 307 | raise_slot_irq(); |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | lower_slot_irq(); |
| 312 | } |
| 313 | } |
| 314 | |
trunk/src/emu/bus/a2bus/ezcgi.h
| r0 | r244644 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | ezcgi.h |
| 4 | |
| 5 | "E-Z Color Graphics Interface" by Steve Ciarcia |
| 6 | from BYTE Magazine, August, 1982 |
| 7 | https://archive.org/details/byte-magazine-1982-08-rescan |
| 8 | |
| 9 | *********************************************************************/ |
| 10 | |
| 11 | #ifndef __A2BUS_EZCGI__ |
| 12 | #define __A2BUS_EZCGI__ |
| 13 | |
| 14 | #include "emu.h" |
| 15 | #include "a2bus.h" |
| 16 | #include "video/tms9928a.h" |
| 17 | #include "video/v9938.h" |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // TYPE DEFINITIONS |
| 21 | //************************************************************************** |
| 22 | |
| 23 | class a2bus_ezcgi_device: |
| 24 | public device_t, |
| 25 | public device_a2bus_card_interface |
| 26 | { |
| 27 | public: |
| 28 | // construction/destruction |
| 29 | a2bus_ezcgi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 30 | a2bus_ezcgi_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 31 | |
| 32 | // optional information overrides |
| 33 | virtual machine_config_constructor device_mconfig_additions() const; |
| 34 | |
| 35 | DECLARE_WRITE_LINE_MEMBER( tms_irq_w ); |
| 36 | |
| 37 | protected: |
| 38 | virtual void device_start(); |
| 39 | virtual void device_reset(); |
| 40 | |
| 41 | // overrides of standard a2bus slot functions |
| 42 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 43 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 44 | |
| 45 | required_device<tms9918a_device> m_tms; |
| 46 | |
| 47 | private: |
| 48 | }; |
| 49 | |
| 50 | class a2bus_ezcgi_9938_device: |
| 51 | public device_t, |
| 52 | public device_a2bus_card_interface |
| 53 | { |
| 54 | public: |
| 55 | // construction/destruction |
| 56 | a2bus_ezcgi_9938_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 57 | a2bus_ezcgi_9938_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 58 | |
| 59 | // optional information overrides |
| 60 | virtual machine_config_constructor device_mconfig_additions() const; |
| 61 | |
| 62 | DECLARE_WRITE_LINE_MEMBER( tms_irq_w ); |
| 63 | |
| 64 | protected: |
| 65 | virtual void device_start(); |
| 66 | virtual void device_reset(); |
| 67 | |
| 68 | // overrides of standard a2bus slot functions |
| 69 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 70 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 71 | |
| 72 | required_device<v9938_device> m_tms; |
| 73 | |
| 74 | private: |
| 75 | }; |
| 76 | |
| 77 | class a2bus_ezcgi_9958_device: |
| 78 | public device_t, |
| 79 | public device_a2bus_card_interface |
| 80 | { |
| 81 | public: |
| 82 | // construction/destruction |
| 83 | a2bus_ezcgi_9958_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 84 | a2bus_ezcgi_9958_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 85 | |
| 86 | // optional information overrides |
| 87 | virtual machine_config_constructor device_mconfig_additions() const; |
| 88 | |
| 89 | DECLARE_WRITE_LINE_MEMBER( tms_irq_w ); |
| 90 | |
| 91 | protected: |
| 92 | virtual void device_start(); |
| 93 | virtual void device_reset(); |
| 94 | |
| 95 | // overrides of standard a2bus slot functions |
| 96 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 97 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 98 | |
| 99 | required_device<v9958_device> m_tms; |
| 100 | |
| 101 | private: |
| 102 | }; |
| 103 | |
| 104 | // device type definition |
| 105 | extern const device_type A2BUS_EZCGI; |
| 106 | extern const device_type A2BUS_EZCGI_9938; |
| 107 | extern const device_type A2BUS_EZCGI_9958; |
| 108 | |
| 109 | #endif /* __A2BUS_EZCGI__ */ |