trunk/src/mame/machine/leland.c
| r20832 | r20833 | |
| 44 | 44 | * |
| 45 | 45 | *************************************/ |
| 46 | 46 | |
| 47 | | static int dial_compute_value(running_machine &machine, int new_val, int indx) |
| 47 | int leland_state::dial_compute_value(int new_val, int indx) |
| 48 | 48 | { |
| 49 | | leland_state *state = machine.driver_data<leland_state>(); |
| 50 | | int delta = new_val - (int)state->m_dial_last_input[indx]; |
| 51 | | UINT8 result = state->m_dial_last_result[indx] & 0x80; |
| 49 | int delta = new_val - (int)m_dial_last_input[indx]; |
| 50 | UINT8 result = m_dial_last_result[indx] & 0x80; |
| 52 | 51 | |
| 53 | | state->m_dial_last_input[indx] = new_val; |
| 52 | m_dial_last_input[indx] = new_val; |
| 54 | 53 | |
| 55 | 54 | if (delta > 0x80) |
| 56 | 55 | delta -= 0x100; |
| r20832 | r20833 | |
| 67 | 66 | |
| 68 | 67 | if (delta > 0x1f) |
| 69 | 68 | delta = 0x1f; |
| 70 | | result |= (state->m_dial_last_result[indx] + delta) & 0x1f; |
| 69 | result |= (m_dial_last_result[indx] + delta) & 0x1f; |
| 71 | 70 | |
| 72 | | state->m_dial_last_result[indx] = result; |
| 71 | m_dial_last_result[indx] = result; |
| 73 | 72 | return result; |
| 74 | 73 | } |
| 75 | 74 | |
| r20832 | r20833 | |
| 84 | 83 | READ8_MEMBER(leland_state::cerberus_dial_1_r) |
| 85 | 84 | { |
| 86 | 85 | int original = ioport("IN0")->read(); |
| 87 | | int modified = dial_compute_value(machine(), ioport("AN0")->read(), 0); |
| 86 | int modified = dial_compute_value(ioport("AN0")->read(), 0); |
| 88 | 87 | return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); |
| 89 | 88 | } |
| 90 | 89 | |
| r20832 | r20833 | |
| 92 | 91 | READ8_MEMBER(leland_state::cerberus_dial_2_r) |
| 93 | 92 | { |
| 94 | 93 | int original = ioport("IN0")->read(); |
| 95 | | int modified = dial_compute_value(machine(), ioport("AN1")->read(), 1); |
| 94 | int modified = dial_compute_value(ioport("AN1")->read(), 1); |
| 96 | 95 | return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); |
| 97 | 96 | } |
| 98 | 97 | |
| r20832 | r20833 | |
| 133 | 132 | * |
| 134 | 133 | *************************************/ |
| 135 | 134 | |
| 136 | | static void update_dangerz_xy(running_machine &machine) |
| 135 | void leland_state::update_dangerz_xy() |
| 137 | 136 | { |
| 138 | | leland_state *state = machine.driver_data<leland_state>(); |
| 139 | | UINT8 newy = state->ioport("AN0")->read(); |
| 140 | | UINT8 newx = state->ioport("AN1")->read(); |
| 141 | | int deltay = newy - state->m_dial_last_input[0]; |
| 142 | | int deltax = newx - state->m_dial_last_input[1]; |
| 137 | UINT8 newy = ioport("AN0")->read(); |
| 138 | UINT8 newx = ioport("AN1")->read(); |
| 139 | int deltay = newy - m_dial_last_input[0]; |
| 140 | int deltax = newx - m_dial_last_input[1]; |
| 143 | 141 | |
| 144 | 142 | if (deltay <= -128) deltay += 256; |
| 145 | 143 | else if (deltay >= 128) deltay -= 256; |
| 146 | 144 | if (deltax <= -128) deltax += 256; |
| 147 | 145 | else if (deltax >= 128) deltax -= 256; |
| 148 | 146 | |
| 149 | | state->m_dangerz_y += deltay; |
| 150 | | state->m_dangerz_x += deltax; |
| 151 | | if (state->m_dangerz_y < 0) state->m_dangerz_y = 0; |
| 152 | | else if (state->m_dangerz_y >= 1024) state->m_dangerz_y = 1023; |
| 153 | | if (state->m_dangerz_x < 0) state->m_dangerz_x = 0; |
| 154 | | else if (state->m_dangerz_x >= 1024) state->m_dangerz_x = 1023; |
| 147 | m_dangerz_y += deltay; |
| 148 | m_dangerz_x += deltax; |
| 149 | if (m_dangerz_y < 0) m_dangerz_y = 0; |
| 150 | else if (m_dangerz_y >= 1024) m_dangerz_y = 1023; |
| 151 | if (m_dangerz_x < 0) m_dangerz_x = 0; |
| 152 | else if (m_dangerz_x >= 1024) m_dangerz_x = 1023; |
| 155 | 153 | |
| 156 | | state->m_dial_last_input[0] = newy; |
| 157 | | state->m_dial_last_input[1] = newx; |
| 154 | m_dial_last_input[0] = newy; |
| 155 | m_dial_last_input[1] = newx; |
| 158 | 156 | } |
| 159 | 157 | |
| 160 | 158 | |
| 161 | 159 | READ8_MEMBER(leland_state::dangerz_input_y_r) |
| 162 | 160 | { |
| 163 | | update_dangerz_xy(machine()); |
| 161 | update_dangerz_xy(); |
| 164 | 162 | return m_dangerz_y & 0xff; |
| 165 | 163 | } |
| 166 | 164 | |
| 167 | 165 | |
| 168 | 166 | READ8_MEMBER(leland_state::dangerz_input_x_r) |
| 169 | 167 | { |
| 170 | | update_dangerz_xy(machine()); |
| 168 | update_dangerz_xy(); |
| 171 | 169 | return m_dangerz_x & 0xff; |
| 172 | 170 | } |
| 173 | 171 | |
| 174 | 172 | |
| 175 | 173 | READ8_MEMBER(leland_state::dangerz_input_upper_r) |
| 176 | 174 | { |
| 177 | | update_dangerz_xy(machine()); |
| 175 | update_dangerz_xy(); |
| 178 | 176 | return ((m_dangerz_y >> 2) & 0xc0) | ((m_dangerz_x >> 8) & 0x03); |
| 179 | 177 | } |
| 180 | 178 | |
| r20832 | r20833 | |
| 204 | 202 | |
| 205 | 203 | READ8_MEMBER(leland_state::redline_wheel_1_r) |
| 206 | 204 | { |
| 207 | | return dial_compute_value(machine(), ioport("AN0")->read(), 0); |
| 205 | return dial_compute_value(ioport("AN0")->read(), 0); |
| 208 | 206 | } |
| 209 | 207 | |
| 210 | 208 | |
| 211 | 209 | READ8_MEMBER(leland_state::redline_wheel_2_r) |
| 212 | 210 | { |
| 213 | | return dial_compute_value(machine(), ioport("AN1")->read(), 1); |
| 211 | return dial_compute_value(ioport("AN1")->read(), 1); |
| 214 | 212 | } |
| 215 | 213 | |
| 216 | 214 | |
| r20832 | r20833 | |
| 223 | 221 | |
| 224 | 222 | READ8_MEMBER(leland_state::offroad_wheel_1_r) |
| 225 | 223 | { |
| 226 | | return dial_compute_value(machine(), ioport("AN3")->read(), 0); |
| 224 | return dial_compute_value(ioport("AN3")->read(), 0); |
| 227 | 225 | } |
| 228 | 226 | |
| 229 | 227 | |
| 230 | 228 | READ8_MEMBER(leland_state::offroad_wheel_2_r) |
| 231 | 229 | { |
| 232 | | return dial_compute_value(machine(), ioport("AN4")->read(), 1); |
| 230 | return dial_compute_value(ioport("AN4")->read(), 1); |
| 233 | 231 | } |
| 234 | 232 | |
| 235 | 233 | |
| 236 | 234 | READ8_MEMBER(leland_state::offroad_wheel_3_r) |
| 237 | 235 | { |
| 238 | | return dial_compute_value(machine(), ioport("AN5")->read(), 2); |
| 236 | return dial_compute_value(ioport("AN5")->read(), 2); |
| 239 | 237 | } |
| 240 | 238 | |
| 241 | 239 | |
| r20832 | r20833 | |
| 250 | 248 | { |
| 251 | 249 | static const char *const tracknames[] = { "AN0", "AN1", "AN2", "AN3" }; |
| 252 | 250 | |
| 253 | | return dial_compute_value(machine(), ioport(tracknames[offset])->read(), offset); |
| 251 | return dial_compute_value(ioport(tracknames[offset])->read(), offset); |
| 254 | 252 | } |
| 255 | 253 | |
| 256 | 254 | |
| r20832 | r20833 | |
| 265 | 263 | { |
| 266 | 264 | static const char *const tracknames[] = { "AN0", "AN1", "AN2" }; |
| 267 | 265 | |
| 268 | | return dial_compute_value(machine(), ioport(tracknames[offset])->read(), offset); |
| 266 | return dial_compute_value(ioport(tracknames[offset])->read(), offset); |
| 269 | 267 | } |
| 270 | 268 | |
| 271 | 269 | |
| r20832 | r20833 | |
| 355 | 353 | /* initialize the master banks */ |
| 356 | 354 | m_master_length = memregion("master")->bytes(); |
| 357 | 355 | m_master_base = memregion("master")->base(); |
| 358 | | (*m_update_master_bank)(machine()); |
| 356 | (this->*m_update_master_bank)(); |
| 359 | 357 | |
| 360 | 358 | /* initialize the slave banks */ |
| 361 | 359 | m_slave_length = memregion("slave")->bytes(); |
| r20832 | r20833 | |
| 399 | 397 | /* initialize the master banks */ |
| 400 | 398 | m_master_length = memregion("master")->bytes(); |
| 401 | 399 | m_master_base = memregion("master")->base(); |
| 402 | | ataxx_bankswitch(machine()); |
| 400 | ataxx_bankswitch(); |
| 403 | 401 | |
| 404 | 402 | /* initialize the slave banks */ |
| 405 | 403 | m_slave_length = memregion("slave")->bytes(); |
| r20832 | r20833 | |
| 466 | 464 | if ((m_alternate_bank ^ data) & 0x0f) |
| 467 | 465 | logerror("%04X:alternate_bank = %02X\n", space.device().safe_pc(), data & 0x0f); |
| 468 | 466 | m_alternate_bank = data & 15; |
| 469 | | (*m_update_master_bank)(machine()); |
| 467 | (this->*m_update_master_bank)(); |
| 470 | 468 | |
| 471 | 469 | /* sound control is in the rest */ |
| 472 | 470 | leland_80186_control_w(machine().device("custom"), space, offset, data); |
| r20832 | r20833 | |
| 474 | 472 | |
| 475 | 473 | |
| 476 | 474 | /* bankswitching for Cerberus */ |
| 477 | | void cerberus_bankswitch(running_machine &machine) |
| 475 | void leland_state::cerberus_bankswitch() |
| 478 | 476 | { |
| 479 | 477 | /* no bankswitching */ |
| 480 | 478 | } |
| 481 | 479 | |
| 482 | 480 | |
| 483 | 481 | /* bankswitching for Mayhem 2002, Power Play, World Series Baseball, and Alley Master */ |
| 484 | | void mayhem_bankswitch(running_machine &machine) |
| 482 | void leland_state::mayhem_bankswitch() |
| 485 | 483 | { |
| 486 | | leland_state *state = machine.driver_data<leland_state>(); |
| 487 | 484 | UINT8 *address; |
| 488 | 485 | |
| 489 | | state->m_battery_ram_enable = ((state->m_sound_port_bank & 0x24) == 0); |
| 486 | m_battery_ram_enable = ((m_sound_port_bank & 0x24) == 0); |
| 490 | 487 | |
| 491 | | address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000]; |
| 492 | | state->membank("bank1")->set_base(address); |
| 488 | address = (!(m_sound_port_bank & 0x04)) ? &m_master_base[0x10000] : &m_master_base[0x1c000]; |
| 489 | membank("bank1")->set_base(address); |
| 493 | 490 | |
| 494 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; |
| 495 | | state->membank("bank2")->set_base(address); |
| 491 | address = m_battery_ram_enable ? m_battery_ram : &address[0x8000]; |
| 492 | membank("bank2")->set_base(address); |
| 496 | 493 | } |
| 497 | 494 | |
| 498 | 495 | |
| 499 | 496 | /* bankswitching for Danger Zone */ |
| 500 | | void dangerz_bankswitch(running_machine &machine) |
| 497 | void leland_state::dangerz_bankswitch() |
| 501 | 498 | { |
| 502 | | leland_state *state = machine.driver_data<leland_state>(); |
| 503 | 499 | UINT8 *address; |
| 504 | 500 | |
| 505 | | state->m_battery_ram_enable = ((state->m_top_board_bank & 0x80) != 0); |
| 501 | m_battery_ram_enable = ((m_top_board_bank & 0x80) != 0); |
| 506 | 502 | |
| 507 | | address = (!(state->m_alternate_bank & 1)) ? &state->m_master_base[0x02000] : &state->m_master_base[0x12000]; |
| 508 | | state->membank("bank1")->set_base(address); |
| 503 | address = (!(m_alternate_bank & 1)) ? &m_master_base[0x02000] : &m_master_base[0x12000]; |
| 504 | membank("bank1")->set_base(address); |
| 509 | 505 | |
| 510 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; |
| 511 | | state->membank("bank2")->set_base(address); |
| 506 | address = m_battery_ram_enable ? m_battery_ram : &address[0x8000]; |
| 507 | membank("bank2")->set_base(address); |
| 512 | 508 | } |
| 513 | 509 | |
| 514 | 510 | |
| 515 | 511 | /* bankswitching for Baseball the Season II, Super Baseball, and Strike Zone */ |
| 516 | | void basebal2_bankswitch(running_machine &machine) |
| 512 | void leland_state::basebal2_bankswitch() |
| 517 | 513 | { |
| 518 | | leland_state *state = machine.driver_data<leland_state>(); |
| 519 | 514 | UINT8 *address; |
| 520 | 515 | |
| 521 | | state->m_battery_ram_enable = (state->m_top_board_bank & 0x80); |
| 516 | m_battery_ram_enable = (m_top_board_bank & 0x80); |
| 522 | 517 | |
| 523 | | if (!state->m_battery_ram_enable) |
| 524 | | address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000]; |
| 518 | if (!m_battery_ram_enable) |
| 519 | address = (!(m_sound_port_bank & 0x04)) ? &m_master_base[0x10000] : &m_master_base[0x1c000]; |
| 525 | 520 | else |
| 526 | | address = (!(state->m_top_board_bank & 0x40)) ? &state->m_master_base[0x28000] : &state->m_master_base[0x30000]; |
| 527 | | state->membank("bank1")->set_base(address); |
| 521 | address = (!(m_top_board_bank & 0x40)) ? &m_master_base[0x28000] : &m_master_base[0x30000]; |
| 522 | membank("bank1")->set_base(address); |
| 528 | 523 | |
| 529 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; |
| 530 | | state->membank("bank2")->set_base(address); |
| 524 | address = m_battery_ram_enable ? m_battery_ram : &address[0x8000]; |
| 525 | membank("bank2")->set_base(address); |
| 531 | 526 | } |
| 532 | 527 | |
| 533 | 528 | |
| 534 | 529 | /* bankswitching for Red Line Racer */ |
| 535 | | void redline_bankswitch(running_machine &machine) |
| 530 | void leland_state::redline_bankswitch() |
| 536 | 531 | { |
| 537 | | leland_state *state = machine.driver_data<leland_state>(); |
| 538 | 532 | static const UINT32 bank_list[] = { 0x10000, 0x18000, 0x02000, 0x02000 }; |
| 539 | 533 | UINT8 *address; |
| 540 | 534 | |
| 541 | | state->m_battery_ram_enable = ((state->m_alternate_bank & 3) == 1); |
| 535 | m_battery_ram_enable = ((m_alternate_bank & 3) == 1); |
| 542 | 536 | |
| 543 | | address = &state->m_master_base[bank_list[state->m_alternate_bank & 3]]; |
| 544 | | state->membank("bank1")->set_base(address); |
| 537 | address = &m_master_base[bank_list[m_alternate_bank & 3]]; |
| 538 | membank("bank1")->set_base(address); |
| 545 | 539 | |
| 546 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; |
| 547 | | state->membank("bank2")->set_base(address); |
| 540 | address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000]; |
| 541 | membank("bank2")->set_base(address); |
| 548 | 542 | } |
| 549 | 543 | |
| 550 | 544 | |
| 551 | 545 | /* bankswitching for Viper, Quarterback, Team Quarterback, and All American Football */ |
| 552 | | void viper_bankswitch(running_machine &machine) |
| 546 | void leland_state::viper_bankswitch() |
| 553 | 547 | { |
| 554 | | leland_state *state = machine.driver_data<leland_state>(); |
| 555 | 548 | static const UINT32 bank_list[] = { 0x02000, 0x10000, 0x18000, 0x02000 }; |
| 556 | 549 | UINT8 *address; |
| 557 | 550 | |
| 558 | | state->m_battery_ram_enable = ((state->m_alternate_bank & 0x04) != 0); |
| 551 | m_battery_ram_enable = ((m_alternate_bank & 0x04) != 0); |
| 559 | 552 | |
| 560 | | address = &state->m_master_base[bank_list[state->m_alternate_bank & 3]]; |
| 561 | | if (bank_list[state->m_alternate_bank & 3] >= state->m_master_length) |
| 553 | address = &m_master_base[bank_list[m_alternate_bank & 3]]; |
| 554 | if (bank_list[m_alternate_bank & 3] >= m_master_length) |
| 562 | 555 | { |
| 563 | | logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 3); |
| 564 | | address = &state->m_master_base[bank_list[0]]; |
| 556 | logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_alternate_bank & 3); |
| 557 | address = &m_master_base[bank_list[0]]; |
| 565 | 558 | } |
| 566 | | state->membank("bank1")->set_base(address); |
| 559 | membank("bank1")->set_base(address); |
| 567 | 560 | |
| 568 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; |
| 569 | | state->membank("bank2")->set_base(address); |
| 561 | address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000]; |
| 562 | membank("bank2")->set_base(address); |
| 570 | 563 | } |
| 571 | 564 | |
| 572 | 565 | |
| 573 | 566 | /* bankswitching for Super Offroad, Super Offroad Track Pack, and Pig Out */ |
| 574 | | void offroad_bankswitch(running_machine &machine) |
| 567 | void leland_state::offroad_bankswitch() |
| 575 | 568 | { |
| 576 | | leland_state *state = machine.driver_data<leland_state>(); |
| 577 | 569 | static const UINT32 bank_list[] = { 0x02000, 0x02000, 0x10000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000 }; |
| 578 | 570 | UINT8 *address; |
| 579 | 571 | |
| 580 | | state->m_battery_ram_enable = ((state->m_alternate_bank & 7) == 1); |
| 572 | m_battery_ram_enable = ((m_alternate_bank & 7) == 1); |
| 581 | 573 | |
| 582 | | address = &state->m_master_base[bank_list[state->m_alternate_bank & 7]]; |
| 583 | | if (bank_list[state->m_alternate_bank & 7] >= state->m_master_length) |
| 574 | address = &m_master_base[bank_list[m_alternate_bank & 7]]; |
| 575 | if (bank_list[m_alternate_bank & 7] >= m_master_length) |
| 584 | 576 | { |
| 585 | | logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 7); |
| 586 | | address = &state->m_master_base[bank_list[0]]; |
| 577 | logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_alternate_bank & 7); |
| 578 | address = &m_master_base[bank_list[0]]; |
| 587 | 579 | } |
| 588 | | state->membank("bank1")->set_base(address); |
| 580 | membank("bank1")->set_base(address); |
| 589 | 581 | |
| 590 | | address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; |
| 591 | | state->membank("bank2")->set_base(address); |
| 582 | address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000]; |
| 583 | membank("bank2")->set_base(address); |
| 592 | 584 | } |
| 593 | 585 | |
| 594 | 586 | |
| 595 | 587 | /* bankswitching for Ataxx, WSF, Indy Heat, and Brute Force */ |
| 596 | | void ataxx_bankswitch(running_machine &machine) |
| 588 | void leland_state::ataxx_bankswitch() |
| 597 | 589 | { |
| 598 | | leland_state *state = machine.driver_data<leland_state>(); |
| 599 | 590 | static const UINT32 bank_list[] = |
| 600 | 591 | { |
| 601 | 592 | 0x02000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000, 0x40000, 0x48000, |
| r20832 | r20833 | |
| 603 | 594 | }; |
| 604 | 595 | UINT8 *address; |
| 605 | 596 | |
| 606 | | state->m_battery_ram_enable = ((state->m_master_bank & 0x30) == 0x10); |
| 597 | m_battery_ram_enable = ((m_master_bank & 0x30) == 0x10); |
| 607 | 598 | |
| 608 | | address = &state->m_master_base[bank_list[state->m_master_bank & 15]]; |
| 609 | | if (bank_list[state->m_master_bank & 15] >= state->m_master_length) |
| 599 | address = &m_master_base[bank_list[m_master_bank & 15]]; |
| 600 | if (bank_list[m_master_bank & 15] >= m_master_length) |
| 610 | 601 | { |
| 611 | | logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_master_bank & 15); |
| 612 | | address = &state->m_master_base[bank_list[0]]; |
| 602 | logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_master_bank & 15); |
| 603 | address = &m_master_base[bank_list[0]]; |
| 613 | 604 | } |
| 614 | | state->membank("bank1")->set_base(address); |
| 605 | membank("bank1")->set_base(address); |
| 615 | 606 | |
| 616 | | if (state->m_battery_ram_enable) |
| 617 | | address = state->m_battery_ram; |
| 618 | | else if ((state->m_master_bank & 0x30) == 0x20) |
| 619 | | address = &state->m_ataxx_qram[(state->m_master_bank & 0xc0) << 8]; |
| 607 | if (m_battery_ram_enable) |
| 608 | address = m_battery_ram; |
| 609 | else if ((m_master_bank & 0x30) == 0x20) |
| 610 | address = &m_ataxx_qram[(m_master_bank & 0xc0) << 8]; |
| 620 | 611 | else |
| 621 | | address = &state->m_master_base[0xa000]; |
| 622 | | state->membank("bank2")->set_base(address); |
| 612 | address = &m_master_base[0xa000]; |
| 613 | membank("bank2")->set_base(address); |
| 623 | 614 | |
| 624 | | state->m_wcol_enable = ((state->m_master_bank & 0x30) == 0x30); |
| 615 | m_wcol_enable = ((m_master_bank & 0x30) == 0x30); |
| 625 | 616 | } |
| 626 | 617 | |
| 627 | 618 | |
| r20832 | r20833 | |
| 632 | 623 | * |
| 633 | 624 | *************************************/ |
| 634 | 625 | |
| 635 | | void leland_init_eeprom(running_machine &machine, UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type) |
| 626 | void leland_state::leland_init_eeprom(UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type) |
| 636 | 627 | { |
| 637 | 628 | UINT8 xorval = (serial_type == SERIAL_TYPE_ADD_XOR || serial_type == SERIAL_TYPE_ENCRYPT_XOR) ? 0xff : 0x00; |
| 638 | 629 | UINT8 eeprom_data[64*2]; |
| r20832 | r20833 | |
| 743 | 734 | * |
| 744 | 735 | *************************************/ |
| 745 | 736 | |
| 746 | | void ataxx_init_eeprom(running_machine &machine, const UINT16 *data) |
| 737 | void leland_state::ataxx_init_eeprom(const UINT16 *data) |
| 747 | 738 | { |
| 748 | 739 | UINT8 eeprom_data[128*2]; |
| 749 | 740 | UINT8 serial_offset = 0; |
| r20832 | r20833 | |
| 918 | 909 | |
| 919 | 910 | --------------------------------------------------------------------*/ |
| 920 | 911 | |
| 921 | | static int keycard_r(running_machine &machine) |
| 912 | int leland_state::keycard_r() |
| 922 | 913 | { |
| 923 | | leland_state *state = machine.driver_data<leland_state>(); |
| 924 | 914 | int result = 0; |
| 925 | 915 | |
| 926 | | if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_r)\n", machine.describe_context()); |
| 916 | if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_r)\n", machine().describe_context()); |
| 927 | 917 | |
| 928 | 918 | /* if we have a valid keycard read state, we're reading from the keycard */ |
| 929 | | if (state->m_keycard_state & 0x80) |
| 919 | if (m_keycard_state & 0x80) |
| 930 | 920 | { |
| 931 | 921 | /* clock in new data */ |
| 932 | | if (state->m_keycard_bit == 1) |
| 922 | if (m_keycard_bit == 1) |
| 933 | 923 | { |
| 934 | | state->m_keycard_shift = 0xff; /* no data, but this is where we would clock it in */ |
| 935 | | if (LOG_KEYCARDS) logerror(" (clocked in %02X)\n", state->m_keycard_shift); |
| 924 | m_keycard_shift = 0xff; /* no data, but this is where we would clock it in */ |
| 925 | if (LOG_KEYCARDS) logerror(" (clocked in %02X)\n", m_keycard_shift); |
| 936 | 926 | } |
| 937 | 927 | |
| 938 | 928 | /* clock in the bit */ |
| 939 | | result = (~state->m_keycard_shift & 1) << ((state->m_keycard_state >> 4) & 3); |
| 929 | result = (~m_keycard_shift & 1) << ((m_keycard_state >> 4) & 3); |
| 940 | 930 | if (LOG_KEYCARDS) logerror(" (read %02X)\n", result); |
| 941 | 931 | } |
| 942 | 932 | return result; |
| 943 | 933 | } |
| 944 | 934 | |
| 945 | | static void keycard_w(running_machine &machine, int data) |
| 935 | void leland_state::keycard_w(int data) |
| 946 | 936 | { |
| 947 | | leland_state *state = machine.driver_data<leland_state>(); |
| 948 | 937 | int new_state = data & 0xb0; |
| 949 | 938 | int new_clock = data & 0x40; |
| 950 | 939 | |
| 951 | | if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_w=%02X)\n", machine.describe_context(), data); |
| 940 | if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_w=%02X)\n", machine().describe_context(), data); |
| 952 | 941 | |
| 953 | 942 | /* check for going active */ |
| 954 | | if (!state->m_keycard_state && new_state) |
| 943 | if (!m_keycard_state && new_state) |
| 955 | 944 | { |
| 956 | | state->m_keycard_command[0] = state->m_keycard_command[1] = state->m_keycard_command[2] = 0; |
| 945 | m_keycard_command[0] = m_keycard_command[1] = m_keycard_command[2] = 0; |
| 957 | 946 | if (LOG_KEYCARDS) logerror("keycard going active (state=%02X)\n", new_state); |
| 958 | 947 | } |
| 959 | 948 | |
| 960 | 949 | /* check for going inactive */ |
| 961 | | else if (state->m_keycard_state && !new_state) |
| 950 | else if (m_keycard_state && !new_state) |
| 962 | 951 | { |
| 963 | | state->m_keycard_command[0] = state->m_keycard_command[1] = state->m_keycard_command[2] = 0; |
| 952 | m_keycard_command[0] = m_keycard_command[1] = m_keycard_command[2] = 0; |
| 964 | 953 | if (LOG_KEYCARDS) logerror("keycard going inactive\n"); |
| 965 | 954 | } |
| 966 | 955 | |
| 967 | 956 | /* check for clocks */ |
| 968 | | else if (state->m_keycard_state == new_state) |
| 957 | else if (m_keycard_state == new_state) |
| 969 | 958 | { |
| 970 | 959 | /* work off of falling edge */ |
| 971 | | if (!new_clock && state->m_keycard_clock) |
| 960 | if (!new_clock && m_keycard_clock) |
| 972 | 961 | { |
| 973 | | state->m_keycard_shift >>= 1; |
| 974 | | state->m_keycard_bit = (state->m_keycard_bit + 1) & 7; |
| 962 | m_keycard_shift >>= 1; |
| 963 | m_keycard_bit = (m_keycard_bit + 1) & 7; |
| 975 | 964 | } |
| 976 | 965 | |
| 977 | 966 | /* look for a bit write */ |
| 978 | | else if (!new_clock && !state->m_keycard_clock && !(data & 0x80)) |
| 967 | else if (!new_clock && !m_keycard_clock && !(data & 0x80)) |
| 979 | 968 | { |
| 980 | 969 | if (LOG_KEYCARDS) logerror(" (write %02X)\n", data); |
| 981 | 970 | |
| 982 | | state->m_keycard_shift &= ~0x80; |
| 971 | m_keycard_shift &= ~0x80; |
| 983 | 972 | if (data & (1 << ((new_state >> 4) & 3))) |
| 984 | | state->m_keycard_shift |= 0x80; |
| 973 | m_keycard_shift |= 0x80; |
| 985 | 974 | |
| 986 | 975 | /* clock out the data on the last bit */ |
| 987 | | if (state->m_keycard_bit == 7) |
| 976 | if (m_keycard_bit == 7) |
| 988 | 977 | { |
| 989 | | if (LOG_KEYCARDS) logerror(" (clocked out %02X)\n", state->m_keycard_shift); |
| 990 | | state->m_keycard_command[0] = state->m_keycard_command[1]; |
| 991 | | state->m_keycard_command[1] = state->m_keycard_command[2]; |
| 992 | | state->m_keycard_command[2] = state->m_keycard_shift; |
| 993 | | if (state->m_keycard_command[0] == 0x62 && state->m_keycard_command[1] == 0x00 && state->m_keycard_command[2] == 0x80) |
| 978 | if (LOG_KEYCARDS) logerror(" (clocked out %02X)\n", m_keycard_shift); |
| 979 | m_keycard_command[0] = m_keycard_command[1]; |
| 980 | m_keycard_command[1] = m_keycard_command[2]; |
| 981 | m_keycard_command[2] = m_keycard_shift; |
| 982 | if (m_keycard_command[0] == 0x62 && m_keycard_command[1] == 0x00 && m_keycard_command[2] == 0x80) |
| 994 | 983 | { |
| 995 | 984 | if (LOG_KEYCARDS) logerror(" (got command $62)\n"); |
| 996 | 985 | } |
| r20832 | r20833 | |
| 1002 | 991 | else |
| 1003 | 992 | { |
| 1004 | 993 | /* only an error if the selected bit changes; read/write transitions are okay */ |
| 1005 | | if ((new_state & 0x30) != (state->m_keycard_state & 0x30)) |
| 1006 | | if (LOG_KEYCARDS) logerror("ERROR: Caught keycard state transition %02X -> %02X\n", state->m_keycard_state, new_state); |
| 994 | if ((new_state & 0x30) != (m_keycard_state & 0x30)) |
| 995 | if (LOG_KEYCARDS) logerror("ERROR: Caught keycard state transition %02X -> %02X\n", m_keycard_state, new_state); |
| 1007 | 996 | } |
| 1008 | 997 | |
| 1009 | | state->m_keycard_state = new_state; |
| 1010 | | state->m_keycard_clock = new_clock; |
| 998 | m_keycard_state = new_state; |
| 999 | m_keycard_clock = new_clock; |
| 1011 | 1000 | } |
| 1012 | 1001 | |
| 1013 | 1002 | |
| r20832 | r20833 | |
| 1034 | 1023 | break; |
| 1035 | 1024 | |
| 1036 | 1025 | case 0x02: /* FF = keycard serial data read */ |
| 1037 | | result = keycard_r(machine()); |
| 1026 | result = keycard_r(); |
| 1038 | 1027 | |
| 1039 | 1028 | /* bit 7 indicates the analog input is busy for some games */ |
| 1040 | 1029 | result &= ~0x80; |
| r20832 | r20833 | |
| 1062 | 1051 | if ((m_top_board_bank ^ data) & 0xc0) |
| 1063 | 1052 | logerror("%04X:top_board_bank = %02X\n", space.device().safe_pc(), data & 0xc0); |
| 1064 | 1053 | m_top_board_bank = data & 0xc0; |
| 1065 | | (*m_update_master_bank)(machine()); |
| 1054 | (this->*m_update_master_bank)(); |
| 1066 | 1055 | break; |
| 1067 | 1056 | |
| 1068 | 1057 | case 0x02: /* FF = keycard data write */ |
| 1069 | | keycard_w(machine(), data); |
| 1058 | keycard_w(data); |
| 1070 | 1059 | break; |
| 1071 | 1060 | } |
| 1072 | 1061 | } |
| r20832 | r20833 | |
| 1201 | 1190 | if ((m_master_bank ^ data) & 0xff) |
| 1202 | 1191 | logerror("%04X:master_bank = %02X\n", space.device().safe_pc(), data & 0xff); |
| 1203 | 1192 | m_master_bank = data; |
| 1204 | | ataxx_bankswitch(machine()); |
| 1193 | ataxx_bankswitch(); |
| 1205 | 1194 | break; |
| 1206 | 1195 | |
| 1207 | 1196 | case 0x05: /* /SLV0 */ |
| r20832 | r20833 | |
| 1322 | 1311 | if ((m_sound_port_bank ^ data) & 0x24) |
| 1323 | 1312 | logerror("%s:sound_port_bank = %02X\n", machine().describe_context(), data & 0x24); |
| 1324 | 1313 | m_sound_port_bank = data & 0x24; |
| 1325 | | (*m_update_master_bank)(machine()); |
| 1314 | (this->*m_update_master_bank)(); |
| 1326 | 1315 | } |
| 1327 | 1316 | |
| 1328 | 1317 | |
| r20832 | r20833 | |
| 1408 | 1397 | *************************************/ |
| 1409 | 1398 | |
| 1410 | 1399 | /* also called by Ataxx */ |
| 1411 | | void leland_rotate_memory(running_machine &machine, const char *cpuname) |
| 1400 | void leland_state::leland_rotate_memory(const char *cpuname) |
| 1412 | 1401 | { |
| 1413 | 1402 | int startaddr = 0x10000; |
| 1414 | | int banks = (machine.root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000; |
| 1415 | | UINT8 *ram = machine.root_device().memregion(cpuname)->base(); |
| 1403 | int banks = (machine().root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000; |
| 1404 | UINT8 *ram = machine().root_device().memregion(cpuname)->base(); |
| 1416 | 1405 | UINT8 temp[0x2000]; |
| 1417 | 1406 | int i; |
| 1418 | 1407 | |
trunk/src/mame/video/liberate.c
| r20832 | r20833 | |
| 15 | 15 | #include "includes/liberate.h" |
| 16 | 16 | |
| 17 | 17 | #if 0 |
| 18 | | void debug_print(bitmap_ind16 &bitmap) |
| 18 | void liberate_state::debug_print(bitmap_ind16 &bitmap) |
| 19 | 19 | { |
| 20 | 20 | int i, j; |
| 21 | 21 | char buf[20 * 16]; |
| r20832 | r20833 | |
| 278 | 278 | |
| 279 | 279 | /***************************************************************************/ |
| 280 | 280 | |
| 281 | | static void liberate_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 281 | void liberate_state::liberate_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 282 | 282 | { |
| 283 | | liberate_state *state = machine.driver_data<liberate_state>(); |
| 284 | | UINT8 *spriteram = state->m_spriteram; |
| 283 | UINT8 *spriteram = m_spriteram; |
| 285 | 284 | int offs; |
| 286 | 285 | |
| 287 | 286 | /* Sprites */ |
| r20832 | r20833 | |
| 314 | 313 | if (multi && fy == 0) |
| 315 | 314 | sy -= 16; |
| 316 | 315 | |
| 317 | | if (state->flip_screen()) |
| 316 | if (flip_screen()) |
| 318 | 317 | { |
| 319 | 318 | sy = 240 - sy; |
| 320 | 319 | sx = 240 - sx; |
| r20832 | r20833 | |
| 333 | 332 | sy2 = sy + 16; |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 335 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 337 | 336 | code, |
| 338 | 337 | color, |
| 339 | 338 | fx,fy, |
| 340 | 339 | sx,sy,0); |
| 341 | 340 | if (multi) |
| 342 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 341 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 343 | 342 | code+1, |
| 344 | 343 | color, |
| 345 | 344 | fx,fy, |
| r20832 | r20833 | |
| 347 | 346 | } |
| 348 | 347 | } |
| 349 | 348 | |
| 350 | | static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 349 | void liberate_state::prosport_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 351 | 350 | { |
| 352 | | liberate_state *state = machine.driver_data<liberate_state>(); |
| 353 | 351 | int offs, multi, fx, fy, sx, sy, sy2, code, code2, color, gfx_region; |
| 354 | | UINT8 *spriteram = state->m_spriteram; |
| 352 | UINT8 *spriteram = m_spriteram; |
| 355 | 353 | |
| 356 | 354 | for (offs = 0x000; offs < 0x800; offs += 4) |
| 357 | 355 | { |
| r20832 | r20833 | |
| 361 | 359 | code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0x3) << 8); |
| 362 | 360 | code2 = code + 1; |
| 363 | 361 | |
| 364 | | if(state->m_io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf |
| 362 | if(m_io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf |
| 365 | 363 | gfx_region = 3 + 4; |
| 366 | 364 | else |
| 367 | | gfx_region = ((state->m_io_ram[0] & 0x30) >> 4) + 4; |
| 365 | gfx_region = ((m_io_ram[0] & 0x30) >> 4) + 4; |
| 368 | 366 | |
| 369 | 367 | |
| 370 | 368 | multi = spriteram[offs + 0] & 0x10; |
| r20832 | r20833 | |
| 376 | 374 | // sy = (240 - spriteram[offs + 2]);//-16; |
| 377 | 375 | sy = 240 - sy; |
| 378 | 376 | |
| 379 | | color = 1;//(state->m_io_ram[4] & 2) + 1;//(spriteram[offs + 0] & 0x4) >> 2; |
| 377 | color = 1;//(m_io_ram[4] & 2) + 1;//(spriteram[offs + 0] & 0x4) >> 2; |
| 380 | 378 | |
| 381 | 379 | fy = spriteram[offs + 0] & 0x02; |
| 382 | 380 | fx = spriteram[offs + 0] & 0x04; |
| r20832 | r20833 | |
| 385 | 383 | // if (multi) sy -= 16; |
| 386 | 384 | if ((fy && multi) || (fx && multi)) { code2 = code; code++; } |
| 387 | 385 | |
| 388 | | if (state->flip_screen()) |
| 386 | if (flip_screen()) |
| 389 | 387 | { |
| 390 | 388 | sy = 240 - sy; |
| 391 | 389 | sx = 240 - sx; |
| r20832 | r20833 | |
| 398 | 396 | sy2 = sy + 16; |
| 399 | 397 | } |
| 400 | 398 | |
| 401 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx_region], |
| 399 | drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx_region], |
| 402 | 400 | code, |
| 403 | 401 | color, |
| 404 | 402 | fx,fy, |
| 405 | 403 | sx,sy,0); |
| 406 | 404 | if (multi) |
| 407 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx_region], |
| 405 | drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx_region], |
| 408 | 406 | code2, |
| 409 | 407 | color, |
| 410 | 408 | fx,fy, |
| r20832 | r20833 | |
| 412 | 410 | } |
| 413 | 411 | } |
| 414 | 412 | |
| 415 | | static void boomrang_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) |
| 413 | void liberate_state::boomrang_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) |
| 416 | 414 | { |
| 417 | | liberate_state *state = machine.driver_data<liberate_state>(); |
| 418 | | UINT8 *spriteram = state->m_spriteram; |
| 415 | UINT8 *spriteram = m_spriteram; |
| 419 | 416 | int offs, multi, fx, fy, sx, sy, sy2, code, code2, color; |
| 420 | 417 | |
| 421 | 418 | for (offs = 0x000; offs < 0x800; offs += 4) |
| r20832 | r20833 | |
| 446 | 443 | // if (multi) sy -= 16; |
| 447 | 444 | if (fy && multi) { code2 = code; code++; } |
| 448 | 445 | |
| 449 | | if (state->flip_screen()) |
| 446 | if (flip_screen()) |
| 450 | 447 | { |
| 451 | 448 | sy = 240 - sy; |
| 452 | 449 | sx = 240 - sx; |
| r20832 | r20833 | |
| 459 | 456 | sy2 = sy + 16; |
| 460 | 457 | } |
| 461 | 458 | |
| 462 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 459 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 463 | 460 | code, |
| 464 | 461 | color, |
| 465 | 462 | fx,fy, |
| 466 | 463 | sx,sy,0); |
| 467 | 464 | if (multi) |
| 468 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 465 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 469 | 466 | code2, |
| 470 | 467 | color, |
| 471 | 468 | fx,fy, |
| r20832 | r20833 | |
| 473 | 470 | } |
| 474 | 471 | } |
| 475 | 472 | |
| 476 | | static void prosoccr_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 473 | void liberate_state::prosoccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 477 | 474 | { |
| 478 | | liberate_state *state = machine.driver_data<liberate_state>(); |
| 479 | | UINT8 *spriteram = state->m_spriteram; |
| 475 | UINT8 *spriteram = m_spriteram; |
| 480 | 476 | int offs, code, fx, fy, sx, sy; |
| 481 | 477 | |
| 482 | 478 | for (offs = 0x000; offs < 0x400; offs += 4) |
| r20832 | r20833 | |
| 490 | 486 | fx = spriteram[offs + 0] & 4; |
| 491 | 487 | fy = spriteram[offs + 0] & 2; |
| 492 | 488 | |
| 493 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 489 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 494 | 490 | code, |
| 495 | 491 | 0, |
| 496 | 492 | fx,fy, |
| r20832 | r20833 | |
| 511 | 507 | m_back_tilemap->draw(bitmap, cliprect, 0, 0); |
| 512 | 508 | |
| 513 | 509 | m_fix_tilemap->draw(bitmap, cliprect, 0, 0); |
| 514 | | prosoccr_draw_sprites(machine(), bitmap, cliprect); |
| 510 | prosoccr_draw_sprites(bitmap, cliprect); |
| 515 | 511 | |
| 516 | 512 | return 0; |
| 517 | 513 | } |
| r20832 | r20833 | |
| 554 | 550 | tile, 1, 0, 0, 248 - 8 * mx, 8 * my, 0); |
| 555 | 551 | } |
| 556 | 552 | |
| 557 | | prosport_draw_sprites(machine(), bitmap, cliprect); |
| 553 | prosport_draw_sprites(bitmap, cliprect); |
| 558 | 554 | |
| 559 | 555 | return 0; |
| 560 | 556 | } |
| r20832 | r20833 | |
| 569 | 565 | else |
| 570 | 566 | m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 571 | 567 | |
| 572 | | boomrang_draw_sprites(machine(),bitmap,cliprect,8); |
| 568 | boomrang_draw_sprites(bitmap,cliprect,8); |
| 573 | 569 | if (!m_background_disable) |
| 574 | 570 | m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); |
| 575 | 571 | |
| 576 | | boomrang_draw_sprites(machine(), bitmap, cliprect, 0); |
| 572 | boomrang_draw_sprites(bitmap, cliprect, 0); |
| 577 | 573 | m_fix_tilemap->draw(bitmap, cliprect, 0, 0); |
| 578 | 574 | return 0; |
| 579 | 575 | } |
| r20832 | r20833 | |
| 588 | 584 | else |
| 589 | 585 | m_back_tilemap->draw(bitmap, cliprect, 0, 0); |
| 590 | 586 | |
| 591 | | liberate_draw_sprites(machine(), bitmap, cliprect); |
| 587 | liberate_draw_sprites(bitmap, cliprect); |
| 592 | 588 | m_fix_tilemap->draw(bitmap, cliprect, 0, 0); |
| 593 | 589 | return 0; |
| 594 | 590 | } |
trunk/src/mame/video/lordgun.c
| r20832 | r20833 | |
| 61 | 61 | ***************************************************************************/ |
| 62 | 62 | |
| 63 | 63 | |
| 64 | | INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, int _N_) |
| 64 | inline void lordgun_state::get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_) |
| 65 | 65 | { |
| 66 | | lordgun_state *state = machine.driver_data<lordgun_state>(); |
| 67 | | UINT16 attr = state->m_vram[_N_][tile_index * 2 + 0 ]; |
| 68 | | UINT16 code = state->m_vram[_N_][ tile_index * 2 + 1 ]; |
| 66 | UINT16 attr = m_vram[_N_][tile_index * 2 + 0 ]; |
| 67 | UINT16 code = m_vram[_N_][ tile_index * 2 + 1 ]; |
| 69 | 68 | UINT16 pri = (attr & 0x0e00) >> 9; |
| 70 | | SET_TILE_INFO( _N_, code, ((attr & 0x0030) >> 4) + 0x10 + 0x4 * ((_N_ + 1) & 3) + pri*0x800/0x40, TILE_FLIPXY(attr >> 14)); |
| 69 | SET_TILE_INFO_MEMBER( _N_, code, ((attr & 0x0030) >> 4) + 0x10 + 0x4 * ((_N_ + 1) & 3) + pri*0x800/0x40, TILE_FLIPXY(attr >> 14)); |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_0){ get_tile_info(machine(), tileinfo, tile_index, 0); } |
| 74 | | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_1){ get_tile_info(machine(), tileinfo, tile_index, 1); } |
| 75 | | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_2){ get_tile_info(machine(), tileinfo, tile_index, 2); } |
| 76 | | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_3){ get_tile_info(machine(), tileinfo, tile_index, 3); } |
| 72 | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_0){ get_tile_info(tileinfo, tile_index, 0); } |
| 73 | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_1){ get_tile_info(tileinfo, tile_index, 1); } |
| 74 | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); } |
| 75 | TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); } |
| 77 | 76 | |
| 78 | | INLINE void lordgun_vram_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) |
| 77 | inline void lordgun_state::lordgun_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) |
| 79 | 78 | { |
| 80 | | lordgun_state *state = space.machine().driver_data<lordgun_state>(); |
| 81 | | COMBINE_DATA(&state->m_vram[_N_][offset]); |
| 82 | | state->m_tilemap[_N_]->mark_tile_dirty(offset/2); |
| 79 | COMBINE_DATA(&m_vram[_N_][offset]); |
| 80 | m_tilemap[_N_]->mark_tile_dirty(offset/2); |
| 83 | 81 | } |
| 84 | 82 | |
| 85 | | WRITE16_MEMBER(lordgun_state::lordgun_vram_0_w){ lordgun_vram_w(space, offset, data, mem_mask, 0); } |
| 86 | | WRITE16_MEMBER(lordgun_state::lordgun_vram_1_w){ lordgun_vram_w(space, offset, data, mem_mask, 1); } |
| 87 | | WRITE16_MEMBER(lordgun_state::lordgun_vram_2_w){ lordgun_vram_w(space, offset, data, mem_mask, 2); } |
| 88 | | WRITE16_MEMBER(lordgun_state::lordgun_vram_3_w){ lordgun_vram_w(space, offset, data, mem_mask, 3); } |
| 83 | WRITE16_MEMBER(lordgun_state::lordgun_vram_0_w){ lordgun_vram_w(offset, data, mem_mask, 0); } |
| 84 | WRITE16_MEMBER(lordgun_state::lordgun_vram_1_w){ lordgun_vram_w(offset, data, mem_mask, 1); } |
| 85 | WRITE16_MEMBER(lordgun_state::lordgun_vram_2_w){ lordgun_vram_w(offset, data, mem_mask, 2); } |
| 86 | WRITE16_MEMBER(lordgun_state::lordgun_vram_3_w){ lordgun_vram_w(offset, data, mem_mask, 3); } |
| 89 | 87 | |
| 90 | 88 | /*************************************************************************** |
| 91 | 89 | |
| r20832 | r20833 | |
| 182 | 180 | return lordgun_gun_x_table[x] * 1.0f / 0x1BF; |
| 183 | 181 | } |
| 184 | 182 | |
| 185 | | static void lorddgun_calc_gun_scr(running_machine &machine, int i) |
| 183 | void lordgun_state::lorddgun_calc_gun_scr(int i) |
| 186 | 184 | { |
| 187 | | lordgun_state *state = machine.driver_data<lordgun_state>(); |
| 188 | | // popmessage("%03x, %02x", machine, "LIGHT0_X"), state->ioport("LIGHT0_Y")->read()); |
| 185 | // popmessage("%03x, %02x", machine, "LIGHT0_X"), ioport("LIGHT0_Y")->read()); |
| 189 | 186 | |
| 190 | | int x = state->ioport(gunnames[i])->read() - 0x3c; |
| 187 | int x = ioport(gunnames[i])->read() - 0x3c; |
| 191 | 188 | |
| 192 | 189 | if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) ) |
| 193 | 190 | x = 0; |
| 194 | 191 | |
| 195 | | state->m_gun[i].scr_x = lordgun_gun_x_table[x]; |
| 196 | | state->m_gun[i].scr_y = state->ioport(gunnames[i+2])->read(); |
| 192 | m_gun[i].scr_x = lordgun_gun_x_table[x]; |
| 193 | m_gun[i].scr_y = ioport(gunnames[i+2])->read(); |
| 197 | 194 | } |
| 198 | 195 | |
| 199 | | void lordgun_update_gun(running_machine &machine, int i) |
| 196 | void lordgun_state::lordgun_update_gun(int i) |
| 200 | 197 | { |
| 201 | | lordgun_state *state = machine.driver_data<lordgun_state>(); |
| 202 | | const rectangle &visarea = machine.primary_screen->visible_area(); |
| 198 | const rectangle &visarea = machine().primary_screen->visible_area(); |
| 203 | 199 | |
| 204 | | state->m_gun[i].hw_x = state->ioport(gunnames[i])->read(); |
| 205 | | state->m_gun[i].hw_y = state->ioport(gunnames[i+2])->read(); |
| 200 | m_gun[i].hw_x = ioport(gunnames[i])->read(); |
| 201 | m_gun[i].hw_y = ioport(gunnames[i+2])->read(); |
| 206 | 202 | |
| 207 | | lorddgun_calc_gun_scr(machine, i); |
| 203 | lorddgun_calc_gun_scr(i); |
| 208 | 204 | |
| 209 | | if (!visarea.contains(state->m_gun[i].scr_x, state->m_gun[i].scr_y)) |
| 210 | | state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0; |
| 205 | if (!visarea.contains(m_gun[i].scr_x, m_gun[i].scr_y)) |
| 206 | m_gun[i].hw_x = m_gun[i].hw_y = 0; |
| 211 | 207 | } |
| 212 | 208 | |
| 213 | 209 | |
| r20832 | r20833 | |
| 235 | 231 | |
| 236 | 232 | ***************************************************************************/ |
| 237 | 233 | |
| 238 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 234 | void lordgun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 239 | 235 | { |
| 240 | | lordgun_state *state = machine.driver_data<lordgun_state>(); |
| 241 | | UINT16 *s = state->m_spriteram; |
| 242 | | UINT16 *end = state->m_spriteram + state->m_spriteram.bytes()/2; |
| 236 | UINT16 *s = m_spriteram; |
| 237 | UINT16 *end = m_spriteram + m_spriteram.bytes()/2; |
| 243 | 238 | |
| 244 | 239 | for ( ; s < end; s += 8/2 ) |
| 245 | 240 | { |
| r20832 | r20833 | |
| 278 | 273 | { |
| 279 | 274 | for (x = x0; x != x1; x += dx) |
| 280 | 275 | { |
| 281 | | drawgfx_transpen( bitmap, cliprect, machine.gfx[4], |
| 276 | drawgfx_transpen( bitmap, cliprect, machine().gfx[4], |
| 282 | 277 | code, color + pri * 0x800/0x40, |
| 283 | 278 | flipx, flipy, |
| 284 | 279 | sx + x * 0x10, sy + y * 0x10, |
| r20832 | r20833 | |
| 373 | 368 | if (layers_ctrl & 2) m_tilemap[1]->draw(*m_bitmaps[1], cliprect, 0, 0); |
| 374 | 369 | if (layers_ctrl & 4) m_tilemap[2]->draw(*m_bitmaps[2], cliprect, 0, 0); |
| 375 | 370 | if (layers_ctrl & 8) m_tilemap[3]->draw(*m_bitmaps[3], cliprect, 0, 0); |
| 376 | | if (layers_ctrl & 16) draw_sprites(machine(), *m_bitmaps[4], cliprect); |
| 371 | if (layers_ctrl & 16) draw_sprites(*m_bitmaps[4], cliprect); |
| 377 | 372 | |
| 378 | 373 | // copy to screen bitmap |
| 379 | 374 | |
trunk/src/mame/video/legionna.c
| r20832 | r20833 | |
| 245 | 245 | |
| 246 | 246 | *************************************************************************/ |
| 247 | 247 | |
| 248 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 248 | void legionna_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 249 | 249 | { |
| 250 | | legionna_state *state = machine.driver_data<legionna_state>(); |
| 251 | | UINT16 *spriteram16 = state->m_spriteram; |
| 250 | UINT16 *spriteram16 = m_spriteram; |
| 252 | 251 | int offs,fx,fy,x,y,color,sprite,cur_pri; |
| 253 | 252 | int dx,dy,ax,ay; |
| 254 | 253 | int pri_mask; |
| r20832 | r20833 | |
| 260 | 259 | |
| 261 | 260 | pri_mask = 0; |
| 262 | 261 | |
| 263 | | if (state->m_has_extended_priority) |
| 262 | if (m_has_extended_priority) |
| 264 | 263 | { |
| 265 | 264 | cur_pri = (spriteram16[offs+1] & 0xc000) >> 14; |
| 266 | 265 | |
| r20832 | r20833 | |
| 310 | 309 | |
| 311 | 310 | sprite &= 0x3fff; |
| 312 | 311 | |
| 313 | | if (state->m_has_extended_banking) |
| 312 | if (m_has_extended_banking) |
| 314 | 313 | { |
| 315 | 314 | if(data & 0x0040) |
| 316 | 315 | { |
| r20832 | r20833 | |
| 360 | 359 | for (ax=0; ax<dx; ax++) |
| 361 | 360 | for (ay=0; ay<dy; ay++) |
| 362 | 361 | { |
| 363 | | pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], |
| 362 | pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], |
| 364 | 363 | sprite++, |
| 365 | | color,fx,fy,(x+ax*16)+state->m_sprite_xoffs,y+ay*16+state->m_sprite_yoffs, |
| 366 | | machine.priority_bitmap,pri_mask, 15); |
| 364 | color,fx,fy,(x+ax*16)+m_sprite_xoffs,y+ay*16+m_sprite_yoffs, |
| 365 | machine().priority_bitmap,pri_mask, 15); |
| 367 | 366 | } |
| 368 | 367 | } |
| 369 | 368 | else |
| r20832 | r20833 | |
| 371 | 370 | for (ax=0; ax<dx; ax++) |
| 372 | 371 | for (ay=0; ay<dy; ay++) |
| 373 | 372 | { |
| 374 | | pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], |
| 373 | pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], |
| 375 | 374 | sprite++, |
| 376 | | color,fx,fy,(x+ax*16)+state->m_sprite_xoffs,y+(dy-ay-1)*16+state->m_sprite_yoffs, |
| 377 | | machine.priority_bitmap,pri_mask,15); |
| 375 | color,fx,fy,(x+ax*16)+m_sprite_xoffs,y+(dy-ay-1)*16+m_sprite_yoffs, |
| 376 | machine().priority_bitmap,pri_mask,15); |
| 378 | 377 | } |
| 379 | 378 | } |
| 380 | 379 | } |
| r20832 | r20833 | |
| 385 | 384 | for (ax=0; ax<dx; ax++) |
| 386 | 385 | for (ay=0; ay<dy; ay++) |
| 387 | 386 | { |
| 388 | | pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], |
| 387 | pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], |
| 389 | 388 | sprite++, |
| 390 | | color,fx,fy,(x+(dx-ax-1)*16)+state->m_sprite_xoffs,y+ay*16+state->m_sprite_yoffs, |
| 391 | | machine.priority_bitmap,pri_mask,15); |
| 389 | color,fx,fy,(x+(dx-ax-1)*16)+m_sprite_xoffs,y+ay*16+m_sprite_yoffs, |
| 390 | machine().priority_bitmap,pri_mask,15); |
| 392 | 391 | } |
| 393 | 392 | } |
| 394 | 393 | else |
| r20832 | r20833 | |
| 396 | 395 | for (ax=0; ax<dx; ax++) |
| 397 | 396 | for (ay=0; ay<dy; ay++) |
| 398 | 397 | { |
| 399 | | pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], |
| 398 | pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3], |
| 400 | 399 | sprite++, |
| 401 | | color,fx,fy,(x+(dx-ax-1)*16)+state->m_sprite_xoffs,y+(dy-ay-1)*16+state->m_sprite_yoffs, |
| 402 | | machine.priority_bitmap,pri_mask, 15); |
| 400 | color,fx,fy,(x+(dx-ax-1)*16)+m_sprite_xoffs,y+(dy-ay-1)*16+m_sprite_yoffs, |
| 401 | machine().priority_bitmap,pri_mask, 15); |
| 403 | 402 | } |
| 404 | 403 | } |
| 405 | 404 | } |
| r20832 | r20833 | |
| 430 | 429 | if (!(m_layer_disable&0x0002)) m_background_layer->draw(bitmap, cliprect, 0, 1); |
| 431 | 430 | if (!(m_layer_disable&0x0001)) m_text_layer->draw(bitmap, cliprect, 0, 2); |
| 432 | 431 | |
| 433 | | draw_sprites(machine(),bitmap,cliprect); |
| 432 | draw_sprites(bitmap,cliprect); |
| 434 | 433 | |
| 435 | 434 | |
| 436 | 435 | return 0; |
| r20832 | r20833 | |
| 460 | 459 | if (!(m_layer_disable&0x0004)) m_foreground_layer->draw(bitmap, cliprect, 0,1); |
| 461 | 460 | if (!(m_layer_disable&0x0008)) m_text_layer->draw(bitmap, cliprect, 0,2); |
| 462 | 461 | |
| 463 | | draw_sprites(machine(),bitmap,cliprect); |
| 462 | draw_sprites(bitmap,cliprect); |
| 464 | 463 | |
| 465 | 464 | return 0; |
| 466 | 465 | } |
| r20832 | r20833 | |
| 492 | 491 | if(!(m_layer_disable & 8)) |
| 493 | 492 | m_text_layer->draw(bitmap, cliprect, 0,8); |
| 494 | 493 | |
| 495 | | draw_sprites(machine(),bitmap,cliprect); |
| 494 | draw_sprites(bitmap,cliprect); |
| 496 | 495 | |
| 497 | 496 | return 0; |
| 498 | 497 | } |
trunk/src/mame/video/lsasquad.c
| r20832 | r20833 | |
| 1 | 1 | #include "emu.h" |
| 2 | 2 | #include "includes/lsasquad.h" |
| 3 | 3 | |
| 4 | | static void draw_layer( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *scrollram ) |
| 4 | void lsasquad_state::draw_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *scrollram ) |
| 5 | 5 | { |
| 6 | | lsasquad_state *state = machine.driver_data<lsasquad_state>(); |
| 7 | 6 | int offs, scrollx, scrolly; |
| 8 | 7 | |
| 9 | 8 | scrollx = scrollram[3]; |
| r20832 | r20833 | |
| 15 | 14 | |
| 16 | 15 | base = 64 * scrollram[offs + 1]; |
| 17 | 16 | sx = 8 * (offs / 4) + scrollx; |
| 18 | | if (state->flip_screen()) |
| 17 | if (flip_screen()) |
| 19 | 18 | sx = 248 - sx; |
| 20 | 19 | |
| 21 | 20 | sx &= 0xff; |
| r20832 | r20833 | |
| 25 | 24 | int attr; |
| 26 | 25 | |
| 27 | 26 | sy = 8 * y + scrolly; |
| 28 | | if (state->flip_screen()) |
| 27 | if (flip_screen()) |
| 29 | 28 | sy = 248 - sy; |
| 30 | 29 | sy &= 0xff; |
| 31 | 30 | |
| 32 | | attr = state->m_videoram[base + 2 * y + 1]; |
| 33 | | code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); |
| 31 | attr = m_videoram[base + 2 * y + 1]; |
| 32 | code = m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); |
| 34 | 33 | color = attr >> 4; |
| 35 | 34 | |
| 36 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[0], |
| 35 | drawgfx_transpen(bitmap,cliprect,machine().gfx[0], |
| 37 | 36 | code, |
| 38 | 37 | color, |
| 39 | | state->flip_screen(),state->flip_screen(), |
| 38 | flip_screen(),flip_screen(), |
| 40 | 39 | sx,sy,15); |
| 41 | 40 | if (sx > 248) /* wraparound */ |
| 42 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[0], |
| 41 | drawgfx_transpen(bitmap,cliprect,machine().gfx[0], |
| 43 | 42 | code, |
| 44 | 43 | color, |
| 45 | | state->flip_screen(),state->flip_screen(), |
| 44 | flip_screen(),flip_screen(), |
| 46 | 45 | sx-256,sy,15); |
| 47 | 46 | } |
| 48 | 47 | } |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | | static int draw_layer_daikaiju( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int * previd, int type ) |
| 50 | int lsasquad_state::draw_layer_daikaiju( bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int * previd, int type ) |
| 52 | 51 | { |
| 53 | | lsasquad_state *state = machine.driver_data<lsasquad_state>(); |
| 54 | 52 | int id, scrollx, scrolly, initoffs, globalscrollx; |
| 55 | 53 | int stepx = 0; |
| 56 | 54 | |
| 57 | 55 | initoffs = offs; |
| 58 | 56 | globalscrollx = 0; |
| 59 | 57 | |
| 60 | | id = state->m_scrollram[offs + 2]; |
| 58 | id = m_scrollram[offs + 2]; |
| 61 | 59 | |
| 62 | 60 | for( ; offs < 0x400; offs += 4) |
| 63 | 61 | { |
| 64 | 62 | int base, y, sx, sy, code, color; |
| 65 | 63 | |
| 66 | 64 | //id change |
| 67 | | if (id != state->m_scrollram[offs + 2]) |
| 65 | if (id != m_scrollram[offs + 2]) |
| 68 | 66 | { |
| 69 | 67 | *previd = id; |
| 70 | 68 | return offs; |
| 71 | 69 | } |
| 72 | 70 | else |
| 73 | 71 | { |
| 74 | | id = state->m_scrollram[offs + 2]; |
| 72 | id = m_scrollram[offs + 2]; |
| 75 | 73 | } |
| 76 | 74 | |
| 77 | 75 | //skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0) |
| 78 | | if ((state->m_scrollram[offs + 0] | state->m_scrollram[offs + 1] | state->m_scrollram[offs + 2] | state->m_scrollram[offs + 3]) == 0) |
| 76 | if ((m_scrollram[offs + 0] | m_scrollram[offs + 1] | m_scrollram[offs + 2] | m_scrollram[offs + 3]) == 0) |
| 79 | 77 | continue; |
| 80 | 78 | |
| 81 | 79 | //local scroll x/y |
| 82 | | scrolly = -state->m_scrollram[offs + 0]; |
| 83 | | scrollx = state->m_scrollram[offs + 3]; |
| 80 | scrolly = -m_scrollram[offs + 0]; |
| 81 | scrollx = m_scrollram[offs + 3]; |
| 84 | 82 | |
| 85 | 83 | //check for global x scroll used in bg layer in game (starts at offset 0 in scrollram |
| 86 | 84 | // and game name/logo on title screen (starts in the middle of scrollram, but with different |
| r20832 | r20833 | |
| 99 | 97 | } |
| 100 | 98 | } |
| 101 | 99 | |
| 102 | | base = 64 * state->m_scrollram[offs + 1]; |
| 100 | base = 64 * m_scrollram[offs + 1]; |
| 103 | 101 | sx = scrollx + stepx; |
| 104 | 102 | |
| 105 | | if (state->flip_screen()) |
| 103 | if (flip_screen()) |
| 106 | 104 | sx = 248 - sx; |
| 107 | 105 | sx &= 0xff; |
| 108 | 106 | |
| r20832 | r20833 | |
| 111 | 109 | int attr; |
| 112 | 110 | |
| 113 | 111 | sy = 8 * y + scrolly; |
| 114 | | if (state->flip_screen()) |
| 112 | if (flip_screen()) |
| 115 | 113 | sy = 248 - sy; |
| 116 | 114 | sy &= 0xff; |
| 117 | 115 | |
| 118 | | attr = state->m_videoram[base + 2 * y + 1]; |
| 119 | | code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); |
| 116 | attr = m_videoram[base + 2 * y + 1]; |
| 117 | code = m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); |
| 120 | 118 | color = attr >> 4; |
| 121 | 119 | |
| 122 | 120 | if ((type == 0 && color != 0x0d) || (type != 0 && color == 0x0d)) |
| 123 | 121 | { |
| 124 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[0], |
| 122 | drawgfx_transpen(bitmap,cliprect,machine().gfx[0], |
| 125 | 123 | code, |
| 126 | 124 | color, |
| 127 | | state->flip_screen(),state->flip_screen(), |
| 125 | flip_screen(),flip_screen(), |
| 128 | 126 | sx,sy,15); |
| 129 | 127 | if (sx > 248) /* wraparound */ |
| 130 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[0], |
| 128 | drawgfx_transpen(bitmap,cliprect,machine().gfx[0], |
| 131 | 129 | code, |
| 132 | 130 | color, |
| 133 | | state->flip_screen(),state->flip_screen(), |
| 131 | flip_screen(),flip_screen(), |
| 134 | 132 | sx-256,sy,15); |
| 135 | 133 | } |
| 136 | 134 | } |
| r20832 | r20833 | |
| 138 | 136 | return offs; |
| 139 | 137 | } |
| 140 | 138 | |
| 141 | | static void drawbg( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int type ) |
| 139 | void lsasquad_state::drawbg( bitmap_ind16 &bitmap, const rectangle &cliprect, int type ) |
| 142 | 140 | { |
| 143 | | lsasquad_state *state = machine.driver_data<lsasquad_state>(); |
| 144 | 141 | int i = 0; |
| 145 | 142 | int id = -1; |
| 146 | 143 | |
| 147 | 144 | while (i < 0x400) |
| 148 | 145 | { |
| 149 | | if (!(state->m_scrollram[i + 2] & 1)) |
| 146 | if (!(m_scrollram[i + 2] & 1)) |
| 150 | 147 | { |
| 151 | | i = draw_layer_daikaiju(machine, bitmap, cliprect, i, &id, type); |
| 148 | i = draw_layer_daikaiju(bitmap, cliprect, i, &id, type); |
| 152 | 149 | } |
| 153 | 150 | else |
| 154 | 151 | { |
| 155 | | id = state->m_scrollram[i + 2]; |
| 152 | id = m_scrollram[i + 2]; |
| 156 | 153 | i += 4; |
| 157 | 154 | } |
| 158 | 155 | } |
| 159 | 156 | } |
| 160 | 157 | |
| 161 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 158 | void lsasquad_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 162 | 159 | { |
| 163 | | lsasquad_state *state = machine.driver_data<lsasquad_state>(); |
| 164 | | UINT8 *spriteram = state->m_spriteram; |
| 160 | UINT8 *spriteram = m_spriteram; |
| 165 | 161 | int offs; |
| 166 | 162 | |
| 167 | | for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) |
| 163 | for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) |
| 168 | 164 | { |
| 169 | 165 | int sx, sy, attr, code, color, flipx, flipy; |
| 170 | 166 | |
| r20832 | r20833 | |
| 176 | 172 | flipx = attr & 0x40; |
| 177 | 173 | flipy = attr & 0x80; |
| 178 | 174 | |
| 179 | | if (state->flip_screen()) |
| 175 | if (flip_screen()) |
| 180 | 176 | { |
| 181 | 177 | sx = 240 - sx; |
| 182 | 178 | sy = 240 - sy; |
| r20832 | r20833 | |
| 184 | 180 | flipy = !flipy; |
| 185 | 181 | } |
| 186 | 182 | |
| 187 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 183 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 188 | 184 | code, |
| 189 | 185 | color, |
| 190 | 186 | flipx,flipy, |
| 191 | 187 | sx,sy,15); |
| 192 | 188 | /* wraparound */ |
| 193 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[1], |
| 189 | drawgfx_transpen(bitmap,cliprect,machine().gfx[1], |
| 194 | 190 | code, |
| 195 | 191 | color, |
| 196 | 192 | flipx,flipy, |
| r20832 | r20833 | |
| 202 | 198 | { |
| 203 | 199 | bitmap.fill(511, cliprect); |
| 204 | 200 | |
| 205 | | draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x000); |
| 206 | | draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x080); |
| 207 | | draw_sprites(machine(), bitmap, cliprect); |
| 208 | | draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x100); |
| 201 | draw_layer(bitmap, cliprect, m_scrollram + 0x000); |
| 202 | draw_layer(bitmap, cliprect, m_scrollram + 0x080); |
| 203 | draw_sprites(bitmap, cliprect); |
| 204 | draw_layer(bitmap, cliprect, m_scrollram + 0x100); |
| 209 | 205 | return 0; |
| 210 | 206 | } |
| 211 | 207 | |
| r20832 | r20833 | |
| 213 | 209 | UINT32 lsasquad_state::screen_update_daikaiju(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 214 | 210 | { |
| 215 | 211 | bitmap.fill(511, cliprect); |
| 216 | | drawbg(machine(), bitmap, cliprect, 0); // bottom |
| 217 | | draw_sprites(machine(), bitmap, cliprect); |
| 218 | | drawbg(machine(), bitmap, cliprect, 1); // top = palette $d ? |
| 212 | drawbg(bitmap, cliprect, 0); // bottom |
| 213 | draw_sprites(bitmap, cliprect); |
| 214 | drawbg(bitmap, cliprect, 1); // top = palette $d ? |
| 219 | 215 | return 0; |
| 220 | 216 | } |
trunk/src/mame/video/lockon.c
| r20832 | r20833 | |
| 163 | 163 | m_scroll_v = data & 0x81ff; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | | static void scene_draw( running_machine &machine ) |
| 166 | void lockon_state::scene_draw( ) |
| 167 | 167 | { |
| 168 | | lockon_state *state = machine.driver_data<lockon_state>(); |
| 169 | 168 | UINT32 y; |
| 170 | 169 | |
| 171 | 170 | /* 3bpp characters */ |
| 172 | | const UINT8 *const gfx1 = state->memregion("gfx2")->base(); |
| 171 | const UINT8 *const gfx1 = memregion("gfx2")->base(); |
| 173 | 172 | const UINT8 *const gfx2 = gfx1 + 0x10000; |
| 174 | 173 | const UINT8 *const gfx3 = gfx1 + 0x20000; |
| 175 | 174 | const UINT8 *const clut = gfx1 + 0x30000; |
| r20832 | r20833 | |
| 185 | 184 | UINT16 *bmpaddr; |
| 186 | 185 | UINT32 ram_mask = 0x7ff; |
| 187 | 186 | |
| 188 | | y_offs = (y + state->m_scroll_v) & 0x1ff; |
| 187 | y_offs = (y + m_scroll_v) & 0x1ff; |
| 189 | 188 | |
| 190 | 189 | /* Clamp - stops tilemap wrapping when screen is rotated */ |
| 191 | | if (BIT(state->m_scroll_v, 15) && y_offs & 0x100) |
| 190 | if (BIT(m_scroll_v, 15) && y_offs & 0x100) |
| 192 | 191 | ram_mask = 0x7; |
| 193 | 192 | |
| 194 | | x_offs = (state->m_scroll_h - 8) & 0x1ff; |
| 193 | x_offs = (m_scroll_h - 8) & 0x1ff; |
| 195 | 194 | y_gran = y_offs & 7; |
| 196 | 195 | |
| 197 | 196 | if (x_offs & 7) |
| 198 | 197 | { |
| 199 | 198 | UINT32 tileidx; |
| 200 | 199 | UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f); |
| 201 | | UINT16 ram_val = state->m_scene_ram[addr & ram_mask]; |
| 200 | UINT16 ram_val = m_scene_ram[addr & ram_mask]; |
| 202 | 201 | |
| 203 | 202 | colour = (clut[ram_val & 0x7fff] & 0x3f) << 3; |
| 204 | 203 | tileidx = ((ram_val & 0x0fff) << 3) + y_gran; |
| r20832 | r20833 | |
| 208 | 207 | d2 = *(gfx3 + tileidx); |
| 209 | 208 | } |
| 210 | 209 | |
| 211 | | bmpaddr = &state->m_back_buffer->pix16(y); |
| 210 | bmpaddr = &m_back_buffer->pix16(y); |
| 212 | 211 | |
| 213 | 212 | for (x = 0; x < FRAMEBUFFER_MAX_X; ++x) |
| 214 | 213 | { |
| r20832 | r20833 | |
| 219 | 218 | { |
| 220 | 219 | UINT32 tileidx; |
| 221 | 220 | UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f); |
| 222 | | UINT16 ram_val = state->m_scene_ram[addr & ram_mask]; |
| 221 | UINT16 ram_val = m_scene_ram[addr & ram_mask]; |
| 223 | 222 | |
| 224 | 223 | colour = (clut[ram_val & 0x7fff] & 0x3f) << 3; |
| 225 | 224 | tileidx = ((ram_val & 0x0fff) << 3) + y_gran; |
| r20832 | r20833 | |
| 299 | 298 | rom_data3 = gfx_rom[gfx_addr + 0x20000]; \ |
| 300 | 299 | } |
| 301 | 300 | |
| 302 | | static void ground_draw( running_machine &machine ) |
| 301 | void lockon_state::ground_draw( ) |
| 303 | 302 | { |
| 304 | | lockon_state *state = machine.driver_data<lockon_state>(); |
| 305 | 303 | |
| 306 | 304 | /* ROM pointers */ |
| 307 | | const UINT8 *const gfx_rom = state->memregion("gfx4")->base(); |
| 308 | | const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((state->m_ground_ctrl >> 2) & 0x3 ? 0x10000 : 0); |
| 305 | const UINT8 *const gfx_rom = memregion("gfx4")->base(); |
| 306 | const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((m_ground_ctrl >> 2) & 0x3 ? 0x10000 : 0); |
| 309 | 307 | const UINT8 *const clut_rom = gfx_rom + 0x50000; |
| 310 | 308 | |
| 311 | | UINT32 lut_a15_14 = (state->m_ground_ctrl & 0x3) << 14; |
| 312 | | UINT32 clut_a14_12 = (state->m_ground_ctrl & 0x70) << 8; |
| 313 | | UINT32 gfx_a15 = (state->m_ground_ctrl & 0x40) << 9; |
| 309 | UINT32 lut_a15_14 = (m_ground_ctrl & 0x3) << 14; |
| 310 | UINT32 clut_a14_12 = (m_ground_ctrl & 0x70) << 8; |
| 311 | UINT32 gfx_a15 = (m_ground_ctrl & 0x40) << 9; |
| 314 | 312 | UINT32 offs = 3; |
| 315 | 313 | UINT32 y; |
| 316 | 314 | |
| 317 | 315 | /* TODO: Clean up and emulate CS of GFX ROMs? */ |
| 318 | 316 | for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) |
| 319 | 317 | { |
| 320 | | UINT16 *bmpaddr = &state->m_back_buffer->pix16(y); |
| 318 | UINT16 *bmpaddr = &m_back_buffer->pix16(y); |
| 321 | 319 | UINT8 ls163; |
| 322 | 320 | UINT32 clut_addr; |
| 323 | 321 | UINT32 gfx_addr; |
| r20832 | r20833 | |
| 328 | 326 | UINT32 x; |
| 329 | 327 | |
| 330 | 328 | /* Draw this line? */ |
| 331 | | if (!(state->m_ground_ram[offs] & 0x8000)) |
| 329 | if (!(m_ground_ram[offs] & 0x8000)) |
| 332 | 330 | { |
| 333 | | UINT32 gfx_a2_0 = state->m_ground_ram[offs] & 0x0007; |
| 334 | | UINT32 gfx_a6_5 = (state->m_ground_ram[offs] & 0x0018) << 2; |
| 335 | | UINT32 clut_a4_3 = (state->m_ground_ram[offs] & 0x0018) >> 1; |
| 336 | | UINT8 tz2213_x = state->m_ground_ram[offs + 1] & 0xff; |
| 337 | | UINT8 tz2213_dx = state->m_ground_ram[offs + 2] & 0xff; |
| 331 | UINT32 gfx_a2_0 = m_ground_ram[offs] & 0x0007; |
| 332 | UINT32 gfx_a6_5 = (m_ground_ram[offs] & 0x0018) << 2; |
| 333 | UINT32 clut_a4_3 = (m_ground_ram[offs] & 0x0018) >> 1; |
| 334 | UINT8 tz2213_x = m_ground_ram[offs + 1] & 0xff; |
| 335 | UINT8 tz2213_dx = m_ground_ram[offs + 2] & 0xff; |
| 338 | 336 | |
| 339 | | UINT32 lut_address = lut_a15_14 + ((state->m_ground_ram[offs] & 0x7fe0) >> 1); |
| 340 | | UINT32 cy = state->m_ground_ram[offs + 2] & 0x0100; |
| 337 | UINT32 lut_address = lut_a15_14 + ((m_ground_ram[offs] & 0x7fe0) >> 1); |
| 338 | UINT32 cy = m_ground_ram[offs + 2] & 0x0100; |
| 341 | 339 | UINT32 color; |
| 342 | 340 | UINT32 gpbal2_0_prev; |
| 343 | 341 | |
| 344 | | ls163 = state->m_ground_ram[offs + 1] >> 8; |
| 342 | ls163 = m_ground_ram[offs + 1] >> 8; |
| 345 | 343 | |
| 346 | 344 | gpbal2_0_prev = ((ls163 & 3) << 1) | BIT(tz2213_x, 7); |
| 347 | 345 | |
| r20832 | r20833 | |
| 379 | 377 | offs += 3; |
| 380 | 378 | |
| 381 | 379 | /* End of list marker */ |
| 382 | | if (state->m_ground_ram[offs + 2] & 0x8000) |
| 380 | if (m_ground_ram[offs + 2] & 0x8000) |
| 383 | 381 | { |
| 384 | | state->m_bufend_timer->adjust(attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y)); |
| 382 | m_bufend_timer->adjust(attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y)); |
| 385 | 383 | } |
| 386 | 384 | } |
| 387 | 385 | } |
| r20832 | r20833 | |
| 418 | 416 | if (px < FRAMEBUFFER_MAX_X) \ |
| 419 | 417 | if (COLOR != 0xf) \ |
| 420 | 418 | { \ |
| 421 | | UINT8 clr = state->m_obj_pal_ram[(pal << 4) + COLOR]; \ |
| 419 | UINT8 clr = m_obj_pal_ram[(pal << 4) + COLOR]; \ |
| 422 | 420 | UINT16 *pix = (line + px); \ |
| 423 | 421 | if (!(clr == 0xff && ((*pix & 0xe00) == 0xa00))) \ |
| 424 | 422 | *pix = 0x400 + clr; \ |
| r20832 | r20833 | |
| 426 | 424 | px = (px + 1) & 0x7ff; \ |
| 427 | 425 | } while(0) |
| 428 | 426 | |
| 429 | | static void objects_draw( running_machine &machine ) |
| 427 | void lockon_state::objects_draw( ) |
| 430 | 428 | { |
| 431 | 429 | UINT32 offs; |
| 432 | | lockon_state *state = machine.driver_data<lockon_state>(); |
| 433 | 430 | |
| 434 | | const UINT8 *const romlut = state->memregion("user1")->base(); |
| 435 | | const UINT16 *const chklut = (UINT16*)state->memregion("user2")->base(); |
| 436 | | const UINT8 *const gfxrom = state->memregion("gfx5")->base(); |
| 437 | | const UINT8 *const sproms = state->memregion("proms")->base() + 0x800; |
| 431 | const UINT8 *const romlut = memregion("user1")->base(); |
| 432 | const UINT16 *const chklut = (UINT16*)memregion("user2")->base(); |
| 433 | const UINT8 *const gfxrom = memregion("gfx5")->base(); |
| 434 | const UINT8 *const sproms = memregion("proms")->base() + 0x800; |
| 438 | 435 | |
| 439 | | for (offs = 0; offs < state->m_object_ram.bytes(); offs += 4) |
| 436 | for (offs = 0; offs < m_object_ram.bytes(); offs += 4) |
| 440 | 437 | { |
| 441 | 438 | UINT32 y; |
| 442 | 439 | UINT32 xpos; |
| r20832 | r20833 | |
| 452 | 449 | UINT32 opsta15_8; |
| 453 | 450 | |
| 454 | 451 | /* Retrieve the object attributes */ |
| 455 | | ypos = state->m_object_ram[offs] & 0x03ff; |
| 456 | | xpos = state->m_object_ram[offs + 3] & 0x07ff; |
| 457 | | ysize = (state->m_object_ram[offs] >> 10) & 0x3; |
| 458 | | xsize = (state->m_object_ram[offs] >> 12) & 0x3; |
| 459 | | yflip = BIT(state->m_object_ram[offs], 14); |
| 460 | | xflip = BIT(state->m_object_ram[offs], 15); |
| 461 | | scale = state->m_object_ram[offs + 1] & 0xff; |
| 462 | | pal = (state->m_object_ram[offs + 1] >> 8) & 0x7f; |
| 463 | | opsta = state->m_object_ram[offs + 2]; |
| 452 | ypos = m_object_ram[offs] & 0x03ff; |
| 453 | xpos = m_object_ram[offs + 3] & 0x07ff; |
| 454 | ysize = (m_object_ram[offs] >> 10) & 0x3; |
| 455 | xsize = (m_object_ram[offs] >> 12) & 0x3; |
| 456 | yflip = BIT(m_object_ram[offs], 14); |
| 457 | xflip = BIT(m_object_ram[offs], 15); |
| 458 | scale = m_object_ram[offs + 1] & 0xff; |
| 459 | pal = (m_object_ram[offs + 1] >> 8) & 0x7f; |
| 460 | opsta = m_object_ram[offs + 2]; |
| 464 | 461 | |
| 465 | | if (state->m_iden) |
| 462 | if (m_iden) |
| 466 | 463 | { |
| 467 | | state->m_obj_pal_ram[(pal << 4) + state->m_obj_pal_addr] = state->m_obj_pal_latch; |
| 464 | m_obj_pal_ram[(pal << 4) + m_obj_pal_addr] = m_obj_pal_latch; |
| 468 | 465 | break; |
| 469 | 466 | } |
| 470 | 467 | |
| r20832 | r20833 | |
| 484 | 481 | UINT32 tile; |
| 485 | 482 | UINT8 cnt; |
| 486 | 483 | UINT32 yidx; |
| 487 | | UINT16 *line = &state->m_back_buffer->pix16(y); |
| 484 | UINT16 *line = &m_back_buffer->pix16(y); |
| 488 | 485 | UINT32 px = xpos; |
| 489 | 486 | |
| 490 | 487 | /* Outside the limits? */ |
| r20832 | r20833 | |
| 595 | 592 | } |
| 596 | 593 | |
| 597 | 594 | /* Check for the end of list marker */ |
| 598 | | if (state->m_object_ram[offs + 1] & 0x8000) |
| 595 | if (m_object_ram[offs + 1] & 0x8000) |
| 599 | 596 | return; |
| 600 | 597 | } |
| 601 | 598 | } |
| r20832 | r20833 | |
| 607 | 604 | { |
| 608 | 605 | m_obj_pal_latch = data & 0xff; |
| 609 | 606 | m_obj_pal_addr = offset & 0xf; |
| 610 | | objects_draw(machine()); |
| 607 | objects_draw(); |
| 611 | 608 | } |
| 612 | 609 | } |
| 613 | 610 | |
| r20832 | r20833 | |
| 684 | 681 | if (carry) --CNT; \ |
| 685 | 682 | } while(0) |
| 686 | 683 | |
| 687 | | static void rotate_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 684 | void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 688 | 685 | { |
| 689 | | lockon_state *state = machine.driver_data<lockon_state>(); |
| 690 | 686 | UINT32 y; |
| 691 | 687 | |
| 692 | 688 | /* Counters */ |
| 693 | | UINT32 cxy = state->m_xsal & 0xff; |
| 694 | | UINT32 cyy = state->m_ysal & 0x1ff; |
| 689 | UINT32 cxy = m_xsal & 0xff; |
| 690 | UINT32 cyy = m_ysal & 0x1ff; |
| 695 | 691 | |
| 696 | 692 | /* Accumulator values and deltas */ |
| 697 | | UINT8 axy = state->m_x0ll & 0xff; |
| 698 | | UINT8 daxy = state->m_dx0ll & 0xff; |
| 699 | | UINT8 ayy = state->m_y0ll & 0xff; |
| 700 | | UINT8 dayy = state->m_dy0ll & 0xff; |
| 701 | | UINT8 dayx = state->m_dyll & 0xff; |
| 702 | | UINT8 daxx = state->m_dxll & 0xff; |
| 693 | UINT8 axy = m_x0ll & 0xff; |
| 694 | UINT8 daxy = m_dx0ll & 0xff; |
| 695 | UINT8 ayy = m_y0ll & 0xff; |
| 696 | UINT8 dayy = m_dy0ll & 0xff; |
| 697 | UINT8 dayx = m_dyll & 0xff; |
| 698 | UINT8 daxx = m_dxll & 0xff; |
| 703 | 699 | |
| 704 | | UINT32 xy_up = BIT(state->m_xsal, 8); |
| 705 | | UINT32 yx_up = BIT(state->m_dyll, 9); |
| 706 | | UINT32 axx_en = !BIT(state->m_dxll, 8); |
| 707 | | UINT32 ayx_en = !BIT(state->m_dyll, 8); |
| 708 | | UINT32 axy_en = !BIT(state->m_dx0ll, 8); |
| 709 | | UINT32 ayy_en = !BIT(state->m_dy0ll, 8); |
| 700 | UINT32 xy_up = BIT(m_xsal, 8); |
| 701 | UINT32 yx_up = BIT(m_dyll, 9); |
| 702 | UINT32 axx_en = !BIT(m_dxll, 8); |
| 703 | UINT32 ayx_en = !BIT(m_dyll, 8); |
| 704 | UINT32 axy_en = !BIT(m_dx0ll, 8); |
| 705 | UINT32 ayy_en = !BIT(m_dy0ll, 8); |
| 710 | 706 | |
| 711 | 707 | for (y = 0; y <= cliprect.max_y; ++y) |
| 712 | 708 | { |
| r20832 | r20833 | |
| 725 | 721 | cx &= 0x1ff; |
| 726 | 722 | cy &= 0x1ff; |
| 727 | 723 | |
| 728 | | *dst++ = state->m_front_buffer->pix16(cy, cx); |
| 724 | *dst++ = m_front_buffer->pix16(cy, cx); |
| 729 | 725 | |
| 730 | 726 | if (axx_en) |
| 731 | 727 | INCREMENT(axx, cx); |
| r20832 | r20833 | |
| 789 | 785 | |
| 790 | 786 | *******************************************************************************************/ |
| 791 | 787 | |
| 792 | | static void hud_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 788 | void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 793 | 789 | { |
| 794 | | lockon_state *state = machine.driver_data<lockon_state>(); |
| 795 | | UINT8 *tile_rom = state->memregion("gfx3")->base(); |
| 790 | UINT8 *tile_rom = memregion("gfx3")->base(); |
| 796 | 791 | UINT32 offs; |
| 797 | 792 | |
| 798 | | for (offs = 0x0; offs <= state->m_hud_ram.bytes(); offs += 2) |
| 793 | for (offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) |
| 799 | 794 | { |
| 800 | 795 | UINT32 y; |
| 801 | 796 | UINT32 y_pos; |
| r20832 | r20833 | |
| 808 | 803 | UINT32 rom_a12_7; |
| 809 | 804 | |
| 810 | 805 | /* End of sprite list marker */ |
| 811 | | if (state->m_hud_ram[offs + 1] & 0x8000) |
| 806 | if (m_hud_ram[offs + 1] & 0x8000) |
| 812 | 807 | break; |
| 813 | 808 | |
| 814 | | y_pos = state->m_hud_ram[offs] & 0x1ff; |
| 815 | | x_pos = state->m_hud_ram[offs + 1] & 0x1ff; |
| 816 | | x_size = (state->m_hud_ram[offs + 1] >> 12) & 7; |
| 817 | | code = (state->m_hud_ram[offs] >> 9) & 0x7f; |
| 818 | | colour = 0x200 + ((state->m_hud_ram[offs + 1] >> 9) & 7); |
| 809 | y_pos = m_hud_ram[offs] & 0x1ff; |
| 810 | x_pos = m_hud_ram[offs + 1] & 0x1ff; |
| 811 | x_size = (m_hud_ram[offs + 1] >> 12) & 7; |
| 812 | code = (m_hud_ram[offs] >> 9) & 0x7f; |
| 813 | colour = 0x200 + ((m_hud_ram[offs + 1] >> 9) & 7); |
| 819 | 814 | layout = (code >> 5) & 3; |
| 820 | 815 | |
| 821 | 816 | rom_a12_7 = (code & 0xfe) << 6; |
| r20832 | r20833 | |
| 923 | 918 | } |
| 924 | 919 | |
| 925 | 920 | /* Scan out the frame buffer in rotated order */ |
| 926 | | rotate_draw(machine(), bitmap, cliprect); |
| 921 | rotate_draw(bitmap, cliprect); |
| 927 | 922 | |
| 928 | 923 | /* Draw the character tilemap */ |
| 929 | 924 | m_tilemap->draw(bitmap, cliprect, 0, 0); |
| 930 | 925 | |
| 931 | 926 | /* Draw the HUD */ |
| 932 | | hud_draw(machine(), bitmap, cliprect); |
| 927 | hud_draw(bitmap, cliprect); |
| 933 | 928 | |
| 934 | 929 | return 0; |
| 935 | 930 | } |
| r20832 | r20833 | |
| 945 | 940 | m_back_buffer = tmp; |
| 946 | 941 | |
| 947 | 942 | /* Draw the frame buffer layers */ |
| 948 | | scene_draw(machine()); |
| 949 | | ground_draw(machine()); |
| 950 | | objects_draw(machine()); |
| 943 | scene_draw(); |
| 944 | ground_draw(); |
| 945 | objects_draw(); |
| 951 | 946 | } |
| 952 | 947 | } |
trunk/src/mame/video/lasso.c
| r20832 | r20833 | |
| 38 | 38 | |
| 39 | 39 | ***************************************************************************/ |
| 40 | 40 | |
| 41 | | static rgb_t get_color( int data ) |
| 41 | rgb_t lasso_state::get_color( int data ) |
| 42 | 42 | { |
| 43 | 43 | int bit0, bit1, bit2; |
| 44 | 44 | int r, g, b; |
| r20832 | r20833 | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| 107 | | static void wwjgtin_set_last_four_colors( running_machine &machine, colortable_t *colortable ) |
| 107 | void lasso_state::wwjgtin_set_last_four_colors( colortable_t *colortable ) |
| 108 | 108 | { |
| 109 | | lasso_state *state = machine.driver_data<lasso_state>(); |
| 110 | 109 | int i; |
| 111 | 110 | |
| 112 | 111 | /* the last palette entries can be changed */ |
| 113 | 112 | for(i = 0; i < 3; i++) |
| 114 | | colortable_palette_set_color(colortable, 0x3d + i, get_color(state->m_last_colors[i])); |
| 113 | colortable_palette_set_color(colortable, 0x3d + i, get_color(m_last_colors[i])); |
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | |
| r20832 | r20833 | |
| 260 | 259 | * |
| 261 | 260 | *************************************/ |
| 262 | 261 | |
| 263 | | static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse ) |
| 262 | void lasso_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse ) |
| 264 | 263 | { |
| 265 | | lasso_state *state = machine.driver_data<lasso_state>(); |
| 266 | 264 | const UINT8 *finish, *source; |
| 267 | 265 | int inc; |
| 268 | 266 | |
| 269 | 267 | if (reverse) |
| 270 | 268 | { |
| 271 | | source = state->m_spriteram; |
| 272 | | finish = state->m_spriteram + state->m_spriteram.bytes(); |
| 269 | source = m_spriteram; |
| 270 | finish = m_spriteram + m_spriteram.bytes(); |
| 273 | 271 | inc = 4; |
| 274 | 272 | } |
| 275 | 273 | else |
| 276 | 274 | { |
| 277 | | source = state->m_spriteram + state->m_spriteram.bytes() - 4; |
| 278 | | finish = state->m_spriteram - 4; |
| 275 | source = m_spriteram + m_spriteram.bytes() - 4; |
| 276 | finish = m_spriteram - 4; |
| 279 | 277 | inc = -4; |
| 280 | 278 | } |
| 281 | 279 | |
| r20832 | r20833 | |
| 289 | 287 | flipx = source[1] & 0x40; |
| 290 | 288 | flipy = source[1] & 0x80; |
| 291 | 289 | |
| 292 | | if (state->flip_screen_x()) |
| 290 | if (flip_screen_x()) |
| 293 | 291 | { |
| 294 | 292 | sx = 240 - sx; |
| 295 | 293 | flipx = !flipx; |
| 296 | 294 | } |
| 297 | 295 | |
| 298 | | if (state->flip_screen_y()) |
| 296 | if (flip_screen_y()) |
| 299 | 297 | flipy = !flipy; |
| 300 | 298 | else |
| 301 | 299 | sy = 240 - sy; |
| r20832 | r20833 | |
| 303 | 301 | code = source[1] & 0x3f; |
| 304 | 302 | color = source[2] & 0x0f; |
| 305 | 303 | |
| 306 | | drawgfx_transpen(bitmap, cliprect, machine.gfx[1], |
| 307 | | code | ((UINT16)state->m_gfxbank << 6), |
| 304 | drawgfx_transpen(bitmap, cliprect, machine().gfx[1], |
| 305 | code | ((UINT16)m_gfxbank << 6), |
| 308 | 306 | color, |
| 309 | 307 | flipx, flipy, |
| 310 | 308 | sx,sy,0); |
| r20832 | r20833 | |
| 314 | 312 | } |
| 315 | 313 | |
| 316 | 314 | |
| 317 | | static void draw_lasso( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 315 | void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 318 | 316 | { |
| 319 | | lasso_state *state = machine.driver_data<lasso_state>(); |
| 320 | 317 | offs_t offs; |
| 321 | 318 | pen_t pen = 0x3f; |
| 322 | 319 | |
| r20832 | r20833 | |
| 327 | 324 | UINT8 x; |
| 328 | 325 | UINT8 y = offs >> 5; |
| 329 | 326 | |
| 330 | | if (state->flip_screen_y()) |
| 327 | if (flip_screen_y()) |
| 331 | 328 | y = ~y; |
| 332 | 329 | |
| 333 | 330 | if ((y < cliprect.min_y) || (y > cliprect.max_y)) |
| 334 | 331 | continue; |
| 335 | 332 | |
| 336 | 333 | x = (offs & 0x1f) << 3; |
| 337 | | data = state->m_bitmap_ram[offs]; |
| 334 | data = m_bitmap_ram[offs]; |
| 338 | 335 | |
| 339 | | if (state->flip_screen_x()) |
| 336 | if (flip_screen_x()) |
| 340 | 337 | x = ~x; |
| 341 | 338 | |
| 342 | 339 | for (bit = 0; bit < 8; bit++) |
| r20832 | r20833 | |
| 344 | 341 | if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x)) |
| 345 | 342 | bitmap.pix16(y, x) = pen; |
| 346 | 343 | |
| 347 | | if (state->flip_screen_x()) |
| 344 | if (flip_screen_x()) |
| 348 | 345 | x = x - 1; |
| 349 | 346 | else |
| 350 | 347 | x = x + 1; |
| r20832 | r20833 | |
| 361 | 358 | bitmap.fill(0, cliprect); |
| 362 | 359 | |
| 363 | 360 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 364 | | draw_lasso(machine(), bitmap, cliprect); |
| 365 | | draw_sprites(machine(), bitmap, cliprect, 0); |
| 361 | draw_lasso(bitmap, cliprect); |
| 362 | draw_sprites(bitmap, cliprect, 0); |
| 366 | 363 | |
| 367 | 364 | return 0; |
| 368 | 365 | } |
| r20832 | r20833 | |
| 373 | 370 | bitmap.fill(0, cliprect); |
| 374 | 371 | |
| 375 | 372 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 376 | | draw_sprites(machine(), bitmap, cliprect, 0); |
| 373 | draw_sprites(bitmap, cliprect, 0); |
| 377 | 374 | |
| 378 | 375 | return 0; |
| 379 | 376 | } |
| r20832 | r20833 | |
| 382 | 379 | UINT32 lasso_state::screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 383 | 380 | { |
| 384 | 381 | colortable_palette_set_color(machine().colortable, 0, get_color(*m_back_color)); |
| 385 | | wwjgtin_set_last_four_colors(machine(), machine().colortable); |
| 382 | wwjgtin_set_last_four_colors(machine().colortable); |
| 386 | 383 | |
| 387 | 384 | m_track_tilemap->set_scrollx(0, m_track_scroll[0] + m_track_scroll[1] * 256); |
| 388 | 385 | m_track_tilemap->set_scrolly(0, m_track_scroll[2] + m_track_scroll[3] * 256); |
| r20832 | r20833 | |
| 392 | 389 | else |
| 393 | 390 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 394 | 391 | |
| 395 | | draw_sprites(machine(), bitmap, cliprect, 1); // reverse order |
| 392 | draw_sprites(bitmap, cliprect, 1); // reverse order |
| 396 | 393 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 397 | 394 | |
| 398 | 395 | return 0; |
trunk/src/mame/drivers/leland.c
| r20832 | r20833 | |
| 1978 | 1978 | * |
| 1979 | 1979 | *************************************/ |
| 1980 | 1980 | |
| 1981 | | static void init_master_ports(running_machine &machine, UINT8 mvram_base, UINT8 io_base) |
| 1981 | void leland_state::init_master_ports(UINT8 mvram_base, UINT8 io_base) |
| 1982 | 1982 | { |
| 1983 | | leland_state *state = machine.driver_data<leland_state>(); |
| 1984 | 1983 | /* set up the master CPU VRAM I/O */ |
| 1985 | | machine.device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state)); |
| 1984 | machine().device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),this), write8_delegate(FUNC(leland_state::leland_mvram_port_w),this)); |
| 1986 | 1985 | |
| 1987 | 1986 | /* set up the master CPU I/O ports */ |
| 1988 | | machine.device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state)); |
| 1989 | | machine.device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state)); |
| 1987 | machine().device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),this)); |
| 1988 | machine().device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),this)); |
| 1990 | 1989 | } |
| 1991 | 1990 | |
| 1992 | 1991 | |
| 1993 | 1992 | DRIVER_INIT_MEMBER(leland_state,cerberus) |
| 1994 | 1993 | { |
| 1995 | 1994 | /* master CPU bankswitching */ |
| 1996 | | m_update_master_bank = cerberus_bankswitch; |
| 1995 | m_update_master_bank = &leland_state::cerberus_bankswitch; |
| 1997 | 1996 | membank("bank1")->set_base(memregion("master")->base() + 0x2000); |
| 1998 | 1997 | membank("bank2")->set_base(memregion("master")->base() + 0xa000); |
| 1999 | 1998 | membank("bank3")->set_base(memregion("slave")->base() + 0x2000); |
| 2000 | 1999 | |
| 2001 | 2000 | /* set up the master CPU I/O ports */ |
| 2002 | | init_master_ports(machine(), 0x40, 0x80); |
| 2001 | init_master_ports(0x40, 0x80); |
| 2003 | 2002 | |
| 2004 | 2003 | /* set up additional input ports */ |
| 2005 | 2004 | machine().device("master")->memory().space(AS_IO).install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this)); |
| r20832 | r20833 | |
| 2010 | 2009 | DRIVER_INIT_MEMBER(leland_state,mayhem) |
| 2011 | 2010 | { |
| 2012 | 2011 | /* master CPU bankswitching */ |
| 2013 | | m_update_master_bank = mayhem_bankswitch; |
| 2012 | m_update_master_bank = &leland_state::mayhem_bankswitch; |
| 2014 | 2013 | |
| 2015 | 2014 | /* set up the master CPU I/O ports */ |
| 2016 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2015 | init_master_ports(0x00, 0xc0); |
| 2017 | 2016 | } |
| 2018 | 2017 | |
| 2019 | 2018 | |
| 2020 | 2019 | DRIVER_INIT_MEMBER(leland_state,powrplay) |
| 2021 | 2020 | { |
| 2022 | 2021 | /* master CPU bankswitching */ |
| 2023 | | m_update_master_bank = mayhem_bankswitch; |
| 2022 | m_update_master_bank = &leland_state::mayhem_bankswitch; |
| 2024 | 2023 | |
| 2025 | 2024 | /* set up the master CPU I/O ports */ |
| 2026 | | init_master_ports(machine(), 0x40, 0x80); |
| 2025 | init_master_ports(0x40, 0x80); |
| 2027 | 2026 | } |
| 2028 | 2027 | |
| 2029 | 2028 | |
| 2030 | 2029 | DRIVER_INIT_MEMBER(leland_state,wseries) |
| 2031 | 2030 | { |
| 2032 | 2031 | /* master CPU bankswitching */ |
| 2033 | | m_update_master_bank = mayhem_bankswitch; |
| 2032 | m_update_master_bank = &leland_state::mayhem_bankswitch; |
| 2034 | 2033 | |
| 2035 | 2034 | /* set up the master CPU I/O ports */ |
| 2036 | | init_master_ports(machine(), 0x40, 0x80); |
| 2035 | init_master_ports(0x40, 0x80); |
| 2037 | 2036 | } |
| 2038 | 2037 | |
| 2039 | 2038 | |
| 2040 | 2039 | DRIVER_INIT_MEMBER(leland_state,alleymas) |
| 2041 | 2040 | { |
| 2042 | 2041 | /* master CPU bankswitching */ |
| 2043 | | m_update_master_bank = mayhem_bankswitch; |
| 2042 | m_update_master_bank = &leland_state::mayhem_bankswitch; |
| 2044 | 2043 | |
| 2045 | 2044 | /* set up the master CPU I/O ports */ |
| 2046 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2045 | init_master_ports(0x00, 0xc0); |
| 2047 | 2046 | |
| 2048 | 2047 | /* kludge warning: the game uses location E0CA to determine if the joysticks are available */ |
| 2049 | 2048 | /* it gets cleared by the code, but there is no obvious way for the value to be set to a */ |
| r20832 | r20833 | |
| 2055 | 2054 | DRIVER_INIT_MEMBER(leland_state,upyoural) |
| 2056 | 2055 | { |
| 2057 | 2056 | /* master CPU bankswitching */ |
| 2058 | | m_update_master_bank = mayhem_bankswitch; |
| 2057 | m_update_master_bank = &leland_state::mayhem_bankswitch; |
| 2059 | 2058 | |
| 2060 | 2059 | /* set up the master CPU I/O ports */ |
| 2061 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2060 | init_master_ports(0x00, 0xc0); |
| 2062 | 2061 | } |
| 2063 | 2062 | |
| 2064 | 2063 | |
| 2065 | 2064 | DRIVER_INIT_MEMBER(leland_state,dangerz) |
| 2066 | 2065 | { |
| 2067 | 2066 | /* master CPU bankswitching */ |
| 2068 | | m_update_master_bank = dangerz_bankswitch; |
| 2067 | m_update_master_bank = &leland_state::dangerz_bankswitch; |
| 2069 | 2068 | |
| 2070 | 2069 | /* set up the master CPU I/O ports */ |
| 2071 | | init_master_ports(machine(), 0x40, 0x80); |
| 2070 | init_master_ports(0x40, 0x80); |
| 2072 | 2071 | |
| 2073 | 2072 | /* set up additional input ports */ |
| 2074 | 2073 | machine().device("master")->memory().space(AS_IO).install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); |
| r20832 | r20833 | |
| 2080 | 2079 | DRIVER_INIT_MEMBER(leland_state,basebal2) |
| 2081 | 2080 | { |
| 2082 | 2081 | /* master CPU bankswitching */ |
| 2083 | | m_update_master_bank = basebal2_bankswitch; |
| 2082 | m_update_master_bank = &leland_state::basebal2_bankswitch; |
| 2084 | 2083 | |
| 2085 | 2084 | /* set up the master CPU I/O ports */ |
| 2086 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2085 | init_master_ports(0x00, 0xc0); |
| 2087 | 2086 | } |
| 2088 | 2087 | |
| 2089 | 2088 | |
| 2090 | 2089 | DRIVER_INIT_MEMBER(leland_state,dblplay) |
| 2091 | 2090 | { |
| 2092 | 2091 | /* master CPU bankswitching */ |
| 2093 | | m_update_master_bank = basebal2_bankswitch; |
| 2092 | m_update_master_bank = &leland_state::basebal2_bankswitch; |
| 2094 | 2093 | |
| 2095 | 2094 | /* set up the master CPU I/O ports */ |
| 2096 | | init_master_ports(machine(), 0x80, 0x40); |
| 2095 | init_master_ports(0x80, 0x40); |
| 2097 | 2096 | } |
| 2098 | 2097 | |
| 2099 | 2098 | |
| 2100 | 2099 | DRIVER_INIT_MEMBER(leland_state,strkzone) |
| 2101 | 2100 | { |
| 2102 | 2101 | /* master CPU bankswitching */ |
| 2103 | | m_update_master_bank = basebal2_bankswitch; |
| 2102 | m_update_master_bank = &leland_state::basebal2_bankswitch; |
| 2104 | 2103 | |
| 2105 | 2104 | /* set up the master CPU I/O ports */ |
| 2106 | | init_master_ports(machine(), 0x00, 0x40); |
| 2105 | init_master_ports(0x00, 0x40); |
| 2107 | 2106 | } |
| 2108 | 2107 | |
| 2109 | 2108 | |
| 2110 | 2109 | DRIVER_INIT_MEMBER(leland_state,redlin2p) |
| 2111 | 2110 | { |
| 2112 | 2111 | /* master CPU bankswitching */ |
| 2113 | | m_update_master_bank = redline_bankswitch; |
| 2112 | m_update_master_bank = &leland_state::redline_bankswitch; |
| 2114 | 2113 | |
| 2115 | | leland_rotate_memory(machine(), "master"); |
| 2114 | leland_rotate_memory("master"); |
| 2116 | 2115 | |
| 2117 | 2116 | /* set up the master CPU I/O ports */ |
| 2118 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2117 | init_master_ports(0x00, 0xc0); |
| 2119 | 2118 | |
| 2120 | 2119 | /* set up additional input ports */ |
| 2121 | 2120 | machine().device("master")->memory().space(AS_IO).install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this)); |
| r20832 | r20833 | |
| 2128 | 2127 | DRIVER_INIT_MEMBER(leland_state,quarterb) |
| 2129 | 2128 | { |
| 2130 | 2129 | /* master CPU bankswitching */ |
| 2131 | | m_update_master_bank = viper_bankswitch; |
| 2130 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2132 | 2131 | |
| 2133 | | leland_rotate_memory(machine(), "master"); |
| 2132 | leland_rotate_memory("master"); |
| 2134 | 2133 | |
| 2135 | 2134 | /* set up the master CPU I/O ports */ |
| 2136 | | init_master_ports(machine(), 0x40, 0x80); |
| 2135 | init_master_ports(0x40, 0x80); |
| 2137 | 2136 | } |
| 2138 | 2137 | |
| 2139 | 2138 | |
| 2140 | 2139 | DRIVER_INIT_MEMBER(leland_state,viper) |
| 2141 | 2140 | { |
| 2142 | 2141 | /* master CPU bankswitching */ |
| 2143 | | m_update_master_bank = viper_bankswitch; |
| 2142 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2144 | 2143 | |
| 2145 | | leland_rotate_memory(machine(), "master"); |
| 2146 | | leland_rotate_memory(machine(), "slave"); |
| 2147 | | leland_rotate_memory(machine(), "slave"); |
| 2144 | leland_rotate_memory("master"); |
| 2145 | leland_rotate_memory("slave"); |
| 2146 | leland_rotate_memory("slave"); |
| 2148 | 2147 | |
| 2149 | 2148 | /* set up the master CPU I/O ports */ |
| 2150 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2149 | init_master_ports(0x00, 0xc0); |
| 2151 | 2150 | |
| 2152 | 2151 | /* set up additional input ports */ |
| 2153 | 2152 | machine().device("master")->memory().space(AS_IO).install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); |
| r20832 | r20833 | |
| 2159 | 2158 | DRIVER_INIT_MEMBER(leland_state,teamqb) |
| 2160 | 2159 | { |
| 2161 | 2160 | /* master CPU bankswitching */ |
| 2162 | | m_update_master_bank = viper_bankswitch; |
| 2161 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2163 | 2162 | |
| 2164 | | leland_rotate_memory(machine(), "master"); |
| 2165 | | leland_rotate_memory(machine(), "slave"); |
| 2166 | | leland_rotate_memory(machine(), "slave"); |
| 2163 | leland_rotate_memory("master"); |
| 2164 | leland_rotate_memory("slave"); |
| 2165 | leland_rotate_memory("slave"); |
| 2167 | 2166 | |
| 2168 | 2167 | /* set up the master CPU I/O ports */ |
| 2169 | | init_master_ports(machine(), 0x40, 0x80); |
| 2168 | init_master_ports(0x40, 0x80); |
| 2170 | 2169 | |
| 2171 | 2170 | /* set up additional input ports */ |
| 2172 | 2171 | machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); |
| r20832 | r20833 | |
| 2177 | 2176 | DRIVER_INIT_MEMBER(leland_state,aafb) |
| 2178 | 2177 | { |
| 2179 | 2178 | /* master CPU bankswitching */ |
| 2180 | | m_update_master_bank = viper_bankswitch; |
| 2179 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2181 | 2180 | |
| 2182 | | leland_rotate_memory(machine(), "master"); |
| 2183 | | leland_rotate_memory(machine(), "slave"); |
| 2184 | | leland_rotate_memory(machine(), "slave"); |
| 2181 | leland_rotate_memory("master"); |
| 2182 | leland_rotate_memory("slave"); |
| 2183 | leland_rotate_memory("slave"); |
| 2185 | 2184 | |
| 2186 | 2185 | /* set up the master CPU I/O ports */ |
| 2187 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2186 | init_master_ports(0x00, 0xc0); |
| 2188 | 2187 | |
| 2189 | 2188 | /* set up additional input ports */ |
| 2190 | 2189 | machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); |
| r20832 | r20833 | |
| 2195 | 2194 | DRIVER_INIT_MEMBER(leland_state,aafbb) |
| 2196 | 2195 | { |
| 2197 | 2196 | /* master CPU bankswitching */ |
| 2198 | | m_update_master_bank = viper_bankswitch; |
| 2197 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2199 | 2198 | |
| 2200 | | leland_rotate_memory(machine(), "master"); |
| 2201 | | leland_rotate_memory(machine(), "slave"); |
| 2202 | | leland_rotate_memory(machine(), "slave"); |
| 2199 | leland_rotate_memory("master"); |
| 2200 | leland_rotate_memory("slave"); |
| 2201 | leland_rotate_memory("slave"); |
| 2203 | 2202 | |
| 2204 | 2203 | /* set up the master CPU I/O ports */ |
| 2205 | | init_master_ports(machine(), 0x80, 0x40); |
| 2204 | init_master_ports(0x80, 0x40); |
| 2206 | 2205 | |
| 2207 | 2206 | /* set up additional input ports */ |
| 2208 | 2207 | machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); |
| r20832 | r20833 | |
| 2213 | 2212 | DRIVER_INIT_MEMBER(leland_state,aafbd2p) |
| 2214 | 2213 | { |
| 2215 | 2214 | /* master CPU bankswitching */ |
| 2216 | | m_update_master_bank = viper_bankswitch; |
| 2215 | m_update_master_bank = &leland_state::viper_bankswitch; |
| 2217 | 2216 | |
| 2218 | | leland_rotate_memory(machine(), "master"); |
| 2219 | | leland_rotate_memory(machine(), "slave"); |
| 2220 | | leland_rotate_memory(machine(), "slave"); |
| 2217 | leland_rotate_memory("master"); |
| 2218 | leland_rotate_memory("slave"); |
| 2219 | leland_rotate_memory("slave"); |
| 2221 | 2220 | |
| 2222 | 2221 | /* set up the master CPU I/O ports */ |
| 2223 | | init_master_ports(machine(), 0x00, 0x40); |
| 2222 | init_master_ports(0x00, 0x40); |
| 2224 | 2223 | |
| 2225 | 2224 | /* set up additional input ports */ |
| 2226 | 2225 | machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); |
| r20832 | r20833 | |
| 2231 | 2230 | DRIVER_INIT_MEMBER(leland_state,offroad) |
| 2232 | 2231 | { |
| 2233 | 2232 | /* master CPU bankswitching */ |
| 2234 | | m_update_master_bank = offroad_bankswitch; |
| 2233 | m_update_master_bank = &leland_state::offroad_bankswitch; |
| 2235 | 2234 | |
| 2236 | | leland_rotate_memory(machine(), "master"); |
| 2237 | | leland_rotate_memory(machine(), "slave"); |
| 2238 | | leland_rotate_memory(machine(), "slave"); |
| 2235 | leland_rotate_memory("master"); |
| 2236 | leland_rotate_memory("slave"); |
| 2237 | leland_rotate_memory("slave"); |
| 2239 | 2238 | |
| 2240 | 2239 | /* set up the master CPU I/O ports */ |
| 2241 | | init_master_ports(machine(), 0x00, 0xc0); |
| 2242 | | init_master_ports(machine(), 0x40, 0x80); /* yes, this is intentional */ |
| 2240 | init_master_ports(0x00, 0xc0); |
| 2241 | init_master_ports(0x40, 0x80); /* yes, this is intentional */ |
| 2243 | 2242 | |
| 2244 | 2243 | /* set up additional input ports */ |
| 2245 | 2244 | machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); |
| r20832 | r20833 | |
| 2251 | 2250 | DRIVER_INIT_MEMBER(leland_state,offroadt) |
| 2252 | 2251 | { |
| 2253 | 2252 | /* master CPU bankswitching */ |
| 2254 | | m_update_master_bank = offroad_bankswitch; |
| 2253 | m_update_master_bank = &leland_state::offroad_bankswitch; |
| 2255 | 2254 | |
| 2256 | | leland_rotate_memory(machine(), "master"); |
| 2257 | | leland_rotate_memory(machine(), "slave"); |
| 2258 | | leland_rotate_memory(machine(), "slave"); |
| 2255 | leland_rotate_memory("master"); |
| 2256 | leland_rotate_memory("slave"); |
| 2257 | leland_rotate_memory("slave"); |
| 2259 | 2258 | |
| 2260 | 2259 | /* set up the master CPU I/O ports */ |
| 2261 | | init_master_ports(machine(), 0x80, 0x40); |
| 2260 | init_master_ports(0x80, 0x40); |
| 2262 | 2261 | |
| 2263 | 2262 | /* set up additional input ports */ |
| 2264 | 2263 | machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); |
| r20832 | r20833 | |
| 2270 | 2269 | DRIVER_INIT_MEMBER(leland_state,pigout) |
| 2271 | 2270 | { |
| 2272 | 2271 | /* master CPU bankswitching */ |
| 2273 | | m_update_master_bank = offroad_bankswitch; |
| 2272 | m_update_master_bank = &leland_state::offroad_bankswitch; |
| 2274 | 2273 | |
| 2275 | | leland_rotate_memory(machine(), "master"); |
| 2276 | | leland_rotate_memory(machine(), "slave"); |
| 2277 | | leland_rotate_memory(machine(), "slave"); |
| 2274 | leland_rotate_memory("master"); |
| 2275 | leland_rotate_memory("slave"); |
| 2276 | leland_rotate_memory("slave"); |
| 2278 | 2277 | |
| 2279 | 2278 | /* set up the master CPU I/O ports */ |
| 2280 | | init_master_ports(machine(), 0x00, 0x40); |
| 2279 | init_master_ports(0x00, 0x40); |
| 2281 | 2280 | |
| 2282 | 2281 | /* set up additional input ports */ |
| 2283 | 2282 | machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN4"); |