trunk/src/emu/video/mb_vcu.c
| r29491 | r29492 | |
| 156 | 156 | device_video_interface(mconfig, *this), |
| 157 | 157 | m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)), |
| 158 | 158 | m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_pal_ram)), |
| 159 | m_cpu(*this), |
| 159 | 160 | m_palette(*this) |
| 160 | 161 | { |
| 161 | 162 | } |
| 162 | 163 | |
| 163 | 164 | //------------------------------------------------- |
| 164 | | // device_config_complete - perform any |
| 165 | | // operations now that the configuration is |
| 166 | | // complete |
| 167 | | //------------------------------------------------- |
| 168 | | |
| 169 | | void mb_vcu_device::device_config_complete() |
| 170 | | { |
| 171 | | // inherit a copy of the static data |
| 172 | | const mb_vcu_interface *intf = reinterpret_cast<const mb_vcu_interface *>(static_config()); |
| 173 | | if (intf != NULL) |
| 174 | | { |
| 175 | | *static_cast<mb_vcu_interface *>(this) = *intf; |
| 176 | | } |
| 177 | | |
| 178 | | // or initialize to defaults if none provided |
| 179 | | else |
| 180 | | { |
| 181 | | m_cpu_tag = NULL; |
| 182 | | //m_screen_tag = NULL; |
| 183 | | } |
| 184 | | } |
| 185 | | |
| 186 | | //------------------------------------------------- |
| 187 | 165 | // device_validity_check - perform validity checks |
| 188 | 166 | // on this device |
| 189 | 167 | //------------------------------------------------- |
| r29491 | r29492 | |
| 200 | 178 | void mb_vcu_device::device_start() |
| 201 | 179 | { |
| 202 | 180 | // TODO: m_screen_tag |
| 203 | | m_cpu = machine().device<cpu_device>(m_cpu_tag); |
| 204 | 181 | m_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); |
| 205 | 182 | m_palram = auto_alloc_array_clear(machine(), UINT8, 0x100); |
| 206 | 183 | |
trunk/src/emu/video/mb_vcu.h
| r29491 | r29492 | |
| 1 | 1 | // license: ? |
| 2 | 2 | // copyright-holders: Angelo Salese |
| 3 | | /*************************************************************************** |
| 4 | | |
| 5 | | Template for skeleton device |
| 6 | | |
| 7 | | ***************************************************************************/ |
| 8 | | |
| 9 | 3 | #pragma once |
| 10 | 4 | |
| 11 | 5 | #ifndef __MB_VCUDEV_H__ |
| 12 | 6 | #define __MB_VCUDEV_H__ |
| 13 | 7 | |
| 14 | 8 | |
| 15 | | |
| 16 | 9 | //************************************************************************** |
| 17 | | // INTERFACE CONFIGURATION MACROS |
| 18 | | //************************************************************************** |
| 19 | | |
| 20 | | #define MCFG_MB_VCU_ADD(_tag,_freq,_config, _palette_tag) \ |
| 21 | | MCFG_DEVICE_ADD(_tag, MB_VCU, _freq) \ |
| 22 | | MCFG_DEVICE_CONFIG(_config) \ |
| 23 | | mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag); |
| 24 | | |
| 25 | | //************************************************************************** |
| 26 | 10 | // TYPE DEFINITIONS |
| 27 | 11 | //************************************************************************** |
| 28 | 12 | |
| 29 | | // ======================> mb_vcu_interface |
| 30 | | |
| 31 | | struct mb_vcu_interface |
| 32 | | { |
| 33 | | const char *m_cpu_tag; |
| 34 | | }; |
| 35 | | |
| 36 | 13 | // ======================> mb_vcu_device |
| 37 | 14 | |
| 38 | 15 | class mb_vcu_device : public device_t, |
| 39 | 16 | public device_memory_interface, |
| 40 | | public device_video_interface, |
| 41 | | public mb_vcu_interface |
| 17 | public device_video_interface |
| 42 | 18 | { |
| 43 | 19 | public: |
| 44 | 20 | // construction/destruction |
| r29491 | r29492 | |
| 46 | 22 | |
| 47 | 23 | // static configuration |
| 48 | 24 | static void static_set_palette_tag(device_t &device, const char *tag); |
| 25 | static void set_cpu_tag(device_t &device, const char *tag) { downcast<mb_vcu_device &>(device).m_cpu.set_tag(tag); } |
| 49 | 26 | |
| 50 | 27 | // I/O operations |
| 51 | 28 | DECLARE_WRITE8_MEMBER( write_vregs ); |
| r29491 | r29492 | |
| 65 | 42 | |
| 66 | 43 | protected: |
| 67 | 44 | // device-level overrides |
| 68 | | virtual void device_config_complete(); |
| 69 | 45 | virtual void device_validity_check(validity_checker &valid) const; |
| 70 | 46 | virtual void device_start(); |
| 71 | 47 | virtual void device_reset(); |
| r29491 | r29492 | |
| 81 | 57 | UINT8 m_status; |
| 82 | 58 | UINT8 *m_ram; |
| 83 | 59 | UINT8 *m_palram; |
| 84 | | cpu_device *m_cpu; |
| 85 | 60 | UINT16 m_param_offset_latch; |
| 86 | 61 | |
| 87 | 62 | INT16 m_xpos, m_ypos; |
| r29491 | r29492 | |
| 95 | 70 | double m_weights_r[2]; |
| 96 | 71 | double m_weights_g[3]; |
| 97 | 72 | double m_weights_b[3]; |
| 73 | required_device<cpu_device> m_cpu; |
| 98 | 74 | required_device<palette_device> m_palette; |
| 99 | 75 | }; |
| 100 | 76 | |
| r29491 | r29492 | |
| 103 | 79 | extern const device_type MB_VCU; |
| 104 | 80 | |
| 105 | 81 | |
| 106 | | |
| 107 | 82 | //************************************************************************** |
| 108 | | // GLOBAL VARIABLES |
| 83 | // INTERFACE CONFIGURATION MACROS |
| 109 | 84 | //************************************************************************** |
| 110 | 85 | |
| 86 | #define MCFG_MB_VCU_CPU(_tag) \ |
| 87 | mb_vcu_device::set_cpu_tag(*device, "^"_tag); |
| 111 | 88 | |
| 89 | #define MCFG_MB_VCU_PALETTE(_palette_tag) \ |
| 90 | mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag); |
| 112 | 91 | |
| 113 | 92 | #endif |
trunk/src/mame/drivers/mazerbla.c
| r29491 | r29492 | |
| 1466 | 1466 | m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(mazerbla_state::irq_callback),this)); |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | | static const mb_vcu_interface vcu_interface = |
| 1470 | | { |
| 1471 | | "sub2" |
| 1472 | | }; |
| 1473 | | |
| 1474 | 1469 | static MACHINE_CONFIG_START( mazerbla, mazerbla_state ) |
| 1475 | 1470 | |
| 1476 | 1471 | /* basic machine hardware */ |
| r29491 | r29492 | |
| 1493 | 1488 | MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold) |
| 1494 | 1489 | |
| 1495 | 1490 | /* synchronization forced on the fly */ |
| 1496 | | MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface,"palette") |
| 1491 | MCFG_DEVICE_ADD("vcu", MB_VCU, SOUND_CLOCK/4) |
| 1492 | MCFG_MB_VCU_CPU("sub2") |
| 1493 | MCFG_MB_VCU_PALETTE("palette") |
| 1497 | 1494 | |
| 1498 | 1495 | /* video hardware */ |
| 1499 | 1496 | MCFG_SCREEN_ADD("screen", RASTER) |
| r29491 | r29492 | |
| 1530 | 1527 | */ |
| 1531 | 1528 | MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold) |
| 1532 | 1529 | |
| 1533 | | MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface,"palette") |
| 1530 | MCFG_DEVICE_ADD("vcu", MB_VCU, SOUND_CLOCK/4) |
| 1531 | MCFG_MB_VCU_CPU("sub2") |
| 1532 | MCFG_MB_VCU_PALETTE("palette") |
| 1534 | 1533 | |
| 1535 | 1534 | /* video hardware */ |
| 1536 | 1535 | MCFG_SCREEN_ADD("screen", RASTER) |