Previous 15994 Revisions Next

r15910 Wednesday 15th August, 2012 at 20:38:15 UTC by Angelo Salese
Virtual Boy: Added GAME_START and FRAME_START irqs, many more games boots properly now
[src/mess/drivers]vboy.c

src/mess/drivers/vboy.c
r15909r15910
100100   timer_t m_vboy_timer;
101101   bitmap_ind16 m_bg_map[16];
102102   bitmap_ind16 m_screen_output;
103   UINT16 m_frame_count;
103104
104105   void m_timer_tick(UINT8 setting);
105   void m_scanline_tick(int scanline);
106   void m_scanline_tick(int scanline, UINT8 screen_type);
106107   void m_set_irq(UINT16 irq_vector);
107108};
108109
r15909r15910
245246
246247         res =  m_vip_regs.XPSTTS & 0x00f3;
247248         res |= frame_num ? 0x0c : 0x00;
248         //if(m_vip_regs.XPCTRL & 2) /* FIXME: this crashes emulation in boundh and some other games */
249         //if(m_vip_regs.DPCTRL & 2) /* FIXME: this crashes emulation in boundh and some other games */
249250         //   res |= ((row_num)<<8);
250251
251252         return res;
r15909r15910
684685   else
685686   if (mode==3)
686687   {
687      popmessage("Mode 3 used");
688      //popmessage("Mode 3 used");
688689
689690      // just for test
690691      for(i=state->m_vip_regs.SPT[3];i>=state->m_vip_regs.SPT[2];i--)
r15909r15910
783784      device_set_input_line(m_maincpu, 4, CLEAR_LINE);
784785}
785786
786void vboy_state::m_scanline_tick(int scanline)
787/* TODO: obviously all of this needs clean-ups and better implementation ... */
788void vboy_state::m_scanline_tick(int scanline, UINT8 screen_type)
787789{
788790   int frame_num = machine().primary_screen->frame_number();
789791
792   if(screen_type == 1)
793   {
794      if(scanline == 240)
795      {
796         m_vip_regs.DPSTTS = (m_vip_regs.DPCTRL&0x0302)|0x40;
797         m_set_irq(0x0004); // RFBEND
798      }
799
800      return;
801   }
802
790803   if(scanline == 0)
804   {
791805      m_vip_regs.DPSTTS = (m_vip_regs.DPCTRL&0x0302)|0xc0;
806      if(m_vip_regs.DPCTRL & 2)
807         m_set_irq(0x0010); // FRAME_START
792808
809      m_frame_count++;
810
811      if(m_frame_count > m_vip_regs.FRMCYC)
812      {
813         m_set_irq(0x0008); // GAME_START
814         m_frame_count = 0;
815      }
816   }
817
793818   if(scanline == 144)
794819   {
795820      m_vip_regs.DPSTTS  = m_vip_regs.DPCTRL&0x0302;
r15909r15910
805830      m_set_irq(0x0002); // LFBEND
806831   }
807832
808   if(scanline == 240)
809   {
810      m_vip_regs.DPSTTS = (m_vip_regs.DPCTRL&0x0302)|0x40;
811      m_set_irq(0x0004); // RFBEND
812   }
813
814833   if(scanline == 248)
815834   {
816835      m_vip_regs.DPSTTS  = (m_vip_regs.DPCTRL&0x0302);
r15909r15910
824843   }
825844}
826845
827static TIMER_DEVICE_CALLBACK( vboy_scanline )
846static TIMER_DEVICE_CALLBACK( vboy_scanlineL )
828847{
829848   vboy_state *state = timer.machine().driver_data<vboy_state>();
830849   int scanline = param;
831850
832   state->m_scanline_tick(scanline);
851   state->m_scanline_tick(scanline,0);
833852}
834853
854static TIMER_DEVICE_CALLBACK( vboy_scanlineR )
855{
856   vboy_state *state = timer.machine().driver_data<vboy_state>();
857   int scanline = param;
858
859   state->m_scanline_tick(scanline,1);
860}
861
835862static MACHINE_CONFIG_START( vboy, vboy_state )
836863
837864   /* basic machine hardware */
838865   MCFG_CPU_ADD( "maincpu", V810, XTAL_20MHz )
839866   MCFG_CPU_PROGRAM_MAP(vboy_mem)
840867   MCFG_CPU_IO_MAP(vboy_io)
841   MCFG_TIMER_ADD_SCANLINE("scantimer", vboy_scanline, "3dleft", 0, 1)
868   MCFG_TIMER_ADD_SCANLINE("scantimer_l", vboy_scanlineL, "3dleft", 0, 1)
869   MCFG_TIMER_ADD_SCANLINE("scantimer_r", vboy_scanlineR, "3dright", 0, 1)
842870
843871   MCFG_MACHINE_RESET(vboy)
844872

Previous 15994 Revisions Next


© 1998-2018 The MESS Team