Previous 199869 Revisions Next

r35184 Saturday 21st February, 2015 at 15:39:33 UTC by Osso
fuukifg3.c: added save state support (nw)
[src/mame/drivers]fuukifg3.c
[src/mame/includes]fuukifg3.h
[src/mame/video]fuukifg3.c

trunk/src/mame/drivers/fuukifg3.c
r243695r243696
191191      m_shared_ram[(offset * 2) + 1] = data & 0xff;
192192}
193193
194WRITE32_MEMBER(fuuki32_state::fuuki32_vregs_w)
194WRITE32_MEMBER(fuuki32_state::vregs_w)
195195{
196196   if (m_vregs[offset] != data)
197197   {
r243695r243696
210210   AM_RANGE(0x400000, 0x40ffff) AM_RAM                                                                     // Work RAM
211211   AM_RANGE(0x410000, 0x41ffff) AM_RAM                                                                     // Work RAM (used by asurabus)
212212
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
217217   AM_RANGE(0x508000, 0x517fff) AM_RAM                                                                     // More tilemap, or linescroll? Seems to be empty all of the time
218218   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_DEVREADWRITE16("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w, 0xffffffff) // Sprites
219219   AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette",  palette_device, write) AM_SHARE("palette") // Palette
r243695r243696
223223   AM_RANGE(0x880000, 0x880003) AM_READ_PORT("880000")                                                     // Service + DIPS
224224   AM_RANGE(0x890000, 0x890003) AM_READ_PORT("890000")                                                     // More DIPS
225225
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
227227   AM_RANGE(0x8d0000, 0x8d0003) AM_RAM                                                                     // Flipscreen Related
228228   AM_RANGE(0x8e0000, 0x8e0003) AM_RAM AM_SHARE("priority")                            // Controls layer order
229229   AM_RANGE(0x903fe0, 0x903fff) AM_READWRITE(snd_020_r, snd_020_w)                                         // Shared with Z80
r243695r243696
237237
238238***************************************************************************/
239239
240WRITE8_MEMBER(fuuki32_state::fuuki32_sound_bw_w)
240WRITE8_MEMBER(fuuki32_state::sound_bw_w)
241241{
242242   membank("bank1")->set_entry(data);
243243}
r243695r243696
271271
272272static ADDRESS_MAP_START( fuuki32_sound_io_map, AS_IO, 8, fuuki32_state )
273273   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)
275275   AM_RANGE(0x30, 0x30) AM_WRITENOP // leftover/unused nmi handler related
276276   AM_RANGE(0x40, 0x45) AM_DEVREAD("ymf1", ymf278b_device, read) AM_WRITE(snd_ymf278b_w)
277277ADDRESS_MAP_END
r243695r243696
507507   {
508508   case TIMER_LEVEL_1_INTERRUPT:
509509      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));
511511      break;
512512   case TIMER_VBLANK_INTERRUPT:
513513      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());
515515      break;
516516   case TIMER_RASTER_INTERRUPT:
517517      m_maincpu->set_input_line(5, HOLD_LINE);    // Raster Line IRQ
r243695r243696
530530
531531   membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
532532
533   m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT);
534   m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT);
533535   m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT);
534536
535537   save_item(NAME(m_spr_buffered_tilebank));
r243695r243696
541543{
542544   const rectangle &visarea = m_screen->visible_area();
543545
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());
546548   m_raster_interrupt_timer->adjust(m_screen->time_until_pos(0, visarea.max_x + 1));
547549}
548550
r243695r243696
562564   MCFG_SCREEN_REFRESH_RATE(60)
563565   MCFG_SCREEN_SIZE(64 * 8, 32 * 8)
564566   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)
567569   MCFG_SCREEN_PALETTE("palette")
568570
569571   MCFG_GFXDECODE_ADD("gfxdecode", "palette", fuuki32)
r243695r243696
728730
729731***************************************************************************/
730732
731GAME( 1998, asurabld,   0, fuuki32, asurabld, driver_device, 0, ROT0, "Fuuki", "Asura Blade - Sword of Dynasty (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND)
733GAME( 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 )
732734
733GAME( 2000, asurabus,   0,        fuuki32, asurabus, driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND)
734GAME( 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
735GAME( 2000, asurabus,   0,        fuuki32, asurabus, driver_device, 0, ROT0, "Fuuki", "Asura Buster - Eternal Warriors (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
736GAME( 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
r243695r243696
2121
2222   fuuki32_state(const machine_config &mconfig, device_type type, const char *tag)
2323      : 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"),
2824      m_maincpu(*this, "maincpu"),
2925      m_gfxdecode(*this, "gfxdecode"),
3026      m_screen(*this, "screen"),
3127      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")
3333      { }
3434
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   
3542   /* memory pointers */
3643   required_shared_ptr_array<UINT32,4> m_vram;
3744   required_shared_ptr<UINT32> m_vregs;
3845   required_shared_ptr<UINT32> m_priority;
3946   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;
4249
4350   /* video-related */
4451   tilemap_t     *m_tilemap[4];
4552   UINT32      m_spr_buffered_tilebank[2];
4653
4754   /* misc */
55   emu_timer   *m_level_1_interrupt_timer;
56   emu_timer   *m_vblank_interrupt_timer;
4857   emu_timer   *m_raster_interrupt_timer;
4958   UINT8       m_shared_ram[16];
5059
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
5860   DECLARE_READ32_MEMBER(snd_020_r);
5961   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);
6264   DECLARE_READ8_MEMBER(snd_z80_r);
6365   DECLARE_WRITE8_MEMBER(snd_z80_w);
6466   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   
6972   TILE_GET_INFO_MEMBER(get_tile_info_0);
7073   TILE_GET_INFO_MEMBER(get_tile_info_1);
7174   TILE_GET_INFO_MEMBER(get_tile_info_2);
7275   TILE_GET_INFO_MEMBER(get_tile_info_3);
76   
7377   virtual void machine_start();
7478   virtual void machine_reset();
7579   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);
8183   inline void get_tile_info8bpp(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
8284   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_);
8486   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 );
8688
8789protected:
8890   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mame/video/fuukifg3.c
r243695r243696
6868TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_2){ get_tile_info4bpp(tileinfo, tile_index, 2); }
6969TILE_GET_INFO_MEMBER(fuuki32_state::get_tile_info_3){ get_tile_info4bpp(tileinfo, tile_index, 3); }
7070
71inline void fuuki32_state::fuuki32_vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_)
71inline void fuuki32_state::vram_w(offs_t offset, UINT32 data, UINT32 mem_mask, int _N_)
7272{
7373   COMBINE_DATA(&m_vram[_N_][offset]);
7474   m_tilemap[_N_]->mark_tile_dirty(offset);
7575}
7676
77WRITE32_MEMBER(fuuki32_state::fuuki32_vram_0_w){ fuuki32_vram_w(offset, data, mem_mask, 0); }
78WRITE32_MEMBER(fuuki32_state::fuuki32_vram_1_w){ fuuki32_vram_w(offset, data, mem_mask, 1); }
79WRITE32_MEMBER(fuuki32_state::fuuki32_vram_2_w){ fuuki32_vram_w(offset, data, mem_mask, 2); }
80WRITE32_MEMBER(fuuki32_state::fuuki32_vram_3_w){ fuuki32_vram_w(offset, data, mem_mask, 3); }
77WRITE32_MEMBER(fuuki32_state::vram_0_w){ vram_w(offset, data, mem_mask, 0); }
78WRITE32_MEMBER(fuuki32_state::vram_1_w){ vram_w(offset, data, mem_mask, 1); }
79WRITE32_MEMBER(fuuki32_state::vram_2_w){ vram_w(offset, data, mem_mask, 2); }
80WRITE32_MEMBER(fuuki32_state::vram_3_w){ vram_w(offset, data, mem_mask, 3); }
8181
8282
8383/***************************************************************************
r243695r243696
116116
117117                                Screen Drawing
118118
119    Video Registers (fuuki32_vregs):
119    Video Registers (vregs):
120120
121121        00.w        Layer 0 Scroll Y
122122        02.w        Layer 0 Scroll X
r243695r243696
131131        1c.w        Trigger a level 5 irq on this raster line
132132        1e.w        ? $3390/$3393 (Flip Screen Off/On), $0040 is buffer for tilemap 2 or 3
133133
134    Priority Register (fuuki32_priority):
134    Priority Register (priority):
135135
136136        fedc ba98 7654 3---
137137        ---- ---- ---- -210     Layer Order
r243695r243696
145145***************************************************************************/
146146
147147/* Wrapper to handle bg and bg2 ttogether */
148void fuuki32_state::fuuki32_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri )
148void fuuki32_state::draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri )
149149{
150150   int buffer = ((m_vregs[0x1e / 4] & 0x0000ffff) & 0x40);
151151
r243695r243696
161161   }
162162}
163163
164UINT32 fuuki32_state::screen_update_fuuki32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
164UINT32 fuuki32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
165165{
166166   UINT16 layer0_scrollx, layer0_scrolly;
167167   UINT16 layer1_scrollx, layer1_scrolly;
r243695r243696
213213   bitmap.fill((0x800 * 4) - 1, cliprect);
214214   screen.priority().fill(0, cliprect);
215215
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);
219219
220220   m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), m_spr_buffered_tilebank);
221221   return 0;
222222}
223223
224void fuuki32_state::screen_eof_fuuki32(screen_device &screen, bool state)
224void fuuki32_state::screen_eof(screen_device &screen, bool state)
225225{
226226   // rising edge
227227   if (state)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team