trunk/src/mame/drivers/taitotz.c
r32461 | r32462 | |
608 | 608 | DECLARE_READ16_MEMBER(tlcs_ide1_r); |
609 | 609 | DECLARE_WRITE_LINE_MEMBER(ide_interrupt); |
610 | 610 | void taitotz_exit(); |
611 | | void draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile); |
612 | | UINT32 video_mem_r(taitotz_state *state, UINT32 address); |
613 | | void video_mem_w(taitotz_state *state, UINT32 address, UINT32 data); |
614 | | UINT32 video_reg_r(taitotz_state *state, UINT32 reg); |
615 | | void video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data); |
| 611 | void draw_tile(UINT32 pos, UINT32 tile); |
| 612 | UINT32 video_mem_r(UINT32 address); |
| 613 | void video_mem_w(UINT32 address, UINT32 data); |
| 614 | UINT32 video_reg_r(UINT32 reg); |
| 615 | void video_reg_w(UINT32 reg, UINT32 data); |
616 | 616 | void init_taitotz_152(); |
617 | 617 | void init_taitotz_111a(); |
618 | 618 | }; |
r32461 | r32462 | |
634 | 634 | } |
635 | 635 | |
636 | 636 | void set_fb(bitmap_rgb32 *fb) { m_fb = fb; } |
637 | | void render_displaylist(running_machine &machine, const rectangle &cliprect); |
638 | | void draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha); |
| 637 | void render_displaylist(const rectangle &cliprect); |
| 638 | void draw_object(UINT32 address, float scale, UINT8 alpha); |
639 | 639 | float line_plane_intersection(const vertex_t *v1, const vertex_t *v2, PLANE cp); |
640 | 640 | int clip_polygon(const vertex_t *v, int num_vertices, PLANE cp, vertex_t *vout); |
641 | 641 | void setup_viewport(int x, int y, int width, int height, int center_x, int center_y); |
r32461 | r32462 | |
1152 | 1152 | return clip_verts; |
1153 | 1153 | } |
1154 | 1154 | |
1155 | | void taitotz_renderer::draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha) |
| 1155 | void taitotz_renderer::draw_object(UINT32 address, float scale, UINT8 alpha) |
1156 | 1156 | { |
1157 | 1157 | const rectangle& visarea = m_state.m_screen->visible_area(); |
1158 | 1158 | |
r32461 | r32462 | |
1336 | 1336 | m_clip_plane[4].d = 0.1f; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | | void taitotz_renderer::render_displaylist(running_machine &machine, const rectangle &cliprect) |
| 1339 | void taitotz_renderer::render_displaylist(const rectangle &cliprect) |
1340 | 1340 | { |
1341 | 1341 | float zvalue = 0;//ZBUFFER_MAX; |
1342 | 1342 | m_zbuffer->fill(*(int*)&zvalue, cliprect); |
r32461 | r32462 | |
1405 | 1405 | |
1406 | 1406 | UINT32 alpha = w[2]; |
1407 | 1407 | |
1408 | | draw_object(machine, w[0] & 0x1fffff, scale, alpha); |
| 1408 | draw_object(w[0] & 0x1fffff, scale, alpha); |
1409 | 1409 | |
1410 | 1410 | #if LOG_DISPLAY_LIST |
1411 | 1411 | printf("0xffff0011: %08X, %08X, %08X, %08X\n", w[0], w[1], w[2], w[3]); |
r32461 | r32462 | |
1594 | 1594 | { |
1595 | 1595 | bitmap.fill(0x000000, cliprect); |
1596 | 1596 | m_renderer->set_fb(&bitmap); |
1597 | | m_renderer->render_displaylist(machine(), cliprect); |
| 1597 | m_renderer->render_displaylist(cliprect); |
1598 | 1598 | |
1599 | 1599 | |
1600 | 1600 | UINT16 *screen_src = (UINT16*)&m_screen_ram[m_scr_base]; |
r32461 | r32462 | |
1618 | 1618 | return 0; |
1619 | 1619 | } |
1620 | 1620 | |
1621 | | void taitotz_state::draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile) |
| 1621 | void taitotz_state::draw_tile(UINT32 pos, UINT32 tile) |
1622 | 1622 | { |
1623 | 1623 | int tileu = (tile & 0x1f) * 16; |
1624 | 1624 | int tilev = ((tile >> 5)) * 16; |
r32461 | r32462 | |
1660 | 1660 | batlgr2 into 0x9e0000 |
1661 | 1661 | */ |
1662 | 1662 | |
1663 | | UINT32 taitotz_state::video_mem_r(taitotz_state *state, UINT32 address) |
| 1663 | UINT32 taitotz_state::video_mem_r(UINT32 address) |
1664 | 1664 | { |
1665 | 1665 | if (address >= 0x800000 && address < 0x1000000) |
1666 | 1666 | { |
r32461 | r32462 | |
1681 | 1681 | } |
1682 | 1682 | } |
1683 | 1683 | |
1684 | | void taitotz_state::video_mem_w(taitotz_state *state, UINT32 address, UINT32 data) |
| 1684 | void taitotz_state::video_mem_w(UINT32 address, UINT32 data) |
1685 | 1685 | { |
1686 | 1686 | if (address >= 0x800000 && address < 0x1000000) |
1687 | 1687 | { |
r32461 | r32462 | |
1701 | 1701 | } |
1702 | 1702 | } |
1703 | 1703 | |
1704 | | UINT32 taitotz_state::video_reg_r(taitotz_state *state, UINT32 reg) |
| 1704 | UINT32 taitotz_state::video_reg_r(UINT32 reg) |
1705 | 1705 | { |
1706 | 1706 | switch ((reg >> 28) & 0xf) |
1707 | 1707 | { |
r32461 | r32462 | |
1731 | 1731 | } |
1732 | 1732 | case 0xb: |
1733 | 1733 | { |
1734 | | return video_mem_r(state, reg & 0xfffffff); |
| 1734 | return video_mem_r(reg & 0xfffffff); |
1735 | 1735 | } |
1736 | 1736 | default: |
1737 | 1737 | { |
r32461 | r32462 | |
1764 | 1764 | video_reg_w: r: 20000004 d: 00000000 |
1765 | 1765 | */ |
1766 | 1766 | |
1767 | | void taitotz_state::video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data) |
| 1767 | void taitotz_state::video_reg_w(UINT32 reg, UINT32 data) |
1768 | 1768 | { |
1769 | 1769 | switch ((reg >> 28) & 0xf) |
1770 | 1770 | { |
r32461 | r32462 | |
1794 | 1794 | { |
1795 | 1795 | UINT32 pos = (data >> 12) & 0xfff; |
1796 | 1796 | UINT32 tile = data & 0xfff; |
1797 | | draw_tile(state, pos, tile); |
| 1797 | draw_tile(pos, tile); |
1798 | 1798 | break; |
1799 | 1799 | } |
1800 | 1800 | case 0xb: // RAM write? |
1801 | 1801 | { |
1802 | | video_mem_w(state, m_video_ram_ptr, data); |
| 1802 | video_mem_w(m_video_ram_ptr, data); |
1803 | 1803 | m_video_ram_ptr++; |
1804 | 1804 | break; |
1805 | 1805 | } |
r32461 | r32462 | |
1839 | 1839 | { |
1840 | 1840 | case 0x0: |
1841 | 1841 | { |
1842 | | r |= (UINT64)(video_reg_r(this, m_video_reg)) << 32; |
| 1842 | r |= (UINT64)(video_reg_r(m_video_reg)) << 32; |
1843 | 1843 | break; |
1844 | 1844 | } |
1845 | 1845 | |
r32461 | r32462 | |
1885 | 1885 | { |
1886 | 1886 | case 0: |
1887 | 1887 | { |
1888 | | video_reg_w(this, m_video_reg, regdata); |
| 1888 | video_reg_w(m_video_reg, regdata); |
1889 | 1889 | break; |
1890 | 1890 | } |
1891 | 1891 | case 0x8: |
r32461 | r32462 | |
1940 | 1940 | UINT64 r = 0; |
1941 | 1941 | if (ACCESSING_BITS_32_63) |
1942 | 1942 | { |
1943 | | r |= (UINT64)(video_mem_r(this, m_video_ram_ptr)) << 32; |
| 1943 | r |= (UINT64)(video_mem_r(m_video_ram_ptr)) << 32; |
1944 | 1944 | m_video_ram_ptr++; |
1945 | 1945 | } |
1946 | 1946 | if (ACCESSING_BITS_0_31) |
1947 | 1947 | { |
1948 | | r |= (UINT64)(video_mem_r(this, m_video_ram_ptr)); |
| 1948 | r |= (UINT64)(video_mem_r(m_video_ram_ptr)); |
1949 | 1949 | m_video_ram_ptr++; |
1950 | 1950 | } |
1951 | 1951 | |
r32461 | r32462 | |
1963 | 1963 | { |
1964 | 1964 | if (m_video_fifo_ptr >= 8) |
1965 | 1965 | { |
1966 | | video_mem_w(this, m_video_ram_ptr, (UINT32)(data >> 32)); |
| 1966 | video_mem_w(m_video_ram_ptr, (UINT32)(data >> 32)); |
1967 | 1967 | m_video_ram_ptr++; |
1968 | 1968 | } |
1969 | 1969 | m_video_fifo_ptr++; |
r32461 | r32462 | |
1972 | 1972 | { |
1973 | 1973 | if (m_video_fifo_ptr >= 8) |
1974 | 1974 | { |
1975 | | video_mem_w(this, m_video_ram_ptr, (UINT32)(data)); |
| 1975 | video_mem_w(m_video_ram_ptr, (UINT32)(data)); |
1976 | 1976 | m_video_ram_ptr++; |
1977 | 1977 | } |
1978 | 1978 | m_video_fifo_ptr++; |
trunk/src/mame/drivers/segas32.c
r32461 | r32462 | |
531 | 531 | |
532 | 532 | /************************************* |
533 | 533 | * |
534 | | * Prototypes |
535 | | * |
536 | | *************************************/ |
537 | | |
538 | | static void signal_sound_irq(running_machine &machine, int which); |
539 | | |
540 | | |
541 | | |
542 | | /************************************* |
543 | | * |
544 | 534 | * Machine init |
545 | 535 | * |
546 | 536 | *************************************/ |
r32461 | r32462 | |
659 | 649 | case 13: |
660 | 650 | case 14: |
661 | 651 | case 15: /* signal IRQ to sound CPU */ |
662 | | signal_sound_irq(machine(),SOUND_IRQ_V60); |
| 652 | signal_sound_irq(SOUND_IRQ_V60); |
663 | 653 | break; |
664 | 654 | } |
665 | 655 | } |
r32461 | r32462 | |
1216 | 1206 | } |
1217 | 1207 | |
1218 | 1208 | |
1219 | | static void signal_sound_irq(running_machine &machine, int which) |
| 1209 | void segas32_state::signal_sound_irq(int which) |
1220 | 1210 | { |
1221 | | segas32_state *state = machine.driver_data<segas32_state>(); |
1222 | | int i; |
1223 | | |
1224 | 1211 | /* see if this interrupt input is mapped to any vectors; if so, mark them */ |
1225 | | for (i = 0; i < 3; i++) |
1226 | | if (state->m_sound_irq_control[i] == which) |
1227 | | state->m_sound_irq_input |= 1 << i; |
1228 | | state->update_sound_irq_state(); |
| 1212 | for (int i = 0; i < 3; i++) |
| 1213 | if (m_sound_irq_control[i] == which) |
| 1214 | m_sound_irq_input |= 1 << i; |
| 1215 | update_sound_irq_state(); |
1229 | 1216 | } |
1230 | 1217 | |
1231 | 1218 | |
1232 | | static void clear_sound_irq(running_machine &machine, int which) |
| 1219 | void segas32_state::clear_sound_irq(int which) |
1233 | 1220 | { |
1234 | | segas32_state *state = machine.driver_data<segas32_state>(); |
1235 | | int i; |
1236 | | for (i = 0; i < 3; i++) |
1237 | | if (state->m_sound_irq_control[i] == which) |
1238 | | state->m_sound_irq_input &= ~(1 << i); |
1239 | | state->update_sound_irq_state(); |
| 1221 | for (int i = 0; i < 3; i++) |
| 1222 | if (m_sound_irq_control[i] == which) |
| 1223 | m_sound_irq_input &= ~(1 << i); |
| 1224 | update_sound_irq_state(); |
1240 | 1225 | } |
1241 | 1226 | |
1242 | 1227 | |
r32461 | r32462 | |
1265 | 1250 | WRITE_LINE_MEMBER(segas32_state::ym3438_irq_handler) |
1266 | 1251 | { |
1267 | 1252 | if (state) |
1268 | | signal_sound_irq(machine(), SOUND_IRQ_YM3438); |
| 1253 | signal_sound_irq(SOUND_IRQ_YM3438); |
1269 | 1254 | else |
1270 | | clear_sound_irq(machine(), SOUND_IRQ_YM3438); |
| 1255 | clear_sound_irq(SOUND_IRQ_YM3438); |
1271 | 1256 | } |
1272 | 1257 | |
1273 | 1258 | |
trunk/src/mame/drivers/avt.c
r32461 | r32462 | |
452 | 452 | INTERRUPT_GEN_MEMBER(avt_vblank_irq); |
453 | 453 | }; |
454 | 454 | |
455 | | #define mc6845_h_char_total (state->m_crtc_vreg[0]) |
| 455 | #define mc6845_h_char_total (m_crtc_vreg[0]) |
456 | 456 | #define mc6845_h_display (m_crtc_vreg[1]) |
457 | | #define mc6845_h_sync_pos (state->m_crtc_vreg[2]) |
458 | | #define mc6845_sync_width (state->m_crtc_vreg[3]) |
459 | | #define mc6845_v_char_total (state->m_crtc_vreg[4]) |
460 | | #define mc6845_v_total_adj (state->m_crtc_vreg[5]) |
| 457 | #define mc6845_h_sync_pos (m_crtc_vreg[2]) |
| 458 | #define mc6845_sync_width (m_crtc_vreg[3]) |
| 459 | #define mc6845_v_char_total (m_crtc_vreg[4]) |
| 460 | #define mc6845_v_total_adj (m_crtc_vreg[5]) |
461 | 461 | #define mc6845_v_display (m_crtc_vreg[6]) |
462 | | #define mc6845_v_sync_pos (state->m_crtc_vreg[7]) |
463 | | #define mc6845_mode_ctrl (state->m_crtc_vreg[8]) |
464 | | #define mc6845_tile_height (state->m_crtc_vreg[9]+1) |
465 | | #define mc6845_cursor_y_start (state->m_crtc_vreg[0x0a]) |
466 | | #define mc6845_cursor_y_end (state->m_crtc_vreg[0x0b]) |
467 | | #define mc6845_start_addr (((state->m_crtc_vreg[0x0c]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0d] & 0xff)) |
468 | | #define mc6845_cursor_addr (((state->m_crtc_vreg[0x0e]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0f] & 0xff)) |
469 | | #define mc6845_light_pen_addr (((state->m_crtc_vreg[0x10]<<8) & 0x3f00) | (state->m_crtc_vreg[0x11] & 0xff)) |
470 | | #define mc6845_update_addr (((state->m_crtc_vreg[0x12]<<8) & 0x3f00) | (state->m_crtc_vreg[0x13] & 0xff)) |
| 462 | #define mc6845_v_sync_pos (m_crtc_vreg[7]) |
| 463 | #define mc6845_mode_ctrl (m_crtc_vreg[8]) |
| 464 | #define mc6845_tile_height (m_crtc_vreg[9]+1) |
| 465 | #define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) |
| 466 | #define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) |
| 467 | #define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) |
| 468 | #define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) |
| 469 | #define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) |
| 470 | #define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) |
471 | 471 | |
472 | 472 | |
473 | 473 | /********************************************* |
trunk/src/mame/drivers/cave.c
r32461 | r32462 | |
638 | 638 | Koro Koro Quest |
639 | 639 | ***************************************************************************/ |
640 | 640 | |
641 | | static void show_leds(running_machine &machine) |
| 641 | void cave_state::show_leds() |
642 | 642 | { |
643 | 643 | #ifdef MAME_DEBUG |
644 | | // cave_state *state = machine.driver_data<cave_state>(); |
645 | | // popmessage("led %04X eep %02X", state->m_leds[0], (state->m_leds[1] >> 8) & ~0x70); |
| 644 | // popmessage("led %04X eep %02X", m_leds[0], (m_leds[1] >> 8) & ~0x70); |
646 | 645 | #endif |
647 | 646 | } |
648 | 647 | |
r32461 | r32462 | |
666 | 665 | set_led_status(machine(), 7, data & 0x0002); |
667 | 666 | set_led_status(machine(), 8, data & 0x0001); |
668 | 667 | |
669 | | show_leds(machine()); |
| 668 | show_leds(); |
670 | 669 | } |
671 | 670 | |
672 | 671 | |
r32461 | r32462 | |
676 | 675 | { |
677 | 676 | logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data); |
678 | 677 | COMBINE_DATA(&m_leds[1]); |
679 | | show_leds(machine()); |
| 678 | show_leds(); |
680 | 679 | } |
681 | 680 | |
682 | 681 | if (ACCESSING_BITS_8_15) // even address |
r32461 | r32462 | |
924 | 923 | return ~8 + ((m_eeprom->do_read() & 1) ? 8 : 0); |
925 | 924 | } |
926 | 925 | |
927 | | INLINE void vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX) |
| 926 | inline void cave_state::vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX) |
928 | 927 | { |
929 | | cave_state *state = space.machine().driver_data<cave_state>(); |
930 | | UINT16 *VCTRL = state->m_vctrl[GFX]; |
| 928 | UINT16 *VCTRL = m_vctrl[GFX]; |
931 | 929 | if (offset == 4 / 2) |
932 | 930 | { |
933 | 931 | switch (data & 0x000f) |
r32461 | r32462 | |
4665 | 4663 | |
4666 | 4664 | /* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other. |
4667 | 4665 | Expand the 2 bit part into a 4 bit layout, so we can decode it */ |
4668 | | static void sailormn_unpack_tiles( running_machine &machine, const char *region ) |
| 4666 | void cave_state::sailormn_unpack_tiles( const char *region ) |
4669 | 4667 | { |
4670 | | const UINT32 len = machine.root_device().memregion(region)->bytes(); |
4671 | | UINT8 *rgn = machine.root_device().memregion(region)->base(); |
| 4668 | const UINT32 len = memregion(region)->bytes(); |
| 4669 | UINT8 *rgn = memregion(region)->base(); |
4672 | 4670 | UINT8 *src = rgn + (len/4)*3 - 1; |
4673 | 4671 | UINT8 *dst = rgn + (len/4)*4 - 2; |
4674 | 4672 | |
r32461 | r32462 | |
4684 | 4682 | } |
4685 | 4683 | } |
4686 | 4684 | |
4687 | | static void init_cave(running_machine &machine) |
| 4685 | void cave_state::init_cave() |
4688 | 4686 | { |
4689 | | cave_state *state = machine.driver_data<cave_state>(); |
| 4687 | m_spritetype[0] = 0; // Normal sprites |
| 4688 | m_kludge = 0; |
| 4689 | m_time_vblank_irq = 100; |
4690 | 4690 | |
4691 | | state->m_spritetype[0] = 0; // Normal sprites |
4692 | | state->m_kludge = 0; |
4693 | | state->m_time_vblank_irq = 100; |
4694 | | |
4695 | | state->m_irq_level = 1; |
| 4691 | m_irq_level = 1; |
4696 | 4692 | } |
4697 | 4693 | |
4698 | 4694 | |
4699 | 4695 | DRIVER_INIT_MEMBER(cave_state,agallet) |
4700 | 4696 | { |
4701 | 4697 | UINT8 *ROM = memregion("audiocpu")->base(); |
4702 | | init_cave(machine()); |
| 4698 | init_cave(); |
4703 | 4699 | |
4704 | 4700 | membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000); |
4705 | 4701 | |
r32461 | r32462 | |
4711 | 4707 | membank("oki2bank1")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000); |
4712 | 4708 | membank("oki2bank2")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000); |
4713 | 4709 | |
4714 | | sailormn_unpack_tiles(machine(), "layer2"); |
| 4710 | sailormn_unpack_tiles("layer2"); |
4715 | 4711 | |
4716 | 4712 | unpack_sprites("sprites0"); |
4717 | 4713 | } |
4718 | 4714 | |
4719 | 4715 | DRIVER_INIT_MEMBER(cave_state,dfeveron) |
4720 | 4716 | { |
4721 | | init_cave(machine()); |
| 4717 | init_cave(); |
4722 | 4718 | |
4723 | 4719 | unpack_sprites("sprites0"); |
4724 | 4720 | m_kludge = 2; |
r32461 | r32462 | |
4726 | 4722 | |
4727 | 4723 | DRIVER_INIT_MEMBER(cave_state,feversos) |
4728 | 4724 | { |
4729 | | init_cave(machine()); |
| 4725 | init_cave(); |
4730 | 4726 | |
4731 | 4727 | unpack_sprites("sprites0"); |
4732 | 4728 | m_kludge = 2; |
r32461 | r32462 | |
4734 | 4730 | |
4735 | 4731 | DRIVER_INIT_MEMBER(cave_state,ddonpach) |
4736 | 4732 | { |
4737 | | init_cave(machine()); |
| 4733 | init_cave(); |
4738 | 4734 | |
4739 | 4735 | ddonpach_unpack_sprites("sprites0"); |
4740 | 4736 | m_spritetype[0] = 1; // "different" sprites (no zooming?) |
r32461 | r32462 | |
4743 | 4739 | |
4744 | 4740 | DRIVER_INIT_MEMBER(cave_state,donpachi) |
4745 | 4741 | { |
4746 | | init_cave(machine()); |
| 4742 | init_cave(); |
4747 | 4743 | |
4748 | 4744 | ddonpach_unpack_sprites("sprites0"); |
4749 | 4745 | m_spritetype[0] = 1; // "different" sprites (no zooming?) |
r32461 | r32462 | |
4753 | 4749 | |
4754 | 4750 | DRIVER_INIT_MEMBER(cave_state,esprade) |
4755 | 4751 | { |
4756 | | init_cave(machine()); |
| 4752 | init_cave(); |
4757 | 4753 | |
4758 | 4754 | esprade_unpack_sprites("sprites0"); |
4759 | 4755 | m_time_vblank_irq = 2000; /**/ |
r32461 | r32462 | |
4768 | 4764 | |
4769 | 4765 | DRIVER_INIT_MEMBER(cave_state,gaia) |
4770 | 4766 | { |
4771 | | init_cave(machine()); |
| 4767 | init_cave(); |
4772 | 4768 | |
4773 | 4769 | /* No EEPROM */ |
4774 | 4770 | |
r32461 | r32462 | |
4779 | 4775 | |
4780 | 4776 | DRIVER_INIT_MEMBER(cave_state,guwange) |
4781 | 4777 | { |
4782 | | init_cave(machine()); |
| 4778 | init_cave(); |
4783 | 4779 | |
4784 | 4780 | esprade_unpack_sprites("sprites0"); |
4785 | 4781 | m_time_vblank_irq = 2000; /**/ |
r32461 | r32462 | |
4789 | 4785 | { |
4790 | 4786 | UINT8 *ROM = memregion("audiocpu")->base(); |
4791 | 4787 | |
4792 | | init_cave(machine()); |
| 4788 | init_cave(); |
4793 | 4789 | |
4794 | 4790 | membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000); |
4795 | 4791 | |
r32461 | r32462 | |
4808 | 4804 | UINT8 *src = memregion("sprites0")->base(); |
4809 | 4805 | int len = memregion("sprites0")->bytes(); |
4810 | 4806 | |
4811 | | init_cave(machine()); |
| 4807 | init_cave(); |
4812 | 4808 | |
4813 | 4809 | membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000); |
4814 | 4810 | |
r32461 | r32462 | |
4835 | 4831 | { |
4836 | 4832 | UINT8 *ROM = memregion("audiocpu")->base(); |
4837 | 4833 | |
4838 | | init_cave(machine()); |
| 4834 | init_cave(); |
4839 | 4835 | |
4840 | 4836 | membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000); |
4841 | 4837 | |
r32461 | r32462 | |
4855 | 4851 | |
4856 | 4852 | DRIVER_INIT_MEMBER(cave_state,ppsatan) |
4857 | 4853 | { |
4858 | | init_cave(machine()); |
| 4854 | init_cave(); |
4859 | 4855 | |
4860 | 4856 | unpack_sprites("sprites0"); |
4861 | 4857 | unpack_sprites("sprites1"); |
r32461 | r32462 | |
4875 | 4871 | int len = memregion("sprites0")->bytes(); |
4876 | 4872 | int i, j; |
4877 | 4873 | |
4878 | | init_cave(machine()); |
| 4874 | init_cave(); |
4879 | 4875 | |
4880 | 4876 | membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000); |
4881 | 4877 | |
r32461 | r32462 | |
4919 | 4915 | UINT8 *src = memregion("sprites0")->base(); |
4920 | 4916 | int len = memregion("sprites0")->bytes(); |
4921 | 4917 | |
4922 | | init_cave(machine()); |
| 4918 | init_cave(); |
4923 | 4919 | |
4924 | 4920 | membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000); |
4925 | 4921 | |
r32461 | r32462 | |
4940 | 4936 | memcpy(src, buffer, len); |
4941 | 4937 | } |
4942 | 4938 | |
4943 | | sailormn_unpack_tiles( machine(), "layer2" ); |
| 4939 | sailormn_unpack_tiles("layer2"); |
4944 | 4940 | |
4945 | 4941 | unpack_sprites("sprites0"); |
4946 | 4942 | m_spritetype[0] = 2; // Normal sprites with different position handling |
r32461 | r32462 | |
4953 | 4949 | |
4954 | 4950 | DRIVER_INIT_MEMBER(cave_state,tjumpman) |
4955 | 4951 | { |
4956 | | init_cave(machine()); |
| 4952 | init_cave(); |
4957 | 4953 | |
4958 | 4954 | unpack_sprites("sprites0"); |
4959 | 4955 | m_spritetype[0] = 2; // Normal sprites with different position handling |
r32461 | r32462 | |
4966 | 4962 | |
4967 | 4963 | DRIVER_INIT_MEMBER(cave_state,uopoko) |
4968 | 4964 | { |
4969 | | init_cave(machine()); |
| 4965 | init_cave(); |
4970 | 4966 | |
4971 | 4967 | unpack_sprites("sprites0"); |
4972 | 4968 | m_kludge = 2; |
r32461 | r32462 | |
4975 | 4971 | |
4976 | 4972 | DRIVER_INIT_MEMBER(cave_state,korokoro) |
4977 | 4973 | { |
4978 | | init_cave(machine()); |
| 4974 | init_cave(); |
4979 | 4975 | |
4980 | 4976 | m_irq_level = 2; |
4981 | 4977 | |
trunk/src/mame/drivers/coolpool.c
r32461 | r32462 | |
1106 | 1106 | * |
1107 | 1107 | *************************************/ |
1108 | 1108 | |
1109 | | static void register_state_save(running_machine &machine) |
| 1109 | void coolpool_state::register_state_save() |
1110 | 1110 | { |
1111 | | coolpool_state *state = machine.driver_data<coolpool_state>(); |
| 1111 | save_item(NAME(m_oldx)); |
| 1112 | save_item(NAME(m_oldy)); |
| 1113 | save_item(NAME(m_result)); |
| 1114 | save_item(NAME(m_lastresult)); |
1112 | 1115 | |
1113 | | state->save_item(NAME(state->m_oldx)); |
1114 | | state->save_item(NAME(state->m_oldy)); |
1115 | | state->save_item(NAME(state->m_result)); |
1116 | | state->save_item(NAME(state->m_lastresult)); |
1117 | | |
1118 | | state->save_item(NAME(state->m_cmd_pending)); |
1119 | | state->save_item(NAME(state->m_iop_cmd)); |
1120 | | state->save_item(NAME(state->m_iop_answer)); |
1121 | | state->save_item(NAME(state->m_iop_romaddr)); |
| 1116 | save_item(NAME(m_cmd_pending)); |
| 1117 | save_item(NAME(m_iop_cmd)); |
| 1118 | save_item(NAME(m_iop_answer)); |
| 1119 | save_item(NAME(m_iop_romaddr)); |
1122 | 1120 | } |
1123 | 1121 | |
1124 | 1122 | |
r32461 | r32462 | |
1127 | 1125 | { |
1128 | 1126 | m_lastresult = 0xffff; |
1129 | 1127 | |
1130 | | register_state_save(machine()); |
| 1128 | register_state_save(); |
1131 | 1129 | } |
1132 | 1130 | |
1133 | 1131 | DRIVER_INIT_MEMBER(coolpool_state,coolpool) |
1134 | 1132 | { |
1135 | 1133 | m_dsp->space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this)); |
1136 | 1134 | |
1137 | | register_state_save(machine()); |
| 1135 | register_state_save(); |
1138 | 1136 | } |
1139 | 1137 | |
1140 | 1138 | |
r32461 | r32462 | |
1178 | 1176 | rom[a+1] = tmp; |
1179 | 1177 | } |
1180 | 1178 | |
1181 | | register_state_save(machine()); |
| 1179 | register_state_save(); |
1182 | 1180 | } |
1183 | 1181 | |
1184 | 1182 | |
trunk/src/mame/drivers/galaxian.c
r32461 | r32462 | |
446 | 446 | { |
447 | 447 | m_tenspot_current_game++; |
448 | 448 | m_tenspot_current_game%=10; |
449 | | tenspot_set_game_bank(machine(), m_tenspot_current_game, 1); |
| 449 | tenspot_set_game_bank(m_tenspot_current_game, 1); |
450 | 450 | m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); |
451 | 451 | } |
452 | 452 | } |
r32461 | r32462 | |
5972 | 5972 | } |
5973 | 5973 | |
5974 | 5974 | |
5975 | | void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, int from_game) |
| 5975 | void galaxian_state::tenspot_set_game_bank(int bank, int from_game) |
5976 | 5976 | { |
5977 | 5977 | char tmp[64]; |
5978 | 5978 | UINT8* srcregion; |
r32461 | r32462 | |
5980 | 5980 | int x; |
5981 | 5981 | |
5982 | 5982 | sprintf(tmp,"game_%d_cpu", bank); |
5983 | | srcregion = machine.root_device().memregion(tmp)->base(); |
5984 | | dstregion = machine.root_device().memregion("maincpu")->base(); |
| 5983 | srcregion = memregion(tmp)->base(); |
| 5984 | dstregion = memregion("maincpu")->base(); |
5985 | 5985 | memcpy(dstregion, srcregion, 0x4000); |
5986 | 5986 | |
5987 | 5987 | sprintf(tmp,"game_%d_temp", bank); |
5988 | | srcregion = machine.root_device().memregion(tmp)->base(); |
5989 | | dstregion = machine.root_device().memregion("gfx1")->base(); |
| 5988 | srcregion = memregion(tmp)->base(); |
| 5989 | dstregion = memregion("gfx1")->base(); |
5990 | 5990 | memcpy(dstregion, srcregion, 0x2000); |
5991 | | dstregion = machine.root_device().memregion("gfx2")->base(); |
| 5991 | dstregion = memregion("gfx2")->base(); |
5992 | 5992 | memcpy(dstregion, srcregion, 0x2000); |
5993 | 5993 | |
5994 | 5994 | if (from_game) |
r32461 | r32462 | |
6005 | 6005 | } |
6006 | 6006 | |
6007 | 6007 | sprintf(tmp,"game_%d_prom", bank); |
6008 | | srcregion = machine.root_device().memregion(tmp)->base(); |
6009 | | dstregion = machine.root_device().memregion("proms")->base(); |
| 6008 | srcregion = memregion(tmp)->base(); |
| 6009 | dstregion = memregion("proms")->base(); |
6010 | 6010 | memcpy(dstregion, srcregion, 0x20); |
6011 | 6011 | |
6012 | 6012 | PALETTE_INIT_NAME(galaxian)(m_palette); |
r32461 | r32462 | |
6032 | 6032 | |
6033 | 6033 | m_tenspot_current_game = 0; |
6034 | 6034 | |
6035 | | tenspot_set_game_bank(machine(), m_tenspot_current_game, 0); |
| 6035 | tenspot_set_game_bank(m_tenspot_current_game, 0); |
6036 | 6036 | |
6037 | 6037 | space.install_read_handler(0x7000, 0x7000, read8_delegate(FUNC(galaxian_state::tenspot_dsw_read),this)); |
6038 | 6038 | } |
trunk/src/mame/drivers/cobra.c
r32461 | r32462 | |
387 | 387 | void draw_line(const rectangle &visarea, vertex_t &v1, vertex_t &v2); |
388 | 388 | |
389 | 389 | void gfx_init(); |
390 | | void gfx_exit(running_machine &machine); |
391 | | void gfx_reset(running_machine &machine); |
392 | | void gfx_fifo_exec(running_machine &machine); |
| 390 | void gfx_exit(); |
| 391 | void gfx_reset(); |
| 392 | void gfx_fifo_exec(); |
393 | 393 | UINT32 gfx_read_gram(UINT32 address); |
394 | 394 | void gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data); |
395 | | UINT64 gfx_read_reg(running_machine &machine); |
396 | | void gfx_write_reg(running_machine &machine, UINT64 data); |
| 395 | UINT64 gfx_read_reg(); |
| 396 | void gfx_write_reg(UINT64 data); |
397 | 397 | |
398 | 398 | void display(bitmap_rgb32 *bitmap, const rectangle &cliprect); |
399 | 399 | inline rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format); |
r32461 | r32462 | |
998 | 998 | |
999 | 999 | void cobra_state::cobra_video_exit() |
1000 | 1000 | { |
1001 | | m_renderer->gfx_exit(machine()); |
| 1001 | m_renderer->gfx_exit(); |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | void cobra_state::video_start() |
r32461 | r32462 | |
2032 | 2032 | m_zbuffer->fill(*(int*)&zvalue, visarea); |
2033 | 2033 | } |
2034 | 2034 | |
2035 | | void cobra_renderer::gfx_exit(running_machine &machine) |
| 2035 | void cobra_renderer::gfx_exit() |
2036 | 2036 | { |
2037 | 2037 | /* |
2038 | 2038 | FILE *file; |
r32461 | r32462 | |
2048 | 2048 | */ |
2049 | 2049 | } |
2050 | 2050 | |
2051 | | void cobra_renderer::gfx_reset(running_machine &machine) |
| 2051 | void cobra_renderer::gfx_reset() |
2052 | 2052 | { |
2053 | | cobra_state *cobra = machine.driver_data<cobra_state>(); |
| 2053 | cobra_state *cobra = machine().driver_data<cobra_state>(); |
2054 | 2054 | |
2055 | 2055 | cobra->m_gfx_re_status = RE_STATUS_IDLE; |
2056 | 2056 | } |
r32461 | r32462 | |
2125 | 2125 | m_gfx_gram[address/4] |= data & mask; |
2126 | 2126 | } |
2127 | 2127 | |
2128 | | UINT64 cobra_renderer::gfx_read_reg(running_machine &machine) |
| 2128 | UINT64 cobra_renderer::gfx_read_reg() |
2129 | 2129 | { |
2130 | 2130 | return m_gfx_register[m_gfx_register_select]; |
2131 | 2131 | } |
2132 | 2132 | |
2133 | | void cobra_renderer::gfx_write_reg(running_machine &machine, UINT64 data) |
| 2133 | void cobra_renderer::gfx_write_reg(UINT64 data) |
2134 | 2134 | { |
2135 | 2135 | switch (m_gfx_register_select) |
2136 | 2136 | { |
r32461 | r32462 | |
2150 | 2150 | m_gfx_register[m_gfx_register_select] = data; |
2151 | 2151 | } |
2152 | 2152 | |
2153 | | void cobra_renderer::gfx_fifo_exec(running_machine &machine) |
| 2153 | void cobra_renderer::gfx_fifo_exec() |
2154 | 2154 | { |
2155 | | cobra_state *cobra = machine.driver_data<cobra_state>(); |
| 2155 | cobra_state *cobra = machine().driver_data<cobra_state>(); |
2156 | 2156 | |
2157 | 2157 | if (cobra->m_gfx_fifo_loopback != 0) |
2158 | 2158 | return; |
r32461 | r32462 | |
2230 | 2230 | // 64-bit registers, top 32-bits in word 2, low 32-bit in word 3 |
2231 | 2231 | printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]); |
2232 | 2232 | |
2233 | | gfx_write_reg(machine, ((UINT64)(w[2]) << 32) | w[3]); |
| 2233 | gfx_write_reg(((UINT64)(w[2]) << 32) | w[3]); |
2234 | 2234 | } |
2235 | 2235 | else if (w2 == 0x10521000) |
2236 | 2236 | { |
r32461 | r32462 | |
2832 | 2832 | { |
2833 | 2833 | UINT64 r = 0; |
2834 | 2834 | |
2835 | | m_renderer->gfx_fifo_exec(space.machine()); |
| 2835 | m_renderer->gfx_fifo_exec(); |
2836 | 2836 | |
2837 | 2837 | if (ACCESSING_BITS_32_63) |
2838 | 2838 | { |
r32461 | r32462 | |
2958 | 2958 | |
2959 | 2959 | // printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), activecpu_get_pc()); |
2960 | 2960 | |
2961 | | m_renderer->gfx_fifo_exec(space.machine()); |
| 2961 | m_renderer->gfx_fifo_exec(); |
2962 | 2962 | |
2963 | 2963 | if (data == U64(0x00a0000110500018)) |
2964 | 2964 | { |
r32461 | r32462 | |
2966 | 2966 | |
2967 | 2967 | // reads back the register selected by gfx register select |
2968 | 2968 | |
2969 | | UINT64 regdata = m_renderer->gfx_read_reg(space.machine()); |
| 2969 | UINT64 regdata = m_renderer->gfx_read_reg(); |
2970 | 2970 | |
2971 | 2971 | m_gfxfifo_out->push(&space.device(), (UINT32)(regdata >> 32)); |
2972 | 2972 | m_gfxfifo_out->push(&space.device(), (UINT32)(regdata)); |
r32461 | r32462 | |
3012 | 3012 | fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 32) | i); |
3013 | 3013 | fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 0) | i); |
3014 | 3014 | |
3015 | | cobra->m_renderer->gfx_fifo_exec(device->machine()); |
| 3015 | cobra->m_renderer->gfx_fifo_exec(); |
3016 | 3016 | } |
3017 | 3017 | else |
3018 | 3018 | { |
r32461 | r32462 | |
3150 | 3150 | identify_device[51] = 0x0200; /* 51: PIO data transfer cycle timing mode */ |
3151 | 3151 | identify_device[67] = 0x01e0; /* 67: minimum PIO transfer cycle time without flow control */ |
3152 | 3152 | |
3153 | | m_renderer->gfx_reset(machine()); |
| 3153 | m_renderer->gfx_reset(); |
3154 | 3154 | |
3155 | 3155 | m_sound_dma_ptr = 0; |
3156 | 3156 | |
trunk/src/mame/includes/cave.h
r32461 | r32462 | |
127 | 127 | required_device<timer_device> m_int_timer; |
128 | 128 | optional_device<timer_device> m_int_timer_left; |
129 | 129 | optional_device<timer_device> m_int_timer_right; |
| 130 | optional_device<eeprom_serial_93cxx_device> m_eeprom; |
| 131 | required_device<gfxdecode_device> m_gfxdecode; |
| 132 | required_device<screen_device> m_screen; |
| 133 | required_device<palette_device> m_palette; |
130 | 134 | int m_rasflag; |
131 | 135 | int m_old_rasflag; |
132 | 136 | DECLARE_READ16_MEMBER(cave_irq_cause_r); |
r32461 | r32462 | |
237 | 241 | void sailormn_tilebank_w(int bank); |
238 | 242 | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
239 | 243 | DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); |
240 | | optional_device<eeprom_serial_93cxx_device> m_eeprom; |
241 | | required_device<gfxdecode_device> m_gfxdecode; |
242 | | required_device<screen_device> m_screen; |
243 | | required_device<palette_device> m_palette; |
244 | 244 | void update_irq_state(); |
245 | 245 | void unpack_sprites(const char *region); |
246 | 246 | void ddonpach_unpack_sprites(const char *region); |
247 | 247 | void esprade_unpack_sprites(const char *region); |
| 248 | void sailormn_unpack_tiles(const char *region); |
248 | 249 | |
249 | 250 | private: |
250 | 251 | inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX ); |
251 | 252 | inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 priority, UINT32 priority2, int GFX ); |
252 | 253 | inline void vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ); |
253 | 254 | inline void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ); |
| 255 | inline void vctrl_w( address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX ); |
254 | 256 | void set_pens(int chip); |
255 | 257 | void cave_vh_start( int num ); |
256 | 258 | void get_sprite_info_cave(int chip); |
r32461 | r32462 | |
265 | 267 | void sprite_draw_cave_zbuf( int chip, int priority ); |
266 | 268 | void sprite_draw_donpachi( int chip, int priority ); |
267 | 269 | void sprite_draw_donpachi_zbuf( int chip, int priority ); |
| 270 | void init_cave(); |
| 271 | void show_leds(); |
268 | 272 | }; |
trunk/src/mame/includes/cosmic.h
r32461 | r32462 | |
18 | 18 | : driver_device(mconfig, type, tag), |
19 | 19 | m_videoram(*this, "videoram"), |
20 | 20 | m_spriteram(*this, "spriteram"), |
| 21 | m_maincpu(*this, "maincpu"), |
21 | 22 | m_samples(*this, "samples"), |
22 | 23 | m_dac(*this, "dac"), |
23 | | m_maincpu(*this, "maincpu"), |
24 | 24 | m_gfxdecode(*this, "gfxdecode"), |
25 | 25 | m_screen(*this, "screen"), |
26 | 26 | m_palette(*this, "palette") { } |
r32461 | r32462 | |
30 | 30 | optional_shared_ptr<UINT8> m_spriteram; |
31 | 31 | |
32 | 32 | /* video-related */ |
33 | | pen_t (*m_map_color)(running_machine &machine, UINT8 x, UINT8 y); |
| 33 | typedef pen_t (cosmic_state::*color_func)(UINT8 x, UINT8 y); |
| 34 | color_func m_map_color; |
34 | 35 | int m_color_registers[3]; |
35 | 36 | int m_background_enable; |
36 | 37 | int m_magspot_pen_mask; |
r32461 | r32462 | |
47 | 48 | DECLARE_READ8_MEMBER( interrupt_level ); |
48 | 49 | |
49 | 50 | /* devices */ |
| 51 | required_device<cpu_device> m_maincpu; |
50 | 52 | optional_device<samples_device> m_samples; |
51 | 53 | required_device<dac_device> m_dac; |
| 54 | optional_device<gfxdecode_device> m_gfxdecode; |
| 55 | required_device<screen_device> m_screen; |
| 56 | required_device<palette_device> m_palette; |
| 57 | |
52 | 58 | DECLARE_WRITE8_MEMBER(panic_sound_output_w); |
53 | 59 | DECLARE_WRITE8_MEMBER(panic_sound_output2_w); |
54 | 60 | DECLARE_WRITE8_MEMBER(cosmicg_output_w); |
r32461 | r32462 | |
85 | 91 | UINT32 screen_update_devzone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
86 | 92 | UINT32 screen_update_nomnlnd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
87 | 93 | TIMER_DEVICE_CALLBACK_MEMBER(panic_scanline); |
88 | | void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
89 | | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites ); |
90 | | void cosmica_draw_starfield( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); |
91 | | void devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
92 | | void nomnlnd_draw_background( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); |
93 | | required_device<cpu_device> m_maincpu; |
94 | | optional_device<gfxdecode_device> m_gfxdecode; |
95 | | required_device<screen_device> m_screen; |
96 | | required_device<palette_device> m_palette; |
| 94 | void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 95 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites); |
| 96 | void cosmica_draw_starfield(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 97 | void devzone_draw_grid(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 98 | void nomnlnd_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 99 | pen_t panic_map_color(UINT8 x, UINT8 y); |
| 100 | pen_t cosmica_map_color(UINT8 x, UINT8 y); |
| 101 | pen_t cosmicg_map_color(UINT8 x, UINT8 y); |
| 102 | pen_t magspot_map_color(UINT8 x, UINT8 y); |
97 | 103 | }; |
trunk/src/mame/includes/coolpool.h
r32461 | r32462 | |
8 | 8 | public: |
9 | 9 | coolpool_state(const machine_config &mconfig, device_type type, const char *tag) |
10 | 10 | : driver_device(mconfig, type, tag), |
| 11 | m_maincpu(*this, "maincpu"), |
| 12 | m_dsp(*this, "dsp"), |
| 13 | m_dac(*this, "dac"), |
11 | 14 | m_tlc34076(*this, "tlc34076"), |
12 | 15 | m_vram_base(*this, "vram_base"), |
13 | | m_nvram(*this, "nvram"), |
14 | | m_maincpu(*this, "maincpu"), |
15 | | m_dsp(*this, "dsp"), |
16 | | m_dac(*this, "dac"){ } |
| 16 | m_nvram(*this, "nvram") { } |
17 | 17 | |
| 18 | required_device<cpu_device> m_maincpu; |
| 19 | required_device<cpu_device> m_dsp; |
| 20 | required_device<dac_device> m_dac; |
18 | 21 | optional_device<tlc34076_device> m_tlc34076; |
| 22 | |
19 | 23 | required_shared_ptr<UINT16> m_vram_base; |
20 | 24 | required_shared_ptr<UINT16> m_nvram; |
21 | 25 | |
r32461 | r32462 | |
33 | 37 | |
34 | 38 | UINT16 m_result; |
35 | 39 | UINT16 m_lastresult; |
36 | | |
37 | | required_device<cpu_device> m_maincpu; |
38 | | required_device<cpu_device> m_dsp; |
| 40 | |
39 | 41 | UINT16 m_nvram_write_seq[NVRAM_UNLOCK_SEQ_LEN]; |
40 | 42 | UINT8 m_nvram_write_enable; |
41 | 43 | UINT8 m_old_cmd; |
r32461 | r32462 | |
73 | 75 | TIMER_CALLBACK_MEMBER(deferred_iop_w); |
74 | 76 | TIMER_DEVICE_CALLBACK_MEMBER(nvram_write_timeout); |
75 | 77 | TIMER_DEVICE_CALLBACK_MEMBER(amerdart_audio_int_gen); |
76 | | required_device<dac_device> m_dac; |
| 78 | void register_state_save(); |
77 | 79 | }; |
trunk/src/mame/video/cosmic.c
r32461 | r32462 | |
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | | static pen_t panic_map_color( running_machine &machine, UINT8 x, UINT8 y ) |
| 19 | pen_t cosmic_state::panic_map_color( UINT8 x, UINT8 y ) |
20 | 20 | { |
21 | | cosmic_state *state = machine.driver_data<cosmic_state>(); |
22 | | offs_t offs = (state->m_color_registers[0] << 9) | (state->m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3); |
23 | | pen_t pen = state->memregion("user1")->base()[offs]; |
| 21 | offs_t offs = (m_color_registers[0] << 9) | (m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3); |
| 22 | pen_t pen = memregion("user1")->base()[offs]; |
24 | 23 | |
25 | | if (state->m_color_registers[1]) |
| 24 | if (m_color_registers[1]) |
26 | 25 | pen >>= 4; |
27 | 26 | |
28 | 27 | return pen & 0x0f; |
29 | 28 | } |
30 | 29 | |
31 | | static pen_t cosmica_map_color( running_machine &machine, UINT8 x, UINT8 y ) |
| 30 | pen_t cosmic_state::cosmica_map_color( UINT8 x, UINT8 y ) |
32 | 31 | { |
33 | | cosmic_state *state = machine.driver_data<cosmic_state>(); |
34 | | offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3); |
35 | | pen_t pen = state->memregion("user1")->base()[offs]; |
| 32 | offs_t offs = (m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3); |
| 33 | pen_t pen = memregion("user1")->base()[offs]; |
36 | 34 | |
37 | | if (state->m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors |
| 35 | if (m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors |
38 | 36 | pen >>= 4; |
39 | 37 | |
40 | 38 | return pen & 0x07; |
41 | 39 | } |
42 | 40 | |
43 | | static pen_t cosmicg_map_color( running_machine &machine, UINT8 x, UINT8 y ) |
| 41 | pen_t cosmic_state::cosmicg_map_color( UINT8 x, UINT8 y ) |
44 | 42 | { |
45 | | cosmic_state *state = machine.driver_data<cosmic_state>(); |
46 | | offs_t offs = (state->m_color_registers[0] << 8) | (state->m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4); |
47 | | pen_t pen = state->memregion("user1")->base()[offs]; |
| 43 | offs_t offs = (m_color_registers[0] << 8) | (m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4); |
| 44 | pen_t pen = memregion("user1")->base()[offs]; |
48 | 45 | |
49 | 46 | /* the upper 4 bits are for cocktail mode support */ |
50 | 47 | return pen & 0x0f; |
51 | 48 | } |
52 | 49 | |
53 | | static pen_t magspot_map_color( running_machine &machine, UINT8 x, UINT8 y ) |
| 50 | pen_t cosmic_state::magspot_map_color( UINT8 x, UINT8 y ) |
54 | 51 | { |
55 | | cosmic_state *state = machine.driver_data<cosmic_state>(); |
56 | | offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4); |
57 | | pen_t pen = state->memregion("user1")->base()[offs]; |
| 52 | offs_t offs = (m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4); |
| 53 | pen_t pen = memregion("user1")->base()[offs]; |
58 | 54 | |
59 | | if (state->m_color_registers[1]) |
| 55 | if (m_color_registers[1]) |
60 | 56 | pen >>= 4; |
61 | 57 | |
62 | | return pen & state->m_magspot_pen_mask; |
| 58 | return pen & m_magspot_pen_mask; |
63 | 59 | } |
64 | 60 | |
65 | 61 | |
r32461 | r32462 | |
101 | 97 | palette.set_pen_indirect(i, ctabentry); |
102 | 98 | } |
103 | 99 | |
104 | | m_map_color = panic_map_color; |
| 100 | m_map_color = &cosmic_state::panic_map_color; |
105 | 101 | } |
106 | 102 | |
107 | 103 | |
r32461 | r32462 | |
141 | 137 | palette.set_pen_indirect(i + 0x20, ctabentry); |
142 | 138 | } |
143 | 139 | |
144 | | m_map_color = cosmica_map_color; |
| 140 | m_map_color = &cosmic_state::cosmica_map_color; |
145 | 141 | } |
146 | 142 | |
147 | 143 | |
r32461 | r32462 | |
167 | 163 | palette.set_pen_color(i, rgb_t(r, g, b)); |
168 | 164 | } |
169 | 165 | |
170 | | m_map_color = cosmicg_map_color; |
| 166 | m_map_color = &cosmic_state::cosmicg_map_color; |
171 | 167 | } |
172 | 168 | |
173 | 169 | |
r32461 | r32462 | |
197 | 193 | palette.set_pen_indirect(i, ctabentry); |
198 | 194 | } |
199 | 195 | |
200 | | m_map_color = magspot_map_color; |
| 196 | m_map_color = &cosmic_state::magspot_map_color; |
201 | 197 | m_magspot_pen_mask = 0x0f; |
202 | 198 | } |
203 | 199 | |
r32461 | r32462 | |
225 | 221 | palette.set_pen_indirect(i, ctabentry); |
226 | 222 | } |
227 | 223 | |
228 | | m_map_color = magspot_map_color; |
| 224 | m_map_color = &cosmic_state::magspot_map_color; |
229 | 225 | m_magspot_pen_mask = 0x07; |
230 | 226 | } |
231 | 227 | |
r32461 | r32462 | |
248 | 244 | UINT8 x = offs << 3; |
249 | 245 | UINT8 y = offs >> 5; |
250 | 246 | |
251 | | pen_t pen = m_map_color(machine(), x, y); |
| 247 | pen_t pen = (this->*m_map_color)(x, y); |
252 | 248 | |
253 | 249 | for (i = 0; i < 8; i++) |
254 | 250 | { |