trunk/src/mame/drivers/fuukifg2.c
| r243693 | r243694 | |
| 60 | 60 | |
| 61 | 61 | ***************************************************************************/ |
| 62 | 62 | |
| 63 | | WRITE16_MEMBER(fuuki16_state::fuuki16_vregs_w) |
| 63 | WRITE16_MEMBER(fuuki16_state::vregs_w) |
| 64 | 64 | { |
| 65 | 65 | UINT16 old_data = m_vregs[offset]; |
| 66 | 66 | UINT16 new_data = COMBINE_DATA(&m_vregs[offset]); |
| r243693 | r243694 | |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | | WRITE16_MEMBER(fuuki16_state::fuuki16_sound_command_w) |
| 75 | WRITE16_MEMBER(fuuki16_state::sound_command_w) |
| 76 | 76 | { |
| 77 | 77 | if (ACCESSING_BITS_0_7) |
| 78 | 78 | { |
| r243693 | r243694 | |
| 86 | 86 | static ADDRESS_MAP_START( fuuki16_map, AS_PROGRAM, 16, fuuki16_state ) |
| 87 | 87 | AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM |
| 88 | 88 | AM_RANGE(0x400000, 0x40ffff) AM_RAM // RAM |
| 89 | | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(fuuki16_vram_0_w) AM_SHARE("vram.0") // Layers |
| 90 | | AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(fuuki16_vram_1_w) AM_SHARE("vram.1") // |
| 91 | | AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(fuuki16_vram_2_w) AM_SHARE("vram.2") // |
| 92 | | AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(fuuki16_vram_3_w) AM_SHARE("vram.3") // |
| 89 | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(vram_0_w) AM_SHARE("vram.0") // Layers |
| 90 | AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(vram_1_w) AM_SHARE("vram.1") // |
| 91 | AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(vram_2_w) AM_SHARE("vram.2") // |
| 92 | AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(vram_3_w) AM_SHARE("vram.3") // |
| 93 | 93 | AM_RANGE(0x600000, 0x601fff) AM_MIRROR(0x008000) AM_DEVREADWRITE("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w) AM_SHARE("spriteram") // Sprites, mirrored? |
| 94 | 94 | AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // Palette |
| 95 | 95 | AM_RANGE(0x800000, 0x800001) AM_READ_PORT("SYSTEM") |
| 96 | 96 | AM_RANGE(0x810000, 0x810001) AM_READ_PORT("P1_P2") |
| 97 | 97 | AM_RANGE(0x880000, 0x880001) AM_READ_PORT("DSW") |
| 98 | | AM_RANGE(0x8a0000, 0x8a0001) AM_WRITE(fuuki16_sound_command_w) // To Sound CPU |
| 99 | | AM_RANGE(0x8c0000, 0x8c001f) AM_RAM_WRITE(fuuki16_vregs_w) AM_SHARE("vregs") // Video Registers |
| 98 | AM_RANGE(0x8a0000, 0x8a0001) AM_WRITE(sound_command_w) // To Sound CPU |
| 99 | AM_RANGE(0x8c0000, 0x8c001f) AM_RAM_WRITE(vregs_w) AM_SHARE("vregs") // Video Registers |
| 100 | 100 | AM_RANGE(0x8d0000, 0x8d0003) AM_RAM AM_SHARE("unknown") // |
| 101 | 101 | AM_RANGE(0x8e0000, 0x8e0001) AM_RAM AM_SHARE("priority") // |
| 102 | 102 | ADDRESS_MAP_END |
| r243693 | r243694 | |
| 110 | 110 | |
| 111 | 111 | ***************************************************************************/ |
| 112 | 112 | |
| 113 | | WRITE8_MEMBER(fuuki16_state::fuuki16_sound_rombank_w) |
| 113 | WRITE8_MEMBER(fuuki16_state::sound_rombank_w) |
| 114 | 114 | { |
| 115 | 115 | if (data <= 2) |
| 116 | 116 | membank("bank1")->set_entry(data); |
| r243693 | r243694 | |
| 118 | 118 | logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", space.device().safe_pc(), data); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | | WRITE8_MEMBER(fuuki16_state::fuuki16_oki_banking_w) |
| 121 | WRITE8_MEMBER(fuuki16_state::oki_banking_w) |
| 122 | 122 | { |
| 123 | 123 | /* |
| 124 | 124 | data & 0x06 is always equals to data & 0x60 |
| r243693 | r243694 | |
| 136 | 136 | |
| 137 | 137 | static ADDRESS_MAP_START( fuuki16_sound_io_map, AS_IO, 8, fuuki16_state ) |
| 138 | 138 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 139 | | AM_RANGE(0x00, 0x00) AM_WRITE(fuuki16_sound_rombank_w) // ROM Bank |
| 139 | AM_RANGE(0x00, 0x00) AM_WRITE(sound_rombank_w) // ROM Bank |
| 140 | 140 | AM_RANGE(0x11, 0x11) AM_READ(soundlatch_byte_r) AM_WRITENOP // From Main CPU / ? To Main CPU ? |
| 141 | | AM_RANGE(0x20, 0x20) AM_WRITE(fuuki16_oki_banking_w) // Oki Banking |
| 141 | AM_RANGE(0x20, 0x20) AM_WRITE(oki_banking_w) // Oki Banking |
| 142 | 142 | AM_RANGE(0x30, 0x30) AM_WRITENOP // ? In the NMI routine |
| 143 | 143 | AM_RANGE(0x40, 0x41) AM_DEVWRITE("ym1", ym2203_device, write) |
| 144 | 144 | AM_RANGE(0x50, 0x51) AM_DEVREADWRITE("ym2", ym3812_device, read, write) |
| r243693 | r243694 | |
| 399 | 399 | { |
| 400 | 400 | case TIMER_LEVEL_1_INTERRUPT: |
| 401 | 401 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 402 | | timer_set(m_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT); |
| 402 | m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248)); |
| 403 | 403 | break; |
| 404 | 404 | case TIMER_VBLANK_INTERRUPT: |
| 405 | 405 | m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ |
| 406 | | timer_set(m_screen->time_until_vblank_start(), TIMER_VBLANK_INTERRUPT); |
| 406 | m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start()); |
| 407 | 407 | break; |
| 408 | 408 | case TIMER_RASTER_INTERRUPT: |
| 409 | 409 | m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ |
| r243693 | r243694 | |
| 422 | 422 | |
| 423 | 423 | membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x8000); |
| 424 | 424 | |
| 425 | m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT); |
| 426 | m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT); |
| 425 | 427 | m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT); |
| 426 | 428 | } |
| 427 | 429 | |
| r243693 | r243694 | |
| 430 | 432 | { |
| 431 | 433 | const rectangle &visarea = m_screen->visible_area(); |
| 432 | 434 | |
| 433 | | timer_set(m_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT); |
| 434 | | timer_set(m_screen->time_until_vblank_start(), TIMER_VBLANK_INTERRUPT); |
| 435 | m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248)); |
| 436 | m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start()); |
| 435 | 437 | m_raster_interrupt_timer->adjust(m_screen->time_until_pos(0, visarea.max_x + 1)); |
| 436 | 438 | } |
| 437 | 439 | |
| r243693 | r243694 | |
| 452 | 454 | MCFG_SCREEN_REFRESH_RATE(60) |
| 453 | 455 | MCFG_SCREEN_SIZE(320, 256) |
| 454 | 456 | MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-16-1) |
| 455 | | MCFG_SCREEN_UPDATE_DRIVER(fuuki16_state, screen_update_fuuki16) |
| 457 | MCFG_SCREEN_UPDATE_DRIVER(fuuki16_state, screen_update) |
| 456 | 458 | MCFG_SCREEN_PALETTE("palette") |
| 457 | 459 | |
| 458 | 460 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", fuuki16) |
| r243693 | r243694 | |
| 661 | 663 | |
| 662 | 664 | ***************************************************************************/ |
| 663 | 665 | |
| 664 | | GAME( 1995, gogomile, 0, fuuki16, gogomile, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (newer)", 0 ) |
| 665 | | GAME( 1995, gogomileo, gogomile, fuuki16, gogomileo, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (older)", 0 ) |
| 666 | | GAME( 1996, pbancho, 0, fuuki16, pbancho, driver_device, 0, ROT0, "Fuuki", "Gyakuten!! Puzzle Bancho (Japan)", 0) |
| 666 | GAME( 1995, gogomile, 0, fuuki16, gogomile, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (newer)", GAME_SUPPORTS_SAVE ) |
| 667 | GAME( 1995, gogomileo, gogomile, fuuki16, gogomileo, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (older)", GAME_SUPPORTS_SAVE ) |
| 668 | GAME( 1996, pbancho, 0, fuuki16, pbancho, driver_device, 0, ROT0, "Fuuki", "Gyakuten!! Puzzle Bancho (Japan)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/fuukifg2.h
| r243693 | r243694 | |
| 13 | 13 | |
| 14 | 14 | fuuki16_state(const machine_config &mconfig, device_type type, const char *tag) |
| 15 | 15 | : driver_device(mconfig, type, tag), |
| 16 | | m_vram(*this, "vram"), |
| 17 | | m_vregs(*this, "vregs"), |
| 18 | | m_unknown(*this, "unknown"), |
| 19 | | m_priority(*this, "priority"), |
| 20 | 16 | m_maincpu(*this, "maincpu"), |
| 21 | 17 | m_audiocpu(*this, "audiocpu"), |
| 22 | 18 | m_oki(*this, "oki"), |
| 23 | 19 | m_gfxdecode(*this, "gfxdecode"), |
| 24 | 20 | m_screen(*this, "screen"), |
| 25 | 21 | m_palette(*this, "palette"), |
| 26 | | m_fuukivid(*this, "fuukivid") |
| 22 | m_fuukivid(*this, "fuukivid"), |
| 23 | m_vram(*this, "vram"), |
| 24 | m_vregs(*this, "vregs"), |
| 25 | m_unknown(*this, "unknown"), |
| 26 | m_priority(*this, "priority") |
| 27 | 27 | { } |
| 28 | 28 | |
| 29 | /* devices */ |
| 30 | required_device<cpu_device> m_maincpu; |
| 31 | required_device<cpu_device> m_audiocpu; |
| 32 | required_device<okim6295_device> m_oki; |
| 33 | required_device<gfxdecode_device> m_gfxdecode; |
| 34 | required_device<screen_device> m_screen; |
| 35 | required_device<palette_device> m_palette; |
| 36 | required_device<fuukivid_device> m_fuukivid; |
| 37 | |
| 29 | 38 | /* memory pointers */ |
| 30 | 39 | required_shared_ptr_array<UINT16,4> m_vram; |
| 31 | 40 | required_shared_ptr<UINT16> m_vregs; |
| 32 | 41 | required_shared_ptr<UINT16> m_unknown; |
| 33 | 42 | required_shared_ptr<UINT16> m_priority; |
| 34 | | // UINT16 * m_paletteram; // currently this uses generic palette handling |
| 35 | 43 | |
| 36 | 44 | /* video-related */ |
| 37 | 45 | tilemap_t *m_tilemap[4]; |
| 38 | 46 | |
| 39 | 47 | /* misc */ |
| 48 | emu_timer *m_level_1_interrupt_timer; |
| 49 | emu_timer *m_vblank_interrupt_timer; |
| 40 | 50 | emu_timer *m_raster_interrupt_timer; |
| 41 | 51 | |
| 42 | | /* devices */ |
| 43 | | required_device<cpu_device> m_maincpu; |
| 44 | | required_device<cpu_device> m_audiocpu; |
| 45 | | DECLARE_WRITE16_MEMBER(fuuki16_vregs_w); |
| 46 | | DECLARE_WRITE16_MEMBER(fuuki16_sound_command_w); |
| 47 | | DECLARE_WRITE8_MEMBER(fuuki16_sound_rombank_w); |
| 48 | | DECLARE_WRITE16_MEMBER(fuuki16_vram_0_w); |
| 49 | | DECLARE_WRITE16_MEMBER(fuuki16_vram_1_w); |
| 50 | | DECLARE_WRITE16_MEMBER(fuuki16_vram_2_w); |
| 51 | | DECLARE_WRITE16_MEMBER(fuuki16_vram_3_w); |
| 52 | | DECLARE_WRITE8_MEMBER(fuuki16_oki_banking_w); |
| 52 | DECLARE_WRITE16_MEMBER(vregs_w); |
| 53 | DECLARE_WRITE16_MEMBER(sound_command_w); |
| 54 | DECLARE_WRITE8_MEMBER(sound_rombank_w); |
| 55 | DECLARE_WRITE16_MEMBER(vram_0_w); |
| 56 | DECLARE_WRITE16_MEMBER(vram_1_w); |
| 57 | DECLARE_WRITE16_MEMBER(vram_2_w); |
| 58 | DECLARE_WRITE16_MEMBER(vram_3_w); |
| 59 | DECLARE_WRITE8_MEMBER(oki_banking_w); |
| 60 | |
| 53 | 61 | TILE_GET_INFO_MEMBER(get_tile_info_0); |
| 54 | 62 | TILE_GET_INFO_MEMBER(get_tile_info_1); |
| 55 | 63 | TILE_GET_INFO_MEMBER(get_tile_info_2); |
| 56 | 64 | TILE_GET_INFO_MEMBER(get_tile_info_3); |
| 65 | |
| 57 | 66 | virtual void machine_start(); |
| 58 | 67 | virtual void machine_reset(); |
| 59 | 68 | virtual void video_start(); |
| 60 | | UINT32 screen_update_fuuki16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 69 | |
| 70 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | 71 | inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_); |
| 62 | | inline void fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_); |
| 63 | | void fuuki16_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ); |
| 64 | | required_device<okim6295_device> m_oki; |
| 65 | | required_device<gfxdecode_device> m_gfxdecode; |
| 66 | | required_device<screen_device> m_screen; |
| 67 | | required_device<palette_device> m_palette; |
| 68 | | required_device<fuukivid_device> m_fuukivid; |
| 72 | inline void vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_); |
| 73 | void draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ); |
| 74 | |
| 69 | 75 | protected: |
| 70 | 76 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 71 | 77 | }; |
trunk/src/mame/video/fuukifg2.c
| r243693 | r243694 | |
| 56 | 56 | TILE_GET_INFO_MEMBER(fuuki16_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); } |
| 57 | 57 | TILE_GET_INFO_MEMBER(fuuki16_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); } |
| 58 | 58 | |
| 59 | | inline void fuuki16_state::fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) |
| 59 | inline void fuuki16_state::vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) |
| 60 | 60 | { |
| 61 | 61 | COMBINE_DATA(&m_vram[_N_][offset]); |
| 62 | 62 | m_tilemap[_N_]->mark_tile_dirty(offset / 2); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | | WRITE16_MEMBER(fuuki16_state::fuuki16_vram_0_w){ fuuki16_vram_w(offset, data, mem_mask, 0); } |
| 66 | | WRITE16_MEMBER(fuuki16_state::fuuki16_vram_1_w){ fuuki16_vram_w(offset, data, mem_mask, 1); } |
| 67 | | WRITE16_MEMBER(fuuki16_state::fuuki16_vram_2_w){ fuuki16_vram_w(offset, data, mem_mask, 2); } |
| 68 | | WRITE16_MEMBER(fuuki16_state::fuuki16_vram_3_w){ fuuki16_vram_w(offset, data, mem_mask, 3); } |
| 65 | WRITE16_MEMBER(fuuki16_state::vram_0_w){ vram_w(offset, data, mem_mask, 0); } |
| 66 | WRITE16_MEMBER(fuuki16_state::vram_1_w){ vram_w(offset, data, mem_mask, 1); } |
| 67 | WRITE16_MEMBER(fuuki16_state::vram_2_w){ vram_w(offset, data, mem_mask, 2); } |
| 68 | WRITE16_MEMBER(fuuki16_state::vram_3_w){ vram_w(offset, data, mem_mask, 3); } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | /*************************************************************************** |
| r243693 | r243694 | |
| 112 | 112 | |
| 113 | 113 | Screen Drawing |
| 114 | 114 | |
| 115 | | Video Registers (fuuki16_vregs): |
| 115 | Video Registers (vregs): |
| 116 | 116 | |
| 117 | 117 | 00.w Layer 0 Scroll Y |
| 118 | 118 | 02.w Layer 0 Scroll X |
| r243693 | r243694 | |
| 127 | 127 | 1c.w Trigger a level 5 irq on this raster line |
| 128 | 128 | 1e.w ? $3390/$3393 (Flip Screen Off/On), $0040 is buffer for tilemap 2 or 3 |
| 129 | 129 | |
| 130 | | Priority Register (fuuki16_priority): |
| 130 | Priority Register (priority): |
| 131 | 131 | |
| 132 | 132 | fedc ba98 7654 3--- |
| 133 | 133 | ---- ---- ---- -210 Layer Order |
| 134 | 134 | |
| 135 | 135 | |
| 136 | | Unknown Registers (fuuki16_unknown): |
| 136 | Unknown Registers (unknown): |
| 137 | 137 | |
| 138 | 138 | 00.w ? $0200/$0201 (Flip Screen Off/On) |
| 139 | 139 | 02.w ? $f300/$0330 |
| r243693 | r243694 | |
| 141 | 141 | ***************************************************************************/ |
| 142 | 142 | |
| 143 | 143 | /* Wrapper to handle bg and bg2 ttogether */ |
| 144 | | void fuuki16_state::fuuki16_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ) |
| 144 | void fuuki16_state::draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ) |
| 145 | 145 | { |
| 146 | 146 | int buffer = (m_vregs[0x1e / 2] & 0x40); |
| 147 | 147 | |
| r243693 | r243694 | |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | | UINT32 fuuki16_state::screen_update_fuuki16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 160 | UINT32 fuuki16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 161 | 161 | { |
| 162 | 162 | UINT16 layer0_scrollx, layer0_scrolly; |
| 163 | 163 | UINT16 layer1_scrollx, layer1_scrolly; |
| r243693 | r243694 | |
| 208 | 208 | /* The backmost tilemap decides the background color(s) but sprites can |
| 209 | 209 | go below the opaque pixels of that tilemap. We thus need to mark the |
| 210 | 210 | transparent pixels of this layer with a different priority value */ |
| 211 | | // fuuki16_draw_layer(machine(), bitmap, cliprect, tm_back, TILEMAP_DRAW_OPAQUE, 0); |
| 211 | // draw_layer(screen, bitmap, cliprect, tm_back, TILEMAP_DRAW_OPAQUE, 0); |
| 212 | 212 | |
| 213 | 213 | /* Actually, bg colour is simply the last pen i.e. 0x1fff -pjp */ |
| 214 | 214 | bitmap.fill((0x800 * 4) - 1, cliprect); |
| 215 | 215 | screen.priority().fill(0, cliprect); |
| 216 | 216 | |
| 217 | | fuuki16_draw_layer(screen, bitmap, cliprect, tm_back, 0, 1); |
| 218 | | fuuki16_draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2); |
| 219 | | fuuki16_draw_layer(screen, bitmap, cliprect, tm_front, 0, 4); |
| 217 | draw_layer(screen, bitmap, cliprect, tm_back, 0, 1); |
| 218 | draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2); |
| 219 | draw_layer(screen, bitmap, cliprect, tm_front, 0, 4); |
| 220 | 220 | |
| 221 | 221 | m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), 0); |
| 222 | 222 | |