Previous 199869 Revisions Next

r34496 Monday 19th January, 2015 at 17:48:27 UTC by Osso
m58.c: fixed 10yard save state problem, removed unneeded prefixes (nw)
[src/mame/drivers]m58.c
[src/mame/includes]m58.h
[src/mame/video]m58.c

trunk/src/mame/drivers/m58.c
r243007r243008
2626
2727static ADDRESS_MAP_START( yard_map, AS_PROGRAM, 8, m58_state )
2828   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)
3131   AM_RANGE(0xc820, 0xc87f) AM_RAM AM_SHARE("spriteram")
3232   AM_RANGE(0xa000, 0xa000) AM_RAM AM_SHARE("scroll_x_low")
3333   AM_RANGE(0xa200, 0xa200) AM_RAM AM_SHARE("scroll_x_high")
3434   AM_RANGE(0xa400, 0xa400) AM_RAM AM_SHARE("scroll_y_low")
3535   AM_RANGE(0xa800, 0xa800) AM_RAM AM_SHARE("score_disable")
3636   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 */
3838   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0")
3939   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1")
4040   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2")
r243007r243008
203203
204204   MCFG_SCREEN_ADD("screen", RASTER)
205205   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)
207207   MCFG_SCREEN_PALETTE("palette")
208208
209209   /* sound hardware */
trunk/src/mame/includes/m58.h
r243007r243008
33public:
44   m58_state(const machine_config &mconfig, device_type type, const char *tag)
55      : 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"),
126      m_maincpu(*this, "maincpu"),
137      m_gfxdecode(*this, "gfxdecode"),
148      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   
1723   /* memory pointers */
1824   required_shared_ptr<UINT8> m_videoram;
1925   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;
2030
2131   /* video-related */
2232   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   
3239   DECLARE_DRIVER_INIT(yard85);
33   TILE_GET_INFO_MEMBER(yard_get_bg_tile_info);
34   TILEMAP_MAPPER_MEMBER(yard_tilemap_scan_rows);
3540   virtual void video_start();
3641   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);
3847   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
3948   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;
4449};
trunk/src/mame/video/m58.c
r243007r243008
102102 *
103103 *************************************/
104104
105WRITE8_MEMBER(m58_state::yard_videoram_w)
105WRITE8_MEMBER(m58_state::videoram_w)
106106{
107107   m_videoram[offset] = data;
108108   m_bg_tilemap->mark_tile_dirty(offset / 2);
109109}
110110
111111
112WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
112WRITE8_MEMBER(m58_state::scroll_panel_w)
113113{
114114   int sx,sy,i;
115115
r243007r243008
128128      col = (data >> i) & 0x11;
129129      col = ((col >> 3) | col) & 3;
130130
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;
132132   }
133133}
134134
r243007r243008
140140 *
141141 *************************************/
142142
143TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info)
143TILE_GET_INFO_MEMBER(m58_state::get_bg_tile_info)
144144{
145145   int offs = tile_index * 2;
146146   int attr = m_videoram[offs + 1];
r243007r243008
152152}
153153
154154
155TILEMAP_MAPPER_MEMBER(m58_state::yard_tilemap_scan_rows)
155TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows)
156156{
157157   /* logical (col,row) -> memory offset */
158158   if (col >= 32)
r243007r243008
175175   int height = m_screen->height();
176176   const rectangle &visarea = m_screen->visible_area();
177177
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);
179179   m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1));
180180   m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1));
181181
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));
183185}
184186
185187
r243007r243008
190192 *
191193 *************************************/
192194
193WRITE8_MEMBER(m58_state::yard_flipscreen_w)
195WRITE8_MEMBER(m58_state::flipscreen_w)
194196{
195197   /* screen flip is handled both by software and hardware */
196198   flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01));
r243007r243008
265267
266268void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
267269{
268   if (!*m_yard_score_panel_disabled)
270   if (!*m_score_panel_disabled)
269271   {
270272      const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1);
271273      const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
r243007r243008
278280      clip.max_y += visarea.max_y + yoffs;
279281      clip &= cliprect;
280282
281      copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(),
283      copybitmap(bitmap, m_scroll_panel_bitmap, flip_screen(), flip_screen(),
282284               sx, visarea.min_y + yoffs, clip);
283285   }
284286}
r243007r243008
291293 *
292294 *************************************/
293295
294UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
296UINT32 m58_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
295297{
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);
298300
299301   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
300302   draw_sprites(bitmap, cliprect);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team