コード例 #1
0
ファイル: tests.c プロジェクト: Amon-X/yabause
void init_test(void)
{
   // Put saturn in a minimalized state
   int i;

   interrupt_set_level_mask(0xF);

   for (i = 0; i < 0x80; i++)
      bios_set_sh2_interrupt(i, 0);

   for (i = 0x40; i < 0x60; i++)
      bios_set_scu_interrupt(i, 0);

   // Make sure all interrupts have been called
   bios_change_scu_interrupt_mask(0, 0);
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF);

   vdp_init(RES_320x224);
//   per_init();

   commlink_stop_service();

//   if (InterruptGetLevelMask() > 0x7)
//      interrupt_set_level_mask(0x7);

   vdp_rbg0_init(&test_disp_settings);
}
コード例 #2
0
ファイル: iapetus.c プロジェクト: abrasive/iapetus
void init_iapetus(int res)
{
   int i;

   interrupt_set_level_mask(0xF);

   for (i = 0; i < 0x80; i++)
      bios_set_sh2_interrupt(i, 0);

   for (i = 0x40; i < 0x60; i++)
      bios_set_scu_interrupt(i, 0);

   // Make sure all interrupts have been called
   bios_change_scu_interrupt_mask(0, 0);
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF);

   vdp_init(res);
   per_init();

   commlink_stop_service();
   cl_set_service_func(cl_check2);

#ifdef DEBUG
   debug_init();
