Previous 199869 Revisions Next

r35096 Tuesday 17th February, 2015 at 19:57:53 UTC by Osso
sidepckt.c: added save state support (nw)
[src/mame/drivers]sidepckt.c
[src/mame/includes]sidepckt.h
[src/mame/video]sidepckt.c

trunk/src/mame/drivers/sidepckt.c
r243607r243608
146146   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
147147}
148148
149READ8_MEMBER(sidepckt_state::sidepckt_i8751_r)
149READ8_MEMBER(sidepckt_state::i8751_r)
150150{
151151   return m_i8751_return;
152152}
153153
154WRITE8_MEMBER(sidepckt_state::sidepckt_i8751_w)
154WRITE8_MEMBER(sidepckt_state::i8751_w)
155155{
156156   m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
157157
r243607r243608
193193
194194static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state )
195195   AM_RANGE(0x0000, 0x0fff) AM_RAM
196   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sidepckt_videoram_w) AM_SHARE("videoram")
196   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
197197   AM_RANGE(0x1400, 0x17ff) AM_RAM // ???
198   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(sidepckt_colorram_w) AM_SHARE("colorram")
198   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
199199   AM_RANGE(0x1c00, 0x1fff) AM_RAM // ???
200200   AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("spriteram")
201201   AM_RANGE(0x2100, 0x24ff) AM_RAM // ???
r243607r243608
204204   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1")
205205   AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2")
206206   AM_RANGE(0x3004, 0x3004) AM_WRITE(sound_cpu_command_w)
207   AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE(sidepckt_flipscreen_w)
208   AM_RANGE(0x3014, 0x3014) AM_READ(sidepckt_i8751_r)
209   AM_RANGE(0x3018, 0x3018) AM_WRITE(sidepckt_i8751_w)
207   AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE(flipscreen_w)
208   AM_RANGE(0x3014, 0x3014) AM_READ(i8751_r)
209   AM_RANGE(0x3018, 0x3018) AM_WRITE(i8751_w)
210210   AM_RANGE(0x4000, 0xffff) AM_ROM
211211ADDRESS_MAP_END
212212
r243607r243608
377377   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */ )
378378   MCFG_SCREEN_SIZE(32*8, 32*8)
379379   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
380   MCFG_SCREEN_UPDATE_DRIVER(sidepckt_state, screen_update_sidepckt)
380   MCFG_SCREEN_UPDATE_DRIVER(sidepckt_state, screen_update)
381381   MCFG_SCREEN_PALETTE("palette")
382382
383383   MCFG_GFXDECODE_ADD("gfxdecode", "palette", sidepckt)
r243607r243608
488488   m_prot_table[0] = sidepckt_prot_table_1;
489489   m_prot_table[1] = sidepckt_prot_table_2;
490490   m_prot_table[2] = sidepckt_prot_table_3;
491   
492   save_item(NAME(m_i8751_return));
493   save_item(NAME(m_current_ptr));
494   save_item(NAME(m_current_table));
495   save_item(NAME(m_in_math));
496   save_item(NAME(m_math_param));
491497}
492498
493499DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj)
r243607r243608
495501   m_prot_table[0] = sidepcktj_prot_table_1;
496502   m_prot_table[1] = sidepcktj_prot_table_2;
497503   m_prot_table[2] = sidepcktj_prot_table_3;
504   
505   save_item(NAME(m_i8751_return));
506   save_item(NAME(m_current_ptr));
507   save_item(NAME(m_current_table));
508   save_item(NAME(m_in_math));
509   save_item(NAME(m_math_param));
498510}
499511
500512
501GAME( 1986, sidepckt,  0,        sidepckt,  sidepckt,  sidepckt_state, sidepckt,  ROT0, "Data East Corporation", "Side Pocket (World)", GAME_NO_COCKTAIL )
502GAME( 1986, sidepcktj, sidepckt, sidepckt,  sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", GAME_NO_COCKTAIL )
503GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device,  0,         ROT0, "bootleg", "Side Pocket (bootleg)", GAME_NO_COCKTAIL )
513GAME( 1986, sidepckt,  0,        sidepckt,  sidepckt,  sidepckt_state, sidepckt,  ROT0, "Data East Corporation", "Side Pocket (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
514GAME( 1986, sidepcktj, sidepckt, sidepckt,  sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
515GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device,  0,         ROT0, "bootleg", "Side Pocket (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/sidepckt.h
r243607r243608
1111      : driver_device(mconfig, type, tag),
1212      m_maincpu(*this, "maincpu"),
1313      m_audiocpu(*this, "audiocpu"),
14      m_gfxdecode(*this, "gfxdecode"),
15      m_palette(*this, "palette"),
1416      m_videoram(*this, "videoram"),
1517      m_colorram(*this, "colorram"),
16      m_spriteram(*this, "spriteram"),
17      m_gfxdecode(*this, "gfxdecode"),
18      m_palette(*this, "palette")
18      m_spriteram(*this, "spriteram")
1919   { }
2020
21   tilemap_t *m_bg_tilemap;
2221   required_device<cpu_device> m_maincpu;
2322   required_device<cpu_device> m_audiocpu;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<palette_device> m_palette;
25
2426   required_shared_ptr<UINT8> m_videoram;
2527   required_shared_ptr<UINT8> m_colorram;
2628   required_shared_ptr<UINT8> m_spriteram;
27   required_device<gfxdecode_device> m_gfxdecode;
28   required_device<palette_device> m_palette;
29
29   
30   tilemap_t *m_bg_tilemap;
3031   const UINT8* m_prot_table[3];
3132   UINT8 m_i8751_return;
3233   UINT8 m_current_ptr;
r243607r243608
3536   UINT8 m_math_param;
3637
3738   DECLARE_WRITE8_MEMBER(sound_cpu_command_w);
38   DECLARE_READ8_MEMBER(sidepckt_i8751_r);
39   DECLARE_WRITE8_MEMBER(sidepckt_i8751_w);
40   DECLARE_WRITE8_MEMBER(sidepctj_i8751_w);
41   DECLARE_WRITE8_MEMBER(sidepckt_videoram_w);
42   DECLARE_WRITE8_MEMBER(sidepckt_colorram_w);
43   DECLARE_WRITE8_MEMBER(sidepckt_flipscreen_w);
39   DECLARE_READ8_MEMBER(i8751_r);
40   DECLARE_WRITE8_MEMBER(i8751_w);
41   DECLARE_WRITE8_MEMBER(videoram_w);
42   DECLARE_WRITE8_MEMBER(colorram_w);
43   DECLARE_WRITE8_MEMBER(flipscreen_w);
44   
4445   DECLARE_DRIVER_INIT(sidepckt);
4546   DECLARE_DRIVER_INIT(sidepcktj);
47   
4648   TILE_GET_INFO_MEMBER(get_tile_info);
49   
4750   virtual void machine_reset();
4851   virtual void video_start();
4952   DECLARE_PALETTE_INIT(sidepckt);
50   UINT32 screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
53   
54   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5155   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
5256};
trunk/src/mame/video/sidepckt.c
r243607r243608
8686
8787***************************************************************************/
8888
89WRITE8_MEMBER(sidepckt_state::sidepckt_videoram_w)
89WRITE8_MEMBER(sidepckt_state::videoram_w)
9090{
9191   m_videoram[offset] = data;
9292   m_bg_tilemap->mark_tile_dirty(offset);
9393}
9494
95WRITE8_MEMBER(sidepckt_state::sidepckt_colorram_w)
95WRITE8_MEMBER(sidepckt_state::colorram_w)
9696{
9797   m_colorram[offset] = data;
9898   m_bg_tilemap->mark_tile_dirty(offset);
9999}
100100
101WRITE8_MEMBER(sidepckt_state::sidepckt_flipscreen_w)
101WRITE8_MEMBER(sidepckt_state::flipscreen_w)
102102{
103103   int flipscreen = data;
104104   machine().tilemap().set_flip_all(flipscreen ? TILEMAP_FLIPY : TILEMAP_FLIPX);
r243607r243608
113113
114114void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
115115{
116   UINT8 *spriteram = m_spriteram;
117   int offs;
118
119   for (offs = 0;offs < m_spriteram.bytes(); offs += 4)
116   for (int offs = 0;offs < m_spriteram.bytes(); offs += 4)
120117   {
121118      int sx,sy,code,color,flipx,flipy;
122119
123      code = spriteram[offs+3] + ((spriteram[offs+1] & 0x03) << 8);
124      color = (spriteram[offs+1] & 0xf0) >> 4;
120      code = m_spriteram[offs+3] + ((m_spriteram[offs+1] & 0x03) << 8);
121      color = (m_spriteram[offs+1] & 0xf0) >> 4;
125122
126      sx = spriteram[offs+2]-2;
127      sy = spriteram[offs];
123      sx = m_spriteram[offs+2]-2;
124      sy = m_spriteram[offs];
128125
129      flipx = spriteram[offs+1] & 0x08;
130      flipy = spriteram[offs+1] & 0x04;
126      flipx = m_spriteram[offs+1] & 0x08;
127      flipy = m_spriteram[offs+1] & 0x04;
131128
132129      m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
133130            code,
r243607r243608
144141}
145142
146143
147UINT32 sidepckt_state::screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
144UINT32 sidepckt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
148145{
149146   m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
150147   draw_sprites(bitmap,cliprect);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team