| Previous | 199869 Revisions | Next |
| r24079 Friday 5th July, 2013 at 02:47:27 UTC by Tafoid |
|---|
| Modernized some others devices contained in konicdev.c: k007342, k007420, k052109, k051960 and k05324x. [Osso] |
| [src/mame/drivers] | 88games.c ajax.c aliens.c asterix.c battlnts.c bladestl.c blockhl.c bottom9.c chqflag.c combatsc.c contra.c crimfght.c fastlane.c flkatck.c gbusters.c gradius3.c hcastle.c labyrunr.c lethal.c mainevt.c parodius.c rockrage.c rollerg.c simpsons.c spy.c surpratk.c thunderx.c tmnt.c ultraman.c vendetta.c xmen.c |
| [src/mame/includes] | battlnts.h bladestl.h combatsc.h contra.h fastlane.h flkatck.h hcastle.h rockrage.h |
| [src/mame/machine] | ajax.c simpsons.c |
| [src/mame/video] | 88games.c ajax.c aliens.c asterix.c battlnts.c bladestl.c blockhl.c bottom9.c chqflag.c combatsc.c contra.c crimfght.c fastlane.c flkatck.c gbusters.c gradius3.c hcastle.c konicdev.c konicdev.h labyrunr.c lethal.c mainevt.c parodius.c rockrage.c rollerg.c simpsons.c spy.c surpratk.c thunderx.c tmnt.c ultraman.c vendetta.c xmen.c |
| r24078 | r24079 | |
|---|---|---|
| 49 | 49 | AM_RANGE(0x207f80, 0x207f9f) AM_DEVWRITE8_LEGACY("k051316_1", k051316_ctrl_w, 0x00ff) /* K051316 #0 registers */ |
| 50 | 50 | AM_RANGE(0x207fa0, 0x207fbf) AM_DEVWRITE8_LEGACY("k051316_2", k051316_ctrl_w, 0x00ff) /* K051316 #1 registers */ |
| 51 | 51 | AM_RANGE(0x207fc0, 0x207fdf) AM_DEVWRITE8_LEGACY("k051316_3", k051316_ctrl_w, 0x00ff) /* K051316 #2 registers */ |
| 52 | AM_RANGE(0x304000, 0x30400f) AM_DEVREADWRITE8_LEGACY("k051960", k051937_r, k051937_w, 0x00ff) /* Sprite control */ | |
| 53 | AM_RANGE(0x304800, 0x304fff) AM_DEVREADWRITE8_LEGACY("k051960", k051960_r, k051960_w, 0x00ff) /* Sprite RAM */ | |
| 52 | AM_RANGE(0x304000, 0x30400f) AM_DEVREADWRITE8("k051960", k051960_device, k051937_r, k051937_w, 0x00ff) /* Sprite control */ | |
| 53 | AM_RANGE(0x304800, 0x304fff) AM_DEVREADWRITE8("k051960", k051960_device, k051960_r, k051960_w, 0x00ff) /* Sprite RAM */ | |
| 54 | 54 | ADDRESS_MAP_END |
| 55 | 55 | |
| 56 | 56 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, ultraman_state ) |
| r24078 | r24079 | |
|---|---|---|
| 94 | 94 | AM_RANGE(0x0061, 0x0061) AM_READ(pip_r) /* ????? */ |
| 95 | 95 | AM_RANGE(0x0100, 0x010f) AM_DEVREADWRITE("k053252", k053252_device, read, write) /* 053252? */ |
| 96 | 96 | AM_RANGE(0x0200, 0x020f) AM_DEVWRITE_LEGACY("k051316", k051316_ctrl_w) |
| 97 | AM_RANGE(0x0300, 0x030f) AM_DEVREADWRITE | |
| 97 | AM_RANGE(0x0300, 0x030f) AM_DEVREADWRITE("k053244", k05324x_device, k053244_r, k053244_w) | |
| 98 | 98 | AM_RANGE(0x0800, 0x0fff) AM_READ(rollerg_k051316_r) AM_DEVWRITE_LEGACY("k051316", k051316_w) |
| 99 | AM_RANGE(0x1000, 0x17ff) AM_DEVREADWRITE | |
| 99 | AM_RANGE(0x1000, 0x17ff) AM_DEVREADWRITE("k053244", k05324x_device, k053245_r, k053245_w) | |
| 100 | 100 | AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram") |
| 101 | 101 | AM_RANGE(0x2000, 0x3aff) AM_RAM |
| 102 | 102 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") |
| r24078 | r24079 | |
|---|---|---|
| 20 | 20 | #include "cpu/m6809/hd6309.h" |
| 21 | 21 | #include "cpu/m6809/m6809.h" |
| 22 | 22 | #include "sound/2151intf.h" |
| 23 | #include "video/konicdev.h" | |
| 24 | 23 | #include "includes/konamipt.h" |
| 25 | 24 | #include "includes/contra.h" |
| 26 | 25 | |
| r24078 | r24079 | |
| 28 | 27 | INTERRUPT_GEN_MEMBER(contra_state::contra_interrupt) |
| 29 | 28 | { |
| 30 | 29 | address_space &space = generic_space(); |
| 31 | if (k007121_ctrlram_r( | |
| 30 | if (m_k007121_1->ctrlram_r(space, 7) & 0x02) | |
| 32 | 31 | device.execute().set_input_line(HD6309_IRQ_LINE, HOLD_LINE); |
| 33 | 32 | } |
| 34 | 33 |
| r24078 | r24079 | |
|---|---|---|
| 84 | 84 | /* some games have the A12 line not connected, so the chip spans */ |
| 85 | 85 | /* twice the memory range, with mirroring */ |
| 86 | 86 | offset = ((offset & 0x3000) >> 1) | (offset & 0x07ff); |
| 87 | return k052109 | |
| 87 | return m_k052109->word_r(space, offset, mem_mask); | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | WRITE16_MEMBER(tmnt_state::k052109_word_noA12_w) |
| r24078 | r24079 | |
| 92 | 92 | /* some games have the A12 line not connected, so the chip spans */ |
| 93 | 93 | /* twice the memory range, with mirroring */ |
| 94 | 94 | offset = ((offset & 0x3000) >> 1) | (offset & 0x07ff); |
| 95 | k052109 | |
| 95 | m_k052109->word_w(space, offset, data, mem_mask); | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | WRITE16_MEMBER(tmnt_state::punkshot_k052109_word_w) |
| r24078 | r24079 | |
| 100 | 100 | /* it seems that a word write is supposed to affect only the MSB. The */ |
| 101 | 101 | /* "ROUND 1" text in punkshtj goes lost otherwise. */ |
| 102 | 102 | if (ACCESSING_BITS_8_15) |
| 103 | | |
| 103 | m_k052109->write(space, offset, (data >> 8) & 0xff); | |
| 104 | 104 | else if (ACCESSING_BITS_0_7) |
| 105 | | |
| 105 | m_k052109->write(space, offset + 0x2000, data & 0xff); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | WRITE16_MEMBER(tmnt_state::punkshot_k052109_word_noA12_w) |
| r24078 | r24079 | |
| 124 | 124 | else |
| 125 | 125 | { |
| 126 | 126 | offset = ((offset & 0x000e) >> 1) | ((offset & 0x1fc0) >> 3); |
| 127 | return k053245_word_r( | |
| 127 | return m_k053245->k053245_word_r(space, offset, mem_mask); | |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| r24078 | r24079 | |
| 135 | 135 | if (!(offset & 0x0031)) |
| 136 | 136 | { |
| 137 | 137 | offset = ((offset & 0x000e) >> 1) | ((offset & 0x1fc0) >> 3); |
| 138 | k053245_word_w( | |
| 138 | m_k053245->k053245_word_w(space, offset, data, mem_mask); | |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| r24078 | r24079 | |
| 143 | 143 | { |
| 144 | 144 | offset &= ~1; /* handle mirror address */ |
| 145 | 145 | |
| 146 | return k05324 | |
| 146 | return m_k053245->k053244_r(space, offset + 1) | (m_k053245->k053244_r(space, offset) << 8); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | WRITE16_MEMBER(tmnt_state::k053244_word_noA1_w) |
| r24078 | r24079 | |
| 151 | 151 | offset &= ~1; /* handle mirror address */ |
| 152 | 152 | |
| 153 | 153 | if (ACCESSING_BITS_8_15) |
| 154 | k05324 | |
| 154 | m_k053245->k053244_w(space, offset, (data >> 8) & 0xff); | |
| 155 | 155 | if (ACCESSING_BITS_0_7) |
| 156 | k05324 | |
| 156 | m_k053245->k053244_w(space, offset + 1, data & 0xff); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | INTERRUPT_GEN_MEMBER(tmnt_state::cuebrick_interrupt) |
| r24078 | r24079 | |
| 164 | 164 | |
| 165 | 165 | INTERRUPT_GEN_MEMBER(tmnt_state::punkshot_interrupt) |
| 166 | 166 | { |
| 167 | if (k052109 | |
| 167 | if (m_k052109->is_irq_enabled()) | |
| 168 | 168 | irq4_line_hold(device); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | INTERRUPT_GEN_MEMBER(tmnt_state::lgtnfght_interrupt) |
| 172 | 172 | { |
| 173 | if (k052109 | |
| 173 | if (m_k052109->is_irq_enabled()) | |
| 174 | 174 | irq5_line_hold(device); |
| 175 | 175 | } |
| 176 | 176 | |
| r24078 | r24079 | |
| 363 | 363 | data = -space.read_word(0x105818); |
| 364 | 364 | data = ((data / 8 - 4) & 0x1f) * 0x40; |
| 365 | 365 | data += ((space.read_word(0x105cb0) + |
| 366 | 256 * | |
| 366 | 256 * m_k052109->read(space, 0x1a01) + m_k052109->read(space, 0x1a00) - 6) / 8 + 12) & 0x3f; | |
| 367 | 367 | return data; |
| 368 | 368 | |
| 369 | 369 | default: |
| r24078 | r24079 | |
| 389 | 389 | { |
| 390 | 390 | if ((space.read_word(0x180006 + 128 * i) >> 8) == logical_pri) |
| 391 | 391 | { |
| 392 | k053245_word_w( | |
| 392 | m_k053245->k053245_word_w(space, 8 * i, hardware_pri, 0x00ff); | |
| 393 | 393 | hardware_pri++; |
| 394 | 394 | } |
| 395 | 395 | } |
| r24078 | r24079 | |
| 507 | 507 | m_last = data & 0x20; |
| 508 | 508 | |
| 509 | 509 | /* bit 6 = enable char ROM reading through the video RAM */ |
| 510 | k052109 | |
| 510 | m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| r24078 | r24079 | |
| 558 | 558 | AM_RANGE(0x0b0400, 0x0b0401) AM_WRITE(cuebrick_nvbank_w) |
| 559 | 559 | AM_RANGE(0x0c0000, 0x0c0003) AM_DEVREADWRITE8("ymsnd", ym2151_device, read, write, 0xff00) |
| 560 | 560 | AM_RANGE(0x100000, 0x107fff) AM_READWRITE(k052109_word_noA12_r, k052109_word_noA12_w) |
| 561 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE_LEGACY("k051960", k051937_word_r, k051937_word_w) | |
| 562 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_word_r, k051960_word_w) | |
| 561 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE("k051960", k051960_device, k051937_word_r, k051937_word_w) | |
| 562 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_word_r, k051960_word_w) | |
| 563 | 563 | ADDRESS_MAP_END |
| 564 | 564 | |
| 565 | 565 | |
| r24078 | r24079 | |
| 580 | 580 | #endif |
| 581 | 581 | AM_RANGE(0x100000, 0x107fff) AM_READWRITE(k052109_word_noA12_r, k052109_word_noA12_w) |
| 582 | 582 | // AM_RANGE(0x10e800, 0x10e801) AM_WRITENOP ??? |
| 583 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE_LEGACY("k051960", k051937_word_r, k051937_word_w) | |
| 584 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_word_r, k051960_word_w) | |
| 583 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE("k051960", k051960_device, k051937_word_r, k051937_word_w) | |
| 584 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_word_r, k051960_word_w) | |
| 585 | 585 | ADDRESS_MAP_END |
| 586 | 586 | |
| 587 | 587 | |
| r24078 | r24079 | |
| 601 | 601 | AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(tmnt_priority_w) |
| 602 | 602 | AM_RANGE(0x100000, 0x107fff) AM_READWRITE(k052109_word_noA12_r, k052109_word_noA12_w) |
| 603 | 603 | // AM_RANGE(0x10e800, 0x10e801) AM_WRITENOP ??? |
| 604 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE_LEGACY("k051960", k051937_word_r, k051937_word_w) | |
| 605 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_word_r, k051960_word_w) | |
| 604 | AM_RANGE(0x140000, 0x140007) AM_DEVREADWRITE("k051960", k051960_device, k051937_word_r, k051937_word_w) | |
| 605 | AM_RANGE(0x140400, 0x1407ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_word_r, k051960_word_w) | |
| 606 | 606 | ADDRESS_MAP_END |
| 607 | 607 | |
| 608 | 608 | |
| r24078 | r24079 | |
| 620 | 620 | AM_RANGE(0x0a0060, 0x0a007f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w) |
| 621 | 621 | AM_RANGE(0x0a0080, 0x0a0081) AM_WRITE(watchdog_reset16_w) |
| 622 | 622 | AM_RANGE(0x100000, 0x107fff) AM_READWRITE(k052109_word_noA12_r, punkshot_k052109_word_noA12_w) |
| 623 | AM_RANGE(0x110000, 0x110007) AM_DEVREADWRITE_LEGACY("k051960", k051937_word_r, k051937_word_w) | |
| 624 | AM_RANGE(0x110400, 0x1107ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_word_r, k051960_word_w) | |
| 623 | AM_RANGE(0x110000, 0x110007) AM_DEVREADWRITE("k051960", k051960_device, k051937_word_r, k051937_word_w) | |
| 624 | AM_RANGE(0x110400, 0x1107ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_word_r, k051960_word_w) | |
| 625 | 625 | AM_RANGE(0xfffffc, 0xffffff) AM_READ(punkshot_kludge_r) |
| 626 | 626 | ADDRESS_MAP_END |
| 627 | 627 | |
| r24078 | r24079 | |
| 655 | 655 | |
| 656 | 656 | static ADDRESS_MAP_START( blswhstl_main_map, AS_PROGRAM, 16, tmnt_state ) |
| 657 | 657 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 658 | AM_RANGE(0x180000, 0x183fff) AM_DEVREADWRITE | |
| 658 | AM_RANGE(0x180000, 0x183fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w) | |
| 659 | 659 | AM_RANGE(0x204000, 0x207fff) AM_RAM /* main RAM */ |
| 660 | 660 | AM_RANGE(0x300000, 0x303fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_SHARE("spriteram") |
| 661 | 661 | AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") |
| r24078 | r24079 | |
| 689 | 689 | { |
| 690 | 690 | if (k053251_get_tmap_dirty(m_k053251, 2 + i)) |
| 691 | 691 | { |
| 692 | k052109 | |
| 692 | m_k052109->tilemap_mark_dirty(i); | |
| 693 | 693 | k053251_set_tmap_dirty(m_k053251, 2 + i, 0); |
| 694 | 694 | } |
| 695 | 695 | } |
| r24078 | r24079 | |
| 703 | 703 | AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") |
| 704 | 704 | AM_RANGE(0x10c000, 0x10cfff) AM_DEVREADWRITE_LEGACY("k053936", k053936_linectrl_r, k053936_linectrl_w) /* 053936? */ |
| 705 | 705 | AM_RANGE(0x110000, 0x11001f) AM_WRITE(k053244_word_noA1_w) /* duplicate! */ |
| 706 | AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE | |
| 706 | AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE("k053245", k05324x_device, k053244_lsb_r, k053244_lsb_w) /* duplicate! */ | |
| 707 | 707 | AM_RANGE(0x118000, 0x11801f) AM_DEVWRITE_LEGACY("k053936", k053936_ctrl_w) |
| 708 | 708 | AM_RANGE(0x11c000, 0x11c01f) AM_DEVWRITE_LEGACY("k053251", k053251_msb_w) |
| 709 | 709 | AM_RANGE(0x11c000, 0x11c01f) AM_WRITE(k053251_glfgreat_w) |
| r24078 | r24079 | |
| 727 | 727 | AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") |
| 728 | 728 | AM_RANGE(0x10c000, 0x10cfff) AM_DEVREADWRITE_LEGACY("k053936", k053936_linectrl_r, k053936_linectrl_w) |
| 729 | 729 | AM_RANGE(0x110000, 0x11001f) AM_WRITE(k053244_word_noA1_w) /* duplicate! */ |
| 730 | AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE | |
| 730 | AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE("k053245", k05324x_device, k053244_lsb_r, k053244_lsb_w) /* duplicate! */ | |
| 731 | 731 | AM_RANGE(0x118000, 0x11801f) AM_DEVWRITE_LEGACY("k053936", k053936_ctrl_w) |
| 732 | 732 | AM_RANGE(0x11c000, 0x11c01f) AM_DEVWRITE_LEGACY("k053251", k053251_msb_w) |
| 733 | 733 | AM_RANGE(0x11c000, 0x11c01f) AM_WRITE(k053251_glfgreat_w) |
| r24078 | r24079 | |
| 765 | 765 | if (!(offs & 0x0031)) |
| 766 | 766 | { |
| 767 | 767 | offs = ((offs & 0x000e) >> 1) | ((offs & 0x1fc0) >> 3); |
| 768 | k053245_word_w( | |
| 768 | m_k053245->k053245_word_w(space, offs, data, 0xffff); | |
| 769 | 769 | } |
| 770 | 770 | } |
| 771 | 771 | else if (addr >= 0x104000 / 2 && addr <= 0x107fff / 2) |
| r24078 | r24079 | |
| 1001 | 1001 | AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff) |
| 1002 | 1002 | AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w) |
| 1003 | 1003 | AM_RANGE(0x5c0700, 0x5c071f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w) |
| 1004 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE | |
| 1004 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w) | |
| 1005 | 1005 | ADDRESS_MAP_END |
| 1006 | 1006 | |
| 1007 | 1007 | |
| r24078 | r24079 | |
| 1027 | 1027 | AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff) |
| 1028 | 1028 | AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w) |
| 1029 | 1029 | AM_RANGE(0x5c0700, 0x5c071f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w) |
| 1030 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE | |
| 1030 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w) | |
| 1031 | 1031 | ADDRESS_MAP_END |
| 1032 | 1032 | |
| 1033 | 1033 | |
| r24078 | r24079 | |
| 1041 | 1041 | AM_RANGE(0x1c0300, 0x1c0301) AM_WRITE(ssriders_1c0300_w) |
| 1042 | 1042 | AM_RANGE(0x1c0400, 0x1c0401) AM_WRITENOP |
| 1043 | 1043 | AM_RANGE(0x5a0000, 0x5a001f) AM_READWRITE(k053244_word_noA1_r, k053244_word_noA1_w) |
| 1044 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE | |
| 1044 | AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w) | |
| 1045 | 1045 | AM_RANGE(0x604020, 0x60402f) AM_WRITENOP /* written every frame */ |
| 1046 | 1046 | AM_RANGE(0x604200, 0x604201) AM_WRITENOP /* watchdog */ |
| 1047 | 1047 | AM_RANGE(0x6119e2, 0x6119e3) AM_WRITENOP /* written a lot in some test menus (PC=18204) */ |
| r24078 | r24079 | |
| 1070 | 1070 | AM_RANGE(0x500202, 0x500203) AM_READ(thndrx2_eeprom_r) |
| 1071 | 1071 | AM_RANGE(0x500300, 0x500301) AM_WRITENOP /* watchdog reset? irq enable? */ |
| 1072 | 1072 | AM_RANGE(0x600000, 0x607fff) AM_READWRITE(k052109_word_noA12_r, k052109_word_noA12_w) |
| 1073 | AM_RANGE(0x700000, 0x700007) AM_DEVREADWRITE_LEGACY("k051960", k051937_word_r, k051937_word_w) | |
| 1074 | AM_RANGE(0x700400, 0x7007ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_word_r, k051960_word_w) | |
| 1073 | AM_RANGE(0x700000, 0x700007) AM_DEVREADWRITE("k051960", k051960_device, k051937_word_r, k051937_word_w) | |
| 1074 | AM_RANGE(0x700400, 0x7007ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_word_r, k051960_word_w) | |
| 1075 | 1075 | ADDRESS_MAP_END |
| 1076 | 1076 | |
| 1077 | 1077 |
| r24078 | r24079 | |
|---|---|---|
| 11 | 11 | #include "cpu/z80/z80.h" |
| 12 | 12 | #include "sound/3812intf.h" |
| 13 | 13 | #include "sound/k051649.h" |
| 14 | #include "video/konicdev.h" | |
| 15 | 14 | #include "includes/konamipt.h" |
| 16 | 15 | #include "includes/hcastle.h" |
| 17 | 16 |
| r24078 | r24079 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | INTERRUPT_GEN_MEMBER(aliens_state::aliens_interrupt) |
| 22 | 22 | { |
| 23 | if (k051960_is_irq_enabled( | |
| 23 | if (m_k051960->k051960_is_irq_enabled()) | |
| 24 | 24 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 25 | 25 | } |
| 26 | 26 | |
| r24078 | r24079 | |
| 50 | 50 | m_palette_selected = data & 0x20; |
| 51 | 51 | |
| 52 | 52 | /* bit 6 = enable char ROM reading through the video RAM */ |
| 53 | k052109 | |
| 53 | m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 54 | 54 | |
| 55 | 55 | /* other bits unknown */ |
| 56 | 56 | #if 0 |
| r24078 | r24079 | |
| 82 | 82 | |
| 83 | 83 | READ8_MEMBER(aliens_state::k052109_051960_r) |
| 84 | 84 | { |
| 85 | if (k052109 | |
| 85 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 86 | 86 | { |
| 87 | 87 | if (offset >= 0x3800 && offset < 0x3808) |
| 88 | return k0519 | |
| 88 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 89 | 89 | else if (offset < 0x3c00) |
| 90 | return | |
| 90 | return m_k052109->read(space, offset); | |
| 91 | 91 | else |
| 92 | return k051960 | |
| 92 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 93 | 93 | } |
| 94 | 94 | else |
| 95 | return | |
| 95 | return m_k052109->read(space, offset); | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | WRITE8_MEMBER(aliens_state::k052109_051960_w) |
| 99 | 99 | { |
| 100 | 100 | if (offset >= 0x3800 && offset < 0x3808) |
| 101 | k0519 | |
| 101 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 102 | 102 | else if (offset < 0x3c00) |
| 103 | | |
| 103 | m_k052109->write(space, offset, data); | |
| 104 | 104 | else |
| 105 | k051960 | |
| 105 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | static ADDRESS_MAP_START( aliens_map, AS_PROGRAM, 8, aliens_state ) |
| r24078 | r24079 | |
|---|---|---|
| 14 | 14 | #include "cpu/z80/z80.h" |
| 15 | 15 | #include "cpu/m6809/hd6309.h" |
| 16 | 16 | #include "sound/2151intf.h" |
| 17 | #include "video/konicdev.h" | |
| 18 | 17 | #include "includes/konamipt.h" |
| 19 | 18 | #include "includes/flkatck.h" |
| 20 | 19 |
| r24078 | r24079 | |
|---|---|---|
| 14 | 14 | #include "cpu/m6809/hd6309.h" |
| 15 | 15 | #include "cpu/z80/z80.h" |
| 16 | 16 | #include "sound/3812intf.h" |
| 17 | #include "video/konicdev.h" | |
| 18 | 17 | #include "includes/konamipt.h" |
| 19 | 18 | #include "includes/battlnts.h" |
| 20 | 19 | |
| r24078 | r24079 | |
| 27 | 26 | |
| 28 | 27 | INTERRUPT_GEN_MEMBER(battlnts_state::battlnts_interrupt) |
| 29 | 28 | { |
| 30 | if (k007342 | |
| 29 | if (m_k007342->is_int_enabled()) | |
| 31 | 30 | device.execute().set_input_line(HD6309_IRQ_LINE, HOLD_LINE); |
| 32 | 31 | } |
| 33 | 32 | |
| r24078 | r24079 | |
| 56 | 55 | *************************************/ |
| 57 | 56 | |
| 58 | 57 | static ADDRESS_MAP_START( battlnts_map, AS_PROGRAM, 8, battlnts_state ) |
| 59 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("k007342", k007342_r, k007342_w) /* Color RAM + Video RAM */ | |
| 60 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE_LEGACY("k007420", k007420_r, k007420_w) /* Sprite RAM */ | |
| 61 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE_LEGACY("k007342", k007342_scroll_r, k007342_scroll_w) /* Scroll RAM */ | |
| 58 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("k007342", k007342_device, read, write) /* Color RAM + Video RAM */ | |
| 59 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE("k007420", k007420_device, read, write) /* Sprite RAM */ | |
| 60 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE("k007342", k007342_device, scroll_r, scroll_w) /* Scroll RAM */ | |
| 62 | 61 | AM_RANGE(0x2400, 0x24ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")/* palette */ |
| 63 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE | |
| 62 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE("k007342", k007342_device, vreg_w) /* Video Registers */ | |
| 64 | 63 | AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("DSW1") |
| 65 | 64 | AM_RANGE(0x2e01, 0x2e01) AM_READ_PORT("P2") |
| 66 | 65 | AM_RANGE(0x2e02, 0x2e02) AM_READ_PORT("P1") |
| r24078 | r24079 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | INTERRUPT_GEN_MEMBER(_88games_state::k88games_interrupt) |
| 26 | 26 | { |
| 27 | if (k052109 | |
| 27 | if (m_k052109->is_irq_enabled()) | |
| 28 | 28 | irq0_line_hold(device); |
| 29 | 29 | } |
| 30 | 30 | |
| r24078 | r24079 | |
| 88 | 88 | /* special handlers to combine 052109 & 051960 */ |
| 89 | 89 | READ8_MEMBER(_88games_state::k052109_051960_r) |
| 90 | 90 | { |
| 91 | if (k052109 | |
| 91 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 92 | 92 | { |
| 93 | 93 | if (offset >= 0x3800 && offset < 0x3808) |
| 94 | return k0519 | |
| 94 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 95 | 95 | else if (offset < 0x3c00) |
| 96 | return | |
| 96 | return m_k052109->read(space, offset); | |
| 97 | 97 | else |
| 98 | return k051960 | |
| 98 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 99 | 99 | } |
| 100 | 100 | else |
| 101 | return | |
| 101 | return m_k052109->read(space, offset); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | WRITE8_MEMBER(_88games_state::k052109_051960_w) |
| 105 | 105 | { |
| 106 | 106 | if (offset >= 0x3800 && offset < 0x3808) |
| 107 | k0519 | |
| 107 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 108 | 108 | else if (offset < 0x3c00) |
| 109 | | |
| 109 | m_k052109->write(space, offset, data); | |
| 110 | 110 | else |
| 111 | k051960 | |
| 111 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /************************************* |
| r24078 | r24079 | |
| 288 | 288 | state->m_videobank = lines & 0x10; |
| 289 | 289 | |
| 290 | 290 | /* bit 5 = enable char ROM reading through the video RAM */ |
| 291 | k052109 | |
| 291 | state->m_k052109->set_rmrd_line((lines & 0x20) ? ASSERT_LINE : CLEAR_LINE); | |
| 292 | 292 | |
| 293 | 293 | /* bit 6 is unknown, 1 most of the time */ |
| 294 | 294 |
| r24078 | r24079 | |
|---|---|---|
| 100 | 100 | AM_RANGE(0x1fc8, 0x1fc9) AM_DEVREAD_LEGACY("k053246", k053246_r) |
| 101 | 101 | AM_RANGE(0x1fca, 0x1fca) AM_READ(watchdog_reset_r) |
| 102 | 102 | AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank4") |
| 103 | AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE | |
| 103 | AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) | |
| 104 | 104 | AM_RANGE(0x4000, 0x5fff) AM_RAM |
| 105 | 105 | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") |
| 106 | 106 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| r24078 | r24079 | |
| 271 | 271 | timer_set(attotime::from_usec(30), TIMER_DMAEND); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | if (k052109 | |
| 274 | if (m_k052109->is_irq_enabled()) | |
| 275 | 275 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 276 | 276 | } |
| 277 | 277 |
| r24078 | r24079 | |
|---|---|---|
| 60 | 60 | /* bit 8 = enable sprite ROM reading */ |
| 61 | 61 | k053246_set_objcha_line(m_k053246, (data & 0x0100) ? ASSERT_LINE : CLEAR_LINE); |
| 62 | 62 | /* bit 9 = enable char ROM reading through the video RAM */ |
| 63 | k052109 | |
| 63 | m_k052109->set_rmrd_line((data & 0x0200) ? ASSERT_LINE : CLEAR_LINE); | |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| r24078 | r24079 | |
| 122 | 122 | AM_RANGE(0x10a00c, 0x10a00d) AM_DEVREAD_LEGACY("k053246", k053246_word_r) |
| 123 | 123 | AM_RANGE(0x110000, 0x113fff) AM_RAM /* main RAM */ |
| 124 | 124 | AM_RANGE(0x18fa00, 0x18fa01) AM_WRITE(xmen_18fa00_w) |
| 125 | AM_RANGE(0x18c000, 0x197fff) AM_DEVREADWRITE | |
| 125 | AM_RANGE(0x18c000, 0x197fff) AM_DEVREADWRITE("k052109", k052109_device, lsb_r, lsb_w) | |
| 126 | 126 | ADDRESS_MAP_END |
| 127 | 127 | |
| 128 | 128 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, xmen_state ) |
| r24078 | r24079 | |
| 158 | 158 | AM_RANGE(0x10a00c, 0x10a00d) AM_DEVREAD_LEGACY("k053246", k053246_word_r) /* sprites */ |
| 159 | 159 | AM_RANGE(0x110000, 0x113fff) AM_RAM /* main RAM */ |
| 160 | 160 | AM_RANGE(0x18fa00, 0x18fa01) AM_WRITE(xmen_18fa00_w) |
| 161 | /* AM_RANGE(0x18c000, 0x197fff) AM_DEVWRITE | |
| 161 | /* AM_RANGE(0x18c000, 0x197fff) AM_DEVWRITE("k052109", k052109_device, lsb_w) AM_SHARE("tilemapleft") */ | |
| 162 | 162 | AM_RANGE(0x18c000, 0x197fff) AM_RAM AM_SHARE("tilemapleft") /* left tilemap (p1,p2,p3 counters) */ |
| 163 | 163 | /* |
| 164 | 164 | AM_RANGE(0x1ac000, 0x1af7ff) AM_READONLY |
| r24078 | r24079 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | INTERRUPT_GEN_MEMBER(mainevt_state::mainevt_interrupt) |
| 34 | 34 | { |
| 35 | if (k052109 | |
| 35 | if (m_k052109->is_irq_enabled()) | |
| 36 | 36 | irq0_line_hold(device); |
| 37 | 37 | } |
| 38 | 38 | |
| r24078 | r24079 | |
| 57 | 57 | //palette_selected = data & 0x20; |
| 58 | 58 | |
| 59 | 59 | /* bit 6 = enable char ROM reading through the video RAM */ |
| 60 | k052109 | |
| 60 | m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 61 | 61 | |
| 62 | 62 | /* bit 7 = NINITSET (unknown) */ |
| 63 | 63 | |
| r24078 | r24079 | |
| 126 | 126 | |
| 127 | 127 | READ8_MEMBER(mainevt_state::k052109_051960_r) |
| 128 | 128 | { |
| 129 | if (k052109 | |
| 129 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 130 | 130 | { |
| 131 | 131 | if (offset >= 0x3800 && offset < 0x3808) |
| 132 | return k0519 | |
| 132 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 133 | 133 | else if (offset < 0x3c00) |
| 134 | return | |
| 134 | return m_k052109->read(space, offset); | |
| 135 | 135 | else |
| 136 | return k051960 | |
| 136 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 137 | 137 | } |
| 138 | 138 | else |
| 139 | return | |
| 139 | return m_k052109->read(space, offset); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | WRITE8_MEMBER(mainevt_state::k052109_051960_w) |
| 143 | 143 | { |
| 144 | 144 | if (offset >= 0x3800 && offset < 0x3808) |
| 145 | k0519 | |
| 145 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 146 | 146 | else if (offset < 0x3c00) |
| 147 | | |
| 147 | m_k052109->write(space, offset, data); | |
| 148 | 148 | else |
| 149 | k051960 | |
| 149 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 |
| r24078 | r24079 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | static ADDRESS_MAP_START( ajax_main_map, AS_PROGRAM, 8, ajax_state ) |
| 28 | 28 | AM_RANGE(0x0000, 0x01c0) AM_READWRITE(ajax_ls138_f10_r, ajax_ls138_f10_w) /* bankswitch + sound command + FIRQ command */ |
| 29 | AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE_LEGACY("k051960", k051937_r, k051937_w) /* sprite control registers */ | |
| 30 | AM_RANGE(0x0c00, 0x0fff) AM_DEVREADWRITE_LEGACY("k051960", k051960_r, k051960_w) /* sprite RAM 2128SL at J7 */ | |
| 29 | AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE("k051960", k051960_device, k051937_r, k051937_w) /* sprite control registers */ | |
| 30 | AM_RANGE(0x0c00, 0x0fff) AM_DEVREADWRITE("k051960", k051960_device, k051960_r, k051960_w) /* sprite RAM 2128SL at J7 */ | |
| 31 | 31 | AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")/* palette */ |
| 32 | 32 | AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("share1") /* shared RAM with the 6809 */ |
| 33 | 33 | AM_RANGE(0x4000, 0x5fff) AM_RAM /* RAM 6264L at K10 */ |
| r24078 | r24079 | |
| 41 | 41 | AM_RANGE(0x1000, 0x17ff) AM_DEVREAD_LEGACY("k051316", k051316_rom_r) /* 051316 (ROM test) */ |
| 42 | 42 | AM_RANGE(0x1800, 0x1800) AM_WRITE(ajax_bankswitch_2_w) /* bankswitch control */ |
| 43 | 43 | AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("share1") /* shared RAM with the 052001 */ |
| 44 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE | |
| 44 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) /* video RAM + color RAM + video registers */ | |
| 45 | 45 | AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1") /* banked ROM */ |
| 46 | 46 | AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM I16 */ |
| 47 | 47 | ADDRESS_MAP_END |
| r24078 | r24079 | |
|---|---|---|
| 31 | 31 | #include "cpu/m6809/hd6309.h" |
| 32 | 32 | #include "sound/2203intf.h" |
| 33 | 33 | #include "sound/upd7759.h" |
| 34 | #include "video/konicdev.h" | |
| 35 | 34 | #include "includes/konamipt.h" |
| 36 | 35 | #include "includes/bladestl.h" |
| 37 | 36 | |
| r24078 | r24079 | |
| 40 | 39 | { |
| 41 | 40 | int scanline = param; |
| 42 | 41 | |
| 43 | if(scanline == 240 && k007342 | |
| 42 | if(scanline == 240 && m_k007342->is_int_enabled()) // vblank-out irq | |
| 44 | 43 | m_maincpu->set_input_line(HD6309_FIRQ_LINE, HOLD_LINE); |
| 45 | 44 | |
| 46 | 45 | if(scanline == 0) // vblank-in or timer irq |
| r24078 | r24079 | |
| 116 | 115 | *************************************/ |
| 117 | 116 | |
| 118 | 117 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, bladestl_state ) |
| 119 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("k007342", k007342_r, k007342_w) /* Color RAM + Video RAM */ | |
| 120 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE_LEGACY("k007420", k007420_r, k007420_w) /* Sprite RAM */ | |
| 121 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE_LEGACY("k007342", k007342_scroll_r, k007342_scroll_w) /* Scroll RAM */ | |
| 118 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("k007342", k007342_device, read, write) /* Color RAM + Video RAM */ | |
| 119 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE("k007420", k007420_device, read, write) /* Sprite RAM */ | |
| 120 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE("k007342", k007342_device, scroll_r, scroll_w) /* Scroll RAM */ | |
| 122 | 121 | AM_RANGE(0x2400, 0x245f) AM_RAM AM_SHARE("paletteram") /* palette */ |
| 123 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE | |
| 122 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE("k007342", k007342_device, vreg_w) /* Video Registers */ | |
| 124 | 123 | AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("COINSW") /* DIPSW #3, coinsw, startsw */ |
| 125 | 124 | AM_RANGE(0x2e01, 0x2e01) AM_READ_PORT("P1") /* 1P controls */ |
| 126 | 125 | AM_RANGE(0x2e02, 0x2e02) AM_READ_PORT("P2") /* 2P controls */ |
| r24078 | r24079 | |
|---|---|---|
| 173 | 173 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, asterix_state ) |
| 174 | 174 | AM_RANGE(0x000000, 0x0fffff) AM_ROM |
| 175 | 175 | AM_RANGE(0x100000, 0x107fff) AM_RAM |
| 176 | AM_RANGE(0x180000, 0x1807ff) AM_DEVREADWRITE | |
| 176 | AM_RANGE(0x180000, 0x1807ff) AM_DEVREADWRITE("k053244", k05324x_device, k053245_word_r, k053245_word_w) | |
| 177 | 177 | AM_RANGE(0x180800, 0x180fff) AM_RAM // extra RAM, or mirror for the above? |
| 178 | AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE | |
| 178 | AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("k053244", k05324x_device, k053244_word_r, k053244_word_w) | |
| 179 | 179 | AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") |
| 180 | AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE | |
| 180 | AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE("k053244", k05324x_device, k053244_lsb_r, k053244_lsb_w) | |
| 181 | 181 | AM_RANGE(0x380000, 0x380001) AM_READ_PORT("IN0") |
| 182 | 182 | AM_RANGE(0x380002, 0x380003) AM_READ_PORT("IN1") |
| 183 | 183 | AM_RANGE(0x380100, 0x380101) AM_WRITE(control2_w) |
| r24078 | r24079 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | READ16_MEMBER(gradius3_state::k052109_halfword_r) |
| 30 | 30 | { |
| 31 | return | |
| 31 | return m_k052109->read(space, offset); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | WRITE16_MEMBER(gradius3_state::k052109_halfword_w) |
| 35 | 35 | { |
| 36 | 36 | if (ACCESSING_BITS_0_7) |
| 37 | | |
| 37 | m_k052109->write(space, offset, data & 0xff); | |
| 38 | 38 | |
| 39 | 39 | /* is this a bug in the game or something else? */ |
| 40 | 40 | if (!ACCESSING_BITS_0_7) |
| 41 | | |
| 41 | m_k052109->write(space, offset, (data >> 8) & 0xff); | |
| 42 | 42 | // logerror("%06x half %04x = %04x\n",space.device().safe_pc(),offset,data); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | READ16_MEMBER(gradius3_state::k051937_halfword_r) |
| 46 | 46 | { |
| 47 | return k0519 | |
| 47 | return m_k051960->k051937_r(space, offset); | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | WRITE16_MEMBER(gradius3_state::k051937_halfword_w) |
| 51 | 51 | { |
| 52 | 52 | if (ACCESSING_BITS_0_7) |
| 53 | k0519 | |
| 53 | m_k051960->k051937_w(space, offset, data & 0xff); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | READ16_MEMBER(gradius3_state::k051960_halfword_r) |
| 57 | 57 | { |
| 58 | return k051960 | |
| 58 | return m_k051960->k051960_r(space, offset); | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | WRITE16_MEMBER(gradius3_state::k051960_halfword_w) |
| 62 | 62 | { |
| 63 | 63 | if (ACCESSING_BITS_0_7) |
| 64 | k051960 | |
| 64 | m_k051960->k051960_w(space, offset, data & 0xff); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | WRITE16_MEMBER(gradius3_state::cpuA_ctrl_w) |
| r24078 | r24079 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | INTERRUPT_GEN_MEMBER(parodius_state::parodius_interrupt) |
| 23 | 23 | { |
| 24 | if (k052109 | |
| 24 | if (m_k052109->is_irq_enabled()) | |
| 25 | 25 | device.execute().set_input_line(0, HOLD_LINE); |
| 26 | 26 | } |
| 27 | 27 | |
| r24078 | r24079 | |
| 54 | 54 | READ8_MEMBER(parodius_state::parodius_052109_053245_r) |
| 55 | 55 | { |
| 56 | 56 | if (m_videobank & 0x02) |
| 57 | return k053245 | |
| 57 | return m_k053245->k053245_r(space, offset); | |
| 58 | 58 | else |
| 59 | return | |
| 59 | return m_k052109->read(space, offset); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | WRITE8_MEMBER(parodius_state::parodius_052109_053245_w) |
| 63 | 63 | { |
| 64 | 64 | if (m_videobank & 0x02) |
| 65 | k053245 | |
| 65 | m_k053245->k053245_w(space, offset, data); | |
| 66 | 66 | else |
| 67 | | |
| 67 | m_k052109->write(space, offset, data); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | WRITE8_MEMBER(parodius_state::parodius_videobank_w) |
| r24078 | r24079 | |
| 88 | 88 | coin_counter_w(machine(), 1, data & 0x02); |
| 89 | 89 | |
| 90 | 90 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 91 | k052109 | |
| 91 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 92 | 92 | |
| 93 | 93 | /* other bits unknown */ |
| 94 | 94 | } |
| r24078 | r24079 | |
| 141 | 141 | AM_RANGE(0x3f8e, 0x3f8e) AM_READ_PORT("DSW3") |
| 142 | 142 | AM_RANGE(0x3f8f, 0x3f8f) AM_READ_PORT("DSW1") |
| 143 | 143 | AM_RANGE(0x3f90, 0x3f90) AM_READ_PORT("DSW2") |
| 144 | AM_RANGE(0x3fa0, 0x3faf) AM_DEVREADWRITE | |
| 144 | AM_RANGE(0x3fa0, 0x3faf) AM_DEVREADWRITE("k053245", k05324x_device, k053244_r, k053244_w) | |
| 145 | 145 | AM_RANGE(0x3fb0, 0x3fbf) AM_DEVWRITE_LEGACY("k053251", k053251_w) |
| 146 | 146 | AM_RANGE(0x3fc0, 0x3fc0) AM_READ(watchdog_reset_r) AM_WRITE(parodius_3fc0_w) |
| 147 | 147 | AM_RANGE(0x3fc4, 0x3fc4) AM_WRITE(parodius_videobank_w) |
| 148 | 148 | AM_RANGE(0x3fc8, 0x3fc8) AM_WRITE(parodius_sh_irqtrigger_w) |
| 149 | 149 | AM_RANGE(0x3fcc, 0x3fcd) AM_READ(parodius_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w) /* K053260 */ |
| 150 | 150 | AM_RANGE(0x2000, 0x27ff) AM_READWRITE(parodius_052109_053245_r, parodius_052109_053245_w) |
| 151 | AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE | |
| 151 | AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) | |
| 152 | 152 | AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1") /* banked ROM */ |
| 153 | 153 | AM_RANGE(0xa000, 0xffff) AM_ROM /* ROM */ |
| 154 | 154 | ADDRESS_MAP_END |
| r24078 | r24079 | |
|---|---|---|
| 123 | 123 | #include "cpu/m6809/hd6309.h" |
| 124 | 124 | #include "cpu/z80/z80.h" |
| 125 | 125 | #include "sound/2203intf.h" |
| 126 | #include "sound/upd7759.h" | |
| 127 | #include "sound/msm5205.h" | |
| 128 | #include "video/konicdev.h" | |
| 129 | 126 | #include "includes/combatsc.h" |
| 130 | 127 | |
| 131 | 128 |
| r24078 | r24079 | |
|---|---|---|
| 52 | 52 | #include "cpu/m6809/hd6309.h" |
| 53 | 53 | #include "sound/2151intf.h" |
| 54 | 54 | #include "sound/vlm5030.h" |
| 55 | #include "video/konicdev.h" | |
| 56 | 55 | #include "includes/rockrage.h" |
| 57 | 56 | #include "includes/konamipt.h" |
| 58 | 57 | |
| 59 | 58 | |
| 60 | 59 | INTERRUPT_GEN_MEMBER(rockrage_state::rockrage_interrupt) |
| 61 | 60 | { |
| 62 | if (k007342 | |
| 61 | if (m_k007342->is_int_enabled()) | |
| 63 | 62 | device.execute().set_input_line(HD6309_IRQ_LINE, HOLD_LINE); |
| 64 | 63 | } |
| 65 | 64 | |
| r24078 | r24079 | |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | static ADDRESS_MAP_START( rockrage_map, AS_PROGRAM, 8, rockrage_state ) |
| 99 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("k007342", k007342_r, k007342_w) /* Color RAM + Video RAM */ | |
| 100 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE_LEGACY("k007420", k007420_r, k007420_w) /* Sprite RAM */ | |
| 101 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE_LEGACY("k007342", k007342_scroll_r, k007342_scroll_w) /* Scroll RAM */ | |
| 98 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("k007342", k007342_device, read, write) /* Color RAM + Video RAM */ | |
| 99 | AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE("k007420", k007420_device, read, write) /* Sprite RAM */ | |
| 100 | AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE("k007342", k007342_device, scroll_r, scroll_w) /* Scroll RAM */ | |
| 102 | 101 | AM_RANGE(0x2400, 0x247f) AM_RAM AM_SHARE("paletteram") /* Palette */ |
| 103 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE | |
| 102 | AM_RANGE(0x2600, 0x2607) AM_DEVWRITE("k007342", k007342_device, vreg_w) /* Video Registers */ | |
| 104 | 103 | AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("SYSTEM") |
| 105 | 104 | AM_RANGE(0x2e01, 0x2e01) AM_READ_PORT("P1") |
| 106 | 105 | AM_RANGE(0x2e02, 0x2e02) AM_READ_PORT("P2") |
| r24078 | r24079 | |
|---|---|---|
| 29 | 29 | { |
| 30 | 30 | int scanline = param; |
| 31 | 31 | |
| 32 | if(scanline == 240 && k051960_is_irq_enabled( | |
| 32 | if(scanline == 240 && m_k051960->k051960_is_irq_enabled()) // vblank irq | |
| 33 | 33 | m_maincpu->set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 34 | else if(((scanline % 32) == 0) && (k051960_is_nmi_enabled( | |
| 34 | else if(((scanline % 32) == 0) && (m_k051960->k051960_is_nmi_enabled())) // timer irq | |
| 35 | 35 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 36 | 36 | } |
| 37 | 37 | |
| r24078 | r24079 | |
| 139 | 139 | AM_RANGE(0x0000, 0x0fff) AM_RAM /* RAM */ |
| 140 | 140 | AM_RANGE(0x1000, 0x17ff) AM_RAMBANK("bank1") /* banked RAM (RAM/051316 (chip 1)) */ |
| 141 | 141 | AM_RANGE(0x1800, 0x1fff) AM_RAMBANK("bank2") /* palette + RAM */ |
| 142 | AM_RANGE(0x2000, 0x2007) AM_DEVREADWRITE_LEGACY("k051960", k051937_r, k051937_w) /* Sprite control registers */ | |
| 143 | AM_RANGE(0x2400, 0x27ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_r, k051960_w) /* Sprite RAM */ | |
| 142 | AM_RANGE(0x2000, 0x2007) AM_DEVREADWRITE("k051960", k051960_device, k051937_r, k051937_w) /* Sprite control registers */ | |
| 143 | AM_RANGE(0x2400, 0x27ff) AM_DEVREADWRITE("k051960", k051960_device, k051960_r, k051960_w) /* Sprite RAM */ | |
| 144 | 144 | AM_RANGE(0x2800, 0x2fff) AM_READ_BANK("bank3") AM_DEVWRITE_LEGACY("k051316_2", k051316_w) /* 051316 zoom/rotation (chip 2) */ |
| 145 | 145 | AM_RANGE(0x3000, 0x3000) AM_WRITE(soundlatch_byte_w) /* sound code # */ |
| 146 | 146 | AM_RANGE(0x3001, 0x3001) AM_WRITE(chqflag_sh_irqtrigger_w) /* cause interrupt on audio CPU */ |
| r24078 | r24079 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "cpu/m6809/hd6309.h" |
| 14 | #include "video/konicdev.h" | |
| 15 | 14 | #include "includes/konamipt.h" |
| 16 | 15 | #include "includes/fastlane.h" |
| 17 | 16 | |
| r24078 | r24079 | |
| 20 | 19 | int scanline = param; |
| 21 | 20 | |
| 22 | 21 | address_space &space = generic_space(); |
| 23 | if(scanline == 240 && k007121 | |
| 22 | if(scanline == 240 && m_k007121->ctrlram_r(space, 7) & 0x02) // vblank irq | |
| 24 | 23 | m_maincpu->set_input_line(HD6309_IRQ_LINE, HOLD_LINE); |
| 25 | else if(((scanline % 32) == 0) && k007121 | |
| 24 | else if(((scanline % 32) == 0) && m_k007121->ctrlram_r(space, 7) & 0x01) // timer irq | |
| 26 | 25 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 27 | 26 | } |
| 28 | 27 | |
| r24078 | r24079 | |
| 30 | 29 | WRITE8_MEMBER(fastlane_state::k007121_registers_w) |
| 31 | 30 | { |
| 32 | 31 | if (offset < 8) |
| 33 | k007121 | |
| 32 | m_k007121->ctrl_w(space, offset, data); | |
| 34 | 33 | else /* scroll registers */ |
| 35 | 34 | m_k007121_regs[offset] = data; |
| 36 | 35 | } |
| r24078 | r24079 | |
|---|---|---|
| 143 | 143 | |
| 144 | 144 | READ8_MEMBER(vendetta_state::vendetta_K052109_r) |
| 145 | 145 | { |
| 146 | return | |
| 146 | return m_k052109->read(space, offset + 0x2000); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | WRITE8_MEMBER(vendetta_state::vendetta_K052109_w) |
| r24078 | r24079 | |
| 153 | 153 | // * Tilemap MASK-ROM Test (0x1d80<->0x3d80, 0x1e00<->0x3e00, 0x1f00<->0x3f00) * |
| 154 | 154 | // ************************************************************************************* |
| 155 | 155 | if ((offset == 0x1d80) || (offset == 0x1e00) || (offset == 0x1f00)) |
| 156 | k052109_w(m_k052109, space, offset, data); | |
| 157 | k052109_w(m_k052109, space, offset + 0x2000, data); | |
| 156 | m_k052109->write(space, offset, data); | |
| 157 | m_k052109->write(space, offset + 0x2000, data); | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| r24078 | r24079 | |
| 172 | 172 | else |
| 173 | 173 | { |
| 174 | 174 | space.install_readwrite_handler(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, read8_delegate(FUNC(vendetta_state::vendetta_K052109_r),this), write8_delegate(FUNC(vendetta_state::vendetta_K052109_w),this) ); |
| 175 | space.install_ | |
| 175 | space.install_readwrite_handler(m_video_banking_base + 0x0000, m_video_banking_base + 0x0fff, read8_delegate(FUNC(k052109_device::read), (k052109_device*)m_k052109), write8_delegate(FUNC(k052109_device::write), (k052109_device*)m_k052109)); | |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| r24078 | r24079 | |
| 185 | 185 | /* bit 2 = BRAMBK ?? */ |
| 186 | 186 | |
| 187 | 187 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 188 | k052109 | |
| 188 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 189 | 189 | |
| 190 | 190 | /* bit 4 = INIT ?? */ |
| 191 | 191 | |
| r24078 | r24079 | |
| 251 | 251 | /* what is the desired effect of overlapping these memory regions anyway? */ |
| 252 | 252 | AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank3") |
| 253 | 253 | AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank2") |
| 254 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE | |
| 254 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) | |
| 255 | 255 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 256 | 256 | ADDRESS_MAP_END |
| 257 | 257 | |
| r24078 | r24079 | |
| 275 | 275 | /* what is the desired effect of overlapping these memory regions anyway? */ |
| 276 | 276 | AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") // 052109 (Tilemap) 0x0000-0x0fff |
| 277 | 277 | AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank2") // 052109 (Tilemap) 0x2000-0x3fff, Tilemap MASK-ROM bank selector (MASK-ROM Test) |
| 278 | AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE | |
| 278 | AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) // 052109 (Tilemap) | |
| 279 | 279 | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") // 053248 '975r01' 1M ROM (Banked) |
| 280 | 280 | AM_RANGE(0x8000, 0xffff) AM_ROM // 053248 '975r01' 1M ROM (0x18000-0x1ffff) |
| 281 | 281 | ADDRESS_MAP_END |
| r24078 | r24079 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | INTERRUPT_GEN_MEMBER(spy_state::spy_interrupt) |
| 29 | 29 | { |
| 30 | if (k052109 | |
| 30 | if (m_k052109->is_irq_enabled()) | |
| 31 | 31 | device.execute().set_input_line(0, HOLD_LINE); |
| 32 | 32 | } |
| 33 | 33 | |
| r24078 | r24079 | |
| 286 | 286 | coin_counter_w(machine(), 1, data & 0x02); |
| 287 | 287 | |
| 288 | 288 | /* bit 2 = enable char ROM reading through the video RAM */ |
| 289 | k052109 | |
| 289 | m_k052109->set_rmrd_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE); | |
| 290 | 290 | |
| 291 | 291 | /* bit 3 = disable video */ |
| 292 | 292 | m_video_enable = ~(data & 0x08); |
| r24078 | r24079 | |
| 345 | 345 | |
| 346 | 346 | READ8_MEMBER(spy_state::k052109_051960_r) |
| 347 | 347 | { |
| 348 | if (k052109 | |
| 348 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 349 | 349 | { |
| 350 | 350 | if (offset >= 0x3800 && offset < 0x3808) |
| 351 | return k0519 | |
| 351 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 352 | 352 | else if (offset < 0x3c00) |
| 353 | return | |
| 353 | return m_k052109->read(space, offset); | |
| 354 | 354 | else |
| 355 | return k051960 | |
| 355 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | return | |
| 358 | return m_k052109->read(space, offset); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | WRITE8_MEMBER(spy_state::k052109_051960_w) |
| 362 | 362 | { |
| 363 | 363 | if (offset >= 0x3800 && offset < 0x3808) |
| 364 | k0519 | |
| 364 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 365 | 365 | else if (offset < 0x3c00) |
| 366 | | |
| 366 | m_k052109->write(space, offset, data); | |
| 367 | 367 | else |
| 368 | k051960 | |
| 368 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | static ADDRESS_MAP_START( spy_map, AS_PROGRAM, 8, spy_state ) |
| r24078 | r24079 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | INTERRUPT_GEN_MEMBER(crimfght_state::crimfght_interrupt) |
| 26 | 26 | { |
| 27 | if (k051960_is_irq_enabled( | |
| 27 | if (m_k051960->k051960_is_irq_enabled()) | |
| 28 | 28 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 29 | 29 | } |
| 30 | 30 | |
| r24078 | r24079 | |
| 53 | 53 | |
| 54 | 54 | READ8_MEMBER(crimfght_state::k052109_051960_r) |
| 55 | 55 | { |
| 56 | if (k052109 | |
| 56 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 57 | 57 | { |
| 58 | 58 | if (offset >= 0x3800 && offset < 0x3808) |
| 59 | return k0519 | |
| 59 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 60 | 60 | else if (offset < 0x3c00) |
| 61 | return | |
| 61 | return m_k052109->read(space, offset); | |
| 62 | 62 | else |
| 63 | return k051960 | |
| 63 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 64 | 64 | } |
| 65 | 65 | else |
| 66 | return | |
| 66 | return m_k052109->read(space, offset); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | WRITE8_MEMBER(crimfght_state::k052109_051960_w) |
| 70 | 70 | { |
| 71 | 71 | if (offset >= 0x3800 && offset < 0x3808) |
| 72 | k0519 | |
| 72 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 73 | 73 | else if (offset < 0x3c00) |
| 74 | | |
| 74 | m_k052109->write(space, offset, data); | |
| 75 | 75 | else |
| 76 | k051960 | |
| 76 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /********************************************/ |
| r24078 | r24079 | |
| 399 | 399 | device->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); /* RAM */ |
| 400 | 400 | |
| 401 | 401 | /* bit 6 = enable char ROM reading through the video RAM */ |
| 402 | k052109 | |
| 402 | state->m_k052109->set_rmrd_line((lines & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 403 | 403 | |
| 404 | 404 | state->membank("bank2")->set_entry(lines & 0x0f); |
| 405 | 405 | } |
| r24078 | r24079 | |
|---|---|---|
| 19 | 19 | INTERRUPT_GEN_MEMBER(labyrunr_state::labyrunr_vblank_interrupt) |
| 20 | 20 | { |
| 21 | 21 | address_space &space = generic_space(); |
| 22 | if (k007121 | |
| 22 | if (m_k007121->ctrlram_r(space, 7) & 0x02) | |
| 23 | 23 | device.execute().set_input_line(HD6309_IRQ_LINE, HOLD_LINE); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | INTERRUPT_GEN_MEMBER(labyrunr_state::labyrunr_timer_interrupt) |
| 27 | 27 | { |
| 28 | 28 | address_space &space = generic_space(); |
| 29 | if (k007121 | |
| 29 | if (m_k007121->ctrlram_r(space, 7) & 0x01) | |
| 30 | 30 | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 31 | 31 | } |
| 32 | 32 | |
| r24078 | r24079 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static ADDRESS_MAP_START( labyrunr_map, AS_PROGRAM, 8, labyrunr_state ) |
| 47 | AM_RANGE(0x0000, 0x0007) AM_DEVWRITE | |
| 47 | AM_RANGE(0x0000, 0x0007) AM_DEVWRITE("k007121", k007121_device, ctrl_w) | |
| 48 | 48 | AM_RANGE(0x0020, 0x005f) AM_RAM AM_SHARE("scrollram") |
| 49 | 49 | AM_RANGE(0x0800, 0x0800) AM_DEVREADWRITE("ym1", ym2203_device, read_port_r, write_port_w) |
| 50 | 50 | AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("ym1", ym2203_device, status_port_r, control_port_w) |
| r24078 | r24079 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | INTERRUPT_GEN_MEMBER(surpratk_state::surpratk_interrupt) |
| 22 | 22 | { |
| 23 | if (k052109 | |
| 23 | if (m_k052109->is_irq_enabled()) | |
| 24 | 24 | device.execute().set_input_line(0, HOLD_LINE); |
| 25 | 25 | } |
| 26 | 26 | |
| r24078 | r24079 | |
| 34 | 34 | return m_generic_paletteram_8[offset]; |
| 35 | 35 | } |
| 36 | 36 | else if (m_videobank & 0x01) |
| 37 | return k05324 | |
| 37 | return m_k053244->k053245_r(space, offset); | |
| 38 | 38 | else |
| 39 | 39 | return m_ram[offset]; |
| 40 | 40 | } |
| r24078 | r24079 | |
| 49 | 49 | paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space,offset,data); |
| 50 | 50 | } |
| 51 | 51 | else if (m_videobank & 0x01) |
| 52 | k05324 | |
| 52 | m_k053244->k053245_w(space, offset, data); | |
| 53 | 53 | else |
| 54 | 54 | m_ram[offset] = data; |
| 55 | 55 | } |
| r24078 | r24079 | |
| 73 | 73 | coin_counter_w(machine(), 1, data & 0x02); |
| 74 | 74 | |
| 75 | 75 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 76 | k052109 | |
| 76 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 77 | 77 | |
| 78 | 78 | /* other bits unknown */ |
| 79 | 79 | } |
| r24078 | r24079 | |
| 90 | 90 | AM_RANGE(0x5f8e, 0x5f8e) AM_READ_PORT("DSW3") |
| 91 | 91 | AM_RANGE(0x5f8f, 0x5f8f) AM_READ_PORT("DSW1") |
| 92 | 92 | AM_RANGE(0x5f90, 0x5f90) AM_READ_PORT("DSW2") |
| 93 | AM_RANGE(0x5fa0, 0x5faf) AM_DEVREADWRITE | |
| 93 | AM_RANGE(0x5fa0, 0x5faf) AM_DEVREADWRITE("k053244", k05324x_device, k053244_r, k053244_w) | |
| 94 | 94 | AM_RANGE(0x5fb0, 0x5fbf) AM_DEVWRITE_LEGACY("k053251", k053251_w) |
| 95 | 95 | AM_RANGE(0x5fc0, 0x5fc0) AM_READ(watchdog_reset_r) AM_WRITE(surpratk_5fc0_w) |
| 96 | 96 | AM_RANGE(0x5fd0, 0x5fd1) AM_DEVWRITE("ymsnd", ym2151_device, write) |
| 97 | 97 | AM_RANGE(0x5fc4, 0x5fc4) AM_WRITE(surpratk_videobank_w) |
| 98 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE | |
| 98 | AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("k052109", k052109_device, read, write) | |
| 99 | 99 | AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ |
| 100 | 100 | ADDRESS_MAP_END |
| 101 | 101 |
| r24078 | r24079 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | INTERRUPT_GEN_MEMBER(blockhl_state::blockhl_interrupt) |
| 34 | 34 | { |
| 35 | if (k052109 | |
| 35 | if (m_k052109->is_irq_enabled() && m_rombank == 0) /* kludge to prevent crashes */ | |
| 36 | 36 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 37 | 37 | } |
| 38 | 38 | |
| r24078 | r24079 | |
| 61 | 61 | /* special handlers to combine 052109 & 051960 */ |
| 62 | 62 | READ8_MEMBER(blockhl_state::k052109_051960_r) |
| 63 | 63 | { |
| 64 | if (k052109 | |
| 64 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 65 | 65 | { |
| 66 | 66 | if (offset >= 0x3800 && offset < 0x3808) |
| 67 | return k0519 | |
| 67 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 68 | 68 | else if (offset < 0x3c00) |
| 69 | return | |
| 69 | return m_k052109->read(space, offset); | |
| 70 | 70 | else |
| 71 | return k051960 | |
| 71 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 72 | 72 | } |
| 73 | 73 | else |
| 74 | return | |
| 74 | return m_k052109->read(space, offset); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | WRITE8_MEMBER(blockhl_state::k052109_051960_w) |
| 78 | 78 | { |
| 79 | 79 | if (offset >= 0x3800 && offset < 0x3808) |
| 80 | k0519 | |
| 80 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 81 | 81 | else if (offset < 0x3c00) |
| 82 | | |
| 82 | m_k052109->write(space, offset, data); | |
| 83 | 83 | else |
| 84 | k051960 | |
| 84 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| r24078 | r24079 | |
| 311 | 311 | state->m_palette_selected = ~lines & 0x20; |
| 312 | 312 | |
| 313 | 313 | /* bit 6 = enable char ROM reading through the video RAM */ |
| 314 | k052109 | |
| 314 | state->m_k052109->set_rmrd_line((lines & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 315 | 315 | |
| 316 | 316 | /* bit 7 used but unknown */ |
| 317 | 317 |
| r24078 | r24079 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | INTERRUPT_GEN_MEMBER(bottom9_state::bottom9_interrupt) |
| 23 | 23 | { |
| 24 | if (k052109 | |
| 24 | if (m_k052109->is_irq_enabled()) | |
| 25 | 25 | device.execute().set_input_line(0, HOLD_LINE); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | READ8_MEMBER(bottom9_state::k052109_051960_r) |
| 29 | 29 | { |
| 30 | if (k052109 | |
| 30 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 31 | 31 | { |
| 32 | 32 | if (offset >= 0x3800 && offset < 0x3808) |
| 33 | return k0519 | |
| 33 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 34 | 34 | else if (offset < 0x3c00) |
| 35 | return | |
| 35 | return m_k052109->read(space, offset); | |
| 36 | 36 | else |
| 37 | return k051960 | |
| 37 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 38 | 38 | } |
| 39 | 39 | else |
| 40 | return | |
| 40 | return m_k052109->read(space, offset); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | WRITE8_MEMBER(bottom9_state::k052109_051960_w) |
| 44 | 44 | { |
| 45 | 45 | if (offset >= 0x3800 && offset < 0x3808) |
| 46 | k0519 | |
| 46 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 47 | 47 | else if (offset < 0x3c00) |
| 48 | | |
| 48 | m_k052109->write(space, offset, data); | |
| 49 | 49 | else |
| 50 | k051960 | |
| 50 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | READ8_MEMBER(bottom9_state::bottom9_bankedram1_r) |
| r24078 | r24079 | |
| 111 | 111 | coin_counter_w(machine(), 1, data & 0x02); |
| 112 | 112 | |
| 113 | 113 | /* bit 2 = enable char ROM reading through the video RAM */ |
| 114 | k052109 | |
| 114 | m_k052109->set_rmrd_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE); | |
| 115 | 115 | |
| 116 | 116 | /* bit 3 = disable video */ |
| 117 | 117 | m_video_enable = ~data & 0x08; |
| r24078 | r24079 | |
|---|---|---|
| 263 | 263 | case 0x4d: |
| 264 | 264 | case 0x4e: |
| 265 | 265 | case 0x4f: |
| 266 | return k053244 | |
| 266 | return m_k053244->k053244_r(space, offset - 0x40); | |
| 267 | 267 | |
| 268 | 268 | case 0x80: |
| 269 | 269 | case 0x81: |
| r24078 | r24079 | |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | else if (offset < 0x1800) |
| 307 | return k05324 | |
| 307 | return m_k053244->k053245_r(space, (offset - 0x0800) & 0x07ff); | |
| 308 | 308 | else if (offset < 0x2000) |
| 309 | 309 | return k056832_ram_code_lo_r(m_k056832, space, offset - 0x1800); |
| 310 | 310 | else if (offset < 0x2800) |
| r24078 | r24079 | |
| 354 | 354 | case 0x4d: |
| 355 | 355 | case 0x4e: |
| 356 | 356 | case 0x4f: |
| 357 | k053244 | |
| 357 | m_k053244->k053244_w(space, offset - 0x40, data); | |
| 358 | 358 | break; |
| 359 | 359 | |
| 360 | 360 | case 0x80: |
| r24078 | r24079 | |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | else if (offset < 0x1800) |
| 401 | k05324 | |
| 401 | m_k053244->k053245_w(space, (offset - 0x0800) & 0x07ff, data); | |
| 402 | 402 | else if (offset < 0x2000) |
| 403 | 403 | k056832_ram_code_lo_w(m_k056832, space, offset - 0x1800, data); |
| 404 | 404 | else if (offset < 0x2800) |
| r24078 | r24079 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | INTERRUPT_GEN_MEMBER(gbusters_state::gbusters_interrupt) |
| 22 | 22 | { |
| 23 | if (k052109 | |
| 23 | if (m_k052109->is_irq_enabled()) | |
| 24 | 24 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 25 | 25 | } |
| 26 | 26 | |
| r24078 | r24079 | |
| 43 | 43 | WRITE8_MEMBER(gbusters_state::gbusters_1f98_w) |
| 44 | 44 | { |
| 45 | 45 | /* bit 0 = enable char ROM reading through the video RAM */ |
| 46 | k052109 | |
| 46 | m_k052109->set_rmrd_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); | |
| 47 | 47 | |
| 48 | 48 | /* bit 7 used (during gfx rom tests), but unknown */ |
| 49 | 49 | |
| r24078 | r24079 | |
| 115 | 115 | /* special handlers to combine 052109 & 051960 */ |
| 116 | 116 | READ8_MEMBER(gbusters_state::k052109_051960_r) |
| 117 | 117 | { |
| 118 | if (k052109 | |
| 118 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 119 | 119 | { |
| 120 | 120 | if (offset >= 0x3800 && offset < 0x3808) |
| 121 | return k0519 | |
| 121 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 122 | 122 | else if (offset < 0x3c00) |
| 123 | return | |
| 123 | return m_k052109->read(space, offset); | |
| 124 | 124 | else |
| 125 | return k051960 | |
| 125 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 126 | 126 | } |
| 127 | 127 | else |
| 128 | return | |
| 128 | return m_k052109->read(space, offset); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | WRITE8_MEMBER(gbusters_state::k052109_051960_w) |
| 132 | 132 | { |
| 133 | 133 | if (offset >= 0x3800 && offset < 0x3808) |
| 134 | k0519 | |
| 134 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 135 | 135 | else if (offset < 0x3c00) |
| 136 | | |
| 136 | m_k052109->write(space, offset, data); | |
| 137 | 137 | else |
| 138 | k051960 | |
| 138 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 |
| r24078 | r24079 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | INTERRUPT_GEN_MEMBER(thunderx_state::scontra_interrupt) |
| 28 | 28 | { |
| 29 | if (k052109 | |
| 29 | if (m_k052109->is_irq_enabled()) | |
| 30 | 30 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 31 | 31 | } |
| 32 | 32 | |
| r24078 | r24079 | |
| 296 | 296 | // logerror("%04x: 1f98_w %02x\n", space.device().safe_pc(),data); |
| 297 | 297 | |
| 298 | 298 | /* bit 0 = enable char ROM reading through the video RAM */ |
| 299 | k052109 | |
| 299 | m_k052109->set_rmrd_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); | |
| 300 | 300 | |
| 301 | 301 | /* bit 1 = PMC-BK */ |
| 302 | 302 | m_pmcbank = (data & 0x02) >> 1; |
| r24078 | r24079 | |
| 368 | 368 | |
| 369 | 369 | READ8_MEMBER(thunderx_state::k052109_051960_r) |
| 370 | 370 | { |
| 371 | if (k052109 | |
| 371 | if (m_k052109->get_rmrd_line() == CLEAR_LINE) | |
| 372 | 372 | { |
| 373 | 373 | if (offset >= 0x3800 && offset < 0x3808) |
| 374 | return k0519 | |
| 374 | return m_k051960->k051937_r(space, offset - 0x3800); | |
| 375 | 375 | else if (offset < 0x3c00) |
| 376 | return | |
| 376 | return m_k052109->read(space, offset); | |
| 377 | 377 | else |
| 378 | return k051960 | |
| 378 | return m_k051960->k051960_r(space, offset - 0x3c00); | |
| 379 | 379 | } |
| 380 | 380 | else |
| 381 | return | |
| 381 | return m_k052109->read(space, offset); | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | WRITE8_MEMBER(thunderx_state::k052109_051960_w) |
| 385 | 385 | { |
| 386 | 386 | if (offset >= 0x3800 && offset < 0x3808) |
| 387 | k0519 | |
| 387 | m_k051960->k051937_w(space, offset - 0x3800, data); | |
| 388 | 388 | else if (offset < 0x3c00) |
| 389 | | |
| 389 | m_k052109->write(space, offset, data); | |
| 390 | 390 | else |
| 391 | k051960 | |
| 391 | m_k051960->k051960_w(space, offset - 0x3c00, data); | |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /***************************************************************************/ |
| r24078 | r24079 | |
|---|---|---|
| 37 | 37 | coin_counter_w(machine(), 1, data & 0x02); |
| 38 | 38 | /* bit 2 selects mono or stereo sound */ |
| 39 | 39 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 40 | k052109 | |
| 40 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 41 | 41 | /* bit 4 = INIT (unknown) */ |
| 42 | 42 | /* bit 5 = enable sprite ROM reading */ |
| 43 | 43 | k053246_set_objcha_line(m_k053246, (~data & 0x20) ? ASSERT_LINE : CLEAR_LINE); |
| r24078 | r24079 | |
|---|---|---|
| 180 | 180 | WRITE8_MEMBER(ajax_state::ajax_bankswitch_2_w) |
| 181 | 181 | { |
| 182 | 182 | /* enable char ROM reading through the video RAM */ |
| 183 | k052109 | |
| 183 | m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); | |
| 184 | 184 | |
| 185 | 185 | /* bit 5 enables 051316 wraparound */ |
| 186 | 186 | k051316_wraparound_enable(m_k051316, data & 0x20); |
| r24078 | r24079 | |
| 215 | 215 | |
| 216 | 216 | INTERRUPT_GEN_MEMBER(ajax_state::ajax_interrupt) |
| 217 | 217 | { |
| 218 | if (k051960_is_irq_enabled( | |
| 218 | if (m_k051960->k051960_is_irq_enabled()) | |
| 219 | 219 | device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); |
| 220 | 220 | } |
| r24078 | r24079 | |
|---|---|---|
| 1 | 1 | #include "emu.h" |
| 2 | #include "video/konicdev.h" | |
| 3 | 2 | #include "includes/bladestl.h" |
| 4 | 3 | |
| 5 | 4 | |
| r24078 | r24079 | |
| 81 | 80 | { |
| 82 | 81 | set_pens(machine()); |
| 83 | 82 | |
| 84 | k007342 | |
| 83 | m_k007342->tilemap_update(); | |
| 85 | 84 | |
| 86 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE ,0); | |
| 87 | k007420_sprites_draw(m_k007420, bitmap, cliprect, machine().gfx[1]); | |
| 88 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 1, 1 | TILEMAP_DRAW_OPAQUE ,0); | |
| 89 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, 0 ,0); | |
| 90 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, 1 ,0); | |
| 85 | m_k007342->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE ,0); | |
| 86 | m_k007420->sprites_draw(bitmap, cliprect, machine().gfx[1]); | |
| 87 | m_k007342->tilemap_draw(bitmap, cliprect, 1, 1 | TILEMAP_DRAW_OPAQUE ,0); | |
| 88 | m_k007342->tilemap_draw(bitmap, cliprect, 0, 0 ,0); | |
| 89 | m_k007342->tilemap_draw(bitmap, cliprect, 0, 1 ,0); | |
| 91 | 90 | return 0; |
| 92 | 91 | } |
| r24078 | r24079 | |
|---|---|---|
| 67 | 67 | |
| 68 | 68 | UINT32 thunderx_state::screen_update_scontra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 69 | 69 | { |
| 70 | k052109 | |
| 70 | m_k052109->tilemap_update(); | |
| 71 | 71 | |
| 72 | 72 | machine().priority_bitmap.fill(0, cliprect); |
| 73 | 73 | |
| r24078 | r24079 | |
| 75 | 75 | // bitmap.fill(16 * m_layer_colorbase[1], cliprect); |
| 76 | 76 | if (m_priority) |
| 77 | 77 | { |
| 78 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 1); | |
| 79 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 2); | |
| 78 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 1); | |
| 79 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 2); | |
| 80 | 80 | } |
| 81 | 81 | else |
| 82 | 82 | { |
| 83 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 84 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 2); | |
| 83 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 84 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 2); | |
| 85 | 85 | } |
| 86 | k052109 | |
| 86 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 4); | |
| 87 | 87 | |
| 88 | k051960_sprites_draw( | |
| 88 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 89 | 89 | return 0; |
| 90 | 90 | } |
| r24078 | r24079 | |
|---|---|---|
| 77 | 77 | m_layer_colorbase[2] = 48; |
| 78 | 78 | m_sprite_colorbase = 16; |
| 79 | 79 | |
| 80 | k052109_set_layer_offsets(m_k052109, 2, -2, 0); | |
| 81 | k051960_set_sprite_offsets(m_k051960, 2, 0); | |
| 80 | m_k052109->set_layer_offsets(2, -2, 0); | |
| 81 | m_k051960->k051960_set_sprite_offsets(2, 0); | |
| 82 | 82 | |
| 83 | 83 | /* re-decode the sprites because the ROMs are connected to the custom IC differently |
| 84 | 84 | from how they are connected to the CPU. */ |
| r24078 | r24079 | |
| 125 | 125 | { |
| 126 | 126 | /* TODO: this kludge enforces the char banks. For some reason, they don't work otherwise. */ |
| 127 | 127 | address_space &space = machine().driver_data()->generic_space(); |
| 128 | k052109_w(m_k052109, space, 0x1d80, 0x10); | |
| 129 | k052109_w(m_k052109, space, 0x1f00, 0x32); | |
| 128 | m_k052109->write(space, 0x1d80, 0x10); | |
| 129 | m_k052109->write(space, 0x1f00, 0x32); | |
| 130 | 130 | |
| 131 | k052109 | |
| 131 | m_k052109->tilemap_update(); | |
| 132 | 132 | |
| 133 | 133 | machine().priority_bitmap.fill(0, cliprect); |
| 134 | 134 | if (m_priority == 0) |
| 135 | 135 | { |
| 136 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 2); | |
| 137 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 4); | |
| 138 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 1); | |
| 136 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 2); | |
| 137 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 4); | |
| 138 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 1); | |
| 139 | 139 | } |
| 140 | 140 | else |
| 141 | 141 | { |
| 142 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 1); | |
| 143 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 2); | |
| 144 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 4); | |
| 142 | m_k052109->tilemap_draw(bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 1); | |
| 143 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 2); | |
| 144 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 4); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | k051960_sprites_draw( | |
| 147 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 148 | 148 | return 0; |
| 149 | 149 | } |
| r24078 | r24079 | |
|---|---|---|
| 1332 | 1332 | /* */ |
| 1333 | 1333 | /***************************************************************************/ |
| 1334 | 1334 | |
| 1335 | struct k007121_state | |
| 1335 | ||
| 1336 | const device_type K007121 = &device_creator<k007121_device>; | |
| 1337 | ||
| 1338 | k007121_device::k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1339 | : device_t(mconfig, K007121, "Konami 007121", tag, owner, clock, "k007121", __FILE__), | |
| 1340 | m_flipscreen(0) | |
| 1336 | 1341 | { |
| 1337 | UINT8 ctrlram[8]; | |
| 1338 | int flipscreen; | |
| 1339 | }; | |
| 1342 | } | |
| 1340 | 1343 | |
| 1341 | /***************************************************************************** | |
| 1342 | INLINE FUNCTIONS | |
| 1343 | *****************************************************************************/ | |
| 1344 | //------------------------------------------------- | |
| 1345 | // device_config_complete - perform any | |
| 1346 | // operations now that the configuration is | |
| 1347 | // complete | |
| 1348 | //------------------------------------------------- | |
| 1344 | 1349 | |
| 1345 | ||
| 1350 | void k007121_device::device_config_complete() | |
| 1346 | 1351 | { |
| 1347 | assert(device != NULL); | |
| 1348 | assert(device->type() == K007121); | |
| 1352 | } | |
| 1349 | 1353 | |
| 1350 | return (k007121_state *)downcast<k007121_device *>(device)->token(); | |
| 1354 | //------------------------------------------------- | |
| 1355 | // device_start - device-specific startup | |
| 1356 | //------------------------------------------------- | |
| 1357 | ||
| 1358 | void k007121_device::device_start() | |
| 1359 | { | |
| 1360 | save_item(NAME(m_ctrlram)); | |
| 1361 | save_item(NAME(m_flipscreen)); | |
| 1351 | 1362 | } |
| 1352 | 1363 | |
| 1364 | //------------------------------------------------- | |
| 1365 | // device_reset - device-specific reset | |
| 1366 | //------------------------------------------------- | |
| 1367 | ||
| 1368 | void k007121_device::device_reset() | |
| 1369 | { | |
| 1370 | int i; | |
| 1371 | ||
| 1372 | m_flipscreen = 0; | |
| 1373 | ||
| 1374 | for (i = 0; i < 8; i++) | |
| 1375 | m_ctrlram[i] = 0; | |
| 1376 | } | |
| 1377 | ||
| 1378 | ||
| 1353 | 1379 | /***************************************************************************** |
| 1354 | 1380 | DEVICE HANDLERS |
| 1355 | 1381 | *****************************************************************************/ |
| 1356 | 1382 | |
| 1357 | READ8_ | |
| 1383 | READ8_MEMBER( k007121_device::ctrlram_r ) | |
| 1358 | 1384 | { |
| 1359 | k007121_state *k007121 = k007121_get_safe_token(device); | |
| 1360 | ||
| 1361 | 1385 | assert(offset < 8); |
| 1362 | 1386 | |
| 1363 | return | |
| 1387 | return m_ctrlram[offset]; | |
| 1364 | 1388 | } |
| 1365 | 1389 | |
| 1366 | 1390 | |
| 1367 | WRITE8_ | |
| 1391 | WRITE8_MEMBER( k007121_device::ctrl_w ) | |
| 1368 | 1392 | { |
| 1369 | k007121_state *k007121 = k007121_get_safe_token(device); | |
| 1370 | ||
| 1371 | 1393 | assert(offset < 8); |
| 1372 | 1394 | |
| 1373 | 1395 | switch (offset) |
| 1374 | 1396 | { |
| 1375 | 1397 | case 6: |
| 1376 | 1398 | /* palette bank change */ |
| 1377 | if (( | |
| 1399 | if ((m_ctrlram[offset] & 0x30) != (data & 0x30)) | |
| 1378 | 1400 | space.machine().tilemap().mark_all_dirty(); |
| 1379 | 1401 | break; |
| 1380 | 1402 | case 7: |
| 1381 | | |
| 1403 | m_flipscreen = data & 0x08; | |
| 1382 | 1404 | break; |
| 1383 | 1405 | } |
| 1384 | 1406 | |
| 1385 | | |
| 1407 | m_ctrlram[offset] = data; | |
| 1386 | 1408 | } |
| 1387 | 1409 | |
| 1388 | 1410 | /* |
| r24078 | r24079 | |
| 1420 | 1442 | * |
| 1421 | 1443 | */ |
| 1422 | 1444 | |
| 1423 | void k007121_sprites_draw( | |
| 1445 | void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable, | |
| 1424 | 1446 | const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask ) |
| 1425 | 1447 | { |
| 1426 | k007121_state *k007121 = k007121_get_safe_token(device); | |
| 1427 | // gfx_element *gfx = gfxs[chip]; | |
| 1448 | // gfx_element *gfx = gfxs[chip]; | |
| 1428 | 1449 | bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap; |
| 1429 | int flipscreen = | |
| 1450 | int flipscreen = m_flipscreen; | |
| 1430 | 1451 | int i, num, inc, offs[5]; |
| 1431 | 1452 | int is_flakatck = (ctable == NULL); |
| 1432 | 1453 | |
| r24078 | r24079 | |
| 1552 | 1573 | } |
| 1553 | 1574 | } |
| 1554 | 1575 | |
| 1555 | /***************************************************************************** | |
| 1556 | DEVICE INTERFACE | |
| 1557 | *****************************************************************************/ | |
| 1576 | /***************************************************************************/ | |
| 1577 | /* */ | |
| 1578 | /* 007342 */ | |
| 1579 | /* */ | |
| 1580 | /***************************************************************************/ | |
| 1558 | 1581 | |
| 1559 | static DEVICE_START( k007121 ) | |
| 1560 | { | |
| 1561 | k007121_state *k007121 = k007121_get_safe_token(device); | |
| 1582 | const device_type K007342 = &device_creator<k007342_device>; | |
| 1562 | 1583 | |
| 1563 | device->save_item(NAME(k007121->ctrlram)); | |
| 1564 | device->save_item(NAME(k007121->flipscreen)); | |
| 1565 | } | |
| 1566 | ||
| 1567 | static DEVICE_RESET( k007121 ) | |
| 1584 | k007342_device::k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1585 | : device_t(mconfig, K007342, "Konami 007342", tag, owner, clock, "k007342", __FILE__), | |
| 1586 | m_ram(NULL), | |
| 1587 | m_scroll_ram(NULL), | |
| 1588 | m_videoram_0(NULL), | |
| 1589 | m_videoram_1(NULL), | |
| 1590 | m_colorram_0(NULL), | |
| 1591 | m_colorram_1(NULL), | |
| 1592 | //m_tilemap[2]; | |
| 1593 | m_flipscreen(0), | |
| 1594 | m_int_enabled(0) | |
| 1595 | //m_regs[8], | |
| 1596 | //m_scrollx[2], | |
| 1597 | //m_scrolly[2] | |
| 1568 | 1598 | { |
| 1569 | k007121_state *k007121 = k007121_get_safe_token(device); | |
| 1570 | int i; | |
| 1571 | ||
| 1572 | k007121->flipscreen = 0; | |
| 1573 | ||
| 1574 | for (i = 0; i < 8; i++) | |
| 1575 | k007121->ctrlram[i] = 0; | |
| 1576 | 1599 | } |
| 1577 | 1600 | |
| 1578 | const device_type K007121 = &device_creator<k007121_device>; | |
| 1579 | ||
| 1580 | k007121_device::k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1581 | : device_t(mconfig, K007121, "Konami 007121", tag, owner, clock, "k007121", __FILE__) | |
| 1582 | { | |
| 1583 | m_token = global_alloc_clear(k007121_state); | |
| 1584 | } | |
| 1585 | ||
| 1586 | 1601 | //------------------------------------------------- |
| 1587 | 1602 | // device_config_complete - perform any |
| 1588 | 1603 | // operations now that the configuration is |
| 1589 | 1604 | // complete |
| 1590 | 1605 | //------------------------------------------------- |
| 1591 | 1606 | |
| 1592 | void k007 | |
| 1607 | void k007342_device::device_config_complete() | |
| 1593 | 1608 | { |
| 1609 | // inherit a copy of the static data | |
| 1610 | const k007342_interface *intf = reinterpret_cast<const k007342_interface *>(static_config()); | |
| 1611 | if (intf != NULL) | |
| 1612 | *static_cast<k007342_interface *>(this) = *intf; | |
| 1613 | ||
| 1614 | // or initialize to defaults if none provided | |
| 1615 | else | |
| 1616 | { | |
| 1617 | m_gfxnum = 0; | |
| 1618 | m_callback = NULL; | |
| 1619 | } | |
| 1594 | 1620 | } |
| 1595 | 1621 | |
| 1596 | 1622 | //------------------------------------------------- |
| 1597 | 1623 | // device_start - device-specific startup |
| 1598 | 1624 | //------------------------------------------------- |
| 1599 | 1625 | |
| 1600 | void k007 | |
| 1626 | void k007342_device::device_start() | |
| 1601 | 1627 | { |
| 1602 | DEVICE_START_NAME( k007121 )(this); | |
| 1628 | m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info0),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32); | |
| 1629 | m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info1),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32); | |
| 1630 | ||
| 1631 | m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); | |
| 1632 | m_scroll_ram = auto_alloc_array_clear(machine(), UINT8, 0x0200); | |
| 1633 | ||
| 1634 | m_colorram_0 = &m_ram[0x0000]; | |
| 1635 | m_colorram_1 = &m_ram[0x1000]; | |
| 1636 | m_videoram_0 = &m_ram[0x0800]; | |
| 1637 | m_videoram_1 = &m_ram[0x1800]; | |
| 1638 | ||
| 1639 | m_tilemap[0]->set_transparent_pen(0); | |
| 1640 | m_tilemap[1]->set_transparent_pen(0); | |
| 1641 | ||
| 1642 | save_pointer(NAME(m_ram), 0x2000); | |
| 1643 | save_pointer(NAME(m_scroll_ram), 0x0200); | |
| 1644 | save_item(NAME(m_int_enabled)); | |
| 1645 | save_item(NAME(m_flipscreen)); | |
| 1646 | save_item(NAME(m_scrollx)); | |
| 1647 | save_item(NAME(m_scrolly)); | |
| 1648 | save_item(NAME(m_regs)); | |
| 1603 | 1649 | } |
| 1604 | 1650 | |
| 1605 | 1651 | //------------------------------------------------- |
| 1606 | 1652 | // device_reset - device-specific reset |
| 1607 | 1653 | //------------------------------------------------- |
| 1608 | 1654 | |
| 1609 | void k007 | |
| 1655 | void k007342_device::device_reset() | |
| 1610 | 1656 | { |
| 1611 | DEVICE_RESET_NAME( k007121 )(this); | |
| 1612 | } | |
| 1657 | int i; | |
| 1613 | 1658 | |
| 1614 | /***************************************************************************/ | |
| 1615 | /* */ | |
| 1616 | /* 007342 */ | |
| 1617 | /* */ | |
| 1618 | /***************************************************************************/ | |
| 1659 | m_int_enabled = 0; | |
| 1660 | m_flipscreen = 0; | |
| 1661 | m_scrollx[0] = 0; | |
| 1662 | m_scrollx[1] = 0; | |
| 1663 | m_scrolly[0] = 0; | |
| 1664 | m_scrolly[1] = 0; | |
| 1619 | 1665 | |
| 1620 | struct k007342_state | |
| 1621 | { | |
| 1622 | UINT8 *ram; | |
| 1623 | UINT8 *scroll_ram; | |
| 1624 | UINT8 *videoram_0; | |
| 1625 | UINT8 *videoram_1; | |
| 1626 | UINT8 *colorram_0; | |
| 1627 | UINT8 *colorram_1; | |
| 1628 | ||
| 1629 | tilemap_t *tilemap[2]; | |
| 1630 | int flipscreen, gfxnum, int_enabled; | |
| 1631 | UINT8 regs[8]; | |
| 1632 | UINT16 scrollx[2]; | |
| 1633 | UINT8 scrolly[2]; | |
| 1634 | ||
| 1635 | k007342_callback callback; | |
| 1636 | }; | |
| 1637 | ||
| 1638 | /***************************************************************************** | |
| 1639 | INLINE FUNCTIONS | |
| 1640 | *****************************************************************************/ | |
| 1641 | ||
| 1642 | INLINE k007342_state *k007342_get_safe_token( device_t *device ) | |
| 1643 | { | |
| 1644 | assert(device != NULL); | |
| 1645 | assert(device->type() == K007342); | |
| 1646 | ||
| 1647 | return (k007342_state *)downcast<k007342_device *>(device)->token(); | |
| 1666 | for (i = 0; i < 8; i++) | |
| 1667 | m_regs[i] = 0; | |
| 1648 | 1668 | } |
| 1649 | 1669 | |
| 1650 | INLINE const k007342_interface *k007342_get_interface( device_t *device ) | |
| 1651 | { | |
| 1652 | assert(device != NULL); | |
| 1653 | assert((device->type() == K007342)); | |
| 1654 | return (const k007342_interface *) device->static_config(); | |
| 1655 | } | |
| 1656 | ||
| 1657 | 1670 | /***************************************************************************** |
| 1658 | 1671 | DEVICE HANDLERS |
| 1659 | 1672 | *****************************************************************************/ |
| 1660 | 1673 | |
| 1661 | READ8_ | |
| 1674 | READ8_MEMBER( k007342_device::read ) | |
| 1662 | 1675 | { |
| 1663 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1664 | return k007342->ram[offset]; | |
| 1676 | return m_ram[offset]; | |
| 1665 | 1677 | } |
| 1666 | 1678 | |
| 1667 | WRITE8_ | |
| 1679 | WRITE8_MEMBER( k007342_device::write ) | |
| 1668 | 1680 | { |
| 1669 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1670 | k007342->ram[offset] = data; | |
| 1681 | m_ram[offset] = data; | |
| 1671 | 1682 | |
| 1672 | 1683 | if (offset < 0x1000) /* layer 0 */ |
| 1673 | | |
| 1684 | m_tilemap[0]->mark_tile_dirty(offset & 0x7ff); | |
| 1674 | 1685 | else /* layer 1 */ |
| 1675 | | |
| 1686 | m_tilemap[1]->mark_tile_dirty(offset & 0x7ff); | |
| 1676 | 1687 | } |
| 1677 | 1688 | |
| 1678 | READ8_ | |
| 1689 | READ8_MEMBER( k007342_device::scroll_r ) | |
| 1679 | 1690 | { |
| 1680 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1681 | return k007342->scroll_ram[offset]; | |
| 1691 | return m_scroll_ram[offset]; | |
| 1682 | 1692 | } |
| 1683 | 1693 | |
| 1684 | WRITE8_ | |
| 1694 | WRITE8_MEMBER( k007342_device::scroll_w ) | |
| 1685 | 1695 | { |
| 1686 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1687 | k007342->scroll_ram[offset] = data; | |
| 1696 | m_scroll_ram[offset] = data; | |
| 1688 | 1697 | } |
| 1689 | 1698 | |
| 1690 | WRITE8_ | |
| 1699 | WRITE8_MEMBER( k007342_device::vreg_w ) | |
| 1691 | 1700 | { |
| 1692 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1693 | 1701 | switch(offset) |
| 1694 | 1702 | { |
| 1695 | 1703 | case 0x00: |
| 1696 | 1704 | /* bit 1: INT control */ |
| 1697 | k007342->int_enabled = data & 0x02; | |
| 1698 | k007342->flipscreen = data & 0x10; | |
| 1699 | k007342->tilemap[0]->set_flip(k007342->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 1700 | k007342->tilemap[1]->set_flip(k007342->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 1705 | m_int_enabled = data & 0x02; | |
| 1706 | m_flipscreen = data & 0x10; | |
| 1707 | m_tilemap[0]->set_flip(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 1708 | m_tilemap[1]->set_flip(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 1701 | 1709 | break; |
| 1702 | 1710 | case 0x01: /* used for banking in Rock'n'Rage */ |
| 1703 | if (data != | |
| 1711 | if (data != m_regs[1]) | |
| 1704 | 1712 | space.machine().tilemap().mark_all_dirty(); |
| 1705 | 1713 | case 0x02: |
| 1706 | k007342->scrollx[0] = (k007342->scrollx[0] & 0xff) | ((data & 0x01) << 8); | |
| 1707 | k007342->scrollx[1] = (k007342->scrollx[1] & 0xff) | ((data & 0x02) << 7); | |
| 1714 | m_scrollx[0] = (m_scrollx[0] & 0xff) | ((data & 0x01) << 8); | |
| 1715 | m_scrollx[1] = (m_scrollx[1] & 0xff) | ((data & 0x02) << 7); | |
| 1708 | 1716 | break; |
| 1709 | 1717 | case 0x03: /* scroll x (register 0) */ |
| 1710 | | |
| 1718 | m_scrollx[0] = (m_scrollx[0] & 0x100) | data; | |
| 1711 | 1719 | break; |
| 1712 | 1720 | case 0x04: /* scroll y (register 0) */ |
| 1713 | | |
| 1721 | m_scrolly[0] = data; | |
| 1714 | 1722 | break; |
| 1715 | 1723 | case 0x05: /* scroll x (register 1) */ |
| 1716 | | |
| 1724 | m_scrollx[1] = (m_scrollx[1] & 0x100) | data; | |
| 1717 | 1725 | break; |
| 1718 | 1726 | case 0x06: /* scroll y (register 1) */ |
| 1719 | | |
| 1727 | m_scrolly[1] = data; | |
| 1720 | 1728 | case 0x07: /* unused */ |
| 1721 | 1729 | break; |
| 1722 | 1730 | } |
| 1723 | | |
| 1731 | m_regs[offset] = data; | |
| 1724 | 1732 | } |
| 1725 | 1733 | |
| 1726 | void k007342_tilemap_update( | |
| 1734 | void k007342_device::tilemap_update( ) | |
| 1727 | 1735 | { |
| 1728 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1729 | 1736 | int offs; |
| 1730 | 1737 | |
| 1731 | 1738 | /* update scroll */ |
| 1732 | switch ( | |
| 1739 | switch (m_regs[2] & 0x1c) | |
| 1733 | 1740 | { |
| 1734 | 1741 | case 0x00: |
| 1735 | 1742 | case 0x08: /* unknown, blades of steel shootout between periods */ |
| 1736 | k007342->tilemap[0]->set_scroll_rows(1); | |
| 1737 | k007342->tilemap[0]->set_scroll_cols(1); | |
| 1738 | k007342->tilemap[0]->set_scrollx(0, k007342->scrollx[0]); | |
| 1739 | k007342->tilemap[0]->set_scrolly(0, k007342->scrolly[0]); | |
| 1743 | m_tilemap[0]->set_scroll_rows(1); | |
| 1744 | m_tilemap[0]->set_scroll_cols(1); | |
| 1745 | m_tilemap[0]->set_scrollx(0, m_scrollx[0]); | |
| 1746 | m_tilemap[0]->set_scrolly(0, m_scrolly[0]); | |
| 1740 | 1747 | break; |
| 1741 | 1748 | |
| 1742 | 1749 | case 0x0c: /* 32 columns */ |
| 1743 | k007342->tilemap[0]->set_scroll_rows(1); | |
| 1744 | k007342->tilemap[0]->set_scroll_cols(512); | |
| 1745 | k007342->tilemap[0]->set_scrollx(0, k007342->scrollx[0]); | |
| 1750 | m_tilemap[0]->set_scroll_rows(1); | |
| 1751 | m_tilemap[0]->set_scroll_cols(512); | |
| 1752 | m_tilemap[0]->set_scrollx(0, m_scrollx[0]); | |
| 1746 | 1753 | for (offs = 0; offs < 256; offs++) |
| 1747 | k007342->tilemap[0]->set_scrolly((offs + k007342->scrollx[0]) & 0x1ff, | |
| 1748 | k007342->scroll_ram[2 * (offs / 8)] + 256 * k007342->scroll_ram[2 * (offs / 8) + 1]); | |
| 1754 | m_tilemap[0]->set_scrolly((offs + m_scrollx[0]) & 0x1ff, | |
| 1755 | m_scroll_ram[2 * (offs / 8)] + 256 * m_scroll_ram[2 * (offs / 8) + 1]); | |
| 1749 | 1756 | break; |
| 1750 | 1757 | |
| 1751 | 1758 | case 0x14: /* 256 rows */ |
| 1752 | k007342->tilemap[0]->set_scroll_rows(256); | |
| 1753 | k007342->tilemap[0]->set_scroll_cols(1); | |
| 1754 | k007342->tilemap[0]->set_scrolly(0, k007342->scrolly[0]); | |
| 1759 | m_tilemap[0]->set_scroll_rows(256); | |
| 1760 | m_tilemap[0]->set_scroll_cols(1); | |
| 1761 | m_tilemap[0]->set_scrolly(0, m_scrolly[0]); | |
| 1755 | 1762 | for (offs = 0; offs < 256; offs++) |
| 1756 | k007342->tilemap[0]->set_scrollx((offs + k007342->scrolly[0]) & 0xff, | |
| 1757 | k007342->scroll_ram[2 * offs] + 256 * k007342->scroll_ram[2 * offs + 1]); | |
| 1763 | m_tilemap[0]->set_scrollx((offs + m_scrolly[0]) & 0xff, | |
| 1764 | m_scroll_ram[2 * offs] + 256 * m_scroll_ram[2 * offs + 1]); | |
| 1758 | 1765 | break; |
| 1759 | 1766 | |
| 1760 | 1767 | default: |
| 1761 | // popmessage("unknown scroll ctrl %02x", | |
| 1768 | // popmessage("unknown scroll ctrl %02x", m_regs[2] & 0x1c); | |
| 1762 | 1769 | break; |
| 1763 | 1770 | } |
| 1764 | 1771 | |
| 1765 | k007342->tilemap[1]->set_scrollx(0, k007342->scrollx[1]); | |
| 1766 | k007342->tilemap[1]->set_scrolly(0, k007342->scrolly[1]); | |
| 1772 | m_tilemap[1]->set_scrollx(0, m_scrollx[1]); | |
| 1773 | m_tilemap[1]->set_scrolly(0, m_scrolly[1]); | |
| 1767 | 1774 | |
| 1768 | 1775 | #if 0 |
| 1769 | 1776 | { |
| 1770 | 1777 | static int current_layer = 0; |
| 1771 | 1778 | |
| 1772 | 1779 | if (machine.input().code_pressed_once(KEYCODE_Z)) current_layer = !current_layer; |
| 1773 | k007342->tilemap[current_layer]->enable(1); | |
| 1774 | k007342->tilemap[!current_layer]->enable(0); | |
| 1780 | m_tilemap[current_layer]->enable(1); | |
| 1781 | m_tilemap[!current_layer]->enable(0); | |
| 1775 | 1782 | |
| 1776 | 1783 | popmessage("regs:%02x %02x %02x %02x-%02x %02x %02x %02x:%02x", |
| 1777 | k007342->regs[0], k007342->regs[1], k007342->regs[2], k007342->regs[3], | |
| 1778 | k007342->regs[4], k007342->regs[5], k007342->regs[6], k007342->regs[7], | |
| 1784 | m_regs[0], m_regs[1], m_regs[2], m_regs[3], | |
| 1785 | m_regs[4], m_regs[5], m_regs[6], m_regs[7], | |
| 1779 | 1786 | current_layer); |
| 1780 | 1787 | } |
| 1781 | 1788 | #endif |
| 1782 | 1789 | } |
| 1783 | 1790 | |
| 1784 | void k007342_tilemap_draw( | |
| 1791 | void k007342_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority ) | |
| 1785 | 1792 | { |
| 1786 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1787 | k007342->tilemap[num]->draw(bitmap, cliprect, flags, priority); | |
| 1793 | m_tilemap[num]->draw(bitmap, cliprect, flags, priority); | |
| 1788 | 1794 | } |
| 1789 | 1795 | |
| 1790 | int k007342_is_int_enabled( | |
| 1796 | int k007342_device::is_int_enabled( ) | |
| 1791 | 1797 | { |
| 1792 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1793 | return k007342->int_enabled; | |
| 1798 | return m_int_enabled; | |
| 1794 | 1799 | } |
| 1795 | 1800 | |
| 1796 | 1801 | |
| r24078 | r24079 | |
| 1810 | 1815 | color RAM ----xxxx depends on external connections (usually color and banking) |
| 1811 | 1816 | */ |
| 1812 | 1817 | |
| 1813 | TILEMAP_MAPPER_MEMBER(k007342_device:: | |
| 1818 | TILEMAP_MAPPER_MEMBER(k007342_device::scan) | |
| 1814 | 1819 | { |
| 1815 | 1820 | /* logical (col,row) -> memory offset */ |
| 1816 | 1821 | return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 5); |
| 1817 | 1822 | } |
| 1818 | 1823 | |
| 1819 | ||
| 1824 | void k007342_device::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram ) | |
| 1820 | 1825 | { |
| 1821 | k007342_state *k007342 = k007342_get_safe_token(device); | |
| 1822 | 1826 | int color, code, flags; |
| 1823 | 1827 | |
| 1824 | 1828 | color = cram[tile_index]; |
| r24078 | r24079 | |
| 1827 | 1831 | |
| 1828 | 1832 | tileinfo.category = (color & 0x80) >> 7; |
| 1829 | 1833 | |
| 1830 | | |
| 1834 | m_callback(machine(), layer, m_regs[1], &code, &color, &flags); | |
| 1831 | 1835 | |
| 1832 | SET_TILE_INFO( | |
| 1833 | k007342->gfxnum, | |
| 1836 | SET_TILE_INFO_MEMBER( | |
| 1837 | m_gfxnum, | |
| 1834 | 1838 | code, |
| 1835 | 1839 | color, |
| 1836 | 1840 | flags); |
| 1837 | 1841 | } |
| 1838 | 1842 | |
| 1839 | TILE_GET_INFO_MEMBER(k007342_device:: | |
| 1843 | TILE_GET_INFO_MEMBER(k007342_device::get_tile_info0) | |
| 1840 | 1844 | { |
| 1841 | k007342_state *k007342 = k007342_get_safe_token(this); | |
| 1842 | k007342_get_tile_info(machine(), this, tileinfo, tile_index, 0, k007342->colorram_0, k007342->videoram_0); | |
| 1845 | get_tile_info(tileinfo, tile_index, 0, m_colorram_0, m_videoram_0); | |
| 1843 | 1846 | } |
| 1844 | 1847 | |
| 1845 | TILE_GET_INFO_MEMBER(k007342_device:: | |
| 1848 | TILE_GET_INFO_MEMBER(k007342_device::get_tile_info1) | |
| 1846 | 1849 | { |
| 1847 | k007342_state *k007342 = k007342_get_safe_token(this); | |
| 1848 | k007342_get_tile_info(machine(), this, tileinfo, tile_index, 1, k007342->colorram_1, k007342->videoram_1); | |
| 1850 | get_tile_info(tileinfo, tile_index, 1, m_colorram_1, m_videoram_1); | |
| 1849 | 1851 | } |
| 1850 | 1852 | |
| 1851 | const device_type K007342 = &device_creator<k007342_device>; | |
| 1853 | /***************************************************************************/ | |
| 1854 | /* */ | |
| 1855 | /* 007420 */ | |
| 1856 | /* */ | |
| 1857 | /***************************************************************************/ | |
| 1852 | 1858 | |
| 1853 | k007342_device::k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1854 | : device_t(mconfig, K007342, "Konami 007342", tag, owner, clock, "k007342", __FILE__) | |
| 1859 | #define K007420_SPRITERAM_SIZE 0x200 | |
| 1860 | ||
| 1861 | const device_type K007420 = &device_creator<k007420_device>; | |
| 1862 | ||
| 1863 | k007420_device::k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1864 | : device_t(mconfig, K007420, "Konami 007420", tag, owner, clock, "k007420", __FILE__), | |
| 1865 | m_ram(NULL), | |
| 1866 | m_flipscreen(0) | |
| 1867 | //m_regs[8], | |
| 1855 | 1868 | { |
| 1856 | m_token = global_alloc_clear(k007342_state); | |
| 1857 | 1869 | } |
| 1858 | 1870 | |
| 1859 | 1871 | //------------------------------------------------- |
| r24078 | r24079 | |
| 1862 | 1874 | // complete |
| 1863 | 1875 | //------------------------------------------------- |
| 1864 | 1876 | |
| 1865 | void k007 | |
| 1877 | void k007420_device::device_config_complete() | |
| 1866 | 1878 | { |
| 1879 | // inherit a copy of the static data | |
| 1880 | const k007420_interface *intf = reinterpret_cast<const k007420_interface *>(static_config()); | |
| 1881 | if (intf != NULL) | |
| 1882 | *static_cast<k007420_interface *>(this) = *intf; | |
| 1883 | ||
| 1884 | // or initialize to defaults if none provided | |
| 1885 | else | |
| 1886 | { | |
| 1887 | m_banklimit = 0; | |
| 1888 | m_callback = NULL; | |
| 1889 | } | |
| 1867 | 1890 | } |
| 1868 | 1891 | |
| 1869 | 1892 | //------------------------------------------------- |
| 1870 | 1893 | // device_start - device-specific startup |
| 1871 | 1894 | //------------------------------------------------- |
| 1872 | 1895 | |
| 1873 | void k007 | |
| 1896 | void k007420_device::device_start() | |
| 1874 | 1897 | { |
| 1875 | k007342_state *k007342 = k007342_get_safe_token(this); | |
| 1876 | const k007342_interface *intf = k007342_get_interface(this); | |
| 1898 | m_ram = auto_alloc_array_clear(machine(), UINT8, 0x200); | |
| 1877 | 1899 | |
| 1878 | k007342->gfxnum = intf->gfxnum; | |
| 1879 | k007342->callback = intf->callback; | |
| 1880 | ||
| 1881 | k007342->tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::k007342_get_tile_info0),this), tilemap_mapper_delegate(FUNC(k007342_device::k007342_scan),this), 8, 8, 64, 32); | |
| 1882 | k007342->tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::k007342_get_tile_info1),this), tilemap_mapper_delegate(FUNC(k007342_device::k007342_scan),this), 8, 8, 64, 32); | |
| 1883 | ||
| 1884 | k007342->ram = auto_alloc_array(machine(), UINT8, 0x2000); | |
| 1885 | k007342->scroll_ram = auto_alloc_array(machine(), UINT8, 0x0200); | |
| 1886 | ||
| 1887 | k007342->colorram_0 = &k007342->ram[0x0000]; | |
| 1888 | k007342->colorram_1 = &k007342->ram[0x1000]; | |
| 1889 | k007342->videoram_0 = &k007342->ram[0x0800]; | |
| 1890 | k007342->videoram_1 = &k007342->ram[0x1800]; | |
| 1891 | ||
| 1892 | k007342->tilemap[0]->set_transparent_pen(0); | |
| 1893 | k007342->tilemap[1]->set_transparent_pen(0); | |
| 1894 | ||
| 1895 | save_pointer(NAME(k007342->ram), 0x2000); | |
| 1896 | save_pointer(NAME(k007342->scroll_ram), 0x0200); | |
| 1897 | save_item(NAME(k007342->int_enabled)); | |
| 1898 | save_item(NAME(k007342->flipscreen)); | |
| 1899 | save_item(NAME(k007342->scrollx)); | |
| 1900 | save_item(NAME(k007342->scrolly)); | |
| 1901 | save_item(NAME(k007342->regs)); | |
| 1900 | save_pointer(NAME(m_ram), 0x200); | |
| 1901 | save_item(NAME(m_flipscreen)); // current one uses 7342 one | |
| 1902 | save_item(NAME(m_regs)); // current one uses 7342 ones | |
| 1902 | 1903 | } |
| 1903 | 1904 | |
| 1904 | 1905 | //------------------------------------------------- |
| 1905 | 1906 | // device_reset - device-specific reset |
| 1906 | 1907 | //------------------------------------------------- |
| 1907 | 1908 | |
| 1908 | void k007 | |
| 1909 | void k007420_device::device_reset() | |
| 1909 | 1910 | { |
| 1910 | k007342_state *k007342 = k007342_get_safe_token(this); | |
| 1911 | 1911 | int i; |
| 1912 | 1912 | |
| 1913 | k007342->int_enabled = 0; | |
| 1914 | k007342->flipscreen = 0; | |
| 1915 | k007342->scrollx[0] = 0; | |
| 1916 | k007342->scrollx[1] = 0; | |
| 1917 | k007342->scrolly[0] = 0; | |
| 1918 | k007342->scrolly[1] = 0; | |
| 1919 | ||
| 1913 | m_flipscreen = 0; | |
| 1920 | 1914 | for (i = 0; i < 8; i++) |
| 1921 | | |
| 1915 | m_regs[i] = 0; | |
| 1922 | 1916 | } |
| 1923 | 1917 | |
| 1924 | ||
| 1925 | ||
| 1926 | /***************************************************************************/ | |
| 1927 | /* */ | |
| 1928 | /* 007420 */ | |
| 1929 | /* */ | |
| 1930 | /***************************************************************************/ | |
| 1931 | ||
| 1932 | struct k007420_state | |
| 1933 | { | |
| 1934 | UINT8 *ram; | |
| 1935 | ||
| 1936 | int banklimit; | |
| 1937 | int flipscreen; // current code uses the 7342 flipscreen!! | |
| 1938 | UINT8 regs[8]; // current code uses the 7342 regs!! (only [2]) | |
| 1939 | ||
| 1940 | k007420_callback callback; | |
| 1941 | }; | |
| 1942 | ||
| 1943 | 1918 | /***************************************************************************** |
| 1944 | INLINE FUNCTIONS | |
| 1945 | *****************************************************************************/ | |
| 1946 | ||
| 1947 | INLINE k007420_state *k007420_get_safe_token( device_t *device ) | |
| 1948 | { | |
| 1949 | assert(device != NULL); | |
| 1950 | assert(device->type() == K007420); | |
| 1951 | ||
| 1952 | return (k007420_state *)downcast<k007420_device *>(device)->token(); | |
| 1953 | } | |
| 1954 | ||
| 1955 | INLINE const k007420_interface *k007420_get_interface( device_t *device ) | |
| 1956 | { | |
| 1957 | assert(device != NULL); | |
| 1958 | assert((device->type() == K007420)); | |
| 1959 | return (const k007420_interface *) device->static_config(); | |
| 1960 | } | |
| 1961 | ||
| 1962 | /***************************************************************************** | |
| 1963 | 1919 | DEVICE HANDLERS |
| 1964 | 1920 | *****************************************************************************/ |
| 1965 | 1921 | |
| 1966 | READ8_ | |
| 1922 | READ8_MEMBER( k007420_device::read ) | |
| 1967 | 1923 | { |
| 1968 | k007420_state *k007420 = k007420_get_safe_token(device); | |
| 1969 | return k007420->ram[offset]; | |
| 1924 | return m_ram[offset]; | |
| 1970 | 1925 | } |
| 1971 | 1926 | |
| 1972 | WRITE8_ | |
| 1927 | WRITE8_MEMBER( k007420_device::write ) | |
| 1973 | 1928 | { |
| 1974 | k007420_state *k007420 = k007420_get_safe_token(device); | |
| 1975 | k007420->ram[offset] = data; | |
| 1929 | m_ram[offset] = data; | |
| 1976 | 1930 | } |
| 1977 | 1931 | |
| 1978 | 1932 | /* |
| r24078 | r24079 | |
| 1995 | 1949 | * 7 | xxxxxxxx | unused |
| 1996 | 1950 | */ |
| 1997 | 1951 | |
| 1998 | void k007420_sprites_draw( | |
| 1952 | void k007420_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx ) | |
| 1999 | 1953 | { |
| 2000 | k007420_state *k007420 = k007420_get_safe_token(device); | |
| 2001 | 1954 | int offs; |
| 2002 | int codemask = k007420->banklimit; | |
| 2003 | int bankmask = ~k007420->banklimit; | |
| 1955 | int codemask = m_banklimit; | |
| 1956 | int bankmask = ~m_banklimit; | |
| 2004 | 1957 | |
| 2005 | 1958 | for (offs = K007420_SPRITERAM_SIZE - 8; offs >= 0; offs -= 8) |
| 2006 | 1959 | { |
| r24078 | r24079 | |
| 2008 | 1961 | static const int xoffset[4] = { 0, 1, 4, 5 }; |
| 2009 | 1962 | static const int yoffset[4] = { 0, 2, 8, 10 }; |
| 2010 | 1963 | |
| 2011 | code = k007420->ram[offs + 1]; | |
| 2012 | color = k007420->ram[offs + 2]; | |
| 2013 | ox = k007420->ram[offs + 3] - ((k007420->ram[offs + 4] & 0x80) << 1); | |
| 2014 | oy = 256 - k007420->ram[offs + 0]; | |
| 2015 | flipx = k007420->ram[offs + 4] & 0x04; | |
| 2016 | flipy = k007420->ram[offs + 4] & 0x08; | |
| 1964 | code = m_ram[offs + 1]; | |
| 1965 | color = m_ram[offs + 2]; | |
| 1966 | ox = m_ram[offs + 3] - ((m_ram[offs + 4] & 0x80) << 1); | |
| 1967 | oy = 256 - m_ram[offs + 0]; | |
| 1968 | flipx = m_ram[offs + 4] & 0x04; | |
| 1969 | flipy = m_ram[offs + 4] & 0x08; | |
| 2017 | 1970 | |
| 2018 | | |
| 1971 | m_callback(machine(), &code, &color); | |
| 2019 | 1972 | |
| 2020 | 1973 | bank = code & bankmask; |
| 2021 | 1974 | code &= codemask; |
| 2022 | 1975 | |
| 2023 | 1976 | /* 0x080 = normal scale, 0x040 = double size, 0x100 half size */ |
| 2024 | zoom = | |
| 1977 | zoom = m_ram[offs + 5] | ((m_ram[offs + 4] & 0x03) << 8); | |
| 2025 | 1978 | if (!zoom) |
| 2026 | 1979 | continue; |
| 2027 | 1980 | zoom = 0x10000 * 128 / zoom; |
| 2028 | 1981 | |
| 2029 | switch ( | |
| 1982 | switch (m_ram[offs + 4] & 0x70) | |
| 2030 | 1983 | { |
| 2031 | 1984 | case 0x30: w = h = 1; break; |
| 2032 | 1985 | case 0x20: w = 2; h = 1; code &= (~1); break; |
| r24078 | r24079 | |
| 2034 | 1987 | case 0x00: w = h = 2; code &= (~3); break; |
| 2035 | 1988 | case 0x40: w = h = 4; code &= (~3); break; |
| 2036 | 1989 | default: w = 1; h = 1; |
| 2037 | //logerror("Unknown sprite size %02x\n",( | |
| 1990 | //logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4); | |
| 2038 | 1991 | } |
| 2039 | 1992 | |
| 2040 | if ( | |
| 1993 | if (m_flipscreen) | |
| 2041 | 1994 | { |
| 2042 | 1995 | ox = 256 - ox - ((zoom * w + (1 << 12)) >> 13); |
| 2043 | 1996 | oy = 256 - oy - ((zoom * h + (1 << 12)) >> 13); |
| r24078 | r24079 | |
| 2079 | 2032 | flipx,flipy, |
| 2080 | 2033 | sx,sy,0); |
| 2081 | 2034 | |
| 2082 | if ( | |
| 2035 | if (m_regs[2] & 0x80) | |
| 2083 | 2036 | drawgfx_transpen(bitmap,cliprect,gfx, |
| 2084 | 2037 | c, |
| 2085 | 2038 | color, |
| r24078 | r24079 | |
| 2124 | 2077 | sx,sy, |
| 2125 | 2078 | (zw << 16) / 8,(zh << 16) / 8,0); |
| 2126 | 2079 | |
| 2127 | if ( | |
| 2080 | if (m_regs[2] & 0x80) | |
| 2128 | 2081 | drawgfxzoom_transpen(bitmap,cliprect,gfx, |
| 2129 | 2082 | c, |
| 2130 | 2083 | color, |
| r24078 | r24079 | |
| 2139 | 2092 | { |
| 2140 | 2093 | static int current_sprite = 0; |
| 2141 | 2094 | |
| 2142 | if (machine.input().code_pressed_once(KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1); | |
| 2143 | if (machine.input().code_pressed_once(KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1); | |
| 2095 | if (machine().input().code_pressed_once(KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1); | |
| 2096 | if (machine().input().code_pressed_once(KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1); | |
| 2144 | 2097 | |
| 2145 | 2098 | popmessage("%02x:%02x %02x %02x %02x %02x %02x %02x %02x", current_sprite, |
| 2146 | k007420->ram[(current_sprite*8)+0], k007420->ram[(current_sprite*8)+1], | |
| 2147 | k007420->ram[(current_sprite*8)+2], k007420->ram[(current_sprite*8)+3], | |
| 2148 | k007420->ram[(current_sprite*8)+4], k007420->ram[(current_sprite*8)+5], | |
| 2149 | k007420->ram[(current_sprite*8)+6], k007420->ram[(current_sprite*8)+7]); | |
| 2099 | m_ram[(current_sprite*8)+0], m_ram[(current_sprite*8)+1], | |
| 2100 | m_ram[(current_sprite*8)+2], m_ram[(current_sprite*8)+3], | |
| 2101 | m_ram[(current_sprite*8)+4], m_ram[(current_sprite*8)+5], | |
| 2102 | m_ram[(current_sprite*8)+6], m_ram[(current_sprite*8)+7]); | |
| 2150 | 2103 | } |
| 2151 | 2104 | #endif |
| 2152 | 2105 | } |
| 2153 | 2106 | |
| 2154 | /***************************************************************************** | |
| 2155 | DEVICE INTERFACE | |
| 2156 | *****************************************************************************/ | |
| 2157 | 2107 | |
| 2158 | static DEVICE_START( k007420 ) | |
| 2159 | { | |
| 2160 | k007420_state *k007420 = k007420_get_safe_token(device); | |
| 2161 | const k007420_interface *intf = k007420_get_interface(device); | |
| 2108 | /***************************************************************************/ | |
| 2109 | /* */ | |
| 2110 | /* 052109 */ | |
| 2111 | /* */ | |
| 2112 | /***************************************************************************/ | |
| 2162 | 2113 | |
| 2163 | k007420->callback = intf->callback; | |
| 2164 | k007420->banklimit = intf->banklimit; | |
| 2114 | const device_type K052109 = &device_creator<k052109_device>; | |
| 2165 | 2115 | |
| 2166 | k007420->ram = auto_alloc_array(device->machine(), UINT8, 0x200); | |
| 2116 | k052109_device::k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 2117 | : device_t(mconfig, K052109, "Konami 052109", tag, owner, clock, "k052109", __FILE__), | |
| 2118 | m_ram(NULL), | |
| 2119 | m_videoram_F(NULL), | |
| 2120 | m_videoram_A(NULL), | |
| 2121 | m_videoram_B(NULL), | |
| 2122 | m_videoram2_F(NULL), | |
| 2123 | m_videoram2_A(NULL), | |
| 2124 | m_videoram2_B(NULL), | |
| 2125 | m_colorram_F(NULL), | |
| 2126 | m_colorram_A(NULL), | |
| 2127 | m_colorram_B(NULL), | |
| 2167 | 2128 | |
| 2168 | device->save_pointer(NAME(k007420->ram), 0x200); | |
| 2169 | device->save_item(NAME(k007420->flipscreen)); // current one uses 7342 one | |
| 2170 | device->save_item(NAME(k007420->regs)); // current one uses 7342 ones | |
| 2171 | } | |
| 2172 | ||
| 2173 | static DEVICE_RESET( k007420 ) | |
| 2129 | //m_tilemap[3], | |
| 2130 | m_tileflip_enable(0), | |
| 2131 | //m_charrombank[4], | |
| 2132 | //m_charrombank_2[4], | |
| 2133 | m_has_extra_video_ram(0), | |
| 2134 | m_rmrd_line(0), | |
| 2135 | m_irq_enabled(0), | |
| 2136 | //m_dx[3], m_dy[3], | |
| 2137 | m_romsubbank(0), | |
| 2138 | m_scrollctrl(0) | |
| 2174 | 2139 | { |
| 2175 | k007420_state *k007420 = k007420_get_safe_token(device); | |
| 2176 | int i; | |
| 2177 | ||
| 2178 | k007420->flipscreen = 0; | |
| 2179 | for (i = 0; i < 8; i++) | |
| 2180 | k007420->regs[i] = 0; | |
| 2181 | 2140 | } |
| 2182 | 2141 | |
| 2183 | ||
| 2184 | const device_type K007420 = &device_creator<k007420_device>; | |
| 2185 | ||
| 2186 | k007420_device::k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 2187 | : device_t(mconfig, K007420, "Konami 007420", tag, owner, clock, "k007420", __FILE__) | |
| 2188 | { | |
| 2189 | m_token = global_alloc_clear(k007420_state); | |
| 2190 | } | |
| 2191 | ||
| 2192 | 2142 | //------------------------------------------------- |
| 2193 | 2143 | // device_config_complete - perform any |
| 2194 | 2144 | // operations now that the configuration is |
| 2195 | 2145 | // complete |
| 2196 | 2146 | //------------------------------------------------- |
| 2197 | 2147 | |
| 2198 | void k0 | |
| 2148 | void k052109_device::device_config_complete() | |
| 2199 | 2149 | { |
| 2150 | // inherit a copy of the static data | |
| 2151 | const k052109_interface *intf = reinterpret_cast<const k052109_interface *>(static_config()); | |
| 2152 | if (intf != NULL) | |
| 2153 | *static_cast<k052109_interface *>(this) = *intf; | |
| 2154 | ||
| 2155 | // or initialize to defaults if none provided | |
| 2156 | else | |
| 2157 | { | |
| 2158 | m_gfx_memory_region = ""; | |
| 2159 | m_gfx_num = 0; | |
| 2160 | m_plane_order = 0; | |
| 2161 | m_deinterleave = 0; | |
| 2162 | m_callback = NULL; | |
| 2163 | } | |
| 2200 | 2164 | } |
| 2201 | 2165 | |
| 2202 | 2166 | //------------------------------------------------- |
| 2203 | 2167 | // device_start - device-specific startup |
| 2204 | 2168 | //------------------------------------------------- |
| 2205 | 2169 | |
| 2206 | void k0 | |
| 2170 | void k052109_device::device_start() | |
| 2207 | 2171 | { |
| 2208 | DEVICE_START_NAME( k007420 )(this); | |
| 2209 | } | |
| 2172 | UINT32 total; | |
| 2173 | static const gfx_layout charlayout = | |
| 2174 | { | |
| 2175 | 8,8, | |
| 2176 | 0, | |
| 2177 | 4, | |
| 2178 | { 24, 16, 8, 0 }, | |
| 2179 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 2180 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 2181 | 32*8 | |
| 2182 | }; | |
| 2183 | static const gfx_layout charlayout_gradius3 = | |
| 2184 | { | |
| 2185 | 8,8, | |
| 2186 | 0, | |
| 2187 | 4, | |
| 2188 | { 0, 1, 2, 3 }, | |
| 2189 | { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 }, | |
| 2190 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 2191 | 32*8 | |
| 2192 | }; | |
| 2210 | 2193 | |
| 2211 | //------------------------------------------------- | |
| 2212 | // device_reset - device-specific reset | |
| 2213 | //------------------------------------------------- | |
| 2214 | 2194 | |
| 2215 | void k007420_device::device_reset() | |
| 2216 | { | |
| 2217 | DEVICE_RESET_NAME( k007420 )(this); | |
| 2218 | } | |
| 2195 | /* decode the graphics */ | |
| 2196 | switch (m_plane_order) | |
| 2197 | { | |
| 2198 | case NORMAL_PLANE_ORDER: | |
| 2199 | total = machine().root_device().memregion(m_gfx_memory_region)->bytes() / 32; | |
| 2200 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &charlayout, 4); | |
| 2201 | break; | |
| 2219 | 2202 | |
| 2220 | /***************************************************************************/ | |
| 2221 | /* */ | |
| 2222 | /* 052109 */ | |
| 2223 | /* */ | |
| 2224 | /***************************************************************************/ | |
| 2203 | case GRADIUS3_PLANE_ORDER: | |
| 2204 | total = 0x1000; | |
| 2205 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &charlayout_gradius3, 4); | |
| 2206 | break; | |
| 2225 | 2207 | |
| 2226 | struct k052109_state | |
| 2227 | { | |
| 2228 | UINT8 *ram; | |
| 2229 | UINT8 *videoram_F; | |
| 2230 | UINT8 *videoram_A; | |
| 2231 | UINT8 *videoram_B; | |
| 2232 | UINT8 *videoram2_F; | |
| 2233 | UINT8 *videoram2_A; | |
| 2234 | UINT8 *videoram2_B; | |
| 2235 | UINT8 *colorram_F; | |
| 2236 | UINT8 *colorram_A; | |
| 2237 | UINT8 *colorram_B; | |
| 2208 | default: | |
| 2209 | fatalerror("Unsupported plane_order\n"); | |
| 2210 | } | |
| 2238 | 2211 | |
| 2239 | tilemap_t *tilemap[3]; | |
| 2240 | int tileflip_enable, gfxnum; | |
| 2241 | UINT8 charrombank[4]; | |
| 2242 | UINT8 charrombank_2[4]; | |
| 2243 | UINT8 has_extra_video_ram; | |
| 2244 | INT32 rmrd_line; | |
| 2245 | UINT8 irq_enabled; | |
| 2246 | INT32 dx[3], dy[3]; | |
| 2247 | UINT8 romsubbank, scrollctrl; | |
| 2212 | /* deinterleave the graphics, if needed */ | |
| 2213 | deinterleave_gfx(machine(), m_gfx_memory_region, m_deinterleave); | |
| 2248 | 2214 | |
| 2249 | k052109_callback callback; | |
| 2215 | m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2216 | m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2217 | m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2250 | 2218 | |
| 2251 | const char *memory_region; | |
| 2252 | }; | |
| 2219 | m_ram = auto_alloc_array_clear(machine(), UINT8, 0x6000); | |
| 2253 | 2220 | |
| 2221 | m_colorram_F = &m_ram[0x0000]; | |
| 2222 | m_colorram_A = &m_ram[0x0800]; | |
| 2223 | m_colorram_B = &m_ram[0x1000]; | |
| 2224 | m_videoram_F = &m_ram[0x2000]; | |
| 2225 | m_videoram_A = &m_ram[0x2800]; | |
| 2226 | m_videoram_B = &m_ram[0x3000]; | |
| 2227 | m_videoram2_F = &m_ram[0x4000]; | |
| 2228 | m_videoram2_A = &m_ram[0x4800]; | |
| 2229 | m_videoram2_B = &m_ram[0x5000]; | |
| 2254 | 2230 | |
| 2255 | /***************************************************************************** | |
| 2256 | INLINE FUNCTIONS | |
| 2257 | *****************************************************************************/ | |
| 2231 | m_tilemap[0]->set_transparent_pen(0); | |
| 2232 | m_tilemap[1]->set_transparent_pen(0); | |
| 2233 | m_tilemap[2]->set_transparent_pen(0); | |
| 2258 | 2234 | |
| 2259 | INLINE k052109_state *k052109_get_safe_token( device_t *device ) | |
| 2260 | { | |
| 2261 | assert(device != NULL); | |
| 2262 | assert(device->type() == K052109); | |
| 2263 | ||
| 2264 | return (k052109_state *)downcast<k052109_device *>(device)->token(); | |
| 2235 | save_pointer(NAME(m_ram), 0x6000); | |
| 2236 | save_item(NAME(m_rmrd_line)); | |
| 2237 | save_item(NAME(m_romsubbank)); | |
| 2238 | save_item(NAME(m_scrollctrl)); | |
| 2239 | save_item(NAME(m_irq_enabled)); | |
| 2240 | save_item(NAME(m_charrombank)); | |
| 2241 | save_item(NAME(m_charrombank_2)); | |
| 2242 | save_item(NAME(m_dx)); | |
| 2243 | save_item(NAME(m_dy)); | |
| 2244 | save_item(NAME(m_has_extra_video_ram)); | |
| 2245 | machine().save().register_postload(save_prepost_delegate(FUNC(k052109_device::tileflip_reset), this)); | |
| 2265 | 2246 | } |
| 2266 | 2247 | |
| 2267 | INLINE const k052109_interface *k052109_get_interface( device_t *device ) | |
| 2248 | //------------------------------------------------- | |
| 2249 | // device_reset - device-specific reset | |
| 2250 | //------------------------------------------------- | |
| 2251 | ||
| 2252 | void k052109_device::device_reset() | |
| 2268 | 2253 | { |
| 2269 | assert(device != NULL); | |
| 2270 | assert((device->type() == K052109)); | |
| 2271 | return (const k052109_interface *) device->static_config(); | |
| 2254 | int i; | |
| 2255 | ||
| 2256 | m_rmrd_line = CLEAR_LINE; | |
| 2257 | m_irq_enabled = 0; | |
| 2258 | m_romsubbank = 0; | |
| 2259 | m_scrollctrl = 0; | |
| 2260 | ||
| 2261 | m_has_extra_video_ram = 0; | |
| 2262 | ||
| 2263 | for (i = 0; i < 3; i++) | |
| 2264 | m_dx[i] = m_dy[i] = 0; | |
| 2265 | ||
| 2266 | for (i = 0; i < 4; i++) | |
| 2267 | { | |
| 2268 | m_charrombank[i] = 0; | |
| 2269 | m_charrombank_2[i] = 0; | |
| 2270 | } | |
| 2272 | 2271 | } |
| 2273 | 2272 | |
| 2274 | 2273 | /***************************************************************************** |
| 2275 | 2274 | DEVICE HANDLERS |
| 2276 | 2275 | *****************************************************************************/ |
| 2277 | 2276 | |
| 2278 | READ8_ | |
| 2277 | READ8_MEMBER( k052109_device::read ) | |
| 2279 | 2278 | { |
| 2280 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2281 | ||
| 2282 | if (k052109->rmrd_line == CLEAR_LINE) | |
| 2279 | if (m_rmrd_line == CLEAR_LINE) | |
| 2283 | 2280 | { |
| 2284 | 2281 | if ((offset & 0x1fff) >= 0x1800) |
| 2285 | 2282 | { |
| r24078 | r24079 | |
| 2297 | 2294 | //logerror("%04x: read from unknown 052109 address %04x\n",space.device().safe_pc(),offset); |
| 2298 | 2295 | } |
| 2299 | 2296 | |
| 2300 | return | |
| 2297 | return m_ram[offset]; | |
| 2301 | 2298 | } |
| 2302 | 2299 | else /* Punk Shot and TMNT read from 0000-1fff, Aliens from 2000-3fff */ |
| 2303 | 2300 | { |
| 2304 | 2301 | int code = (offset & 0x1fff) >> 5; |
| 2305 | int color = | |
| 2302 | int color = m_romsubbank; | |
| 2306 | 2303 | int flags = 0; |
| 2307 | 2304 | int priority = 0; |
| 2308 | int bank = | |
| 2305 | int bank = m_charrombank[(color & 0x0c) >> 2] >> 2; /* discard low bits (TMNT) */ | |
| 2309 | 2306 | int addr; |
| 2310 | 2307 | |
| 2311 | bank |= ( | |
| 2308 | bank |= (m_charrombank_2[(color & 0x0c) >> 2] >> 2); // Surprise Attack uses this 2nd bank in the rom test | |
| 2312 | 2309 | |
| 2313 | if ( | |
| 2310 | if (m_has_extra_video_ram) | |
| 2314 | 2311 | code |= color << 8; /* kludge for X-Men */ |
| 2315 | 2312 | else |
| 2316 | | |
| 2313 | m_callback(space.machine(), 0, bank, &code, &color, &flags, &priority); | |
| 2317 | 2314 | |
| 2318 | 2315 | addr = (code << 5) + (offset & 0x1f); |
| 2319 | addr &= space.machine().root_device().memregion( | |
| 2316 | addr &= space.machine().root_device().memregion(m_gfx_memory_region)->bytes() - 1; | |
| 2320 | 2317 | |
| 2321 | // logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space.device().safe_pc(), offset, | |
| 2318 | // logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space.device().safe_pc(), offset, m_romsubbank, bank, addr); | |
| 2322 | 2319 | |
| 2323 | return space.machine().root_device().memregion( | |
| 2320 | return space.machine().root_device().memregion(m_gfx_memory_region)->base()[addr]; | |
| 2324 | 2321 | } |
| 2325 | 2322 | } |
| 2326 | 2323 | |
| 2327 | WRITE8_ | |
| 2324 | WRITE8_MEMBER( k052109_device::write ) | |
| 2328 | 2325 | { |
| 2329 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2330 | ||
| 2331 | 2326 | if ((offset & 0x1fff) < 0x1800) /* tilemap RAM */ |
| 2332 | 2327 | { |
| 2333 | 2328 | if (offset >= 0x4000) |
| 2334 | | |
| 2329 | m_has_extra_video_ram = 1; /* kludge for X-Men */ | |
| 2335 | 2330 | |
| 2336 | k052109->ram[offset] = data; | |
| 2337 | k052109->tilemap[(offset & 0x1800) >> 11]->mark_tile_dirty(offset & 0x7ff); | |
| 2331 | m_ram[offset] = data; | |
| 2332 | m_tilemap[(offset & 0x1800) >> 11]->mark_tile_dirty(offset & 0x7ff); | |
| 2338 | 2333 | } |
| 2339 | 2334 | else /* control registers */ |
| 2340 | 2335 | { |
| 2341 | | |
| 2336 | m_ram[offset] = data; | |
| 2342 | 2337 | |
| 2343 | 2338 | if (offset >= 0x180c && offset < 0x1834) |
| 2344 | 2339 | { /* A y scroll */ } |
| r24078 | r24079 | |
| 2346 | 2341 | { /* A x scroll */ } |
| 2347 | 2342 | else if (offset == 0x1c80) |
| 2348 | 2343 | { |
| 2349 | if ( | |
| 2344 | if (m_scrollctrl != data) | |
| 2350 | 2345 | { |
| 2351 | 2346 | //popmessage("scrollcontrol = %02x", data); |
| 2352 | 2347 | //logerror("%04x: rowscrollcontrol = %02x\n", space.device().safe_pc(), data); |
| 2353 | | |
| 2348 | m_scrollctrl = data; | |
| 2354 | 2349 | } |
| 2355 | 2350 | } |
| 2356 | 2351 | else if (offset == 0x1d00) |
| r24078 | r24079 | |
| 2358 | 2353 | //logerror("%04x: 052109 register 1d00 = %02x\n", space.device().safe_pc(), data); |
| 2359 | 2354 | /* bit 2 = irq enable */ |
| 2360 | 2355 | /* the custom chip can also generate NMI and FIRQ, for use with a 6809 */ |
| 2361 | | |
| 2356 | m_irq_enabled = data & 0x04; | |
| 2362 | 2357 | } |
| 2363 | 2358 | else if (offset == 0x1d80) |
| 2364 | 2359 | { |
| 2365 | 2360 | int dirty = 0; |
| 2366 | 2361 | |
| 2367 | if ( | |
| 2362 | if (m_charrombank[0] != (data & 0x0f)) | |
| 2368 | 2363 | dirty |= 1; |
| 2369 | if ( | |
| 2364 | if (m_charrombank[1] != ((data >> 4) & 0x0f)) | |
| 2370 | 2365 | dirty |= 2; |
| 2371 | 2366 | |
| 2372 | 2367 | if (dirty) |
| 2373 | 2368 | { |
| 2374 | 2369 | int i; |
| 2375 | 2370 | |
| 2376 | k052109->charrombank[0] = data & 0x0f; | |
| 2377 | k052109->charrombank[1] = (data >> 4) & 0x0f; | |
| 2371 | m_charrombank[0] = data & 0x0f; | |
| 2372 | m_charrombank[1] = (data >> 4) & 0x0f; | |
| 2378 | 2373 | |
| 2379 | 2374 | for (i = 0; i < 0x1800; i++) |
| 2380 | 2375 | { |
| 2381 | int bank = ( | |
| 2376 | int bank = (m_ram[i]&0x0c) >> 2; | |
| 2382 | 2377 | if ((bank == 0 && (dirty & 1)) || (bank == 1 && (dirty & 2))) |
| 2383 | 2378 | { |
| 2384 | | |
| 2379 | m_tilemap[(i & 0x1800) >> 11]->mark_tile_dirty(i & 0x7ff); | |
| 2385 | 2380 | } |
| 2386 | 2381 | } |
| 2387 | 2382 | } |
| r24078 | r24079 | |
| 2389 | 2384 | else if (offset == 0x1e00 || offset == 0x3e00) // Surprise Attack uses offset 0x3e00 |
| 2390 | 2385 | { |
| 2391 | 2386 | //logerror("%04x: 052109 register 1e00 = %02x\n",space.device().safe_pc(),data); |
| 2392 | | |
| 2387 | m_romsubbank = data; | |
| 2393 | 2388 | } |
| 2394 | 2389 | else if (offset == 0x1e80) |
| 2395 | 2390 | { |
| 2396 | 2391 | //if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",space.device().safe_pc(),data); |
| 2397 | k052109->tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2398 | k052109->tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2399 | k052109->tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2400 | if (k052109->tileflip_enable != ((data & 0x06) >> 1)) | |
| 2392 | m_tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2393 | m_tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2394 | m_tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2395 | if (m_tileflip_enable != ((data & 0x06) >> 1)) | |
| 2401 | 2396 | { |
| 2402 | | |
| 2397 | m_tileflip_enable = ((data & 0x06) >> 1); | |
| 2403 | 2398 | |
| 2404 | k052109->tilemap[0]->mark_all_dirty(); | |
| 2405 | k052109->tilemap[1]->mark_all_dirty(); | |
| 2406 | k052109->tilemap[2]->mark_all_dirty(); | |
| 2399 | m_tilemap[0]->mark_all_dirty(); | |
| 2400 | m_tilemap[1]->mark_all_dirty(); | |
| 2401 | m_tilemap[2]->mark_all_dirty(); | |
| 2407 | 2402 | } |
| 2408 | 2403 | } |
| 2409 | 2404 | else if (offset == 0x1f00) |
| 2410 | 2405 | { |
| 2411 | 2406 | int dirty = 0; |
| 2412 | 2407 | |
| 2413 | if ( | |
| 2408 | if (m_charrombank[2] != (data & 0x0f)) | |
| 2414 | 2409 | dirty |= 1; |
| 2415 | 2410 | |
| 2416 | if ( | |
| 2411 | if (m_charrombank[3] != ((data >> 4) & 0x0f)) | |
| 2417 | 2412 | dirty |= 2; |
| 2418 | 2413 | |
| 2419 | 2414 | if (dirty) |
| 2420 | 2415 | { |
| 2421 | 2416 | int i; |
| 2422 | 2417 | |
| 2423 | k052109->charrombank[2] = data & 0x0f; | |
| 2424 | k052109->charrombank[3] = (data >> 4) & 0x0f; | |
| 2418 | m_charrombank[2] = data & 0x0f; | |
| 2419 | m_charrombank[3] = (data >> 4) & 0x0f; | |
| 2425 | 2420 | |
| 2426 | 2421 | for (i = 0; i < 0x1800; i++) |
| 2427 | 2422 | { |
| 2428 | int bank = ( | |
| 2423 | int bank = (m_ram[i] & 0x0c) >> 2; | |
| 2429 | 2424 | if ((bank == 2 && (dirty & 1)) || (bank == 3 && (dirty & 2))) |
| 2430 | | |
| 2425 | m_tilemap[(i & 0x1800) >> 11]->mark_tile_dirty(i & 0x7ff); | |
| 2431 | 2426 | } |
| 2432 | 2427 | } |
| 2433 | 2428 | } |
| r24078 | r24079 | |
| 2438 | 2433 | else if (offset == 0x3d80) // Surprise Attack uses offset 0x3d80 in rom test |
| 2439 | 2434 | { |
| 2440 | 2435 | // mirroring this write, breaks Surprise Attack in game tilemaps |
| 2441 | k052109->charrombank_2[0] = data & 0x0f; | |
| 2442 | k052109->charrombank_2[1] = (data >> 4) & 0x0f; | |
| 2436 | m_charrombank_2[0] = data & 0x0f; | |
| 2437 | m_charrombank_2[1] = (data >> 4) & 0x0f; | |
| 2443 | 2438 | } |
| 2444 | 2439 | else if (offset == 0x3f00) // Surprise Attack uses offset 0x3f00 in rom test |
| 2445 | 2440 | { |
| 2446 | 2441 | // mirroring this write, breaks Surprise Attack in game tilemaps |
| 2447 | k052109->charrombank_2[2] = data & 0x0f; | |
| 2448 | k052109->charrombank_2[3] = (data >> 4) & 0x0f; | |
| 2442 | m_charrombank_2[2] = data & 0x0f; | |
| 2443 | m_charrombank_2[3] = (data >> 4) & 0x0f; | |
| 2449 | 2444 | } |
| 2450 | 2445 | // else |
| 2451 | 2446 | // logerror("%04x: write %02x to unknown 052109 address %04x\n",space.device().safe_pc(),data,offset); |
| 2452 | 2447 | } |
| 2453 | 2448 | } |
| 2454 | 2449 | |
| 2455 | READ16_ | |
| 2450 | READ16_MEMBER( k052109_device::word_r ) | |
| 2456 | 2451 | { |
| 2457 | return | |
| 2452 | return read(space, offset + 0x2000) | (read(space, offset) << 8); | |
| 2458 | 2453 | } |
| 2459 | 2454 | |
| 2460 | WRITE16_ | |
| 2455 | WRITE16_MEMBER( k052109_device::word_w ) | |
| 2461 | 2456 | { |
| 2462 | 2457 | if (ACCESSING_BITS_8_15) |
| 2463 | | |
| 2458 | write(space, offset, (data >> 8) & 0xff); | |
| 2464 | 2459 | if (ACCESSING_BITS_0_7) |
| 2465 | | |
| 2460 | write(space, offset + 0x2000, data & 0xff); | |
| 2466 | 2461 | } |
| 2467 | 2462 | |
| 2468 | READ16_ | |
| 2463 | READ16_MEMBER( k052109_device::lsb_r ) | |
| 2469 | 2464 | { |
| 2470 | return | |
| 2465 | return read(space, offset); | |
| 2471 | 2466 | } |
| 2472 | 2467 | |
| 2473 | WRITE16_ | |
| 2468 | WRITE16_MEMBER( k052109_device::lsb_w ) | |
| 2474 | 2469 | { |
| 2475 | 2470 | if(ACCESSING_BITS_0_7) |
| 2476 | | |
| 2471 | write(space, offset, data & 0xff); | |
| 2477 | 2472 | } |
| 2478 | 2473 | |
| 2479 | void k052109_set_rmrd_line( | |
| 2474 | void k052109_device::set_rmrd_line( int state ) | |
| 2480 | 2475 | { |
| 2481 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2482 | k052109->rmrd_line = state; | |
| 2476 | m_rmrd_line = state; | |
| 2483 | 2477 | } |
| 2484 | 2478 | |
| 2485 | int k052109_get_rmrd_line( | |
| 2479 | int k052109_device::get_rmrd_line( ) | |
| 2486 | 2480 | { |
| 2487 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2488 | return k052109->rmrd_line; | |
| 2481 | return m_rmrd_line; | |
| 2489 | 2482 | } |
| 2490 | 2483 | |
| 2491 | 2484 | |
| 2492 | void k052109_tilemap_mark_dirty( | |
| 2485 | void k052109_device::tilemap_mark_dirty( int tmap_num ) | |
| 2493 | 2486 | { |
| 2494 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2495 | k052109->tilemap[tmap_num]->mark_all_dirty(); | |
| 2487 | m_tilemap[tmap_num]->mark_all_dirty(); | |
| 2496 | 2488 | } |
| 2497 | 2489 | |
| 2498 | 2490 | |
| 2499 | void k052109_tilemap_update( | |
| 2491 | void k052109_device::tilemap_update( ) | |
| 2500 | 2492 | { |
| 2501 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2502 | 2493 | int xscroll, yscroll, offs; |
| 2503 | 2494 | |
| 2504 | 2495 | #if 0 |
| 2505 | 2496 | { |
| 2506 | 2497 | popmessage("%x %x %x %x", |
| 2507 | k052109->charrombank[0], | |
| 2508 | k052109->charrombank[1], | |
| 2509 | k052109->charrombank[2], | |
| 2510 | k052109->charrombank[3]); | |
| 2498 | m_charrombank[0], | |
| 2499 | m_charrombank[1], | |
| 2500 | m_charrombank[2], | |
| 2501 | m_charrombank[3]); | |
| 2511 | 2502 | } |
| 2512 | 2503 | #endif |
| 2513 | 2504 | |
| 2514 | if (( | |
| 2505 | if ((m_scrollctrl & 0x03) == 0x02) | |
| 2515 | 2506 | { |
| 2516 | UINT8 *scrollram = & | |
| 2507 | UINT8 *scrollram = &m_ram[0x1a00]; | |
| 2517 | 2508 | |
| 2518 | k052109->tilemap[1]->set_scroll_rows(256); | |
| 2519 | k052109->tilemap[1]->set_scroll_cols(1); | |
| 2520 | yscroll = k052109->ram[0x180c]; | |
| 2521 | k052109->tilemap[1]->set_scrolly(0, yscroll + k052109->dy[1]); | |
| 2509 | m_tilemap[1]->set_scroll_rows(256); | |
| 2510 | m_tilemap[1]->set_scroll_cols(1); | |
| 2511 | yscroll = m_ram[0x180c]; | |
| 2512 | m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]); | |
| 2522 | 2513 | for (offs = 0; offs < 256; offs++) |
| 2523 | 2514 | { |
| 2524 | 2515 | xscroll = scrollram[2 * (offs & 0xfff8) + 0] + 256 * scrollram[2 * (offs & 0xfff8) + 1]; |
| 2525 | 2516 | xscroll -= 6; |
| 2526 | | |
| 2517 | m_tilemap[1]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[1]); | |
| 2527 | 2518 | } |
| 2528 | 2519 | } |
| 2529 | else if (( | |
| 2520 | else if ((m_scrollctrl & 0x03) == 0x03) | |
| 2530 | 2521 | { |
| 2531 | UINT8 *scrollram = & | |
| 2522 | UINT8 *scrollram = &m_ram[0x1a00]; | |
| 2532 | 2523 | |
| 2533 | k052109->tilemap[1]->set_scroll_rows(256); | |
| 2534 | k052109->tilemap[1]->set_scroll_cols(1); | |
| 2535 | yscroll = k052109->ram[0x180c]; | |
| 2536 | k052109->tilemap[1]->set_scrolly(0, yscroll + k052109->dy[1]); | |
| 2524 | m_tilemap[1]->set_scroll_rows(256); | |
| 2525 | m_tilemap[1]->set_scroll_cols(1); | |
| 2526 | yscroll = m_ram[0x180c]; | |
| 2527 | m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]); | |
| 2537 | 2528 | for (offs = 0; offs < 256; offs++) |
| 2538 | 2529 | { |
| 2539 | 2530 | xscroll = scrollram[2 * offs + 0] + 256 * scrollram[2 * offs + 1]; |
| 2540 | 2531 | xscroll -= 6; |
| 2541 | | |
| 2532 | m_tilemap[1]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[1]); | |
| 2542 | 2533 | } |
| 2543 | 2534 | } |
| 2544 | else if (( | |
| 2535 | else if ((m_scrollctrl & 0x04) == 0x04) | |
| 2545 | 2536 | { |
| 2546 | UINT8 *scrollram = & | |
| 2537 | UINT8 *scrollram = &m_ram[0x1800]; | |
| 2547 | 2538 | |
| 2548 | k052109->tilemap[1]->set_scroll_rows(1); | |
| 2549 | k052109->tilemap[1]->set_scroll_cols(512); | |
| 2550 | xscroll = k052109->ram[0x1a00] + 256 * k052109->ram[0x1a01]; | |
| 2539 | m_tilemap[1]->set_scroll_rows(1); | |
| 2540 | m_tilemap[1]->set_scroll_cols(512); | |
| 2541 | xscroll = m_ram[0x1a00] + 256 * m_ram[0x1a01]; | |
| 2551 | 2542 | xscroll -= 6; |
| 2552 | | |
| 2543 | m_tilemap[1]->set_scrollx(0, xscroll + m_dx[1]); | |
| 2553 | 2544 | for (offs = 0; offs < 512; offs++) |
| 2554 | 2545 | { |
| 2555 | 2546 | yscroll = scrollram[offs / 8]; |
| 2556 | | |
| 2547 | m_tilemap[1]->set_scrolly((offs + xscroll) & 0x1ff, yscroll + m_dy[1]); | |
| 2557 | 2548 | } |
| 2558 | 2549 | } |
| 2559 | 2550 | else |
| 2560 | 2551 | { |
| 2561 | UINT8 *scrollram = & | |
| 2552 | UINT8 *scrollram = &m_ram[0x1a00]; | |
| 2562 | 2553 | |
| 2563 | k052109->tilemap[1]->set_scroll_rows(1); | |
| 2564 | k052109->tilemap[1]->set_scroll_cols(1); | |
| 2554 | m_tilemap[1]->set_scroll_rows(1); | |
| 2555 | m_tilemap[1]->set_scroll_cols(1); | |
| 2565 | 2556 | xscroll = scrollram[0] + 256 * scrollram[1]; |
| 2566 | 2557 | xscroll -= 6; |
| 2567 | yscroll = k052109->ram[0x180c]; | |
| 2568 | k052109->tilemap[1]->set_scrollx(0, xscroll + k052109->dx[1]); | |
| 2569 | k052109->tilemap[1]->set_scrolly(0, yscroll + k052109->dy[1]); | |
| 2558 | yscroll = m_ram[0x180c]; | |
| 2559 | m_tilemap[1]->set_scrollx(0, xscroll + m_dx[1]); | |
| 2560 | m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]); | |
| 2570 | 2561 | } |
| 2571 | 2562 | |
| 2572 | if (( | |
| 2563 | if ((m_scrollctrl & 0x18) == 0x10) | |
| 2573 | 2564 | { |
| 2574 | UINT8 *scrollram = & | |
| 2565 | UINT8 *scrollram = &m_ram[0x3a00]; | |
| 2575 | 2566 | |
| 2576 | k052109->tilemap[2]->set_scroll_rows(256); | |
| 2577 | k052109->tilemap[2]->set_scroll_cols(1); | |
| 2578 | yscroll = k052109->ram[0x380c]; | |
| 2579 | k052109->tilemap[2]->set_scrolly(0, yscroll + k052109->dy[2]); | |
| 2567 | m_tilemap[2]->set_scroll_rows(256); | |
| 2568 | m_tilemap[2]->set_scroll_cols(1); | |
| 2569 | yscroll = m_ram[0x380c]; | |
| 2570 | m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]); | |
| 2580 | 2571 | for (offs = 0; offs < 256; offs++) |
| 2581 | 2572 | { |
| 2582 | 2573 | xscroll = scrollram[2 * (offs & 0xfff8) + 0] + 256 * scrollram[2 * (offs & 0xfff8) + 1]; |
| 2583 | 2574 | xscroll -= 6; |
| 2584 | | |
| 2575 | m_tilemap[2]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[2]); | |
| 2585 | 2576 | } |
| 2586 | 2577 | } |
| 2587 | else if (( | |
| 2578 | else if ((m_scrollctrl & 0x18) == 0x18) | |
| 2588 | 2579 | { |
| 2589 | UINT8 *scrollram = & | |
| 2580 | UINT8 *scrollram = &m_ram[0x3a00]; | |
| 2590 | 2581 | |
| 2591 | k052109->tilemap[2]->set_scroll_rows(256); | |
| 2592 | k052109->tilemap[2]->set_scroll_cols(1); | |
| 2593 | yscroll = k052109->ram[0x380c]; | |
| 2594 | k052109->tilemap[2]->set_scrolly(0, yscroll + k052109->dy[2]); | |
| 2582 | m_tilemap[2]->set_scroll_rows(256); | |
| 2583 | m_tilemap[2]->set_scroll_cols(1); | |
| 2584 | yscroll = m_ram[0x380c]; | |
| 2585 | m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]); | |
| 2595 | 2586 | for (offs = 0; offs < 256; offs++) |
| 2596 | 2587 | { |
| 2597 | 2588 | xscroll = scrollram[2 * offs + 0] + 256 * scrollram[2 * offs + 1]; |
| 2598 | 2589 | xscroll -= 6; |
| 2599 | | |
| 2590 | m_tilemap[2]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[2]); | |
| 2600 | 2591 | } |
| 2601 | 2592 | } |
| 2602 | else if (( | |
| 2593 | else if ((m_scrollctrl & 0x20) == 0x20) | |
| 2603 | 2594 | { |
| 2604 | UINT8 *scrollram = & | |
| 2595 | UINT8 *scrollram = &m_ram[0x3800]; | |
| 2605 | 2596 | |
| 2606 | k052109->tilemap[2]->set_scroll_rows(1); | |
| 2607 | k052109->tilemap[2]->set_scroll_cols(512); | |
| 2608 | xscroll = k052109->ram[0x3a00] + 256 * k052109->ram[0x3a01]; | |
| 2597 | m_tilemap[2]->set_scroll_rows(1); | |
| 2598 | m_tilemap[2]->set_scroll_cols(512); | |
| 2599 | xscroll = m_ram[0x3a00] + 256 * m_ram[0x3a01]; | |
| 2609 | 2600 | xscroll -= 6; |
| 2610 | | |
| 2601 | m_tilemap[2]->set_scrollx(0, xscroll + m_dx[2]); | |
| 2611 | 2602 | for (offs = 0; offs < 512; offs++) |
| 2612 | 2603 | { |
| 2613 | 2604 | yscroll = scrollram[offs / 8]; |
| 2614 | | |
| 2605 | m_tilemap[2]->set_scrolly((offs + xscroll) & 0x1ff, yscroll + m_dy[2]); | |
| 2615 | 2606 | } |
| 2616 | 2607 | } |
| 2617 | 2608 | else |
| 2618 | 2609 | { |
| 2619 | UINT8 *scrollram = & | |
| 2610 | UINT8 *scrollram = &m_ram[0x3a00]; | |
| 2620 | 2611 | |
| 2621 | k052109->tilemap[2]->set_scroll_rows(1); | |
| 2622 | k052109->tilemap[2]->set_scroll_cols(1); | |
| 2612 | m_tilemap[2]->set_scroll_rows(1); | |
| 2613 | m_tilemap[2]->set_scroll_cols(1); | |
| 2623 | 2614 | xscroll = scrollram[0] + 256 * scrollram[1]; |
| 2624 | 2615 | xscroll -= 6; |
| 2625 | yscroll = k052109->ram[0x380c]; | |
| 2626 | k052109->tilemap[2]->set_scrollx(0, xscroll + k052109->dx[2]); | |
| 2627 | k052109->tilemap[2]->set_scrolly(0, yscroll + k052109->dy[2]); | |
| 2616 | yscroll = m_ram[0x380c]; | |
| 2617 | m_tilemap[2]->set_scrollx(0, xscroll + m_dx[2]); | |
| 2618 | m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]); | |
| 2628 | 2619 | } |
| 2629 | 2620 | |
| 2630 | 2621 | #if 0 |
| 2631 | if ((k052109->scrollctrl & 0x03) == 0x01 || | |
| 2632 | (k052109->scrollctrl & 0x18) == 0x08 || | |
| 2633 | ((k052109->scrollctrl & 0x04) && (k052109->scrollctrl & 0x03)) || | |
| 2634 | ((k052109->scrollctrl & 0x20) && (k052109->scrollctrl & 0x18)) || | |
| 2635 | (k052109->scrollctrl & 0xc0) != 0) | |
| 2636 | popmessage("scrollcontrol = %02x", k052109->scrollctrl); | |
| 2622 | if ((m_scrollctrl & 0x03) == 0x01 || | |
| 2623 | (m_scrollctrl & 0x18) == 0x08 || | |
| 2624 | ((m_scrollctrl & 0x04) && (m_scrollctrl & 0x03)) || | |
| 2625 | ((m_scrollctrl & 0x20) && (m_scrollctrl & 0x18)) || | |
| 2626 | (m_scrollctrl & 0xc0) != 0) | |
| 2627 | popmessage("scrollcontrol = %02x", m_scrollctrl); | |
| 2637 | 2628 | |
| 2638 | if (machine.input().code_pressed(KEYCODE_F)) | |
| 2629 | if (machine().input().code_pressed(KEYCODE_F)) | |
| 2639 | 2630 | { |
| 2640 | 2631 | FILE *fp; |
| 2641 | 2632 | fp=fopen("TILE.DMP", "w+b"); |
| 2642 | 2633 | if (fp) |
| 2643 | 2634 | { |
| 2644 | fwrite( | |
| 2635 | fwrite(m_ram, 0x6000, 1, fp); | |
| 2645 | 2636 | popmessage("saved"); |
| 2646 | 2637 | fclose(fp); |
| 2647 | 2638 | } |
| r24078 | r24079 | |
| 2649 | 2640 | #endif |
| 2650 | 2641 | } |
| 2651 | 2642 | |
| 2652 | void k052109_tilemap_draw( | |
| 2643 | void k052109_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority ) | |
| 2653 | 2644 | { |
| 2654 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2655 | k052109->tilemap[tmap_num]->draw(bitmap, cliprect, flags, priority); | |
| 2645 | m_tilemap[tmap_num]->draw(bitmap, cliprect, flags, priority); | |
| 2656 | 2646 | } |
| 2657 | 2647 | |
| 2658 | int k052109_is_irq_enabled( | |
| 2648 | int k052109_device::is_irq_enabled( ) | |
| 2659 | 2649 | { |
| 2660 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2661 | ||
| 2662 | return k052109->irq_enabled; | |
| 2650 | return m_irq_enabled; | |
| 2663 | 2651 | } |
| 2664 | 2652 | |
| 2665 | void k052109_set_layer_offsets( | |
| 2653 | void k052109_device::set_layer_offsets( int layer, int dx, int dy ) | |
| 2666 | 2654 | { |
| 2667 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2668 | ||
| 2669 | k052109->dx[layer] = dx; | |
| 2670 | k052109->dy[layer] = dy; | |
| 2655 | m_dx[layer] = dx; | |
| 2656 | m_dy[layer] = dy; | |
| 2671 | 2657 | } |
| 2672 | 2658 | |
| 2673 | 2659 | |
| r24078 | r24079 | |
| 2688 | 2674 | color RAM ------xx depends on external connections (usually banking, flip) |
| 2689 | 2675 | */ |
| 2690 | 2676 | |
| 2691 | ||
| 2677 | void k052109_device::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram1, UINT8 *vram2 ) | |
| 2692 | 2678 | { |
| 2693 | k052109_state *k052109 = k052109_get_safe_token(device); | |
| 2694 | 2679 | int flipy = 0; |
| 2695 | 2680 | int code = vram1[tile_index] + 256 * vram2[tile_index]; |
| 2696 | 2681 | int color = cram[tile_index]; |
| 2697 | 2682 | int flags = 0; |
| 2698 | 2683 | int priority = 0; |
| 2699 | int bank = k052109->charrombank[(color & 0x0c) >> 2]; | |
| 2700 | if (k052109->has_extra_video_ram) | |
| 2684 | int bank = m_charrombank[(color & 0x0c) >> 2]; | |
| 2685 | if (m_has_extra_video_ram) | |
| 2701 | 2686 | bank = (color & 0x0c) >> 2; /* kludge for X-Men */ |
| 2702 | 2687 | |
| 2703 | 2688 | color = (color & 0xf3) | ((bank & 0x03) << 2); |
| r24078 | r24079 | |
| 2705 | 2690 | |
| 2706 | 2691 | flipy = color & 0x02; |
| 2707 | 2692 | |
| 2708 | | |
| 2693 | m_callback(machine(), layer, bank, &code, &color, &flags, &priority); | |
| 2709 | 2694 | |
| 2710 | 2695 | /* if the callback set flip X but it is not enabled, turn it off */ |
| 2711 | if (!( | |
| 2696 | if (!(m_tileflip_enable & 1)) | |
| 2712 | 2697 | flags &= ~TILE_FLIPX; |
| 2713 | 2698 | |
| 2714 | 2699 | /* if flip Y is enabled and the attribute but is set, turn it on */ |
| 2715 | if (flipy && ( | |
| 2700 | if (flipy && (m_tileflip_enable & 2)) | |
| 2716 | 2701 | flags |= TILE_FLIPY; |
| 2717 | 2702 | |
| 2718 | SET_TILE_INFO( | |
| 2719 | k052109->gfxnum, | |
| 2703 | SET_TILE_INFO_MEMBER( | |
| 2704 | m_gfx_num, | |
| 2720 | 2705 | code, |
| 2721 | 2706 | color, |
| 2722 | 2707 | flags); |
| r24078 | r24079 | |
| 2724 | 2709 | tileinfo.category = priority; |
| 2725 | 2710 | } |
| 2726 | 2711 | |
| 2727 | TILE_GET_INFO_MEMBER(k052109_device:: | |
| 2712 | TILE_GET_INFO_MEMBER(k052109_device::get_tile_info0) | |
| 2728 | 2713 | { |
| 2729 | k052109_state *k052109 = k052109_get_safe_token(this); | |
| 2730 | k052109_get_tile_info(machine(), this, tileinfo, tile_index, 0, k052109->colorram_F, k052109->videoram_F, k052109->videoram2_F); | |
| 2714 | get_tile_info(tileinfo, tile_index, 0, m_colorram_F, m_videoram_F, m_videoram2_F); | |
| 2731 | 2715 | } |
| 2732 | 2716 | |
| 2733 | TILE_GET_INFO_MEMBER(k052109_device:: | |
| 2717 | TILE_GET_INFO_MEMBER(k052109_device::get_tile_info1) | |
| 2734 | 2718 | { |
| 2735 | k052109_state *k052109 = k052109_get_safe_token(this); | |
| 2736 | k052109_get_tile_info(machine(), this, tileinfo, tile_index, 1, k052109->colorram_A, k052109->videoram_A, k052109->videoram2_A); | |
| 2719 | get_tile_info(tileinfo, tile_index, 1, m_colorram_A, m_videoram_A, m_videoram2_A); | |
| 2737 | 2720 | } |
| 2738 | 2721 | |
| 2739 | TILE_GET_INFO_MEMBER(k052109_device:: | |
| 2722 | TILE_GET_INFO_MEMBER(k052109_device::get_tile_info2) | |
| 2740 | 2723 | { |
| 2741 | k052109_state *k052109 = k052109_get_safe_token(this); | |
| 2742 | k052109_get_tile_info(machine(), this, tileinfo, tile_index, 2, k052109->colorram_B, k052109->videoram_B, k052109->videoram2_B); | |
| 2724 | get_tile_info(tileinfo, tile_index, 2, m_colorram_B, m_videoram_B, m_videoram2_B); | |
| 2743 | 2725 | } |
| 2744 | 2726 | |
| 2745 | 2727 | |
| 2746 | ||
| 2728 | void k052109_device::tileflip_reset() | |
| 2747 | 2729 | { |
| 2748 | int data = k052109->ram[0x1e80]; | |
| 2749 | k052109->tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2750 | k052109->tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2751 | k052109->tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2752 | k052109->tileflip_enable = ((data & 0x06) >> 1); | |
| 2730 | int data = m_ram[0x1e80]; | |
| 2731 | m_tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2732 | m_tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2733 | m_tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); | |
| 2734 | m_tileflip_enable = ((data & 0x06) >> 1); | |
| 2753 | 2735 | } |
| 2754 | 2736 | |
| 2755 | const device_type K052109 = &device_creator<k052109_device>; | |
| 2756 | 2737 | |
| 2757 | k052109_device::k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 2758 | : device_t(mconfig, K052109, "Konami 052109", tag, owner, clock, "k052109", __FILE__) | |
| 2738 | /***************************************************************************/ | |
| 2739 | /* */ | |
| 2740 | /* 051960 */ | |
| 2741 | /* */ | |
| 2742 | /***************************************************************************/ | |
| 2743 | ||
| 2744 | const device_type K051960 = &device_creator<k051960_device>; | |
| 2745 | ||
| 2746 | k051960_device::k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 2747 | : device_t(mconfig, K051960, "Konami 051960", tag, owner, clock, "k051960", __FILE__), | |
| 2748 | m_ram(NULL), | |
| 2749 | m_gfx(NULL), | |
| 2750 | //m_spriterombank[3], | |
| 2751 | m_dx(0), | |
| 2752 | m_dy(0), | |
| 2753 | m_romoffset(0), | |
| 2754 | m_spriteflip(0), | |
| 2755 | m_readroms(0), | |
| 2756 | m_irq_enabled(0), | |
| 2757 | m_nmi_enabled(0), | |
| 2758 | m_k051937_counter(0) | |
| 2759 | 2759 | { |
| 2760 | m_token = global_alloc_clear(k052109_state); | |
| 2761 | 2760 | } |
| 2762 | 2761 | |
| 2763 | 2762 | //------------------------------------------------- |
| r24078 | r24079 | |
| 2766 | 2765 | // complete |
| 2767 | 2766 | //------------------------------------------------- |
| 2768 | 2767 | |
| 2769 | void k05 | |
| 2768 | void k051960_device::device_config_complete() | |
| 2770 | 2769 | { |
| 2770 | // inherit a copy of the static data | |
| 2771 | const k051960_interface *intf = reinterpret_cast<const k051960_interface *>(static_config()); | |
| 2772 | if (intf != NULL) | |
| 2773 | *static_cast<k051960_interface *>(this) = *intf; | |
| 2774 | ||
| 2775 | // or initialize to defaults if none provided | |
| 2776 | else | |
| 2777 | { | |
| 2778 | m_gfx_memory_region = ""; | |
| 2779 | m_gfx_num = 0; | |
| 2780 | m_plane_order = 0; | |
| 2781 | m_deinterleave = 0; | |
| 2782 | m_callback = NULL; | |
| 2783 | } | |
| 2771 | 2784 | } |
| 2772 | 2785 | |
| 2773 | 2786 | //------------------------------------------------- |
| 2774 | 2787 | // device_start - device-specific startup |
| 2775 | 2788 | //------------------------------------------------- |
| 2776 | 2789 | |
| 2777 | void k05 | |
| 2790 | void k051960_device::device_start() | |
| 2778 | 2791 | { |
| 2779 | k052109_state *k052109 = k052109_get_safe_token(this); | |
| 2780 | const k052109_interface *intf = k052109_get_interface(this); | |
| 2781 | 2792 | UINT32 total; |
| 2782 | static const gfx_layout | |
| 2793 | static const gfx_layout spritelayout = | |
| 2783 | 2794 | { |
| 2784 | | |
| 2795 | 16,16, | |
| 2785 | 2796 | 0, |
| 2786 | 2797 | 4, |
| 2798 | { 0, 8, 16, 24 }, | |
| 2799 | { 0, 1, 2, 3, 4, 5, 6, 7, | |
| 2800 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, | |
| 2801 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 2802 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, | |
| 2803 | 128*8 | |
| 2804 | }; | |
| 2805 | static const gfx_layout spritelayout_reverse = | |
| 2806 | { | |
| 2807 | 16,16, | |
| 2808 | 0, | |
| 2809 | 4, | |
| 2787 | 2810 | { 24, 16, 8, 0 }, |
| 2788 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 2789 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 2790 | 32*8 | |
| 2811 | { 0, 1, 2, 3, 4, 5, 6, 7, | |
| 2812 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, | |
| 2813 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 2814 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, | |
| 2815 | 128*8 | |
| 2791 | 2816 | }; |
| 2792 | static const gfx_layout | |
| 2817 | static const gfx_layout spritelayout_gradius3 = | |
| 2793 | 2818 | { |
| 2794 | | |
| 2819 | 16,16, | |
| 2795 | 2820 | 0, |
| 2796 | 2821 | 4, |
| 2797 | 2822 | { 0, 1, 2, 3 }, |
| 2798 | { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 }, | |
| 2799 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, | |
| 2800 | 32*8 | |
| 2823 | { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4, | |
| 2824 | 32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 }, | |
| 2825 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 2826 | 64*8+0*32, 64*8+1*32, 64*8+2*32, 64*8+3*32, 64*8+4*32, 64*8+5*32, 64*8+6*32, 64*8+7*32 }, | |
| 2827 | 128*8 | |
| 2801 | 2828 | }; |
| 2802 | 2829 | |
| 2803 | ||
| 2804 | 2830 | /* decode the graphics */ |
| 2805 | switch ( | |
| 2831 | switch (m_plane_order) | |
| 2806 | 2832 | { |
| 2807 | 2833 | case NORMAL_PLANE_ORDER: |
| 2808 | total = machine().root_device().memregion(intf->gfx_memory_region)->bytes() / 32; | |
| 2809 | decode_gfx(machine(), intf->gfx_num, machine().root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout, 4); | |
| 2834 | total = machine().root_device().memregion(m_gfx_memory_region)->bytes() / 128; | |
| 2835 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &spritelayout, 4); | |
| 2810 | 2836 | break; |
| 2811 | 2837 | |
| 2838 | case REVERSE_PLANE_ORDER: | |
| 2839 | total = machine().root_device().memregion(m_gfx_memory_region)->bytes() / 128; | |
| 2840 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &spritelayout_reverse, 4); | |
| 2841 | break; | |
| 2842 | ||
| 2812 | 2843 | case GRADIUS3_PLANE_ORDER: |
| 2813 | total = 0x1000; | |
| 2814 | decode_gfx(machine(), intf->gfx_num, machine().root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout_gradius3, 4); | |
| 2844 | total = 0x4000; | |
| 2845 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &spritelayout_gradius3, 4); | |
| 2815 | 2846 | break; |
| 2816 | 2847 | |
| 2817 | 2848 | default: |
| 2818 | fatalerror("Un | |
| 2849 | fatalerror("Unknown plane_order\n"); | |
| 2819 | 2850 | } |
| 2820 | 2851 | |
| 2852 | if (VERBOSE && !(machine().config().m_video_attributes & VIDEO_HAS_SHADOWS)) | |
| 2853 | popmessage("driver should use VIDEO_HAS_SHADOWS"); | |
| 2854 | ||
| 2821 | 2855 | /* deinterleave the graphics, if needed */ |
| 2822 | deinterleave_gfx(machine(), | |
| 2856 | deinterleave_gfx(machine(), m_gfx_memory_region, m_deinterleave); | |
| 2823 | 2857 | |
| 2824 | k052109->memory_region = intf->gfx_memory_region; | |
| 2825 | k052109->gfxnum = intf->gfx_num; | |
| 2826 | k052109->callback = intf->callback; | |
| 2858 | m_gfx = machine().gfx[m_gfx_num]; | |
| 2859 | m_ram = auto_alloc_array_clear(machine(), UINT8, 0x400); | |
| 2827 | 2860 | |
| 2828 | k052109->tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::k052109_get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2829 | k052109->tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::k052109_get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2830 | k052109->tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::k052109_get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); | |
| 2861 | save_item(NAME(m_romoffset)); | |
| 2862 | save_item(NAME(m_spriteflip)); | |
| 2863 | save_item(NAME(m_readroms)); | |
| 2864 | save_item(NAME(m_spriterombank)); | |
| 2865 | save_pointer(NAME(m_ram), 0x400); | |
| 2866 | save_item(NAME(m_irq_enabled)); | |
| 2867 | save_item(NAME(m_nmi_enabled)); | |
| 2868 | save_item(NAME(m_dx)); | |
| 2869 | save_item(NAME(m_dy)); | |
| 2831 | 2870 | |
| 2832 | k052109->ram = auto_alloc_array_clear(machine(), UINT8, 0x6000); | |
| 2833 | ||
| 2834 | k052109->colorram_F = &k052109->ram[0x0000]; | |
| 2835 | k052109->colorram_A = &k052109->ram[0x0800]; | |
| 2836 | k052109->colorram_B = &k052109->ram[0x1000]; | |
| 2837 | k052109->videoram_F = &k052109->ram[0x2000]; | |
| 2838 | k052109->videoram_A = &k052109->ram[0x2800]; | |
| 2839 | k052109->videoram_B = &k052109->ram[0x3000]; | |
| 2840 | k052109->videoram2_F = &k052109->ram[0x4000]; | |
| 2841 | k052109->videoram2_A = &k052109->ram[0x4800]; | |
| 2842 | k052109->videoram2_B = &k052109->ram[0x5000]; | |
| 2843 | ||
| 2844 | k052109->tilemap[0]->set_transparent_pen(0); | |
| 2845 | k052109->tilemap[1]->set_transparent_pen(0); | |
| 2846 | k052109->tilemap[2]->set_transparent_pen(0); | |
| 2847 | ||
| 2848 | save_pointer(NAME(k052109->ram), 0x6000); | |
| 2849 | save_item(NAME(k052109->rmrd_line)); | |
| 2850 | save_item(NAME(k052109->romsubbank)); | |
| 2851 | save_item(NAME(k052109->scrollctrl)); | |
| 2852 | save_item(NAME(k052109->irq_enabled)); | |
| 2853 | save_item(NAME(k052109->charrombank)); | |
| 2854 | save_item(NAME(k052109->charrombank_2)); | |
| 2855 | save_item(NAME(k052109->dx)); | |
| 2856 | save_item(NAME(k052109->dy)); | |
| 2857 | save_item(NAME(k052109->has_extra_video_ram)); | |
| 2858 | machine().save().register_postload(save_prepost_delegate(FUNC(k052109_tileflip_reset), k052109)); | |
| 2871 | save_item(NAME(m_k051937_counter)); | |
| 2859 | 2872 | } |
| 2860 | 2873 | |
| 2861 | 2874 | //------------------------------------------------- |
| 2862 | 2875 | // device_reset - device-specific reset |
| 2863 | 2876 | //------------------------------------------------- |
| 2864 | 2877 | |
| 2865 | void k05 | |
| 2878 | void k051960_device::device_reset() | |
| 2866 | 2879 | { |
| 2867 | k052109_state *k052109 = k052109_get_safe_token(this); | |
| 2868 | int i; | |
| 2880 | ||
| 2881 | m_dx = m_dy = 0; | |
| 2882 | m_k051937_counter = 0; | |
| 2869 | 2883 | |
| 2870 | k052109->rmrd_line = CLEAR_LINE; | |
| 2871 | k052109->irq_enabled = 0; | |
| 2872 | k052109->romsubbank = 0; | |
| 2873 | k052109->scrollctrl = 0; | |
| 2884 | m_romoffset = 0; | |
| 2885 | m_spriteflip = 0; | |
| 2886 | m_readroms = 0; | |
| 2887 | m_irq_enabled = 0; | |
| 2888 | m_nmi_enabled = 0; | |
| 2874 | 2889 | |
| 2875 | k052109->has_extra_video_ram = 0; | |
| 2876 | ||
| 2877 | for (i = 0; i < 3; i++) | |
| 2878 | k052109->dx[i] = k052109->dy[i] = 0; | |
| 2879 | ||
| 2880 | for (i = 0; i < 4; i++) | |
| 2881 | { | |
| 2882 | k052109->charrombank[i] = 0; | |
| 2883 | k052109->charrombank_2[i] = 0; | |
| 2884 | } | |
| 2890 | m_spriterombank[0] = 0; | |
| 2891 | m_spriterombank[1] = 0; | |
| 2892 | m_spriterombank[2] = 0; | |
| 2885 | 2893 | } |
| 2886 | 2894 | |
| 2887 | 2895 | |
| 2888 | ||
| 2889 | /***************************************************************************/ | |
| 2890 | /* */ | |
| 2891 | /* 051960 */ | |
| 2892 | /* */ | |
| 2893 | /***************************************************************************/ | |
| 2894 | ||
| 2895 | struct k051960_state | |
| 2896 | { | |
| 2897 | UINT8 *ram; | |
| 2898 | ||
| 2899 | gfx_element *gfx; | |
| 2900 | ||
| 2901 | UINT8 spriterombank[3]; | |
| 2902 | int dx, dy; | |
| 2903 | int romoffset; | |
| 2904 | int spriteflip, readroms; | |
| 2905 | int irq_enabled, nmi_enabled; | |
| 2906 | ||
| 2907 | int k051937_counter; | |
| 2908 | ||
| 2909 | k051960_callback callback; | |
| 2910 | ||
| 2911 | const char *memory_region; | |
| 2912 | }; | |
| 2913 | ||
| 2914 | ||
| 2915 | 2896 | /***************************************************************************** |
| 2916 | INLINE FUNCTIONS | |
| 2917 | *****************************************************************************/ | |
| 2918 | ||
| 2919 | INLINE k051960_state *k051960_get_safe_token( device_t *device ) | |
| 2920 | { | |
| 2921 | assert(device != NULL); | |
| 2922 | assert(device->type() == K051960); | |
| 2923 | ||
| 2924 | return (k051960_state *)downcast<k051960_device *>(device)->token(); | |
| 2925 | } | |
| 2926 | ||
| 2927 | INLINE const k051960_interface *k051960_get_interface( device_t *device ) | |
| 2928 | { | |
| 2929 | assert(device != NULL); | |
| 2930 | assert((device->type() == K051960)); | |
| 2931 | return (const k051960_interface *) device->static_config(); | |
| 2932 | } | |
| 2933 | ||
| 2934 | /***************************************************************************** | |
| 2935 | 2897 | DEVICE HANDLERS |
| 2936 | 2898 | *****************************************************************************/ |
| 2937 | 2899 | |
| 2938 | ||
| 2900 | int k051960_device::k051960_fetchromdata( int byte ) | |
| 2939 | 2901 | { |
| 2940 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 2941 | 2902 | int code, color, pri, shadow, off1, addr; |
| 2942 | 2903 | |
| 2943 | addr = | |
| 2904 | addr = m_romoffset + (m_spriterombank[0] << 8) + ((m_spriterombank[1] & 0x03) << 16); | |
| 2944 | 2905 | code = (addr & 0x3ffe0) >> 5; |
| 2945 | 2906 | off1 = addr & 0x1f; |
| 2946 | color = (( | |
| 2907 | color = ((m_spriterombank[1] & 0xfc) >> 2) + ((m_spriterombank[2] & 0x03) << 6); | |
| 2947 | 2908 | pri = 0; |
| 2948 | 2909 | shadow = color & 0x80; |
| 2949 | | |
| 2910 | m_callback(machine(), &code, &color, &pri, &shadow); | |
| 2950 | 2911 | |
| 2951 | 2912 | addr = (code << 7) | (off1 << 2) | byte; |
| 2952 | addr &= | |
| 2913 | addr &= machine().root_device().memregion(m_gfx_memory_region)->bytes() - 1; | |
| 2953 | 2914 | |
| 2954 | // popmessage("%s: addr %06x", | |
| 2915 | // popmessage("%s: addr %06x", machine().describe_context(), addr); | |
| 2955 | 2916 | |
| 2956 | return | |
| 2917 | return machine().root_device().memregion(m_gfx_memory_region)->base()[addr]; | |
| 2957 | 2918 | } |
| 2958 | 2919 | |
| 2959 | READ8_ | |
| 2920 | READ8_MEMBER( k051960_device::k051960_r ) | |
| 2960 | 2921 | { |
| 2961 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 2962 | if (k051960->readroms) | |
| 2922 | if (m_readroms) | |
| 2963 | 2923 | { |
| 2964 | 2924 | /* the 051960 remembers the last address read and uses it when reading the sprite ROMs */ |
| 2965 | k051960->romoffset = (offset & 0x3fc) >> 2; | |
| 2966 | return k051960_fetchromdata(device, offset & 3); /* only 88 Games reads the ROMs from here */ | |
| 2925 | m_romoffset = (offset & 0x3fc) >> 2; | |
| 2926 | return k051960_fetchromdata(offset & 3); /* only 88 Games reads the ROMs from here */ | |
| 2967 | 2927 | } |
| 2968 | 2928 | else |
| 2969 | return | |
| 2929 | return m_ram[offset]; | |
| 2970 | 2930 | } |
| 2971 | 2931 | |
| 2972 | WRITE8_ | |
| 2932 | WRITE8_MEMBER( k051960_device::k051960_w ) | |
| 2973 | 2933 | { |
| 2974 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 2975 | k051960->ram[offset] = data; | |
| 2934 | m_ram[offset] = data; | |
| 2976 | 2935 | } |
| 2977 | 2936 | |
| 2978 | READ16_ | |
| 2937 | READ16_MEMBER( k051960_device::k051960_word_r ) | |
| 2979 | 2938 | { |
| 2980 | return k051960_r( | |
| 2939 | return k051960_r(space, offset * 2 + 1) | (k051960_r(space, offset * 2) << 8); | |
| 2981 | 2940 | } |
| 2982 | 2941 | |
| 2983 | WRITE16_ | |
| 2942 | WRITE16_MEMBER( k051960_device::k051960_word_w ) | |
| 2984 | 2943 | { |
| 2985 | 2944 | if (ACCESSING_BITS_8_15) |
| 2986 | k051960_w( | |
| 2945 | k051960_w(space, offset * 2, (data >> 8) & 0xff); | |
| 2987 | 2946 | if (ACCESSING_BITS_0_7) |
| 2988 | k051960_w( | |
| 2947 | k051960_w(space, offset * 2 + 1, data & 0xff); | |
| 2989 | 2948 | } |
| 2990 | 2949 | |
| 2991 | 2950 | |
| 2992 | 2951 | /* should this be split by k051960? */ |
| 2993 | READ8_ | |
| 2952 | READ8_MEMBER( k051960_device::k051937_r ) | |
| 2994 | 2953 | { |
| 2995 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 2996 | ||
| 2997 | if (k051960->readroms && offset >= 4 && offset < 8) | |
| 2998 | return k051960_fetchromdata(device, offset & 3); | |
| 2954 | if (m_readroms && offset >= 4 && offset < 8) | |
| 2955 | return k051960_fetchromdata(offset & 3); | |
| 2999 | 2956 | else |
| 3000 | 2957 | { |
| 3001 | 2958 | if (offset == 0) |
| 3002 | 2959 | { |
| 3003 | 2960 | /* some games need bit 0 to pulse */ |
| 3004 | return ( | |
| 2961 | return (m_k051937_counter++) & 1; | |
| 3005 | 2962 | } |
| 3006 | 2963 | //logerror("%04x: read unknown 051937 address %x\n", device->cpu->safe_pc(), offset); |
| 3007 | 2964 | return 0; |
| r24078 | r24079 | |
| 3010 | 2967 | return 0; |
| 3011 | 2968 | } |
| 3012 | 2969 | |
| 3013 | WRITE8_ | |
| 2970 | WRITE8_MEMBER( k051960_device::k051937_w ) | |
| 3014 | 2971 | { |
| 3015 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3016 | ||
| 3017 | 2972 | if (offset == 0) |
| 3018 | 2973 | { |
| 3019 | 2974 | //if (data & 0xc2) popmessage("051937 reg 00 = %02x",data); |
| 3020 | 2975 | |
| 3021 | 2976 | /* bit 0 is IRQ enable */ |
| 3022 | | |
| 2977 | m_irq_enabled = data & 0x01; | |
| 3023 | 2978 | |
| 3024 | 2979 | /* bit 1: probably FIRQ enable */ |
| 3025 | 2980 | |
| 3026 | 2981 | /* bit 2 is NMI enable */ |
| 3027 | | |
| 2982 | m_nmi_enabled = data & 0x04; | |
| 3028 | 2983 | |
| 3029 | 2984 | /* bit 3 = flip screen */ |
| 3030 | | |
| 2985 | m_spriteflip = data & 0x08; | |
| 3031 | 2986 | |
| 3032 | 2987 | /* bit 4 used by Devastators and TMNT, unknown */ |
| 3033 | 2988 | |
| 3034 | 2989 | /* bit 5 = enable gfx ROM reading */ |
| 3035 | k051960->readroms = data & 0x20; | |
| 3036 | //logerror("%04x: write %02x to 051937 address %x\n", machine.cpu->safe_pc(), data, offset); | |
| 2990 | m_readroms = data & 0x20; | |
| 2991 | //logerror("%04x: write %02x to 051937 address %x\n", machine().cpu->safe_pc(), data, offset); | |
| 3037 | 2992 | } |
| 3038 | 2993 | else if (offset == 1) |
| 3039 | 2994 | { |
| 3040 | // popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset); | |
| 3041 | //logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset); | |
| 2995 | // popmessage("%04x: write %02x to 051937 address %x", machine().cpu->safe_pc(), data, offset); | |
| 2996 | //logerror("%04x: write %02x to unknown 051937 address %x\n", machine().cpu->safe_pc(), data, offset); | |
| 3042 | 2997 | } |
| 3043 | 2998 | else if (offset >= 2 && offset < 5) |
| 3044 | 2999 | { |
| 3045 | | |
| 3000 | m_spriterombank[offset - 2] = data; | |
| 3046 | 3001 | } |
| 3047 | 3002 | else |
| 3048 | 3003 | { |
| 3049 | // popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset); | |
| 3050 | //logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset); | |
| 3004 | // popmessage("%04x: write %02x to 051937 address %x", machine().cpu->safe_pc(), data, offset); | |
| 3005 | //logerror("%04x: write %02x to unknown 051937 address %x\n", machine().cpu->safe_pc(), data, offset); | |
| 3051 | 3006 | } |
| 3052 | 3007 | } |
| 3053 | 3008 | |
| 3054 | int k051960_is_irq_enabled( | |
| 3009 | int k051960_device::k051960_is_irq_enabled( ) | |
| 3055 | 3010 | { |
| 3056 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3057 | return k051960->irq_enabled; | |
| 3011 | return m_irq_enabled; | |
| 3058 | 3012 | } |
| 3059 | 3013 | |
| 3060 | int k051960_is_nmi_enabled( | |
| 3014 | int k051960_device::k051960_is_nmi_enabled( ) | |
| 3061 | 3015 | { |
| 3062 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3063 | return k051960->nmi_enabled; | |
| 3016 | return m_nmi_enabled; | |
| 3064 | 3017 | } |
| 3065 | 3018 | |
| 3066 | void k051960_set_sprite_offsets( | |
| 3019 | void k051960_device::k051960_set_sprite_offsets( int dx, int dy ) | |
| 3067 | 3020 | { |
| 3068 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3069 | k051960->dx = dx; | |
| 3070 | k051960->dy = dy; | |
| 3021 | m_dx = dx; | |
| 3022 | m_dy = dy; | |
| 3071 | 3023 | } |
| 3072 | 3024 | |
| 3073 | 3025 | |
| 3074 | READ16_ | |
| 3026 | READ16_MEMBER( k051960_device::k051937_word_r ) | |
| 3075 | 3027 | { |
| 3076 | return k051937_r( | |
| 3028 | return k051937_r(space, offset * 2 + 1) | (k051937_r(space, offset * 2) << 8); | |
| 3077 | 3029 | } |
| 3078 | 3030 | |
| 3079 | WRITE16_ | |
| 3031 | WRITE16_MEMBER( k051960_device::k051937_word_w ) | |
| 3080 | 3032 | { |
| 3081 | 3033 | if (ACCESSING_BITS_8_15) |
| 3082 | k051937_w( | |
| 3034 | k051937_w(space, offset * 2,(data >> 8) & 0xff); | |
| 3083 | 3035 | if (ACCESSING_BITS_0_7) |
| 3084 | k051937_w( | |
| 3036 | k051937_w(space, offset * 2 + 1,data & 0xff); | |
| 3085 | 3037 | } |
| 3086 | 3038 | |
| 3087 | 3039 | /* |
| r24078 | r24079 | |
| 3116 | 3068 | * Note that Aliens also uses the shadow bit to select the second sprite bank. |
| 3117 | 3069 | */ |
| 3118 | 3070 | |
| 3119 | void k051960_sprites_draw( | |
| 3071 | void k051960_device::k051960_sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int min_priority, int max_priority ) | |
| 3120 | 3072 | { |
| 3121 | 3073 | #define NUM_SPRITES 128 |
| 3122 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3123 | running_machine &machine = device->machine(); | |
| 3124 | 3074 | int offs, pri_code; |
| 3125 | 3075 | int sortedlist[NUM_SPRITES]; |
| 3126 | 3076 | UINT8 drawmode_table[256]; |
| r24078 | r24079 | |
| 3134 | 3084 | /* prebuild a sorted table */ |
| 3135 | 3085 | for (offs = 0; offs < 0x400; offs += 8) |
| 3136 | 3086 | { |
| 3137 | if ( | |
| 3087 | if (m_ram[offs] & 0x80) | |
| 3138 | 3088 | { |
| 3139 | 3089 | if (max_priority == -1) /* draw front to back when using priority buffer */ |
| 3140 | sortedlist[( | |
| 3090 | sortedlist[(m_ram[offs] & 0x7f) ^ 0x7f] = offs; | |
| 3141 | 3091 | else |
| 3142 | sortedlist[ | |
| 3092 | sortedlist[m_ram[offs] & 0x7f] = offs; | |
| 3143 | 3093 | } |
| 3144 | 3094 | } |
| 3145 | 3095 | |
| r24078 | r24079 | |
| 3165 | 3115 | if (offs == -1) |
| 3166 | 3116 | continue; |
| 3167 | 3117 | |
| 3168 | code = k051960->ram[offs + 2] + ((k051960->ram[offs + 1] & 0x1f) << 8); | |
| 3169 | color = k051960->ram[offs + 3] & 0xff; | |
| 3118 | code = m_ram[offs + 2] + ((m_ram[offs + 1] & 0x1f) << 8); | |
| 3119 | color = m_ram[offs + 3] & 0xff; | |
| 3170 | 3120 | pri = 0; |
| 3171 | 3121 | shadow = color & 0x80; |
| 3172 | | |
| 3122 | m_callback(machine(), &code, &color, &pri, &shadow); | |
| 3173 | 3123 | |
| 3174 | 3124 | if (max_priority != -1) |
| 3175 | 3125 | if (pri < min_priority || pri > max_priority) |
| 3176 | 3126 | continue; |
| 3177 | 3127 | |
| 3178 | size = ( | |
| 3128 | size = (m_ram[offs + 1] & 0xe0) >> 5; | |
| 3179 | 3129 | w = width[size]; |
| 3180 | 3130 | h = height[size]; |
| 3181 | 3131 | |
| r24078 | r24079 | |
| 3186 | 3136 | if (w >= 8) code &= ~0x10; |
| 3187 | 3137 | if (h >= 8) code &= ~0x20; |
| 3188 | 3138 | |
| 3189 | ox = (256 * k051960->ram[offs + 6] + k051960->ram[offs + 7]) & 0x01ff; | |
| 3190 | oy = 256 - ((256 * k051960->ram[offs + 4] + k051960->ram[offs + 5]) & 0x01ff); | |
| 3191 | ox += k051960->dx; | |
| 3192 | oy += k051960->dy; | |
| 3193 | flipx = k051960->ram[offs + 6] & 0x02; | |
| 3194 | flipy = k051960->ram[offs + 4] & 0x02; | |
| 3195 | zoomx = (k051960->ram[offs + 6] & 0xfc) >> 2; | |
| 3196 | zoomy = (k051960->ram[offs + 4] & 0xfc) >> 2; | |
| 3139 | ox = (256 * m_ram[offs + 6] + m_ram[offs + 7]) & 0x01ff; | |
| 3140 | oy = 256 - ((256 * m_ram[offs + 4] + m_ram[offs + 5]) & 0x01ff); | |
| 3141 | ox += m_dx; | |
| 3142 | oy += m_dy; | |
| 3143 | flipx = m_ram[offs + 6] & 0x02; | |
| 3144 | flipy = m_ram[offs + 4] & 0x02; | |
| 3145 | zoomx = (m_ram[offs + 6] & 0xfc) >> 2; | |
| 3146 | zoomy = (m_ram[offs + 4] & 0xfc) >> 2; | |
| 3197 | 3147 | zoomx = 0x10000 / 128 * (128 - zoomx); |
| 3198 | 3148 | zoomy = 0x10000 / 128 * (128 - zoomy); |
| 3199 | 3149 | |
| 3200 | if ( | |
| 3150 | if (m_spriteflip) | |
| 3201 | 3151 | { |
| 3202 | 3152 | ox = 512 - (zoomx * w >> 12) - ox; |
| 3203 | 3153 | oy = 256 - (zoomy * h >> 12) - oy; |
| r24078 | r24079 | |
| 3205 | 3155 | flipy = !flipy; |
| 3206 | 3156 | } |
| 3207 | 3157 | |
| 3208 | drawmode_table[ | |
| 3158 | drawmode_table[m_gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 3209 | 3159 | |
| 3210 | 3160 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 3211 | 3161 | { |
| r24078 | r24079 | |
| 3231 | 3181 | c += yoffset[y]; |
| 3232 | 3182 | |
| 3233 | 3183 | if (max_priority == -1) |
| 3234 | pdrawgfx_transtable(bitmap,cliprect, | |
| 3184 | pdrawgfx_transtable(bitmap,cliprect,m_gfx, | |
| 3235 | 3185 | c, |
| 3236 | 3186 | color, |
| 3237 | 3187 | flipx,flipy, |
| 3238 | 3188 | sx & 0x1ff,sy, |
| 3239 | machine.priority_bitmap,pri, | |
| 3240 | drawmode_table,machine.shadow_table); | |
| 3189 | machine().priority_bitmap,pri, | |
| 3190 | drawmode_table,machine().shadow_table); | |
| 3241 | 3191 | else |
| 3242 | drawgfx_transtable(bitmap,cliprect, | |
| 3192 | drawgfx_transtable(bitmap,cliprect,m_gfx, | |
| 3243 | 3193 | c, |
| 3244 | 3194 | color, |
| 3245 | 3195 | flipx,flipy, |
| 3246 | 3196 | sx & 0x1ff,sy, |
| 3247 | drawmode_table,machine.shadow_table); | |
| 3197 | drawmode_table,machine().shadow_table); | |
| 3248 | 3198 | } |
| 3249 | 3199 | } |
| 3250 | 3200 | } |
| r24078 | r24079 | |
| 3274 | 3224 | c += yoffset[y]; |
| 3275 | 3225 | |
| 3276 | 3226 | if (max_priority == -1) |
| 3277 | pdrawgfxzoom_transtable(bitmap,cliprect, | |
| 3227 | pdrawgfxzoom_transtable(bitmap,cliprect,m_gfx, | |
| 3278 | 3228 | c, |
| 3279 | 3229 | color, |
| 3280 | 3230 | flipx,flipy, |
| 3281 | 3231 | sx & 0x1ff,sy, |
| 3282 | 3232 | (zw << 16) / 16,(zh << 16) / 16, |
| 3283 | machine.priority_bitmap,pri, | |
| 3284 | drawmode_table,machine.shadow_table); | |
| 3233 | machine().priority_bitmap,pri, | |
| 3234 | drawmode_table,machine().shadow_table); | |
| 3285 | 3235 | else |
| 3286 | drawgfxzoom_transtable(bitmap,cliprect, | |
| 3236 | drawgfxzoom_transtable(bitmap,cliprect,m_gfx, | |
| 3287 | 3237 | c, |
| 3288 | 3238 | color, |
| 3289 | 3239 | flipx,flipy, |
| 3290 | 3240 | sx & 0x1ff,sy, |
| 3291 | 3241 | (zw << 16) / 16,(zh << 16) / 16, |
| 3292 | drawmode_table,machine.shadow_table); | |
| 3242 | drawmode_table,machine().shadow_table); | |
| 3293 | 3243 | } |
| 3294 | 3244 | } |
| 3295 | 3245 | } |
| 3296 | 3246 | } |
| 3297 | 3247 | #if 0 |
| 3298 | if (machine.input().code_pressed(KEYCODE_D)) | |
| 3248 | if (machine().input().code_pressed(KEYCODE_D)) | |
| 3299 | 3249 | { |
| 3300 | 3250 | FILE *fp; |
| 3301 | 3251 | fp=fopen("SPRITE.DMP", "w+b"); |
| r24078 | r24079 | |
| 3310 | 3260 | #undef NUM_SPRITES |
| 3311 | 3261 | } |
| 3312 | 3262 | |
| 3263 | ||
| 3264 | /***************************************************************************/ | |
| 3265 | /* */ | |
| 3266 | /* 05324x Family Sprite Generators */ | |
| 3267 | /* */ | |
| 3268 | /***************************************************************************/ | |
| 3269 | ||
| 3270 | /***************************************************************************/ | |
| 3271 | /* */ | |
| 3272 | /* 053244 / 053245 */ | |
| 3273 | /* */ | |
| 3274 | /***************************************************************************/ | |
| 3275 | ||
| 3276 | ||
| 3313 | 3277 | /***************************************************************************** |
| 3314 | 3278 | DEVICE INTERFACE |
| 3315 | 3279 | *****************************************************************************/ |
| 3316 | 3280 | |
| 3317 | static DEVICE_START( k051960 ) | |
| 3281 | const device_type K053244 = &device_creator<k05324x_device>; | |
| 3282 | ||
| 3283 | k05324x_device::k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 3284 | : device_t(mconfig, K053244, "Konami 053244 & 053245", tag, owner, clock, "k05324x", __FILE__), | |
| 3285 | m_ram(NULL), | |
| 3286 | m_buffer(NULL), | |
| 3287 | m_gfx(NULL), | |
| 3288 | //m_regs[0x10], | |
| 3289 | m_rombank(0), | |
| 3290 | m_ramsize(0), | |
| 3291 | m_z_rejection(0) | |
| 3318 | 3292 | { |
| 3319 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3320 | const k051960_interface *intf = k051960_get_interface(device); | |
| 3321 | running_machine &machine = device->machine(); | |
| 3293 | } | |
| 3294 | ||
| 3295 | //------------------------------------------------- | |
| 3296 | // device_config_complete - perform any | |
| 3297 | // operations now that the configuration is | |
| 3298 | // complete | |
| 3299 | //------------------------------------------------- | |
| 3300 | ||
| 3301 | void k05324x_device::device_config_complete() | |
| 3302 | { | |
| 3303 | // inherit a copy of the static data | |
| 3304 | const k05324x_interface *intf = reinterpret_cast<const k05324x_interface *>(static_config()); | |
| 3305 | if (intf != NULL) | |
| 3306 | *static_cast<k05324x_interface *>(this) = *intf; | |
| 3307 | ||
| 3308 | // or initialize to defaults if none provided | |
| 3309 | else | |
| 3310 | { | |
| 3311 | m_gfx_memory_region = ""; | |
| 3312 | m_gfx_num = 0; | |
| 3313 | m_plane_order = 0; | |
| 3314 | m_dx = 0; | |
| 3315 | m_dy = 0; | |
| 3316 | m_deinterleave = 0; | |
| 3317 | m_callback = NULL; | |
| 3318 | } | |
| 3319 | } | |
| 3320 | ||
| 3321 | //------------------------------------------------- | |
| 3322 | // device_start - device-specific startup | |
| 3323 | //------------------------------------------------- | |
| 3324 | ||
| 3325 | void k05324x_device::device_start() | |
| 3326 | { | |
| 3322 | 3327 | UINT32 total; |
| 3323 | 3328 | static const gfx_layout spritelayout = |
| 3324 | 3329 | { |
| 3325 | 3330 | 16,16, |
| 3326 | 3331 | 0, |
| 3327 | 3332 | 4, |
| 3328 | { 0, 8, 16, 24 }, | |
| 3329 | { 0, 1, 2, 3, 4, 5, 6, 7, | |
| 3330 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, | |
| 3331 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 3332 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, | |
| 3333 | 128*8 | |
| 3334 | }; | |
| 3335 | static const gfx_layout spritelayout_reverse = | |
| 3336 | { | |
| 3337 | 16,16, | |
| 3338 | 0, | |
| 3339 | 4, | |
| 3340 | 3333 | { 24, 16, 8, 0 }, |
| 3341 | 3334 | { 0, 1, 2, 3, 4, 5, 6, 7, |
| 3342 | 3335 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, |
| r24078 | r24079 | |
| 3344 | 3337 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, |
| 3345 | 3338 | 128*8 |
| 3346 | 3339 | }; |
| 3347 | static const gfx_layout spritelayout_gradius3 = | |
| 3348 | { | |
| 3349 | 16,16, | |
| 3350 | 0, | |
| 3351 | 4, | |
| 3352 | { 0, 1, 2, 3 }, | |
| 3353 | { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4, | |
| 3354 | 32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 }, | |
| 3355 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 3356 | 64*8+0*32, 64*8+1*32, 64*8+2*32, 64*8+3*32, 64*8+4*32, 64*8+5*32, 64*8+6*32, 64*8+7*32 }, | |
| 3357 | 128*8 | |
| 3358 | }; | |
| 3359 | 3340 | |
| 3360 | 3341 | /* decode the graphics */ |
| 3361 | switch ( | |
| 3342 | switch (m_plane_order) | |
| 3362 | 3343 | { |
| 3363 | 3344 | case NORMAL_PLANE_ORDER: |
| 3364 | total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128; | |
| 3365 | decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout, 4); | |
| 3345 | total = machine().root_device().memregion(m_gfx_memory_region)->bytes() / 128; | |
| 3346 | decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &spritelayout, 4); | |
| 3366 | 3347 | break; |
| 3367 | 3348 | |
| 3368 | case REVERSE_PLANE_ORDER: | |
| 3369 | total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128; | |
| 3370 | decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout_reverse, 4); | |
| 3371 | break; | |
| 3372 | ||
| 3373 | case GRADIUS3_PLANE_ORDER: | |
| 3374 | total = 0x4000; | |
| 3375 | decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout_gradius3, 4); | |
| 3376 | break; | |
| 3377 | ||
| 3378 | 3349 | default: |
| 3379 | fatalerror("Un | |
| 3350 | fatalerror("Unsupported plane_order\n"); | |
| 3380 | 3351 | } |
| 3381 | 3352 | |
| 3382 | if (VERBOSE && !(machine.config().m_video_attributes & VIDEO_HAS_SHADOWS)) | |
| 3353 | if (VERBOSE && !(machine().config().m_video_attributes & VIDEO_HAS_SHADOWS)) | |
| 3383 | 3354 | popmessage("driver should use VIDEO_HAS_SHADOWS"); |
| 3384 | 3355 | |
| 3385 | 3356 | /* deinterleave the graphics, if needed */ |
| 3386 | deinterleave_gfx(machine, | |
| 3357 | deinterleave_gfx(machine(), m_gfx_memory_region, m_deinterleave); | |
| 3387 | 3358 | |
| 3388 | k051960->memory_region = intf->gfx_memory_region; | |
| 3389 | k051960->gfx = machine.gfx[intf->gfx_num]; | |
| 3390 | k051960->callback = intf->callback; | |
| 3391 | k051960->ram = auto_alloc_array_clear(machine, UINT8, 0x400); | |
| 3359 | m_ramsize = 0x800; | |
| 3392 | 3360 | |
| 3393 | device->save_item(NAME(k051960->romoffset)); | |
| 3394 | device->save_item(NAME(k051960->spriteflip)); | |
| 3395 | device->save_item(NAME(k051960->readroms)); | |
| 3396 | device->save_item(NAME(k051960->spriterombank)); | |
| 3397 | device->save_pointer(NAME(k051960->ram), 0x400); | |
| 3398 | device->save_item(NAME(k051960->irq_enabled)); | |
| 3399 | device->save_item(NAME(k051960->nmi_enabled)); | |
| 3400 | device->save_item(NAME(k051960->dx)); | |
| 3401 | device->save_item(NAME(k051960->dy)); | |
| 3361 | m_z_rejection = -1; | |
| 3362 | m_gfx = machine().gfx[m_gfx_num]; | |
| 3363 | m_ram = auto_alloc_array_clear(machine(), UINT16, m_ramsize / 2); | |
| 3402 | 3364 | |
| 3403 | device->save_item(NAME(k051960->k051937_counter)); | |
| 3404 | } | |
| 3365 | m_buffer = auto_alloc_array_clear(machine(), UINT16, m_ramsize / 2); | |
| 3405 | 3366 | |
| 3406 | static DEVICE_RESET( k051960 ) | |
| 3407 | { | |
| 3408 | k051960_state *k051960 = k051960_get_safe_token(device); | |
| 3409 | ||
| 3410 | k051960->dx = k051960->dy = 0; | |
| 3411 | k051960->k051937_counter = 0; | |
| 3412 | ||
| 3413 | k051960->romoffset = 0; | |
| 3414 | k051960->spriteflip = 0; | |
| 3415 | k051960->readroms = 0; | |
| 3416 | k051960->irq_enabled = 0; | |
| 3417 | k051960->nmi_enabled = 0; | |
| 3418 | ||
| 3419 | k051960->spriterombank[0] = 0; | |
| 3420 | k051960->spriterombank[1] = 0; | |
| 3421 | k051960->spriterombank[2] = 0; | |
| 3367 | save_pointer(NAME(m_ram), m_ramsize / 2); | |
| 3368 | save_pointer(NAME(m_buffer), m_ramsize / 2); | |
| 3369 | save_item(NAME(m_rombank)); | |
| 3370 | save_item(NAME(m_z_rejection)); | |
| 3371 | save_item(NAME(m_regs)); | |
| 3422 | 3372 | } |
| 3423 | 3373 | |
| 3424 | ||
| 3425 | const device_type K051960 = &device_creator<k051960_device>; | |
| 3426 | ||
| 3427 | k051960_device::k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 3428 | : device_t(mconfig, K051960, "Konami 051960", tag, owner, clock, "k051960", __FILE__) | |
| 3429 | { | |
| 3430 | m_token = global_alloc_clear(k051960_state); | |
| 3431 | } | |
| 3432 | ||
| 3433 | 3374 | //------------------------------------------------- |
| 3434 | // device_config_complete - perform any | |
| 3435 | // operations now that the configuration is | |
| 3436 | // complete | |
| 3437 | //------------------------------------------------- | |
| 3438 | ||
| 3439 | void k051960_device::device_config_complete() | |
| 3440 | { | |
| 3441 | } | |
| 3442 | ||
| 3443 | //------------------------------------------------- | |
| 3444 | // device_start - device-specific startup | |
| 3445 | //------------------------------------------------- | |
| 3446 | ||
| 3447 | void k051960_device::device_start() | |
| 3448 | { | |
| 3449 | DEVICE_START_NAME( k051960 )(this); | |
| 3450 | } | |
| 3451 | ||
| 3452 | //------------------------------------------------- | |
| 3453 | 3375 | // device_reset - device-specific reset |
| 3454 | 3376 | //------------------------------------------------- |
| 3455 | 3377 | |
| 3456 | void k05 | |
| 3378 | void k05324x_device::device_reset() | |
| 3457 | 3379 | { |
| 3458 | DEVICE_RESET_NAME( k051960 )(this); | |
| 3459 | } | |
| 3380 | int i; | |
| 3460 | 3381 | |
| 3461 | /***************************************************************************/ | |
| 3462 | /* */ | |
| 3463 | /* 05324x Family Sprite Generators */ | |
| 3464 | /* */ | |
| 3465 | /***************************************************************************/ | |
| 3382 | m_rombank = 0; | |
| 3466 | 3383 | |
| 3467 | /***************************************************************************/ | |
| 3468 | /* */ | |
| 3469 | /* 053244 / 053245 */ | |
| 3470 | /* */ | |
| 3471 | /***************************************************************************/ | |
| 3472 | ||
| 3473 | struct k05324x_state | |
| 3474 | { | |
| 3475 | UINT16 *ram; | |
| 3476 | UINT16 *buffer; | |
| 3477 | ||
| 3478 | gfx_element *gfx; | |
| 3479 | ||
| 3480 | UINT8 regs[0x10]; // 053244 | |
| 3481 | int dx, dy; | |
| 3482 | int rombank; // 053244 | |
| 3483 | int ramsize; | |
| 3484 | int z_rejection; | |
| 3485 | ||
| 3486 | k05324x_callback callback; | |
| 3487 | ||
| 3488 | const char *memory_region; | |
| 3489 | }; | |
| 3490 | ||
| 3491 | ||
| 3492 | /***************************************************************************** | |
| 3493 | INLINE FUNCTIONS | |
| 3494 | *****************************************************************************/ | |
| 3495 | ||
| 3496 | INLINE k05324x_state *k05324x_get_safe_token( device_t *device ) | |
| 3497 | { | |
| 3498 | assert(device != NULL); | |
| 3499 | assert((device->type() == K053244 || device->type() == K053245)); | |
| 3500 | ||
| 3501 | return (k05324x_state *)downcast<k05324x_device *>(device)->token(); | |
| 3384 | for (i = 0; i < 0x10; i++) | |
| 3385 | m_regs[i] = 0; | |
| 3502 | 3386 | } |
| 3503 | 3387 | |
| 3504 | INLINE const k05324x_interface *k05324x_get_interface( device_t *device ) | |
| 3505 | { | |
| 3506 | assert(device != NULL); | |
| 3507 | assert((device->type() == K053244 || device->type() == K053245)); | |
| 3508 | return (const k05324x_interface *) device->static_config(); | |
| 3509 | } | |
| 3510 | ||
| 3511 | 3388 | /***************************************************************************** |
| 3512 | 3389 | DEVICE HANDLERS |
| 3513 | 3390 | *****************************************************************************/ |
| 3514 | 3391 | |
| 3515 | void k053245_set_sprite_offs( | |
| 3392 | void k05324x_device::k053245_set_sprite_offs( int offsx, int offsy ) | |
| 3516 | 3393 | { |
| 3517 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3518 | k053245->dx = offsx; | |
| 3519 | k053245->dy = offsy; | |
| 3394 | m_dx = offsx; | |
| 3395 | m_dy = offsy; | |
| 3520 | 3396 | } |
| 3521 | 3397 | |
| 3522 | READ16_ | |
| 3398 | READ16_MEMBER( k05324x_device::k053245_word_r ) | |
| 3523 | 3399 | { |
| 3524 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3525 | return k053245->ram[offset]; | |
| 3400 | return m_ram[offset]; | |
| 3526 | 3401 | } |
| 3527 | 3402 | |
| 3528 | WRITE16_ | |
| 3403 | WRITE16_MEMBER( k05324x_device::k053245_word_w ) | |
| 3529 | 3404 | { |
| 3530 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3531 | COMBINE_DATA(k053245->ram + offset); | |
| 3405 | COMBINE_DATA(m_ram + offset); | |
| 3532 | 3406 | } |
| 3533 | 3407 | |
| 3534 | READ8_ | |
| 3408 | READ8_MEMBER( k05324x_device::k053245_r ) | |
| 3535 | 3409 | { |
| 3536 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3537 | ||
| 3538 | 3410 | if(offset & 1) |
| 3539 | return | |
| 3411 | return m_ram[offset >> 1] & 0xff; | |
| 3540 | 3412 | else |
| 3541 | return ( | |
| 3413 | return (m_ram[offset >> 1] >> 8) & 0xff; | |
| 3542 | 3414 | } |
| 3543 | 3415 | |
| 3544 | 3416 | |
| 3545 | WRITE8_ | |
| 3417 | WRITE8_MEMBER( k05324x_device::k053245_w ) | |
| 3546 | 3418 | { |
| 3547 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3548 | ||
| 3549 | 3419 | if(offset & 1) |
| 3550 | | |
| 3420 | m_ram[offset >> 1] = (m_ram[offset >> 1] & 0xff00) | data; | |
| 3551 | 3421 | else |
| 3552 | | |
| 3422 | m_ram[offset >> 1] = (m_ram[offset >> 1] & 0x00ff) | (data << 8); | |
| 3553 | 3423 | } |
| 3554 | 3424 | |
| 3555 | void k053245_clear_buffer( | |
| 3425 | void k05324x_device::k053245_clear_buffer( ) | |
| 3556 | 3426 | { |
| 3557 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3558 | 3427 | int i, e; |
| 3559 | 3428 | |
| 3560 | for (e = k053245->ramsize / 2, i = 0; i < e; i += 8) | |
| 3561 | k053245->buffer[i] = 0; | |
| 3429 | for (e = m_ramsize / 2, i = 0; i < e; i += 8) | |
| 3430 | m_buffer[i] = 0; | |
| 3562 | 3431 | } |
| 3563 | 3432 | |
| 3564 | ||
| 3433 | void k05324x_device::k053245_update_buffer( ) | |
| 3565 | 3434 | { |
| 3566 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3567 | memcpy(k053245->buffer, k053245->ram, k053245->ramsize); | |
| 3435 | memcpy(m_buffer, m_ram, m_ramsize); | |
| 3568 | 3436 | } |
| 3569 | 3437 | |
| 3570 | READ8_ | |
| 3438 | READ8_MEMBER( k05324x_device::k053244_r ) | |
| 3571 | 3439 | { |
| 3572 | k05324x_state *k053244 = k05324x_get_safe_token(device); | |
| 3573 | running_machine &machine = space.machine(); | |
| 3574 | ||
| 3575 | if ((k053244->regs[5] & 0x10) && offset >= 0x0c && offset < 0x10) | |
| 3440 | if ((m_regs[5] & 0x10) && offset >= 0x0c && offset < 0x10) | |
| 3576 | 3441 | { |
| 3577 | 3442 | int addr; |
| 3578 | 3443 | |
| 3579 | addr = (k053244->rombank << 19) | ((k053244->regs[11] & 0x7) << 18) | |
| 3580 | | (k053244->regs[8] << 10) | (k053244->regs[9] << 2) | |
| 3444 | addr = (m_rombank << 19) | ((m_regs[11] & 0x7) << 18) | |
| 3445 | | (m_regs[8] << 10) | (m_regs[9] << 2) | |
| 3581 | 3446 | | ((offset & 3) ^ 1); |
| 3582 | addr &= machine.root_device().memregion( | |
| 3447 | addr &= machine().root_device().memregion(m_gfx_memory_region)->bytes() - 1; | |
| 3583 | 3448 | |
| 3584 | // popmessage("%s: offset %02x addr %06x", machine.describe_context(), offset & 3, addr); | |
| 3449 | // popmessage("%s: offset %02x addr %06x", machine().describe_context(), offset & 3, addr); | |
| 3585 | 3450 | |
| 3586 | return machine.root_device().memregion( | |
| 3451 | return machine().root_device().memregion(m_gfx_memory_region)->base()[addr]; | |
| 3587 | 3452 | } |
| 3588 | 3453 | else if (offset == 0x06) |
| 3589 | 3454 | { |
| 3590 | k053245_update_buffer( | |
| 3455 | k053245_update_buffer(); | |
| 3591 | 3456 | return 0; |
| 3592 | 3457 | } |
| 3593 | 3458 | else |
| 3594 | 3459 | { |
| 3595 | //logerror("%s: read from unknown 053244 address %x\n", machine.describe_context(), offset); | |
| 3460 | //logerror("%s: read from unknown 053244 address %x\n", machine().describe_context(), offset); | |
| 3596 | 3461 | return 0; |
| 3597 | 3462 | } |
| 3598 | 3463 | } |
| 3599 | 3464 | |
| 3600 | WRITE8_ | |
| 3465 | WRITE8_MEMBER( k05324x_device::k053244_w ) | |
| 3601 | 3466 | { |
| 3602 | | |
| 3467 | m_regs[offset] = data; | |
| 3603 | 3468 | |
| 3604 | k053244->regs[offset] = data; | |
| 3605 | ||
| 3606 | 3469 | switch(offset) |
| 3607 | 3470 | { |
| 3608 | 3471 | case 0x05: |
| r24078 | r24079 | |
| 3614 | 3477 | break; |
| 3615 | 3478 | |
| 3616 | 3479 | case 0x06: |
| 3617 | k053245_update_buffer( | |
| 3480 | k053245_update_buffer(); | |
| 3618 | 3481 | break; |
| 3619 | 3482 | } |
| 3620 | 3483 | } |
| 3621 | 3484 | |
| 3622 | 3485 | |
| 3623 | READ16_ | |
| 3486 | READ16_MEMBER( k05324x_device::k053244_lsb_r ) | |
| 3624 | 3487 | { |
| 3625 | return k053244_r( | |
| 3488 | return k053244_r(space, offset); | |
| 3626 | 3489 | } |
| 3627 | 3490 | |
| 3628 | WRITE16_ | |
| 3491 | WRITE16_MEMBER( k05324x_device::k053244_lsb_w ) | |
| 3629 | 3492 | { |
| 3630 | 3493 | if (ACCESSING_BITS_0_7) |
| 3631 | k053244_w( | |
| 3494 | k053244_w(space, offset, data & 0xff); | |
| 3632 | 3495 | } |
| 3633 | 3496 | |
| 3634 | READ16_ | |
| 3497 | READ16_MEMBER( k05324x_device::k053244_word_r ) | |
| 3635 | 3498 | { |
| 3636 | return (k053244_r( | |
| 3499 | return (k053244_r(space, offset * 2) << 8) | k053244_r(space, offset * 2 + 1); | |
| 3637 | 3500 | } |
| 3638 | 3501 | |
| 3639 | WRITE16_ | |
| 3502 | WRITE16_MEMBER( k05324x_device::k053244_word_w ) | |
| 3640 | 3503 | { |
| 3641 | 3504 | if (ACCESSING_BITS_8_15) |
| 3642 | k053244_w( | |
| 3505 | k053244_w(space, offset * 2, (data >> 8) & 0xff); | |
| 3643 | 3506 | if (ACCESSING_BITS_0_7) |
| 3644 | k053244_w( | |
| 3507 | k053244_w(space, offset * 2 + 1, data & 0xff); | |
| 3645 | 3508 | } |
| 3646 | 3509 | |
| 3647 | void k053244_bankselect( | |
| 3510 | void k05324x_device::k053244_bankselect( int bank ) | |
| 3648 | 3511 | { |
| 3649 | k05324x_state *k053244 = k05324x_get_safe_token(device); | |
| 3650 | k053244->rombank = bank; | |
| 3512 | m_rombank = bank; | |
| 3651 | 3513 | } |
| 3652 | 3514 | |
| 3515 | void k05324x_device::k05324x_set_z_rejection( int zcode ) | |
| 3516 | { | |
| 3517 | m_z_rejection = zcode; | |
| 3518 | } | |
| 3519 | ||
| 3653 | 3520 | /* |
| 3654 | 3521 | * Sprite Format |
| 3655 | 3522 | * ------------------ |
| r24078 | r24079 | |
| 3678 | 3545 | * The rest of the sprite remains normal. |
| 3679 | 3546 | */ |
| 3680 | 3547 | |
| 3681 | void k053245_sprites_draw( | |
| 3548 | void k05324x_device::k053245_sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 3682 | 3549 | { |
| 3683 | 3550 | #define NUM_SPRITES 128 |
| 3684 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3685 | running_machine &machine = device->machine(); | |
| 3686 | 3551 | int offs, pri_code, i; |
| 3687 | 3552 | int sortedlist[NUM_SPRITES]; |
| 3688 | 3553 | int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; |
| r24078 | r24079 | |
| 3691 | 3556 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); |
| 3692 | 3557 | drawmode_table[0] = DRAWMODE_NONE; |
| 3693 | 3558 | |
| 3694 | flipscreenX = k053245->regs[5] & 0x01; | |
| 3695 | flipscreenY = k053245->regs[5] & 0x02; | |
| 3696 | spriteoffsX = (k053245->regs[0] << 8) | k053245->regs[1]; | |
| 3697 | spriteoffsY = (k053245->regs[2] << 8) | k053245->regs[3]; | |
| 3559 | flipscreenX = m_regs[5] & 0x01; | |
| 3560 | flipscreenY = m_regs[5] & 0x02; | |
| 3561 | spriteoffsX = (m_regs[0] << 8) | m_regs[1]; | |
| 3562 | spriteoffsY = (m_regs[2] << 8) | m_regs[3]; | |
| 3698 | 3563 | |
| 3699 | 3564 | for (offs = 0; offs < NUM_SPRITES; offs++) |
| 3700 | 3565 | sortedlist[offs] = -1; |
| 3701 | 3566 | |
| 3702 | 3567 | /* prebuild a sorted table */ |
| 3703 | for (i = | |
| 3568 | for (i = m_ramsize / 2, offs = 0; offs < i; offs += 8) | |
| 3704 | 3569 | { |
| 3705 | pri_code = | |
| 3570 | pri_code = m_buffer[offs]; | |
| 3706 | 3571 | if (pri_code & 0x8000) |
| 3707 | 3572 | { |
| 3708 | 3573 | pri_code &= 0x007f; |
| 3709 | 3574 | |
| 3710 | if (offs && pri_code == | |
| 3575 | if (offs && pri_code == m_z_rejection) | |
| 3711 | 3576 | continue; |
| 3712 | 3577 | |
| 3713 | 3578 | if (sortedlist[pri_code] == -1) |
| r24078 | r24079 | |
| 3750 | 3615 | /* field to do bank switching. However this applies only to TMNT2, with its */ |
| 3751 | 3616 | /* protection mcu creating the sprite table, so we don't know where to fetch */ |
| 3752 | 3617 | /* the bits from. */ |
| 3753 | code = | |
| 3618 | code = m_buffer[offs + 1]; | |
| 3754 | 3619 | code = ((code & 0xffe1) + ((code & 0x0010) >> 2) + ((code & 0x0008) << 1) |
| 3755 | 3620 | + ((code & 0x0004) >> 1) + ((code & 0x0002) << 2)); |
| 3756 | color = | |
| 3621 | color = m_buffer[offs + 6] & 0x00ff; | |
| 3757 | 3622 | pri = 0; |
| 3758 | 3623 | |
| 3759 | | |
| 3624 | m_callback(machine(), &code, &color, &pri); | |
| 3760 | 3625 | |
| 3761 | size = ( | |
| 3626 | size = (m_buffer[offs] & 0x0f00) >> 8; | |
| 3762 | 3627 | |
| 3763 | 3628 | w = 1 << (size & 0x03); |
| 3764 | 3629 | h = 1 << ((size >> 2) & 0x03); |
| r24078 | r24079 | |
| 3768 | 3633 | <0x40 enlarge (0x20 = double size) |
| 3769 | 3634 | >0x40 reduce (0x80 = half size) |
| 3770 | 3635 | */ |
| 3771 | zoomy = | |
| 3636 | zoomy = m_buffer[offs + 4]; | |
| 3772 | 3637 | if (zoomy > 0x2000) |
| 3773 | 3638 | continue; |
| 3774 | 3639 | |
| r24078 | r24079 | |
| 3776 | 3641 | zoomy = (0x400000 + zoomy / 2) / zoomy; |
| 3777 | 3642 | else |
| 3778 | 3643 | zoomy = 2 * 0x400000; |
| 3779 | if (( | |
| 3644 | if ((m_buffer[offs] & 0x4000) == 0) | |
| 3780 | 3645 | { |
| 3781 | zoomx = | |
| 3646 | zoomx = m_buffer[offs + 5]; | |
| 3782 | 3647 | if (zoomx > 0x2000) |
| 3783 | 3648 | continue; |
| 3784 | 3649 | if (zoomx) |
| r24078 | r24079 | |
| 3790 | 3655 | else |
| 3791 | 3656 | zoomx = zoomy; |
| 3792 | 3657 | |
| 3793 | ox = k053245->buffer[offs+3] + spriteoffsX; | |
| 3794 | oy = k053245->buffer[offs+2]; | |
| 3658 | ox = m_buffer[offs+3] + spriteoffsX; | |
| 3659 | oy = m_buffer[offs+2]; | |
| 3795 | 3660 | |
| 3796 | ox += k053245->dx; | |
| 3797 | oy += k053245->dy; | |
| 3661 | ox += m_dx; | |
| 3662 | oy += m_dy; | |
| 3798 | 3663 | |
| 3799 | flipx = k053245->buffer[offs] & 0x1000; | |
| 3800 | flipy = k053245->buffer[offs] & 0x2000; | |
| 3801 | mirrorx = k053245->buffer[offs + 6] & 0x0100; | |
| 3664 | flipx = m_buffer[offs] & 0x1000; | |
| 3665 | flipy = m_buffer[offs] & 0x2000; | |
| 3666 | mirrorx = m_buffer[offs + 6] & 0x0100; | |
| 3802 | 3667 | if (mirrorx) |
| 3803 | 3668 | flipx = 0; // documented and confirmed |
| 3804 | 3669 | |
| 3805 | mirrory = k053245->buffer[offs + 6] & 0x0200; | |
| 3806 | shadow = k053245->buffer[offs + 6] & 0x0080; | |
| 3670 | mirrory = m_buffer[offs + 6] & 0x0200; | |
| 3671 | shadow = m_buffer[offs + 6] & 0x0080; | |
| 3807 | 3672 | |
| 3808 | 3673 | if (flipscreenX) |
| 3809 | 3674 | { |
| r24078 | r24079 | |
| 3827 | 3692 | ox -= (zoomx * w) >> 13; |
| 3828 | 3693 | oy -= (zoomy * h) >> 13; |
| 3829 | 3694 | |
| 3830 | drawmode_table[ | |
| 3695 | drawmode_table[m_gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 3831 | 3696 | |
| 3832 | 3697 | for (y = 0; y < h; y++) |
| 3833 | 3698 | { |
| r24078 | r24079 | |
| 3891 | 3756 | |
| 3892 | 3757 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 3893 | 3758 | { |
| 3894 | pdrawgfx_transtable(bitmap,cliprect, | |
| 3759 | pdrawgfx_transtable(bitmap,cliprect,m_gfx, | |
| 3895 | 3760 | c, |
| 3896 | 3761 | color, |
| 3897 | 3762 | fx,fy, |
| 3898 | 3763 | sx,sy, |
| 3899 | machine.priority_bitmap,pri, | |
| 3900 | drawmode_table,machine.shadow_table); | |
| 3764 | machine().priority_bitmap,pri, | |
| 3765 | drawmode_table,machine().shadow_table); | |
| 3901 | 3766 | } |
| 3902 | 3767 | else |
| 3903 | 3768 | { |
| 3904 | pdrawgfxzoom_transtable(bitmap,cliprect, | |
| 3769 | pdrawgfxzoom_transtable(bitmap,cliprect,m_gfx, | |
| 3905 | 3770 | c, |
| 3906 | 3771 | color, |
| 3907 | 3772 | fx,fy, |
| 3908 | 3773 | sx,sy, |
| 3909 | 3774 | (zw << 16) / 16,(zh << 16) / 16, |
| 3910 | machine.priority_bitmap,pri, | |
| 3911 | drawmode_table,machine.shadow_table); | |
| 3775 | machine().priority_bitmap,pri, | |
| 3776 | drawmode_table,machine().shadow_table); | |
| 3912 | 3777 | |
| 3913 | 3778 | } |
| 3914 | 3779 | } |
| 3915 | 3780 | } |
| 3916 | 3781 | } |
| 3917 | 3782 | #if 0 |
| 3918 | if (machine.input().code_pressed(KEYCODE_D)) | |
| 3783 | if (machine().input().code_pressed(KEYCODE_D)) | |
| 3919 | 3784 | { |
| 3920 | 3785 | FILE *fp; |
| 3921 | 3786 | fp=fopen("SPRITE.DMP", "w+b"); |
| 3922 | 3787 | if (fp) |
| 3923 | 3788 | { |
| 3924 | fwrite( | |
| 3789 | fwrite(m_buffer, 0x800, 1, fp); | |
| 3925 | 3790 | popmessage("saved"); |
| 3926 | 3791 | fclose(fp); |
| 3927 | 3792 | } |
| r24078 | r24079 | |
| 3930 | 3795 | #undef NUM_SPRITES |
| 3931 | 3796 | } |
| 3932 | 3797 | |
| 3933 | /* Lethal Enforcers has 2 of these chips hooked up in parallel to give 6bpp gfx.. lets cheat a | |
| 3798 | /* Lethal Enforcers has 2 of these chips hooked up in parallel to give 6bpp gfx.. let's cheat a | |
| 3934 | 3799 | bit and make emulating it a little less messy by using a custom function instead */ |
| 3935 | void k053245_sprites_draw_lethal( | |
| 3800 | void k05324x_device::k053245_sprites_draw_lethal( bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 3936 | 3801 | { |
| 3937 | 3802 | #define NUM_SPRITES 128 |
| 3938 | k05324x_state *k053245 = k05324x_get_safe_token(device); | |
| 3939 | 3803 | int offs, pri_code, i; |
| 3940 | 3804 | int sortedlist[NUM_SPRITES]; |
| 3941 | 3805 | int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; |
| 3942 | 3806 | UINT8 drawmode_table[256]; |
| 3943 | running_machine &machine = device->machine(); | |
| 3944 | ||
| 3807 | ||
| 3945 | 3808 | memset(drawmode_table, DRAWMODE_SOURCE, sizeof(drawmode_table)); |
| 3946 | 3809 | drawmode_table[0] = DRAWMODE_NONE; |
| 3947 | 3810 | |
| 3948 | flipscreenX = k053245->regs[5] & 0x01; | |
| 3949 | flipscreenY = k053245->regs[5] & 0x02; | |
| 3950 | spriteoffsX = (k053245->regs[0] << 8) | k053245->regs[1]; | |
| 3951 | spriteoffsY = (k053245->regs[2] << 8) | k053245->regs[3]; | |
| 3811 | flipscreenX = m_regs[5] & 0x01; | |
| 3812 | flipscreenY = m_regs[5] & 0x02; | |
| 3813 | spriteoffsX = (m_regs[0] << 8) | m_regs[1]; | |
| 3814 | spriteoffsY = (m_regs[2] << 8) | m_regs[3]; | |
| 3952 | 3815 | |
| 3953 | 3816 | for (offs = 0; offs < NUM_SPRITES; offs++) |
| 3954 | 3817 | sortedlist[offs] = -1; |
| 3955 | 3818 | |
| 3956 | 3819 | /* prebuild a sorted table */ |
| 3957 | for (i = | |
| 3820 | for (i = m_ramsize / 2, offs = 0; offs < i; offs += 8) | |
| 3958 | 3821 | { |
| 3959 | pri_code = | |
| 3822 | pri_code = m_buffer[offs]; | |
| 3960 | 3823 | if (pri_code & 0x8000) |
| 3961 | 3824 | { |
| 3962 | 3825 | pri_code &= 0x007f; |
| 3963 | 3826 | |
| 3964 | if (offs && pri_code == | |
| 3827 | if (offs && pri_code == m_z_rejection) | |
| 3965 | 3828 | continue; |
| 3966 | 3829 | |
| 3967 | 3830 | if (sortedlist[pri_code] == -1) |
| r24078 | r24079 | |
| 4004 | 3867 | /* field to do bank switching. However this applies only to TMNT2, with its */ |
| 4005 | 3868 | /* protection mcu creating the sprite table, so we don't know where to fetch */ |
| 4006 | 3869 | /* the bits from. */ |
| 4007 | code = | |
| 3870 | code = m_buffer[offs + 1]; | |
| 4008 | 3871 | code = ((code & 0xffe1) + ((code & 0x0010) >> 2) + ((code & 0x0008) << 1) |
| 4009 | 3872 | + ((code & 0x0004) >> 1) + ((code & 0x0002) << 2)); |
| 4010 | color = | |
| 3873 | color = m_buffer[offs + 6] & 0x00ff; | |
| 4011 | 3874 | pri = 0; |
| 4012 | 3875 | |
| 4013 | | |
| 3876 | m_callback(machine(), &code, &color, &pri); | |
| 4014 | 3877 | |
| 4015 | size = ( | |
| 3878 | size = (m_buffer[offs] & 0x0f00) >> 8; | |
| 4016 | 3879 | |
| 4017 | 3880 | w = 1 << (size & 0x03); |
| 4018 | 3881 | h = 1 << ((size >> 2) & 0x03); |
| r24078 | r24079 | |
| 4022 | 3885 | <0x40 enlarge (0x20 = double size) |
| 4023 | 3886 | >0x40 reduce (0x80 = half size) |
| 4024 | 3887 | */ |
| 4025 | zoomy = | |
| 3888 | zoomy = m_buffer[offs + 4]; | |
| 4026 | 3889 | if (zoomy > 0x2000) |
| 4027 | 3890 | continue; |
| 4028 | 3891 | if (zoomy) |
| 4029 | 3892 | zoomy = (0x400000 + zoomy / 2) / zoomy; |
| 4030 | 3893 | else |
| 4031 | 3894 | zoomy = 2 * 0x400000; |
| 4032 | if (( | |
| 3895 | if ((m_buffer[offs] & 0x4000) == 0) | |
| 4033 | 3896 | { |
| 4034 | zoomx = | |
| 3897 | zoomx = m_buffer[offs + 5]; | |
| 4035 | 3898 | if (zoomx > 0x2000) |
| 4036 | 3899 | continue; |
| 4037 | 3900 | if (zoomx) |
| r24078 | r24079 | |
| 4043 | 3906 | else |
| 4044 | 3907 | zoomx = zoomy; |
| 4045 | 3908 | |
| 4046 | ox = k053245->buffer[offs + 3] + spriteoffsX; | |
| 4047 | oy = k053245->buffer[offs + 2]; | |
| 3909 | ox = m_buffer[offs + 3] + spriteoffsX; | |
| 3910 | oy = m_buffer[offs + 2]; | |
| 4048 | 3911 | |
| 4049 | ox += k053245->dx; | |
| 4050 | oy += k053245->dy; | |
| 3912 | ox += m_dx; | |
| 3913 | oy += m_dy; | |
| 4051 | 3914 | |
| 4052 | flipx = k053245->buffer[offs] & 0x1000; | |
| 4053 | flipy = k053245->buffer[offs] & 0x2000; | |
| 4054 | mirrorx = k053245->buffer[offs + 6] & 0x0100; | |
| 3915 | flipx = m_buffer[offs] & 0x1000; | |
| 3916 | flipy = m_buffer[offs] & 0x2000; | |
| 3917 | mirrorx = m_buffer[offs + 6] & 0x0100; | |
| 4055 | 3918 | if (mirrorx) |
| 4056 | 3919 | flipx = 0; // documented and confirmed |
| 4057 | mirrory = k053245->buffer[offs + 6] & 0x0200; | |
| 4058 | shadow = k053245->buffer[offs + 6] & 0x0080; | |
| 3920 | mirrory = m_buffer[offs + 6] & 0x0200; | |
| 3921 | shadow = m_buffer[offs + 6] & 0x0080; | |
| 4059 | 3922 | |
| 4060 | 3923 | if (flipscreenX) |
| 4061 | 3924 | { |
| r24078 | r24079 | |
| 4077 | 3940 | ox -= (zoomx * w) >> 13; |
| 4078 | 3941 | oy -= (zoomy * h) >> 13; |
| 4079 | 3942 | |
| 4080 | drawmode_table[machine.gfx[0]->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 3943 | drawmode_table[machine().gfx[0]->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; | |
| 4081 | 3944 | |
| 4082 | 3945 | for (y = 0; y < h; y++) |
| 4083 | 3946 | { |
| r24078 | r24079 | |
| 4141 | 4004 | |
| 4142 | 4005 | if (zoomx == 0x10000 && zoomy == 0x10000) |
| 4143 | 4006 | { |
| 4144 | pdrawgfx_transtable(bitmap,cliprect,machine.gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 4007 | pdrawgfx_transtable(bitmap,cliprect,machine().gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 4145 | 4008 | c, |
| 4146 | 4009 | color, |
| 4147 | 4010 | fx,fy, |
| 4148 | 4011 | sx,sy, |
| 4149 | machine.priority_bitmap,pri, | |
| 4150 | drawmode_table,machine.shadow_table); | |
| 4012 | machine().priority_bitmap,pri, | |
| 4013 | drawmode_table,machine().shadow_table); | |
| 4151 | 4014 | } |
| 4152 | 4015 | else |
| 4153 | 4016 | { |
| 4154 | pdrawgfxzoom_transtable(bitmap,cliprect,machine.gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 4017 | pdrawgfxzoom_transtable(bitmap,cliprect,machine().gfx[0], /* hardcoded to 0 (decoded 6bpp gfx) for le */ | |
| 4155 | 4018 | c, |
| 4156 | 4019 | color, |
| 4157 | 4020 | fx,fy, |
| 4158 | 4021 | sx,sy, |
| 4159 | 4022 | (zw << 16) / 16,(zh << 16) / 16, |
| 4160 | machine.priority_bitmap,pri, | |
| 4161 | drawmode_table,machine.shadow_table); | |
| 4023 | machine().priority_bitmap,pri, | |
| 4024 | drawmode_table,machine().shadow_table); | |
| 4162 | 4025 | |
| 4163 | 4026 | } |
| 4164 | 4027 | } |
| 4165 | 4028 | } |
| 4166 | 4029 | } |
| 4167 | 4030 | #if 0 |
| 4168 | if (machine.input().code_pressed(KEYCODE_D)) | |
| 4031 | if (machine().input().code_pressed(KEYCODE_D)) | |
| 4169 | 4032 | { |
| 4170 | 4033 | FILE *fp; |
| 4171 | 4034 | fp=fopen("SPRITE.DMP", "w+b"); |
| 4172 | 4035 | if (fp) |
| 4173 | 4036 | { |
| 4174 | fwrite( | |
| 4037 | fwrite(m_buffer, 0x800, 1, fp); | |
| 4175 | 4038 | popmessage("saved"); |
| 4176 | 4039 | fclose(fp); |
| 4177 | 4040 | } |
| r24078 | r24079 | |
| 4180 | 4043 | #undef NUM_SPRITES |
| 4181 | 4044 | } |
| 4182 | 4045 | |
| 4183 | ||
| 4184 | /***************************************************************************** | |
| 4185 | DEVICE INTERFACE | |
| 4186 | *****************************************************************************/ | |
| 4187 | ||
| 4188 | static DEVICE_START( k05324x ) | |
| 4046 | READ16_MEMBER( k05324x_device::k053244_reg_word_r ) | |
| 4189 | 4047 | { |
| 4190 | k05324x_state *k05324x = k05324x_get_safe_token(device); | |
| 4191 | const k05324x_interface *intf = k05324x_get_interface(device); | |
| 4192 | running_machine &machine = device->machine(); | |
| 4193 | UINT32 total; | |
| 4194 | static const gfx_layout spritelayout = | |
| 4195 | { | |
| 4196 | 16,16, | |
| 4197 | 0, | |
| 4198 | 4, | |
| 4199 | { 24, 16, 8, 0 }, | |
| 4200 | { 0, 1, 2, 3, 4, 5, 6, 7, | |
| 4201 | 8*32+0, 8*32+1, 8*32+2, 8*32+3, 8*32+4, 8*32+5, 8*32+6, 8*32+7 }, | |
| 4202 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, | |
| 4203 | 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 }, | |
| 4204 | 128*8 | |
| 4205 | }; | |
| 4206 | ||
| 4207 | /* decode the graphics */ | |
| 4208 | switch (intf->plane_order) | |
| 4209 | { | |
| 4210 | case NORMAL_PLANE_ORDER: | |
| 4211 | total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128; | |
| 4212 | decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout, 4); | |
| 4213 | break; | |
| 4214 | ||
| 4215 | default: | |
| 4216 | fatalerror("Unsupported plane_order\n"); | |
| 4217 | } | |
| 4218 | ||
| 4219 | if (VERBOSE && !(machine.config().m_video_attributes & VIDEO_HAS_SHADOWS)) | |
| 4220 | popmessage("driver should use VIDEO_HAS_SHADOWS"); | |
| 4221 | ||
| 4222 | /* deinterleave the graphics, if needed */ | |
| 4223 | deinterleave_gfx(machine, intf->gfx_memory_region, intf->deinterleave); | |
| 4224 | ||
| 4225 | k05324x->ramsize = 0x800; | |
| 4226 | ||
| 4227 | k05324x->z_rejection = -1; | |
| 4228 | k05324x->memory_region = intf->gfx_memory_region; | |
| 4229 | k05324x->gfx = machine.gfx[intf->gfx_num]; | |
| 4230 | k05324x->dx = intf->dx; | |
| 4231 | k05324x->dy = intf->dy; | |
| 4232 | k05324x->callback = intf->callback; | |
| 4233 | k05324x->ram = auto_alloc_array(machine, UINT16, k05324x->ramsize / 2); | |
| 4234 | ||
| 4235 | k05324x->buffer = auto_alloc_array(machine, UINT16, k05324x->ramsize / 2); | |
| 4236 | ||
| 4237 | device->save_pointer(NAME(k05324x->ram), k05324x->ramsize / 2); | |
| 4238 | device->save_pointer(NAME(k05324x->buffer), k05324x->ramsize / 2); | |
| 4239 | device->save_item(NAME(k05324x->rombank)); | |
| 4240 | device->save_item(NAME(k05324x->z_rejection)); | |
| 4241 | device->save_item(NAME(k05324x->regs)); | |
| 4048 | return(m_regs[offset * 2] << 8 | m_regs[offset * 2 + 1]); | |
| 4242 | 4049 | } |
| 4243 | 4050 | |
| 4244 | static DEVICE_RESET( k05324x ) | |
| 4245 | { | |
| 4246 | k05324x_state *k05324x = k05324x_get_safe_token(device); | |
| 4247 | int i; | |
| 4248 | 4051 | |
| 4249 | k05324x->rombank = 0; | |
| 4250 | ||
| 4251 | for (i = 0; i < 0x10; i++) | |
| 4252 | k05324x->regs[i] = 0; | |
| 4253 | } | |
| 4254 | ||
| 4255 | ||
| 4256 | const device_type K053244 = &device_creator<k05324x_device>; | |
| 4257 | ||
| 4258 | k05324x_device::k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 4259 | : device_t(mconfig, K053244, "Konami 053244 & 053245", tag, owner, clock, "k05324x", __FILE__) | |
| 4260 | { | |
| 4261 | m_token = global_alloc_clear(k05324x_state); | |
| 4262 | } | |
| 4263 | ||
| 4264 | //------------------------------------------------- | |
| 4265 | // device_config_complete - perform any | |
| 4266 | // operations now that the configuration is | |
| 4267 | // complete | |
| 4268 | //------------------------------------------------- | |
| 4269 | ||
| 4270 | void k05324x_device::device_config_complete() | |
| 4271 | { | |
| 4272 | } | |
| 4273 | ||
| 4274 | //------------------------------------------------- | |
| 4275 | // device_start - device-specific startup | |
| 4276 | //------------------------------------------------- | |
| 4277 | ||
| 4278 | void k05324x_device::device_start() | |
| 4279 | { | |
| 4280 | DEVICE_START_NAME( k05324x )(this); | |
| 4281 | } | |
| 4282 | ||
| 4283 | //------------------------------------------------- | |
| 4284 | // device_reset - device-specific reset | |
| 4285 | //------------------------------------------------- | |
| 4286 | ||
| 4287 | void k05324x_device::device_reset() | |
| 4288 | { | |
| 4289 | DEVICE_RESET_NAME( k05324x )(this); | |
| 4290 | } | |
| 4291 | ||
| 4292 | 4052 | /***************************************************************************/ |
| 4293 | 4053 | /* */ |
| 4294 | 4054 | /* 053246/053247 */ |
| r24078 | r24079 | |
| 5355 | 5115 | 0x00-0xff = zcode to ignore |
| 5356 | 5116 | */ |
| 5357 | 5117 | |
| 5358 | ||
| 5359 | void k05324x_set_z_rejection( device_t *device, int zcode ) | |
| 5360 | { | |
| 5361 | k05324x_state *k05324x = k05324x_get_safe_token(device); | |
| 5362 | k05324x->z_rejection = zcode; | |
| 5363 | } | |
| 5364 | ||
| 5365 | 5118 | void k053247_set_z_rejection( device_t *device, int zcode ) |
| 5366 | 5119 | { |
| 5367 | 5120 | k053247_state *k053247 = k053247_get_safe_token(device); |
| r24078 | r24079 | |
| 10898 | 10651 | offset <<= 1; |
| 10899 | 10652 | return (k055555_word_r(device, space, offset + 1, 0xffff) | k055555_word_r(device, space, offset, 0xffff) << 16); |
| 10900 | 10653 | } |
| 10901 | ||
| 10902 | READ16_DEVICE_HANDLER( k053244_reg_word_r ) | |
| 10903 | { | |
| 10904 | k05324x_state *k053244 = k05324x_get_safe_token(device); | |
| 10905 | return(k053244->regs[offset * 2] << 8 | k053244->regs[offset * 2 + 1]); | |
| 10906 | } |
| r24078 | r24079 | |
|---|---|---|
| 28 | 28 | |
| 29 | 29 | struct k007342_interface |
| 30 | 30 | { |
| 31 | int gfxnum; | |
| 32 | k007342_callback callback; | |
| 31 | int m_gfxnum; | |
| 32 | k007342_callback m_callback; | |
| 33 | 33 | }; |
| 34 | 34 | |
| 35 | 35 | struct k007420_interface |
| 36 | 36 | { |
| 37 | int banklimit; | |
| 38 | k007420_callback callback; | |
| 37 | int m_banklimit; | |
| 38 | k007420_callback m_callback; | |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | struct k052109_interface |
| 42 | 42 | { |
| 43 | const char *gfx_memory_region; | |
| 44 | int gfx_num; | |
| 45 | int plane_order; | |
| 46 | int deinterleave; | |
| 47 | k052109_callback callback; | |
| 43 | const char *m_gfx_memory_region; | |
| 44 | int m_gfx_num; | |
| 45 | int m_plane_order; | |
| 46 | int m_deinterleave; | |
| 47 | k052109_callback m_callback; | |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | struct k051960_interface |
| 51 | 51 | { |
| 52 | const char *gfx_memory_region; | |
| 53 | int gfx_num; | |
| 54 | int plane_order; | |
| 55 | int deinterleave; | |
| 56 | k051960_callback callback; | |
| 52 | const char *m_gfx_memory_region; | |
| 53 | int m_gfx_num; | |
| 54 | int m_plane_order; | |
| 55 | int m_deinterleave; | |
| 56 | k051960_callback m_callback; | |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | struct k05324x_interface |
| 60 | 60 | { |
| 61 | const char *gfx_memory_region; | |
| 62 | int gfx_num; | |
| 63 | int plane_order; | |
| 64 | int dx, dy; | |
| 65 | int deinterleave; | |
| 66 | k05324x_callback callback; | |
| 61 | const char *m_gfx_memory_region; | |
| 62 | int m_gfx_num; | |
| 63 | int m_plane_order; | |
| 64 | int m_dx, m_dy; | |
| 65 | int m_deinterleave; | |
| 66 | k05324x_callback m_callback; | |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | struct k053247_interface |
| r24078 | r24079 | |
| 148 | 148 | { |
| 149 | 149 | public: |
| 150 | 150 | k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 151 | ~k007121_device() { global_free(m_token); } | |
| 151 | ~k007121_device() {} | |
| 152 | ||
| 153 | DECLARE_READ8_MEMBER( ctrlram_r ); | |
| 154 | DECLARE_WRITE8_MEMBER( ctrl_w ); | |
| 152 | 155 | |
| 153 | // access to legacy token | |
| 154 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 156 | /* shall we move source in the interface? */ | |
| 157 | /* also notice that now we directly pass *gfx[chip] instead of **gfx !! */ | |
| 158 | void sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable, const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask ); | |
| 159 | ||
| 155 | 160 | protected: |
| 156 | 161 | // device-level overrides |
| 157 | 162 | virtual void device_config_complete(); |
| 158 | 163 | virtual void device_start(); |
| 159 | 164 | virtual void device_reset(); |
| 165 | ||
| 160 | 166 | private: |
| 161 | 167 | // internal state |
| 162 | void *m_token; | |
| 168 | UINT8 m_ctrlram[8]; | |
| 169 | int m_flipscreen; | |
| 163 | 170 | }; |
| 164 | 171 | |
| 165 | 172 | extern const device_type K007121; |
| 166 | 173 | |
| 167 | class k007342_device : public device_t | |
| 174 | class k007342_device : public device_t, | |
| 175 | public k007342_interface | |
| 168 | 176 | { |
| 169 | 177 | public: |
| 170 | 178 | k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 171 | ~k007342_device() { | |
| 179 | ~k007342_device() {} | |
| 172 | 180 | |
| 173 | // access to legacy token | |
| 174 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 181 | DECLARE_READ8_MEMBER( read ); | |
| 182 | DECLARE_WRITE8_MEMBER( write ); | |
| 183 | DECLARE_READ8_MEMBER( scroll_r ); | |
| 184 | DECLARE_WRITE8_MEMBER( scroll_w ); | |
| 185 | DECLARE_WRITE8_MEMBER( vreg_w ); | |
| 186 | ||
| 187 | void tilemap_update(); | |
| 188 | void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority); | |
| 189 | int is_int_enabled(); | |
| 190 | ||
| 175 | 191 | protected: |
| 176 | 192 | // device-level overrides |
| 177 | 193 | virtual void device_config_complete(); |
| r24078 | r24079 | |
| 179 | 195 | virtual void device_reset(); |
| 180 | 196 | private: |
| 181 | 197 | // internal state |
| 182 | void *m_token; | |
| 198 | UINT8 *m_ram; | |
| 199 | UINT8 *m_scroll_ram; | |
| 200 | UINT8 *m_videoram_0; | |
| 201 | UINT8 *m_videoram_1; | |
| 202 | UINT8 *m_colorram_0; | |
| 203 | UINT8 *m_colorram_1; | |
| 183 | 204 | |
| 184 | TILEMAP_MAPPER_MEMBER(k007342_scan); | |
| 185 | TILE_GET_INFO_MEMBER(k007342_get_tile_info0); | |
| 186 | TILE_GET_INFO_MEMBER(k007342_get_tile_info1); | |
| 205 | tilemap_t *m_tilemap[2]; | |
| 206 | int m_flipscreen, m_int_enabled; | |
| 207 | UINT8 m_regs[8]; | |
| 208 | UINT16 m_scrollx[2]; | |
| 209 | UINT8 m_scrolly[2]; | |
| 210 | ||
| 211 | TILEMAP_MAPPER_MEMBER(scan); | |
| 212 | TILE_GET_INFO_MEMBER(get_tile_info0); | |
| 213 | TILE_GET_INFO_MEMBER(get_tile_info1); | |
| 214 | void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram ); | |
| 187 | 215 | }; |
| 188 | 216 | |
| 189 | 217 | extern const device_type K007342; |
| 190 | 218 | |
| 191 | class k007420_device : public device_t | |
| 219 | class k007420_device : public device_t, | |
| 220 | public k007420_interface | |
| 192 | 221 | { |
| 193 | 222 | public: |
| 194 | 223 | k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 195 | ~k007420_device() { | |
| 224 | ~k007420_device() {} | |
| 196 | 225 | |
| 197 | // access to legacy token | |
| 198 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 226 | DECLARE_READ8_MEMBER( read ); | |
| 227 | DECLARE_WRITE8_MEMBER( write ); | |
| 228 | void sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); | |
| 229 | ||
| 199 | 230 | protected: |
| 200 | 231 | // device-level overrides |
| 201 | 232 | virtual void device_config_complete(); |
| r24078 | r24079 | |
| 203 | 234 | virtual void device_reset(); |
| 204 | 235 | private: |
| 205 | 236 | // internal state |
| 206 | void *m_token; | |
| 237 | UINT8 *m_ram; | |
| 238 | ||
| 239 | int m_flipscreen; // current code uses the 7342 flipscreen!! | |
| 240 | UINT8 m_regs[8]; // current code uses the 7342 regs!! (only [2]) | |
| 207 | 241 | }; |
| 208 | 242 | |
| 209 | 243 | extern const device_type K007420; |
| 210 | 244 | |
| 211 | class k052109_device : public device_t | |
| 245 | class k052109_device : public device_t, | |
| 246 | public k052109_interface | |
| 212 | 247 | { |
| 213 | 248 | public: |
| 214 | 249 | k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 215 | ~k052109_device() { | |
| 250 | ~k052109_device() {} | |
| 216 | 251 | |
| 217 | // access to legacy token | |
| 218 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 252 | /* | |
| 253 | You don't have to decode the graphics: the vh_start() routines will do that | |
| 254 | for you, using the plane order passed. | |
| 255 | Of course the ROM data must be in the correct order. This is a way to ensure | |
| 256 | that the ROM test will pass. | |
| 257 | The konami_rom_deinterleave() function above will do the reorganization for | |
| 258 | you in most cases (but see tmnt.c for additional bit rotations or byte | |
| 259 | permutations which may be required). | |
| 260 | */ | |
| 261 | #define NORMAL_PLANE_ORDER 0x0123 | |
| 262 | #define REVERSE_PLANE_ORDER 0x3210 | |
| 263 | #define GRADIUS3_PLANE_ORDER 0x1111 | |
| 264 | #define TASMAN_PLANE_ORDER 0x1616 | |
| 265 | ||
| 266 | /* | |
| 267 | The callback is passed: | |
| 268 | - layer number (0 = FIX, 1 = A, 2 = B) | |
| 269 | - bank (range 0-3, output of the pins CAB1 and CAB2) | |
| 270 | - code (range 00-FF, output of the pins VC3-VC10) | |
| 271 | NOTE: code is in the range 0000-FFFF for X-Men, which uses extra RAM | |
| 272 | - color (range 00-FF, output of the pins COL0-COL7) | |
| 273 | The callback must put: | |
| 274 | - in code the resulting tile number | |
| 275 | - in color the resulting color index | |
| 276 | - if necessary, put flags and/or priority for the TileMap code in the tile_info | |
| 277 | structure (e.g. TILE_FLIPX). Note that TILE_FLIPY is handled internally by the | |
| 278 | chip so it must not be set by the callback. | |
| 279 | */ | |
| 280 | ||
| 281 | DECLARE_READ8_MEMBER( read ); | |
| 282 | DECLARE_WRITE8_MEMBER( write ); | |
| 283 | DECLARE_READ16_MEMBER( word_r ); | |
| 284 | DECLARE_WRITE16_MEMBER( word_w ); | |
| 285 | DECLARE_READ16_MEMBER( lsb_r ); | |
| 286 | DECLARE_WRITE16_MEMBER( lsb_w ); | |
| 287 | ||
| 288 | void set_rmrd_line(int state); | |
| 289 | int get_rmrd_line(); | |
| 290 | void tilemap_update(); | |
| 291 | int is_irq_enabled(); | |
| 292 | void set_layer_offsets(int layer, int dx, int dy); | |
| 293 | void tilemap_mark_dirty(int tmap_num); | |
| 294 | void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority); | |
| 295 | ||
| 219 | 296 | protected: |
| 220 | 297 | // device-level overrides |
| 221 | 298 | virtual void device_config_complete(); |
| r24078 | r24079 | |
| 223 | 300 | virtual void device_reset(); |
| 224 | 301 | private: |
| 225 | 302 | // internal state |
| 226 | void *m_token; | |
| 303 | UINT8 *m_ram; | |
| 304 | UINT8 *m_videoram_F; | |
| 305 | UINT8 *m_videoram_A; | |
| 306 | UINT8 *m_videoram_B; | |
| 307 | UINT8 *m_videoram2_F; | |
| 308 | UINT8 *m_videoram2_A; | |
| 309 | UINT8 *m_videoram2_B; | |
| 310 | UINT8 *m_colorram_F; | |
| 311 | UINT8 *m_colorram_A; | |
| 312 | UINT8 *m_colorram_B; | |
| 227 | 313 | |
| 228 | TILE_GET_INFO_MEMBER(k052109_get_tile_info0); | |
| 229 | TILE_GET_INFO_MEMBER(k052109_get_tile_info1); | |
| 230 | TILE_GET_INFO_MEMBER(k052109_get_tile_info2); | |
| 314 | tilemap_t *m_tilemap[3]; | |
| 315 | int m_tileflip_enable; | |
| 316 | UINT8 m_charrombank[4]; | |
| 317 | UINT8 m_charrombank_2[4]; | |
| 318 | UINT8 m_has_extra_video_ram; | |
| 319 | INT32 m_rmrd_line; | |
| 320 | UINT8 m_irq_enabled; | |
| 321 | INT32 m_dx[3], m_dy[3]; | |
| 322 | UINT8 m_romsubbank, m_scrollctrl; | |
| 323 | ||
| 324 | TILE_GET_INFO_MEMBER(get_tile_info0); | |
| 325 | TILE_GET_INFO_MEMBER(get_tile_info1); | |
| 326 | TILE_GET_INFO_MEMBER(get_tile_info2); | |
| 327 | ||
| 328 | void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram1, UINT8 *vram2 ); | |
| 329 | void tileflip_reset(); | |
| 231 | 330 | }; |
| 232 | 331 | |
| 233 | 332 | extern const device_type K052109; |
| 234 | 333 | |
| 235 | class k051960_device : public device_t | |
| 334 | class k051960_device : public device_t, | |
| 335 | public k051960_interface | |
| 236 | 336 | { |
| 237 | 337 | public: |
| 238 | 338 | k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 239 | ~k051960_device() { | |
| 339 | ~k051960_device() {} | |
| 240 | 340 | |
| 241 | // access to legacy token | |
| 242 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 341 | /* | |
| 342 | The callback is passed: | |
| 343 | - code (range 00-1FFF, output of the pins CA5-CA17) | |
| 344 | - color (range 00-FF, output of the pins OC0-OC7). Note that most of the | |
| 345 | time COL7 seems to be "shadow", but not always (e.g. Aliens). | |
| 346 | The callback must put: | |
| 347 | - in code the resulting sprite number | |
| 348 | - in color the resulting color index | |
| 349 | - if necessary, in priority the priority of the sprite wrt tilemaps | |
| 350 | - if necessary, alter shadow to indicate whether the sprite has shadows enabled. | |
| 351 | shadow is preloaded with color & 0x80 so it doesn't need to be changed unless | |
| 352 | the game has special treatment (Aliens) | |
| 353 | */ | |
| 354 | ||
| 355 | DECLARE_READ8_MEMBER( k051960_r ); | |
| 356 | DECLARE_WRITE8_MEMBER( k051960_w ); | |
| 357 | DECLARE_READ16_MEMBER( k051960_word_r ); | |
| 358 | DECLARE_WRITE16_MEMBER( k051960_word_w ); | |
| 359 | ||
| 360 | DECLARE_READ8_MEMBER( k051937_r ); | |
| 361 | DECLARE_WRITE8_MEMBER( k051937_w ); | |
| 362 | DECLARE_READ16_MEMBER( k051937_word_r ); | |
| 363 | DECLARE_WRITE16_MEMBER( k051937_word_w ); | |
| 364 | ||
| 365 | void k051960_sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int min_priority, int max_priority); | |
| 366 | int k051960_is_irq_enabled(); | |
| 367 | int k051960_is_nmi_enabled(); | |
| 368 | void k051960_set_sprite_offsets(int dx, int dy); | |
| 369 | ||
| 370 | #if 0 // to be moved in the specific drivers! | |
| 371 | /* special handling for the chips sharing address space */ | |
| 372 | DECLARE_READ8_HANDLER( k052109_051960_r ); | |
| 373 | DECLARE_WRITE8_HANDLER( k052109_051960_w ); | |
| 374 | #endif | |
| 375 | ||
| 243 | 376 | protected: |
| 244 | 377 | // device-level overrides |
| 245 | 378 | virtual void device_config_complete(); |
| r24078 | r24079 | |
| 247 | 380 | virtual void device_reset(); |
| 248 | 381 | private: |
| 249 | 382 | // internal state |
| 250 | void *m_token; | |
| 383 | UINT8 *m_ram; | |
| 384 | ||
| 385 | gfx_element *m_gfx; | |
| 386 | ||
| 387 | UINT8 m_spriterombank[3]; | |
| 388 | int m_dx, m_dy; | |
| 389 | int m_romoffset; | |
| 390 | int m_spriteflip, m_readroms; | |
| 391 | int m_irq_enabled, m_nmi_enabled; | |
| 392 | ||
| 393 | int m_k051937_counter; | |
| 394 | ||
| 395 | int k051960_fetchromdata( int byte ); | |
| 251 | 396 | }; |
| 252 | 397 | |
| 253 | 398 | extern const device_type K051960; |
| 254 | 399 | |
| 255 | class k05324x_device : public device_t | |
| 400 | class k05324x_device : public device_t, | |
| 401 | public k05324x_interface | |
| 256 | 402 | { |
| 257 | 403 | public: |
| 258 | 404 | k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 259 | ~k05324x_device() { | |
| 405 | ~k05324x_device() {} | |
| 260 | 406 | |
| 261 | // access to legacy token | |
| 262 | void *token() const { assert(m_token != NULL); return m_token; } | |
| 407 | DECLARE_READ16_MEMBER( k053245_word_r ); | |
| 408 | DECLARE_WRITE16_MEMBER( k053245_word_w ); | |
| 409 | DECLARE_READ8_MEMBER( k053245_r ); | |
| 410 | DECLARE_WRITE8_MEMBER( k053245_w ); | |
| 411 | DECLARE_READ8_MEMBER( k053244_r ); | |
| 412 | DECLARE_WRITE8_MEMBER( k053244_w ); | |
| 413 | DECLARE_READ16_MEMBER( k053244_lsb_r ); | |
| 414 | DECLARE_WRITE16_MEMBER( k053244_lsb_w ); | |
| 415 | DECLARE_READ16_MEMBER( k053244_word_r ); | |
| 416 | DECLARE_WRITE16_MEMBER( k053244_word_w ); | |
| 417 | void k053244_bankselect(int bank); /* used by TMNT2, Asterix and Premier Soccer for ROM testing */ | |
| 418 | void k053245_sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 419 | void k053245_sprites_draw_lethal(bitmap_ind16 &bitmap, const rectangle &cliprect); /* for lethal enforcers */ | |
| 420 | void k053245_clear_buffer(); | |
| 421 | void k053245_update_buffer(); | |
| 422 | void k053245_set_sprite_offs(int offsx, int offsy); | |
| 423 | void k05324x_set_z_rejection(int zcode); // common to k053244/5 | |
| 424 | ||
| 263 | 425 | protected: |
| 264 | 426 | // device-level overrides |
| 265 | 427 | virtual void device_config_complete(); |
| r24078 | r24079 | |
| 267 | 429 | virtual void device_reset(); |
| 268 | 430 | private: |
| 269 | 431 | // internal state |
| 270 | void *m_token; | |
| 432 | UINT16 *m_ram; | |
| 433 | UINT16 *m_buffer; | |
| 434 | ||
| 435 | gfx_element *m_gfx; | |
| 436 | ||
| 437 | UINT8 m_regs[0x10]; // 053244 | |
| 438 | int m_rombank; // 053244 | |
| 439 | int m_ramsize; | |
| 440 | int m_z_rejection; | |
| 441 | ||
| 442 | DECLARE_READ16_MEMBER( k053244_reg_word_r ); // OBJSET0 debug handler | |
| 271 | 443 | }; |
| 272 | 444 | |
| 273 | 445 | extern const device_type K053244; |
| r24078 | r24079 | |
| 722 | 894 | DEVICE I/O FUNCTIONS |
| 723 | 895 | ***************************************************************************/ |
| 724 | 896 | |
| 725 | /** Konami 007121 **/ | |
| 726 | DECLARE_READ8_DEVICE_HANDLER( k007121_ctrlram_r ); | |
| 727 | DECLARE_WRITE8_DEVICE_HANDLER( k007121_ctrl_w ); | |
| 728 | ||
| 729 | /* shall we move source in the interface? */ | |
| 730 | /* also notice that now we directly pass *gfx[chip] instead of **gfx !! */ | |
| 731 | void k007121_sprites_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable, | |
| 732 | const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask ); | |
| 733 | ||
| 734 | ||
| 735 | /** Konami 007342 **/ | |
| 736 | DECLARE_READ8_DEVICE_HANDLER( k007342_r ); | |
| 737 | DECLARE_WRITE8_DEVICE_HANDLER( k007342_w ); | |
| 738 | DECLARE_READ8_DEVICE_HANDLER( k007342_scroll_r ); | |
| 739 | DECLARE_WRITE8_DEVICE_HANDLER( k007342_scroll_w ); | |
| 740 | DECLARE_WRITE8_DEVICE_HANDLER( k007342_vreg_w ); | |
| 741 | ||
| 742 | void k007342_tilemap_update(device_t *device); | |
| 743 | void k007342_tilemap_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority); | |
| 744 | int k007342_is_int_enabled(device_t *device); | |
| 745 | ||
| 746 | ||
| 747 | /** Konami 007420 **/ | |
| 748 | #define K007420_SPRITERAM_SIZE 0x200 | |
| 749 | ||
| 750 | DECLARE_READ8_DEVICE_HANDLER( k007420_r ); | |
| 751 | DECLARE_WRITE8_DEVICE_HANDLER( k007420_w ); | |
| 752 | void k007420_sprites_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); | |
| 753 | ||
| 754 | ||
| 755 | /** Konami 052109 **/ | |
| 756 | /* | |
| 757 | You don't have to decode the graphics: the vh_start() routines will do that | |
| 758 | for you, using the plane order passed. | |
| 759 | Of course the ROM data must be in the correct order. This is a way to ensure | |
| 760 | that the ROM test will pass. | |
| 761 | The konami_rom_deinterleave() function above will do the reorganization for | |
| 762 | you in most cases (but see tmnt.c for additional bit rotations or byte | |
| 763 | permutations which may be required). | |
| 764 | */ | |
| 765 | #define NORMAL_PLANE_ORDER 0x0123 | |
| 766 | #define REVERSE_PLANE_ORDER 0x3210 | |
| 767 | #define GRADIUS3_PLANE_ORDER 0x1111 | |
| 768 | #define TASMAN_PLANE_ORDER 0x1616 | |
| 769 | ||
| 770 | /* | |
| 771 | The callback is passed: | |
| 772 | - layer number (0 = FIX, 1 = A, 2 = B) | |
| 773 | - bank (range 0-3, output of the pins CAB1 and CAB2) | |
| 774 | - code (range 00-FF, output of the pins VC3-VC10) | |
| 775 | NOTE: code is in the range 0000-FFFF for X-Men, which uses extra RAM | |
| 776 | - color (range 00-FF, output of the pins COL0-COL7) | |
| 777 | The callback must put: | |
| 778 | - in code the resulting tile number | |
| 779 | - in color the resulting color index | |
| 780 | - if necessary, put flags and/or priority for the TileMap code in the tile_info | |
| 781 | structure (e.g. TILE_FLIPX). Note that TILE_FLIPY is handled internally by the | |
| 782 | chip so it must not be set by the callback. | |
| 783 | */ | |
| 784 | ||
| 785 | DECLARE_READ8_DEVICE_HANDLER( k052109_r ); | |
| 786 | DECLARE_WRITE8_DEVICE_HANDLER( k052109_w ); | |
| 787 | DECLARE_READ16_DEVICE_HANDLER( k052109_word_r ); | |
| 788 | DECLARE_WRITE16_DEVICE_HANDLER( k052109_word_w ); | |
| 789 | DECLARE_READ16_DEVICE_HANDLER( k052109_lsb_r ); | |
| 790 | DECLARE_WRITE16_DEVICE_HANDLER( k052109_lsb_w ); | |
| 791 | ||
| 792 | void k052109_set_rmrd_line(device_t *device, int state); | |
| 793 | int k052109_get_rmrd_line(device_t *device); | |
| 794 | void k052109_tilemap_update(device_t *device); | |
| 795 | int k052109_is_irq_enabled(device_t *device); | |
| 796 | void k052109_set_layer_offsets(device_t *device, int layer, int dx, int dy); | |
| 797 | void k052109_tilemap_mark_dirty(device_t *device, int tmap_num); | |
| 798 | void k052109_tilemap_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority); | |
| 799 | ||
| 800 | ||
| 801 | /** Konami 051960 / 051937 **/ | |
| 802 | /* | |
| 803 | The callback is passed: | |
| 804 | - code (range 00-1FFF, output of the pins CA5-CA17) | |
| 805 | - color (range 00-FF, output of the pins OC0-OC7). Note that most of the | |
| 806 | time COL7 seems to be "shadow", but not always (e.g. Aliens). | |
| 807 | The callback must put: | |
| 808 | - in code the resulting sprite number | |
| 809 | - in color the resulting color index | |
| 810 | - if necessary, in priority the priority of the sprite wrt tilemaps | |
| 811 | - if necessary, alter shadow to indicate whether the sprite has shadows enabled. | |
| 812 | shadow is preloaded with color & 0x80 so it doesn't need to be changed unless | |
| 813 | the game has special treatment (Aliens) | |
| 814 | */ | |
| 815 | ||
| 816 | DECLARE_READ8_DEVICE_HANDLER( k051960_r ); | |
| 817 | DECLARE_WRITE8_DEVICE_HANDLER( k051960_w ); | |
| 818 | DECLARE_READ16_DEVICE_HANDLER( k051960_word_r ); | |
| 819 | DECLARE_WRITE16_DEVICE_HANDLER( k051960_word_w ); | |
| 820 | ||
| 821 | DECLARE_READ8_DEVICE_HANDLER( k051937_r ); | |
| 822 | DECLARE_WRITE8_DEVICE_HANDLER( k051937_w ); | |
| 823 | DECLARE_READ16_DEVICE_HANDLER( k051937_word_r ); | |
| 824 | DECLARE_WRITE16_DEVICE_HANDLER( k051937_word_w ); | |
| 825 | ||
| 826 | void k051960_sprites_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int min_priority, int max_priority); | |
| 827 | int k051960_is_irq_enabled(device_t *device); | |
| 828 | int k051960_is_nmi_enabled(device_t *device); | |
| 829 | void k051960_set_sprite_offsets(device_t *device, int dx, int dy); | |
| 830 | ||
| 831 | #if 0 // to be moved in the specific drivers! | |
| 832 | /* special handling for the chips sharing address space */ | |
| 833 | DECLARE_READ8_HANDLER( k052109_051960_r ); | |
| 834 | DECLARE_WRITE8_HANDLER( k052109_051960_w ); | |
| 835 | #endif | |
| 836 | ||
| 837 | ||
| 838 | /** Konami 053244 / 053245 **/ | |
| 839 | DECLARE_READ16_DEVICE_HANDLER( k053245_word_r ); | |
| 840 | DECLARE_WRITE16_DEVICE_HANDLER( k053245_word_w ); | |
| 841 | DECLARE_READ8_DEVICE_HANDLER( k053245_r ); | |
| 842 | DECLARE_WRITE8_DEVICE_HANDLER( k053245_w ); | |
| 843 | DECLARE_READ8_DEVICE_HANDLER( k053244_r ); | |
| 844 | DECLARE_WRITE8_DEVICE_HANDLER( k053244_w ); | |
| 845 | DECLARE_READ16_DEVICE_HANDLER( k053244_lsb_r ); | |
| 846 | DECLARE_WRITE16_DEVICE_HANDLER( k053244_lsb_w ); | |
| 847 | DECLARE_READ16_DEVICE_HANDLER( k053244_word_r ); | |
| 848 | DECLARE_WRITE16_DEVICE_HANDLER( k053244_word_w ); | |
| 849 | void k053244_bankselect(device_t *device, int bank); /* used by TMNT2, Asterix and Premier Soccer for ROM testing */ | |
| 850 | void k053245_sprites_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 851 | void k053245_sprites_draw_lethal(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect); /* for lethal enforcers */ | |
| 852 | void k053245_clear_buffer(device_t *device); | |
| 853 | void k053245_set_sprite_offs(device_t *device, int offsx, int offsy); | |
| 854 | ||
| 855 | ||
| 856 | ||
| 857 | 897 | /** Konami 053246 / 053247 / 055673 **/ |
| 858 | 898 | #define K055673_LAYOUT_GX 0 |
| 859 | 899 | #define K055673_LAYOUT_RNG 1 |
| r24078 | r24079 | |
| 887 | 927 | int k053247_read_register(device_t *device, int regnum); |
| 888 | 928 | void k053247_set_sprite_offs(device_t *device, int offsx, int offsy); |
| 889 | 929 | void k053247_wraparound_enable(device_t *device, int status); |
| 890 | void k05324x_set_z_rejection(device_t *device, int zcode); // common to k053244/5 | |
| 891 | 930 | void k053247_set_z_rejection(device_t *device, int zcode); // common to k053246/7 |
| 892 | 931 | void k053247_get_ram(device_t *device, UINT16 **ram); |
| 893 | 932 | int k053247_get_dx(device_t *device); |
| r24078 | r24079 | |
| 1175 | 1214 | DECLARE_READ32_DEVICE_HANDLER( k053247_reg_long_r ); // OBJSET2 |
| 1176 | 1215 | DECLARE_READ32_DEVICE_HANDLER( k055555_long_r ); // PCU2 |
| 1177 | 1216 | |
| 1178 | DECLARE_READ16_DEVICE_HANDLER( k053244_reg_word_r ); // OBJSET0 | |
| 1179 | ||
| 1180 | 1217 | #endif |
| r24078 | r24079 | |
|---|---|---|
| 123 | 123 | { |
| 124 | 124 | k051316_zoom_draw(m_k051316_3, bitmap, cliprect, 0, 0); |
| 125 | 125 | k051316_zoom_draw(m_k051316_2, bitmap, cliprect, 0, 0); |
| 126 | k051960_sprites_draw( | |
| 126 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 127 | 127 | k051316_zoom_draw(m_k051316_1, bitmap, cliprect, 0, 0); |
| 128 | k051960_sprites_draw( | |
| 128 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); | |
| 129 | 129 | return 0; |
| 130 | 130 | } |
| r24078 | r24079 | |
|---|---|---|
| 55 | 55 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 56 | 56 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 57 | 57 | |
| 58 | k052109 | |
| 58 | m_k052109->tilemap_update(); | |
| 59 | 59 | |
| 60 | 60 | layer[0] = 0; |
| 61 | 61 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 68 | 68 | |
| 69 | 69 | machine().priority_bitmap.fill(0, cliprect); |
| 70 | 70 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 71 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[0], 0,1); | |
| 72 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[1], 0,2); | |
| 73 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[2], 0,4); | |
| 71 | m_k052109->tilemap_draw(bitmap, cliprect, layer[0], 0,1); | |
| 72 | m_k052109->tilemap_draw(bitmap, cliprect, layer[1], 0,2); | |
| 73 | m_k052109->tilemap_draw(bitmap, cliprect, layer[2], 0,4); | |
| 74 | 74 | |
| 75 | k053245_sprites_draw( | |
| 75 | m_k053245->k053245_sprites_draw(bitmap, cliprect); | |
| 76 | 76 | return 0; |
| 77 | 77 | } |
| r24078 | r24079 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | TILE_GET_INFO_MEMBER(combatsc_state::get_tile_info0) |
| 116 | 116 | { |
| 117 | UINT8 ctrl_6 = k007121_ctrlram_r( | |
| 117 | UINT8 ctrl_6 = m_k007121_1->ctrlram_r(generic_space(), 6); | |
| 118 | 118 | UINT8 attributes = m_page[0][tile_index]; |
| 119 | 119 | int bank = 4 * ((m_vreg & 0x0f) - 1); |
| 120 | 120 | int number, color; |
| r24078 | r24079 | |
| 148 | 148 | |
| 149 | 149 | TILE_GET_INFO_MEMBER(combatsc_state::get_tile_info1) |
| 150 | 150 | { |
| 151 | UINT8 ctrl_6 = k007121_ctrlram_r( | |
| 151 | UINT8 ctrl_6 = m_k007121_2->ctrlram_r(generic_space(), 6); | |
| 152 | 152 | UINT8 attributes = m_page[1][tile_index]; |
| 153 | 153 | int bank = 4 * ((m_vreg >> 4) - 1); |
| 154 | 154 | int number, color; |
| r24078 | r24079 | |
| 346 | 346 | |
| 347 | 347 | WRITE8_MEMBER(combatsc_state::combatsc_pf_control_w) |
| 348 | 348 | { |
| 349 | device_t *k007121 = m_video_circuit ? m_k007121_2 : m_k007121_1; | |
| 350 | k007121_ctrl_w(k007121, space, offset, data); | |
| 349 | k007121_device *k007121 = m_video_circuit ? m_k007121_2 : m_k007121_1; | |
| 350 | k007121->ctrl_w(space, offset, data); | |
| 351 | 351 | |
| 352 | 352 | if (offset == 7) |
| 353 | 353 | m_bg_tilemap[m_video_circuit]->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| r24078 | r24079 | |
| 381 | 381 | |
| 382 | 382 | void combatsc_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *source, int circuit, UINT32 pri_mask ) |
| 383 | 383 | { |
| 384 | device | |
| 384 | k007121_device *k007121 = circuit ? m_k007121_2 : m_k007121_1; | |
| 385 | 385 | address_space &space = machine().driver_data()->generic_space(); |
| 386 | int base_color = (circuit * 4) * 16 + (k007121 | |
| 386 | int base_color = (circuit * 4) * 16 + (k007121->ctrlram_r(space, 6) & 0x10) * 2; | |
| 387 | 387 | |
| 388 | k007121 | |
| 388 | k007121->sprites_draw(bitmap, cliprect, machine().gfx[circuit], machine().colortable, source, base_color, 0, 0, pri_mask); | |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | |
| r24078 | r24079 | |
| 396 | 396 | set_pens(); |
| 397 | 397 | |
| 398 | 398 | address_space &space = machine().driver_data()->generic_space(); |
| 399 | if (k007121_ctrlram_r( | |
| 399 | if (m_k007121_1->ctrlram_r(space, 1) & 0x02) | |
| 400 | 400 | { |
| 401 | 401 | m_bg_tilemap[0]->set_scroll_rows(32); |
| 402 | 402 | for (i = 0; i < 32; i++) |
| r24078 | r24079 | |
| 405 | 405 | else |
| 406 | 406 | { |
| 407 | 407 | m_bg_tilemap[0]->set_scroll_rows(1); |
| 408 | m_bg_tilemap[0]->set_scrollx(0, k007121_ctrlram_r( | |
| 408 | m_bg_tilemap[0]->set_scrollx(0, m_k007121_1->ctrlram_r(space, 0) | ((m_k007121_1->ctrlram_r(space, 1) & 0x01) << 8)); | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | if (k007121_ctrlram_r( | |
| 411 | if (m_k007121_2->ctrlram_r(space, 1) & 0x02) | |
| 412 | 412 | { |
| 413 | 413 | m_bg_tilemap[1]->set_scroll_rows(32); |
| 414 | 414 | for (i = 0; i < 32; i++) |
| r24078 | r24079 | |
| 417 | 417 | else |
| 418 | 418 | { |
| 419 | 419 | m_bg_tilemap[1]->set_scroll_rows(1); |
| 420 | m_bg_tilemap[1]->set_scrollx(0, k007121_ctrlram_r( | |
| 420 | m_bg_tilemap[1]->set_scrollx(0, m_k007121_2->ctrlram_r(space, 0) | ((m_k007121_2->ctrlram_r(space, 1) & 0x01) << 8)); | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | m_bg_tilemap[0]->set_scrolly(0, k007121_ctrlram_r(m_k007121_1, space, 2)); | |
| 424 | m_bg_tilemap[1]->set_scrolly(0, k007121_ctrlram_r(m_k007121_2, space, 2)); | |
| 423 | m_bg_tilemap[0]->set_scrolly(0, m_k007121_1->ctrlram_r(space, 2)); | |
| 424 | m_bg_tilemap[1]->set_scrolly(0, m_k007121_2->ctrlram_r(space, 2)); | |
| 425 | 425 | |
| 426 | 426 | machine().priority_bitmap.fill(0, cliprect); |
| 427 | 427 | |
| r24078 | r24079 | |
| 448 | 448 | draw_sprites(bitmap, cliprect, m_spriteram[0], 0, 0x4444); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | if (k007121_ctrlram_r( | |
| 451 | if (m_k007121_1->ctrlram_r(space, 1) & 0x08) | |
| 452 | 452 | { |
| 453 | 453 | for (i = 0; i < 32; i++) |
| 454 | 454 | { |
| r24078 | r24079 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /* chop the extreme columns if necessary */ |
| 461 | if (k007121_ctrlram_r( | |
| 461 | if (m_k007121_1->ctrlram_r(space, 3) & 0x40) | |
| 462 | 462 | { |
| 463 | 463 | rectangle clip; |
| 464 | 464 |
| r24078 | r24079 | |
|---|---|---|
| 1 | 1 | #include "emu.h" |
| 2 | #include "video/konicdev.h" | |
| 3 | 2 | #include "includes/rockrage.h" |
| 4 | 3 | |
| 5 | 4 | void rockrage_state::palette_init() |
| r24078 | r24079 | |
| 100 | 99 | { |
| 101 | 100 | set_pens(machine()); |
| 102 | 101 | |
| 103 | k007342 | |
| 102 | m_k007342->tilemap_update(); | |
| 104 | 103 | |
| 105 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); | |
| 106 | k007420_sprites_draw(m_k007420, bitmap, cliprect, machine().gfx[1]); | |
| 107 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE, 0); | |
| 108 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 1, 0, 0); | |
| 109 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 1, 1, 0); | |
| 104 | m_k007342->tilemap_draw(bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); | |
| 105 | m_k007420->sprites_draw(bitmap, cliprect, machine().gfx[1]); | |
| 106 | m_k007342->tilemap_draw(bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE, 0); | |
| 107 | m_k007342->tilemap_draw(bitmap, cliprect, 1, 0, 0); | |
| 108 | m_k007342->tilemap_draw(bitmap, cliprect, 1, 1, 0); | |
| 110 | 109 | return 0; |
| 111 | 110 | } |
| r24078 | r24079 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | UINT32 ajax_state::screen_update_ajax(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 89 | 89 | { |
| 90 | k052109 | |
| 90 | m_k052109->tilemap_update(); | |
| 91 | 91 | |
| 92 | 92 | machine().priority_bitmap.fill(0, cliprect); |
| 93 | 93 | |
| 94 | 94 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 95 | k052109 | |
| 95 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 1); | |
| 96 | 96 | if (m_priority) |
| 97 | 97 | { |
| 98 | 98 | /* basic layer order is B, zoom, A, F */ |
| 99 | 99 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 4); |
| 100 | k052109 | |
| 100 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 2); | |
| 101 | 101 | } |
| 102 | 102 | else |
| 103 | 103 | { |
| 104 | 104 | /* basic layer order is B, A, zoom, F */ |
| 105 | k052109 | |
| 105 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 2); | |
| 106 | 106 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 4); |
| 107 | 107 | } |
| 108 | k052109 | |
| 108 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 8); | |
| 109 | 109 | |
| 110 | k051960_sprites_draw( | |
| 110 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 111 | 111 | return 0; |
| 112 | 112 | } |
| r24078 | r24079 | |
|---|---|---|
| 1 | 1 | #include "emu.h" |
| 2 | #include "video/konicdev.h" | |
| 3 | 2 | #include "includes/fastlane.h" |
| 4 | 3 | |
| 5 | 4 | |
| r24078 | r24079 | |
| 48 | 47 | |
| 49 | 48 | TILE_GET_INFO_MEMBER(fastlane_state::get_tile_info0) |
| 50 | 49 | { |
| 51 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121, generic_space(), 3); | |
| 52 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121, generic_space(), 4); | |
| 53 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121, generic_space(), 5); | |
| 50 | UINT8 ctrl_3 = m_k007121->ctrlram_r(generic_space(), 3); | |
| 51 | UINT8 ctrl_4 = m_k007121->ctrlram_r(generic_space(), 4); | |
| 52 | UINT8 ctrl_5 = m_k007121->ctrlram_r(generic_space(), 5); | |
| 54 | 53 | int attr = m_videoram1[tile_index]; |
| 55 | 54 | int code = m_videoram1[tile_index + 0x400]; |
| 56 | 55 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| r24078 | r24079 | |
| 76 | 75 | |
| 77 | 76 | TILE_GET_INFO_MEMBER(fastlane_state::get_tile_info1) |
| 78 | 77 | { |
| 79 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121, generic_space(), 3); | |
| 80 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121, generic_space(), 4); | |
| 81 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121, generic_space(), 5); | |
| 78 | UINT8 ctrl_3 = m_k007121->ctrlram_r(generic_space(), 3); | |
| 79 | UINT8 ctrl_4 = m_k007121->ctrlram_r(generic_space(), 4); | |
| 80 | UINT8 ctrl_5 = m_k007121->ctrlram_r(generic_space(), 5); | |
| 82 | 81 | int attr = m_videoram2[tile_index]; |
| 83 | 82 | int code = m_videoram2[tile_index + 0x400]; |
| 84 | 83 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| r24078 | r24079 | |
| 161 | 160 | |
| 162 | 161 | /* set scroll registers */ |
| 163 | 162 | address_space &space = machine().driver_data()->generic_space(); |
| 164 | xoffs = k007121 | |
| 163 | xoffs = m_k007121->ctrlram_r(space, 0); | |
| 165 | 164 | for (i = 0; i < 32; i++) |
| 166 | 165 | m_layer0->set_scrollx(i, m_k007121_regs[0x20 + i] + xoffs - 40); |
| 167 | 166 | |
| 168 | m_layer0->set_scrolly(0, k007121 | |
| 167 | m_layer0->set_scrolly(0, m_k007121->ctrlram_r(space, 2)); | |
| 169 | 168 | |
| 170 | 169 | m_layer0->draw(bitmap, finalclip0, 0, 0); |
| 171 | k007121 | |
| 170 | m_k007121->sprites_draw(bitmap, cliprect, machine().gfx[0], machine().colortable, m_spriteram, 0, 40, 0, (UINT32)-1); | |
| 172 | 171 | m_layer1->draw(bitmap, finalclip1, 0, 0); |
| 173 | 172 | return 0; |
| 174 | 173 | } |
| r24078 | r24079 | |
|---|---|---|
| 61 | 61 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 62 | 62 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 63 | 63 | |
| 64 | k052109 | |
| 64 | m_k052109->tilemap_update(); | |
| 65 | 65 | |
| 66 | 66 | layer[0] = 0; |
| 67 | 67 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 73 | 73 | konami_sortlayers3(layer, m_layerpri); |
| 74 | 74 | |
| 75 | 75 | machine().priority_bitmap.fill(0, cliprect); |
| 76 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); | |
| 77 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[1], 0, 2); | |
| 78 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[2], 0, 4); | |
| 76 | m_k052109->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); | |
| 77 | m_k052109->tilemap_draw(bitmap, cliprect, layer[1], 0, 2); | |
| 78 | m_k052109->tilemap_draw(bitmap, cliprect, layer[2], 0, 4); | |
| 79 | 79 | |
| 80 | 80 | k053247_sprites_draw(m_k053246, bitmap, cliprect); |
| 81 | 81 | return 0; |
| r24078 | r24079 | |
|---|---|---|
| 75 | 75 | |
| 76 | 76 | UINT32 crimfght_state::screen_update_crimfght(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 77 | 77 | { |
| 78 | k052109 | |
| 78 | m_k052109->tilemap_update(); | |
| 79 | 79 | |
| 80 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 81 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 2, 2); | |
| 82 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 0); | |
| 83 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 1, 1); | |
| 84 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 85 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 80 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 81 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 2, 2); | |
| 82 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 0); | |
| 83 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); | |
| 84 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 85 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 86 | 86 | return 0; |
| 87 | 87 | } |
| r24078 | r24079 | |
|---|---|---|
| 55 | 55 | { |
| 56 | 56 | machine().priority_bitmap.fill(0, cliprect); |
| 57 | 57 | |
| 58 | k052109 | |
| 58 | m_k052109->tilemap_update(); | |
| 59 | 59 | |
| 60 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2 | |
| 61 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 1); // tile 1 | |
| 62 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 2); // tile 0 | |
| 60 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2 | |
| 61 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 1); // tile 1 | |
| 62 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 2); // tile 0 | |
| 63 | 63 | |
| 64 | k051960_sprites_draw( | |
| 64 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, -1); | |
| 65 | 65 | return 0; |
| 66 | 66 | } |
| r24078 | r24079 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "emu.h" |
| 8 | #include "video/konicdev.h" | |
| 9 | 8 | #include "includes/contra.h" |
| 10 | 9 | |
| 11 | 10 | |
| r24078 | r24079 | |
| 77 | 76 | |
| 78 | 77 | TILE_GET_INFO_MEMBER(contra_state::get_fg_tile_info) |
| 79 | 78 | { |
| 80 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121_1, generic_space(), 3); | |
| 81 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121_1, generic_space(), 4); | |
| 82 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121_1, generic_space(), 5); | |
| 83 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121_1, generic_space(), 6); | |
| 79 | UINT8 ctrl_3 = m_k007121_1->ctrlram_r(generic_space(), 3); | |
| 80 | UINT8 ctrl_4 = m_k007121_1->ctrlram_r(generic_space(), 4); | |
| 81 | UINT8 ctrl_5 = m_k007121_1->ctrlram_r(generic_space(), 5); | |
| 82 | UINT8 ctrl_6 = m_k007121_1->ctrlram_r(generic_space(), 6); | |
| 84 | 83 | int attr = m_fg_cram[tile_index]; |
| 85 | 84 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| 86 | 85 | int bit1 = (ctrl_5 >> 2) & 0x03; |
| r24078 | r24079 | |
| 105 | 104 | |
| 106 | 105 | TILE_GET_INFO_MEMBER(contra_state::get_bg_tile_info) |
| 107 | 106 | { |
| 108 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121_2, generic_space(), 3); | |
| 109 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121_2, generic_space(), 4); | |
| 110 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121_2, generic_space(), 5); | |
| 111 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121_2, generic_space(), 6); | |
| 107 | UINT8 ctrl_3 = m_k007121_2->ctrlram_r(generic_space(), 3); | |
| 108 | UINT8 ctrl_4 = m_k007121_2->ctrlram_r(generic_space(), 4); | |
| 109 | UINT8 ctrl_5 = m_k007121_2->ctrlram_r(generic_space(), 5); | |
| 110 | UINT8 ctrl_6 = m_k007121_2->ctrlram_r(generic_space(), 6); | |
| 112 | 111 | int attr = m_bg_cram[tile_index]; |
| 113 | 112 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| 114 | 113 | int bit1 = (ctrl_5 >> 2) & 0x03; |
| r24078 | r24079 | |
| 134 | 133 | |
| 135 | 134 | TILE_GET_INFO_MEMBER(contra_state::get_tx_tile_info) |
| 136 | 135 | { |
| 137 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121_1, generic_space(), 5); | |
| 138 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121_1, generic_space(), 6); | |
| 136 | UINT8 ctrl_5 = m_k007121_1->ctrlram_r(generic_space(), 5); | |
| 137 | UINT8 ctrl_6 = m_k007121_1->ctrlram_r(generic_space(), 6); | |
| 139 | 138 | int attr = m_tx_cram[tile_index]; |
| 140 | 139 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| 141 | 140 | int bit1 = (ctrl_5 >> 2) & 0x03; |
| r24078 | r24079 | |
| 230 | 229 | |
| 231 | 230 | WRITE8_MEMBER(contra_state::contra_K007121_ctrl_0_w) |
| 232 | 231 | { |
| 233 | UINT8 ctrl_6 = k007121_ctrlram_r( | |
| 232 | UINT8 ctrl_6 = m_k007121_1->ctrlram_r(space, 6); | |
| 234 | 233 | |
| 235 | 234 | if (offset == 3) |
| 236 | 235 | { |
| r24078 | r24079 | |
| 249 | 248 | if (offset == 7) |
| 250 | 249 | m_fg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 251 | 250 | |
| 252 | k007121_ctrl_w( | |
| 251 | m_k007121_1->ctrl_w(space, offset, data); | |
| 253 | 252 | } |
| 254 | 253 | |
| 255 | 254 | WRITE8_MEMBER(contra_state::contra_K007121_ctrl_1_w) |
| 256 | 255 | { |
| 257 | UINT8 ctrl_6 = k007121_ctrlram_r( | |
| 256 | UINT8 ctrl_6 = m_k007121_2->ctrlram_r(space, 6); | |
| 258 | 257 | |
| 259 | 258 | if (offset == 3) |
| 260 | 259 | { |
| r24078 | r24079 | |
| 271 | 270 | if (offset == 7) |
| 272 | 271 | m_bg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 273 | 272 | |
| 274 | k007121_ctrl_w( | |
| 273 | m_k007121_2->ctrl_w(space, offset, data); | |
| 275 | 274 | } |
| 276 | 275 | |
| 277 | 276 | |
| r24078 | r24079 | |
| 284 | 283 | |
| 285 | 284 | void contra_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank ) |
| 286 | 285 | { |
| 287 | device | |
| 286 | k007121_device *k007121 = bank ? m_k007121_2 : m_k007121_1; | |
| 288 | 287 | address_space &space = machine().driver_data()->generic_space(); |
| 289 | int base_color = (k007121 | |
| 288 | int base_color = (k007121->ctrlram_r(space, 6) & 0x30) * 2; | |
| 290 | 289 | const UINT8 *source; |
| 291 | 290 | |
| 292 | 291 | if (bank == 0) |
| r24078 | r24079 | |
| 294 | 293 | else |
| 295 | 294 | source = m_buffered_spriteram_2; |
| 296 | 295 | |
| 297 | k007121 | |
| 296 | k007121->sprites_draw(bitmap, cliprect, machine().gfx[bank], machine().colortable, source, base_color, 40, 0, (UINT32)-1); | |
| 298 | 297 | } |
| 299 | 298 | |
| 300 | 299 | UINT32 contra_state::screen_update_contra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 301 | 300 | { |
| 302 | 301 | address_space &space = machine().driver_data()->generic_space(); |
| 303 | UINT8 ctrl_1_0 = k007121_ctrlram_r(m_k007121_1, space, 0); | |
| 304 | UINT8 ctrl_1_2 = k007121_ctrlram_r(m_k007121_1, space, 2); | |
| 305 | UINT8 ctrl_2_0 = k007121_ctrlram_r(m_k007121_2, space, 0); | |
| 306 | UINT8 ctrl_2_2 = k007121_ctrlram_r(m_k007121_2, space, 2); | |
| 302 | UINT8 ctrl_1_0 = m_k007121_1->ctrlram_r(space, 0); | |
| 303 | UINT8 ctrl_1_2 = m_k007121_1->ctrlram_r(space, 2); | |
| 304 | UINT8 ctrl_2_0 = m_k007121_2->ctrlram_r(space, 0); | |
| 305 | UINT8 ctrl_2_2 = m_k007121_2->ctrlram_r(space, 2); | |
| 307 | 306 | rectangle bg_finalclip = m_bg_clip; |
| 308 | 307 | rectangle fg_finalclip = m_fg_clip; |
| 309 | 308 | rectangle tx_finalclip = m_tx_clip; |
| r24078 | r24079 | |
|---|---|---|
| 1 | 1 | #include "emu.h" |
| 2 | #include "video/konicdev.h" | |
| 3 | 2 | #include "includes/battlnts.h" |
| 4 | 3 | |
| 5 | 4 | /*************************************************************************** |
| r24078 | r24079 | |
| 44 | 43 | |
| 45 | 44 | UINT32 battlnts_state::screen_update_battlnts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 46 | 45 | { |
| 47 | k007342 | |
| 46 | m_k007342->tilemap_update(); | |
| 48 | 47 | |
| 49 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE ,0); | |
| 50 | k007420_sprites_draw(m_k007420, bitmap, cliprect, machine().gfx[1]); | |
| 51 | k007342_tilemap_draw(m_k007342, bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE ,0); | |
| 48 | m_k007342->tilemap_draw(bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE ,0); | |
| 49 | m_k007420->sprites_draw(bitmap, cliprect, machine().gfx[1]); | |
| 50 | m_k007342->tilemap_draw(bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE ,0); | |
| 52 | 51 | return 0; |
| 53 | 52 | } |
| r24078 | r24079 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | UINT32 bottom9_state::screen_update_bottom9(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 75 | 75 | { |
| 76 | k052109 | |
| 76 | m_k052109->tilemap_update(); | |
| 77 | 77 | |
| 78 | 78 | /* note: FIX layer is not used */ |
| 79 | 79 | bitmap.fill(m_layer_colorbase[1], cliprect); |
| 80 | 80 | // if (m_video_enable) |
| 81 | 81 | { |
| 82 | k051960_sprites_draw( | |
| 82 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); | |
| 83 | 83 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 0); |
| 84 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 85 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 0); | |
| 84 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 85 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 0); | |
| 86 | 86 | /* note that priority 3 is opposite to the basic layer priority! */ |
| 87 | 87 | /* (it IS used, but hopefully has no effect) */ |
| 88 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 2, 3); | |
| 89 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); | |
| 88 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 2, 3); | |
| 89 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); | |
| 90 | 90 | } |
| 91 | 91 | return 0; |
| 92 | 92 | } |
| r24078 | r24079 | |
|---|---|---|
| 65 | 65 | |
| 66 | 66 | TILE_GET_INFO_MEMBER(labyrunr_state::get_tile_info0) |
| 67 | 67 | { |
| 68 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121, generic_space(), 3); | |
| 69 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121, generic_space(), 4); | |
| 70 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121, generic_space(), 5); | |
| 71 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121, generic_space(), 6); | |
| 68 | UINT8 ctrl_3 = m_k007121->ctrlram_r(generic_space(), 3); | |
| 69 | UINT8 ctrl_4 = m_k007121->ctrlram_r(generic_space(), 4); | |
| 70 | UINT8 ctrl_5 = m_k007121->ctrlram_r(generic_space(), 5); | |
| 71 | UINT8 ctrl_6 = m_k007121->ctrlram_r(generic_space(), 6); | |
| 72 | 72 | int attr = m_videoram1[tile_index]; |
| 73 | 73 | int code = m_videoram1[tile_index + 0x400]; |
| 74 | 74 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| r24078 | r24079 | |
| 94 | 94 | |
| 95 | 95 | TILE_GET_INFO_MEMBER(labyrunr_state::get_tile_info1) |
| 96 | 96 | { |
| 97 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121, generic_space(), 3); | |
| 98 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121, generic_space(), 4); | |
| 99 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121, generic_space(), 5); | |
| 100 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121, generic_space(), 6); | |
| 97 | UINT8 ctrl_3 = m_k007121->ctrlram_r(generic_space(), 3); | |
| 98 | UINT8 ctrl_4 = m_k007121->ctrlram_r(generic_space(), 4); | |
| 99 | UINT8 ctrl_5 = m_k007121->ctrlram_r(generic_space(), 5); | |
| 100 | UINT8 ctrl_6 = m_k007121->ctrlram_r(generic_space(), 6); | |
| 101 | 101 | int attr = m_videoram2[tile_index]; |
| 102 | 102 | int code = m_videoram2[tile_index + 0x400]; |
| 103 | 103 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| r24078 | r24079 | |
| 177 | 177 | UINT32 labyrunr_state::screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 178 | 178 | { |
| 179 | 179 | address_space &space = machine().driver_data()->generic_space(); |
| 180 | UINT8 ctrl_0 = k007121 | |
| 180 | UINT8 ctrl_0 = m_k007121->ctrlram_r(space, 0); | |
| 181 | 181 | rectangle finalclip0, finalclip1; |
| 182 | 182 | |
| 183 | 183 | set_pens(); |
| r24078 | r24079 | |
| 185 | 185 | machine().priority_bitmap.fill(0, cliprect); |
| 186 | 186 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 187 | 187 | |
| 188 | if (~k007121 | |
| 188 | if (~m_k007121->ctrlram_r(space, 3) & 0x20) | |
| 189 | 189 | { |
| 190 | 190 | int i; |
| 191 | 191 | |
| r24078 | r24079 | |
| 201 | 201 | for(i = 0; i < 32; i++) |
| 202 | 202 | { |
| 203 | 203 | /* enable colscroll */ |
| 204 | if((k007121_ctrlram_r(m_k007121, space, 1) & 6) == 6) // it's probably just one bit, but it's only used once in the game so I don't know which it's | |
| 205 | m_layer0->set_scrolly((i + 2) & 0x1f, k007121_ctrlram_r(m_k007121, space, 2) + m_scrollram[i]); | |
| 204 | if((m_k007121->ctrlram_r(space, 1) & 6) == 6) // it's probably just one bit, but it's only used once in the game so I don't know which it's | |
| 205 | m_layer0->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(space, 2) + m_scrollram[i]); | |
| 206 | 206 | else |
| 207 | m_layer0->set_scrolly((i + 2) & 0x1f, k007121 | |
| 207 | m_layer0->set_scrolly((i + 2) & 0x1f, m_k007121->ctrlram_r(space, 2)); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | m_layer0->draw(bitmap, finalclip0, TILEMAP_DRAW_OPAQUE, 0); |
| 211 | k007121 | |
| 211 | m_k007121->sprites_draw(bitmap, cliprect, machine().gfx[0], machine().colortable, m_spriteram,(m_k007121->ctrlram_r(space, 6) & 0x30) * 2, 40,0,(m_k007121->ctrlram_r(space, 3) & 0x40) >> 5); | |
| 212 | 212 | /* we ignore the transparency because layer1 is drawn only at the top of the screen also covering sprites */ |
| 213 | 213 | m_layer1->draw(bitmap, finalclip1, TILEMAP_DRAW_OPAQUE, 0); |
| 214 | 214 | } |
| r24078 | r24079 | |
| 221 | 221 | finalclip0.min_y = finalclip1.min_y = cliprect.min_y; |
| 222 | 222 | finalclip0.max_y = finalclip1.max_y = cliprect.max_y; |
| 223 | 223 | |
| 224 | if(k007121 | |
| 224 | if(m_k007121->ctrlram_r(space, 1) & 1) | |
| 225 | 225 | { |
| 226 | 226 | finalclip0.min_x = cliprect.max_x - ctrl_0 + 8; |
| 227 | 227 | finalclip0.max_x = cliprect.max_x; |
| r24078 | r24079 | |
| 278 | 278 | if(use_clip3[1]) |
| 279 | 279 | m_layer1->draw(bitmap, finalclip3, 0, 1); |
| 280 | 280 | |
| 281 | k007121 | |
| 281 | m_k007121->sprites_draw(bitmap, cliprect, machine().gfx[0], machine().colortable, m_spriteram, (m_k007121->ctrlram_r(space, 6) & 0x30) * 2,40,0,(m_k007121->ctrlram_r(space, 3) & 0x40) >> 5); | |
| 282 | 282 | } |
| 283 | 283 | return 0; |
| 284 | 284 | } |
| r24078 | r24079 | |
|---|---|---|
| 93 | 93 | |
| 94 | 94 | UINT32 mainevt_state::screen_update_mainevt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 95 | 95 | { |
| 96 | k052109 | |
| 96 | m_k052109->tilemap_update(); | |
| 97 | 97 | |
| 98 | 98 | machine().priority_bitmap.fill(0, cliprect); |
| 99 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 100 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 1, 2); /* low priority part of layer */ | |
| 101 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 4); /* high priority part of layer */ | |
| 102 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 8); | |
| 99 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 100 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 1, 2); /* low priority part of layer */ | |
| 101 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 4); /* high priority part of layer */ | |
| 102 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 8); | |
| 103 | 103 | |
| 104 | k051960_sprites_draw( | |
| 104 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 105 | 105 | return 0; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | UINT32 mainevt_state::screen_update_dv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 109 | 109 | { |
| 110 | k052109 | |
| 110 | m_k052109->tilemap_update(); | |
| 111 | 111 | |
| 112 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 113 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 0); | |
| 114 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 115 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 112 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 113 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 0); | |
| 114 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 115 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 116 | 116 | return 0; |
| 117 | 117 | } |
| r24078 | r24079 | |
|---|---|---|
| 73 | 73 | |
| 74 | 74 | UINT32 aliens_state::screen_update_aliens(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 75 | 75 | { |
| 76 | k052109 | |
| 76 | m_k052109->tilemap_update(); | |
| 77 | 77 | |
| 78 | 78 | machine().priority_bitmap.fill(0, cliprect); |
| 79 | 79 | bitmap.fill(m_layer_colorbase[1] * 16, cliprect); |
| 80 | 80 | |
| 81 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 1); | |
| 82 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 2); | |
| 83 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 4); | |
| 81 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 1); | |
| 82 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 2); | |
| 83 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 4); | |
| 84 | 84 | |
| 85 | k051960_sprites_draw( | |
| 85 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 86 | 86 | return 0; |
| 87 | 87 | } |
| r24078 | r24079 | |
|---|---|---|
| 52 | 52 | { |
| 53 | 53 | tmnt_state *state = machine.driver_data<tmnt_state>(); |
| 54 | 54 | |
| 55 | if ((k052109 | |
| 55 | if ((state->m_k052109->get_rmrd_line() == CLEAR_LINE) && (layer == 0)) | |
| 56 | 56 | { |
| 57 | 57 | *code |= ((*color & 0x01) << 8); |
| 58 | 58 | *color = state->m_layer_colorbase[layer] + ((*color & 0x80) >> 5) + ((*color & 0x10) >> 1); |
| r24078 | r24079 | |
| 254 | 254 | |
| 255 | 255 | VIDEO_START_MEMBER(tmnt_state,lgtnfght)/* also tmnt2, ssriders */ |
| 256 | 256 | { |
| 257 | k05324x_set_z_rejection( | |
| 257 | m_k053245->k05324x_set_z_rejection(0); | |
| 258 | 258 | |
| 259 | 259 | m_dim_c = m_dim_v = m_lastdim = m_lasten = 0; |
| 260 | 260 | |
| r24078 | r24079 | |
| 330 | 330 | m_irq5_mask = data & 0x20; |
| 331 | 331 | |
| 332 | 332 | /* bit 7 = enable char ROM reading through the video RAM */ |
| 333 | k052109 | |
| 333 | m_k052109->set_rmrd_line((data & 0x80) ? ASSERT_LINE : CLEAR_LINE); | |
| 334 | 334 | |
| 335 | 335 | /* other bits unused */ |
| 336 | 336 | } |
| r24078 | r24079 | |
| 350 | 350 | m_last = data & 0x04; |
| 351 | 351 | |
| 352 | 352 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 353 | k052109 | |
| 353 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| r24078 | r24079 | |
| 369 | 369 | m_last = data & 0x04; |
| 370 | 370 | |
| 371 | 371 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 372 | k052109 | |
| 372 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| r24078 | r24079 | |
| 382 | 382 | coin_counter_w(machine(), 1,data & 0x02); |
| 383 | 383 | |
| 384 | 384 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 385 | k052109 | |
| 385 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 386 | 386 | |
| 387 | 387 | /* bit 7 = select char ROM bank */ |
| 388 | 388 | if (m_blswhstl_rombank != ((data & 0x80) >> 7)) |
| r24078 | r24079 | |
| 418 | 418 | coin_counter_w(machine(), 1, data & 0x02); |
| 419 | 419 | |
| 420 | 420 | /* bit 4 = enable char ROM reading through the video RAM */ |
| 421 | k052109 | |
| 421 | m_k052109->set_rmrd_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); | |
| 422 | 422 | |
| 423 | 423 | /* bit 5 = 53596 tile rom bank selection */ |
| 424 | 424 | if (m_glfgreat_roz_rom_bank != (data & 0x20) >> 5) |
| r24078 | r24079 | |
| 455 | 455 | m_dim_c = data & 0x18; |
| 456 | 456 | |
| 457 | 457 | /* bit 5 selects sprite ROM for testing in TMNT2 (bits 5-7, actually, according to the schematics) */ |
| 458 | k053244_bankselect( | |
| 458 | m_k053245->k053244_bankselect(((data & 0x20) >> 5) << 2); | |
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
| r24078 | r24079 | |
| 468 | 468 | coin_counter_w(machine(), 1, data & 0x02); |
| 469 | 469 | |
| 470 | 470 | /* bit 3 = enable char ROM reading through the video RAM */ |
| 471 | k052109 | |
| 471 | m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); | |
| 472 | 472 | |
| 473 | 473 | /* bits 4-6 control palette dimming (DIM0-DIM2) */ |
| 474 | 474 | m_dim_v = (data & 0x70) >> 4; |
| r24078 | r24079 | |
| 484 | 484 | coin_counter_w(machine(), 1, data & 0x02); |
| 485 | 485 | |
| 486 | 486 | /* bit 4 = enable char ROM reading through the video RAM */ |
| 487 | k052109 | |
| 487 | m_k052109->set_rmrd_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); | |
| 488 | 488 | |
| 489 | 489 | /* bit 6 = sprite ROM bank */ |
| 490 | 490 | m_prmrsocr_sprite_bank = (data & 0x40) >> 6; |
| 491 | k053244_bankselect( | |
| 491 | m_k053245->k053244_bankselect(m_prmrsocr_sprite_bank << 2); | |
| 492 | 492 | |
| 493 | 493 | /* bit 7 = 53596 region selector for ROM test */ |
| 494 | 494 | m_glfgreat_roz_char_bank = (data & 0x80) >> 7; |
| r24078 | r24079 | |
| 544 | 544 | |
| 545 | 545 | UINT32 tmnt_state::screen_update_mia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 546 | 546 | { |
| 547 | k052109 | |
| 547 | m_k052109->tilemap_update(); | |
| 548 | 548 | |
| 549 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE,0); | |
| 550 | if ((m_tmnt_priorityflag & 1) == 1) k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 551 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); | |
| 552 | if ((m_tmnt_priorityflag & 1) == 0) k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 553 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 549 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE,0); | |
| 550 | if ((m_tmnt_priorityflag & 1) == 1) m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 551 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); | |
| 552 | if ((m_tmnt_priorityflag & 1) == 0) m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 553 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 554 | 554 | |
| 555 | 555 | return 0; |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | UINT32 tmnt_state::screen_update_tmnt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 559 | 559 | { |
| 560 | k052109 | |
| 560 | m_k052109->tilemap_update(); | |
| 561 | 561 | |
| 562 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE,0); | |
| 563 | if ((m_tmnt_priorityflag & 1) == 1) k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 564 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); | |
| 565 | if ((m_tmnt_priorityflag & 1) == 0) k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 566 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 562 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE,0); | |
| 563 | if ((m_tmnt_priorityflag & 1) == 1) m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 564 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); | |
| 565 | if ((m_tmnt_priorityflag & 1) == 0) m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 566 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 567 | 567 | |
| 568 | 568 | return 0; |
| 569 | 569 | } |
| r24078 | r24079 | |
| 576 | 576 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 577 | 577 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 578 | 578 | |
| 579 | k052109 | |
| 579 | m_k052109->tilemap_update(); | |
| 580 | 580 | |
| 581 | 581 | m_sorted_layer[0] = 0; |
| 582 | 582 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 588 | 588 | konami_sortlayers3(m_sorted_layer, m_layerpri); |
| 589 | 589 | |
| 590 | 590 | machine().priority_bitmap.fill(0, cliprect); |
| 591 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[0], TILEMAP_DRAW_OPAQUE, 1); | |
| 592 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 593 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 591 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[0], TILEMAP_DRAW_OPAQUE, 1); | |
| 592 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 593 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 594 | 594 | |
| 595 | k051960_sprites_draw( | |
| 595 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 596 | 596 | return 0; |
| 597 | 597 | } |
| 598 | 598 | |
| r24078 | r24079 | |
| 607 | 607 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 608 | 608 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 609 | 609 | |
| 610 | k052109 | |
| 610 | m_k052109->tilemap_update(); | |
| 611 | 611 | |
| 612 | 612 | m_sorted_layer[0] = 0; |
| 613 | 613 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 620 | 620 | |
| 621 | 621 | machine().priority_bitmap.fill(0, cliprect); |
| 622 | 622 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 623 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[0], 0, 1); | |
| 624 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 625 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 623 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[0], 0, 1); | |
| 624 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 625 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 626 | 626 | |
| 627 | k053245_sprites_draw( | |
| 627 | m_k053245->k053245_sprites_draw(bitmap, cliprect); | |
| 628 | 628 | return 0; |
| 629 | 629 | } |
| 630 | 630 | |
| r24078 | r24079 | |
| 651 | 651 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI3) + 8; /* weird... */ |
| 652 | 652 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 653 | 653 | |
| 654 | k052109 | |
| 654 | m_k052109->tilemap_update(); | |
| 655 | 655 | |
| 656 | 656 | m_sorted_layer[0] = 0; |
| 657 | 657 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 666 | 666 | |
| 667 | 667 | machine().priority_bitmap.fill(0, cliprect); |
| 668 | 668 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 669 | k052109 | |
| 669 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[0], 0, 1); | |
| 670 | 670 | |
| 671 | 671 | if (m_layerpri[0] >= 0x30 && m_layerpri[1] < 0x30) |
| 672 | 672 | { |
| r24078 | r24079 | |
| 674 | 674 | m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | k052109 | |
| 677 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 678 | 678 | |
| 679 | 679 | if (m_layerpri[1] >= 0x30 && m_layerpri[2] < 0x30) |
| 680 | 680 | { |
| r24078 | r24079 | |
| 682 | 682 | m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | k052109 | |
| 685 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 686 | 686 | |
| 687 | 687 | if (m_layerpri[2] >= 0x30) |
| 688 | 688 | { |
| r24078 | r24079 | |
| 690 | 690 | m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | k053245_sprites_draw( | |
| 693 | m_k053245->k053245_sprites_draw(bitmap, cliprect); | |
| 694 | 694 | return 0; |
| 695 | 695 | } |
| 696 | 696 | |
| r24078 | r24079 | |
| 756 | 756 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 757 | 757 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 758 | 758 | |
| 759 | k052109 | |
| 759 | m_k052109->tilemap_update(); | |
| 760 | 760 | |
| 761 | 761 | m_sorted_layer[0] = 0; |
| 762 | 762 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 769 | 769 | |
| 770 | 770 | machine().priority_bitmap.fill(0, cliprect); |
| 771 | 771 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 772 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[0], 0, 1); | |
| 773 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 774 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 772 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[0], 0, 1); | |
| 773 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[1], 0, 2); | |
| 774 | m_k052109->tilemap_draw(bitmap, cliprect, m_sorted_layer[2], 0, 4); | |
| 775 | 775 | |
| 776 | k051960_sprites_draw( | |
| 776 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 777 | 777 | return 0; |
| 778 | 778 | } |
| 779 | 779 | |
| r24078 | r24079 | |
| 790 | 790 | // on rising edge |
| 791 | 791 | if (state) |
| 792 | 792 | { |
| 793 | k053245_clear_buffer( | |
| 793 | m_k053245->k053245_clear_buffer(); | |
| 794 | 794 | } |
| 795 | 795 | } |
| r24078 | r24079 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | READ8_MEMBER(simpsons_state::simpsons_k052109_r) |
| 50 | 50 | { |
| 51 | return | |
| 51 | return m_k052109->read(space, offset + 0x2000); | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | WRITE8_MEMBER(simpsons_state::simpsons_k052109_w) |
| 55 | 55 | { |
| 56 | | |
| 56 | m_k052109->write(space, offset + 0x2000, data); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | READ8_MEMBER(simpsons_state::simpsons_k053247_r) |
| r24078 | r24079 | |
| 101 | 101 | membank("bank5")->set_base(m_generic_paletteram_8); |
| 102 | 102 | } |
| 103 | 103 | else |
| 104 | space.install_ | |
| 104 | space.install_readwrite_handler(0x0000, 0x0fff, read8_delegate(FUNC(k052109_device::read), (k052109_device*)m_k052109), write8_delegate(FUNC(k052109_device::write), (k052109_device*)m_k052109)); | |
| 105 | 105 | |
| 106 | 106 | if (bank & 2) |
| 107 | 107 | space.install_readwrite_handler(0x2000, 0x3fff, read8_delegate(FUNC(simpsons_state::simpsons_k053247_r),this), write8_delegate(FUNC(simpsons_state::simpsons_k053247_w),this)); |
| r24078 | r24079 | |
| 127 | 127 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 128 | 128 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 129 | 129 | |
| 130 | k052109 | |
| 130 | m_k052109->tilemap_update(); | |
| 131 | 131 | |
| 132 | 132 | layer[0] = 0; |
| 133 | 133 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 140 | 140 | |
| 141 | 141 | machine().priority_bitmap.fill(0, cliprect); |
| 142 | 142 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 143 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[0], 0, 1); | |
| 144 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[1], 0, 2); | |
| 145 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[2], 0, 4); | |
| 143 | m_k052109->tilemap_draw(bitmap, cliprect, layer[0], 0, 1); | |
| 144 | m_k052109->tilemap_draw(bitmap, cliprect, layer[1], 0, 2); | |
| 145 | m_k052109->tilemap_draw(bitmap, cliprect, layer[2], 0, 4); | |
| 146 | 146 | |
| 147 | 147 | k053247_sprites_draw(m_k053246, bitmap, cliprect); |
| 148 | 148 | return 0; |
| r24078 | r24079 | |
|---|---|---|
| 6 | 6 | static void reset_spritebank( running_machine &machine ) |
| 7 | 7 | { |
| 8 | 8 | asterix_state *state = machine.driver_data<asterix_state>(); |
| 9 | k053244_bankselect( | |
| 9 | state->m_k053244->k053244_bankselect(state->m_spritebank & 7); | |
| 10 | 10 | state->m_spritebanks[0] = (state->m_spritebank << 12) & 0x7000; |
| 11 | 11 | state->m_spritebanks[1] = (state->m_spritebank << 9) & 0x7000; |
| 12 | 12 | state->m_spritebanks[2] = (state->m_spritebank << 6) & 0x7000; |
| r24078 | r24079 | |
| 103 | 103 | |
| 104 | 104 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference |
| 105 | 105 | pdrawgfx_shadow_lowpri = 1; fix shadows in front of feet */ |
| 106 | k053245_sprites_draw( | |
| 106 | m_k053244->k053245_sprites_draw(bitmap, cliprect); | |
| 107 | 107 | |
| 108 | 108 | k056832_tilemap_draw(m_k056832, bitmap, cliprect, 2, K056832_DRAW_FLAG_MIRROR, 0); |
| 109 | 109 | return 0; |
| r24078 | r24079 | |
|---|---|---|
| 72 | 72 | bitmap.fill(0, cliprect); |
| 73 | 73 | |
| 74 | 74 | k051316_zoom_draw(m_k051316_2, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); |
| 75 | k051960_sprites_draw( | |
| 75 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 76 | 76 | k051316_zoom_draw(m_k051316_2, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); |
| 77 | k051960_sprites_draw( | |
| 77 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); | |
| 78 | 78 | k051316_zoom_draw(m_k051316_1, bitmap, cliprect, 0, 0); |
| 79 | 79 | return 0; |
| 80 | 80 | } |
| r24078 | r24079 | |
|---|---|---|
| 65 | 65 | machine().priority_bitmap.fill(0, cliprect); |
| 66 | 66 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 67 | 67 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 1); |
| 68 | k053245_sprites_draw( | |
| 68 | m_k053244->k053245_sprites_draw(bitmap, cliprect); | |
| 69 | 69 | return 0; |
| 70 | 70 | } |
| r24078 | r24079 | |
|---|---|---|
| 56 | 56 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI4); |
| 57 | 57 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI3); |
| 58 | 58 | |
| 59 | k052109 | |
| 59 | m_k052109->tilemap_update(); | |
| 60 | 60 | |
| 61 | 61 | layer[0] = 0; |
| 62 | 62 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI2); |
| r24078 | r24079 | |
| 69 | 69 | |
| 70 | 70 | machine().priority_bitmap.fill(0, cliprect); |
| 71 | 71 | bitmap.fill(16 * bg_colorbase, cliprect); |
| 72 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[0], 0, 1); | |
| 73 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[1], 0, 2); | |
| 74 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[2], 0, 4); | |
| 72 | m_k052109->tilemap_draw(bitmap, cliprect, layer[0], 0, 1); | |
| 73 | m_k052109->tilemap_draw(bitmap, cliprect, layer[1], 0, 2); | |
| 74 | m_k052109->tilemap_draw(bitmap, cliprect, layer[2], 0, 4); | |
| 75 | 75 | |
| 76 | k053245_sprites_draw( | |
| 76 | m_k053244->k053245_sprites_draw(bitmap, cliprect); | |
| 77 | 77 | return 0; |
| 78 | 78 | } |
| r24078 | r24079 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "emu.h" |
| 8 | #include "video/konicdev.h" | |
| 9 | 8 | #include "includes/hcastle.h" |
| 10 | 9 | |
| 11 | 10 | |
| r24078 | r24079 | |
| 72 | 71 | |
| 73 | 72 | TILE_GET_INFO_MEMBER(hcastle_state::get_fg_tile_info) |
| 74 | 73 | { |
| 75 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121_1, generic_space(), 5); | |
| 76 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121_1, generic_space(), 6); | |
| 74 | UINT8 ctrl_5 = m_k007121_1->ctrlram_r(generic_space(), 5); | |
| 75 | UINT8 ctrl_6 = m_k007121_1->ctrlram_r(generic_space(), 6); | |
| 77 | 76 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| 78 | 77 | int bit1 = (ctrl_5 >> 2) & 0x03; |
| 79 | 78 | int bit2 = (ctrl_5 >> 4) & 0x03; |
| r24078 | r24079 | |
| 96 | 95 | |
| 97 | 96 | TILE_GET_INFO_MEMBER(hcastle_state::get_bg_tile_info) |
| 98 | 97 | { |
| 99 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121_2, generic_space(), 5); | |
| 100 | UINT8 ctrl_6 = k007121_ctrlram_r(m_k007121_2, generic_space(), 6); | |
| 98 | UINT8 ctrl_5 = m_k007121_2->ctrlram_r(generic_space(), 5); | |
| 99 | UINT8 ctrl_6 = m_k007121_2->ctrlram_r(generic_space(), 6); | |
| 101 | 100 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| 102 | 101 | int bit1 = (ctrl_5 >> 2) & 0x03; |
| 103 | 102 | int bit2 = (ctrl_5 >> 4) & 0x03; |
| r24078 | r24079 | |
| 177 | 176 | { |
| 178 | 177 | m_fg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 179 | 178 | } |
| 180 | k007121_ctrl_w( | |
| 179 | m_k007121_1->ctrl_w(space, offset, data); | |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | 182 | WRITE8_MEMBER(hcastle_state::hcastle_pf2_control_w) |
| r24078 | r24079 | |
| 193 | 192 | { |
| 194 | 193 | m_bg_tilemap->set_flip((data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); |
| 195 | 194 | } |
| 196 | k007121_ctrl_w( | |
| 195 | m_k007121_2->ctrl_w(space, offset, data); | |
| 197 | 196 | } |
| 198 | 197 | |
| 199 | 198 | /*****************************************************************************/ |
| 200 | 199 | |
| 201 | 200 | void hcastle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank ) |
| 202 | 201 | { |
| 203 | device | |
| 202 | k007121_device *k007121 = bank ? m_k007121_2 : m_k007121_1; | |
| 204 | 203 | address_space &space = machine().driver_data()->generic_space(); |
| 205 | int base_color = (k007121 | |
| 204 | int base_color = (k007121->ctrlram_r(space, 6) & 0x30) * 2; | |
| 206 | 205 | int bank_base = (bank == 0) ? 0x4000 * (m_gfx_bank & 1) : 0; |
| 207 | 206 | |
| 208 | k007121 | |
| 207 | k007121->sprites_draw(bitmap, cliprect, machine().gfx[bank], machine().colortable, sbank, base_color, 0, bank_base, (UINT32)-1); | |
| 209 | 208 | } |
| 210 | 209 | |
| 211 | 210 | /*****************************************************************************/ |
| r24078 | r24079 | |
| 214 | 213 | { |
| 215 | 214 | address_space &space = machine().driver_data()->generic_space(); |
| 216 | 215 | |
| 217 | UINT8 ctrl_1_0 = k007121_ctrlram_r(m_k007121_1, space, 0); | |
| 218 | UINT8 ctrl_1_1 = k007121_ctrlram_r(m_k007121_1, space, 1); | |
| 219 | UINT8 ctrl_1_2 = k007121_ctrlram_r(m_k007121_1, space, 2); | |
| 220 | UINT8 ctrl_1_3 = k007121_ctrlram_r(m_k007121_1, space, 3); | |
| 221 | UINT8 ctrl_2_0 = k007121_ctrlram_r(m_k007121_2, space, 0); | |
| 222 | UINT8 ctrl_2_1 = k007121_ctrlram_r(m_k007121_2, space, 1); | |
| 223 | UINT8 ctrl_2_2 = k007121_ctrlram_r(m_k007121_2, space, 2); | |
| 224 | UINT8 ctrl_2_3 = k007121_ctrlram_r(m_k007121_2, space, 3); | |
| 216 | UINT8 ctrl_1_0 = m_k007121_1->ctrlram_r(space, 0); | |
| 217 | UINT8 ctrl_1_1 = m_k007121_1->ctrlram_r(space, 1); | |
| 218 | UINT8 ctrl_1_2 = m_k007121_1->ctrlram_r(space, 2); | |
| 219 | UINT8 ctrl_1_3 = m_k007121_1->ctrlram_r(space, 3); | |
| 220 | UINT8 ctrl_2_0 = m_k007121_2->ctrlram_r(space, 0); | |
| 221 | UINT8 ctrl_2_1 = m_k007121_2->ctrlram_r(space, 1); | |
| 222 | UINT8 ctrl_2_2 = m_k007121_2->ctrlram_r(space, 2); | |
| 223 | UINT8 ctrl_2_3 = m_k007121_2->ctrlram_r(space, 3); | |
| 225 | 224 | |
| 226 | 225 | set_pens(); |
| 227 | 226 |
| r24078 | r24079 | |
|---|---|---|
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "emu.h" |
| 8 | #include "video/konicdev.h" | |
| 9 | 8 | #include "includes/flkatck.h" |
| 10 | 9 | |
| 11 | 10 | /*************************************************************************** |
| r24078 | r24079 | |
| 16 | 15 | |
| 17 | 16 | TILE_GET_INFO_MEMBER(flkatck_state::get_tile_info_A) |
| 18 | 17 | { |
| 19 | UINT8 ctrl_0 = k007121_ctrlram_r(m_k007121, generic_space(), 0); | |
| 20 | UINT8 ctrl_2 = k007121_ctrlram_r(m_k007121, generic_space(), 2); | |
| 21 | UINT8 ctrl_3 = k007121_ctrlram_r(m_k007121, generic_space(), 3); | |
| 22 | UINT8 ctrl_4 = k007121_ctrlram_r(m_k007121, generic_space(), 4); | |
| 23 | UINT8 ctrl_5 = k007121_ctrlram_r(m_k007121, generic_space(), 5); | |
| 18 | UINT8 ctrl_0 = m_k007121->ctrlram_r(generic_space(), 0); | |
| 19 | UINT8 ctrl_2 = m_k007121->ctrlram_r(generic_space(), 2); | |
| 20 | UINT8 ctrl_3 = m_k007121->ctrlram_r(generic_space(), 3); | |
| 21 | UINT8 ctrl_4 = m_k007121->ctrlram_r(generic_space(), 4); | |
| 22 | UINT8 ctrl_5 = m_k007121->ctrlram_r(generic_space(), 5); | |
| 24 | 23 | int attr = m_k007121_ram[tile_index]; |
| 25 | 24 | int code = m_k007121_ram[tile_index + 0x400]; |
| 26 | 25 | int bit0 = (ctrl_5 >> 0) & 0x03; |
| r24078 | r24079 | |
| 97 | 96 | switch (offset) |
| 98 | 97 | { |
| 99 | 98 | case 0x04: /* ROM bank select */ |
| 100 | if (data != k007121 | |
| 99 | if (data != m_k007121->ctrlram_r(space, 4)) | |
| 101 | 100 | machine().tilemap().mark_all_dirty(); |
| 102 | 101 | break; |
| 103 | 102 | |
| r24078 | r24079 | |
| 108 | 107 | break; |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | k007121 | |
| 110 | m_k007121->ctrl_w(space, offset, data); | |
| 112 | 111 | } |
| 113 | 112 | |
| 114 | 113 | |
| r24078 | r24079 | |
| 139 | 138 | clip[1] = visarea; |
| 140 | 139 | clip[1].min_x = clip[1].max_x - 40; |
| 141 | 140 | |
| 142 | m_k007121_tilemap[0]->set_scrollx(0, k007121_ctrlram_r(m_k007121, space, 0) - 56 ); | |
| 143 | m_k007121_tilemap[0]->set_scrolly(0, k007121_ctrlram_r(m_k007121, space, 2)); | |
| 141 | m_k007121_tilemap[0]->set_scrollx(0, m_k007121->ctrlram_r(space, 0) - 56 ); | |
| 142 | m_k007121_tilemap[0]->set_scrolly(0, m_k007121->ctrlram_r(space, 2)); | |
| 144 | 143 | m_k007121_tilemap[1]->set_scrollx(0, -16); |
| 145 | 144 | } |
| 146 | 145 | else |
| r24078 | r24079 | |
| 152 | 151 | clip[1].max_x = 39; |
| 153 | 152 | clip[1].min_x = 0; |
| 154 | 153 | |
| 155 | m_k007121_tilemap[0]->set_scrollx(0, k007121_ctrlram_r(m_k007121, space, 0) - 40 ); | |
| 156 | m_k007121_tilemap[0]->set_scrolly(0, k007121_ctrlram_r(m_k007121, space, 2)); | |
| 154 | m_k007121_tilemap[0]->set_scrollx(0, m_k007121->ctrlram_r(space, 0) - 40 ); | |
| 155 | m_k007121_tilemap[0]->set_scrolly(0, m_k007121->ctrlram_r(space, 2)); | |
| 157 | 156 | m_k007121_tilemap[1]->set_scrollx(0, 0); |
| 158 | 157 | } |
| 159 | 158 | |
| r24078 | r24079 | |
| 163 | 162 | |
| 164 | 163 | /* draw the graphics */ |
| 165 | 164 | m_k007121_tilemap[0]->draw(bitmap, clip[0], 0, 0); |
| 166 | k007121 | |
| 165 | m_k007121->sprites_draw(bitmap, cliprect, machine().gfx[0], NULL, &m_k007121_ram[0x1000], 0, 40, 0, (UINT32)-1); | |
| 167 | 166 | m_k007121_tilemap[1]->draw(bitmap, clip[1], 0, 0); |
| 168 | 167 | return 0; |
| 169 | 168 | } |
| r24078 | r24079 | |
|---|---|---|
| 79 | 79 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI0); |
| 80 | 80 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI2); |
| 81 | 81 | |
| 82 | k052109 | |
| 82 | m_k052109->tilemap_update(); | |
| 83 | 83 | |
| 84 | 84 | layer[0] = 0; |
| 85 | 85 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI3); |
| r24078 | r24079 | |
| 93 | 93 | machine().priority_bitmap.fill(0, cliprect); |
| 94 | 94 | /* note the '+1' in the background color!!! */ |
| 95 | 95 | bitmap.fill(16 * bg_colorbase + 1, cliprect); |
| 96 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[0], 0, 1); | |
| 97 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[1], 0, 2); | |
| 98 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, layer[2], 0, 4); | |
| 96 | m_k052109->tilemap_draw(bitmap, cliprect, layer[0], 0, 1); | |
| 97 | m_k052109->tilemap_draw(bitmap, cliprect, layer[1], 0, 2); | |
| 98 | m_k052109->tilemap_draw(bitmap, cliprect, layer[2], 0, 4); | |
| 99 | 99 | |
| 100 | 100 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference |
| 101 | 101 | pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ |
| r24078 | r24079 | |
| 165 | 165 | */ |
| 166 | 166 | for (offset = 0; offset < (0xc000 / 2); offset++) |
| 167 | 167 | { |
| 168 | // K052109_lsb_w | |
| 169 | k052109_w(m_k052109, space, offset, m_xmen6p_tilemapright[offset] & 0x00ff); | |
| 168 | // m_k052109->lsb_w | |
| 169 | m_k052109->write(space, offset, m_xmen6p_tilemapright[offset] & 0x00ff); | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| r24078 | r24079 | |
| 184 | 184 | */ |
| 185 | 185 | for (offset = 0; offset < (0xc000 / 2); offset++) |
| 186 | 186 | { |
| 187 | // K052109_lsb_w | |
| 188 | k052109_w(m_k052109, space, offset, m_xmen6p_tilemapleft[offset] & 0x00ff); | |
| 187 | // m_k052109->lsb_w | |
| 188 | m_k052109->write(space, offset, m_xmen6p_tilemapleft[offset] & 0x00ff); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
| r24078 | r24079 | |
| 199 | 199 | m_layer_colorbase[1] = k053251_get_palette_index(m_k053251, K053251_CI0); |
| 200 | 200 | m_layer_colorbase[2] = k053251_get_palette_index(m_k053251, K053251_CI2); |
| 201 | 201 | |
| 202 | k052109 | |
| 202 | m_k052109->tilemap_update(); | |
| 203 | 203 | |
| 204 | 204 | layer[0] = 0; |
| 205 | 205 | m_layerpri[0] = k053251_get_priority(m_k053251, K053251_CI3); |
| r24078 | r24079 | |
| 213 | 213 | machine().priority_bitmap.fill(0, cliprect); |
| 214 | 214 | /* note the '+1' in the background color!!! */ |
| 215 | 215 | renderbitmap->fill(16 * bg_colorbase + 1, cliprect); |
| 216 | k052109_tilemap_draw(m_k052109, *renderbitmap, cliprect, layer[0], 0, 1); | |
| 217 | k052109_tilemap_draw(m_k052109, *renderbitmap, cliprect, layer[1], 0, 2); | |
| 218 | k052109_tilemap_draw(m_k052109, *renderbitmap, cliprect, layer[2], 0, 4); | |
| 216 | m_k052109->tilemap_draw(*renderbitmap, cliprect, layer[0], 0, 1); | |
| 217 | m_k052109->tilemap_draw(*renderbitmap, cliprect, layer[1], 0, 2); | |
| 218 | m_k052109->tilemap_draw(*renderbitmap, cliprect, layer[2], 0, 4); | |
| 219 | 219 | |
| 220 | 220 | /* this isn't supported anymore and it is unsure if still needed; keeping here for reference |
| 221 | 221 | pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ |
| r24078 | r24079 | |
|---|---|---|
| 107 | 107 | k056832_tilemap_draw(m_k056832, bitmap, cliprect, 2, K056832_DRAW_FLAG_MIRROR, 2); |
| 108 | 108 | k056832_tilemap_draw(m_k056832, bitmap, cliprect, 1, K056832_DRAW_FLAG_MIRROR, 4); |
| 109 | 109 | |
| 110 | k053245_sprites_draw_lethal( | |
| 110 | m_k053244->k053245_sprites_draw_lethal(bitmap, cliprect); | |
| 111 | 111 | |
| 112 | 112 | // force "A" layer over top of everything |
| 113 | 113 | k056832_tilemap_draw(m_k056832, bitmap, cliprect, 0, K056832_DRAW_FLAG_MIRROR, 0); |
| r24078 | r24079 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | UINT32 _88games_state::screen_update_88games(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 58 | 58 | { |
| 59 | k052109 | |
| 59 | m_k052109->tilemap_update(); | |
| 60 | 60 | |
| 61 | 61 | if (m_k88games_priority) |
| 62 | 62 | { |
| 63 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // tile 0 | |
| 64 | k051960_sprites_draw(m_k051960, bitmap,cliprect, 1, 1); | |
| 65 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 0); // tile 2 | |
| 66 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); // tile 1 | |
| 67 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 63 | m_k052109->tilemap_draw(bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // tile 0 | |
| 64 | m_k051960->k051960_sprites_draw(bitmap,cliprect, 1, 1); | |
| 65 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 0); // tile 2 | |
| 66 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); // tile 1 | |
| 67 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 68 | 68 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 0); |
| 69 | 69 | } |
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | k052109 | |
| 72 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2 | |
| 73 | 73 | k051316_zoom_draw(m_k051316, bitmap, cliprect, 0, 0); |
| 74 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 75 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); // tile 1 | |
| 76 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 1, 1); | |
| 77 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); // tile 0 | |
| 74 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 75 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); // tile 1 | |
| 76 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); | |
| 77 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); // tile 0 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return 0; |
| r24078 | r24079 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | UINT32 gbusters_state::screen_update_gbusters(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 50 | 50 | { |
| 51 | k052109 | |
| 51 | m_k052109->tilemap_update(); | |
| 52 | 52 | |
| 53 | 53 | /* sprite priority 3 = disable */ |
| 54 | 54 | if (m_priority) |
| 55 | 55 | { |
| 56 | // k051960_sprites_draw(m_k051960, bitmap, cliprect, 1, 1); /* are these used? */ | |
| 57 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); | |
| 58 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 2, 2); | |
| 59 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, 0, 0); | |
| 60 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 61 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 56 | // m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); /* are these used? */ | |
| 57 | m_k052109->tilemap_draw(bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); | |
| 58 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 2, 2); | |
| 59 | m_k052109->tilemap_draw(bitmap, cliprect, 1, 0, 0); | |
| 60 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 61 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 62 | 62 | } |
| 63 | 63 | else |
| 64 | 64 | { |
| 65 | // k051960_sprites_draw(m_k051960, bitmap, cliprect, 1, 1); /* are these used? */ | |
| 66 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 67 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 2, 2); | |
| 68 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 0); | |
| 69 | k051960_sprites_draw(m_k051960, bitmap, cliprect, 0, 0); | |
| 70 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 65 | // m_k051960->k051960_sprites_draw(bitmap, cliprect, 1, 1); /* are these used? */ | |
| 66 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); | |
| 67 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 2, 2); | |
| 68 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 0); | |
| 69 | m_k051960->k051960_sprites_draw(bitmap, cliprect, 0, 0); | |
| 70 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 71 | 71 | } |
| 72 | 72 | return 0; |
| 73 | 73 | } |
| r24078 | r24079 | |
|---|---|---|
| 62 | 62 | |
| 63 | 63 | UINT32 spy_state::screen_update_spy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 64 | 64 | { |
| 65 | k052109 | |
| 65 | m_k052109->tilemap_update(); | |
| 66 | 66 | |
| 67 | 67 | machine().priority_bitmap.fill(0, cliprect); |
| 68 | 68 | |
| r24078 | r24079 | |
| 70 | 70 | bitmap.fill(16 * m_layer_colorbase[0], cliprect); |
| 71 | 71 | else |
| 72 | 72 | { |
| 73 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 74 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 2, 0, 2); | |
| 75 | k051960_sprites_draw(m_k051960, bitmap, cliprect, -1, -1); | |
| 76 | k052109_tilemap_draw(m_k052109, bitmap, cliprect, 0, 0, 0); | |
| 73 | m_k052109->tilemap_draw(bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); | |
| 74 | m_k052109->tilemap_draw(bitmap, cliprect, 2, 0, 2); | |
| 75 | m_k051960->k051960_sprites_draw(bitmap, cliprect, -1, -1); | |
| 76 | m_k052109->tilemap_draw(bitmap, cliprect, 0, 0, 0); | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return 0; |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | #include "sound/upd7759.h" |
| 7 | #include "video/konicdev.h" | |
| 7 | 8 | |
| 8 | 9 | class bladestl_state : public driver_device |
| 9 | 10 | { |
| r24078 | r24079 | |
|---|---|---|
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | #include "sound/upd7759.h" |
| 7 | 7 | #include "sound/msm5205.h" |
| 8 | #include "video/konicdev.h" | |
| 8 | 9 | |
| 9 | 10 | class combatsc_state : public driver_device |
| 10 | 11 | { |
| r24078 | r24079 | |
| 50 | 51 | required_device<cpu_device> m_audiocpu; |
| 51 | 52 | optional_device<k007121_device> m_k007121_1; |
| 52 | 53 | optional_device<k007121_device> m_k007121_2; |
| 54 | required_device<cpu_device> m_maincpu; | |
| 55 | optional_device<upd7759_device> m_upd7759; | |
| 56 | optional_device<msm5205_device> m_msm5205; | |
| 53 | 57 | DECLARE_WRITE8_MEMBER(combatsc_vreg_w); |
| 54 | 58 | DECLARE_WRITE8_MEMBER(combatscb_sh_irqtrigger_w); |
| 55 | 59 | DECLARE_READ8_MEMBER(combatscb_io_r); |
| r24078 | r24079 | |
| 92 | 96 | void set_pens( ); |
| 93 | 97 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *source, int circuit, UINT32 pri_mask ); |
| 94 | 98 | void bootleg_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *source, int circuit ); |
| 95 | required_device<cpu_device> m_maincpu; | |
| 96 | optional_device<upd7759_device> m_upd7759; | |
| 97 | optional_device<msm5205_device> m_msm5205; | |
| 98 | 99 | }; |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | #include "video/konicdev.h" | |
| 8 | ||
| 7 | 9 | class rockrage_state : public driver_device |
| 8 | 10 | { |
| 9 | 11 | public: |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | #include "video/konicdev.h" | |
| 8 | ||
| 7 | 9 | class contra_state : public driver_device |
| 8 | 10 | { |
| 9 | 11 | public: |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | #include "sound/k007232.h" |
| 7 | #include "video/konicdev.h" | |
| 7 | 8 | |
| 8 | 9 | class fastlane_state : public driver_device |
| 9 | 10 | { |
| r24078 | r24079 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | #include "video/bufsprite.h" |
| 8 | 8 | #include "sound/k007232.h" |
| 9 | #include "video/konicdev.h" | |
| 9 | 10 | |
| 10 | 11 | class hcastle_state : public driver_device |
| 11 | 12 | { |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | #include "sound/k007232.h" |
| 7 | #include "video/konicdev.h" | |
| 7 | 8 | |
| 8 | 9 | class flkatck_state : public driver_device |
| 9 | 10 | { |
| r24078 | r24079 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | #include "video/konicdev.h" | |
| 8 | ||
| 7 | 9 | class battlnts_state : public driver_device |
| 8 | 10 | { |
| 9 | 11 | public: |
| Previous | 199869 Revisions | Next |