Previous 199869 Revisions Next

r35182 Saturday 21st February, 2015 at 15:10:02 UTC by Osso
fuukifg2: added save state support (nw)
[src/mame/drivers]fuukifg2.c
[src/mame/includes]fuukifg2.h
[src/mame/video]fuukifg2.c

trunk/src/mame/drivers/fuukifg2.c
r243693r243694
6060
6161***************************************************************************/
6262
63WRITE16_MEMBER(fuuki16_state::fuuki16_vregs_w)
63WRITE16_MEMBER(fuuki16_state::vregs_w)
6464{
6565   UINT16 old_data = m_vregs[offset];
6666   UINT16 new_data = COMBINE_DATA(&m_vregs[offset]);
r243693r243694
7272   }
7373}
7474
75WRITE16_MEMBER(fuuki16_state::fuuki16_sound_command_w)
75WRITE16_MEMBER(fuuki16_state::sound_command_w)
7676{
7777   if (ACCESSING_BITS_0_7)
7878   {
r243693r243694
8686static ADDRESS_MAP_START( fuuki16_map, AS_PROGRAM, 16, fuuki16_state )
8787   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                                     // ROM
8888   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")                  //
9393   AM_RANGE(0x600000, 0x601fff) AM_MIRROR(0x008000) AM_DEVREADWRITE("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w) AM_SHARE("spriteram")   // Sprites, mirrored?
9494   AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")    // Palette
9595   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("SYSTEM")
9696   AM_RANGE(0x810000, 0x810001) AM_READ_PORT("P1_P2")
9797   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
100100   AM_RANGE(0x8d0000, 0x8d0003) AM_RAM AM_SHARE("unknown")                                         //
101101   AM_RANGE(0x8e0000, 0x8e0001) AM_RAM AM_SHARE("priority")                                            //
102102ADDRESS_MAP_END
r243693r243694
110110
111111***************************************************************************/
112112
113WRITE8_MEMBER(fuuki16_state::fuuki16_sound_rombank_w)
113WRITE8_MEMBER(fuuki16_state::sound_rombank_w)
114114{
115115   if (data <= 2)
116116      membank("bank1")->set_entry(data);
r243693r243694
118118      logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", space.device().safe_pc(), data);
119119}
120120
121WRITE8_MEMBER(fuuki16_state::fuuki16_oki_banking_w)
121WRITE8_MEMBER(fuuki16_state::oki_banking_w)
122122{
123123   /*
124124       data & 0x06 is always equals to data & 0x60
r243693r243694
136136
137137static ADDRESS_MAP_START( fuuki16_sound_io_map, AS_IO, 8, fuuki16_state )
138138   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
140140   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
142142   AM_RANGE(0x30, 0x30) AM_WRITENOP    // ? In the NMI routine
143143   AM_RANGE(0x40, 0x41) AM_DEVWRITE("ym1", ym2203_device, write)
144144   AM_RANGE(0x50, 0x51) AM_DEVREADWRITE("ym2", ym3812_device, read, write)
r243693r243694
399399   {
400400   case TIMER_LEVEL_1_INTERRUPT:
401401      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));
403403      break;
404404   case TIMER_VBLANK_INTERRUPT:
405405      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());
407407      break;
408408   case TIMER_RASTER_INTERRUPT:
409409      m_maincpu->set_input_line(5, HOLD_LINE);    // Raster Line IRQ
r243693r243694
422422
423423   membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x8000);
424424
425   m_level_1_interrupt_timer = timer_alloc(TIMER_LEVEL_1_INTERRUPT);
426   m_vblank_interrupt_timer = timer_alloc(TIMER_VBLANK_INTERRUPT);
425427   m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT);
426428}
427429
r243693r243694
430432{
431433   const rectangle &visarea = m_screen->visible_area();
432434
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());
435437   m_raster_interrupt_timer->adjust(m_screen->time_until_pos(0, visarea.max_x + 1));
436438}
437439
r243693r243694
452454   MCFG_SCREEN_REFRESH_RATE(60)
453455   MCFG_SCREEN_SIZE(320, 256)
454456   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)
456458   MCFG_SCREEN_PALETTE("palette")
457459
458460   MCFG_GFXDECODE_ADD("gfxdecode", "palette", fuuki16)
r243693r243694
661663
662664***************************************************************************/
663665
664GAME( 1995, gogomile,  0,        fuuki16, gogomile,  driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (newer)", 0 )
665GAME( 1995, gogomileo, gogomile, fuuki16, gogomileo, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (older)", 0 )
666GAME( 1996, pbancho,   0,        fuuki16, pbancho,   driver_device, 0, ROT0, "Fuuki", "Gyakuten!! Puzzle Bancho (Japan)", 0)
666GAME( 1995, gogomile,  0,        fuuki16, gogomile,  driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (newer)", GAME_SUPPORTS_SAVE )
667GAME( 1995, gogomileo, gogomile, fuuki16, gogomileo, driver_device, 0, ROT0, "Fuuki", "Susume! Mile Smile / Go Go! Mile Smile (older)", GAME_SUPPORTS_SAVE )
668GAME( 1996, pbancho,   0,        fuuki16, pbancho,   driver_device, 0, ROT0, "Fuuki", "Gyakuten!! Puzzle Bancho (Japan)", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/fuukifg2.h
r243693r243694
1313
1414   fuuki16_state(const machine_config &mconfig, device_type type, const char *tag)
1515      : 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"),
2016      m_maincpu(*this, "maincpu"),
2117      m_audiocpu(*this, "audiocpu"),
2218      m_oki(*this, "oki"),
2319      m_gfxdecode(*this, "gfxdecode"),
2420      m_screen(*this, "screen"),
2521      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")
2727      { }
2828
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   
2938   /* memory pointers */
3039   required_shared_ptr_array<UINT16,4> m_vram;
3140   required_shared_ptr<UINT16> m_vregs;
3241   required_shared_ptr<UINT16> m_unknown;
3342   required_shared_ptr<UINT16> m_priority;
34//  UINT16 *    m_paletteram; // currently this uses generic palette handling
3543
3644   /* video-related */
3745   tilemap_t     *m_tilemap[4];
3846
3947   /* misc */
48   emu_timer   *m_level_1_interrupt_timer;
49   emu_timer   *m_vblank_interrupt_timer;
4050   emu_timer   *m_raster_interrupt_timer;
4151
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   
5361   TILE_GET_INFO_MEMBER(get_tile_info_0);
5462   TILE_GET_INFO_MEMBER(get_tile_info_1);
5563   TILE_GET_INFO_MEMBER(get_tile_info_2);
5664   TILE_GET_INFO_MEMBER(get_tile_info_3);
65   
5766   virtual void machine_start();
5867   virtual void machine_reset();
5968   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);
6171   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
6975protected:
7076   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
7177};
trunk/src/mame/video/fuukifg2.c
r243693r243694
5656TILE_GET_INFO_MEMBER(fuuki16_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); }
5757TILE_GET_INFO_MEMBER(fuuki16_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); }
5858
59inline void fuuki16_state::fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_)
59inline void fuuki16_state::vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_)
6060{
6161   COMBINE_DATA(&m_vram[_N_][offset]);
6262   m_tilemap[_N_]->mark_tile_dirty(offset / 2);
6363}
6464
65WRITE16_MEMBER(fuuki16_state::fuuki16_vram_0_w){ fuuki16_vram_w(offset, data, mem_mask, 0); }
66WRITE16_MEMBER(fuuki16_state::fuuki16_vram_1_w){ fuuki16_vram_w(offset, data, mem_mask, 1); }
67WRITE16_MEMBER(fuuki16_state::fuuki16_vram_2_w){ fuuki16_vram_w(offset, data, mem_mask, 2); }
68WRITE16_MEMBER(fuuki16_state::fuuki16_vram_3_w){ fuuki16_vram_w(offset, data, mem_mask, 3); }
65WRITE16_MEMBER(fuuki16_state::vram_0_w){ vram_w(offset, data, mem_mask, 0); }
66WRITE16_MEMBER(fuuki16_state::vram_1_w){ vram_w(offset, data, mem_mask, 1); }
67WRITE16_MEMBER(fuuki16_state::vram_2_w){ vram_w(offset, data, mem_mask, 2); }
68WRITE16_MEMBER(fuuki16_state::vram_3_w){ vram_w(offset, data, mem_mask, 3); }
6969
7070
7171/***************************************************************************
r243693r243694
112112
113113                                Screen Drawing
114114
115    Video Registers (fuuki16_vregs):
115    Video Registers (vregs):
116116
117117        00.w        Layer 0 Scroll Y
118118        02.w        Layer 0 Scroll X
r243693r243694
127127        1c.w        Trigger a level 5 irq on this raster line
128128        1e.w        ? $3390/$3393 (Flip Screen Off/On), $0040 is buffer for tilemap 2 or 3
129129
130    Priority Register (fuuki16_priority):
130    Priority Register (priority):
131131
132132        fedc ba98 7654 3---
133133        ---- ---- ---- -210     Layer Order
134134
135135
136    Unknown Registers (fuuki16_unknown):
136    Unknown Registers (unknown):
137137
138138        00.w        ? $0200/$0201   (Flip Screen Off/On)
139139        02.w        ? $f300/$0330
r243693r243694
141141***************************************************************************/
142142
143143/* Wrapper to handle bg and bg2 ttogether */
144void fuuki16_state::fuuki16_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri )
144void fuuki16_state::draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri )
145145{
146146   int buffer = (m_vregs[0x1e / 2] & 0x40);
147147
r243693r243694
157157   }
158158}
159159
160UINT32 fuuki16_state::screen_update_fuuki16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
160UINT32 fuuki16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
161161{
162162   UINT16 layer0_scrollx, layer0_scrolly;
163163   UINT16 layer1_scrollx, layer1_scrolly;
r243693r243694
208208   /* The backmost tilemap decides the background color(s) but sprites can
209209      go below the opaque pixels of that tilemap. We thus need to mark the
210210      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);
212212
213213   /* Actually, bg colour is simply the last pen i.e. 0x1fff -pjp */
214214   bitmap.fill((0x800 * 4) - 1, cliprect);
215215   screen.priority().fill(0, cliprect);
216216
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);
220220
221221   m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), 0);
222222


Previous 199869 Revisions Next


© 1997-2024 The MAME Team