trunk/src/mame/drivers/stuntair.c
| r22890 | r22891 | |
| 81 | 81 | : driver_device(mconfig, type, tag), |
| 82 | 82 | m_maincpu(*this, "maincpu"), |
| 83 | 83 | m_audiocpu(*this, "audiocpu"), |
| 84 | | m_fgram(*this, "fgram") |
| 84 | m_fgram(*this, "fgram"), |
| 85 | m_bgram(*this, "bgram"), |
| 86 | m_bgattrram(*this, "bgattrram") |
| 85 | 87 | { } |
| 86 | 88 | |
| 87 | 89 | required_device<cpu_device> m_maincpu; |
| 88 | 90 | required_device<cpu_device> m_audiocpu; |
| 89 | 91 | required_shared_ptr<UINT8> m_fgram; |
| 92 | required_shared_ptr<UINT8> m_bgram; |
| 93 | required_shared_ptr<UINT8> m_bgattrram; |
| 90 | 94 | |
| 91 | 95 | tilemap_t *m_fg_tilemap; |
| 96 | tilemap_t *m_bg_tilemap; |
| 92 | 97 | |
| 93 | 98 | DECLARE_WRITE8_MEMBER(stuntair_fgram_w); |
| 94 | 99 | TILE_GET_INFO_MEMBER(get_stuntair_fg_tile_info); |
| 95 | 100 | |
| 101 | DECLARE_WRITE8_MEMBER(stuntair_bgram_w); |
| 102 | DECLARE_WRITE8_MEMBER(stuntair_bgattrram_w); |
| 103 | TILE_GET_INFO_MEMBER(get_stuntair_bg_tile_info); |
| 104 | |
| 105 | |
| 96 | 106 | DECLARE_READ8_MEMBER(stuntair_unk_r) |
| 97 | 107 | { |
| 98 | 108 | return 0xff; |
| r22890 | r22891 | |
| 110 | 120 | |
| 111 | 121 | static ADDRESS_MAP_START( stuntair_map, AS_PROGRAM, 8, stuntair_state ) |
| 112 | 122 | AM_RANGE(0x0000, 0x9fff) AM_ROM |
| 113 | | AM_RANGE(0xc000, 0xc7ff) AM_RAM // bg |
| 114 | | AM_RANGE(0xc800, 0xcfff) AM_RAM // bg attr |
| 115 | | AM_RANGE(0xd000, 0xd3ff) AM_RAM |
| 123 | AM_RANGE(0xc000, 0xc7ff) AM_RAM |
| 124 | AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE(stuntair_bgattrram_w) AM_SHARE("bgattrram") // bg attr |
| 125 | AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(stuntair_bgram_w) AM_SHARE("bgram") // bg |
| 116 | 126 | AM_RANGE(0xd800, 0xdfff) AM_RAM |
| 117 | 127 | |
| 118 | 128 | AM_RANGE(0xe000, 0xe000) AM_READ(stuntair_unk_r) AM_WRITENOP |
| r22890 | r22891 | |
| 215 | 225 | m_fg_tilemap->mark_tile_dirty(offset); |
| 216 | 226 | } |
| 217 | 227 | |
| 228 | WRITE8_MEMBER(stuntair_state::stuntair_bgram_w) |
| 229 | { |
| 230 | m_bgram[offset] = data; |
| 231 | m_bg_tilemap->mark_tile_dirty(offset); |
| 232 | } |
| 218 | 233 | |
| 234 | TILE_GET_INFO_MEMBER(stuntair_state::get_stuntair_bg_tile_info) |
| 235 | { |
| 236 | int tileno = m_bgram[tile_index]; |
| 237 | tileno |= (m_bgattrram[tile_index] & 0x08)<<5; |
| 238 | |
| 239 | SET_TILE_INFO_MEMBER(1, tileno, 0, 0); |
| 240 | } |
| 241 | |
| 242 | |
| 243 | WRITE8_MEMBER(stuntair_state::stuntair_bgattrram_w) |
| 244 | { |
| 245 | m_bgattrram[offset] = data; |
| 246 | m_bg_tilemap->mark_tile_dirty(offset); |
| 247 | } |
| 248 | |
| 249 | |
| 219 | 250 | void stuntair_state::video_start() |
| 220 | 251 | { |
| 221 | 252 | m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(stuntair_state::get_stuntair_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 253 | m_fg_tilemap->set_transparent_pen(0); |
| 254 | |
| 255 | |
| 256 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(stuntair_state::get_stuntair_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 222 | 257 | } |
| 223 | 258 | |
| 224 | 259 | UINT32 stuntair_state::screen_update_stuntair(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 225 | 260 | { |
| 261 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 226 | 262 | m_fg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 227 | 263 | return 0; |
| 228 | 264 | } |