trunk/src/mess/machine/intv.c
| r20997 | r20998 | |
| 48 | 48 | switch (offset) |
| 49 | 49 | { |
| 50 | 50 | case 0x000: |
| 51 | | rv = ioport("TEST")->read() & 0x80; |
| 51 | rv = m_io_test->read() & 0x80; |
| 52 | 52 | logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset); |
| 53 | 53 | break; |
| 54 | 54 | case 0x001: |
| 55 | | rv = (ioport("TEST")->read() & 0x40) << 1; |
| 55 | rv = (m_io_test->read() & 0x40) << 1; |
| 56 | 56 | logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset); |
| 57 | 57 | break; |
| 58 | 58 | case 0x002: |
| 59 | | rv = (ioport("TEST")->read() & 0x20) << 2; |
| 59 | rv = (m_io_test->read() & 0x20) << 2; |
| 60 | 60 | logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset); |
| 61 | 61 | break; |
| 62 | 62 | case 0x003: |
| 63 | | rv = (ioport("TEST")->read() & 0x10) << 3; |
| 63 | rv = (m_io_test->read() & 0x10) << 3; |
| 64 | 64 | logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset); |
| 65 | 65 | break; |
| 66 | 66 | case 0x004: |
| 67 | | rv = (ioport("TEST")->read() & 0x08) << 4; |
| 67 | rv = (m_io_test->read() & 0x08) << 4; |
| 68 | 68 | logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset); |
| 69 | 69 | break; |
| 70 | 70 | case 0x005: |
| 71 | | rv = (ioport("TEST")->read() & 0x04) << 5; |
| 71 | rv = (m_io_test->read() & 0x04) << 5; |
| 72 | 72 | logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset); |
| 73 | 73 | break; |
| 74 | 74 | case 0x006: |
| r20997 | r20998 | |
| 88 | 88 | case 0x060: /* Keyboard Read */ |
| 89 | 89 | rv = 0xff; |
| 90 | 90 | if (m_intvkbd_keyboard_col == 0) |
| 91 | | rv = ioport("ROW0")->read(); |
| 91 | rv = m_io_row0->read(); |
| 92 | 92 | if (m_intvkbd_keyboard_col == 1) |
| 93 | | rv = ioport("ROW1")->read(); |
| 93 | rv = m_io_row1->read(); |
| 94 | 94 | if (m_intvkbd_keyboard_col == 2) |
| 95 | | rv = ioport("ROW2")->read(); |
| 95 | rv = m_io_row2->read(); |
| 96 | 96 | if (m_intvkbd_keyboard_col == 3) |
| 97 | | rv = ioport("ROW3")->read(); |
| 97 | rv = m_io_row3->read(); |
| 98 | 98 | if (m_intvkbd_keyboard_col == 4) |
| 99 | | rv = ioport("ROW4")->read(); |
| 99 | rv = m_io_row4->read(); |
| 100 | 100 | if (m_intvkbd_keyboard_col == 5) |
| 101 | | rv = ioport("ROW5")->read(); |
| 101 | rv = m_io_row5->read(); |
| 102 | 102 | if (m_intvkbd_keyboard_col == 6) |
| 103 | | rv = ioport("ROW6")->read(); |
| 103 | rv = m_io_row6->read(); |
| 104 | 104 | if (m_intvkbd_keyboard_col == 7) |
| 105 | | rv = ioport("ROW7")->read(); |
| 105 | rv = m_io_row7->read(); |
| 106 | 106 | if (m_intvkbd_keyboard_col == 8) |
| 107 | | rv = ioport("ROW8")->read(); |
| 107 | rv = m_io_row8->read(); |
| 108 | 108 | if (m_intvkbd_keyboard_col == 9) |
| 109 | | rv = ioport("ROW9")->read(); |
| 109 | rv = m_io_row9->read(); |
| 110 | 110 | break; |
| 111 | 111 | case 0x80: |
| 112 | 112 | rv = 0x00; |
| r20997 | r20998 | |
| 338 | 338 | { |
| 339 | 339 | if (data == 0x2A50) |
| 340 | 340 | { |
| 341 | | membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (0x2000 << 1)); |
| 341 | m_bank1->set_base(m_region_maincpu->base() + (0x2000 << 1)); |
| 342 | 342 | } |
| 343 | 343 | else if (data == 0x2A51) |
| 344 | 344 | { |
| 345 | | membank("bank1")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x2000 << 1)); |
| 345 | m_bank1->set_base(m_region_ecs_rom->base() + (0x2000 << 1)); |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
| r20997 | r20998 | |
| 353 | 353 | { |
| 354 | 354 | if (data == 0x7A50) |
| 355 | 355 | { |
| 356 | | membank("bank2")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1 |
| 356 | m_bank2->set_base(m_region_ecs_rom->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1 |
| 357 | 357 | } |
| 358 | 358 | else if (data == 0x7A51 ) |
| 359 | 359 | { |
| 360 | | membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + (0x7000 << 1)); |
| 360 | m_bank2->set_base(m_region_maincpu->base() + (0x7000 << 1)); |
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | } |
| r20997 | r20998 | |
| 368 | 368 | { |
| 369 | 369 | if (data == 0xEA50) |
| 370 | 370 | { |
| 371 | | membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + (0xE000 << 1)); |
| 371 | m_bank3->set_base(m_region_maincpu->base() + (0xE000 << 1)); |
| 372 | 372 | } |
| 373 | 373 | else if (data == 0xEA51) |
| 374 | 374 | { |
| 375 | | membank("bank3")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xE000 << 1)); |
| 375 | m_bank3->set_base(m_region_ecs_rom->base() + (0xE000 << 1)); |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | } |
| r20997 | r20998 | |
| 384 | 384 | { |
| 385 | 385 | if (data == 0xFA50) |
| 386 | 386 | { |
| 387 | | membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + (0xF000 << 1)); |
| 387 | m_bank4->set_base(m_region_maincpu->base() + (0xF000 << 1)); |
| 388 | 388 | } |
| 389 | 389 | else if (data == 0xFA51) |
| 390 | 390 | { |
| 391 | | membank("bank4")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xF000 << 1)); |
| 391 | m_bank4->set_base(m_region_ecs_rom->base() + (0xF000 << 1)); |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | | static int intv_load_rom_file(device_image_interface &image) |
| 396 | int intv_state::intv_load_rom_file(device_image_interface &image) |
| 397 | 397 | { |
| 398 | 398 | int i,j; |
| 399 | 399 | |
| r20997 | r20998 | |
| 408 | 408 | UINT8 high_byte; |
| 409 | 409 | UINT8 low_byte; |
| 410 | 410 | |
| 411 | | UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base(); |
| 412 | | intv_state *state = image.device().machine().driver_data<intv_state>(); |
| 413 | | address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 411 | UINT8 *memory = m_region_maincpu->base(); |
| 412 | address_space &program = m_maincpu->space(AS_PROGRAM); |
| 414 | 413 | const char *filetype = image.filetype(); |
| 415 | 414 | |
| 416 | 415 | /* if it is in .rom format, we enter here */ |
| r20997 | r20998 | |
| 505 | 504 | size = ( ram & 0x0f ) * 0x800; |
| 506 | 505 | |
| 507 | 506 | program.install_readwrite_handler(start, start + size, |
| 508 | | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state), |
| 509 | | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state)); |
| 507 | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this), |
| 508 | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this)); |
| 510 | 509 | } |
| 511 | 510 | /* For now intellivoice always active |
| 512 | 511 | if (extra & INTELLIVOICE_MASK) |
| r20997 | r20998 | |
| 553 | 552 | { |
| 554 | 553 | UINT16 offset[] = {0x4800, 0x5000, 0x6000, 0x7000, 0x9000, 0xa000, 0xc000, 0xd000, 0xf000}; |
| 555 | 554 | const char* region_name[] = {"4800", "5000", "6000", "7000", "9000", "A000", "C000", "D000", "F000"}; |
| 556 | | UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base(); |
| 557 | | intv_state *state = image.device().machine().driver_data<intv_state>(); |
| 558 | | address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 555 | UINT8 *memory = m_region_maincpu->base(); |
| 556 | address_space &program = m_maincpu->space(AS_PROGRAM); |
| 559 | 557 | |
| 560 | 558 | UINT32 size=0; |
| 561 | 559 | UINT16 address = 0; |
| r20997 | r20998 | |
| 576 | 574 | } |
| 577 | 575 | // deal with wsmlb paged rom |
| 578 | 576 | |
| 579 | | UINT8 *ecs_rom_region = image.device().machine().root_device().memregion("ecs_rom")->base(); |
| 577 | UINT8 *ecs_rom_region = m_region_ecs_rom->base(); |
| 580 | 578 | size = image.get_software_region_length("F000_bank1"); |
| 581 | 579 | if (size && ecs_rom_region) // only load if ecs is plugged in (should probably be done a different way) |
| 582 | 580 | { |
| r20997 | r20998 | |
| 593 | 591 | if (size) |
| 594 | 592 | { |
| 595 | 593 | program.install_readwrite_handler(0xD000, 0xD000 + size, |
| 596 | | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state), |
| 597 | | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state)); |
| 594 | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this), |
| 595 | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this)); |
| 598 | 596 | } |
| 599 | 597 | |
| 600 | 598 | size = image.get_software_region_length("8800_RAM8"); |
| 601 | 599 | if (size) |
| 602 | 600 | { |
| 603 | 601 | program.install_readwrite_handler(0x8800, 0x8800 + size, |
| 604 | | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state), |
| 605 | | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state)); |
| 602 | read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this), |
| 603 | write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this)); |
| 606 | 604 | } |
| 607 | 605 | return IMAGE_INIT_PASS; |
| 608 | 606 | } |
| r20997 | r20998 | |
| 617 | 615 | /* Set Reset and INTR/INTRM Vector */ |
| 618 | 616 | void intv_state::machine_reset() |
| 619 | 617 | { |
| 620 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_RESET, 0x1000); |
| 618 | m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000); |
| 621 | 619 | |
| 622 | 620 | /* These are actually the same vector, and INTR is unused */ |
| 623 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTRM, 0x1004); |
| 624 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTR, 0x1004); |
| 621 | m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004); |
| 622 | m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004); |
| 625 | 623 | |
| 626 | 624 | /* Set initial PC */ |
| 627 | | machine().device("maincpu")->state().set_state_int(CP1610_R7, 0x1000); |
| 625 | m_maincpu->set_state_int(CP1610_R7, 0x1000); |
| 628 | 626 | |
| 629 | 627 | return; |
| 630 | 628 | } |
| 631 | 629 | |
| 632 | 630 | MACHINE_RESET_MEMBER(intv_state,intvecs) |
| 633 | 631 | { |
| 634 | | membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (0x2000 << 1)); |
| 635 | | membank("bank2")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x7000 << 1)); |
| 636 | | membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + (0xE000 << 1)); |
| 637 | | membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + (0xF000 << 1)); |
| 632 | m_bank1->set_base(m_region_maincpu->base() + (0x2000 << 1)); |
| 633 | m_bank2->set_base(m_region_ecs_rom->base() + (0x7000 << 1)); |
| 634 | m_bank3->set_base(m_region_maincpu->base() + (0xE000 << 1)); |
| 635 | m_bank4->set_base(m_region_maincpu->base() + (0xF000 << 1)); |
| 638 | 636 | |
| 639 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_RESET, 0x1000); |
| 637 | m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000); |
| 640 | 638 | |
| 641 | 639 | /* These are actually the same vector, and INTR is unused */ |
| 642 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTRM, 0x1004); |
| 643 | | machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTR, 0x1004); |
| 640 | m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004); |
| 641 | m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004); |
| 644 | 642 | |
| 645 | 643 | /* Set initial PC */ |
| 646 | | machine().device("maincpu")->state().set_state_int(CP1610_R7, 0x1000); |
| 644 | m_maincpu->set_state_int(CP1610_R7, 0x1000); |
| 647 | 645 | |
| 648 | 646 | return; |
| 649 | 647 | } |
| r20997 | r20998 | |
| 651 | 649 | |
| 652 | 650 | TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete) |
| 653 | 651 | { |
| 654 | | machine().device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, CLEAR_LINE); |
| 652 | m_maincpu->set_input_line(CP1610_INT_INTRM, CLEAR_LINE); |
| 655 | 653 | m_bus_copy_mode = 0; |
| 656 | 654 | } |
| 657 | 655 | |
| r20997 | r20998 | |
| 670 | 668 | |
| 671 | 669 | INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt) |
| 672 | 670 | { |
| 673 | | machine().device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, ASSERT_LINE); |
| 671 | m_maincpu->set_input_line(CP1610_INT_INTRM, ASSERT_LINE); |
| 674 | 672 | m_sr1_int_pending = 1; |
| 675 | 673 | m_bus_copy_mode = 1; |
| 676 | 674 | m_backtab_row = 0; |
| 677 | 675 | UINT8 row; |
| 678 | | machine().device("maincpu")->execute().adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing |
| 676 | m_maincpu->adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing |
| 679 | 677 | machine().scheduler().timer_set(machine().device<cpu_device>("maincpu") |
| 680 | 678 | ->cycles_to_attotime(STIC_VBLANK_END), timer_expired_delegate(FUNC(intv_state::intv_interrupt_complete),this)); |
| 681 | 679 | for (row=0; row < STIC_BACKTAB_HEIGHT; row++) |
| 682 | 680 | { |
| 683 | | machine().scheduler().timer_set(machine().device<cpu_device>("maincpu") |
| 681 | machine().scheduler().timer_set(m_maincpu |
| 684 | 682 | ->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), timer_expired_delegate(FUNC(intv_state::intv_btb_fill),this)); |
| 685 | 683 | } |
| 686 | 684 | |
| 687 | 685 | if (m_row_delay == 0) |
| 688 | 686 | { |
| 689 | | machine().device("maincpu")->execute().adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0 |
| 687 | m_maincpu->adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0 |
| 690 | 688 | } |
| 691 | 689 | |
| 692 | | intv_stic_screenrefresh(machine()); |
| 690 | intv_stic_screenrefresh(); |
| 693 | 691 | } |
| 694 | 692 | |
| 695 | 693 | /* hand 0 == left, 1 == right, 2 == ECS hand controller 1, 3 == ECS hand controller 2 */ |
| 696 | | UINT8 intv_control_r(address_space &space, int hand) |
| 694 | UINT8 intv_state::intv_control_r(int hand) |
| 697 | 695 | { |
| 698 | | static const char* const keypad_name[] = { "KEYPAD1", "KEYPAD2", "KEYPAD3", "KEYPAD4" }; |
| 696 | ioport_port *keypad[] = { m_io_keypad1, m_io_keypad2, m_io_keypad3, m_io_keypad4 }; |
| 699 | 697 | static const UINT8 keypad_table[] = |
| 700 | 698 | { |
| 701 | 699 | 0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB, |
| 702 | 700 | 0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E |
| 703 | 701 | }; |
| 704 | 702 | |
| 705 | | static const char* const disc_name[] = { "DISC1", "DISC2", "DISC3", "DISC4" }; |
| 703 | ioport_port *disc[] = { m_io_disc1, m_io_disc2, m_io_disc3, m_io_disc4 }; |
| 706 | 704 | static const UINT8 disc_table[] = |
| 707 | 705 | { |
| 708 | 706 | 0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE, |
| 709 | 707 | 0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB |
| 710 | 708 | }; |
| 711 | 709 | |
| 712 | | static const char* const discx_name[] = { "DISCX1", "DISCX2", "DISCX3", "DISCX4" }; |
| 713 | | static const char* const discy_name[] = { "DISCY1", "DISCY2", "DISKY3", "DISCY4" }; |
| 710 | ioport_port *discx[] = { m_io_discx1, m_io_discx2, m_io_discx3, m_io_discx4 }; |
| 711 | ioport_port *discy[] = { m_io_discy1, m_io_discy2, m_io_discy3, m_io_discy4 }; |
| 714 | 712 | static const UINT8 discyx_table[5][5] = |
| 715 | 713 | { |
| 716 | 714 | { 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 }, |
| r20997 | r20998 | |
| 724 | 722 | UINT8 rv = 0xFF; |
| 725 | 723 | |
| 726 | 724 | /* keypad */ |
| 727 | | x = space.machine().root_device().ioport(keypad_name[hand])->read(); |
| 725 | x = keypad[hand]->read(); |
| 728 | 726 | for (y = 0; y < 16; y++) |
| 729 | 727 | { |
| 730 | 728 | if (x & (1 << y)) |
| r20997 | r20998 | |
| 733 | 731 | } |
| 734 | 732 | } |
| 735 | 733 | |
| 736 | | switch ((space.machine().root_device().ioport("OPTIONS")->read() >> hand) & 1) |
| 734 | switch ((m_io_options->read() >> hand) & 1) |
| 737 | 735 | { |
| 738 | 736 | case 0: /* disc == digital */ |
| 739 | 737 | default: |
| 740 | 738 | |
| 741 | | x = space.machine().root_device().ioport(disc_name[hand])->read(); |
| 739 | x = disc[hand]->read(); |
| 742 | 740 | for (y = 0; y < 16; y++) |
| 743 | 741 | { |
| 744 | 742 | if (x & (1 << y)) |
| r20997 | r20998 | |
| 750 | 748 | |
| 751 | 749 | case 1: /* disc == _fake_ analog */ |
| 752 | 750 | |
| 753 | | x = space.machine().root_device().ioport(discx_name[hand])->read(); |
| 754 | | y = space.machine().root_device().ioport(discy_name[hand])->read(); |
| 751 | x = discx[hand]->read(); |
| 752 | y = discy[hand]->read(); |
| 755 | 753 | rv &= discyx_table[y / 32][x / 32]; |
| 756 | 754 | } |
| 757 | 755 | |
| r20997 | r20998 | |
| 760 | 758 | |
| 761 | 759 | READ8_MEMBER( intv_state::intv_left_control_r ) |
| 762 | 760 | { |
| 763 | | return intv_control_r(space, 0); |
| 761 | return intv_control_r(0); |
| 764 | 762 | } |
| 765 | 763 | |
| 766 | 764 | READ8_MEMBER( intv_state::intv_right_control_r ) |
| 767 | 765 | { |
| 768 | | return intv_control_r(space, 1); |
| 766 | return intv_control_r(1); |
| 769 | 767 | } |
| 770 | 768 | |
| 771 | 769 | READ8_MEMBER( intv_state::intv_ecs_porta_r ) |
| 772 | 770 | { |
| 773 | | if (ioport("ECS_CNTRLSEL")->read() == 0) |
| 774 | | return intv_control_r(space, 2); |
| 771 | if (m_io_ecs_cntrlsel->read() == 0) |
| 772 | return intv_control_r(2); |
| 775 | 773 | else |
| 776 | 774 | return 0xff; // not sure what to return here, maybe it should be last output? |
| 777 | 775 | } |
| 778 | 776 | |
| 779 | 777 | READ8_MEMBER( intv_state::intv_ecs_portb_r ) |
| 780 | 778 | { |
| 781 | | switch (ioport("ECS_CNTRLSEL")->read()) |
| 779 | switch (m_io_ecs_cntrlsel->read()) |
| 782 | 780 | { |
| 783 | 781 | case 0x00: // hand controller |
| 784 | 782 | { |
| 785 | | return intv_control_r(space, 3); |
| 783 | return intv_control_r(3); |
| 786 | 784 | } |
| 787 | 785 | case 0x01: // synthesizer keyboard |
| 788 | 786 | { |
| 789 | | static const char* const ecs_synth_rows[] = { "ECS_SYNTH_ROW0", "ECS_SYNTH_ROW1", "ECS_SYNTH_ROW2", "ECS_SYNTH_ROW3", "ECS_SYNTH_ROW4", "ECS_SYNTH_ROW5", "ECS_SYNTH_ROW6" }; |
| 787 | ioport_port *ecs_synth_rows[] = { m_io_ecs_synth_row0, m_io_ecs_synth_row1, m_io_ecs_synth_row2, m_io_ecs_synth_row3, m_io_ecs_synth_row4, m_io_ecs_synth_row5, m_io_ecs_synth_row6 }; |
| 790 | 788 | UINT8 rv = 0xFF; |
| 791 | 789 | // return correct result if more than one bit of 0xFE is set |
| 792 | 790 | for (int i=0; i<7; i++) |
| 793 | 791 | { |
| 794 | 792 | if (m_ecs_psg_porta & (1<<i)) |
| 795 | | rv &= ioport(ecs_synth_rows[i])->read(); |
| 793 | rv &= ecs_synth_rows[i]->read(); |
| 796 | 794 | } |
| 797 | 795 | return rv; |
| 798 | 796 | } |
| 799 | 797 | case 0x02: // ecs keyboard |
| 800 | 798 | { |
| 801 | | static const char* const ecs_keyboard_rows[] = { "ECS_ROW0", "ECS_ROW1", "ECS_ROW2", "ECS_ROW3", "ECS_ROW4", "ECS_ROW5", "ECS_ROW6" }; |
| 799 | ioport_port *ecs_keyboard_rows[] = { m_io_ecs_row0, m_io_ecs_row1, m_io_ecs_row2, m_io_ecs_row3, m_io_ecs_row4, m_io_ecs_row5, m_io_ecs_row6 }; |
| 802 | 800 | UINT8 rv = 0xFF; |
| 803 | 801 | // return correct result if more than one bit of 0xFE is set |
| 804 | 802 | for (int i=0; i<7; i++) |
| 805 | 803 | { |
| 806 | 804 | if (m_ecs_psg_porta & (1<<i)) |
| 807 | | rv &= ioport(ecs_keyboard_rows[i])->read(); |
| 805 | rv &= ecs_keyboard_rows[i]->read(); |
| 808 | 806 | } |
| 809 | 807 | return rv; |
| 810 | 808 | } |
| r20997 | r20998 | |
| 826 | 824 | { |
| 827 | 825 | /* First, initialize these as empty so that the intellivision |
| 828 | 826 | * will think that the playcable is not attached */ |
| 829 | | UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base(); |
| 827 | UINT8 *memory = m_region_maincpu->base(); |
| 830 | 828 | |
| 831 | 829 | /* assume playcable is absent */ |
| 832 | 830 | memory[0x4800 << 1] = 0xff; |
| r20997 | r20998 | |
| 837 | 835 | |
| 838 | 836 | if (strcmp(image.device().tag(),":cart2") == 0) /* Keyboard component cartridge slot */ |
| 839 | 837 | { |
| 840 | | UINT8 *memory = image.device().machine().root_device().memregion("keyboard")->base(); |
| 838 | UINT8 *memory = m_region_keyboard->base(); |
| 841 | 839 | |
| 842 | 840 | /* Assume an 8K cart, like BASIC */ |
| 843 | 841 | image.fread( &memory[0xe000], 0x2000); |
trunk/src/mess/includes/intv.h
| r20997 | r20998 | |
| 34 | 34 | { |
| 35 | 35 | public: |
| 36 | 36 | intv_state(const machine_config &mconfig, device_type type, const char *tag) |
| 37 | | : driver_device(mconfig, type, tag), |
| 38 | | m_maincpu(*this, "maincpu"), |
| 39 | | m_intellivoice(*this, "sp0256_speech"), |
| 40 | | m_sound(*this, "ay8914.1"), |
| 41 | | m_ecs_sound(*this, "ay8914.2"), |
| 42 | | m_intvkbd_dualport_ram(*this, "dualport_ram"), |
| 43 | | m_videoram(*this, "videoram"), |
| 44 | | m_keyboard(*this, "keyboard") |
| 37 | : driver_device(mconfig, type, tag) |
| 38 | , m_maincpu(*this, "maincpu") |
| 39 | , m_intellivoice(*this, "sp0256_speech") |
| 40 | , m_sound(*this, "ay8914.1") |
| 41 | , m_ecs_sound(*this, "ay8914.2") |
| 42 | , m_intvkbd_dualport_ram(*this, "dualport_ram") |
| 43 | , m_videoram(*this, "videoram") |
| 44 | , m_keyboard(*this, "keyboard") |
| 45 | , m_region_maincpu(*this, "maincpu") |
| 46 | , m_region_ecs_rom(*this, "ecs_rom") |
| 47 | , m_region_keyboard(*this, "keyboard") |
| 48 | , m_bank1(*this, "bank1") |
| 49 | , m_bank2(*this, "bank2") |
| 50 | , m_bank3(*this, "bank3") |
| 51 | , m_bank4(*this, "bank4") |
| 52 | , m_io_keypad1(*this, "KEYPAD1") |
| 53 | , m_io_disc1(*this, "DISC1") |
| 54 | , m_io_discx1(*this, "DISCX1") |
| 55 | , m_io_discy1(*this, "DISCY1") |
| 56 | , m_io_keypad2(*this, "KEYPAD2") |
| 57 | , m_io_disc2(*this, "DISC2") |
| 58 | , m_io_discx2(*this, "DISCX2") |
| 59 | , m_io_discy2(*this, "DISCY2") |
| 60 | , m_io_options(*this, "OPTIONS") |
| 61 | , m_io_ecs_row0(*this, "ECS_ROW0") |
| 62 | , m_io_ecs_row1(*this, "ECS_ROW1") |
| 63 | , m_io_ecs_row2(*this, "ECS_ROW2") |
| 64 | , m_io_ecs_row3(*this, "ECS_ROW3") |
| 65 | , m_io_ecs_row4(*this, "ECS_ROW4") |
| 66 | , m_io_ecs_row5(*this, "ECS_ROW5") |
| 67 | , m_io_ecs_row6(*this, "ECS_ROW6") |
| 68 | , m_io_ecs_synth_row0(*this, "ECS_SYNTH_ROW0") |
| 69 | , m_io_ecs_synth_row1(*this, "ECS_SYNTH_ROW1") |
| 70 | , m_io_ecs_synth_row2(*this, "ECS_SYNTH_ROW2") |
| 71 | , m_io_ecs_synth_row3(*this, "ECS_SYNTH_ROW3") |
| 72 | , m_io_ecs_synth_row4(*this, "ECS_SYNTH_ROW4") |
| 73 | , m_io_ecs_synth_row5(*this, "ECS_SYNTH_ROW5") |
| 74 | , m_io_ecs_synth_row6(*this, "ECS_SYNTH_ROW6") |
| 75 | , m_io_keypad3(*this, "KEYPAD3") |
| 76 | , m_io_disc3(*this, "DISC3") |
| 77 | , m_io_discx3(*this, "DISCX3") |
| 78 | , m_io_discy3(*this, "DISCY3") |
| 79 | , m_io_keypad4(*this, "KEYPAD4") |
| 80 | , m_io_disc4(*this, "DISC4") |
| 81 | , m_io_discx4(*this, "DISCX4") |
| 82 | , m_io_discy4(*this, "DISCY4") |
| 83 | , m_io_ecs_cntrlsel(*this, "ECS_CNTRLSEL") |
| 84 | , m_io_row0(*this, "ROW0") |
| 85 | , m_io_row1(*this, "ROW1") |
| 86 | , m_io_row2(*this, "ROW2") |
| 87 | , m_io_row3(*this, "ROW3") |
| 88 | , m_io_row4(*this, "ROW4") |
| 89 | , m_io_row5(*this, "ROW5") |
| 90 | , m_io_row6(*this, "ROW6") |
| 91 | , m_io_row7(*this, "ROW7") |
| 92 | , m_io_row8(*this, "ROW8") |
| 93 | , m_io_row9(*this, "ROW9") |
| 94 | , m_io_test(*this, "TEST") |
| 45 | 95 | { } |
| 46 | 96 | |
| 47 | 97 | required_device<cpu_device> m_maincpu; |
| r20997 | r20998 | |
| 146 | 196 | |
| 147 | 197 | protected: |
| 148 | 198 | optional_device<cpu_device> m_keyboard; |
| 199 | required_memory_region m_region_maincpu; |
| 200 | optional_memory_region m_region_ecs_rom; |
| 201 | optional_memory_region m_region_keyboard; |
| 202 | optional_memory_bank m_bank1; |
| 203 | optional_memory_bank m_bank2; |
| 204 | optional_memory_bank m_bank3; |
| 205 | optional_memory_bank m_bank4; |
| 206 | required_ioport m_io_keypad1; |
| 207 | required_ioport m_io_disc1; |
| 208 | required_ioport m_io_discx1; |
| 209 | required_ioport m_io_discy1; |
| 210 | required_ioport m_io_keypad2; |
| 211 | required_ioport m_io_disc2; |
| 212 | required_ioport m_io_discx2; |
| 213 | required_ioport m_io_discy2; |
| 214 | required_ioport m_io_options; |
| 215 | optional_ioport m_io_ecs_row0; |
| 216 | optional_ioport m_io_ecs_row1; |
| 217 | optional_ioport m_io_ecs_row2; |
| 218 | optional_ioport m_io_ecs_row3; |
| 219 | optional_ioport m_io_ecs_row4; |
| 220 | optional_ioport m_io_ecs_row5; |
| 221 | optional_ioport m_io_ecs_row6; |
| 222 | optional_ioport m_io_ecs_synth_row0; |
| 223 | optional_ioport m_io_ecs_synth_row1; |
| 224 | optional_ioport m_io_ecs_synth_row2; |
| 225 | optional_ioport m_io_ecs_synth_row3; |
| 226 | optional_ioport m_io_ecs_synth_row4; |
| 227 | optional_ioport m_io_ecs_synth_row5; |
| 228 | optional_ioport m_io_ecs_synth_row6; |
| 229 | optional_ioport m_io_keypad3; |
| 230 | optional_ioport m_io_disc3; |
| 231 | optional_ioport m_io_discx3; |
| 232 | optional_ioport m_io_discy3; |
| 233 | optional_ioport m_io_keypad4; |
| 234 | optional_ioport m_io_disc4; |
| 235 | optional_ioport m_io_discx4; |
| 236 | optional_ioport m_io_discy4; |
| 237 | optional_ioport m_io_ecs_cntrlsel; |
| 238 | optional_ioport m_io_row0; |
| 239 | optional_ioport m_io_row1; |
| 240 | optional_ioport m_io_row2; |
| 241 | optional_ioport m_io_row3; |
| 242 | optional_ioport m_io_row4; |
| 243 | optional_ioport m_io_row5; |
| 244 | optional_ioport m_io_row6; |
| 245 | optional_ioport m_io_row7; |
| 246 | optional_ioport m_io_row8; |
| 247 | optional_ioport m_io_row9; |
| 248 | optional_ioport m_io_test; |
| 249 | |
| 250 | int intv_load_rom_file(device_image_interface &image); |
| 251 | UINT8 intv_control_r(int hand); |
| 252 | void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); |
| 253 | UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y); |
| 254 | void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color); |
| 255 | int sprites_collide(int spriteNum1, int spriteNum2); |
| 256 | void determine_sprite_collisions(); |
| 257 | void render_sprites(); |
| 258 | void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor); |
| 259 | void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3); |
| 260 | void render_color_stack_mode(bitmap_ind16 &bitmap); |
| 261 | void render_fg_bg_mode(bitmap_ind16 &bitmap); |
| 262 | void copy_sprites_to_background(bitmap_ind16 &bitmap); |
| 263 | void render_background(bitmap_ind16 &bitmap); |
| 264 | void draw_borders(bitmap_ind16 &bm); |
| 265 | void intv_stic_screenrefresh(); |
| 149 | 266 | }; |
| 150 | 267 | |
| 151 | | /*----------- defined in video/intv.c -----------*/ |
| 152 | | void intv_stic_screenrefresh(running_machine &machine); |
| 153 | | |
| 154 | | |
| 155 | 268 | #endif /* INTV_H_ */ |
trunk/src/mess/video/intv.c
| r20997 | r20998 | |
| 10 | 10 | |
| 11 | 11 | /* initialized to non-zero, because we divide by it */ |
| 12 | 12 | |
| 13 | | INLINE void intv_set_pixel(intv_state *state, bitmap_ind16 &bitmap, int x, int y, UINT32 color) |
| 13 | void intv_state::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) |
| 14 | 14 | { |
| 15 | 15 | int w, h; |
| 16 | 16 | |
| 17 | 17 | // output scaling |
| 18 | | x *= state->m_x_scale; |
| 19 | | y *= state->m_y_scale; |
| 18 | x *= m_x_scale; |
| 19 | y *= m_y_scale; |
| 20 | 20 | color = SET_COLOR(color); |
| 21 | 21 | |
| 22 | | for (h = 0; h < state->m_y_scale; h++) |
| 23 | | for (w = 0; w < state->m_x_scale; w++) |
| 22 | for (h = 0; h < m_y_scale; h++) |
| 23 | for (w = 0; w < m_x_scale; w++) |
| 24 | 24 | bitmap.pix16(y + h, x + w) = color; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | | INLINE UINT32 intv_get_pixel(intv_state *state, bitmap_ind16 &bitmap, int x, int y) |
| 27 | UINT32 intv_state::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) |
| 28 | 28 | { |
| 29 | | return GET_COLOR(bitmap.pix16(y * state->m_y_scale, x * state->m_x_scale)); |
| 29 | return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | | INLINE void intv_plot_box(intv_state *state, bitmap_ind16 &bm, int x, int y, int w, int h, int color) |
| 32 | void intv_state::intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color) |
| 33 | 33 | { |
| 34 | | bm.plot_box(x * state->m_x_scale, y * state->m_y_scale, w * state->m_x_scale, h * state->m_y_scale, SET_COLOR(color)); |
| 34 | bm.plot_box(x * m_x_scale, y * m_y_scale, w * m_x_scale, h * m_y_scale, SET_COLOR(color)); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | void intv_state::video_start() |
| r20997 | r20998 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | | static int sprites_collide(intv_state *state, int spriteNum1, int spriteNum2) |
| 96 | int intv_state::sprites_collide(int spriteNum1, int spriteNum2) |
| 97 | 97 | { |
| 98 | 98 | INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2; |
| 99 | 99 | |
| 100 | | intv_sprite_type* s1 = &state->m_sprite[spriteNum1]; |
| 101 | | intv_sprite_type* s2 = &state->m_sprite[spriteNum2]; |
| 100 | intv_sprite_type* s1 = &m_sprite[spriteNum1]; |
| 101 | intv_sprite_type* s2 = &m_sprite[spriteNum2]; |
| 102 | 102 | |
| 103 | | x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH; |
| 104 | | y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT; |
| 103 | x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; |
| 104 | y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; |
| 105 | 105 | x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE; |
| 106 | 106 | x2 = (s2->xpos + x0) * STIC_X_SCALE; y2 = (s2->ypos + y0) * STIC_Y_SCALE; |
| 107 | 107 | w1 = (s1->doublex ? 2 : 1) * STIC_CARD_WIDTH; |
| r20997 | r20998 | |
| 126 | 126 | { |
| 127 | 127 | for (y0 = 0; y0 < h0; y0++) |
| 128 | 128 | { |
| 129 | | if (state->m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] && |
| 130 | | state->m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2]) |
| 129 | if (m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] && |
| 130 | m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2]) |
| 131 | 131 | return TRUE; |
| 132 | 132 | } |
| 133 | 133 | } |
| r20997 | r20998 | |
| 135 | 135 | return FALSE; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | | static void determine_sprite_collisions(intv_state *state) |
| 138 | void intv_state::determine_sprite_collisions() |
| 139 | 139 | { |
| 140 | 140 | // check sprite to sprite collisions |
| 141 | 141 | int i, j; |
| 142 | 142 | for (i = 0; i < STIC_MOBS - 1; i++) |
| 143 | 143 | { |
| 144 | | intv_sprite_type* s1 = &state->m_sprite[i]; |
| 144 | intv_sprite_type* s1 = &m_sprite[i]; |
| 145 | 145 | if (s1->xpos == 0 || !s1->coll) |
| 146 | 146 | continue; |
| 147 | 147 | |
| 148 | 148 | for (j = i + 1; j < STIC_MOBS; j++) |
| 149 | 149 | { |
| 150 | | intv_sprite_type* s2 = &state->m_sprite[j]; |
| 150 | intv_sprite_type* s2 = &m_sprite[j]; |
| 151 | 151 | if (s2->xpos == 0 || !s2->coll) |
| 152 | 152 | continue; |
| 153 | 153 | |
| 154 | | if (sprites_collide(state, i, j)) |
| 154 | if (sprites_collide(i, j)) |
| 155 | 155 | { |
| 156 | 156 | s1->collision |= (1 << j); |
| 157 | 157 | s2->collision |= (1 << i); |
| r20997 | r20998 | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | | static void render_sprites(running_machine &machine) |
| 163 | void intv_state::render_sprites() |
| 164 | 164 | { |
| 165 | | intv_state *state = machine.driver_data<intv_state>(); |
| 166 | 165 | INT32 cardMemoryLocation, pixelSize; |
| 167 | 166 | INT32 spritePixelHeight; |
| 168 | 167 | INT32 nextMemoryLocation; |
| r20997 | r20998 | |
| 172 | 171 | INT32 xInc; |
| 173 | 172 | INT32 i, j, k; |
| 174 | 173 | |
| 175 | | UINT8* memory = state->memregion("maincpu")->base(); |
| 174 | UINT8* memory = m_region_maincpu->base(); |
| 176 | 175 | |
| 177 | 176 | for (i = 0; i < STIC_MOBS; i++) |
| 178 | 177 | { |
| 179 | | intv_sprite_type* s = &state->m_sprite[i]; |
| 178 | intv_sprite_type* s = &m_sprite[i]; |
| 180 | 179 | |
| 181 | 180 | if (s->grom) |
| 182 | 181 | cardMemoryLocation = (s->card * STIC_CARD_HEIGHT); |
| r20997 | r20998 | |
| 192 | 191 | if (s->grom) |
| 193 | 192 | nextData = memory[(0x3000+nextMemoryLocation)<<1]; |
| 194 | 193 | else if (nextMemoryLocation < 0x200) |
| 195 | | nextData = state->m_gram[nextMemoryLocation]; |
| 194 | nextData = m_gram[nextMemoryLocation]; |
| 196 | 195 | else |
| 197 | 196 | nextData = 0xFFFF; |
| 198 | 197 | nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0); |
| r20997 | r20998 | |
| 201 | 200 | |
| 202 | 201 | for (k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++) |
| 203 | 202 | { |
| 204 | | state->m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; |
| 203 | m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; |
| 205 | 204 | } |
| 206 | 205 | } |
| 207 | 206 | } |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | | static void render_line(running_machine &machine, bitmap_ind16 &bitmap, |
| 211 | | UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) |
| 209 | void intv_state::render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) |
| 212 | 210 | { |
| 213 | | intv_state *state = machine.driver_data<intv_state>(); |
| 214 | 211 | UINT32 color; |
| 215 | 212 | UINT8 i; |
| 216 | 213 | |
| 217 | 214 | for (i = 0; i < STIC_CARD_WIDTH; i++) |
| 218 | 215 | { |
| 219 | 216 | color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor); |
| 220 | | intv_set_pixel(state, bitmap, x+i, y, color); |
| 221 | | intv_set_pixel(state, bitmap, x+i, y+1, color); |
| 217 | intv_set_pixel(bitmap, x+i, y, color); |
| 218 | intv_set_pixel(bitmap, x+i, y+1, color); |
| 222 | 219 | } |
| 223 | 220 | } |
| 224 | 221 | |
| 225 | | static void render_colored_squares(running_machine &machine, bitmap_ind16 &bitmap, |
| 226 | | UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) |
| 222 | void intv_state::render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) |
| 227 | 223 | { |
| 228 | | intv_state *state = machine.driver_data<intv_state>(); |
| 229 | | |
| 230 | | intv_plot_box(state, bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0); |
| 231 | | intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1); |
| 232 | | intv_plot_box(state, bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2); |
| 233 | | intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3); |
| 224 | intv_plot_box(bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0); |
| 225 | intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1); |
| 226 | intv_plot_box(bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2); |
| 227 | intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3); |
| 234 | 228 | } |
| 235 | 229 | |
| 236 | | static void render_color_stack_mode(running_machine &machine, bitmap_ind16 &bitmap) |
| 230 | void intv_state::render_color_stack_mode(bitmap_ind16 &bitmap) |
| 237 | 231 | { |
| 238 | | intv_state *state = machine.driver_data<intv_state>(); |
| 239 | 232 | INT16 w, h, nextx, nexty; |
| 240 | 233 | UINT8 csPtr = 0; |
| 241 | 234 | UINT16 nextCard; |
| 242 | | UINT8 *ram = state->memregion("maincpu")->base(); |
| 235 | UINT8 *ram = m_region_maincpu->base(); |
| 243 | 236 | |
| 244 | | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 237 | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; |
| 245 | 238 | h < STIC_BACKTAB_HEIGHT; |
| 246 | 239 | h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) |
| 247 | 240 | { |
| 248 | | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 241 | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; |
| 249 | 242 | w < STIC_BACKTAB_WIDTH; |
| 250 | 243 | w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) |
| 251 | 244 | { |
| 252 | | nextCard = state->m_backtab_buffer[h][w]; |
| 245 | nextCard = m_backtab_buffer[h][w]; |
| 253 | 246 | |
| 254 | 247 | // colored squares mode |
| 255 | 248 | if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3) |
| 256 | 249 | { |
| 257 | | UINT8 csColor = state->m_stic_registers[STIC_CSR + csPtr]; |
| 250 | UINT8 csColor = m_stic_registers[STIC_CSR + csPtr]; |
| 258 | 251 | UINT8 color0 = nextCard & STIC_CSQM_A; |
| 259 | 252 | UINT8 color1 = (nextCard & STIC_CSQM_B) >> 3; |
| 260 | 253 | UINT8 color2 = (nextCard & STIC_CSQM_C) >> 6; |
| 261 | 254 | UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) | |
| 262 | 255 | ((nextCard & (STIC_CSQM_D10)) >> 9); |
| 263 | | render_colored_squares(machine, bitmap, nextx, nexty, |
| 256 | render_colored_squares(bitmap, nextx, nexty, |
| 264 | 257 | (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), |
| 265 | 258 | (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), |
| 266 | 259 | (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), |
| r20997 | r20998 | |
| 279 | 272 | |
| 280 | 273 | fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) | |
| 281 | 274 | (nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT; |
| 282 | | bgcolor = state->m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; |
| 275 | bgcolor = m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; |
| 283 | 276 | |
| 284 | 277 | isGrom = !(nextCard & STIC_CSTM_SEL); |
| 285 | 278 | if (isGrom) |
| r20997 | r20998 | |
| 287 | 280 | memoryLocation = 0x3000 + (nextCard & STIC_CSTM_C); |
| 288 | 281 | memory = ram; |
| 289 | 282 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 290 | | render_line(machine, bitmap, memory[(memoryLocation + j) * 2], |
| 283 | render_line(bitmap, memory[(memoryLocation + j) * 2], |
| 291 | 284 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 292 | 285 | } |
| 293 | 286 | else |
| 294 | 287 | { |
| 295 | 288 | memoryLocation = (nextCard & STIC_CSTM_C50); |
| 296 | | memory = state->m_gram; |
| 289 | memory = m_gram; |
| 297 | 290 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 298 | | render_line(machine, bitmap, memory[memoryLocation + j], |
| 291 | render_line(bitmap, memory[memoryLocation + j], |
| 299 | 292 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 300 | 293 | } |
| 301 | 294 | } |
| r20997 | r20998 | |
| 303 | 296 | } |
| 304 | 297 | } |
| 305 | 298 | |
| 306 | | static void render_fg_bg_mode(running_machine &machine, bitmap_ind16 &bitmap) |
| 299 | void intv_state::render_fg_bg_mode(bitmap_ind16 &bitmap) |
| 307 | 300 | { |
| 308 | | intv_state *state = machine.driver_data<intv_state>(); |
| 309 | 301 | INT16 w, h, nextx, nexty; |
| 310 | 302 | UINT8 j, isGrom, fgcolor, bgcolor; |
| 311 | 303 | UINT16 nextCard, memoryLocation; |
| 312 | 304 | UINT8* memory; |
| 313 | | UINT8* ram = state->memregion("maincpu")->base(); |
| 305 | UINT8* ram = m_region_maincpu->base(); |
| 314 | 306 | |
| 315 | | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 307 | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; |
| 316 | 308 | h < STIC_BACKTAB_HEIGHT; |
| 317 | 309 | h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) |
| 318 | 310 | { |
| 319 | | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 311 | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; |
| 320 | 312 | w < STIC_BACKTAB_WIDTH; |
| 321 | 313 | w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) |
| 322 | 314 | { |
| 323 | | nextCard = state->m_backtab_buffer[h][w]; |
| 315 | nextCard = m_backtab_buffer[h][w]; |
| 324 | 316 | fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT; |
| 325 | 317 | bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) | |
| 326 | 318 | ((nextCard & STIC_FBM_BG310) >> 9); |
| r20997 | r20998 | |
| 331 | 323 | memoryLocation = 0x3000 + (nextCard & STIC_FBM_C); |
| 332 | 324 | memory = ram; |
| 333 | 325 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 334 | | render_line(machine, bitmap, memory[(memoryLocation + j) * 2], |
| 326 | render_line(bitmap, memory[(memoryLocation + j) * 2], |
| 335 | 327 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 336 | 328 | } |
| 337 | 329 | else |
| 338 | 330 | { |
| 339 | 331 | memoryLocation = (nextCard & STIC_FBM_C); |
| 340 | | memory = state->m_gram; |
| 332 | memory = m_gram; |
| 341 | 333 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 342 | | render_line(machine, bitmap, memory[memoryLocation + j], |
| 334 | render_line(bitmap, memory[memoryLocation + j], |
| 343 | 335 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 344 | 336 | } |
| 345 | 337 | } |
| 346 | 338 | } |
| 347 | 339 | } |
| 348 | 340 | |
| 349 | | static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &bitmap) |
| 341 | void intv_state::copy_sprites_to_background(bitmap_ind16 &bitmap) |
| 350 | 342 | { |
| 351 | | intv_state *state = machine.driver_data<intv_state>(); |
| 352 | 343 | UINT8 width, currentPixel; |
| 353 | 344 | UINT8 borderCollision, foregroundCollision; |
| 354 | 345 | UINT8 spritePixelHeight, x, y; |
| r20997 | r20998 | |
| 358 | 349 | |
| 359 | 350 | for (i = STIC_MOBS - 1; i >= 0; i--) |
| 360 | 351 | { |
| 361 | | intv_sprite_type *s = &state->m_sprite[i]; |
| 352 | intv_sprite_type *s = &m_sprite[i]; |
| 362 | 353 | if (s->xpos == 0 || (!s->coll && !s->visible)) |
| 363 | 354 | continue; |
| 364 | 355 | |
| r20997 | r20998 | |
| 368 | 359 | spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; |
| 369 | 360 | width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH; |
| 370 | 361 | |
| 371 | | leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 372 | | nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 362 | leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; |
| 363 | nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; |
| 373 | 364 | |
| 374 | | leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; |
| 365 | leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; |
| 375 | 366 | rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE; |
| 376 | | topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; |
| 367 | topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; |
| 377 | 368 | bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1; |
| 378 | 369 | |
| 379 | 370 | for (y = 0; y < spritePixelHeight; y++) |
| r20997 | r20998 | |
| 381 | 372 | for (x = 0; x < width; x++) |
| 382 | 373 | { |
| 383 | 374 | //if this sprite pixel is not on, then don't paint it |
| 384 | | if (!state->m_sprite_buffers[i][x][y]) |
| 375 | if (!m_sprite_buffers[i][x][y]) |
| 385 | 376 | continue; |
| 386 | 377 | |
| 387 | 378 | nextX = leftX + x; |
| r20997 | r20998 | |
| 394 | 385 | continue; |
| 395 | 386 | } |
| 396 | 387 | |
| 397 | | currentPixel = intv_get_pixel(state, bitmap, nextX, nextY); |
| 388 | currentPixel = intv_get_pixel(bitmap, nextX, nextY); |
| 398 | 389 | |
| 399 | 390 | //check for foreground collision |
| 400 | 391 | if (currentPixel & FOREGROUND_BIT) |
| r20997 | r20998 | |
| 406 | 397 | |
| 407 | 398 | if (s->visible) |
| 408 | 399 | { |
| 409 | | intv_set_pixel(state, bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 400 | intv_set_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 410 | 401 | } |
| 411 | 402 | } |
| 412 | 403 | nextY++; |
| r20997 | r20998 | |
| 423 | 414 | } |
| 424 | 415 | } |
| 425 | 416 | |
| 426 | | static void render_background(running_machine &machine, bitmap_ind16 &bitmap) |
| 417 | void intv_state::render_background(bitmap_ind16 &bitmap) |
| 427 | 418 | { |
| 428 | | intv_state *state = machine.driver_data<intv_state>(); |
| 429 | | if (state->m_color_stack_mode) |
| 430 | | render_color_stack_mode(machine, bitmap); |
| 419 | if (m_color_stack_mode) |
| 420 | render_color_stack_mode(bitmap); |
| 431 | 421 | else |
| 432 | | render_fg_bg_mode(machine, bitmap); |
| 422 | render_fg_bg_mode(bitmap); |
| 433 | 423 | } |
| 434 | 424 | |
| 435 | 425 | #ifdef UNUSED_CODE |
| r20997 | r20998 | |
| 478 | 468 | if (colorb == 7) colorb = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 479 | 469 | if (colorc == 7) colorc = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 480 | 470 | if (colord == 7) colord = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 481 | | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); |
| 482 | | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); |
| 483 | | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); |
| 484 | | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord); |
| 471 | intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); |
| 472 | intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); |
| 473 | intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); |
| 474 | intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord); |
| 485 | 475 | } |
| 486 | 476 | else // normal color stack mode |
| 487 | 477 | { |
| r20997 | r20998 | |
| 519 | 509 | |
| 520 | 510 | for(j=0;j<8;j++) |
| 521 | 511 | { |
| 522 | | //intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); |
| 512 | //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); |
| 523 | 513 | } |
| 524 | 514 | |
| 525 | 515 | } |
| r20997 | r20998 | |
| 533 | 523 | |
| 534 | 524 | for(j=0;j<8;j++) |
| 535 | 525 | { |
| 536 | | //intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); |
| 526 | //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); |
| 537 | 527 | } |
| 538 | 528 | } |
| 539 | 529 | } |
| r20997 | r20998 | |
| 685 | 675 | } |
| 686 | 676 | #endif |
| 687 | 677 | |
| 688 | | static void draw_borders(running_machine &machine, bitmap_ind16 &bm) |
| 678 | void intv_state::draw_borders(bitmap_ind16 &bm) |
| 689 | 679 | { |
| 690 | | intv_state *state = machine.driver_data<intv_state>(); |
| 680 | intv_plot_box(bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); |
| 681 | intv_plot_box(bm, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); |
| 691 | 682 | |
| 692 | | intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : state->m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color); |
| 693 | | intv_plot_box(state, bm, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color); |
| 694 | | |
| 695 | | intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : state->m_row_delay)) * STIC_Y_SCALE, state->m_border_color); |
| 696 | | intv_plot_box(state, bm, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, state->m_border_color); |
| 683 | intv_plot_box(bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : m_row_delay)) * STIC_Y_SCALE, m_border_color); |
| 684 | intv_plot_box(bm, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, m_border_color); |
| 697 | 685 | } |
| 698 | 686 | |
| 699 | | void intv_stic_screenrefresh(running_machine &machine) |
| 687 | void intv_state::intv_stic_screenrefresh() |
| 700 | 688 | { |
| 701 | | intv_state *state = machine.driver_data<intv_state>(); |
| 702 | 689 | int i; |
| 703 | 690 | |
| 704 | | if (state->m_stic_handshake != 0) |
| 691 | if (m_stic_handshake != 0) |
| 705 | 692 | { |
| 706 | | state->m_stic_handshake = 0; |
| 693 | m_stic_handshake = 0; |
| 707 | 694 | // Render the background |
| 708 | | render_background(machine, state->m_bitmap); |
| 695 | render_background(m_bitmap); |
| 709 | 696 | // Render the sprites into their buffers |
| 710 | | render_sprites(machine); |
| 711 | | for (i = 0; i < STIC_MOBS; i++) state->m_sprite[i].collision = 0; |
| 697 | render_sprites(); |
| 698 | for (i = 0; i < STIC_MOBS; i++) m_sprite[i].collision = 0; |
| 712 | 699 | // Copy the sprites to the background |
| 713 | | copy_sprites_to_background(machine, state->m_bitmap); |
| 714 | | determine_sprite_collisions(state); |
| 715 | | for (i = 0; i < STIC_MOBS; i++) state->m_stic_registers[STIC_MCR + i] |= state->m_sprite[i].collision; |
| 700 | copy_sprites_to_background(m_bitmap); |
| 701 | determine_sprite_collisions(); |
| 702 | for (i = 0; i < STIC_MOBS; i++) m_stic_registers[STIC_MCR + i] |= m_sprite[i].collision; |
| 716 | 703 | /* draw the screen borders if enabled */ |
| 717 | | draw_borders(machine, state->m_bitmap); |
| 704 | draw_borders(m_bitmap); |
| 718 | 705 | } |
| 719 | 706 | else |
| 720 | 707 | { |
| 721 | 708 | /* STIC disabled, just fill with border color */ |
| 722 | | state->m_bitmap.fill(SET_COLOR(state->m_border_color)); |
| 709 | m_bitmap.fill(SET_COLOR(m_border_color)); |
| 723 | 710 | } |
| 724 | 711 | } |
| 725 | 712 | |
| r20997 | r20998 | |
| 729 | 716 | |
| 730 | 717 | READ8_MEMBER( intv_state::intvkbd_tms9927_r ) |
| 731 | 718 | { |
| 732 | | //intv_state *state = space.machine().driver_data<intv_state>(); |
| 733 | 719 | UINT8 rv; |
| 734 | 720 | switch (offset) |
| 735 | 721 | { |
| r20997 | r20998 | |
| 752 | 738 | |
| 753 | 739 | WRITE8_MEMBER( intv_state::intvkbd_tms9927_w ) |
| 754 | 740 | { |
| 755 | | //intv_state *state = space.machine().driver_data<intv_state>(); |
| 756 | 741 | switch (offset) |
| 757 | 742 | { |
| 758 | 743 | case 3: |