trunk/src/mame/drivers/m58.c
| r243007 | r243008 | |
| 26 | 26 | |
| 27 | 27 | static ADDRESS_MAP_START( yard_map, AS_PROGRAM, 8, m58_state ) |
| 28 | 28 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 29 | | AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(yard_videoram_w) AM_SHARE("videoram") |
| 30 | | AM_RANGE(0x9000, 0x9fff) AM_WRITE(yard_scroll_panel_w) |
| 29 | AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
| 30 | AM_RANGE(0x9000, 0x9fff) AM_WRITE(scroll_panel_w) |
| 31 | 31 | AM_RANGE(0xc820, 0xc87f) AM_RAM AM_SHARE("spriteram") |
| 32 | 32 | AM_RANGE(0xa000, 0xa000) AM_RAM AM_SHARE("scroll_x_low") |
| 33 | 33 | AM_RANGE(0xa200, 0xa200) AM_RAM AM_SHARE("scroll_x_high") |
| 34 | 34 | AM_RANGE(0xa400, 0xa400) AM_RAM AM_SHARE("scroll_y_low") |
| 35 | 35 | AM_RANGE(0xa800, 0xa800) AM_RAM AM_SHARE("score_disable") |
| 36 | 36 | AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("irem_audio", irem_audio_device, cmd_w) |
| 37 | | AM_RANGE(0xd001, 0xd001) AM_WRITE(yard_flipscreen_w) /* + coin counters */ |
| 37 | AM_RANGE(0xd001, 0xd001) AM_WRITE(flipscreen_w) /* + coin counters */ |
| 38 | 38 | AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0") |
| 39 | 39 | AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1") |
| 40 | 40 | AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2") |
| r243007 | r243008 | |
| 203 | 203 | |
| 204 | 204 | MCFG_SCREEN_ADD("screen", RASTER) |
| 205 | 205 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 256, 282, 42, 266) |
| 206 | | MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update_yard) |
| 206 | MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update) |
| 207 | 207 | MCFG_SCREEN_PALETTE("palette") |
| 208 | 208 | |
| 209 | 209 | /* sound hardware */ |
trunk/src/mame/includes/m58.h
| r243007 | r243008 | |
| 3 | 3 | public: |
| 4 | 4 | m58_state(const machine_config &mconfig, device_type type, const char *tag) |
| 5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | | m_videoram(*this, "videoram"), |
| 7 | | m_spriteram(*this, "spriteram"), |
| 8 | | m_yard_scroll_x_low(*this, "scroll_x_low"), |
| 9 | | m_yard_scroll_x_high(*this, "scroll_x_high"), |
| 10 | | m_yard_scroll_y_low(*this, "scroll_y_low"), |
| 11 | | m_yard_score_panel_disabled(*this, "score_disable"), |
| 12 | 6 | m_maincpu(*this, "maincpu"), |
| 13 | 7 | m_gfxdecode(*this, "gfxdecode"), |
| 14 | 8 | m_screen(*this, "screen"), |
| 15 | | m_palette(*this, "palette") { } |
| 16 | | |
| 9 | m_palette(*this, "palette"), |
| 10 | m_videoram(*this, "videoram"), |
| 11 | m_spriteram(*this, "spriteram"), |
| 12 | m_scroll_x_low(*this, "scroll_x_low"), |
| 13 | m_scroll_x_high(*this, "scroll_x_high"), |
| 14 | m_scroll_y_low(*this, "scroll_y_low"), |
| 15 | m_score_panel_disabled(*this, "score_disable") { } |
| 16 | |
| 17 | /* devices */ |
| 18 | required_device<cpu_device> m_maincpu; |
| 19 | required_device<gfxdecode_device> m_gfxdecode; |
| 20 | required_device<screen_device> m_screen; |
| 21 | required_device<palette_device> m_palette; |
| 22 | |
| 17 | 23 | /* memory pointers */ |
| 18 | 24 | required_shared_ptr<UINT8> m_videoram; |
| 19 | 25 | required_shared_ptr<UINT8> m_spriteram; |
| 26 | required_shared_ptr<UINT8> m_scroll_x_low; |
| 27 | required_shared_ptr<UINT8> m_scroll_x_high; |
| 28 | required_shared_ptr<UINT8> m_scroll_y_low; |
| 29 | required_shared_ptr<UINT8> m_score_panel_disabled; |
| 20 | 30 | |
| 21 | 31 | /* video-related */ |
| 22 | 32 | tilemap_t* m_bg_tilemap; |
| 23 | | |
| 24 | | required_shared_ptr<UINT8> m_yard_scroll_x_low; |
| 25 | | required_shared_ptr<UINT8> m_yard_scroll_x_high; |
| 26 | | required_shared_ptr<UINT8> m_yard_scroll_y_low; |
| 27 | | required_shared_ptr<UINT8> m_yard_score_panel_disabled; |
| 28 | | bitmap_ind16 *m_scroll_panel_bitmap; |
| 29 | | DECLARE_WRITE8_MEMBER(yard_videoram_w); |
| 30 | | DECLARE_WRITE8_MEMBER(yard_scroll_panel_w); |
| 31 | | DECLARE_WRITE8_MEMBER(yard_flipscreen_w); |
| 33 | bitmap_ind16 m_scroll_panel_bitmap; |
| 34 | |
| 35 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 36 | DECLARE_WRITE8_MEMBER(scroll_panel_w); |
| 37 | DECLARE_WRITE8_MEMBER(flipscreen_w); |
| 38 | |
| 32 | 39 | DECLARE_DRIVER_INIT(yard85); |
| 33 | | TILE_GET_INFO_MEMBER(yard_get_bg_tile_info); |
| 34 | | TILEMAP_MAPPER_MEMBER(yard_tilemap_scan_rows); |
| 35 | 40 | virtual void video_start(); |
| 36 | 41 | DECLARE_PALETTE_INIT(m58); |
| 37 | | UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 42 | |
| 43 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 44 | TILEMAP_MAPPER_MEMBER(tilemap_scan_rows); |
| 45 | |
| 46 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 38 | 47 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 39 | 48 | void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 40 | | required_device<cpu_device> m_maincpu; |
| 41 | | required_device<gfxdecode_device> m_gfxdecode; |
| 42 | | required_device<screen_device> m_screen; |
| 43 | | required_device<palette_device> m_palette; |
| 44 | 49 | }; |
trunk/src/mame/video/m58.c
| r243007 | r243008 | |
| 102 | 102 | * |
| 103 | 103 | *************************************/ |
| 104 | 104 | |
| 105 | | WRITE8_MEMBER(m58_state::yard_videoram_w) |
| 105 | WRITE8_MEMBER(m58_state::videoram_w) |
| 106 | 106 | { |
| 107 | 107 | m_videoram[offset] = data; |
| 108 | 108 | m_bg_tilemap->mark_tile_dirty(offset / 2); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
| 112 | | WRITE8_MEMBER(m58_state::yard_scroll_panel_w) |
| 112 | WRITE8_MEMBER(m58_state::scroll_panel_w) |
| 113 | 113 | { |
| 114 | 114 | int sx,sy,i; |
| 115 | 115 | |
| r243007 | r243008 | |
| 128 | 128 | col = (data >> i) & 0x11; |
| 129 | 129 | col = ((col >> 3) | col) & 3; |
| 130 | 130 | |
| 131 | | m_scroll_panel_bitmap->pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col; |
| 131 | m_scroll_panel_bitmap.pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| r243007 | r243008 | |
| 140 | 140 | * |
| 141 | 141 | *************************************/ |
| 142 | 142 | |
| 143 | | TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info) |
| 143 | TILE_GET_INFO_MEMBER(m58_state::get_bg_tile_info) |
| 144 | 144 | { |
| 145 | 145 | int offs = tile_index * 2; |
| 146 | 146 | int attr = m_videoram[offs + 1]; |
| r243007 | r243008 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | | TILEMAP_MAPPER_MEMBER(m58_state::yard_tilemap_scan_rows) |
| 155 | TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows) |
| 156 | 156 | { |
| 157 | 157 | /* logical (col,row) -> memory offset */ |
| 158 | 158 | if (col >= 32) |
| r243007 | r243008 | |
| 175 | 175 | int height = m_screen->height(); |
| 176 | 176 | const rectangle &visarea = m_screen->visible_area(); |
| 177 | 177 | |
| 178 | | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::yard_get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::yard_tilemap_scan_rows),this), 8, 8, 64, 32); |
| 178 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::tilemap_scan_rows),this), 8, 8, 64, 32); |
| 179 | 179 | m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1)); |
| 180 | 180 | m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1)); |
| 181 | 181 | |
| 182 | | m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height); |
| 182 | //m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height); |
| 183 | m_screen->register_screen_bitmap(m_scroll_panel_bitmap); |
| 184 | save_item(NAME(m_scroll_panel_bitmap)); |
| 183 | 185 | } |
| 184 | 186 | |
| 185 | 187 | |
| r243007 | r243008 | |
| 190 | 192 | * |
| 191 | 193 | *************************************/ |
| 192 | 194 | |
| 193 | | WRITE8_MEMBER(m58_state::yard_flipscreen_w) |
| 195 | WRITE8_MEMBER(m58_state::flipscreen_w) |
| 194 | 196 | { |
| 195 | 197 | /* screen flip is handled both by software and hardware */ |
| 196 | 198 | flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01)); |
| r243007 | r243008 | |
| 265 | 267 | |
| 266 | 268 | void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 267 | 269 | { |
| 268 | | if (!*m_yard_score_panel_disabled) |
| 270 | if (!*m_score_panel_disabled) |
| 269 | 271 | { |
| 270 | 272 | const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1); |
| 271 | 273 | const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1); |
| r243007 | r243008 | |
| 278 | 280 | clip.max_y += visarea.max_y + yoffs; |
| 279 | 281 | clip &= cliprect; |
| 280 | 282 | |
| 281 | | copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(), |
| 283 | copybitmap(bitmap, m_scroll_panel_bitmap, flip_screen(), flip_screen(), |
| 282 | 284 | sx, visarea.min_y + yoffs, clip); |
| 283 | 285 | } |
| 284 | 286 | } |
| r243007 | r243008 | |
| 291 | 293 | * |
| 292 | 294 | *************************************/ |
| 293 | 295 | |
| 294 | | UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 296 | UINT32 m58_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 295 | 297 | { |
| 296 | | m_bg_tilemap->set_scrollx(0, (*m_yard_scroll_x_high * 0x100) + *m_yard_scroll_x_low); |
| 297 | | m_bg_tilemap->set_scrolly(0, *m_yard_scroll_y_low); |
| 298 | m_bg_tilemap->set_scrollx(0, (*m_scroll_x_high * 0x100) + *m_scroll_x_low); |
| 299 | m_bg_tilemap->set_scrolly(0, *m_scroll_y_low); |
| 298 | 300 | |
| 299 | 301 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 300 | 302 | draw_sprites(bitmap, cliprect); |