Previous 199869 Revisions Next

r33537 Tuesday 25th November, 2014 at 21:52:52 UTC by David Haywood
decode fixes (nw)
[src/mame/drivers]supduck.c

trunk/src/mame/drivers/supduck.c
r242048r242049
2424         m_audiocpu(*this, "audiocpu"),
2525         m_spriteram(*this, "spriteram") ,
2626         m_tx_videoram(*this, "txvideoram"),
27         m_bg_videoram(*this, "bgvideoram"),
28         m_fg_videoram(*this, "fgvideoram"),
2729         m_gfxdecode(*this, "gfxdecode"),
2830         m_palette(*this, "palette")
2931   { }
r242048r242049
3537   // shared pointers
3638   required_device<buffered_spriteram16_device> m_spriteram;
3739   required_shared_ptr<UINT16> m_tx_videoram;
40   required_shared_ptr<UINT16> m_bg_videoram;
41   required_shared_ptr<UINT16> m_fg_videoram;
3842
3943   required_device<gfxdecode_device> m_gfxdecode;
4044   required_device<palette_device> m_palette;
4145
4246   tilemap_t     *m_tx_tilemap;
47   tilemap_t     *m_bg_tilemap;
48   tilemap_t     *m_fg_tilemap;
4349
4450   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4551
4652   DECLARE_WRITE16_MEMBER(tx_videoram_w);
53   DECLARE_WRITE16_MEMBER(bg_videoram_w);
54   DECLARE_WRITE16_MEMBER(fg_videoram_w);
4755
4856protected:
4957
r242048r242049
5563
5664   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
5765   TILE_GET_INFO_MEMBER(get_tx_tile_info);
66   TILE_GET_INFO_MEMBER(get_bg_tile_info);
67   TILE_GET_INFO_MEMBER(get_fg_tile_info);
68
5869};
5970
6071void supduck_state::video_start()
6172{
6273   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supduck_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
74
75   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supduck_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 8, 256);
76   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supduck_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 8, 256);
77
6378   m_tx_tilemap->set_transparent_pen(3);
6479
6580}
r242048r242049
8297   m_tx_tilemap->mark_tile_dirty(offset);
8398}
8499
100WRITE16_MEMBER(supduck_state::bg_videoram_w)
101{
102   COMBINE_DATA(&m_bg_videoram[offset]);
103   m_bg_tilemap->mark_tile_dirty(offset);
104}
105
106WRITE16_MEMBER(supduck_state::fg_videoram_w)
107{
108   COMBINE_DATA(&m_fg_videoram[offset]);
109   m_fg_tilemap->mark_tile_dirty(offset);
110}
111
112
85113TILE_GET_INFO_MEMBER(supduck_state::get_tx_tile_info) // same as tigeroad.c
86114{
87115   UINT16 *videoram = m_tx_videoram;
r242048r242049
94122   SET_TILE_INFO_MEMBER(0, code, color, flags);
95123}
96124
125TILE_GET_INFO_MEMBER(supduck_state::get_bg_tile_info)
126{
127   int m_bgcharbank = 0;
97128
129   UINT16 *tilerom = m_bg_videoram;
130   int data = tilerom[tile_index];
131   int attr = tilerom[tile_index + 1];
132   int code = data + ((attr & 0xc0) << 2) + (m_bgcharbank << 10);
133   int color = attr & 0x0f;
134   int flags = (attr & 0x20) ? TILE_FLIPX : 0;
135
136   SET_TILE_INFO_MEMBER(1, code, color, flags);
137   tileinfo.group = (attr & 0x10) ? 1 : 0;
138}
139
140TILE_GET_INFO_MEMBER(supduck_state::get_fg_tile_info)
141{
142
143   UINT16 *videoram = m_fg_videoram;
144   int data = videoram[tile_index];
145
146   int code = data;
147   int color = 0;
148   int flags = 0;
149
150   SET_TILE_INFO_MEMBER(2, code, color, flags);
151}
152
153
98154void supduck_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
99155{
100156   UINT16 *source = &m_spriteram->buffer()[m_spriteram->bytes()/2] - 4;
r242048r242049
147203//   AM_RANGE(0xfe4000, 0xfe4001) AM_WRITE(bionicc_gfxctrl_w)    /* + coin counters */
148204//   AM_RANGE(0xfe4000, 0xfe4001) AM_READ_PORT("SYSTEM")
149205//   AM_RANGE(0xfe4002, 0xfe4003) AM_READ(supduck_random_r)
206   AM_RANGE(0xfe4000, 0xfe4001) AM_READ_PORT("P1_P2")
207   AM_RANGE(0xfe4002, 0xfe4003) AM_READ_PORT("SYSTEM")
150208   AM_RANGE(0xfe4004, 0xfe4005) AM_READ_PORT("DSW")
151209//   AM_RANGE(0xfe8010, 0xfe8017) AM_WRITE(bionicc_scroll_w)
152210//   AM_RANGE(0xfe801a, 0xfe801b) AM_WRITE(bionicc_mpu_trigger_w)    /* ??? not sure, but looks like it */
153211   AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(tx_videoram_w) AM_SHARE("txvideoram")
154   AM_RANGE(0xff0000, 0xff3fff) AM_RAM // AM_RAM_WRITE(bionicc_fgvideoram_w) AM_SHARE("fgvideoram")
155   AM_RANGE(0xff4000, 0xff7fff) AM_RAM // AM_RAM_WRITE(bionicc_bgvideoram_w) AM_SHARE("bgvideoram")
212   AM_RANGE(0xff0000, 0xff3fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fgvideoram")
213   AM_RANGE(0xff4000, 0xff7fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bgvideoram")
156214   AM_RANGE(0xff8000, 0xff87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
157215   AM_RANGE(0xffc000, 0xffffff) AM_RAM /* working RAM */
158216ADDRESS_MAP_END
r242048r242049
164222
165223
166224static INPUT_PORTS_START( supduck )
225   PORT_START("P1_P2")
226   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
227   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
228   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
229   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
230   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
231   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
232   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
233   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
234   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
235   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
236   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
237   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
238   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
239   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
240   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
241   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
242
243   PORT_START("SYSTEM")
244   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
245   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
246   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
247   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") /* not sure, probably wrong */
248   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
249   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
250   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE1 )
251   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN1 )
252   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2 )
253
167254   PORT_START("DSW")
168255   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
169256   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
r242048r242049
246333   128   /* every character takes 128 consecutive bytes */
247334};
248335
249static const gfx_layout scroll2layout_bionicc=
336// same as the ROM tilemap layout from tigeroad
337static const gfx_layout tile_layout =
250338{
251   8,8,    /* 8*8 tiles */
252   RGN_FRAC(1,2),   /* 2048 tiles */
253   4,      /* 4 bits per pixel */
254   { RGN_FRAC(1,2)+4,RGN_FRAC(1,2)+0,RGN_FRAC(0,2)+4,RGN_FRAC(0,2)+0 },
255   { 0,1,2,3, 8,9,10,11 },
256   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
257   128   /* every tile takes 128 consecutive bytes */
258};
259
260static const gfx_layout scroll1layout_bionicc=
261{
262   16,16,  /* 16*16 tiles */
263   RGN_FRAC(1,2),   /* 2048 tiles */
264   4,      /* 4 bits per pixel */
265   { RGN_FRAC(1,2)+4,RGN_FRAC(1,2)+0,RGN_FRAC(0,2)+4,RGN_FRAC(0,2)+0 },
339   32, 32,
340   RGN_FRAC(1, 2),
341   4,
342   { RGN_FRAC(1, 2) + 4, RGN_FRAC(1, 2) + 0, 4, 0 },
266343   {
267      0,1,2,3, 8,9,10,11,
268      (8*4*8)+0,(8*4*8)+1,(8*4*8)+2,(8*4*8)+3,
269      (8*4*8)+8,(8*4*8)+9,(8*4*8)+10,(8*4*8)+11
344      0, 1, 2, 3, 8 + 0, 8 + 1, 8 + 2, 8 + 3,
345      64 * 8 + 0, 64 * 8 + 1, 64 * 8 + 2, 64 * 8 + 3, 64 * 8 + 8 + 0, 64 * 8 + 8 + 1, 64 * 8 + 8 + 2, 64 * 8 + 8 + 3,
346      2 * 64 * 8 + 0, 2 * 64 * 8 + 1, 2 * 64 * 8 + 2, 2 * 64 * 8 + 3, 2 * 64 * 8 + 8 + 0, 2 * 64 * 8 + 8 + 1, 2 * 64 * 8 + 8 + 2, 2 * 64 * 8 + 8 + 3,
347      3 * 64 * 8 + 0, 3 * 64 * 8 + 1, 3 * 64 * 8 + 2, 3 * 64 * 8 + 3, 3 * 64 * 8 + 8 + 0, 3 * 64 * 8 + 8 + 1, 3 * 64 * 8 + 8 + 2, 3 * 64 * 8 + 8 + 3,
270348   },
271349   {
272      0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
273      8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16
350      0 * 16, 1 * 16, 2 * 16, 3 * 16, 4 * 16, 5 * 16, 6 * 16, 7 * 16,
351      8 * 16, 9 * 16, 10 * 16, 11 * 16, 12 * 16, 13 * 16, 14 * 16, 15 * 16,
352      16 * 16, 17 * 16, 18 * 16, 19 * 16, 20 * 16, 21 * 16, 22 * 16, 23 * 16,
353      24 * 16, 25 * 16, 26 * 16, 27 * 16, 28 * 16, 29 * 16, 30 * 16, 31 * 16
274354   },
275   512   /* each tile takes 512 consecutive bytes */
355   256 * 8
276356};
277357
358
359
278360static GFXDECODE_START( supduck )
279361   GFXDECODE_ENTRY( "gfx1", 0, vramlayout_bionicc,    768, 64 )    /* colors 768-1023 */
280   GFXDECODE_ENTRY( "gfx2", 0, scroll2layout_bionicc,   0,  4 )    /* colors   0-  63 */
281   GFXDECODE_ENTRY( "gfx3", 0, scroll1layout_bionicc, 256,  4 )    /* colors 256- 319 */
362   GFXDECODE_ENTRY( "gfx2", 0, tile_layout,   0,  4 )    /* colors   0-  63 */
363   GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 256,  4 )    /* colors 256- 319 */
282364   GFXDECODE_ENTRY( "gfx4", 0, spritelayout_bionicc,  512, 16 )    /* colors 512- 767 */
283365GFXDECODE_END
284366
r242048r242049
317399   /* video hardware */
318400   MCFG_SCREEN_ADD("screen", RASTER)
319401   MCFG_SCREEN_REFRESH_RATE(60)
320   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
402   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
321403   MCFG_SCREEN_UPDATE_DRIVER(supduck_state, screen_update)
322404   MCFG_SCREEN_SIZE(32*8, 32*8)
323405   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
r242048r242049
372454   ROM_REGION( 0x80000, "gfx4", 0 )
373455   ROM_LOAD( "15.u1d",   0x00000, 0x20000, CRC(81bf1f27) SHA1(7a66630a2da85387904917d3c136880dffcb9649) )
374456   ROM_LOAD( "16.u2d",   0x20000, 0x20000, CRC(9573d6ec) SHA1(9923be782bae47c49913d01554bcf3e5efb5395b) )
375   ROM_LOAD( "17.u1c",   0x40000, 0x20000, CRC(21ef14d4) SHA1(66e389aaa1186921a07da9a9a9eda88a1083ad42) )
376   ROM_LOAD( "18.u2c",   0x60000, 0x20000, CRC(33dd0674) SHA1(b95dfcc16d939bac77f338b8a8cada19328a1993) )
457   ROM_LOAD( "17.u1c",   0x60000, 0x20000, CRC(21ef14d4) SHA1(66e389aaa1186921a07da9a9a9eda88a1083ad42) )
458   ROM_LOAD( "18.u2c",   0x40000, 0x20000, CRC(33dd0674) SHA1(b95dfcc16d939bac77f338b8a8cada19328a1993) )
377459
378460   ROM_REGION( 0x80000, "oki", 0 )
379461   ROM_LOAD( "2.su12",   0x00000, 0x20000, CRC(745d42fb) SHA1(f9aee3ddbad3cc2f3a7002ee0d762eb041967e1e) ) // static sample data


Previous 199869 Revisions Next


© 1997-2024 The MAME Team