Previous 199869 Revisions Next

r21828 Wednesday 13th March, 2013 at 10:44:58 UTC by David Haywood
popobear - preliminary rowselect / linescroll for high scores
[src/mame/drivers]popobear.c

trunk/src/mame/drivers/popobear.c
r21827r21828
290290UINT32 popobear_state::screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
291291{
292292   bitmap.fill(0, cliprect);
293   int line;
294   rectangle clip;
295   int scrollbase;
296   int scrollbase2;
293297
298   const rectangle &visarea = screen.visible_area();
299   clip = visarea;
300
294301   //popmessage("%04x",m_vregs[0/2]);
295302   UINT16* vreg = m_vregs;
296303
r21827r21828
299306
300307
301308   // these are more than just enable, they get written with 0x0d and 0x1f (and 0x00 when a layer is off)
302   // it might relate to the linescroll modes or sizes?
309   // seems to be related to the linescroll mode at least? maybe sizes?
303310   int enable0 = (m_vregs[0x0c] & 0xff00)>>8;
304311   int enable1 = (m_vregs[0x0c] & 0x00ff)>>0;
305312   int enable2 = (m_vregs[0x0d] & 0xff00)>>8;
r21827r21828
310317   if ((enable2 != 0x00) && (enable2 != 0x0d) && (enable2 != 0x1f)) printf("unknown enable2 value %02x\n", enable2);
311318   if ((enable3 != 0x00) && (enable3 != 0x0d) && (enable3 != 0x1f)) printf("unknown enable3 value %02x\n", enable3);
312319
320
321   // the lower 2 tilemaps use regular scrolling
313322   m_bg_tilemap[2]->set_scrollx(0, vreg[0x07]);
314323   m_bg_tilemap[2]->set_scrolly(0, vreg[0x08]);
315324
316325   m_bg_tilemap[3]->set_scrollx(0, vreg[0x09]);
317326   m_bg_tilemap[3]->set_scrolly(0, vreg[0x0a]);
318327
319
320328   if (enable3) m_bg_tilemap[3]->draw(bitmap, cliprect, 0, 0);
321329   if (enable2) m_bg_tilemap[2]->draw(bitmap, cliprect, 0, 0);
322   if (enable1) m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0);
323   if (enable0) m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0);
330
331   // the upper 2 tilemaps have a lineselect / linescroll logic
332
333   if (enable1 == 0x1f)
334   {
335      scrollbase = 0xdf600;
336      scrollbase2 = 0xdf800;
337
338      for (line = 0; line < 240;line++)
339      {
340         UINT16 val = m_vram[scrollbase/2 + line];
341         UINT16 upper = (m_vram[scrollbase2/2 + line]&0xff00)>>8;
342
343         clip.min_y = clip.max_y = line;
344
345         m_bg_tilemap[1]->set_scrollx(0,(val&0x00ff) | (upper << 8));
346         m_bg_tilemap[1]->set_scrolly((0,(val&0xff00)>>8)-line);
347
348         m_bg_tilemap[1]->draw(bitmap, clip, 0, 0);
349      }
350   }
351   else if (enable1 != 0x00)
352   {
353      m_bg_tilemap[1]->set_scrollx(0, 0);
354      m_bg_tilemap[1]->set_scrolly(0, 0);
355      m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0);
356   }
357
358   if (enable0 == 0x1f)
359   {
360      scrollbase = 0xdf400;
361      scrollbase2 = 0xdf800;
362
363      for (line = 0; line < 240;line++)
364      {
365         UINT16 val = m_vram[scrollbase/2 + line];
366         UINT16 upper = (m_vram[scrollbase2/2 + line]&0x00ff)>>0;
367
368         clip.min_y = clip.max_y = line;
369
370         m_bg_tilemap[0]->set_scrollx(0,(val&0x00ff) | (upper << 8));
371         m_bg_tilemap[0]->set_scrolly((0,(val&0xff00)>>8)-line);
372
373         m_bg_tilemap[0]->draw(bitmap, clip, 0, 0);
374      }
375   }
376   else if (enable0 != 0x00)
377   {
378      m_bg_tilemap[0]->set_scrollx(0, 0);
379      m_bg_tilemap[0]->set_scrolly(0, 0);
380      m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0);
381   }
382
324383   draw_sprites(bitmap,cliprect);
325384
326385   return 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team