trunk/src/mame/drivers/dassault.c
| r24069 | r24070 | |
| 134 | 134 | #include "sound/2203intf.h" |
| 135 | 135 | #include "sound/2151intf.h" |
| 136 | 136 | #include "sound/okim6295.h" |
| 137 | | #include "video/decocomn.h" |
| 138 | 137 | |
| 139 | 138 | /**********************************************************************************/ |
| 140 | 139 | |
| r24069 | r24070 | |
| 216 | 215 | static ADDRESS_MAP_START( dassault_map, AS_PROGRAM, 16, dassault_state ) |
| 217 | 216 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 218 | 217 | |
| 219 | | AM_RANGE(0x100000, 0x103fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 218 | AM_RANGE(0x100000, 0x103fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 220 | 219 | |
| 221 | 220 | AM_RANGE(0x140004, 0x140007) AM_WRITENOP /* ? */ |
| 222 | 221 | AM_RANGE(0x180000, 0x180001) AM_WRITE(dassault_sound_w) |
| 223 | 222 | |
| 224 | 223 | AM_RANGE(0x1c0000, 0x1c000f) AM_READ(dassault_control_r) |
| 225 | | AM_RANGE(0x1c000a, 0x1c000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 224 | AM_RANGE(0x1c000a, 0x1c000b) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 226 | 225 | AM_RANGE(0x1c000c, 0x1c000d) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) |
| 227 | 226 | AM_RANGE(0x1c000e, 0x1c000f) AM_WRITE(dassault_control_w) |
| 228 | 227 | |
trunk/src/mame/drivers/boogwing.c
| r24069 | r24070 | |
| 86 | 86 | #include "includes/decoprot.h" |
| 87 | 87 | #include "sound/2151intf.h" |
| 88 | 88 | #include "sound/okim6295.h" |
| 89 | | #include "video/decocomn.h" |
| 90 | 89 | |
| 91 | 90 | |
| 92 | 91 | static ADDRESS_MAP_START( boogwing_map, AS_PROGRAM, 16, boogwing_state ) |
| 93 | 92 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 94 | 93 | AM_RANGE(0x200000, 0x20ffff) AM_RAM |
| 95 | 94 | |
| 96 | | AM_RANGE(0x220000, 0x220001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 95 | AM_RANGE(0x220000, 0x220001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 97 | 96 | AM_RANGE(0x220002, 0x22000f) AM_NOP |
| 98 | 97 | |
| 99 | 98 | AM_RANGE(0x240000, 0x240001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) |
| r24069 | r24070 | |
| 120 | 119 | |
| 121 | 120 | AM_RANGE(0x280000, 0x28000f) AM_NOP // ? |
| 122 | 121 | AM_RANGE(0x282000, 0x282001) AM_NOP // Palette setup? |
| 123 | | AM_RANGE(0x282008, 0x282009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) |
| 124 | | AM_RANGE(0x284000, 0x285fff) AM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram") |
| 122 | AM_RANGE(0x282008, 0x282009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) |
| 123 | AM_RANGE(0x284000, 0x285fff) AM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram") |
| 125 | 124 | |
| 126 | 125 | AM_RANGE(0x3c0000, 0x3c004f) AM_RAM // ? |
| 127 | 126 | ADDRESS_MAP_END |
trunk/src/mame/drivers/cninja.c
| r24069 | r24070 | |
| 50 | 50 | #include "sound/2203intf.h" |
| 51 | 51 | #include "sound/2151intf.h" |
| 52 | 52 | #include "sound/okim6295.h" |
| 53 | | #include "video/decocomn.h" |
| 54 | 53 | |
| 55 | 54 | WRITE16_MEMBER(cninja_state::cninja_sound_w) |
| 56 | 55 | { |
| r24069 | r24070 | |
| 175 | 174 | |
| 176 | 175 | AM_RANGE(0x184000, 0x187fff) AM_RAM AM_SHARE("ram") |
| 177 | 176 | AM_RANGE(0x190000, 0x190007) AM_READWRITE(cninja_irq_r, cninja_irq_w) |
| 178 | | AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 177 | AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 179 | 178 | |
| 180 | 179 | AM_RANGE(0x1a4000, 0x1a47ff) AM_RAM AM_SHARE("spriteram") /* Sprites */ |
| 181 | 180 | AM_RANGE(0x1b4000, 0x1b4001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */ |
| r24069 | r24070 | |
| 210 | 209 | AM_RANGE(0x180000, 0x187fff) AM_RAM // more ram on bootleg? |
| 211 | 210 | |
| 212 | 211 | AM_RANGE(0x190000, 0x190007) AM_READWRITE(cninja_irq_r, cninja_irq_w) |
| 213 | | AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 212 | AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 214 | 213 | |
| 215 | 214 | AM_RANGE(0x1b4000, 0x1b4001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */ |
| 216 | 215 | ADDRESS_MAP_END |
| r24069 | r24070 | |
| 230 | 229 | AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_SHARE("pf3_rowscroll") |
| 231 | 230 | AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_SHARE("pf4_rowscroll") |
| 232 | 231 | |
| 233 | | AM_RANGE(0x188000, 0x189fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 232 | AM_RANGE(0x188000, 0x189fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 234 | 233 | AM_RANGE(0x194000, 0x197fff) AM_RAM AM_SHARE("ram") /* Main ram */ |
| 235 | 234 | AM_RANGE(0x198000, 0x1987ff) AM_READWRITE_LEGACY(deco16_60_prot_r, deco16_60_prot_w) AM_SHARE("prot16ram") /* Protection device */ |
| 236 | 235 | AM_RANGE(0x199550, 0x199551) AM_WRITENOP /* Looks like a bug in game code, a protection write is referenced off a5 instead of a6 and ends up here */ |
| r24069 | r24070 | |
| 263 | 262 | AM_RANGE(0x18c000, 0x18c7ff) AM_READ(robocop2_prot_r) /* Protection device */ |
| 264 | 263 | AM_RANGE(0x18c064, 0x18c065) AM_WRITE(cninja_sound_w) |
| 265 | 264 | AM_RANGE(0x198000, 0x198001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */ |
| 266 | | AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 265 | AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 267 | 266 | AM_RANGE(0x1b0000, 0x1b0007) AM_READWRITE(cninja_irq_r, cninja_irq_w) |
| 268 | 267 | AM_RANGE(0x1b8000, 0x1bbfff) AM_RAM AM_SHARE("ram") /* Main ram */ |
| 269 | | AM_RANGE(0x1f0000, 0x1f0001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 268 | AM_RANGE(0x1f0000, 0x1f0001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 270 | 269 | AM_RANGE(0x1f8000, 0x1f8001) AM_READ_PORT("DSW3") /* Dipswitch #3 */ |
| 271 | 270 | ADDRESS_MAP_END |
| 272 | 271 | |
| r24069 | r24070 | |
| 275 | 274 | AM_RANGE(0x100000, 0x103fff) AM_RAM |
| 276 | 275 | AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram") |
| 277 | 276 | AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_SHARE("spriteram2") |
| 278 | | AM_RANGE(0x160000, 0x161fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram") |
| 279 | | AM_RANGE(0x180000, 0x180001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 277 | AM_RANGE(0x160000, 0x161fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram") |
| 278 | AM_RANGE(0x180000, 0x180001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 280 | 279 | AM_RANGE(0x180002, 0x180003) AM_WRITENOP /* VBL irq ack */ |
| 281 | 280 | AM_RANGE(0x1a0000, 0x1a07ff) AM_READWRITE_LEGACY(deco16_66_prot_r, deco16_66_prot_w) AM_SHARE("prot16ram") /* Protection device */ |
| 282 | | AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) AM_DEVREAD_LEGACY("deco_common", decocomn_71_r) |
| 281 | AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) AM_DEVREAD("deco_common", decocomn_device, d_71_r) |
| 283 | 282 | AM_RANGE(0x1e0000, 0x1e0001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) |
| 284 | 283 | |
| 285 | 284 | AM_RANGE(0x300000, 0x30000f) AM_WRITE(cninja_pf12_control_w) |
trunk/src/mame/drivers/rohga.c
| r24069 | r24070 | |
| 112 | 112 | #include "includes/rohga.h" |
| 113 | 113 | #include "sound/2151intf.h" |
| 114 | 114 | #include "sound/okim6295.h" |
| 115 | | #include "video/decocomn.h" |
| 116 | 115 | |
| 117 | 116 | READ16_MEMBER(rohga_state::rohga_irq_ack_r) |
| 118 | 117 | { |
| r24069 | r24070 | |
| 142 | 141 | |
| 143 | 142 | AM_RANGE(0x300000, 0x300001) AM_WRITE(rohga_buffer_spriteram16_w) /* write 1 for sprite dma */ |
| 144 | 143 | AM_RANGE(0x310000, 0x310009) AM_WRITENOP /* Palette control? */ |
| 145 | | AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) /* Write 1111 for dma? (Or any value?) */ |
| 144 | AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) /* Write 1111 for dma? (Or any value?) */ |
| 146 | 145 | AM_RANGE(0x320000, 0x320001) AM_WRITENOP /* ? */ |
| 147 | | AM_RANGE(0x322000, 0x322001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 146 | AM_RANGE(0x322000, 0x322001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 148 | 147 | AM_RANGE(0x321100, 0x321101) AM_READ(rohga_irq_ack_r) /* Irq ack? Value not used */ |
| 149 | 148 | |
| 150 | 149 | AM_RANGE(0x3c0000, 0x3c1fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_r, pf1_data_w) |
| r24069 | r24070 | |
| 158 | 157 | AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("pf4_rowscroll") |
| 159 | 158 | |
| 160 | 159 | AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_SHARE("spriteram") |
| 161 | | AM_RANGE(0x3e0000, 0x3e1fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram") |
| 160 | AM_RANGE(0x3e0000, 0x3e1fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram") |
| 162 | 161 | AM_RANGE(0x3f0000, 0x3f3fff) AM_RAM /* Main ram */ |
| 163 | 162 | ADDRESS_MAP_END |
| 164 | 163 | |
| r24069 | r24070 | |
| 177 | 176 | AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("tilegen1", deco16ic_device, pf_control_w) |
| 178 | 177 | AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("tilegen2", deco16ic_device, pf_control_w) |
| 179 | 178 | |
| 180 | | AM_RANGE(0x320000, 0x320001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) /* Priority */ |
| 179 | AM_RANGE(0x320000, 0x320001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) /* Priority */ |
| 181 | 180 | AM_RANGE(0x320002, 0x320003) AM_WRITENOP /* ? */ |
| 182 | 181 | AM_RANGE(0x320004, 0x320005) AM_WRITE(wizdfire_irq_ack_w) /* VBL IRQ ack */ |
| 183 | 182 | |
| r24069 | r24070 | |
| 186 | 185 | AM_RANGE(0x360000, 0x3607ff) AM_RAM AM_SHARE("spriteram2") |
| 187 | 186 | AM_RANGE(0x370000, 0x370001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* Triggers DMA for spriteram */ |
| 188 | 187 | |
| 189 | | AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram") |
| 190 | | AM_RANGE(0x390008, 0x390009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) |
| 188 | AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram") |
| 189 | AM_RANGE(0x390008, 0x390009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) |
| 191 | 190 | |
| 192 | 191 | AM_RANGE(0xfe4000, 0xfe47ff) AM_READWRITE_LEGACY(deco16_104_prot_r,deco16_104_prot_w) AM_SHARE("prot16ram") /* Protection device */ |
| 193 | 192 | AM_RANGE(0xfdc000, 0xffffff) AM_RAM |
| r24069 | r24070 | |
| 209 | 208 | AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("tilegen1", deco16ic_device, pf_control_w) |
| 210 | 209 | AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("tilegen2", deco16ic_device, pf_control_w) |
| 211 | 210 | |
| 212 | | AM_RANGE(0x320000, 0x320001) AM_READ_PORT("DSW3") AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) /* Priority */ |
| 211 | AM_RANGE(0x320000, 0x320001) AM_READ_PORT("DSW3") AM_DEVWRITE("deco_common", decocomn_device, priority_w) /* Priority */ |
| 213 | 212 | AM_RANGE(0x320002, 0x320003) AM_WRITENOP /* ? */ |
| 214 | 213 | AM_RANGE(0x320004, 0x320005) AM_WRITE(wizdfire_irq_ack_w) /* VBL IRQ ack */ |
| 215 | 214 | |
| r24069 | r24070 | |
| 218 | 217 | AM_RANGE(0x360000, 0x3607ff) AM_RAM AM_SHARE("spriteram2") |
| 219 | 218 | AM_RANGE(0x370000, 0x370001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* Triggers DMA for spriteram */ |
| 220 | 219 | |
| 221 | | AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram") |
| 222 | | AM_RANGE(0x390008, 0x390009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) |
| 220 | AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram") |
| 221 | AM_RANGE(0x390008, 0x390009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) |
| 223 | 222 | |
| 224 | 223 | AM_RANGE(0xfec000, 0xff3fff) AM_RAM |
| 225 | 224 | AM_RANGE(0xff4000, 0xff47ff) AM_MIRROR(0x800) AM_READWRITE_LEGACY(deco16_146_nitroball_prot_r,deco16_146_nitroball_prot_w) AM_SHARE("prot16ram") /* Protection device */ |
| r24069 | r24070 | |
| 236 | 235 | AM_RANGE(0x300000, 0x300001) AM_READ_PORT("DSW3") AM_WRITE(rohga_buffer_spriteram16_w) /* write 1 for sprite dma */ |
| 237 | 236 | AM_RANGE(0x310002, 0x310003) AM_READ_PORT("IN1") |
| 238 | 237 | AM_RANGE(0x310000, 0x310009) AM_WRITENOP /* Palette control? */ |
| 239 | | AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) /* Write 1111 for dma? (Or any value?) */ |
| 238 | AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) /* Write 1111 for dma? (Or any value?) */ |
| 240 | 239 | AM_RANGE(0x320000, 0x320001) AM_WRITENOP /* ? */ |
| 241 | | AM_RANGE(0x322000, 0x322001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) |
| 240 | AM_RANGE(0x322000, 0x322001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) |
| 242 | 241 | AM_RANGE(0x321100, 0x321101) AM_WRITE(wizdfire_irq_ack_w) /* Irq ack? Value not used */ |
| 243 | 242 | |
| 244 | 243 | AM_RANGE(0x3c0000, 0x3c1fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_r, pf1_data_w) |
| r24069 | r24070 | |
| 251 | 250 | AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("pf4_rowscroll") |
| 252 | 251 | |
| 253 | 252 | AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_SHARE("spriteram") |
| 254 | | AM_RANGE(0x3e0000, 0x3e1fff) AM_MIRROR(0x2000) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram") |
| 253 | AM_RANGE(0x3e0000, 0x3e1fff) AM_MIRROR(0x2000) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram") |
| 255 | 254 | AM_RANGE(0xff0000, 0xff7fff) AM_RAM /* Main ram */ |
| 256 | 255 | ADDRESS_MAP_END |
| 257 | 256 | |
trunk/src/mame/video/decocomn.c
| r24069 | r24070 | |
| 9 | 9 | #include "ui.h" |
| 10 | 10 | |
| 11 | 11 | |
| 12 | | struct decocomn_state |
| 12 | const device_type DECOCOMN = &device_creator<decocomn_device>; |
| 13 | |
| 14 | decocomn_device::decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 15 | : device_t(mconfig, DECOCOMN, "Data East Common Video Functions", tag, owner, clock, "decocomn", __FILE__), |
| 16 | m_screen(NULL), |
| 17 | m_dirty_palette(NULL), |
| 18 | m_priority(0) |
| 13 | 19 | { |
| 14 | | screen_device *screen; |
| 15 | | UINT8 *dirty_palette; |
| 16 | | UINT16 priority; |
| 17 | | }; |
| 20 | } |
| 18 | 21 | |
| 19 | | /***************************************************************************** |
| 20 | | INLINE FUNCTIONS |
| 21 | | *****************************************************************************/ |
| 22 | //------------------------------------------------- |
| 23 | // device_config_complete - perform any |
| 24 | // operations now that the configuration is |
| 25 | // complete |
| 26 | //------------------------------------------------- |
| 22 | 27 | |
| 23 | | INLINE decocomn_state *get_safe_token( device_t *device ) |
| 28 | void decocomn_device::device_config_complete() |
| 24 | 29 | { |
| 25 | | assert(device != NULL); |
| 26 | | assert(device->type() == DECOCOMN); |
| 30 | // inherit a copy of the static data |
| 31 | const decocomn_interface *intf = reinterpret_cast<const decocomn_interface *>(static_config()); |
| 32 | if (intf != NULL) |
| 33 | *static_cast<decocomn_interface *>(this) = *intf; |
| 27 | 34 | |
| 28 | | return (decocomn_state *)downcast<decocomn_device *>(device)->token(); |
| 35 | // or initialize to defaults if none provided |
| 36 | else |
| 37 | { |
| 38 | m_screen_tag = ""; |
| 39 | } |
| 29 | 40 | } |
| 30 | 41 | |
| 31 | | INLINE const decocomn_interface *get_interface( device_t *device ) |
| 42 | //------------------------------------------------- |
| 43 | // device_start - device-specific startup |
| 44 | //------------------------------------------------- |
| 45 | |
| 46 | void decocomn_device::device_start() |
| 32 | 47 | { |
| 33 | | assert(device != NULL); |
| 34 | | assert((device->type() == DECOCOMN)); |
| 35 | | return (const decocomn_interface *) device->static_config(); |
| 48 | // int width, height; |
| 49 | |
| 50 | m_screen = machine().device<screen_device>(m_screen_tag); |
| 51 | // width = m_screen->width(); |
| 52 | // height = m_screen->height(); |
| 53 | |
| 54 | m_dirty_palette = auto_alloc_array_clear(machine(), UINT8, 4096); |
| 55 | |
| 56 | save_item(NAME(m_priority)); |
| 57 | save_pointer(NAME(m_dirty_palette), 4096); |
| 36 | 58 | } |
| 37 | 59 | |
| 60 | //------------------------------------------------- |
| 61 | // device_reset - device-specific reset |
| 62 | //------------------------------------------------- |
| 63 | |
| 64 | void decocomn_device::device_reset() |
| 65 | { |
| 66 | m_priority = 0; |
| 67 | } |
| 68 | |
| 38 | 69 | /***************************************************************************** |
| 39 | 70 | DEVICE HANDLERS |
| 40 | 71 | *****************************************************************************/ |
| r24069 | r24070 | |
| 42 | 73 | /* Later games have double buffered paletteram - the real palette ram is |
| 43 | 74 | only updated on a DMA call */ |
| 44 | 75 | |
| 45 | | WRITE16_DEVICE_HANDLER( decocomn_nonbuffered_palette_w ) |
| 76 | WRITE16_MEMBER( decocomn_device::nonbuffered_palette_w ) |
| 46 | 77 | { |
| 78 | driver_device *state = space.machine().driver_data(); |
| 79 | |
| 47 | 80 | int r,g,b; |
| 48 | 81 | |
| 49 | | driver_device *state = space.machine().driver_data(); |
| 50 | 82 | COMBINE_DATA(&state->m_generic_paletteram_16[offset]); |
| 51 | 83 | if (offset&1) offset--; |
| 52 | 84 | |
| r24069 | r24070 | |
| 57 | 89 | palette_set_color(space.machine(), offset / 2, MAKE_RGB(r,g,b)); |
| 58 | 90 | } |
| 59 | 91 | |
| 60 | | WRITE16_DEVICE_HANDLER( decocomn_buffered_palette_w ) |
| 92 | WRITE16_MEMBER( decocomn_device::buffered_palette_w ) |
| 61 | 93 | { |
| 62 | | decocomn_state *decocomn = get_safe_token(device); |
| 63 | | |
| 64 | 94 | driver_device *state = space.machine().driver_data(); |
| 95 | |
| 65 | 96 | COMBINE_DATA(&state->m_generic_paletteram_16[offset]); |
| 66 | 97 | |
| 67 | | decocomn->dirty_palette[offset / 2] = 1; |
| 98 | m_dirty_palette[offset / 2] = 1; |
| 68 | 99 | } |
| 69 | 100 | |
| 70 | | WRITE16_DEVICE_HANDLER( decocomn_palette_dma_w ) |
| 101 | WRITE16_MEMBER( decocomn_device::palette_dma_w ) |
| 71 | 102 | { |
| 72 | | decocomn_state *decocomn = get_safe_token(device); |
| 73 | 103 | driver_device *state = space.machine().driver_data(); |
| 104 | |
| 74 | 105 | const int m = space.machine().total_colors(); |
| 75 | 106 | int r, g, b, i; |
| 76 | 107 | |
| 77 | 108 | for (i = 0; i < m; i++) |
| 78 | 109 | { |
| 79 | | if (decocomn->dirty_palette[i]) |
| 110 | if (m_dirty_palette[i]) |
| 80 | 111 | { |
| 81 | | decocomn->dirty_palette[i] = 0; |
| 112 | m_dirty_palette[i] = 0; |
| 82 | 113 | |
| 83 | 114 | b = (state->m_generic_paletteram_16[i * 2] >> 0) & 0xff; |
| 84 | 115 | g = (state->m_generic_paletteram_16[i * 2 + 1] >> 8) & 0xff; |
| r24069 | r24070 | |
| 92 | 123 | /*****************************************************************************************/ |
| 93 | 124 | |
| 94 | 125 | /* */ |
| 95 | | READ16_DEVICE_HANDLER( decocomn_71_r ) |
| 126 | READ16_MEMBER( decocomn_device::d_71_r ) |
| 96 | 127 | { |
| 97 | 128 | return 0xffff; |
| 98 | 129 | } |
| 99 | 130 | |
| 100 | | WRITE16_DEVICE_HANDLER( decocomn_priority_w ) |
| 131 | WRITE16_MEMBER( decocomn_device::priority_w ) |
| 101 | 132 | { |
| 102 | | decocomn_state *decocomn = get_safe_token(device); |
| 103 | | decocomn->priority = data; |
| 133 | m_priority = data; |
| 104 | 134 | } |
| 105 | 135 | |
| 106 | | READ16_DEVICE_HANDLER( decocomn_priority_r ) |
| 136 | READ16_MEMBER( decocomn_device::priority_r ) |
| 107 | 137 | { |
| 108 | | decocomn_state *decocomn = get_safe_token(device); |
| 109 | | return decocomn->priority; |
| 138 | return m_priority; |
| 110 | 139 | } |
| 111 | | |
| 112 | | |
| 113 | | /******************************************************************************/ |
| 114 | | |
| 115 | | /***************************************************************************** |
| 116 | | DEVICE INTERFACE |
| 117 | | *****************************************************************************/ |
| 118 | | |
| 119 | | static DEVICE_START( decocomn ) |
| 120 | | { |
| 121 | | decocomn_state *decocomn = get_safe_token(device); |
| 122 | | const decocomn_interface *intf = get_interface(device); |
| 123 | | // int width, height; |
| 124 | | |
| 125 | | decocomn->screen = device->machine().device<screen_device>(intf->screen); |
| 126 | | // width = decocomn->screen->width(); |
| 127 | | // height = decocomn->screen->height(); |
| 128 | | |
| 129 | | decocomn->dirty_palette = auto_alloc_array_clear(device->machine(), UINT8, 4096); |
| 130 | | |
| 131 | | device->save_item(NAME(decocomn->priority)); |
| 132 | | device->save_pointer(NAME(decocomn->dirty_palette), 4096); |
| 133 | | } |
| 134 | | |
| 135 | | static DEVICE_RESET( decocomn ) |
| 136 | | { |
| 137 | | decocomn_state *decocomn = get_safe_token(device); |
| 138 | | decocomn->priority = 0; |
| 139 | | } |
| 140 | | |
| 141 | | |
| 142 | | const device_type DECOCOMN = &device_creator<decocomn_device>; |
| 143 | | |
| 144 | | decocomn_device::decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 145 | | : device_t(mconfig, DECOCOMN, "Data East Common Video Functions", tag, owner, clock, "decocomn", __FILE__) |
| 146 | | { |
| 147 | | m_token = global_alloc_clear(decocomn_state); |
| 148 | | } |
| 149 | | |
| 150 | | //------------------------------------------------- |
| 151 | | // device_config_complete - perform any |
| 152 | | // operations now that the configuration is |
| 153 | | // complete |
| 154 | | //------------------------------------------------- |
| 155 | | |
| 156 | | void decocomn_device::device_config_complete() |
| 157 | | { |
| 158 | | } |
| 159 | | |
| 160 | | //------------------------------------------------- |
| 161 | | // device_start - device-specific startup |
| 162 | | //------------------------------------------------- |
| 163 | | |
| 164 | | void decocomn_device::device_start() |
| 165 | | { |
| 166 | | DEVICE_START_NAME( decocomn )(this); |
| 167 | | } |
| 168 | | |
| 169 | | //------------------------------------------------- |
| 170 | | // device_reset - device-specific reset |
| 171 | | //------------------------------------------------- |
| 172 | | |
| 173 | | void decocomn_device::device_reset() |
| 174 | | { |
| 175 | | DEVICE_RESET_NAME( decocomn )(this); |
| 176 | | } |
trunk/src/mame/video/decocomn.h
| r24069 | r24070 | |
| 8 | 8 | #ifndef __DECOCOMN_H__ |
| 9 | 9 | #define __DECOCOMN_H__ |
| 10 | 10 | |
| 11 | | #include "devcb.h" |
| 12 | 11 | |
| 13 | | |
| 14 | 12 | /*************************************************************************** |
| 15 | 13 | TYPE DEFINITIONS |
| 16 | 14 | ***************************************************************************/ |
| r24069 | r24070 | |
| 18 | 16 | |
| 19 | 17 | struct decocomn_interface |
| 20 | 18 | { |
| 21 | | const char *screen; |
| 19 | const char *m_screen_tag; |
| 22 | 20 | }; |
| 23 | 21 | |
| 24 | | class decocomn_device : public device_t |
| 22 | class decocomn_device : public device_t, |
| 23 | public decocomn_interface |
| 25 | 24 | { |
| 26 | 25 | public: |
| 27 | 26 | decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 28 | | ~decocomn_device() { global_free(m_token); } |
| 27 | ~decocomn_device() {} |
| 28 | |
| 29 | DECLARE_WRITE16_MEMBER( nonbuffered_palette_w ); |
| 30 | DECLARE_WRITE16_MEMBER( buffered_palette_w ); |
| 31 | DECLARE_WRITE16_MEMBER( palette_dma_w ); |
| 32 | DECLARE_WRITE16_MEMBER( priority_w ); |
| 33 | DECLARE_READ16_MEMBER( priority_r ); |
| 34 | DECLARE_READ16_MEMBER( d_71_r ); |
| 29 | 35 | |
| 30 | | // access to legacy token |
| 31 | | void *token() const { assert(m_token != NULL); return m_token; } |
| 32 | 36 | protected: |
| 33 | 37 | // device-level overrides |
| 34 | 38 | virtual void device_config_complete(); |
| 35 | 39 | virtual void device_start(); |
| 36 | 40 | virtual void device_reset(); |
| 41 | |
| 37 | 42 | private: |
| 38 | 43 | // internal state |
| 39 | | void *m_token; |
| 44 | screen_device *m_screen; |
| 45 | UINT8 *m_dirty_palette; |
| 46 | UINT16 m_priority; |
| 40 | 47 | }; |
| 41 | 48 | |
| 42 | 49 | extern const device_type DECOCOMN; |
| r24069 | r24070 | |
| 51 | 58 | MCFG_DEVICE_ADD(_tag, DECOCOMN, 0) \ |
| 52 | 59 | MCFG_DEVICE_CONFIG(_interface) |
| 53 | 60 | |
| 54 | | /*************************************************************************** |
| 55 | | DEVICE I/O FUNCTIONS |
| 56 | | ***************************************************************************/ |
| 57 | | |
| 58 | | DECLARE_WRITE16_DEVICE_HANDLER( decocomn_nonbuffered_palette_w ); |
| 59 | | DECLARE_WRITE16_DEVICE_HANDLER( decocomn_buffered_palette_w ); |
| 60 | | DECLARE_WRITE16_DEVICE_HANDLER( decocomn_palette_dma_w ); |
| 61 | | |
| 62 | | DECLARE_WRITE16_DEVICE_HANDLER( decocomn_priority_w ); |
| 63 | | DECLARE_READ16_DEVICE_HANDLER( decocomn_priority_r ); |
| 64 | | |
| 65 | | DECLARE_READ16_DEVICE_HANDLER( decocomn_71_r ); |
| 66 | | |
| 67 | 61 | #endif |