trunk/src/mame/drivers/fuukifg3.c
| r243695 | r243696 | |
| 191 | 191 | m_shared_ram[(offset * 2) + 1] = data & 0xff; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | | WRITE32_MEMBER(fuuki32_state::fuuki32_vregs_w) |
| 194 | WRITE32_MEMBER(fuuki32_state::vregs_w) |
| 195 | 195 | { |
| 196 | 196 | if (m_vregs[offset] != data) |
| 197 | 197 | { |
| r243695 | r243696 | |
| 210 | 210 | AM_RANGE(0x400000, 0x40ffff) AM_RAM // Work RAM |
| 211 | 211 | AM_RANGE(0x410000, 0x41ffff) AM_RAM // Work RAM (used by asurabus) |
| 212 | 212 | |
| 213 | | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(fuuki32_vram_0_w) AM_SHARE("vram.0") // Tilemap 1 |
| 214 | | AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(fuuki32_vram_1_w) AM_SHARE("vram.1") // Tilemap 2 |
| 215 | | AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(fuuki32_vram_2_w) AM_SHARE("vram.2") // Tilemap bg |
| 216 | | AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(fuuki32_vram_3_w) AM_SHARE("vram.3") // Tilemap bg2 |
| 213 | AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(vram_0_w) AM_SHARE("vram.0") // Tilemap 1 |
| 214 | AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(vram_1_w) AM_SHARE("vram.1") // Tilemap 2 |
| 215 | AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(vram_2_w) AM_SHARE("vram.2") // Tilemap bg |
| 216 | AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(vram_3_w) AM_SHARE("vram.3") // Tilemap bg2 |
| 217 | 217 | AM_RANGE(0x508000, 0x517fff) AM_RAM // More tilemap, or linescroll? Seems to be empty all of the time |
| 218 | 218 | AM_RANGE(0x600000, 0x601fff) AM_RAM AM_DEVREADWRITE16("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w, 0xffffffff) // Sprites |
| 219 | 219 | AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // Palette |
| r243695 | r243696 | |
| 223 | 223 | AM_RANGE(0x880000, 0x880003) AM_READ_PORT("880000") // Service + DIPS |
| 224 | 224 | AM_RANGE(0x890000, 0x890003) AM_READ_PORT("890000") // More DIPS |
| 225 | 225 | |
| 226 | | AM_RANGE(0x8c0000, 0x8c001f) AM_RAM_WRITE(fuuki32_vregs_w) AM_SHARE("vregs") // Video Registers |
| 226 | AM_RANGE(0x8c0000, 0x8c001f) AM_RAM_WRITE(vregs_w) AM_SHARE("vregs") // Video Registers |
| 227 | 227 | AM_RANGE(0x8d0000, 0x8d0003) AM_RAM // Flipscreen Related |
| 228 | 228 | AM_RANGE(0x8e0000, 0x8e0003) AM_RAM AM_SHARE("priority") // Controls layer order |
| 229 | 229 | AM_RANGE(0x903fe0, 0x903fff) AM_READWRITE(snd_020_r, snd_020_w) // Shared with Z80 |
| r243695 | r243696 | |
| 237 | 237 | |
| 238 | 238 | ***************************************************************************/ |
| 239 | 239 | |
| 240 | | WRITE8_MEMBER(fuuki32_state::fuuki32_sound_bw_w) |
| 240 | WRITE8_MEMBER(fuuki32_state::sound_bw_w) |
| 241 | 241 | { |
| 242 | 242 | membank("bank1")->set_entry(data); |
| 243 | 243 | } |
| r243695 | r243696 | |
| 271 | 271 | |
| 272 | 272 | static ADDRESS_MAP_START( fuuki32_sound_io_map, AS_IO, 8, fuuki32_state ) |
| 273 | 273 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 274 | | AM_RANGE(0x00, 0x00) AM_WRITE(fuuki32_sound_bw_w) |
| 274 | AM_RANGE(0x00, 0x00) AM_WRITE(sound_bw_w) |
| 275 | 275 | AM_RANGE(0x30, 0x30) AM_WRITENOP // leftover/unused nmi handler related |
| 276 | 276 | AM_RANGE(0x40, 0x45) AM_DEVREAD("ymf1", ymf278b_device, read) AM_WRITE(snd_ymf278b_w) |
| 277 | 277 | ADDRESS_MAP_END |
| r243695 | r243696 | |
| 507 | 507 | { |
| 508 | 508 | case TIMER_LEVEL_1_INTERRUPT: |
| 509 | 509 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 510 | | timer_set(m_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT); |
| 510 | m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248)); |
| 511 | 511 | break; |
| 512 | 512 | case TIMER_VBLANK_INTERRUPT: |
| 513 | 513 | m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ |
| 514 | | timer_set(m_screen->time_until_vblank_start(), TIMER_VBLANK_INTERRUPT); |
| 514 | m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start()); |
| 515 | 515 | break; |
| 516 | 516 | case TIMER_RASTER_INTERRUPT: |
| 517 | 517 | m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ |
| r243695 | r243696 | |
| 530 | 530 | |
| 531 | 531 | membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000); |
| 532 | 532 | |
| 533 | m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT); |
| 534 | m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT); |
| 533 | 535 | m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT); |
| 534 | 536 | |
| 535 | 537 | save_item(NAME(m_spr_buffered_tilebank)); |
| r243695 | r243696 | |
| 541 | 543 | { |
| 542 | 544 | const rectangle &visarea = m_screen->visible_area(); |
| 543 | 545 | |
| 544 | | timer_set(m_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT); |
| 545 | | timer_set(m_screen->time_until_vblank_start(), TIMER_VBLANK_INTERRUPT); |
| 546 | m_level_1_interrupt_timer->adjust(m_screen->time_until_pos(248)); |
| 547 | m_vblank_interrupt_timer->adjust(m_screen->time_until_vblank_start()); |
| 546 | 548 | m_raster_interrupt_timer->adjust(m_screen->time_until_pos(0, visarea.max_x + 1)); |
| 547 | 549 | } |
| 548 | 550 | |
| r243695 | r243696 | |
| 562 | 564 | MCFG_SCREEN_REFRESH_RATE(60) |
| 563 | 565 | MCFG_SCREEN_SIZE(64 * 8, 32 * 8) |
| 564 | 566 | MCFG_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0, 30 * 8 - 1) |
| 565 | | MCFG_SCREEN_UPDATE_DRIVER(fuuki32_state, screen_update_fuuki32) |
| 566 | | MCFG_SCREEN_VBLANK_DRIVER(fuuki32_state, screen_eof_fuuki32) |
| 567 | MCFG_SCREEN_UPDATE_DRIVER(fuuki32_state, screen_update) |
| 568 | MCFG_SCREEN_VBLANK_DRIVER(fuuki32_state, screen_eof) |
| 567 | 569 | MCFG_SCREEN_PALETTE("palette") |
| 568 | 570 | |
| 569 | 571 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", fuuki32) |
| r243695 | r243696 | |
| 728 | 730 | |
| 729 | 731 | ***************************************************************************/ |
| 730 | 732 | |
| 731 | | GAME( 1998, asurabld, 0, fuuki32, asurabld, driver_device, 0, ROT0, "Fuuki", "Asura Blade - Sword of Dynasty (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND) |
| 733 | GAME( 1998, asurabld, 0, fuuki32, asurabld, driver_device, 0, ROT0, "Fuuki", "Asura Blade - Sword of Dynasty (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 732 | 734 | |
| 733 | | GAME( 2000, asurabus, 0, fuuki32, asurabus, driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND) |
| 734 | | GAME( 2000, asurabusa, asurabus, fuuki32, asurabusa,driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan) (ARCADIA review build)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND) // has pause function on P1 button 4 |
| 735 | GAME( 2000, asurabus, 0, fuuki32, asurabus, driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 736 | GAME( 2000, asurabusa, asurabus, fuuki32, asurabusa,driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan) (ARCADIA review build)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // has pause function on P1 button 4 |
trunk/src/mame/includes/fuukifg3.h
| r243695 | r243696 | |
| 21 | 21 | |
| 22 | 22 | fuuki32_state(const machine_config &mconfig, device_type type, const char *tag) |
| 23 | 23 | : driver_device(mconfig, type, tag), |
| 24 | | m_vram(*this, "vram"), |
| 25 | | m_vregs(*this, "vregs"), |
| 26 | | m_priority(*this, "priority"), |
| 27 | | m_tilebank(*this, "tilebank"), |
| 28 | 24 | m_maincpu(*this, "maincpu"), |
| 29 | 25 | m_gfxdecode(*this, "gfxdecode"), |
| 30 | 26 | m_screen(*this, "screen"), |
| 31 | 27 | m_palette(*this, "palette"), |
| 32 | | m_fuukivid(*this, "fuukivid") |
| 28 | m_fuukivid(*this, "fuukivid"), |
| 29 | m_vram(*this, "vram"), |
| 30 | m_vregs(*this, "vregs"), |
| 31 | m_priority(*this, "priority"), |
| 32 | m_tilebank(*this, "tilebank") |
| 33 | 33 | { } |
| 34 | 34 | |
| 35 | /* devices */ |
| 36 | required_device<cpu_device> m_maincpu; |
| 37 | required_device<gfxdecode_device> m_gfxdecode; |
| 38 | required_device<screen_device> m_screen; |
| 39 | required_device<palette_device> m_palette; |
| 40 | required_device<fuukivid_device> m_fuukivid; |
| 41 | |
| 35 | 42 | /* memory pointers */ |
| 36 | 43 | required_shared_ptr_array<UINT32,4> m_vram; |
| 37 | 44 | required_shared_ptr<UINT32> m_vregs; |
| 38 | 45 | required_shared_ptr<UINT32> m_priority; |
| 39 | 46 | required_shared_ptr<UINT32> m_tilebank; |
| 40 | | UINT32 * m_buf_spriteram; |
| 41 | | UINT32 * m_buf_spriteram2; |
| 47 | //UINT32 * m_buf_spriteram; |
| 48 | //UINT32 * m_buf_spriteram2; |
| 42 | 49 | |
| 43 | 50 | /* video-related */ |
| 44 | 51 | tilemap_t *m_tilemap[4]; |
| 45 | 52 | UINT32 m_spr_buffered_tilebank[2]; |
| 46 | 53 | |
| 47 | 54 | /* misc */ |
| 55 | emu_timer *m_level_1_interrupt_timer; |
| 56 | emu_timer *m_vblank_interrupt_timer; |
| 48 | 57 | emu_timer *m_raster_interrupt_timer; |
| 49 | 58 | UINT8 m_shared_ram[16]; |
| 50 | 59 | |
| 51 | | /* devices */ |
| 52 | | required_device<cpu_device> m_maincpu; |
| 53 | | required_device<gfxdecode_device> m_gfxdecode; |
| 54 | | required_device<screen_device> m_screen; |
| 55 | | required_device<palette_device> m_palette; |
| 56 | | required_device<fuukivid_device> m_fuukivid; |
| 57 | | |
| 58 | 60 | DECLARE_READ32_MEMBER(snd_020_r); |
| 59 | 61 | DECLARE_WRITE32_MEMBER(snd_020_w); |
| 60 | | DECLARE_WRITE32_MEMBER(fuuki32_vregs_w); |
| 61 | | DECLARE_WRITE8_MEMBER(fuuki32_sound_bw_w); |
| 62 | DECLARE_WRITE32_MEMBER(vregs_w); |
| 63 | DECLARE_WRITE8_MEMBER(sound_bw_w); |
| 62 | 64 | DECLARE_READ8_MEMBER(snd_z80_r); |
| 63 | 65 | DECLARE_WRITE8_MEMBER(snd_z80_w); |
| 64 | 66 | DECLARE_WRITE8_MEMBER(snd_ymf278b_w); |
| 65 | | DECLARE_WRITE32_MEMBER(fuuki32_vram_0_w); |
| 66 | | DECLARE_WRITE32_MEMBER(fuuki32_vram_1_w); |
| 67 | | DECLARE_WRITE32_MEMBER(fuuki32_vram_2_w); |
| 68 | | DECLARE_WRITE32_MEMBER(fuuki32_vram_3_w); |
| 67 | DECLARE_WRITE32_MEMBER(vram_0_w); |
| 68 | DECLARE_WRITE32_MEMBER(vram_1_w); |
| 69 | DECLARE_WRITE32_MEMBER(vram_2_w); |
| 70 | DECLARE_WRITE32_MEMBER(vram_3_w); |
| 71 | |
| 69 | 72 | TILE_GET_INFO_MEMBER(get_tile_info_0); |
| 70 | 73 | TILE_GET_INFO_MEMBER(get_tile_info_1); |
| 71 | 74 | TILE_GET_INFO_MEMBER(get_tile_info_2); |
| 72 | 75 | TILE_GET_INFO_MEMBER(get_tile_info_3); |
| 76 | |
| 73 | 77 | virtual void machine_start(); |
| 74 | 78 | virtual void machine_reset(); |
| 75 | 79 | virtual void video_start(); |
| 76 | | UINT32 screen_update_fuuki32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 77 | | void screen_eof_fuuki32(screen_device &screen, bool state); |
| 78 | | TIMER_CALLBACK_MEMBER(level_1_interrupt_callback); |
| 79 | | TIMER_CALLBACK_MEMBER(vblank_interrupt_callback); |
| 80 | | TIMER_CALLBACK_MEMBER(raster_interrupt_callback); |
| 80 | |
| 81 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 82 | void screen_eof(screen_device &screen, bool state); |
| 81 | 83 | inline void get_tile_info8bpp(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_); |
| 82 | 84 | inline void get_tile_info4bpp(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_); |
| 83 | | inline void fuuki32_vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_); |
| 85 | inline void vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_); |
| 84 | 86 | void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 85 | | void fuuki32_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ); |
| 87 | void draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ); |
| 86 | 88 | |
| 87 | 89 | protected: |
| 88 | 90 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
trunk/src/mame/video/fuukifg3.c
| r243695 | r243696 | |
| 68 | 68 | TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_2){ get_tile_info4bpp(tileinfo, tile_index, 2); } |
| 69 | 69 | TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_3){ get_tile_info4bpp(tileinfo, tile_index, 3); } |
| 70 | 70 | |
| 71 | | inline void fuuki32_state::fuuki32_vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_) |
| 71 | inline void fuuki32_state::vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_) |
| 72 | 72 | { |
| 73 | 73 | COMBINE_DATA(&m_vram[_N_][offset]); |
| 74 | 74 | m_tilemap[_N_]->mark_tile_dirty(offset); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | | WRITE32_MEMBER(fuuki32_state::fuuki32_vram_0_w){ fuuki32_vram_w(offset, data, mem_mask, 0); } |
| 78 | | WRITE32_MEMBER(fuuki32_state::fuuki32_vram_1_w){ fuuki32_vram_w(offset, data, mem_mask, 1); } |
| 79 | | WRITE32_MEMBER(fuuki32_state::fuuki32_vram_2_w){ fuuki32_vram_w(offset, data, mem_mask, 2); } |
| 80 | | WRITE32_MEMBER(fuuki32_state::fuuki32_vram_3_w){ fuuki32_vram_w(offset, data, mem_mask, 3); } |
| 77 | WRITE32_MEMBER(fuuki32_state::vram_0_w){ vram_w(offset, data, mem_mask, 0); } |
| 78 | WRITE32_MEMBER(fuuki32_state::vram_1_w){ vram_w(offset, data, mem_mask, 1); } |
| 79 | WRITE32_MEMBER(fuuki32_state::vram_2_w){ vram_w(offset, data, mem_mask, 2); } |
| 80 | WRITE32_MEMBER(fuuki32_state::vram_3_w){ vram_w(offset, data, mem_mask, 3); } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | /*************************************************************************** |
| r243695 | r243696 | |
| 116 | 116 | |
| 117 | 117 | Screen Drawing |
| 118 | 118 | |
| 119 | | Video Registers (fuuki32_vregs): |
| 119 | Video Registers (vregs): |
| 120 | 120 | |
| 121 | 121 | 00.w Layer 0 Scroll Y |
| 122 | 122 | 02.w Layer 0 Scroll X |
| r243695 | r243696 | |
| 131 | 131 | 1c.w Trigger a level 5 irq on this raster line |
| 132 | 132 | 1e.w ? $3390/$3393 (Flip Screen Off/On), $0040 is buffer for tilemap 2 or 3 |
| 133 | 133 | |
| 134 | | Priority Register (fuuki32_priority): |
| 134 | Priority Register (priority): |
| 135 | 135 | |
| 136 | 136 | fedc ba98 7654 3--- |
| 137 | 137 | ---- ---- ---- -210 Layer Order |
| r243695 | r243696 | |
| 145 | 145 | ***************************************************************************/ |
| 146 | 146 | |
| 147 | 147 | /* Wrapper to handle bg and bg2 ttogether */ |
| 148 | | void fuuki32_state::fuuki32_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ) |
| 148 | void fuuki32_state::draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri ) |
| 149 | 149 | { |
| 150 | 150 | int buffer = ((m_vregs[0x1e / 4] & 0x0000ffff) & 0x40); |
| 151 | 151 | |
| r243695 | r243696 | |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | | UINT32 fuuki32_state::screen_update_fuuki32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 164 | UINT32 fuuki32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 165 | 165 | { |
| 166 | 166 | UINT16 layer0_scrollx, layer0_scrolly; |
| 167 | 167 | UINT16 layer1_scrollx, layer1_scrolly; |
| r243695 | r243696 | |
| 213 | 213 | bitmap.fill((0x800 * 4) - 1, cliprect); |
| 214 | 214 | screen.priority().fill(0, cliprect); |
| 215 | 215 | |
| 216 | | fuuki32_draw_layer(screen, bitmap, cliprect, tm_back, 0, 1); |
| 217 | | fuuki32_draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2); |
| 218 | | fuuki32_draw_layer(screen, bitmap, cliprect, tm_front, 0, 4); |
| 216 | draw_layer(screen, bitmap, cliprect, tm_back, 0, 1); |
| 217 | draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2); |
| 218 | draw_layer(screen, bitmap, cliprect, tm_front, 0, 4); |
| 219 | 219 | |
| 220 | 220 | m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), m_spr_buffered_tilebank); |
| 221 | 221 | return 0; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | | void fuuki32_state::screen_eof_fuuki32(screen_device &screen, bool state) |
| 224 | void fuuki32_state::screen_eof(screen_device &screen, bool state) |
| 225 | 225 | { |
| 226 | 226 | // rising edge |
| 227 | 227 | if (state) |