trunk/src/mess/drivers/coco3.c
| r28714 | r28715 | |
| 235 | 235 | MAINCPU_TAG, |
| 236 | 236 | RAM_TAG, |
| 237 | 237 | CARTRIDGE_TAG, |
| 238 | | |
| 239 | | DEVCB_DEVICE_LINE_MEMBER(PIA0_TAG, pia6821_device, ca1_w), /* horizontal sync */ |
| 240 | | DEVCB_DEVICE_LINE_MEMBER(PIA0_TAG, pia6821_device, cb1_w), /* field sync */ |
| 241 | | DEVCB_DRIVER_LINE_MEMBER(coco3_state, gime_irq_w), |
| 242 | | DEVCB_DRIVER_LINE_MEMBER(coco3_state, gime_firq_w), |
| 243 | | DEVCB_DRIVER_MEMBER(coco_state, floating_bus_read) |
| 244 | 238 | }; |
| 245 | 239 | |
| 246 | 240 | static MACHINE_CONFIG_START( coco3, coco3_state ) |
| r28714 | r28715 | |
| 274 | 268 | MCFG_COCO_VHD_ADD(VHD1_TAG) |
| 275 | 269 | |
| 276 | 270 | // video hardware |
| 271 | MCFG_DEFAULT_LAYOUT(layout_coco3) |
| 272 | |
| 277 | 273 | MCFG_DEVICE_ADD(GIME_TAG, GIME_NTSC, XTAL_3_579545MHz) |
| 278 | 274 | MCFG_DEVICE_CONFIG(coco_gime_config) |
| 279 | | MCFG_DEFAULT_LAYOUT(layout_coco3) |
| 275 | MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) // TODO not hooked up in gime.c |
| 276 | MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) // TODO not hooked up in gime.c |
| 277 | MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w)) |
| 278 | MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w)) |
| 279 | MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read)) |
| 280 | 280 | |
| 281 | 281 | // composite monitor |
| 282 | 282 | MCFG_SCREEN_ADD(COMPOSITE_SCREEN_TAG, RASTER) |
trunk/src/mess/video/gime.c
| r28714 | r28715 | |
| 107 | 107 | //------------------------------------------------- |
| 108 | 108 | |
| 109 | 109 | gime_base_device::gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source) |
| 110 | | : mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source) |
| 110 | : mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source), |
| 111 | m_write_hsync(*this), |
| 112 | m_write_fsync(*this), |
| 113 | m_write_irq(*this), |
| 114 | m_write_firq(*this), |
| 115 | m_read_floating_bus(*this) |
| 111 | 116 | { |
| 112 | 117 | } |
| 113 | 118 | |
| r28714 | r28715 | |
| 162 | 167 | } |
| 163 | 168 | |
| 164 | 169 | // resolve callbacks |
| 165 | | m_res_out_hsync_func.resolve(config->m_out_hsync_func, *this); |
| 166 | | m_res_out_fsync_func.resolve(config->m_out_fsync_func, *this); |
| 167 | | m_res_out_irq_func.resolve(config->m_out_irq_func, *this); |
| 168 | | m_res_out_firq_func.resolve(config->m_out_firq_func, *this); |
| 169 | | m_res_in_floating_bus_func.resolve(config->m_in_floating_bus_func, *this); |
| 170 | m_write_hsync.resolve_safe(); |
| 171 | m_write_fsync.resolve_safe(); |
| 172 | m_write_irq.resolve_safe(); |
| 173 | m_write_firq.resolve_safe(); |
| 174 | m_read_floating_bus.resolve_safe(0); |
| 170 | 175 | |
| 171 | 176 | // set up ROM/RAM pointers |
| 172 | 177 | m_rom = machine().root_device().memregion(config->m_maincpu_tag)->base(); |
| r28714 | r28715 | |
| 756 | 761 | |
| 757 | 762 | ATTR_FORCE_INLINE UINT8 gime_base_device::read_floating_bus(void) |
| 758 | 763 | { |
| 759 | | return m_res_in_floating_bus_func.isnull() |
| 760 | | ? 0 |
| 761 | | : m_res_in_floating_bus_func(0); |
| 764 | return m_read_floating_bus(0); |
| 762 | 765 | } |
| 763 | 766 | |
| 764 | 767 | |
| r28714 | r28715 | |
| 1096 | 1099 | |
| 1097 | 1100 | void gime_base_device::recalculate_irq(void) |
| 1098 | 1101 | { |
| 1099 | | if (!m_res_out_irq_func.isnull()) |
| 1100 | | m_res_out_irq_func(irq_r()); |
| 1102 | m_write_irq(irq_r()); |
| 1101 | 1103 | } |
| 1102 | 1104 | |
| 1103 | 1105 | |
| r28714 | r28715 | |
| 1108 | 1110 | |
| 1109 | 1111 | void gime_base_device::recalculate_firq(void) |
| 1110 | 1112 | { |
| 1111 | | if (!m_res_out_firq_func.isnull()) |
| 1112 | | m_res_out_firq_func(firq_r()); |
| 1113 | m_write_firq(firq_r()); |
| 1113 | 1114 | } |
| 1114 | 1115 | |
| 1115 | 1116 | |
trunk/src/mess/video/gime.h
| r28714 | r28715 | |
| 21 | 21 | // GIME CONFIG/INTERFACE |
| 22 | 22 | //************************************************************************** |
| 23 | 23 | |
| 24 | #define MCFG_GIME_HSYNC_CALLBACK(_write) \ |
| 25 | devcb = &gime_base_device::set_hsync_wr_callback(*device, DEVCB2_##_write); |
| 26 | |
| 27 | #define MCFG_GIME_FSYNC_CALLBACK(_write) \ |
| 28 | devcb = &gime_base_device::set_fsync_wr_callback(*device, DEVCB2_##_write); |
| 29 | |
| 30 | #define MCFG_GIME_IRQ_CALLBACK(_write) \ |
| 31 | devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB2_##_write); |
| 32 | |
| 33 | #define MCFG_GIME_FIRQ_CALLBACK(_write) \ |
| 34 | devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB2_##_write); |
| 35 | |
| 36 | #define MCFG_GIME_FLOATING_BUS_CALLBACK(_read) \ |
| 37 | devcb = &gime_base_device::set_floating_bus_rd_callback(*device, DEVCB2_##_read); |
| 38 | |
| 24 | 39 | /* interface */ |
| 25 | 40 | struct gime_interface |
| 26 | 41 | { |
| r28714 | r28715 | |
| 28 | 43 | const char *m_maincpu_tag; /* tag of main CPU */ |
| 29 | 44 | const char *m_ram_tag; /* tag of RAM device */ |
| 30 | 45 | const char *m_ext_tag; /* tag of expansion device */ |
| 31 | | |
| 32 | | /* if specified, this gets called for every change of the HSYNC pin */ |
| 33 | | devcb_write_line m_out_hsync_func; |
| 34 | | |
| 35 | | /* if specified, this gets called for every change of the FSYNC pin */ |
| 36 | | devcb_write_line m_out_fsync_func; |
| 37 | | |
| 38 | | /* if specified, this gets called for every change of the IRQ pin */ |
| 39 | | devcb_write_line m_out_irq_func; |
| 40 | | |
| 41 | | /* if specified, this gets called for every change of the FIRQ pin */ |
| 42 | | devcb_write_line m_out_firq_func; |
| 43 | | |
| 44 | | /* if specified, this reads from the floating bus */ |
| 45 | | devcb_read8 m_in_floating_bus_func; |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | |
| r28714 | r28715 | |
| 56 | 56 | class gime_base_device : public mc6847_friend_device, public sam6883_friend_device |
| 57 | 57 | { |
| 58 | 58 | public: |
| 59 | template<class _Object> static devcb2_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_hsync.set_callback(object); } |
| 60 | template<class _Object> static devcb2_base &set_fsync_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_fsync.set_callback(object); } |
| 61 | template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_irq.set_callback(object); } |
| 62 | template<class _Object> static devcb2_base &set_firq_wr_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_write_firq.set_callback(object); } |
| 63 | template<class _Object> static devcb2_base &set_floating_bus_rd_callback(device_t &device, _Object object) { return downcast<gime_base_device &>(device).m_read_floating_bus.set_callback(object); } |
| 64 | |
| 59 | 65 | // read/write |
| 60 | 66 | DECLARE_READ8_MEMBER( read ) { return read(offset); } |
| 61 | 67 | DECLARE_WRITE8_MEMBER( write ) { write(offset, data); } |
| r28714 | r28715 | |
| 156 | 162 | static const UINT8 hires_font[128][12]; |
| 157 | 163 | |
| 158 | 164 | // callbacks |
| 159 | | devcb_resolved_write_line m_res_out_irq_func; |
| 160 | | devcb_resolved_write_line m_res_out_firq_func; |
| 161 | | devcb_resolved_read8 m_res_in_floating_bus_func; |
| 165 | devcb2_write_line m_write_hsync; |
| 166 | devcb2_write_line m_write_fsync; |
| 167 | devcb2_write_line m_write_irq; |
| 168 | devcb2_write_line m_write_firq; |
| 169 | devcb2_read8 m_read_floating_bus; |
| 162 | 170 | |
| 163 | 171 | // device state |
| 164 | 172 | UINT8 m_gime_registers[16]; |