#endif

   // If DSP is running, stop it
   if (dsp_is_exec())
       dsp_stop();

   if (interrupt_get_level_mask() > 0x7)
      interrupt_set_level_mask(0x7);
}
コード例 #3
0
ファイル: scsp.c プロジェクト: esperknight/yabause
void scsp_int_test_func()
{
   stage_status = STAGESTAT_DONE;

   // Mask SCSP interrupts
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0x40);
}
コード例 #4
0
ファイル: main.c プロジェクト: 6lackmag3/yabause
void yabauseut_init()
{
   int i;

   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF);
   interrupt_set_level_mask(0);

   // Wait a bit
   for (i = 0; i < 200000; i++) {}

   interrupt_set_level_mask(0xF);

   bios_set_scu_interrupt(0x40, 0);
   bios_set_scu_interrupt(0x41, 0);
   bios_set_scu_interrupt(0x42, 0);
   bios_set_scu_interrupt(0x43, 0);
   bios_set_scu_interrupt(0x44, 0);
   bios_set_scu_interrupt(0x45, 0);
   bios_set_scu_interrupt(0x46, 0);
   bios_set_scu_interrupt(0x47, 0);
   bios_set_scu_interrupt(0x48, 0);
   bios_set_scu_interrupt(0x49, 0);
   bios_set_scu_interrupt(0x4A, 0);
   bios_set_scu_interrupt(0x4B, 0);
   bios_set_scu_interrupt(0x4C, 0);
   bios_set_scu_interrupt(0x4D, 0);
   bios_set_scu_interrupt(0x50, 0);   

   init_iapetus(RES_320x224);

   // Setup a screen for us draw on
   test_disp_settings.is_bitmap = TRUE;
   test_disp_settings.bitmap_size = BG_BITMAP512x256;
   test_disp_settings.transparent_bit = 0;
   test_disp_settings.color = BG_256COLOR;
   test_disp_settings.special_priority = 0;
   test_disp_settings.special_color_calc = 0;
   test_disp_settings.extra_palette_num = 0;
   test_disp_settings.map_offset = 0;
   test_disp_settings.rotation_mode = 0;
   test_disp_settings.parameter_addr = 0x25E60000;
   vdp_rbg0_init(&test_disp_settings);

   // Use the default palette
   vdp_set_default_palette();

   // Setup an 8x8 1BPP font
   test_disp_font.data = font_8x8;
   test_disp_font.width = 8;
   test_disp_font.height = 8;
   test_disp_font.bpp = 1;
   test_disp_font.out = (u8 *)0x25E00000;
   vdp_set_font(SCREEN_RBG0, &test_disp_font, 1);

   // Print messages and cursor
   vdp_disp_on();
}
コード例 #5
0
ファイル: scsp.c プロジェクト: esperknight/yabause
void scu_interrupt_test()
{
   // Disable everything temporarily
   SCSPREG_SCIEB = 0;
   SCSPREG_MCIEB = 0;

   // Mask SCSP interrupt temporarily
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0x40);

   // Set SCSP interrupt function
   bios_set_scu_interrupt(0x46, scsp_int_test_func);

   // Unmask SCSP interrupt
   bios_change_scu_interrupt_mask(~0x40, 0);

   // Enable all SCSP Main cpu interrupts
   SCSPREG_MCIEB = 0x7FF;
   SCSPREG_MCIRE = 0x7FF;
}
コード例 #6
0
ファイル: scsp.c プロジェクト: esperknight/yabause
void scsp_interactive_test()
{
   u16 scieb=0;
   u16 mcieb=0;

   scsp_minimal_init();

   test_disp_font.transparent = 0;
   scsp_counter=0;
   SCSPREG_SCIEB = mcieb;
   SCSPREG_MCIEB = scieb;

   // Mask SCSP interrupt temporarily
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0x40);

   // Set SCSP interrupt function
   bios_set_scu_interrupt(0x46, scsp_interrupt);

   // Unmask SCSP interrupt
   bios_change_scu_interrupt_mask(~0x40, 0);

   for (;;)
   {
      u16 scipd;
      u16 mcipd;

      vdp_vsync();

#define Refresh(line) \
      scipd = SCSPREG_SCIPD; \
      mcipd = SCSPREG_MCIPD; \
      \
      vdp_printf(&test_disp_font, 2 * 8, line * 8, 0xF, "SCIEB = %04X", scieb); \
      vdp_printf(&test_disp_font, 2 * 8, (line+1) * 8, 0xF, "MCIEB = %04X", mcieb); \
      vdp_printf(&test_disp_font, 2 * 8, (line+2) * 8, 0xF, "SCIPD = %04X", scipd); \
      vdp_printf(&test_disp_font, 2 * 8, (line+3) * 8, 0xF, "MCIPD = %04X", mcipd); \
      vdp_printf(&test_disp_font, 2 * 8, (line+4)* 8, 0xF, "int counter = %d", scsp_counter);

      Refresh(17);

      if (per[0].but_push_once & PAD_A)
      {
         SCSPREG_TIMERA = 0x700;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_B)
      {
         SCSPREG_TIMERA = 0x07FF;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_C)
      {
         SCSPREG_SCIRE = 0x40;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_X)
      {
         mcieb ^= 0x40;
         SCSPREG_MCIEB = mcieb;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_Y)
      {
         SCSPREG_MCIRE = 0x40;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_L)
      {
         mcieb ^= 0x20;
         SCSPREG_MCIEB = mcieb;
         Refresh(23);
      }
      else if (per[0].but_push_once & PAD_R)
      {
         if (SCSPREG_MCIPD & 0x20)
            SCSPREG_MCIRE = 0x20;
         else
            SCSPREG_MCIPD = 0x20;
         Refresh(23);
      }
   }
}
コード例 #7
0
ファイル: tests.c プロジェクト: Amon-X/yabause
void do_tests(const char *testname, int x, int y)
{
   int i;
   u8 stage=0;
   u8 line=0;

   // Clear out test log area
   memset((void *)TEST_LOG_ADDRESS, 0, TEST_LOG_SIZE);
   *((u32 *)TEST_LOG_ADDRESS) = TEST_LOG_ADDRESS+4;

   // Print messages and cursor
   vdp_printf(&test_disp_font, x * 8, y * 8, 0xF, (char *)testname);

   auto_test_section_start((char *)testname);

   for(;;)
   {
      vdp_vsync();

      if (stage_status != STAGESTAT_BUSY && stage_status != STAGESTAT_WAITINGFORINT)
      {
         int textx = x * 8;
         int texty = (y + line + 2) * 8;
         int textstatx = (x + 38) * 8;

         if (stage_status == STAGESTAT_DONE)
         {
            vdp_printf(&test_disp_font, textstatx, texty, 0xA, "OK");
            auto_test_send_result("PASS");
         }

         else if (stage_status < 0)
         {
            // Handle error
            switch (stage_status)
            {
               case STAGESTAT_BADTIMING:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xE, "BT");
                  auto_test_send_result("FAIL (Bad Timing)");
                  break;
               case STAGESTAT_BADDATA:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BD");
                  auto_test_send_result("FAIL (Bad Data)");
                  break;
               case STAGESTAT_BADSIZE:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BS");
                  auto_test_send_result("FAIL (Bad Size)");
                  break;
               case STAGESTAT_BADINTERRUPT:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BI");
                  auto_test_send_result("FAIL (Bad Interrupt)");
                  break;
               case STAGESTAT_NOTEST:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xF, "NT");
                  auto_test_send_result("FAIL (No Test)");
                  break;
               default:
                  vdp_printf(&test_disp_font, textstatx, texty, 0xC, "failed");
                  auto_test_send_result("FAIL");
                  break;
            }
         }

         if (stage >= numtests)
         {
            vdp_printf(&test_disp_font, textx, texty+8, 0xF, "All tests done.");
            break;
         }
#ifndef BUILD_AUTOMATED_TESTING
         else if (line >= 23)
         {
            vdp_printf(&test_disp_font,textx, texty+8, 0xF, "Press any button to continue");
            tests_wait_press();
            // Clear window
            vdp_clear_screen(&test_disp_font);
            vdp_printf(&test_disp_font, x * 8, y * 8, 0xF, (char *)testname);
            line = 0;
            texty = (y + line + 2) * 8;
         }
#endif

         stage_status = STAGESTAT_BUSY;

         if (tests[stage].name)
         {
            vdp_printf(&test_disp_font, textx, texty+8, 0xF, (char *)tests[stage].name);
            auto_test_sub_test_start((char *)tests[stage].name);
         }

         if (tests[stage].testfunc)
            tests[stage].testfunc();

         waitcounter = 60 * 5;

         stage++;
         line++;
      }
      else
      {
         if (stage_status == STAGESTAT_WAITINGFORINT)
         {
            // decrement waitcounter
            waitcounter--;
            if (waitcounter <= 0)
               stage_status = STAGESTAT_BADINTERRUPT;
#ifdef DEBUG
            vdp_printf(&test_disp_font, 0 * 8, 23 * 8, 0xF, "%08X", waitcounter);
#endif
         }
      }
   }

   interrupt_set_level_mask(0xF);

   // Reset all interrupts
   for (i = 0; i < 0x80; i++)
      bios_set_sh2_interrupt(i, 0);

   for (i = 0x40; i < 0x60; i++)
      bios_set_scu_interrupt(i, 0);

   // Make sure all interrupts have been called
   bios_change_scu_interrupt_mask(0, 0);
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF);

   auto_test_section_end();

   // Enable commlink connection
   cl_set_service_func(ud_check);
   commlink_start_service();
   tests_wait_press();
   commlink_stop_service();
}