trunk/src/mame/drivers/jollyjgr.c
| r248592 | r248593 | |
| 116 | 116 | m_bulletram(*this, "bulletram"), |
| 117 | 117 | m_maincpu(*this, "maincpu"), |
| 118 | 118 | m_gfxdecode(*this, "gfxdecode"), |
| 119 | | m_palette(*this, "palette") { } |
| 119 | m_palette(*this, "palette"), |
| 120 | m_bm_palette(*this, "bm_palette") { } |
| 120 | 121 | |
| 121 | 122 | /* memory pointers */ |
| 122 | 123 | required_shared_ptr<UINT8> m_videoram; |
| r248592 | r248593 | |
| 144 | 145 | virtual void machine_reset(); |
| 145 | 146 | virtual void video_start(); |
| 146 | 147 | DECLARE_PALETTE_INIT(jollyjgr); |
| 147 | | UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 148 | | UINT32 screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 148 | UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 149 | UINT32 screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 149 | 150 | INTERRUPT_GEN_MEMBER(jollyjgr_interrupt); |
| 150 | | void draw_bitmap( bitmap_ind16 &bitmap ); |
| 151 | void draw_bitmap( bitmap_rgb32 &bitmap ); |
| 151 | 152 | required_device<cpu_device> m_maincpu; |
| 152 | 153 | required_device<gfxdecode_device> m_gfxdecode; |
| 153 | 154 | required_device<palette_device> m_palette; |
| 155 | required_device<palette_device> m_bm_palette; |
| 154 | 156 | }; |
| 155 | 157 | |
| 156 | 158 | |
| r248592 | r248593 | |
| 415 | 417 | * |
| 416 | 418 | *************************************/ |
| 417 | 419 | |
| 420 | /* tilemap / sprites palette */ |
| 418 | 421 | PALETTE_INIT_MEMBER(jollyjgr_state, jollyjgr) |
| 419 | 422 | { |
| 420 | 423 | const UINT8 *color_prom = memregion("proms")->base(); |
| 421 | | int i; |
| 422 | 424 | |
| 423 | | /* tilemap / sprites palette */ |
| 424 | | for (i = 0; i < 32; i++) |
| 425 | for (int i = 0; i < 32; i++) |
| 425 | 426 | { |
| 426 | 427 | int bit0, bit1, bit2, r, g, b; |
| 427 | 428 | |
| r248592 | r248593 | |
| 443 | 444 | palette.set_pen_color(i, rgb_t(r,g,b)); |
| 444 | 445 | color_prom++; |
| 445 | 446 | } |
| 446 | | |
| 447 | | /* bitmap palette */ |
| 448 | | for (i = 0;i < 8;i++) |
| 449 | | palette.set_pen_color(32 + i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); |
| 450 | 447 | } |
| 451 | 448 | |
| 452 | 449 | /* Tilemap is the same as in Galaxian */ |
| r248592 | r248593 | |
| 465 | 462 | m_bg_tilemap->set_scroll_cols(32); |
| 466 | 463 | } |
| 467 | 464 | |
| 468 | | void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap ) |
| 465 | void jollyjgr_state::draw_bitmap( bitmap_rgb32 &bitmap ) |
| 469 | 466 | { |
| 470 | 467 | int x, y, count; |
| 471 | 468 | int i, bit0, bit1, bit2; |
| r248592 | r248593 | |
| 486 | 483 | if(color) |
| 487 | 484 | { |
| 488 | 485 | if(m_flip_x && m_flip_y) |
| 489 | | bitmap.pix16(y, x * 8 + i) = color + 32; |
| 486 | bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color); |
| 490 | 487 | else if(m_flip_x && !m_flip_y) |
| 491 | | bitmap.pix16(255 - y, x * 8 + i) = color + 32; |
| 488 | bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); |
| 492 | 489 | else if(!m_flip_x && m_flip_y) |
| 493 | | bitmap.pix16(y, 255 - x * 8 - i) = color + 32; |
| 490 | bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); |
| 494 | 491 | else |
| 495 | | bitmap.pix16(255 - y, 255 - x * 8 - i) = color + 32; |
| 492 | bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); |
| 496 | 493 | } |
| 497 | 494 | } |
| 498 | 495 | |
| r248592 | r248593 | |
| 501 | 498 | } |
| 502 | 499 | } |
| 503 | 500 | |
| 504 | | UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 501 | UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 505 | 502 | { |
| 506 | 503 | UINT8 *spriteram = m_spriteram; |
| 507 | 504 | int offs; |
| r248592 | r248593 | |
| 556 | 553 | return 0; |
| 557 | 554 | } |
| 558 | 555 | |
| 559 | | UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 556 | UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 560 | 557 | { |
| 561 | 558 | // Draw bg and sprites |
| 562 | 559 | screen_update_jollyjgr(screen, bitmap, cliprect); |
| r248592 | r248593 | |
| 569 | 566 | UINT8 sy=~m_bulletram[offs]; |
| 570 | 567 | UINT8 sx=~m_bulletram[offs|1]; |
| 571 | 568 | UINT16 bc=(offs<4)? |
| 572 | | 32+7: // player, white |
| 573 | | 32+3; // enemy, yellow |
| 569 | 7: // player, white |
| 570 | 3; // enemy, yellow |
| 574 | 571 | |
| 575 | 572 | if (m_flip_y) sy^=0xff; |
| 576 | 573 | if (m_flip_x) sx+=8; |
| r248592 | r248593 | |
| 578 | 575 | if (sy>=cliprect.min_y && sy<=cliprect.max_y) |
| 579 | 576 | for (int x=sx-4;x<sx;x++) |
| 580 | 577 | if (x>=cliprect.min_x && x<=cliprect.max_x) |
| 581 | | bitmap.pix16(sy, x)=bc; |
| 578 | bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc); |
| 582 | 579 | } |
| 583 | 580 | |
| 584 | 581 | return 0; |
| r248592 | r248593 | |
| 653 | 650 | } |
| 654 | 651 | |
| 655 | 652 | static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) |
| 656 | | |
| 657 | 653 | /* basic machine hardware */ |
| 658 | 654 | MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3,579545 MHz */ |
| 659 | 655 | MCFG_CPU_PROGRAM_MAP(jollyjgr_map) |
| 660 | 656 | MCFG_CPU_VBLANK_INT_DRIVER("screen", jollyjgr_state, jollyjgr_interrupt) |
| 661 | 657 | |
| 662 | | |
| 663 | 658 | /* video hardware */ |
| 664 | 659 | MCFG_SCREEN_ADD("screen", RASTER) |
| 665 | 660 | MCFG_SCREEN_REFRESH_RATE(60) |
| r248592 | r248593 | |
| 667 | 662 | MCFG_SCREEN_SIZE(256, 256) |
| 668 | 663 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 669 | 664 | MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_jollyjgr) |
| 670 | | MCFG_SCREEN_PALETTE("palette") |
| 671 | 665 | |
| 672 | 666 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", jollyjgr) |
| 673 | | MCFG_PALETTE_ADD("palette", 32+8) /* 32 for tilemap and sprites + 8 for the bitmap */ |
| 667 | MCFG_PALETTE_ADD("palette", 32) // tilemap and sprites |
| 674 | 668 | MCFG_PALETTE_INIT_OWNER(jollyjgr_state, jollyjgr) |
| 669 | MCFG_PALETTE_ADD_3BIT_RGB("bm_palette") // bitmap |
| 675 | 670 | |
| 676 | 671 | /* sound hardware */ |
| 677 | 672 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| r248592 | r248593 | |
| 681 | 676 | MACHINE_CONFIG_END |
| 682 | 677 | |
| 683 | 678 | static MACHINE_CONFIG_DERIVED( fspider, jollyjgr ) |
| 684 | | |
| 685 | 679 | MCFG_CPU_MODIFY("maincpu") |
| 686 | 680 | MCFG_CPU_PROGRAM_MAP(fspider_map) |
| 687 | 681 | |
| 688 | 682 | MCFG_SCREEN_MODIFY("screen") |
| 689 | 683 | MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_fspider) |
| 690 | | |
| 691 | 684 | MACHINE_CONFIG_END |
| 692 | 685 | |
| 693 | 686 | /************************************* |