trunk/src/mame/video/cyberbal.c
| r20357 | r20358 | |
| 63 | 63 | * |
| 64 | 64 | *************************************/ |
| 65 | 65 | |
| 66 | | static void video_start_cyberbal_common(running_machine &machine, int screens) |
| 66 | void cyberbal_state::video_start_common(int screens) |
| 67 | 67 | { |
| 68 | 68 | static const atarimo_desc mo0desc = |
| 69 | 69 | { |
| r20357 | r20358 | |
| 138 | 138 | 0, /* resulting value to indicate "special" */ |
| 139 | 139 | 0 /* callback routine for special entries */ |
| 140 | 140 | }; |
| 141 | | cyberbal_state *state = machine.driver_data<cyberbal_state>(); |
| 142 | 141 | |
| 143 | 142 | /* initialize the playfield */ |
| 144 | | state->m_playfield_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,64); |
| 143 | m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64); |
| 145 | 144 | |
| 146 | 145 | /* initialize the motion objects */ |
| 147 | | atarimo_init(machine, 0, &mo0desc); |
| 148 | | atarimo_set_slipram(0, &state->m_current_slip[0]); |
| 146 | atarimo_init(machine(), 0, &mo0desc); |
| 147 | atarimo_set_slipram(0, &m_current_slip[0]); |
| 149 | 148 | |
| 150 | 149 | /* initialize the alphanumerics */ |
| 151 | | state->m_alpha_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,32); |
| 152 | | state->m_alpha_tilemap->set_transparent_pen(0); |
| 150 | m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32); |
| 151 | m_alpha_tilemap->set_transparent_pen(0); |
| 153 | 152 | |
| 154 | 153 | /* allocate the second screen if necessary */ |
| 155 | 154 | if (screens == 2) |
| 156 | 155 | { |
| 157 | 156 | /* initialize the playfield */ |
| 158 | | state->m_playfield2_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield2_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,64); |
| 159 | | state->m_playfield2_tilemap->set_scrollx(0, 0); |
| 157 | m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64); |
| 158 | m_playfield2_tilemap->set_scrollx(0, 0); |
| 160 | 159 | |
| 161 | 160 | /* initialize the motion objects */ |
| 162 | | atarimo_init(machine, 1, &mo1desc); |
| 163 | | atarimo_set_slipram(1, &state->m_current_slip[1]); |
| 161 | atarimo_init(machine(), 1, &mo1desc); |
| 162 | atarimo_set_slipram(1, &m_current_slip[1]); |
| 164 | 163 | |
| 165 | 164 | /* initialize the alphanumerics */ |
| 166 | | state->m_alpha2_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha2_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,32); |
| 167 | | state->m_alpha2_tilemap->set_scrollx(0, 0); |
| 168 | | state->m_alpha2_tilemap->set_transparent_pen(0); |
| 165 | m_alpha2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32); |
| 166 | m_alpha2_tilemap->set_scrollx(0, 0); |
| 167 | m_alpha2_tilemap->set_transparent_pen(0); |
| 169 | 168 | } |
| 170 | 169 | |
| 171 | 170 | /* save states */ |
| 172 | | state->save_item(NAME(state->m_current_slip)); |
| 173 | | state->save_item(NAME(state->m_playfield_palette_bank)); |
| 174 | | state->save_item(NAME(state->m_playfield_xscroll)); |
| 175 | | state->save_item(NAME(state->m_playfield_yscroll)); |
| 171 | save_item(NAME(m_current_slip)); |
| 172 | save_item(NAME(m_playfield_palette_bank)); |
| 173 | save_item(NAME(m_playfield_xscroll)); |
| 174 | save_item(NAME(m_playfield_yscroll)); |
| 176 | 175 | } |
| 177 | 176 | |
| 178 | 177 | |
| 179 | 178 | VIDEO_START_MEMBER(cyberbal_state,cyberbal) |
| 180 | 179 | { |
| 181 | | video_start_cyberbal_common(machine(), 2); |
| 180 | video_start_common(2); |
| 182 | 181 | |
| 183 | 182 | /* adjust the sprite positions */ |
| 184 | 183 | atarimo_set_xscroll(0, 4); |
| r20357 | r20358 | |
| 188 | 187 | |
| 189 | 188 | VIDEO_START_MEMBER(cyberbal_state,cyberbal2p) |
| 190 | 189 | { |
| 191 | | video_start_cyberbal_common(machine(), 1); |
| 190 | video_start_common(1); |
| 192 | 191 | |
| 193 | 192 | /* adjust the sprite positions */ |
| 194 | 193 | atarimo_set_xscroll(0, 5); |
| r20357 | r20358 | |
| 221 | 220 | * |
| 222 | 221 | *************************************/ |
| 223 | 222 | |
| 224 | | WRITE16_HANDLER( cyberbal_paletteram_0_w ) |
| 223 | WRITE16_HANDLER(cyberbal_state::paletteram_0_w) |
| 225 | 224 | { |
| 226 | | cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); |
| 227 | | COMBINE_DATA(&state->m_paletteram_0[offset]); |
| 228 | | set_palette_entry(space.machine(), offset, state->m_paletteram_0[offset]); |
| 225 | COMBINE_DATA(&m_paletteram_0[offset]); |
| 226 | set_palette_entry(machine(), offset, m_paletteram_0[offset]); |
| 229 | 227 | } |
| 230 | 228 | |
| 231 | | READ16_HANDLER( cyberbal_paletteram_0_r ) |
| 229 | READ16_HANDLER(cyberbal_state::paletteram_0_r) |
| 232 | 230 | { |
| 233 | | cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); |
| 234 | | return state->m_paletteram_0[offset]; |
| 231 | return m_paletteram_0[offset]; |
| 235 | 232 | } |
| 236 | 233 | |
| 237 | 234 | |
| 238 | | WRITE16_HANDLER( cyberbal_paletteram_1_w ) |
| 235 | WRITE16_HANDLER(cyberbal_state::paletteram_1_w) |
| 239 | 236 | { |
| 240 | | cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); |
| 241 | | COMBINE_DATA(&state->m_paletteram_1[offset]); |
| 242 | | set_palette_entry(space.machine(), offset + 0x800, state->m_paletteram_1[offset]); |
| 237 | COMBINE_DATA(&m_paletteram_1[offset]); |
| 238 | set_palette_entry(machine(), offset + 0x800, m_paletteram_1[offset]); |
| 243 | 239 | } |
| 244 | 240 | |
| 245 | | READ16_HANDLER( cyberbal_paletteram_1_r ) |
| 241 | READ16_HANDLER(cyberbal_state::paletteram_1_r) |
| 246 | 242 | { |
| 247 | | cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); |
| 248 | | return state->m_paletteram_1[offset]; |
| 243 | return m_paletteram_1[offset]; |
| 249 | 244 | } |
| 250 | 245 | |
| 251 | 246 | |
| r20357 | r20358 | |
| 328 | 323 | * |
| 329 | 324 | *************************************/ |
| 330 | 325 | |
| 331 | | static UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) |
| 326 | UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) |
| 332 | 327 | { |
| 333 | | cyberbal_state *state = screen.machine().driver_data<cyberbal_state>(); |
| 334 | 328 | atarimo_rect_list rectlist; |
| 335 | 329 | rectangle tempclip = cliprect; |
| 336 | 330 | bitmap_ind16 *mobitmap; |
| r20357 | r20358 | |
| 338 | 332 | rectangle visarea = screen.visible_area(); |
| 339 | 333 | |
| 340 | 334 | /* draw the playfield */ |
| 341 | | ((index == 0) ? state->m_playfield_tilemap : state->m_playfield2_tilemap)->draw(bitmap, cliprect, 0, 0); |
| 335 | ((index == 0) ? m_playfield_tilemap : m_playfield2_tilemap)->draw(bitmap, cliprect, 0, 0); |
| 342 | 336 | |
| 343 | 337 | /* draw the MOs -- note some kludging to get this to work correctly for 2 screens */ |
| 344 | 338 | mooffset = 0; |
| r20357 | r20358 | |
| 371 | 365 | } |
| 372 | 366 | |
| 373 | 367 | /* add the alpha on top */ |
| 374 | | ((index == 0) ? state->m_alpha_tilemap : state->m_alpha2_tilemap)->draw(bitmap, cliprect, 0, 0); |
| 368 | ((index == 0) ? m_alpha_tilemap : m_alpha2_tilemap)->draw(bitmap, cliprect, 0, 0); |
| 375 | 369 | return 0; |
| 376 | 370 | } |
| 377 | 371 | |
trunk/src/mame/video/atarisy2.c
| r20357 | r20358 | |
| 13 | 13 | |
| 14 | 14 | /************************************* |
| 15 | 15 | * |
| 16 | | * Prototypes |
| 17 | | * |
| 18 | | *************************************/ |
| 19 | | |
| 20 | | |
| 21 | | |
| 22 | | |
| 23 | | |
| 24 | | /************************************* |
| 25 | | * |
| 26 | 16 | * Tilemap callbacks |
| 27 | 17 | * |
| 28 | 18 | *************************************/ |
| r20357 | r20358 | |
| 124 | 114 | * |
| 125 | 115 | *************************************/ |
| 126 | 116 | |
| 127 | | WRITE16_HANDLER( atarisy2_xscroll_w ) |
| 117 | WRITE16_HANDLER( atarisy2_state::xscroll_w ) |
| 128 | 118 | { |
| 129 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 130 | | UINT16 oldscroll = *state->m_xscroll; |
| 119 | UINT16 oldscroll = *m_xscroll; |
| 131 | 120 | UINT16 newscroll = oldscroll; |
| 132 | 121 | COMBINE_DATA(&newscroll); |
| 133 | 122 | |
| r20357 | r20358 | |
| 136 | 125 | space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos()); |
| 137 | 126 | |
| 138 | 127 | /* update the playfield scrolling - hscroll is clocked on the following scanline */ |
| 139 | | state->m_playfield_tilemap->set_scrollx(0, newscroll >> 6); |
| 128 | m_playfield_tilemap->set_scrollx(0, newscroll >> 6); |
| 140 | 129 | |
| 141 | 130 | /* update the playfield banking */ |
| 142 | | if (state->m_playfield_tile_bank[0] != (newscroll & 0x0f) * 0x400) |
| 131 | if (m_playfield_tile_bank[0] != (newscroll & 0x0f) * 0x400) |
| 143 | 132 | { |
| 144 | | state->m_playfield_tile_bank[0] = (newscroll & 0x0f) * 0x400; |
| 145 | | state->m_playfield_tilemap->mark_all_dirty(); |
| 133 | m_playfield_tile_bank[0] = (newscroll & 0x0f) * 0x400; |
| 134 | m_playfield_tilemap->mark_all_dirty(); |
| 146 | 135 | } |
| 147 | 136 | |
| 148 | 137 | /* update the data */ |
| 149 | | *state->m_xscroll = newscroll; |
| 138 | *m_xscroll = newscroll; |
| 150 | 139 | } |
| 151 | 140 | |
| 152 | 141 | |
| r20357 | r20358 | |
| 156 | 145 | } |
| 157 | 146 | |
| 158 | 147 | |
| 159 | | WRITE16_HANDLER( atarisy2_yscroll_w ) |
| 148 | WRITE16_HANDLER( atarisy2_state::yscroll_w ) |
| 160 | 149 | { |
| 161 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 162 | | UINT16 oldscroll = *state->m_yscroll; |
| 150 | UINT16 oldscroll = *m_yscroll; |
| 163 | 151 | UINT16 newscroll = oldscroll; |
| 164 | 152 | COMBINE_DATA(&newscroll); |
| 165 | 153 | |
| r20357 | r20358 | |
| 169 | 157 | |
| 170 | 158 | /* if bit 4 is zero, the scroll value is clocked in right away */ |
| 171 | 159 | if (!(newscroll & 0x10)) |
| 172 | | state->m_playfield_tilemap->set_scrolly(0, (newscroll >> 6) - space.machine().primary_screen->vpos()); |
| 160 | m_playfield_tilemap->set_scrolly(0, (newscroll >> 6) - space.machine().primary_screen->vpos()); |
| 173 | 161 | else |
| 174 | | state->m_yscroll_reset_timer->adjust(space.machine().primary_screen->time_until_pos(0), newscroll >> 6); |
| 162 | m_yscroll_reset_timer->adjust(space.machine().primary_screen->time_until_pos(0), newscroll >> 6); |
| 175 | 163 | |
| 176 | 164 | /* update the playfield banking */ |
| 177 | | if (state->m_playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400) |
| 165 | if (m_playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400) |
| 178 | 166 | { |
| 179 | | state->m_playfield_tile_bank[1] = (newscroll & 0x0f) * 0x400; |
| 180 | | state->m_playfield_tilemap->mark_all_dirty(); |
| 167 | m_playfield_tile_bank[1] = (newscroll & 0x0f) * 0x400; |
| 168 | m_playfield_tilemap->mark_all_dirty(); |
| 181 | 169 | } |
| 182 | 170 | |
| 183 | 171 | /* update the data */ |
| 184 | | *state->m_yscroll = newscroll; |
| 172 | *m_yscroll = newscroll; |
| 185 | 173 | } |
| 186 | 174 | |
| 187 | 175 | |
| r20357 | r20358 | |
| 192 | 180 | * |
| 193 | 181 | *************************************/ |
| 194 | 182 | |
| 195 | | WRITE16_HANDLER( atarisy2_paletteram_w ) |
| 183 | WRITE16_HANDLER( atarisy2_state::paletteram_w ) |
| 196 | 184 | { |
| 197 | 185 | static const int intensity_table[16] = |
| 198 | 186 | { |
| r20357 | r20358 | |
| 209 | 197 | |
| 210 | 198 | int newword, inten, red, green, blue; |
| 211 | 199 | |
| 212 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 213 | | COMBINE_DATA(&state->m_generic_paletteram_16[offset]); |
| 214 | | newword = state->m_generic_paletteram_16[offset]; |
| 200 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| 201 | newword = m_generic_paletteram_16[offset]; |
| 215 | 202 | |
| 216 | 203 | inten = intensity_table[newword & 15]; |
| 217 | 204 | red = (color_table[(newword >> 12) & 15] * inten) >> 4; |
| r20357 | r20358 | |
| 228 | 215 | * |
| 229 | 216 | *************************************/ |
| 230 | 217 | |
| 231 | | READ16_HANDLER( atarisy2_slapstic_r ) |
| 218 | READ16_HANDLER( atarisy2_state::slapstic_r ) |
| 232 | 219 | { |
| 233 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 234 | | int result = state->m_slapstic_base[offset]; |
| 220 | int result = m_slapstic_base[offset]; |
| 235 | 221 | slapstic_tweak(space, offset); |
| 236 | 222 | |
| 237 | 223 | /* an extra tweak for the next opcode fetch */ |
| 238 | | state->m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; |
| 224 | m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; |
| 239 | 225 | return result; |
| 240 | 226 | } |
| 241 | 227 | |
| 242 | 228 | |
| 243 | | WRITE16_HANDLER( atarisy2_slapstic_w ) |
| 229 | WRITE16_HANDLER( atarisy2_state::slapstic_w ) |
| 244 | 230 | { |
| 245 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 246 | | |
| 247 | 231 | slapstic_tweak(space, offset); |
| 248 | 232 | |
| 249 | 233 | /* an extra tweak for the next opcode fetch */ |
| 250 | | state->m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; |
| 234 | m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; |
| 251 | 235 | } |
| 252 | 236 | |
| 253 | 237 | |
| r20357 | r20358 | |
| 258 | 242 | * |
| 259 | 243 | *************************************/ |
| 260 | 244 | |
| 261 | | READ16_HANDLER( atarisy2_videoram_r ) |
| 245 | READ16_HANDLER( atarisy2_state::videoram_r ) |
| 262 | 246 | { |
| 263 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 264 | | int offs = offset | state->m_videobank; |
| 247 | int offs = offset | m_videobank; |
| 265 | 248 | if (offs >= 0xc00 && offs < 0x1000) |
| 266 | 249 | { |
| 267 | 250 | return atarimo_0_spriteram_r(space, offs - 0x0c00, mem_mask); |
| 268 | 251 | } |
| 269 | 252 | |
| 270 | | return state->m_vram[offs]; |
| 253 | return m_vram[offs]; |
| 271 | 254 | } |
| 272 | 255 | |
| 273 | 256 | |
| 274 | | WRITE16_HANDLER( atarisy2_videoram_w ) |
| 257 | WRITE16_HANDLER( atarisy2_state::videoram_w ) |
| 275 | 258 | { |
| 276 | | atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); |
| 277 | | int offs = offset | state->m_videobank; |
| 259 | int offs = offset | m_videobank; |
| 278 | 260 | |
| 279 | 261 | /* alpharam? */ |
| 280 | 262 | if (offs < 0x0c00) |
| 281 | 263 | { |
| 282 | | COMBINE_DATA(&state->m_alpha[offs]); |
| 283 | | state->m_alpha_tilemap->mark_tile_dirty(offs); |
| 264 | COMBINE_DATA(&m_alpha[offs]); |
| 265 | m_alpha_tilemap->mark_tile_dirty(offs); |
| 284 | 266 | } |
| 285 | 267 | |
| 286 | 268 | /* spriteram? */ |
| r20357 | r20358 | |
| 288 | 270 | { |
| 289 | 271 | /* force an update if the link of object 0 is about to change */ |
| 290 | 272 | if (offs == 0x0c03) |
| 291 | | space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos()); |
| 273 | space.machine().primary_screen->update_partial(machine().primary_screen->vpos()); |
| 292 | 274 | atarimo_0_spriteram_w(space, offs - 0x0c00, data, mem_mask); |
| 293 | 275 | } |
| 294 | 276 | |
| r20357 | r20358 | |
| 296 | 278 | else if (offs >= 0x2000) |
| 297 | 279 | { |
| 298 | 280 | offs -= 0x2000; |
| 299 | | COMBINE_DATA(&state->m_playfield[offs]); |
| 300 | | state->m_playfield_tilemap->mark_tile_dirty(offs); |
| 281 | COMBINE_DATA(&m_playfield[offs]); |
| 282 | m_playfield_tilemap->mark_tile_dirty(offs); |
| 301 | 283 | } |
| 302 | 284 | |
| 303 | 285 | /* generic case */ |
| 304 | 286 | else |
| 305 | 287 | { |
| 306 | | COMBINE_DATA(&state->m_vram[offs]); |
| 288 | COMBINE_DATA(&m_vram[offs]); |
| 307 | 289 | } |
| 308 | 290 | } |
| 309 | 291 | |
trunk/src/mame/includes/cyberbal.h
| r20357 | r20358 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "machine/atarigen.h" |
| 8 | #include "cpu/m68000/m68000.h" |
| 9 | #include "cpu/m6502/m6502.h" |
| 10 | #include "sound/dac.h" |
| 8 | 11 | |
| 9 | 12 | class cyberbal_state : public atarigen_state |
| 10 | 13 | { |
| 11 | 14 | public: |
| 12 | 15 | cyberbal_state(const machine_config &mconfig, device_type type, const char *tag) |
| 13 | 16 | : atarigen_state(mconfig, type, tag), |
| 17 | m_maincpu(*this, "maincpu"), |
| 18 | m_audiocpu(*this, "audiocpu"), |
| 19 | m_extracpu(*this, "extra"), |
| 20 | m_daccpu(*this, "dac"), |
| 21 | m_dac1(*this, "dac1"), |
| 22 | m_dac2(*this, "dac2"), |
| 14 | 23 | m_paletteram_0(*this, "paletteram_0"), |
| 15 | 24 | m_paletteram_1(*this, "paletteram_1") { } |
| 16 | 25 | |
| 26 | required_device<m68000_device> m_maincpu; |
| 27 | optional_device<m6502_device> m_audiocpu; |
| 28 | optional_device<m68000_device> m_extracpu; |
| 29 | optional_device<m68000_device> m_daccpu; |
| 30 | optional_device<dac_device> m_dac1; |
| 31 | optional_device<dac_device> m_dac2; |
| 17 | 32 | optional_shared_ptr<UINT16> m_paletteram_0; |
| 18 | 33 | optional_shared_ptr<UINT16> m_paletteram_1; |
| 19 | 34 | UINT16 m_current_slip[2]; |
| r20357 | r20358 | |
| 34 | 49 | DECLARE_READ16_MEMBER(special_port2_r); |
| 35 | 50 | DECLARE_READ16_MEMBER(sound_state_r); |
| 36 | 51 | DECLARE_WRITE16_MEMBER(p2_reset_w); |
| 37 | | DECLARE_READ8_MEMBER(cyberbal_special_port3_r); |
| 38 | | DECLARE_READ8_MEMBER(cyberbal_sound_6502_stat_r); |
| 39 | | DECLARE_WRITE8_MEMBER(cyberbal_sound_bank_select_w); |
| 40 | | DECLARE_READ8_MEMBER(cyberbal_sound_68k_6502_r); |
| 41 | | DECLARE_WRITE8_MEMBER(cyberbal_sound_68k_6502_w); |
| 42 | | DECLARE_WRITE16_MEMBER(cyberbal_io_68k_irq_ack_w); |
| 43 | | DECLARE_READ16_MEMBER(cyberbal_sound_68k_r); |
| 44 | | DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_w); |
| 45 | | DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_dac_w); |
| 52 | DECLARE_READ8_MEMBER(special_port3_r); |
| 53 | DECLARE_READ8_MEMBER(sound_6502_stat_r); |
| 54 | DECLARE_WRITE8_MEMBER(sound_bank_select_w); |
| 55 | DECLARE_READ8_MEMBER(sound_68k_6502_r); |
| 56 | DECLARE_WRITE8_MEMBER(sound_68k_6502_w); |
| 57 | DECLARE_WRITE16_MEMBER(io_68k_irq_ack_w); |
| 58 | DECLARE_READ16_MEMBER(sound_68k_r); |
| 59 | DECLARE_WRITE16_MEMBER(sound_68k_w); |
| 60 | DECLARE_WRITE16_MEMBER(sound_68k_dac_w); |
| 46 | 61 | DECLARE_DRIVER_INIT(cyberbalt); |
| 47 | 62 | DECLARE_DRIVER_INIT(cyberbal2p); |
| 48 | 63 | DECLARE_DRIVER_INIT(cyberbal); |
| r20357 | r20358 | |
| 58 | 73 | UINT32 screen_update_cyberbal_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 74 | UINT32 screen_update_cyberbal_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 60 | 75 | UINT32 screen_update_cyberbal2p(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | | INTERRUPT_GEN_MEMBER(cyberbal_sound_68k_irq_gen); |
| 76 | INTERRUPT_GEN_MEMBER(sound_68k_irq_gen); |
| 77 | DECLARE_READ16_MEMBER(paletteram_0_r); |
| 78 | DECLARE_READ16_MEMBER(paletteram_1_r); |
| 79 | DECLARE_WRITE16_MEMBER(paletteram_0_w); |
| 80 | DECLARE_WRITE16_MEMBER(paletteram_1_w); |
| 81 | private: |
| 82 | void video_start_common(int screens); |
| 83 | void cyberbal_sound_reset(); |
| 84 | UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index); |
| 85 | void update_sound_68k_interrupts(); |
| 62 | 86 | }; |
| 63 | | |
| 64 | | /*----------- defined in audio/cyberbal.c -----------*/ |
| 65 | | |
| 66 | | void cyberbal_sound_reset(running_machine &machine); |
| 67 | | |
| 68 | | /*----------- defined in video/cyberbal.c -----------*/ |
| 69 | | |
| 70 | | DECLARE_READ16_HANDLER( cyberbal_paletteram_0_r ); |
| 71 | | DECLARE_READ16_HANDLER( cyberbal_paletteram_1_r ); |
| 72 | | DECLARE_WRITE16_HANDLER( cyberbal_paletteram_0_w ); |
| 73 | | DECLARE_WRITE16_HANDLER( cyberbal_paletteram_1_w ); |
| 74 | | |
| 75 | | void cyberbal_scanline_update(screen_device &screen, int scanline); |
trunk/src/mame/includes/atarig1.h
| r20357 | r20358 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "machine/atarigen.h" |
| 8 | #include "cpu/m68000/m68000.h" |
| 8 | 9 | |
| 9 | 10 | class atarig1_state : public atarigen_state |
| 10 | 11 | { |
| 11 | 12 | public: |
| 12 | 13 | atarig1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 13 | 14 | : atarigen_state(mconfig, type, tag), |
| 15 | m_maincpu(*this, "maincpu"), |
| 14 | 16 | m_mo_command(*this, "mo_command") { } |
| 15 | 17 | |
| 16 | | UINT8 m_is_pitfight; |
| 18 | required_device<m68000_device> m_maincpu; |
| 17 | 19 | |
| 20 | bool m_is_pitfight; |
| 21 | |
| 18 | 22 | UINT8 m_which_input; |
| 19 | 23 | required_shared_ptr<UINT16> m_mo_command; |
| 20 | 24 | |
| 21 | 25 | UINT16 * m_bslapstic_base; |
| 22 | 26 | void * m_bslapstic_bank0; |
| 23 | 27 | UINT8 m_bslapstic_bank; |
| 24 | | UINT8 m_bslapstic_primed; |
| 28 | bool m_bslapstic_primed; |
| 25 | 29 | |
| 26 | 30 | int m_pfscroll_xoffset; |
| 27 | 31 | UINT16 m_current_control; |
| r20357 | r20358 | |
| 30 | 34 | UINT16 m_playfield_yscroll; |
| 31 | 35 | |
| 32 | 36 | device_t * m_rle; |
| 37 | virtual void device_post_load(); |
| 33 | 38 | virtual void update_interrupts(); |
| 34 | 39 | virtual void scanline_update(screen_device &screen, int scanline); |
| 35 | 40 | DECLARE_WRITE16_MEMBER(mo_control_w); |
| r20357 | r20358 | |
| 53 | 58 | DECLARE_VIDEO_START(atarig1); |
| 54 | 59 | UINT32 screen_update_atarig1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | 60 | void screen_eof_atarig1(screen_device &screen, bool state); |
| 61 | private: |
| 62 | void init_common(offs_t slapstic_base, int slapstic, bool is_pitfight); |
| 63 | void pitfightb_cheap_slapstic_init(); |
| 56 | 64 | }; |
| 57 | | |
| 58 | | /*----------- defined in video/atarig1.c -----------*/ |
| 59 | | void atarig1_scanline_update(screen_device &screen, int scanline); |
trunk/src/mame/includes/atarisy2.h
| r20357 | r20358 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "machine/atarigen.h" |
| 8 | #include "cpu/m6502/m6502.h" |
| 9 | #include "cpu/t11/t11.h" |
| 8 | 10 | |
| 9 | 11 | class atarisy2_state : public atarigen_state |
| 10 | 12 | { |
| 11 | 13 | public: |
| 12 | 14 | atarisy2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 13 | 15 | : atarigen_state(mconfig, type, tag), |
| 16 | m_maincpu(*this, "maincpu"), |
| 17 | m_audiocpu(*this, "audiocpu"), |
| 14 | 18 | m_slapstic_base(*this, "slapstic_base"), |
| 15 | 19 | m_bankselect(*this, "bankselect"), |
| 16 | 20 | m_rombank1(*this, "rombank1"), |
| 17 | 21 | m_rombank2(*this, "rombank2") { } |
| 18 | 22 | |
| 23 | required_device<t11_device> m_maincpu; |
| 24 | required_device<m6502_device> m_audiocpu; |
| 19 | 25 | required_shared_ptr<UINT16> m_slapstic_base; |
| 20 | 26 | |
| 21 | 27 | UINT8 m_interrupt_enable; |
| r20357 | r20358 | |
| 49 | 55 | UINT32 m_spin_center_count; |
| 50 | 56 | |
| 51 | 57 | UINT16 m_vram[0x8000/2]; |
| 58 | |
| 59 | virtual void device_post_load(); |
| 60 | |
| 52 | 61 | virtual void update_interrupts(); |
| 53 | 62 | virtual void scanline_update(screen_device &screen, int scanline); |
| 54 | 63 | DECLARE_WRITE16_MEMBER(int0_ack_w); |
| r20357 | r20358 | |
| 84 | 93 | INTERRUPT_GEN_MEMBER(vblank_int); |
| 85 | 94 | TIMER_CALLBACK_MEMBER(delayed_int_enable_w); |
| 86 | 95 | TIMER_CALLBACK_MEMBER(reset_yscroll_callback); |
| 96 | DECLARE_READ16_MEMBER(slapstic_r); |
| 97 | DECLARE_READ16_MEMBER(videoram_r); |
| 98 | DECLARE_WRITE16_MEMBER(slapstic_w); |
| 99 | DECLARE_WRITE16_MEMBER(yscroll_w); |
| 100 | DECLARE_WRITE16_MEMBER(xscroll_w); |
| 101 | DECLARE_WRITE16_MEMBER(videoram_w); |
| 102 | DECLARE_WRITE16_MEMBER(paletteram_w); |
| 87 | 103 | }; |
| 88 | | |
| 89 | | |
| 90 | | /*----------- defined in video/atarisy2.c -----------*/ |
| 91 | | |
| 92 | | DECLARE_READ16_HANDLER( atarisy2_slapstic_r ); |
| 93 | | DECLARE_READ16_HANDLER( atarisy2_videoram_r ); |
| 94 | | |
| 95 | | DECLARE_WRITE16_HANDLER( atarisy2_slapstic_w ); |
| 96 | | DECLARE_WRITE16_HANDLER( atarisy2_yscroll_w ); |
| 97 | | DECLARE_WRITE16_HANDLER( atarisy2_xscroll_w ); |
| 98 | | DECLARE_WRITE16_HANDLER( atarisy2_videoram_w ); |
| 99 | | DECLARE_WRITE16_HANDLER( atarisy2_paletteram_w ); |
trunk/src/mame/drivers/atarig1.c
| r20357 | r20358 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | #include "emu.h" |
| 22 | | #include "cpu/m68000/m68000.h" |
| 23 | 22 | #include "audio/atarijsa.h" |
| 24 | 23 | #include "video/atarirle.h" |
| 25 | 24 | #include "includes/atarig1.h" |
| r20357 | r20358 | |
| 34 | 33 | |
| 35 | 34 | void atarig1_state::update_interrupts() |
| 36 | 35 | { |
| 37 | | machine().device("maincpu")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 38 | | machine().device("maincpu")->execute().set_input_line(2, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 36 | m_maincpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 37 | m_maincpu->set_input_line(2, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 39 | 38 | } |
| 40 | 39 | |
| 41 | 40 | |
| r20357 | r20358 | |
| 139 | 138 | } |
| 140 | 139 | |
| 141 | 140 | |
| 142 | | static void pitfightb_state_postload(running_machine &machine) |
| 141 | void atarig1_state::device_post_load() |
| 143 | 142 | { |
| 144 | | atarig1_state *state = machine.driver_data<atarig1_state>(); |
| 145 | | int bank = state->m_bslapstic_bank; |
| 146 | | state->m_bslapstic_bank = -1; |
| 147 | | state->update_bank(bank); |
| 143 | if (m_bslapstic_base != NULL) |
| 144 | { |
| 145 | int bank = m_bslapstic_bank; |
| 146 | m_bslapstic_bank = -1; |
| 147 | update_bank(bank); |
| 148 | } |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | |
| r20357 | r20358 | |
| 157 | 158 | |
| 158 | 159 | /* offset 0 primes the chip */ |
| 159 | 160 | if (offset == 0) |
| 160 | | m_bslapstic_primed = TRUE; |
| 161 | m_bslapstic_primed = true; |
| 161 | 162 | |
| 162 | 163 | /* one of 4 bankswitchers produces the result */ |
| 163 | 164 | else if (m_bslapstic_primed) |
| 164 | 165 | { |
| 165 | 166 | if (offset == 0x42) |
| 166 | | update_bank(0), m_bslapstic_primed = FALSE; |
| 167 | update_bank(0), m_bslapstic_primed = false; |
| 167 | 168 | else if (offset == 0x52) |
| 168 | | update_bank(1), m_bslapstic_primed = FALSE; |
| 169 | update_bank(1), m_bslapstic_primed = false; |
| 169 | 170 | else if (offset == 0x62) |
| 170 | | update_bank(2), m_bslapstic_primed = FALSE; |
| 171 | update_bank(2), m_bslapstic_primed = false; |
| 171 | 172 | else if (offset == 0x72) |
| 172 | | update_bank(3), m_bslapstic_primed = FALSE; |
| 173 | update_bank(3), m_bslapstic_primed = false; |
| 173 | 174 | } |
| 174 | 175 | return result; |
| 175 | 176 | } |
| 176 | 177 | |
| 177 | 178 | |
| 178 | | static void pitfightb_cheap_slapstic_init(running_machine &machine) |
| 179 | void atarig1_state::pitfightb_cheap_slapstic_init() |
| 179 | 180 | { |
| 180 | | atarig1_state *state = machine.driver_data<atarig1_state>(); |
| 181 | | |
| 182 | 181 | /* install a read handler */ |
| 183 | | state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state)); |
| 182 | m_bslapstic_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),this)); |
| 184 | 183 | |
| 185 | 184 | /* allocate memory for a copy of bank 0 */ |
| 186 | | state->m_bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000); |
| 187 | | memcpy(state->m_bslapstic_bank0, state->m_bslapstic_base, 0x2000); |
| 185 | m_bslapstic_bank0 = auto_alloc_array(machine(), UINT8, 0x2000); |
| 186 | memcpy(m_bslapstic_bank0, m_bslapstic_base, 0x2000); |
| 188 | 187 | |
| 189 | 188 | /* not primed by default */ |
| 190 | | state->m_bslapstic_primed = FALSE; |
| 189 | m_bslapstic_primed = false; |
| 191 | 190 | } |
| 192 | 191 | |
| 193 | 192 | |
| r20357 | r20358 | |
| 1205 | 1204 | * |
| 1206 | 1205 | *************************************/ |
| 1207 | 1206 | |
| 1208 | | static void init_g1_common(running_machine &machine, offs_t slapstic_base, int slapstic, int is_pitfight) |
| 1207 | void atarig1_state::init_common(offs_t slapstic_base, int slapstic, bool is_pitfight) |
| 1209 | 1208 | { |
| 1210 | | atarig1_state *state = machine.driver_data<atarig1_state>(); |
| 1211 | | |
| 1212 | | state->m_eeprom_default = NULL; |
| 1209 | m_eeprom_default = NULL; |
| 1213 | 1210 | if (slapstic == -1) |
| 1214 | 1211 | { |
| 1215 | | pitfightb_cheap_slapstic_init(machine); |
| 1216 | | state->save_item(NAME(state->m_bslapstic_bank)); |
| 1217 | | state->save_item(NAME(state->m_bslapstic_primed)); |
| 1218 | | machine.save().register_postload(save_prepost_delegate(FUNC(pitfightb_state_postload), &machine)); |
| 1212 | pitfightb_cheap_slapstic_init(); |
| 1213 | save_item(NAME(m_bslapstic_bank)); |
| 1214 | save_item(NAME(m_bslapstic_primed)); |
| 1219 | 1215 | } |
| 1220 | 1216 | else if (slapstic != 0) |
| 1221 | | state->slapstic_configure(*machine.device<cpu_device>("maincpu"), slapstic_base, 0, slapstic); |
| 1222 | | atarijsa_init(machine, "IN0", 0x4000); |
| 1217 | slapstic_configure(*m_maincpu, slapstic_base, 0, slapstic); |
| 1218 | atarijsa_init(machine(), "IN0", 0x4000); |
| 1223 | 1219 | |
| 1224 | | state->m_is_pitfight = is_pitfight; |
| 1220 | m_is_pitfight = is_pitfight; |
| 1225 | 1221 | } |
| 1226 | 1222 | |
| 1227 | | DRIVER_INIT_MEMBER(atarig1_state,hydra) { init_g1_common(machine(), 0x078000, 116, 0); } |
| 1228 | | DRIVER_INIT_MEMBER(atarig1_state,hydrap) { init_g1_common(machine(), 0x000000, 0, 0); } |
| 1223 | DRIVER_INIT_MEMBER(atarig1_state,hydra) { init_common(0x078000, 116, 0); } |
| 1224 | DRIVER_INIT_MEMBER(atarig1_state,hydrap) { init_common(0x000000, 0, 0); } |
| 1229 | 1225 | |
| 1230 | | DRIVER_INIT_MEMBER(atarig1_state,pitfight9) { init_g1_common(machine(), 0x038000, 114, 1); } |
| 1231 | | DRIVER_INIT_MEMBER(atarig1_state,pitfight7) { init_g1_common(machine(), 0x038000, 112, 1); } |
| 1232 | | DRIVER_INIT_MEMBER(atarig1_state,pitfight) { init_g1_common(machine(), 0x038000, 111, 1); } |
| 1233 | | DRIVER_INIT_MEMBER(atarig1_state,pitfightj) { init_g1_common(machine(), 0x038000, 113, 1); } |
| 1234 | | DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_g1_common(machine(), 0x038000, -1, 1); } |
| 1226 | DRIVER_INIT_MEMBER(atarig1_state,pitfight9) { init_common(0x038000, 114, 1); } |
| 1227 | DRIVER_INIT_MEMBER(atarig1_state,pitfight7) { init_common(0x038000, 112, 1); } |
| 1228 | DRIVER_INIT_MEMBER(atarig1_state,pitfight) { init_common(0x038000, 111, 1); } |
| 1229 | DRIVER_INIT_MEMBER(atarig1_state,pitfightj) { init_common(0x038000, 113, 1); } |
| 1230 | DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_common(0x038000, -1, 1); } |
| 1235 | 1231 | |
| 1236 | 1232 | |
| 1237 | 1233 | /************************************* |
trunk/src/mame/drivers/atarisy2.c
| r20357 | r20358 | |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | #include "emu.h" |
| 127 | | #include "cpu/m6502/m6502.h" |
| 128 | | #include "cpu/t11/t11.h" |
| 129 | 127 | #include "includes/slapstic.h" |
| 130 | 128 | #include "includes/atarisy2.h" |
| 131 | 129 | #include "sound/tms5220.h" |
| r20357 | r20358 | |
| 141 | 139 | |
| 142 | 140 | /************************************* |
| 143 | 141 | * |
| 144 | | * Prototypes |
| 145 | | * |
| 146 | | *************************************/ |
| 147 | | |
| 148 | | static void bankselect_postload(running_machine &machine); |
| 149 | | |
| 150 | | |
| 151 | | |
| 152 | | /************************************* |
| 153 | | * |
| 154 | 142 | * Interrupt updating |
| 155 | 143 | * |
| 156 | 144 | *************************************/ |
| r20357 | r20358 | |
| 158 | 146 | void atarisy2_state::update_interrupts() |
| 159 | 147 | { |
| 160 | 148 | if (m_video_int_state) |
| 161 | | machine().device("maincpu")->execute().set_input_line(3, ASSERT_LINE); |
| 149 | m_maincpu->set_input_line(3, ASSERT_LINE); |
| 162 | 150 | else |
| 163 | | machine().device("maincpu")->execute().set_input_line(3, CLEAR_LINE); |
| 151 | m_maincpu->set_input_line(3, CLEAR_LINE); |
| 164 | 152 | |
| 165 | 153 | if (m_scanline_int_state) |
| 166 | | machine().device("maincpu")->execute().set_input_line(2, ASSERT_LINE); |
| 154 | m_maincpu->set_input_line(2, ASSERT_LINE); |
| 167 | 155 | else |
| 168 | | machine().device("maincpu")->execute().set_input_line(2, CLEAR_LINE); |
| 156 | m_maincpu->set_input_line(2, CLEAR_LINE); |
| 169 | 157 | |
| 170 | 158 | if (m_p2portwr_state) |
| 171 | | machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE); |
| 159 | m_maincpu->set_input_line(1, ASSERT_LINE); |
| 172 | 160 | else |
| 173 | | machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE); |
| 161 | m_maincpu->set_input_line(1, CLEAR_LINE); |
| 174 | 162 | |
| 175 | 163 | if (m_p2portrd_state) |
| 176 | | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); |
| 164 | m_maincpu->set_input_line(0, ASSERT_LINE); |
| 177 | 165 | else |
| 178 | | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); |
| 166 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 179 | 167 | } |
| 180 | 168 | |
| 181 | 169 | |
| r20357 | r20358 | |
| 193 | 181 | /* generate the 32V interrupt (IRQ 2) */ |
| 194 | 182 | if ((scanline % 64) == 0) |
| 195 | 183 | if (m_interrupt_enable & 4) |
| 196 | | scanline_int_gen(*subdevice("maincpu")); |
| 184 | scanline_int_gen(*m_maincpu); |
| 197 | 185 | } |
| 198 | 186 | } |
| 199 | 187 | |
| r20357 | r20358 | |
| 225 | 213 | save_item(NAME(m_which_adc)); |
| 226 | 214 | save_item(NAME(m_p2portwr_state)); |
| 227 | 215 | save_item(NAME(m_p2portrd_state)); |
| 228 | | machine().save().register_postload(save_prepost_delegate(FUNC(bankselect_postload), &machine())); |
| 229 | 216 | save_item(NAME(m_sound_reset_state)); |
| 230 | 217 | } |
| 231 | 218 | |
| r20357 | r20358 | |
| 236 | 223 | slapstic_reset(); |
| 237 | 224 | scanline_timer_reset(*machine().primary_screen, 64); |
| 238 | 225 | |
| 239 | | address_space &main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM); |
| 240 | | main.set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this)); |
| 226 | m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this)); |
| 241 | 227 | |
| 242 | 228 | m_p2portwr_state = 0; |
| 243 | 229 | m_p2portrd_state = 0; |
| r20357 | r20358 | |
| 273 | 259 | { |
| 274 | 260 | /* reset sound CPU */ |
| 275 | 261 | if (ACCESSING_BITS_0_7) |
| 276 | | machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); |
| 262 | m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); |
| 277 | 263 | } |
| 278 | 264 | |
| 279 | 265 | |
| r20357 | r20358 | |
| 325 | 311 | COMBINE_DATA(&newword); |
| 326 | 312 | m_bankselect[offset] = newword; |
| 327 | 313 | |
| 328 | | base = &machine().root_device().memregion("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]]; |
| 314 | base = &memregion("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]]; |
| 329 | 315 | memcpy(offset ? m_rombank2 : m_rombank1, base, 0x2000); |
| 330 | 316 | } |
| 331 | 317 | |
| 332 | 318 | |
| 333 | | static void bankselect_postload(running_machine &machine) |
| 319 | void atarisy2_state::device_post_load() |
| 334 | 320 | { |
| 335 | | address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 336 | | atarisy2_state *state = machine.driver_data<atarisy2_state>(); |
| 321 | atarigen_state::device_post_load(); |
| 337 | 322 | |
| 338 | | state->bankselect_w(space, 0, state->m_bankselect[0], 0xffff); |
| 339 | | state->bankselect_w(space, 1, state->m_bankselect[1], 0xffff); |
| 323 | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 324 | bankselect_w(space, 0, m_bankselect[0], 0xffff); |
| 325 | bankselect_w(space, 1, m_bankselect[1], 0xffff); |
| 340 | 326 | } |
| 341 | 327 | |
| 342 | 328 | |
| r20357 | r20358 | |
| 785 | 771 | /* full memory map derived from schematics */ |
| 786 | 772 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state ) |
| 787 | 773 | AM_RANGE(0x0000, 0x0fff) AM_RAM |
| 788 | | AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE_LEGACY(atarisy2_paletteram_w) AM_SHARE("paletteram") |
| 774 | AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") |
| 789 | 775 | AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w) AM_SHARE("bankselect") |
| 790 | 776 | AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w) |
| 791 | 777 | AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w) |
| r20357 | r20358 | |
| 794 | 780 | AM_RANGE(0x15e0, 0x15e1) AM_MIRROR(0x001e) AM_WRITE(video_int_ack_w) |
| 795 | 781 | AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x007e) AM_WRITE(int_enable_w) |
| 796 | 782 | AM_RANGE(0x1680, 0x1681) AM_MIRROR(0x007e) AM_WRITE8(sound_w, 0x00ff) |
| 797 | | AM_RANGE(0x1700, 0x1701) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_xscroll_w) AM_SHARE("xscroll") |
| 798 | | AM_RANGE(0x1780, 0x1781) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_yscroll_w) AM_SHARE("yscroll") |
| 783 | AM_RANGE(0x1700, 0x1701) AM_MIRROR(0x007e) AM_WRITE(xscroll_w) AM_SHARE("xscroll") |
| 784 | AM_RANGE(0x1780, 0x1781) AM_MIRROR(0x007e) AM_WRITE(yscroll_w) AM_SHARE("yscroll") |
| 799 | 785 | AM_RANGE(0x1800, 0x1801) AM_MIRROR(0x03fe) AM_READ(switch_r) AM_WRITE(watchdog_reset16_w) |
| 800 | 786 | AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x03fe) AM_READ(sound_r) |
| 801 | | AM_RANGE(0x2000, 0x3fff) AM_READWRITE_LEGACY(atarisy2_videoram_r, atarisy2_videoram_w) |
| 787 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(videoram_r, videoram_w) |
| 802 | 788 | AM_RANGE(0x4000, 0x5fff) AM_ROM AM_SHARE("rombank1") |
| 803 | 789 | AM_RANGE(0x6000, 0x7fff) AM_ROM AM_SHARE("rombank2") |
| 804 | | AM_RANGE(0x8000, 0x81ff) AM_READWRITE_LEGACY(atarisy2_slapstic_r, atarisy2_slapstic_w) AM_SHARE("slapstic_base") |
| 790 | AM_RANGE(0x8000, 0x81ff) AM_READWRITE(slapstic_r, slapstic_w) AM_SHARE("slapstic_base") |
| 805 | 791 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 806 | 792 | ADDRESS_MAP_END |
| 807 | 793 | |
trunk/src/mame/drivers/cyberbal.c
| r20357 | r20358 | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | #include "emu.h" |
| 23 | | #include "cpu/m68000/m68000.h" |
| 24 | | #include "cpu/m6502/m6502.h" |
| 25 | 23 | #include "sound/2151intf.h" |
| 26 | | #include "sound/dac.h" |
| 27 | 24 | #include "rendlay.h" |
| 28 | 25 | #include "audio/atarijsa.h" |
| 29 | 26 | #include "video/atarimo.h" |
| r20357 | r20358 | |
| 38 | 35 | |
| 39 | 36 | void cyberbal_state::update_interrupts() |
| 40 | 37 | { |
| 41 | | if (subdevice("extra") != NULL) |
| 38 | if (m_extracpu != NULL) |
| 42 | 39 | { |
| 43 | | subdevice("maincpu")->execute().set_input_line(1, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 44 | | subdevice("extra")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 40 | m_maincpu->set_input_line(1, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 41 | m_extracpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 45 | 42 | } |
| 46 | 43 | else |
| 47 | 44 | { |
| 48 | | subdevice("maincpu")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 49 | | subdevice("maincpu")->execute().set_input_line(3, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 45 | m_maincpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 46 | m_maincpu->set_input_line(3, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); |
| 50 | 47 | } |
| 51 | 48 | } |
| 52 | 49 | |
| r20357 | r20358 | |
| 69 | 66 | atarigen_state::machine_reset(); |
| 70 | 67 | scanline_timer_reset(*machine().primary_screen, 8); |
| 71 | 68 | |
| 72 | | cyberbal_sound_reset(machine()); |
| 69 | cyberbal_sound_reset(); |
| 73 | 70 | |
| 74 | 71 | /* Extra CPU (second M68k) doesn't run until reset */ |
| 75 | | machine().device("extra")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 72 | m_extracpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 76 | 73 | } |
| 77 | 74 | |
| 78 | 75 | |
| r20357 | r20358 | |
| 124 | 121 | |
| 125 | 122 | WRITE16_MEMBER(cyberbal_state::p2_reset_w) |
| 126 | 123 | { |
| 127 | | machine().device("extra")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 124 | m_extracpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 128 | 125 | } |
| 129 | 126 | |
| 130 | 127 | |
| r20357 | r20358 | |
| 146 | 143 | AM_RANGE(0xfd8000, 0xfd9fff) AM_WRITE8(sound_w, 0xff00) |
| 147 | 144 | AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r) |
| 148 | 145 | AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") |
| 149 | | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") |
| 150 | | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") |
| 146 | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1") |
| 147 | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0") |
| 151 | 148 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") |
| 152 | 149 | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") |
| 153 | 150 | AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) |
| r20357 | r20358 | |
| 173 | 170 | AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE(video_int_ack_w) |
| 174 | 171 | AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r) |
| 175 | 172 | AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") |
| 176 | | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") |
| 177 | | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") |
| 173 | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1") |
| 174 | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0") |
| 178 | 175 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") |
| 179 | 176 | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") |
| 180 | 177 | AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) |
| r20357 | r20358 | |
| 198 | 195 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cyberbal_state ) |
| 199 | 196 | AM_RANGE(0x0000, 0x1fff) AM_RAM |
| 200 | 197 | AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) |
| 201 | | AM_RANGE(0x2800, 0x2801) AM_WRITE(cyberbal_sound_68k_6502_w) |
| 198 | AM_RANGE(0x2800, 0x2801) AM_WRITE(sound_68k_6502_w) |
| 202 | 199 | AM_RANGE(0x2802, 0x2803) AM_READWRITE(m6502_irq_ack_r, m6502_irq_ack_w) |
| 203 | 200 | AM_RANGE(0x2804, 0x2805) AM_WRITE(m6502_sound_w) |
| 204 | | AM_RANGE(0x2806, 0x2807) AM_WRITE(cyberbal_sound_bank_select_w) |
| 201 | AM_RANGE(0x2806, 0x2807) AM_WRITE(sound_bank_select_w) |
| 205 | 202 | AM_RANGE(0x2c00, 0x2c01) AM_READ(m6502_sound_r) |
| 206 | | AM_RANGE(0x2c02, 0x2c03) AM_READ(cyberbal_special_port3_r) |
| 207 | | AM_RANGE(0x2c04, 0x2c05) AM_READ(cyberbal_sound_68k_6502_r) |
| 208 | | AM_RANGE(0x2c06, 0x2c07) AM_READ(cyberbal_sound_6502_stat_r) |
| 203 | AM_RANGE(0x2c02, 0x2c03) AM_READ(special_port3_r) |
| 204 | AM_RANGE(0x2c04, 0x2c05) AM_READ(sound_68k_6502_r) |
| 205 | AM_RANGE(0x2c06, 0x2c07) AM_READ(sound_6502_stat_r) |
| 209 | 206 | AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("soundbank") |
| 210 | 207 | AM_RANGE(0x4000, 0xffff) AM_ROM |
| 211 | 208 | ADDRESS_MAP_END |
| r20357 | r20358 | |
| 220 | 217 | |
| 221 | 218 | static ADDRESS_MAP_START( sound_68k_map, AS_PROGRAM, 16, cyberbal_state ) |
| 222 | 219 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 223 | | AM_RANGE(0xff8000, 0xff87ff) AM_READ(cyberbal_sound_68k_r) |
| 224 | | AM_RANGE(0xff8800, 0xff8fff) AM_WRITE(cyberbal_sound_68k_w) |
| 225 | | AM_RANGE(0xff9000, 0xff97ff) AM_WRITE(cyberbal_io_68k_irq_ack_w) |
| 226 | | AM_RANGE(0xff9800, 0xff9fff) AM_WRITE(cyberbal_sound_68k_dac_w) |
| 220 | AM_RANGE(0xff8000, 0xff87ff) AM_READ(sound_68k_r) |
| 221 | AM_RANGE(0xff8800, 0xff8fff) AM_WRITE(sound_68k_w) |
| 222 | AM_RANGE(0xff9000, 0xff97ff) AM_WRITE(io_68k_irq_ack_w) |
| 223 | AM_RANGE(0xff9800, 0xff9fff) AM_WRITE(sound_68k_dac_w) |
| 227 | 224 | AM_RANGE(0xfff000, 0xffffff) AM_RAM |
| 228 | 225 | ADDRESS_MAP_END |
| 229 | 226 | |
| r20357 | r20358 | |
| 420 | 417 | |
| 421 | 418 | MCFG_CPU_ADD("dac", M68000, ATARI_CLOCK_14MHz/2) |
| 422 | 419 | MCFG_CPU_PROGRAM_MAP(sound_68k_map) |
| 423 | | MCFG_CPU_PERIODIC_INT_DRIVER(cyberbal_state, cyberbal_sound_68k_irq_gen, 10000) |
| 420 | MCFG_CPU_PERIODIC_INT_DRIVER(cyberbal_state, sound_68k_irq_gen, 10000) |
| 424 | 421 | |
| 425 | 422 | MCFG_QUANTUM_TIME(attotime::from_hz(600)) |
| 426 | 423 | |
| r20357 | r20358 | |
| 981 | 978 | |
| 982 | 979 | DRIVER_INIT_MEMBER(cyberbal_state,cyberbal) |
| 983 | 980 | { |
| 984 | | slapstic_configure(*machine().device<cpu_device>("maincpu"), 0x018000, 0, 0); |
| 981 | slapstic_configure(*m_maincpu, 0x018000, 0, 0); |
| 985 | 982 | } |
| 986 | 983 | |
| 987 | 984 | |
| 988 | 985 | DRIVER_INIT_MEMBER(cyberbal_state,cyberbalt) |
| 989 | 986 | { |
| 990 | | slapstic_configure(*machine().device<cpu_device>("maincpu"), 0x018000, 0, 116); |
| 987 | slapstic_configure(*m_maincpu, 0x018000, 0, 116); |
| 991 | 988 | } |
| 992 | 989 | |
| 993 | 990 | |
trunk/src/mame/drivers/atarigt.c
| r20357 | r20358 | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | | #if (HACK_TMEK_CONTROLS) |
| 142 | | INLINE void compute_fake_pots(int *pots) |
| 141 | inline void atarigt_state::compute_fake_pots(int *pots) |
| 143 | 142 | { |
| 144 | | int fake = machine.root_device().ioport("FAKE")->read(); |
| 143 | #if (HACK_TMEK_CONTROLS) |
| 144 | int fake = ioport("FAKE")->read(); |
| 145 | 145 | |
| 146 | 146 | pots[0] = pots[1] = pots[2] = pots[3] = 0x80; |
| 147 | 147 | |
| r20357 | r20358 | |
| 167 | 167 | pots[1] = 0xff, pots[3] = 0x00; |
| 168 | 168 | else if (fake & 0x08) /* right only */ |
| 169 | 169 | pots[3] = 0xff, pots[1] = 0x00; |
| 170 | | } |
| 171 | 170 | #endif |
| 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | READ32_MEMBER(atarigt_state::analog_port0_r) |
| r20357 | r20358 | |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | |
| 285 | | static void tmek_update_mode(atarigt_state *state, offs_t offset) |
| 285 | void atarigt_state::tmek_update_mode(offs_t offset) |
| 286 | 286 | { |
| 287 | | int i; |
| 288 | | |
| 289 | 287 | /* pop us into the readseq */ |
| 290 | | for (i = 0; i < ADDRSEQ_COUNT - 1; i++) |
| 291 | | state->m_protaddr[i] = state->m_protaddr[i + 1]; |
| 292 | | state->m_protaddr[ADDRSEQ_COUNT - 1] = offset; |
| 293 | | |
| 288 | for (int i = 0; i < ADDRSEQ_COUNT - 1; i++) |
| 289 | m_protaddr[i] = m_protaddr[i + 1]; |
| 290 | m_protaddr[ADDRSEQ_COUNT - 1] = offset; |
| 294 | 291 | } |
| 295 | 292 | |
| 296 | 293 | |
| 297 | | static void tmek_protection_w(address_space &space, offs_t offset, UINT16 data) |
| 294 | void atarigt_state::tmek_protection_w(address_space &space, offs_t offset, UINT16 data) |
| 298 | 295 | { |
| 299 | | atarigt_state *state = space.machine().driver_data<atarigt_state>(); |
| 300 | 296 | /* |
| 301 | 297 | T-Mek init: |
| 302 | 298 | ($387C0) = $0001 |
| r20357 | r20358 | |
| 308 | 304 | if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", space.device().safe_pcbase(), offset, data); |
| 309 | 305 | |
| 310 | 306 | /* track accesses */ |
| 311 | | tmek_update_mode(state, offset); |
| 307 | tmek_update_mode(offset); |
| 312 | 308 | |
| 313 | 309 | switch (offset) |
| 314 | 310 | { |
| 315 | 311 | case 0xdb0000: |
| 316 | | state->m_ignore_writes = (data == 0x18); |
| 312 | m_ignore_writes = (data == 0x18); |
| 317 | 313 | break; |
| 318 | 314 | } |
| 319 | 315 | } |
| 320 | 316 | |
| 321 | | static void tmek_protection_r(address_space &space, offs_t offset, UINT16 *data) |
| 317 | void atarigt_state::tmek_protection_r(address_space &space, offs_t offset, UINT16 *data) |
| 322 | 318 | { |
| 323 | | atarigt_state *state = space.machine().driver_data<atarigt_state>(); |
| 324 | 319 | if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", space.device().safe_pcbase(), offset); |
| 325 | 320 | |
| 326 | 321 | /* track accesses */ |
| 327 | | tmek_update_mode(state, offset); |
| 322 | tmek_update_mode(offset); |
| 328 | 323 | |
| 329 | 324 | /* handle specific reads */ |
| 330 | 325 | switch (offset) |
| r20357 | r20358 | |
| 348 | 343 | * |
| 349 | 344 | *************************************/ |
| 350 | 345 | |
| 351 | | static void primage_update_mode(atarigt_state *state, offs_t offset) |
| 346 | void atarigt_state::primrage_update_mode(offs_t offset) |
| 352 | 347 | { |
| 353 | | int i; |
| 354 | | |
| 355 | 348 | /* pop us into the readseq */ |
| 356 | | for (i = 0; i < ADDRSEQ_COUNT - 1; i++) |
| 357 | | state->m_protaddr[i] = state->m_protaddr[i + 1]; |
| 358 | | state->m_protaddr[ADDRSEQ_COUNT - 1] = offset; |
| 349 | for (int i = 0; i < ADDRSEQ_COUNT - 1; i++) |
| 350 | m_protaddr[i] = m_protaddr[i + 1]; |
| 351 | m_protaddr[ADDRSEQ_COUNT - 1] = offset; |
| 359 | 352 | |
| 360 | 353 | /* check for particular sequences */ |
| 361 | | if (!state->m_protmode) |
| 354 | if (!m_protmode) |
| 362 | 355 | { |
| 363 | 356 | /* this is from the code at $20f90 */ |
| 364 | | if (state->m_protaddr[1] == 0xdcc7c4 && state->m_protaddr[2] == 0xdcc7c4 && state->m_protaddr[3] == 0xdc4010) |
| 357 | if (m_protaddr[1] == 0xdcc7c4 && m_protaddr[2] == 0xdcc7c4 && m_protaddr[3] == 0xdc4010) |
| 365 | 358 | { |
| 366 | 359 | if (LOG_PROTECTION) logerror("prot:Entering mode 1\n"); |
| 367 | | state->m_protmode = 1; |
| 360 | m_protmode = 1; |
| 368 | 361 | } |
| 369 | 362 | |
| 370 | 363 | /* this is from the code at $27592 */ |
| 371 | | if (state->m_protaddr[0] == 0xdcc7ca && state->m_protaddr[1] == 0xdcc7ca && state->m_protaddr[2] == 0xdcc7c6 && state->m_protaddr[3] == 0xdc4022) |
| 364 | if (m_protaddr[0] == 0xdcc7ca && m_protaddr[1] == 0xdcc7ca && m_protaddr[2] == 0xdcc7c6 && m_protaddr[3] == 0xdc4022) |
| 372 | 365 | { |
| 373 | 366 | if (LOG_PROTECTION) logerror("prot:Entering mode 2\n"); |
| 374 | | state->m_protmode = 2; |
| 367 | m_protmode = 2; |
| 375 | 368 | } |
| 376 | 369 | |
| 377 | 370 | /* this is from the code at $3d8dc */ |
| 378 | | if (state->m_protaddr[0] == 0xdcc7c0 && state->m_protaddr[1] == 0xdcc7c0 && state->m_protaddr[2] == 0xdc80f2 && state->m_protaddr[3] == 0xdc7af2) |
| 371 | if (m_protaddr[0] == 0xdcc7c0 && m_protaddr[1] == 0xdcc7c0 && m_protaddr[2] == 0xdc80f2 && m_protaddr[3] == 0xdc7af2) |
| 379 | 372 | { |
| 380 | 373 | if (LOG_PROTECTION) logerror("prot:Entering mode 3\n"); |
| 381 | | state->m_protmode = 3; |
| 374 | m_protmode = 3; |
| 382 | 375 | } |
| 383 | 376 | } |
| 384 | 377 | } |
| 385 | 378 | |
| 386 | 379 | |
| 387 | 380 | |
| 388 | | static void primrage_protection_w(address_space &space, offs_t offset, UINT16 data) |
| 381 | void atarigt_state::primrage_protection_w(address_space &space, offs_t offset, UINT16 data) |
| 389 | 382 | { |
| 390 | | atarigt_state *state = space.machine().driver_data<atarigt_state>(); |
| 391 | 383 | if (LOG_PROTECTION) |
| 392 | 384 | { |
| 393 | 385 | UINT32 pc = space.device().safe_pcbase(); |
| r20357 | r20358 | |
| 431 | 423 | /* mask = 0x78fff */ |
| 432 | 424 | |
| 433 | 425 | /* track accesses */ |
| 434 | | primage_update_mode(state, offset); |
| 426 | primrage_update_mode(offset); |
| 435 | 427 | |
| 436 | 428 | /* check for certain read sequences */ |
| 437 | | if (state->m_protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(state->m_protdata) * 2) |
| 438 | | state->m_protdata[(offset - 0xdc7800) / 2] = data; |
| 429 | if (m_protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(m_protdata) * 2) |
| 430 | m_protdata[(offset - 0xdc7800) / 2] = data; |
| 439 | 431 | |
| 440 | | if (state->m_protmode == 2) |
| 432 | if (m_protmode == 2) |
| 441 | 433 | { |
| 442 | 434 | int temp = (offset - 0xdc7800) / 2; |
| 443 | 435 | if (LOG_PROTECTION) logerror("prot:mode 2 param = %04X\n", temp); |
| 444 | | state->m_protresult = temp * 0x6915 + 0x6915; |
| 436 | m_protresult = temp * 0x6915 + 0x6915; |
| 445 | 437 | } |
| 446 | 438 | |
| 447 | | if (state->m_protmode == 3) |
| 439 | if (m_protmode == 3) |
| 448 | 440 | { |
| 449 | 441 | if (offset == 0xdc4700) |
| 450 | 442 | { |
| 451 | 443 | if (LOG_PROTECTION) logerror("prot:Clearing mode 3\n"); |
| 452 | | state->m_protmode = 0; |
| 444 | m_protmode = 0; |
| 453 | 445 | } |
| 454 | 446 | } |
| 455 | 447 | } |
| 456 | 448 | |
| 457 | 449 | |
| 458 | 450 | |
| 459 | | static void primrage_protection_r(address_space &space, offs_t offset, UINT16 *data) |
| 451 | void atarigt_state::primrage_protection_r(address_space &space, offs_t offset, UINT16 *data) |
| 460 | 452 | { |
| 461 | | atarigt_state *state = space.machine().driver_data<atarigt_state>(); |
| 462 | 453 | /* track accesses */ |
| 463 | | primage_update_mode(state, offset); |
| 454 | primrage_update_mode(offset); |
| 464 | 455 | |
| 465 | 456 | if (LOG_PROTECTION) |
| 466 | 457 | { |
| r20357 | r20358 | |
| 537 | 528 | { |
| 538 | 529 | /* status register; the code spins on this waiting for the high bit to be set */ |
| 539 | 530 | case 0xdc4700: |
| 540 | | // if (state->m_protmode != 0) |
| 531 | // if (m_protmode != 0) |
| 541 | 532 | { |
| 542 | 533 | *data = 0x8000; |
| 543 | 534 | } |
| r20357 | r20358 | |
| 545 | 536 | |
| 546 | 537 | /* some kind of result register */ |
| 547 | 538 | case 0xdcc7c2: |
| 548 | | if (state->m_protmode == 2) |
| 539 | if (m_protmode == 2) |
| 549 | 540 | { |
| 550 | | *data = state->m_protresult; |
| 551 | | state->m_protmode = 0; |
| 541 | *data = m_protresult; |
| 542 | m_protmode = 0; |
| 552 | 543 | if (LOG_PROTECTION) logerror("prot:Clearing mode 2\n"); |
| 553 | 544 | } |
| 554 | 545 | break; |
| 555 | 546 | |
| 556 | 547 | case 0xdcc7c4: |
| 557 | | if (state->m_protmode == 1) |
| 548 | if (m_protmode == 1) |
| 558 | 549 | { |
| 559 | | state->m_protmode = 0; |
| 550 | m_protmode = 0; |
| 560 | 551 | if (LOG_PROTECTION) logerror("prot:Clearing mode 1\n"); |
| 561 | 552 | } |
| 562 | 553 | break; |
| r20357 | r20358 | |
| 580 | 571 | if (ACCESSING_BITS_16_31) |
| 581 | 572 | { |
| 582 | 573 | result = atarigt_colorram_r(address); |
| 583 | | (*m_protection_r)(space, address, &result); |
| 574 | (this->*m_protection_r)(space, address, &result); |
| 584 | 575 | result32 |= result << 16; |
| 585 | 576 | } |
| 586 | 577 | if (ACCESSING_BITS_0_15) |
| 587 | 578 | { |
| 588 | 579 | result = atarigt_colorram_r(address + 2); |
| 589 | | (*m_protection_r)(space, address + 2, &result); |
| 580 | (this->*m_protection_r)(space, address + 2, &result); |
| 590 | 581 | result32 |= result; |
| 591 | 582 | } |
| 592 | 583 | |
| r20357 | r20358 | |
| 602 | 593 | { |
| 603 | 594 | if (!m_ignore_writes) |
| 604 | 595 | atarigt_colorram_w(address, data >> 16, mem_mask >> 16); |
| 605 | | (*m_protection_w)(space, address, data >> 16); |
| 596 | (this->*m_protection_w)(space, address, data >> 16); |
| 606 | 597 | } |
| 607 | 598 | if (ACCESSING_BITS_0_15) |
| 608 | 599 | { |
| 609 | 600 | if (!m_ignore_writes) |
| 610 | 601 | atarigt_colorram_w(address + 2, data, mem_mask); |
| 611 | | (*m_protection_w)(space, address + 2, data); |
| 602 | (this->*m_protection_w)(space, address + 2, data); |
| 612 | 603 | } |
| 613 | 604 | } |
| 614 | 605 | |
| r20357 | r20358 | |
| 1320 | 1311 | cage_set_irq_handler(cage_irq_callback); |
| 1321 | 1312 | |
| 1322 | 1313 | /* setup protection */ |
| 1323 | | m_protection_r = tmek_protection_r; |
| 1324 | | m_protection_w = tmek_protection_w; |
| 1314 | m_protection_r = &atarigt_state::tmek_protection_r; |
| 1315 | m_protection_w = &atarigt_state::tmek_protection_w; |
| 1325 | 1316 | |
| 1326 | 1317 | /* temp hack */ |
| 1327 | 1318 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this)); |
| 1328 | 1319 | } |
| 1329 | 1320 | |
| 1330 | 1321 | |
| 1331 | | static void primrage_init_common(running_machine &machine, offs_t cage_speedup) |
| 1322 | void atarigt_state::primrage_init_common(offs_t cage_speedup) |
| 1332 | 1323 | { |
| 1333 | | atarigt_state *state = machine.driver_data<atarigt_state>(); |
| 1324 | m_eeprom_default = NULL; |
| 1325 | m_is_primrage = 1; |
| 1334 | 1326 | |
| 1335 | | state->m_eeprom_default = NULL; |
| 1336 | | state->m_is_primrage = 1; |
| 1337 | | |
| 1338 | | cage_init(machine, cage_speedup); |
| 1327 | cage_init(machine(), cage_speedup); |
| 1339 | 1328 | cage_set_irq_handler(cage_irq_callback); |
| 1340 | 1329 | |
| 1341 | 1330 | /* install protection */ |
| 1342 | | state->m_protection_r = primrage_protection_r; |
| 1343 | | state->m_protection_w = primrage_protection_w; |
| 1331 | m_protection_r = &atarigt_state::primrage_protection_r; |
| 1332 | m_protection_w = &atarigt_state::primrage_protection_w; |
| 1344 | 1333 | } |
| 1345 | 1334 | |
| 1346 | | DRIVER_INIT_MEMBER(atarigt_state,primrage) { primrage_init_common(machine(), 0x42f2); } |
| 1347 | | DRIVER_INIT_MEMBER(atarigt_state,primrage20) { primrage_init_common(machine(), 0x48a4); } |
| 1335 | DRIVER_INIT_MEMBER(atarigt_state,primrage) { primrage_init_common(0x42f2); } |
| 1336 | DRIVER_INIT_MEMBER(atarigt_state,primrage20) { primrage_init_common(0x48a4); } |
| 1348 | 1337 | |
| 1349 | 1338 | /************************************* |
| 1350 | 1339 | * |
trunk/src/mame/audio/cyberbal.c
| r20357 | r20358 | |
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "emu.h" |
| 8 | | #include "sound/dac.h" |
| 9 | 8 | #include "sound/2151intf.h" |
| 10 | 9 | #include "machine/atarigen.h" |
| 11 | 10 | #include "includes/cyberbal.h" |
| 12 | 11 | |
| 13 | 12 | |
| 14 | | static void update_sound_68k_interrupts(running_machine &machine); |
| 15 | | |
| 16 | | |
| 17 | | |
| 18 | | void cyberbal_sound_reset(running_machine &machine) |
| 13 | void cyberbal_state::cyberbal_sound_reset() |
| 19 | 14 | { |
| 20 | | cyberbal_state *state = machine.driver_data<cyberbal_state>(); |
| 21 | | |
| 22 | 15 | /* reset the sound system */ |
| 23 | | state->m_bank_base = &state->memregion("audiocpu")->base()[0x10000]; |
| 24 | | state->membank("soundbank")->set_base(&state->m_bank_base[0x0000]); |
| 25 | | state->m_fast_68k_int = state->m_io_68k_int = 0; |
| 26 | | state->m_sound_data_from_68k = state->m_sound_data_from_6502 = 0; |
| 27 | | state->m_sound_data_from_68k_ready = state->m_sound_data_from_6502_ready = 0; |
| 16 | m_bank_base = &memregion("audiocpu")->base()[0x10000]; |
| 17 | membank("soundbank")->set_base(&m_bank_base[0x0000]); |
| 18 | m_fast_68k_int = m_io_68k_int = 0; |
| 19 | m_sound_data_from_68k = m_sound_data_from_6502 = 0; |
| 20 | m_sound_data_from_68k_ready = m_sound_data_from_6502_ready = 0; |
| 28 | 21 | } |
| 29 | 22 | |
| 30 | 23 | |
| r20357 | r20358 | |
| 35 | 28 | * |
| 36 | 29 | *************************************/ |
| 37 | 30 | |
| 38 | | READ8_MEMBER(cyberbal_state::cyberbal_special_port3_r) |
| 31 | READ8_MEMBER(cyberbal_state::special_port3_r) |
| 39 | 32 | { |
| 40 | 33 | int temp = ioport("JSAII")->read(); |
| 41 | 34 | if (!(ioport("IN0")->read() & 0x8000)) temp ^= 0x80; |
| r20357 | r20358 | |
| 45 | 38 | } |
| 46 | 39 | |
| 47 | 40 | |
| 48 | | READ8_MEMBER(cyberbal_state::cyberbal_sound_6502_stat_r) |
| 41 | READ8_MEMBER(cyberbal_state::sound_6502_stat_r) |
| 49 | 42 | { |
| 50 | 43 | int temp = 0xff; |
| 51 | 44 | if (m_sound_data_from_6502_ready) temp ^= 0x80; |
| r20357 | r20358 | |
| 54 | 47 | } |
| 55 | 48 | |
| 56 | 49 | |
| 57 | | WRITE8_MEMBER(cyberbal_state::cyberbal_sound_bank_select_w) |
| 50 | WRITE8_MEMBER(cyberbal_state::sound_bank_select_w) |
| 58 | 51 | { |
| 59 | 52 | membank("soundbank")->set_base(&m_bank_base[0x1000 * ((data >> 6) & 3)]); |
| 60 | 53 | coin_counter_w(machine(), 1, (data >> 5) & 1); |
| 61 | 54 | coin_counter_w(machine(), 0, (data >> 4) & 1); |
| 62 | | machine().device("dac")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); |
| 55 | m_daccpu->set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); |
| 63 | 56 | if (!(data & 0x01)) machine().device("ymsnd")->reset(); |
| 64 | 57 | } |
| 65 | 58 | |
| 66 | 59 | |
| 67 | | READ8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_r) |
| 60 | READ8_MEMBER(cyberbal_state::sound_68k_6502_r) |
| 68 | 61 | { |
| 69 | 62 | m_sound_data_from_68k_ready = 0; |
| 70 | 63 | return m_sound_data_from_68k; |
| 71 | 64 | } |
| 72 | 65 | |
| 73 | 66 | |
| 74 | | WRITE8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_w) |
| 67 | WRITE8_MEMBER(cyberbal_state::sound_68k_6502_w) |
| 75 | 68 | { |
| 76 | 69 | m_sound_data_from_6502 = data; |
| 77 | 70 | m_sound_data_from_6502_ready = 1; |
| r20357 | r20358 | |
| 79 | 72 | if (!m_io_68k_int) |
| 80 | 73 | { |
| 81 | 74 | m_io_68k_int = 1; |
| 82 | | update_sound_68k_interrupts(machine()); |
| 75 | update_sound_68k_interrupts(); |
| 83 | 76 | } |
| 84 | 77 | } |
| 85 | 78 | |
| r20357 | r20358 | |
| 91 | 84 | * |
| 92 | 85 | *************************************/ |
| 93 | 86 | |
| 94 | | static void update_sound_68k_interrupts(running_machine &machine) |
| 87 | void cyberbal_state::update_sound_68k_interrupts() |
| 95 | 88 | { |
| 96 | | cyberbal_state *state = machine.driver_data<cyberbal_state>(); |
| 97 | | machine.device("dac")->execute().set_input_line(6, state->m_fast_68k_int ? ASSERT_LINE : CLEAR_LINE); |
| 98 | | machine.device("dac")->execute().set_input_line(2, state->m_io_68k_int ? ASSERT_LINE : CLEAR_LINE); |
| 89 | m_daccpu->set_input_line(6, m_fast_68k_int ? ASSERT_LINE : CLEAR_LINE); |
| 90 | m_daccpu->set_input_line(2, m_io_68k_int ? ASSERT_LINE : CLEAR_LINE); |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | |
| 102 | | INTERRUPT_GEN_MEMBER(cyberbal_state::cyberbal_sound_68k_irq_gen) |
| 94 | INTERRUPT_GEN_MEMBER(cyberbal_state::sound_68k_irq_gen) |
| 103 | 95 | { |
| 104 | 96 | if (!m_fast_68k_int) |
| 105 | 97 | { |
| 106 | 98 | m_fast_68k_int = 1; |
| 107 | | update_sound_68k_interrupts(machine()); |
| 99 | update_sound_68k_interrupts(); |
| 108 | 100 | } |
| 109 | 101 | } |
| 110 | 102 | |
| 111 | 103 | |
| 112 | | WRITE16_MEMBER(cyberbal_state::cyberbal_io_68k_irq_ack_w) |
| 104 | WRITE16_MEMBER(cyberbal_state::io_68k_irq_ack_w) |
| 113 | 105 | { |
| 114 | 106 | if (m_io_68k_int) |
| 115 | 107 | { |
| 116 | 108 | m_io_68k_int = 0; |
| 117 | | update_sound_68k_interrupts(machine()); |
| 109 | update_sound_68k_interrupts(); |
| 118 | 110 | } |
| 119 | 111 | } |
| 120 | 112 | |
| 121 | 113 | |
| 122 | | READ16_MEMBER(cyberbal_state::cyberbal_sound_68k_r) |
| 114 | READ16_MEMBER(cyberbal_state::sound_68k_r) |
| 123 | 115 | { |
| 124 | 116 | int temp = (m_sound_data_from_6502 << 8) | 0xff; |
| 125 | 117 | |
| r20357 | r20358 | |
| 131 | 123 | } |
| 132 | 124 | |
| 133 | 125 | |
| 134 | | WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_w) |
| 126 | WRITE16_MEMBER(cyberbal_state::sound_68k_w) |
| 135 | 127 | { |
| 136 | 128 | if (ACCESSING_BITS_8_15) |
| 137 | 129 | { |
| r20357 | r20358 | |
| 141 | 133 | } |
| 142 | 134 | |
| 143 | 135 | |
| 144 | | WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_dac_w) |
| 136 | WRITE16_MEMBER(cyberbal_state::sound_68k_dac_w) |
| 145 | 137 | { |
| 146 | | dac_device *dac = machine().device<dac_device>((offset & 8) ? "dac2" : "dac1"); |
| 138 | dac_device *dac = (offset & 8) ? m_dac2 : m_dac1; |
| 147 | 139 | dac->write_unsigned16((((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4); |
| 148 | 140 | |
| 149 | 141 | if (m_fast_68k_int) |
| 150 | 142 | { |
| 151 | 143 | m_fast_68k_int = 0; |
| 152 | | update_sound_68k_interrupts(machine()); |
| 144 | update_sound_68k_interrupts(); |
| 153 | 145 | } |
| 154 | 146 | } |