Previous 199869 Revisions Next

r31293 Wednesday 16th July, 2014 at 14:25:31 UTC by Robbbert
mrgame.c : fixed bad sprites; fixed scrolling.
[src/mame/drivers]mrgame.c

trunk/src/mame/drivers/mrgame.c
r31292r31293
2525- Support for electronic volume control
2626- Audio rom banking
2727- Wrong colours
28- Bad scrolling
2928- Most sounds missing due to unemulated M114 chip
3029- wcup90 is different hardware and there's no schematic
3130
r31292r31293
7675   DECLARE_READ8_MEMBER(rsw_r);
7776   TIMER_DEVICE_CALLBACK_MEMBER(irq_timer);
7877   UINT32 screen_update_mrgame(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
78   bitmap_ind16 *m_tile_bitmap;
7979   required_device<palette_device> m_palette;
8080   required_shared_ptr<UINT8> m_p_videoram;
8181   required_shared_ptr<UINT8> m_p_objectram;
r31292r31293
9191   UINT8 m_video_data;
9292   UINT8 m_video_status;
9393   UINT8 m_video_ctrl[8];
94   const UINT8 *m_p_chargen;
94   virtual void machine_start();
9595   virtual void machine_reset();
9696   required_device<m68000_device> m_maincpu;
9797   required_device<z80_device> m_audiocpu1;
r31292r31293
292292   return m_io_dsw1->read() | ((UINT8)m_ackv << 4);
293293}
294294
295void mrgame_state::machine_start()
296{
297   m_tile_bitmap=auto_bitmap_ind16_alloc(machine(),256,256);
298}
299
295300void mrgame_state::machine_reset()
296301{
297302   m_sound_data = 0xff;
r31292r31293
303308   m_ack2 = 0;
304309   m_ackv = 0;
305310   m_row_data = 0;
306   m_p_chargen = memregion("chargen")->base();
307311}
308312
309313DRIVER_INIT_MEMBER( mrgame_state, mrgame )
r31292r31293
398402// most of this came from pinmame as the diagram doesn't make a lot of sense
399403UINT32 mrgame_state::screen_update_mrgame(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
400404{
401   UINT8 y,ptr,col;
402   UINT16 sy=0,x,chr;
405   UINT8 x,y,ptr=0,col;
406   INT32 scrolly[32];
407   UINT16 chr;
403408   bool flipx,flipy;
404409
405410   // text
406   for (y = 0; y < 32; y++)
411   for (x = 0; x < 32; x++)
407412   {
408      ptr = 1;
409      for (x = 0; x < 32; x++)
413      scrolly[x] = -m_p_objectram[ptr++];
414      col = m_p_objectram[ptr++];
415
416      for (y = 0; y < 32; y++)
410417      {
411         col = m_p_objectram[ptr];
412         ptr+=2;
413         chr = m_p_videoram[x+y*32] + (m_gfx_bank << 8);
418         chr = m_p_videoram[x+y*32] | (m_gfx_bank << 8);
414419
415         m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,
420         m_gfxdecode->gfx(0)->opaque(*m_tile_bitmap, m_tile_bitmap->cliprect(),
416421            chr,
417422            col,
418423            0,0,
r31292r31293
420425      }
421426   }
422427
428   // scroll each column as needed
429   copyscrollbitmap(bitmap,*m_tile_bitmap,0,0,32,scrolly,cliprect);
430
431
423432   // sprites
424433   for (ptr = 0x40; ptr < 0x60; ptr += 4)
425434   {
426435      x = m_p_objectram[ptr + 3] + 1;
427      sy = 255 - m_p_objectram[ptr];
436      y = 255 - m_p_objectram[ptr];
428437      flipx = BIT(m_p_objectram[ptr + 1], 6);
429438      flipy = BIT(m_p_objectram[ptr + 1], 7);
430      chr = (m_p_objectram[ptr + 1] & 0x3f) + (m_gfx_bank << 8);
439      chr = (m_p_objectram[ptr + 1] & 0x3f) | (m_gfx_bank << 6);
431440      col = m_p_objectram[ptr + 2];
432441
433      if ((sy > 16) && (x > 24))
442      if ((y > 16) && (x > 24))
434443         m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
435444            chr,
436445            col,
437446            flipx,flipy,
438            x,sy-16,0);
447            x,y-16,0);
439448   }
440449
441450   return 0;
r31292r31293
463472   MCFG_SCREEN_REFRESH_RATE(50)
464473   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
465474   MCFG_SCREEN_SIZE(256, 256)
466   MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 247) // If you align with X on test screen some info is chopped off
475   MCFG_SCREEN_VISIBLE_AREA(0, 255, 8, 247) // If you align with X on test screen some info is chopped off
467476   MCFG_SCREEN_UPDATE_DRIVER(mrgame_state, screen_update_mrgame)
468477   MCFG_SCREEN_PALETTE("palette")
469478   MCFG_PALETTE_ADD_INIT_BLACK("palette", 32)
r31292r31293
520529ROM_END
521530
522531/*-------------------------------------------------------------------
523/ Motor Show (1988?)
532/ Motor Show (1989)
524533/-------------------------------------------------------------------*/
525534ROM_START(motrshow)
526535   ROM_REGION(0x10000, "roms", 0)
r31292r31293
643652
644653
645654GAME(1988,  dakar,     0,         mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Dakar",                      GAME_IS_SKELETON_MECHANICAL)
646GAME(1988,  motrshow,  0,         mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Motor Show (set 1)",         GAME_IS_SKELETON_MECHANICAL)
647GAME(1988,  motrshowa, motrshow,  mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Motor Show (set 2)",         GAME_IS_SKELETON_MECHANICAL)
655GAME(1989,  motrshow,  0,         mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Motor Show (set 1)",         GAME_IS_SKELETON_MECHANICAL)
656GAME(1989,  motrshowa, motrshow,  mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Motor Show (set 2)",         GAME_IS_SKELETON_MECHANICAL)
648657GAME(1990,  macattck,  0,         mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "Mac Attack",                 GAME_IS_SKELETON_MECHANICAL)
649658GAME(1990,  wcup90,    0,         mrgame,  mrgame, mrgame_state,  mrgame,  ROT0,  "Mr Game",    "World Cup 90",               GAME_IS_SKELETON_MECHANICAL)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team