trunk/src/mame/machine/xevious.c
| r20825 | r20826 | |
| 17 | 17 | |
| 18 | 18 | ***************************************************************************/ |
| 19 | 19 | |
| 20 | | static UINT8 customio[16]; |
| 21 | | static char battles_customio_command; |
| 22 | | static char battles_customio_prev_command; |
| 23 | | static char battles_customio_command_count; |
| 24 | | static char battles_customio_data; |
| 25 | | static char battles_sound_played; |
| 26 | | |
| 27 | | |
| 28 | | void battles_customio_init(running_machine &machine) |
| 20 | void xevious_state::battles_customio_init() |
| 29 | 21 | { |
| 30 | | battles_customio_command = 0; |
| 31 | | battles_customio_prev_command = 0; |
| 32 | | battles_customio_command_count = 0; |
| 33 | | battles_customio_data = 0; |
| 34 | | battles_sound_played = 0; |
| 22 | m_battles_customio_command = 0; |
| 23 | m_battles_customio_prev_command = 0; |
| 24 | m_battles_customio_command_count = 0; |
| 25 | m_battles_customio_data = 0; |
| 26 | m_battles_sound_played = 0; |
| 35 | 27 | } |
| 36 | 28 | |
| 37 | 29 | |
| 38 | 30 | TIMER_DEVICE_CALLBACK_MEMBER(xevious_state::battles_nmi_generate) |
| 39 | 31 | { |
| 40 | | battles_customio_prev_command = battles_customio_command; |
| 32 | m_battles_customio_prev_command = m_battles_customio_command; |
| 41 | 33 | |
| 42 | | if( battles_customio_command & 0x10 ) |
| 34 | if( m_battles_customio_command & 0x10 ) |
| 43 | 35 | { |
| 44 | | if( battles_customio_command_count == 0 ) |
| 36 | if( m_battles_customio_command_count == 0 ) |
| 45 | 37 | { |
| 46 | 38 | machine().device("sub3")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 47 | 39 | } |
| r20825 | r20826 | |
| 56 | 48 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 57 | 49 | machine().device("sub3")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 58 | 50 | } |
| 59 | | battles_customio_command_count++; |
| 51 | m_battles_customio_command_count++; |
| 60 | 52 | } |
| 61 | 53 | |
| 62 | 54 | |
| 63 | | READ8_HANDLER( battles_customio0_r ) |
| 55 | READ8_MEMBER( xevious_state::battles_customio0_r ) |
| 64 | 56 | { |
| 65 | | logerror("CPU0 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),battles_customio_command); |
| 66 | | return battles_customio_command; |
| 57 | logerror("CPU0 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),m_battles_customio_command); |
| 58 | return m_battles_customio_command; |
| 67 | 59 | } |
| 68 | 60 | |
| 69 | | READ8_HANDLER( battles_customio3_r ) |
| 61 | READ8_MEMBER( xevious_state::battles_customio3_r ) |
| 70 | 62 | { |
| 71 | 63 | int return_data; |
| 72 | 64 | |
| 73 | 65 | if( space.device().safe_pc() == 0xAE ){ |
| 74 | 66 | /* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */ |
| 75 | | return_data = ( (battles_customio_command & 0x10) << 3) |
| 67 | return_data = ( (m_battles_customio_command & 0x10) << 3) |
| 76 | 68 | | 0x00 |
| 77 | | | (battles_customio_command & 0x0f); |
| 69 | | (m_battles_customio_command & 0x0f); |
| 78 | 70 | }else{ |
| 79 | | return_data = ( (battles_customio_prev_command & 0x10) << 3) |
| 71 | return_data = ( (m_battles_customio_prev_command & 0x10) << 3) |
| 80 | 72 | | 0x60 |
| 81 | | | (battles_customio_prev_command & 0x0f); |
| 73 | | (m_battles_customio_prev_command & 0x0f); |
| 82 | 74 | } |
| 83 | 75 | logerror("CPU3 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),return_data); |
| 84 | 76 | |
| r20825 | r20826 | |
| 86 | 78 | } |
| 87 | 79 | |
| 88 | 80 | |
| 89 | | WRITE8_HANDLER( battles_customio0_w ) |
| 81 | WRITE8_MEMBER( xevious_state::battles_customio0_w ) |
| 90 | 82 | { |
| 91 | | timer_device *timer = space.machine().device<timer_device>("battles_nmi"); |
| 83 | timer_device *timer = machine().device<timer_device>("battles_nmi"); |
| 92 | 84 | |
| 93 | 85 | logerror("CPU0 %04x: custom I/O Write = %02x\n",space.device().safe_pc(),data); |
| 94 | 86 | |
| 95 | | battles_customio_command = data; |
| 96 | | battles_customio_command_count = 0; |
| 87 | m_battles_customio_command = data; |
| 88 | m_battles_customio_command_count = 0; |
| 97 | 89 | |
| 98 | 90 | switch (data) |
| 99 | 91 | { |
| r20825 | r20826 | |
| 105 | 97 | |
| 106 | 98 | } |
| 107 | 99 | |
| 108 | | WRITE8_HANDLER( battles_customio3_w ) |
| 100 | WRITE8_MEMBER( xevious_state::battles_customio3_w ) |
| 109 | 101 | { |
| 110 | 102 | logerror("CPU3 %04x: custom I/O Write = %02x\n",space.device().safe_pc(),data); |
| 111 | 103 | |
| 112 | | battles_customio_command = data; |
| 104 | m_battles_customio_command = data; |
| 113 | 105 | } |
| 114 | 106 | |
| 115 | 107 | |
| 116 | 108 | |
| 117 | | READ8_HANDLER( battles_customio_data0_r ) |
| 109 | READ8_MEMBER( xevious_state::battles_customio_data0_r ) |
| 118 | 110 | { |
| 119 | | logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,battles_customio_data); |
| 111 | logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,m_battles_customio_data); |
| 120 | 112 | |
| 121 | | return battles_customio_data; |
| 113 | return m_battles_customio_data; |
| 122 | 114 | } |
| 123 | 115 | |
| 124 | | READ8_HANDLER( battles_customio_data3_r ) |
| 116 | READ8_MEMBER( xevious_state::battles_customio_data3_r ) |
| 125 | 117 | { |
| 126 | | logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,battles_customio_data); |
| 127 | | return battles_customio_data; |
| 118 | logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,m_battles_customio_data); |
| 119 | return m_battles_customio_data; |
| 128 | 120 | } |
| 129 | 121 | |
| 130 | 122 | |
| 131 | | WRITE8_HANDLER( battles_customio_data0_w ) |
| 123 | WRITE8_MEMBER( xevious_state::battles_customio_data0_w ) |
| 132 | 124 | { |
| 133 | 125 | logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",space.device().safe_pc(),offset,data); |
| 134 | | battles_customio_data = data; |
| 126 | m_battles_customio_data = data; |
| 135 | 127 | } |
| 136 | 128 | |
| 137 | | WRITE8_HANDLER( battles_customio_data3_w ) |
| 129 | WRITE8_MEMBER( xevious_state::battles_customio_data3_w ) |
| 138 | 130 | { |
| 139 | 131 | logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",space.device().safe_pc(),offset,data); |
| 140 | | battles_customio_data = data; |
| 132 | m_battles_customio_data = data; |
| 141 | 133 | } |
| 142 | 134 | |
| 143 | 135 | |
| 144 | | WRITE8_HANDLER( battles_CPU4_coin_w ) |
| 136 | WRITE8_MEMBER( xevious_state::battles_CPU4_coin_w ) |
| 145 | 137 | { |
| 146 | | set_led_status(space.machine(), 0,data & 0x02); // Start 1 |
| 147 | | set_led_status(space.machine(), 1,data & 0x01); // Start 2 |
| 138 | set_led_status(machine(), 0,data & 0x02); // Start 1 |
| 139 | set_led_status(machine(), 1,data & 0x01); // Start 2 |
| 148 | 140 | |
| 149 | | coin_counter_w(space.machine(), 0,data & 0x20); |
| 150 | | coin_counter_w(space.machine(), 1,data & 0x10); |
| 151 | | coin_lockout_global_w(space.machine(), ~data & 0x04); |
| 141 | coin_counter_w(machine(), 0,data & 0x20); |
| 142 | coin_counter_w(machine(), 1,data & 0x10); |
| 143 | coin_lockout_global_w(machine(), ~data & 0x04); |
| 152 | 144 | } |
| 153 | 145 | |
| 154 | 146 | |
| 155 | | WRITE8_HANDLER( battles_noise_sound_w ) |
| 147 | WRITE8_MEMBER( xevious_state::battles_noise_sound_w ) |
| 156 | 148 | { |
| 157 | 149 | logerror("CPU3 %04x: 50%02x Write = %02x\n",space.device().safe_pc(),offset,data); |
| 158 | | if( (battles_sound_played == 0) && (data == 0xFF) ){ |
| 159 | | samples_device *samples = space.machine().device<samples_device>("samples"); |
| 160 | | if( customio[0] == 0x40 ){ |
| 150 | if( (m_battles_sound_played == 0) && (data == 0xFF) ){ |
| 151 | samples_device *samples = machine().device<samples_device>("samples"); |
| 152 | if( m_customio[0] == 0x40 ){ |
| 161 | 153 | samples->start(0, 0); |
| 162 | 154 | } |
| 163 | 155 | else{ |
| 164 | 156 | samples->start(0, 1); |
| 165 | 157 | } |
| 166 | 158 | } |
| 167 | | battles_sound_played = data; |
| 159 | m_battles_sound_played = data; |
| 168 | 160 | } |
| 169 | 161 | |
| 170 | 162 | |
| 171 | | READ8_HANDLER( battles_input_port_r ) |
| 163 | READ8_MEMBER( xevious_state::battles_input_port_r ) |
| 172 | 164 | { |
| 173 | 165 | switch ( offset ) |
| 174 | 166 | { |
| 175 | 167 | default: |
| 176 | | case 0: return ~BITSWAP8(space.machine().root_device().ioport("IN0H")->read(),7,6,5,4,2,3,1,0); |
| 177 | | case 1: return ~space.machine().root_device().ioport("IN1L")->read(); |
| 178 | | case 2: return ~space.machine().root_device().ioport("IN1H")->read(); |
| 179 | | case 3: return ~space.machine().root_device().ioport("IN0L")->read(); |
| 168 | case 0: return ~BITSWAP8(machine().root_device().ioport("IN0H")->read(),7,6,5,4,2,3,1,0); |
| 169 | case 1: return ~machine().root_device().ioport("IN1L")->read(); |
| 170 | case 2: return ~machine().root_device().ioport("IN1H")->read(); |
| 171 | case 3: return ~machine().root_device().ioport("IN0L")->read(); |
| 180 | 172 | } |
| 181 | 173 | } |
| 182 | 174 | |
trunk/src/mame/video/xevious.c
| r20825 | r20826 | |
| 237 | 237 | |
| 238 | 238 | ***************************************************************************/ |
| 239 | 239 | |
| 240 | | WRITE8_HANDLER( xevious_fg_videoram_w ) |
| 240 | WRITE8_MEMBER( xevious_state::xevious_fg_videoram_w ) |
| 241 | 241 | { |
| 242 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 243 | | |
| 244 | | state->m_xevious_fg_videoram[offset] = data; |
| 245 | | state->m_fg_tilemap->mark_tile_dirty(offset); |
| 242 | m_xevious_fg_videoram[offset] = data; |
| 243 | m_fg_tilemap->mark_tile_dirty(offset); |
| 246 | 244 | } |
| 247 | 245 | |
| 248 | | WRITE8_HANDLER( xevious_fg_colorram_w ) |
| 246 | WRITE8_MEMBER( xevious_state::xevious_fg_colorram_w ) |
| 249 | 247 | { |
| 250 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 251 | | |
| 252 | | state->m_xevious_fg_colorram[offset] = data; |
| 253 | | state->m_fg_tilemap->mark_tile_dirty(offset); |
| 248 | m_xevious_fg_colorram[offset] = data; |
| 249 | m_fg_tilemap->mark_tile_dirty(offset); |
| 254 | 250 | } |
| 255 | 251 | |
| 256 | | WRITE8_HANDLER( xevious_bg_videoram_w ) |
| 252 | WRITE8_MEMBER( xevious_state::xevious_bg_videoram_w ) |
| 257 | 253 | { |
| 258 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 259 | | |
| 260 | | state->m_xevious_bg_videoram[offset] = data; |
| 261 | | state->m_bg_tilemap->mark_tile_dirty(offset); |
| 254 | m_xevious_bg_videoram[offset] = data; |
| 255 | m_bg_tilemap->mark_tile_dirty(offset); |
| 262 | 256 | } |
| 263 | 257 | |
| 264 | | WRITE8_HANDLER( xevious_bg_colorram_w ) |
| 258 | WRITE8_MEMBER( xevious_state::xevious_bg_colorram_w ) |
| 265 | 259 | { |
| 266 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 267 | | |
| 268 | | state->m_xevious_bg_colorram[offset] = data; |
| 269 | | state->m_bg_tilemap->mark_tile_dirty(offset); |
| 260 | m_xevious_bg_colorram[offset] = data; |
| 261 | m_bg_tilemap->mark_tile_dirty(offset); |
| 270 | 262 | } |
| 271 | 263 | |
| 272 | | WRITE8_HANDLER( xevious_vh_latch_w ) |
| 264 | WRITE8_MEMBER( xevious_state::xevious_vh_latch_w ) |
| 273 | 265 | { |
| 274 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 275 | | |
| 276 | 266 | int reg; |
| 277 | 267 | int scroll = data + ((offset&0x01)<<8); /* A0 -> D8 */ |
| 278 | 268 | |
| r20825 | r20826 | |
| 281 | 271 | switch (reg) |
| 282 | 272 | { |
| 283 | 273 | case 0: |
| 284 | | state->m_bg_tilemap->set_scrollx(0,scroll); |
| 274 | m_bg_tilemap->set_scrollx(0,scroll); |
| 285 | 275 | break; |
| 286 | 276 | case 1: |
| 287 | | state->m_fg_tilemap->set_scrollx(0,scroll); |
| 277 | m_fg_tilemap->set_scrollx(0,scroll); |
| 288 | 278 | break; |
| 289 | 279 | case 2: |
| 290 | | state->m_bg_tilemap->set_scrolly(0,scroll); |
| 280 | m_bg_tilemap->set_scrolly(0,scroll); |
| 291 | 281 | break; |
| 292 | 282 | case 3: |
| 293 | | state->m_fg_tilemap->set_scrolly(0,scroll); |
| 283 | m_fg_tilemap->set_scrolly(0,scroll); |
| 294 | 284 | break; |
| 295 | 285 | case 7: |
| 296 | | state->flip_screen_set(scroll & 1); |
| 286 | flip_screen_set(scroll & 1); |
| 297 | 287 | break; |
| 298 | 288 | default: |
| 299 | 289 | logerror("CRTC WRITE REG: %x Data: %03x\n",reg, scroll); |
| r20825 | r20826 | |
| 303 | 293 | |
| 304 | 294 | |
| 305 | 295 | /* emulation for schematic 9B */ |
| 306 | | WRITE8_HANDLER( xevious_bs_w ) |
| 296 | WRITE8_MEMBER( xevious_state::xevious_bs_w ) |
| 307 | 297 | { |
| 308 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 309 | | |
| 310 | | state->m_xevious_bs[offset & 1] = data; |
| 298 | m_xevious_bs[offset & 1] = data; |
| 311 | 299 | } |
| 312 | 300 | |
| 313 | | READ8_HANDLER( xevious_bb_r ) |
| 301 | READ8_MEMBER( xevious_state::xevious_bb_r ) |
| 314 | 302 | { |
| 315 | | xevious_state *state = space.machine().driver_data<xevious_state>(); |
| 316 | | |
| 317 | | UINT8 *rom2a = state->memregion("gfx4")->base(); |
| 303 | UINT8 *rom2a = memregion("gfx4")->base(); |
| 318 | 304 | UINT8 *rom2b = rom2a+0x1000; |
| 319 | 305 | UINT8 *rom2c = rom2a+0x3000; |
| 320 | 306 | int adr_2b,adr_2c; |
| 321 | 307 | int dat1,dat2; |
| 322 | 308 | |
| 323 | 309 | /* get BS to 12 bit data from 2A,2B */ |
| 324 | | adr_2b = ((state->m_xevious_bs[1] & 0x7e) << 6) | ((state->m_xevious_bs[0] & 0xfe) >> 1); |
| 310 | adr_2b = ((m_xevious_bs[1] & 0x7e) << 6) | ((m_xevious_bs[0] & 0xfe) >> 1); |
| 325 | 311 | |
| 326 | 312 | if (adr_2b & 1) |
| 327 | 313 | { |
| r20825 | r20826 | |
| 334 | 320 | dat1 = ((rom2a[adr_2b >> 1] & 0x0f) << 8) | rom2b[adr_2b]; |
| 335 | 321 | } |
| 336 | 322 | |
| 337 | | adr_2c = ((dat1 & 0x1ff) << 2) | ((state->m_xevious_bs[1] & 1) << 1) | (state->m_xevious_bs[0] & 1); |
| 323 | adr_2c = ((dat1 & 0x1ff) << 2) | ((m_xevious_bs[1] & 1) << 1) | (m_xevious_bs[0] & 1); |
| 338 | 324 | if (dat1 & 0x400) adr_2c ^= 1; |
| 339 | 325 | if (dat1 & 0x200) adr_2c ^= 2; |
| 340 | 326 | |
trunk/src/mame/video/bosco.c
| r20825 | r20826 | |
| 150 | 150 | |
| 151 | 151 | ***************************************************************************/ |
| 152 | 152 | |
| 153 | | WRITE8_HANDLER( bosco_videoram_w ) |
| 153 | WRITE8_MEMBER( bosco_state::bosco_videoram_w ) |
| 154 | 154 | { |
| 155 | | bosco_state *state = space.machine().driver_data<bosco_state>(); |
| 156 | | |
| 157 | | state->m_videoram[offset] = data; |
| 155 | m_videoram[offset] = data; |
| 158 | 156 | if (offset & 0x400) |
| 159 | | state->m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 157 | m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 160 | 158 | else |
| 161 | | state->m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 159 | m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 162 | 160 | } |
| 163 | 161 | |
| 164 | | WRITE8_HANDLER( bosco_scrollx_w ) |
| 162 | WRITE8_MEMBER( bosco_state::bosco_scrollx_w ) |
| 165 | 163 | { |
| 166 | | bosco_state *state = space.machine().driver_data<bosco_state>(); |
| 167 | | |
| 168 | | state->m_bg_tilemap->set_scrollx(0,data); |
| 164 | m_bg_tilemap->set_scrollx(0,data); |
| 169 | 165 | } |
| 170 | 166 | |
| 171 | | WRITE8_HANDLER( bosco_scrolly_w ) |
| 167 | WRITE8_MEMBER( bosco_state::bosco_scrolly_w ) |
| 172 | 168 | { |
| 173 | | bosco_state *state = space.machine().driver_data<bosco_state>(); |
| 174 | | state->m_bg_tilemap->set_scrolly(0,data); |
| 169 | m_bg_tilemap->set_scrolly(0,data); |
| 175 | 170 | } |
| 176 | 171 | |
| 177 | | WRITE8_HANDLER( bosco_starclr_w ) |
| 172 | WRITE8_MEMBER( bosco_state::bosco_starclr_w ) |
| 178 | 173 | { |
| 179 | 174 | } |
| 180 | 175 | |
| r20825 | r20826 | |
| 255 | 250 | { |
| 256 | 251 | int x,y; |
| 257 | 252 | |
| 258 | | if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) ) |
| 253 | if ( (set_a == m_star_seed_tab[star_cntr].set) || ( set_b == m_star_seed_tab[star_cntr].set) ) |
| 259 | 254 | { |
| 260 | | x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256; |
| 261 | | y = (star_seed_tab[star_cntr].y + m_stars_scrolly) % 256; |
| 255 | x = (m_star_seed_tab[star_cntr].x + m_stars_scrollx) % 256; |
| 256 | y = (m_star_seed_tab[star_cntr].y + m_stars_scrolly) % 256; |
| 262 | 257 | |
| 263 | 258 | /* dont draw the stars that are off the screen */ |
| 264 | 259 | if ( x < 224 ) |
| r20825 | r20826 | |
| 266 | 261 | if (flip) x += 20*8; |
| 267 | 262 | |
| 268 | 263 | if (cliprect.contains(x, y)) |
| 269 | | bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col; |
| 264 | bitmap.pix16(y, x) = STARS_COLOR_BASE + m_star_seed_tab[star_cntr].col; |
| 270 | 265 | } |
| 271 | 266 | } |
| 272 | 267 | } |
trunk/src/mame/video/digdug.c
| r20825 | r20826 | |
| 162 | 162 | |
| 163 | 163 | ***************************************************************************/ |
| 164 | 164 | |
| 165 | | WRITE8_HANDLER( digdug_videoram_w ) |
| 165 | WRITE8_MEMBER( digdug_state::digdug_videoram_w ) |
| 166 | 166 | { |
| 167 | | digdug_state *state = space.machine().driver_data<digdug_state>(); |
| 168 | | |
| 169 | | state->m_videoram[offset] = data; |
| 170 | | state->m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 167 | m_videoram[offset] = data; |
| 168 | m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); |
| 171 | 169 | } |
| 172 | 170 | |
| 173 | | WRITE8_HANDLER( digdug_PORT_w ) |
| 171 | WRITE8_MEMBER( digdug_state::digdug_PORT_w ) |
| 174 | 172 | { |
| 175 | | digdug_state *state = space.machine().driver_data<digdug_state>(); |
| 176 | | |
| 177 | 173 | switch (offset) |
| 178 | 174 | { |
| 179 | 175 | case 0: /* select background picture */ |
| r20825 | r20826 | |
| 182 | 178 | int shift = offset; |
| 183 | 179 | int mask = 1 << shift; |
| 184 | 180 | |
| 185 | | if ((state->m_bg_select & mask) != ((data & 1) << shift)) |
| 181 | if ((m_bg_select & mask) != ((data & 1) << shift)) |
| 186 | 182 | { |
| 187 | | state->m_bg_select = (state->m_bg_select & ~mask) | ((data & 1) << shift); |
| 188 | | state->m_bg_tilemap->mark_all_dirty(); |
| 183 | m_bg_select = (m_bg_select & ~mask) | ((data & 1) << shift); |
| 184 | m_bg_tilemap->mark_all_dirty(); |
| 189 | 185 | } |
| 190 | 186 | } |
| 191 | 187 | break; |
| 192 | 188 | |
| 193 | 189 | case 2: /* select alpha layer color mode (see tx_get_tile_info) */ |
| 194 | | if (state->m_tx_color_mode != (data & 1)) |
| 190 | if (m_tx_color_mode != (data & 1)) |
| 195 | 191 | { |
| 196 | | state->m_tx_color_mode = data & 1; |
| 197 | | state->m_fg_tilemap->mark_all_dirty(); |
| 192 | m_tx_color_mode = data & 1; |
| 193 | m_fg_tilemap->mark_all_dirty(); |
| 198 | 194 | } |
| 199 | 195 | break; |
| 200 | 196 | |
| 201 | 197 | case 3: /* "disable" background (see bg_get_tile_info) */ |
| 202 | | if (state->m_bg_disable != (data & 1)) |
| 198 | if (m_bg_disable != (data & 1)) |
| 203 | 199 | { |
| 204 | | state->m_bg_disable = data & 1; |
| 205 | | state->m_bg_tilemap->mark_all_dirty(); |
| 200 | m_bg_disable = data & 1; |
| 201 | m_bg_tilemap->mark_all_dirty(); |
| 206 | 202 | } |
| 207 | 203 | break; |
| 208 | 204 | |
| r20825 | r20826 | |
| 212 | 208 | int shift = offset; |
| 213 | 209 | int mask = 1 << shift; |
| 214 | 210 | |
| 215 | | if ((state->m_bg_color_bank & mask) != ((data & 1) << shift)) |
| 211 | if ((m_bg_color_bank & mask) != ((data & 1) << shift)) |
| 216 | 212 | { |
| 217 | | state->m_bg_color_bank = (state->m_bg_color_bank & ~mask) | ((data & 1) << shift); |
| 218 | | state->m_bg_tilemap->mark_all_dirty(); |
| 213 | m_bg_color_bank = (m_bg_color_bank & ~mask) | ((data & 1) << shift); |
| 214 | m_bg_tilemap->mark_all_dirty(); |
| 219 | 215 | } |
| 220 | 216 | } |
| 221 | 217 | break; |
| r20825 | r20826 | |
| 224 | 220 | break; |
| 225 | 221 | |
| 226 | 222 | case 7: /* FLIP */ |
| 227 | | state->flip_screen_set(data & 1); |
| 223 | flip_screen_set(data & 1); |
| 228 | 224 | break; |
| 229 | 225 | } |
| 230 | 226 | } |
trunk/src/mame/includes/galaga.h
| r20825 | r20826 | |
| 64 | 64 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 65 | 65 | void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 66 | 66 | void bosco_latch_reset(); |
| 67 | struct star |
| 68 | { |
| 69 | UINT16 x,y; |
| 70 | UINT8 col,set; |
| 71 | }; |
| 72 | |
| 73 | static struct star m_star_seed_tab[]; |
| 67 | 74 | }; |
| 68 | 75 | |
| 69 | 76 | class xevious_state : public galaga_state |
| r20825 | r20826 | |
| 102 | 109 | INTERRUPT_GEN_MEMBER(battles_interrupt_4); |
| 103 | 110 | TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate); |
| 104 | 111 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 112 | DECLARE_WRITE8_MEMBER( xevious_fg_videoram_w ); |
| 113 | DECLARE_WRITE8_MEMBER( xevious_fg_colorram_w ); |
| 114 | DECLARE_WRITE8_MEMBER( xevious_bg_videoram_w ); |
| 115 | DECLARE_WRITE8_MEMBER( xevious_bg_colorram_w ); |
| 116 | DECLARE_WRITE8_MEMBER( xevious_vh_latch_w ); |
| 117 | DECLARE_WRITE8_MEMBER( xevious_bs_w ); |
| 118 | DECLARE_READ8_MEMBER( xevious_bb_r ); |
| 119 | |
| 120 | // Custom I/O |
| 121 | void battles_customio_init(); |
| 122 | |
| 123 | DECLARE_READ8_MEMBER( battles_customio0_r ); |
| 124 | DECLARE_READ8_MEMBER( battles_customio_data0_r ); |
| 125 | DECLARE_READ8_MEMBER( battles_customio3_r ); |
| 126 | DECLARE_READ8_MEMBER( battles_customio_data3_r ); |
| 127 | DECLARE_READ8_MEMBER( battles_input_port_r ); |
| 128 | |
| 129 | DECLARE_WRITE8_MEMBER( battles_customio0_w ); |
| 130 | DECLARE_WRITE8_MEMBER( battles_customio_data0_w ); |
| 131 | DECLARE_WRITE8_MEMBER( battles_customio3_w ); |
| 132 | DECLARE_WRITE8_MEMBER( battles_customio_data3_w ); |
| 133 | DECLARE_WRITE8_MEMBER( battles_CPU4_coin_w ); |
| 134 | DECLARE_WRITE8_MEMBER( battles_noise_sound_w ); |
| 135 | |
| 136 | UINT8 m_customio[16]; |
| 137 | char m_battles_customio_command; |
| 138 | char m_battles_customio_prev_command; |
| 139 | char m_battles_customio_command_count; |
| 140 | char m_battles_customio_data; |
| 141 | char m_battles_sound_played; |
| 105 | 142 | }; |
| 106 | 143 | |
| 107 | 144 | |
| r20825 | r20826 | |
| 138 | 175 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 139 | 176 | void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 140 | 177 | void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip); |
| 178 | DECLARE_WRITE8_MEMBER( bosco_videoram_w ); |
| 179 | DECLARE_WRITE8_MEMBER( bosco_scrollx_w ); |
| 180 | DECLARE_WRITE8_MEMBER( bosco_scrolly_w ); |
| 181 | DECLARE_WRITE8_MEMBER( bosco_starclr_w ); |
| 141 | 182 | }; |
| 142 | 183 | |
| 143 | 184 | class digdug_state : public galaga_state |
| r20825 | r20826 | |
| 165 | 206 | DECLARE_PALETTE_INIT(digdug); |
| 166 | 207 | UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 167 | 208 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 209 | DECLARE_WRITE8_MEMBER( digdug_videoram_w ); |
| 210 | DECLARE_WRITE8_MEMBER( digdug_PORT_w ); |
| 168 | 211 | }; |
| 169 | 212 | |
| 170 | | /*----------- defined in video/bosco.c -----------*/ |
| 171 | | |
| 172 | | DECLARE_WRITE8_HANDLER( bosco_videoram_w ); |
| 173 | | DECLARE_WRITE8_HANDLER( bosco_scrollx_w ); |
| 174 | | DECLARE_WRITE8_HANDLER( bosco_scrolly_w ); |
| 175 | | DECLARE_WRITE8_HANDLER( bosco_starclr_w ); |
| 176 | | |
| 177 | 213 | /*----------- defined in audio/galaga.c -----------*/ |
| 178 | 214 | |
| 179 | 215 | DISCRETE_SOUND_EXTERN( bosco ); |
| 180 | 216 | DISCRETE_SOUND_EXTERN( galaga ); |
| 181 | | |
| 182 | | |
| 183 | | /*----------- defined in video/galaga.c -----------*/ |
| 184 | | |
| 185 | | struct star |
| 186 | | { |
| 187 | | UINT16 x,y; |
| 188 | | UINT8 col,set; |
| 189 | | }; |
| 190 | | |
| 191 | | extern const struct star star_seed_tab[]; |
| 192 | | |
| 193 | | /*----------- defined in video/xevious.c -----------*/ |
| 194 | | |
| 195 | | DECLARE_WRITE8_HANDLER( xevious_fg_videoram_w ); |
| 196 | | DECLARE_WRITE8_HANDLER( xevious_fg_colorram_w ); |
| 197 | | DECLARE_WRITE8_HANDLER( xevious_bg_videoram_w ); |
| 198 | | DECLARE_WRITE8_HANDLER( xevious_bg_colorram_w ); |
| 199 | | DECLARE_WRITE8_HANDLER( xevious_vh_latch_w ); |
| 200 | | DECLARE_WRITE8_HANDLER( xevious_bs_w ); |
| 201 | | DECLARE_READ8_HANDLER( xevious_bb_r ); |
| 202 | | |
| 203 | | /*----------- defined in machine/xevious.c -----------*/ |
| 204 | | |
| 205 | | void battles_customio_init(running_machine &machine); |
| 206 | | |
| 207 | | DECLARE_READ8_HANDLER( battles_customio0_r ); |
| 208 | | DECLARE_READ8_HANDLER( battles_customio_data0_r ); |
| 209 | | DECLARE_READ8_HANDLER( battles_customio3_r ); |
| 210 | | DECLARE_READ8_HANDLER( battles_customio_data3_r ); |
| 211 | | DECLARE_READ8_HANDLER( battles_input_port_r ); |
| 212 | | |
| 213 | | DECLARE_WRITE8_HANDLER( battles_customio0_w ); |
| 214 | | DECLARE_WRITE8_HANDLER( battles_customio_data0_w ); |
| 215 | | DECLARE_WRITE8_HANDLER( battles_customio3_w ); |
| 216 | | DECLARE_WRITE8_HANDLER( battles_customio_data3_w ); |
| 217 | | DECLARE_WRITE8_HANDLER( battles_CPU4_coin_w ); |
| 218 | | DECLARE_WRITE8_HANDLER( battles_noise_sound_w ); |
| 219 | | |
| 220 | | /*----------- defined in video/digdug.c -----------*/ |
| 221 | | |
| 222 | | DECLARE_WRITE8_HANDLER( digdug_videoram_w ); |
| 223 | | DECLARE_WRITE8_HANDLER( digdug_PORT_w ); |
trunk/src/mame/drivers/galaga.c
| r20825 | r20826 | |
| 903 | 903 | MACHINE_RESET_MEMBER(xevious_state,battles) |
| 904 | 904 | { |
| 905 | 905 | MACHINE_RESET_CALL_MEMBER(galaga); |
| 906 | | battles_customio_init(machine()); |
| 906 | battles_customio_init(); |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | |
| r20825 | r20826 | |
| 917 | 917 | AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx_0", namco_06xx_data_r, namco_06xx_data_w) |
| 918 | 918 | AM_RANGE(0x7100, 0x7100) AM_DEVREADWRITE_LEGACY("06xx_0", namco_06xx_ctrl_r, namco_06xx_ctrl_w) |
| 919 | 919 | AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("share1") |
| 920 | | AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE_LEGACY(bosco_videoram_w) AM_SHARE("videoram")/* + sprite registers */ |
| 920 | AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(bosco_videoram_w) AM_SHARE("videoram")/* + sprite registers */ |
| 921 | 921 | AM_RANGE(0x9000, 0x90ff) AM_DEVREADWRITE_LEGACY("06xx_1", namco_06xx_data_r, namco_06xx_data_w) |
| 922 | 922 | AM_RANGE(0x9100, 0x9100) AM_DEVREADWRITE_LEGACY("06xx_1", namco_06xx_ctrl_r, namco_06xx_ctrl_w) |
| 923 | 923 | AM_RANGE(0x9800, 0x980f) AM_WRITEONLY AM_SHARE("bosco_radarattr") |
| 924 | | AM_RANGE(0x9810, 0x9810) AM_WRITE_LEGACY(bosco_scrollx_w) |
| 925 | | AM_RANGE(0x9820, 0x9820) AM_WRITE_LEGACY(bosco_scrolly_w) |
| 924 | AM_RANGE(0x9810, 0x9810) AM_WRITE(bosco_scrollx_w) |
| 925 | AM_RANGE(0x9820, 0x9820) AM_WRITE(bosco_scrolly_w) |
| 926 | 926 | AM_RANGE(0x9830, 0x9830) AM_WRITEONLY AM_SHARE("starcontrol") |
| 927 | | AM_RANGE(0x9840, 0x9840) AM_WRITE_LEGACY(bosco_starclr_w) |
| 927 | AM_RANGE(0x9840, 0x9840) AM_WRITE(bosco_starclr_w) |
| 928 | 928 | AM_RANGE(0x9870, 0x9870) AM_WRITE(bosco_flip_screen_w) |
| 929 | 929 | AM_RANGE(0x9874, 0x9875) AM_WRITEONLY AM_SHARE("bosco_starblink") |
| 930 | 930 | ADDRESS_MAP_END |
| r20825 | r20826 | |
| 959 | 959 | AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("xevious_sr1") /* work RAM + sprite registers */ |
| 960 | 960 | AM_RANGE(0x9000, 0x97ff) AM_RAM AM_SHARE("xevious_sr2") /* work RAM + sprite registers */ |
| 961 | 961 | AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("xevious_sr3") /* work RAM + sprite registers */ |
| 962 | | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE_LEGACY(xevious_fg_colorram_w) AM_SHARE("fg_colorram") |
| 963 | | AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE_LEGACY(xevious_bg_colorram_w) AM_SHARE("bg_colorram") |
| 964 | | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE_LEGACY(xevious_fg_videoram_w) AM_SHARE("fg_videoram") |
| 965 | | AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE_LEGACY(xevious_bg_videoram_w) AM_SHARE("bg_videoram") |
| 966 | | AM_RANGE(0xd000, 0xd07f) AM_WRITE_LEGACY(xevious_vh_latch_w) |
| 967 | | AM_RANGE(0xf000, 0xffff) AM_READWRITE_LEGACY(xevious_bb_r, xevious_bs_w) |
| 962 | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(xevious_fg_colorram_w) AM_SHARE("fg_colorram") |
| 963 | AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE(xevious_bg_colorram_w) AM_SHARE("bg_colorram") |
| 964 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(xevious_fg_videoram_w) AM_SHARE("fg_videoram") |
| 965 | AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(xevious_bg_videoram_w) AM_SHARE("bg_videoram") |
| 966 | AM_RANGE(0xd000, 0xd07f) AM_WRITE(xevious_vh_latch_w) |
| 967 | AM_RANGE(0xf000, 0xffff) AM_READWRITE(xevious_bb_r, xevious_bs_w) |
| 968 | 968 | ADDRESS_MAP_END |
| 969 | 969 | |
| 970 | 970 | |
| r20825 | r20826 | |
| 975 | 975 | AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w) |
| 976 | 976 | AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w) |
| 977 | 977 | AM_RANGE(0x7100, 0x7100) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_ctrl_r, namco_06xx_ctrl_w) |
| 978 | | AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE_LEGACY(digdug_videoram_w) AM_SHARE("videoram") /* tilemap RAM (bottom half of RAM 0 */ |
| 978 | AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(digdug_videoram_w) AM_SHARE("videoram") /* tilemap RAM (bottom half of RAM 0 */ |
| 979 | 979 | AM_RANGE(0x8400, 0x87ff) AM_RAM AM_SHARE("share1") /* work RAM (top half for RAM 0 */ |
| 980 | 980 | AM_RANGE(0x8800, 0x8bff) AM_RAM AM_SHARE("digdug_objram") /* work RAM + sprite registers */ |
| 981 | 981 | AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("digdug_posram") /* work RAM + sprite registers */ |
| 982 | 982 | AM_RANGE(0x9800, 0x9bff) AM_RAM AM_SHARE("digdug_flpram") /* work RAM + sprite registers */ |
| 983 | | AM_RANGE(0xa000, 0xa007) AM_READNOP AM_WRITE_LEGACY(digdug_PORT_w) /* video latches (spurious reads when setting latch bits) */ |
| 983 | AM_RANGE(0xa000, 0xa007) AM_READNOP AM_WRITE(digdug_PORT_w) /* video latches (spurious reads when setting latch bits) */ |
| 984 | 984 | AM_RANGE(0xb800, 0xb83f) AM_DEVREADWRITE("earom", atari_vg_earom_device, read, write) /* non volatile memory data */ |
| 985 | 985 | AM_RANGE(0xb840, 0xb840) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) /* non volatile memory control */ |
| 986 | 986 | ADDRESS_MAP_END |
| r20825 | r20826 | |
| 993 | 993 | AM_RANGE(0x1000, 0x107f) AM_RAM |
| 994 | 994 | ADDRESS_MAP_END |
| 995 | 995 | |
| 996 | | static ADDRESS_MAP_START( battles_mem4, AS_PROGRAM, 8, galaga_state ) |
| 996 | static ADDRESS_MAP_START( battles_mem4, AS_PROGRAM, 8, xevious_state ) |
| 997 | 997 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 998 | | AM_RANGE(0x4000, 0x4003) AM_READ_LEGACY(battles_input_port_r) |
| 999 | | AM_RANGE(0x4001, 0x4001) AM_WRITE_LEGACY(battles_CPU4_coin_w) |
| 1000 | | AM_RANGE(0x5000, 0x5000) AM_WRITE_LEGACY(battles_noise_sound_w) |
| 1001 | | AM_RANGE(0x6000, 0x6000) AM_READWRITE_LEGACY(battles_customio3_r, battles_customio3_w) |
| 1002 | | AM_RANGE(0x7000, 0x7000) AM_READWRITE_LEGACY(battles_customio_data3_r, battles_customio_data3_w) |
| 998 | AM_RANGE(0x4000, 0x4003) AM_READ(battles_input_port_r) |
| 999 | AM_RANGE(0x4001, 0x4001) AM_WRITE(battles_CPU4_coin_w) |
| 1000 | AM_RANGE(0x5000, 0x5000) AM_WRITE(battles_noise_sound_w) |
| 1001 | AM_RANGE(0x6000, 0x6000) AM_READWRITE(battles_customio3_r, battles_customio3_w) |
| 1002 | AM_RANGE(0x7000, 0x7000) AM_READWRITE(battles_customio_data3_r, battles_customio_data3_w) |
| 1003 | 1003 | AM_RANGE(0x8000, 0x80ff) AM_RAM |
| 1004 | 1004 | ADDRESS_MAP_END |
| 1005 | 1005 | |
| r20825 | r20826 | |
| 3348 | 3348 | DRIVER_INIT_MEMBER(xevious_state,battles) |
| 3349 | 3349 | { |
| 3350 | 3350 | /* replace the Namco I/O handlers with interface to the 4th CPU */ |
| 3351 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) ); |
| 3352 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) ); |
| 3351 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x7000, 0x700f, read8_delegate(FUNC(xevious_state::battles_customio_data0_r),this), write8_delegate(FUNC(xevious_state::battles_customio_data0_w),this) ); |
| 3352 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x7100, 0x7100, read8_delegate(FUNC(xevious_state::battles_customio0_r),this), write8_delegate(FUNC(xevious_state::battles_customio0_w),this) ); |
| 3353 | 3353 | |
| 3354 | 3354 | DRIVER_INIT_CALL(xevious); |
| 3355 | 3355 | } |