trunk/src/mame/drivers/supduck.c
| r242048 | r242049 | |
| 24 | 24 | m_audiocpu(*this, "audiocpu"), |
| 25 | 25 | m_spriteram(*this, "spriteram") , |
| 26 | 26 | m_tx_videoram(*this, "txvideoram"), |
| 27 | m_bg_videoram(*this, "bgvideoram"), |
| 28 | m_fg_videoram(*this, "fgvideoram"), |
| 27 | 29 | m_gfxdecode(*this, "gfxdecode"), |
| 28 | 30 | m_palette(*this, "palette") |
| 29 | 31 | { } |
| r242048 | r242049 | |
| 35 | 37 | // shared pointers |
| 36 | 38 | required_device<buffered_spriteram16_device> m_spriteram; |
| 37 | 39 | required_shared_ptr<UINT16> m_tx_videoram; |
| 40 | required_shared_ptr<UINT16> m_bg_videoram; |
| 41 | required_shared_ptr<UINT16> m_fg_videoram; |
| 38 | 42 | |
| 39 | 43 | required_device<gfxdecode_device> m_gfxdecode; |
| 40 | 44 | required_device<palette_device> m_palette; |
| 41 | 45 | |
| 42 | 46 | tilemap_t *m_tx_tilemap; |
| 47 | tilemap_t *m_bg_tilemap; |
| 48 | tilemap_t *m_fg_tilemap; |
| 43 | 49 | |
| 44 | 50 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 45 | 51 | |
| 46 | 52 | DECLARE_WRITE16_MEMBER(tx_videoram_w); |
| 53 | DECLARE_WRITE16_MEMBER(bg_videoram_w); |
| 54 | DECLARE_WRITE16_MEMBER(fg_videoram_w); |
| 47 | 55 | |
| 48 | 56 | protected: |
| 49 | 57 | |
| r242048 | r242049 | |
| 55 | 63 | |
| 56 | 64 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); |
| 57 | 65 | 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 | |
| 58 | 69 | }; |
| 59 | 70 | |
| 60 | 71 | void supduck_state::video_start() |
| 61 | 72 | { |
| 62 | 73 | 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 | |
| 63 | 78 | m_tx_tilemap->set_transparent_pen(3); |
| 64 | 79 | |
| 65 | 80 | } |
| r242048 | r242049 | |
| 82 | 97 | m_tx_tilemap->mark_tile_dirty(offset); |
| 83 | 98 | } |
| 84 | 99 | |
| 100 | WRITE16_MEMBER(supduck_state::bg_videoram_w) |
| 101 | { |
| 102 | COMBINE_DATA(&m_bg_videoram[offset]); |
| 103 | m_bg_tilemap->mark_tile_dirty(offset); |
| 104 | } |
| 105 | |
| 106 | WRITE16_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 | |
| 85 | 113 | TILE_GET_INFO_MEMBER(supduck_state::get_tx_tile_info) // same as tigeroad.c |
| 86 | 114 | { |
| 87 | 115 | UINT16 *videoram = m_tx_videoram; |
| r242048 | r242049 | |
| 94 | 122 | SET_TILE_INFO_MEMBER(0, code, color, flags); |
| 95 | 123 | } |
| 96 | 124 | |
| 125 | TILE_GET_INFO_MEMBER(supduck_state::get_bg_tile_info) |
| 126 | { |
| 127 | int m_bgcharbank = 0; |
| 97 | 128 | |
| 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 | |
| 140 | TILE_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 | |
| 98 | 154 | void supduck_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) |
| 99 | 155 | { |
| 100 | 156 | UINT16 *source = &m_spriteram->buffer()[m_spriteram->bytes()/2] - 4; |
| r242048 | r242049 | |
| 147 | 203 | // AM_RANGE(0xfe4000, 0xfe4001) AM_WRITE(bionicc_gfxctrl_w) /* + coin counters */ |
| 148 | 204 | // AM_RANGE(0xfe4000, 0xfe4001) AM_READ_PORT("SYSTEM") |
| 149 | 205 | // 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") |
| 150 | 208 | AM_RANGE(0xfe4004, 0xfe4005) AM_READ_PORT("DSW") |
| 151 | 209 | // AM_RANGE(0xfe8010, 0xfe8017) AM_WRITE(bionicc_scroll_w) |
| 152 | 210 | // AM_RANGE(0xfe801a, 0xfe801b) AM_WRITE(bionicc_mpu_trigger_w) /* ??? not sure, but looks like it */ |
| 153 | 211 | 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") |
| 156 | 214 | AM_RANGE(0xff8000, 0xff87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 157 | 215 | AM_RANGE(0xffc000, 0xffffff) AM_RAM /* working RAM */ |
| 158 | 216 | ADDRESS_MAP_END |
| r242048 | r242049 | |
| 164 | 222 | |
| 165 | 223 | |
| 166 | 224 | static 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 | |
| 167 | 254 | PORT_START("DSW") |
| 168 | 255 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) |
| 169 | 256 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| r242048 | r242049 | |
| 246 | 333 | 128 /* every character takes 128 consecutive bytes */ |
| 247 | 334 | }; |
| 248 | 335 | |
| 249 | | static const gfx_layout scroll2layout_bionicc= |
| 336 | // same as the ROM tilemap layout from tigeroad |
| 337 | static const gfx_layout tile_layout = |
| 250 | 338 | { |
| 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 | | |
| 260 | | static 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 }, |
| 266 | 343 | { |
| 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, |
| 270 | 348 | }, |
| 271 | 349 | { |
| 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 |
| 274 | 354 | }, |
| 275 | | 512 /* each tile takes 512 consecutive bytes */ |
| 355 | 256 * 8 |
| 276 | 356 | }; |
| 277 | 357 | |
| 358 | |
| 359 | |
| 278 | 360 | static GFXDECODE_START( supduck ) |
| 279 | 361 | 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 */ |
| 282 | 364 | GFXDECODE_ENTRY( "gfx4", 0, spritelayout_bionicc, 512, 16 ) /* colors 512- 767 */ |
| 283 | 365 | GFXDECODE_END |
| 284 | 366 | |
| r242048 | r242049 | |
| 317 | 399 | /* video hardware */ |
| 318 | 400 | MCFG_SCREEN_ADD("screen", RASTER) |
| 319 | 401 | MCFG_SCREEN_REFRESH_RATE(60) |
| 320 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 402 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 321 | 403 | MCFG_SCREEN_UPDATE_DRIVER(supduck_state, screen_update) |
| 322 | 404 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 323 | 405 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) |
| r242048 | r242049 | |
| 372 | 454 | ROM_REGION( 0x80000, "gfx4", 0 ) |
| 373 | 455 | ROM_LOAD( "15.u1d", 0x00000, 0x20000, CRC(81bf1f27) SHA1(7a66630a2da85387904917d3c136880dffcb9649) ) |
| 374 | 456 | 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) ) |
| 377 | 459 | |
| 378 | 460 | ROM_REGION( 0x80000, "oki", 0 ) |
| 379 | 461 | ROM_LOAD( "2.su12", 0x00000, 0x20000, CRC(745d42fb) SHA1(f9aee3ddbad3cc2f3a7002ee0d762eb041967e1e) ) // static sample data |