Exemplo n.º 1
0
void setup(void)
{
	// Initialize Sega VDP
	VDP_init();

	// Configure the screen with to 40 columns
	VDP_setScreenWidth320();

	// Configure background planes to be 64 x 32 cells
	VDP_setPlanSize(64,32);

	// Initialize column text output (DMA graphic tiles)
	col_init();

	// Disable interrupts during configuration
	SYS_disableInts();

	// Allow all three interrupts
	SYS_setInterruptMaskLevel(0);

	// Set pointers to interrupt service routines
	SYS_setVIntCallback((_voidCallback *)v_int);
	SYS_setHIntCallback((_voidCallback *)h_int);

	// Now we can enable interrupts
	SYS_enableInts();

	// Configure the screen with to 40 columns
	VDP_setScreenWidth320();

	// Configure background planes to be 64 x 32 cells
	VDP_setPlanSize(64,32);

}
Exemplo n.º 2
0
static void _init( u16 hard )
{
   if ( hard == 0 ) // 0 is soft reset
   {
      VDP_drawText ( "BUG HUNT", 16, 9 );
      VDP_drawText ( "FOR SEGA MEGADRIVE", 11, 11 );
      VDP_drawText ( "BY THE AFROMONKEYS, 2015", 8, 13 );

      waitMs(3000);


      // That's weird.
      // Resetting in SGDK v1.11 invokes JOY_init() that
      // makes Justifier | Menacer not to be detected if
      // mouse is on PORT_1

      if ( JOY_getPortType(PORT_1) != PORT_TYPE_PAD )
      {
         VDP_drawText ( "PLEASE, REBOOT YOUR SYSTEM", 7, 19 );

         while ( 1 );
      }

      _start_entry(); // even more reset
   }


   sd_reset();
   SYS_assertReset(); // makes gensKmod crash, WTF?!



   VDP_init();
   //JOY_init();  // can cause mouse + justifer issues

   h_scroll = 0;
   VDP_setScrollingMode ( HSCROLL_PLANE, VSCROLL_PLANE );     /* The scroll mode never change during the game */
   VDP_setPlanSize(64,32);

   save_init( );

   SPR_init(0);                                             /* Sprite Engine INIT */
   VDP_setPalette(PAL3, sprpal.data);                       /* Sprite Palette (never change during the game) */

   /* PAD & Mouse (PORT_1) & Lightgun (PORT_2) Support */
   _JOYint ( TRUE );
   LightgunInit ( PORT_2 );

   VINT_SCROLL_FLAG  = FALSE;
   VINT_JOY_UPDATE   = FALSE;

   SYS_setVIntCallback((_voidCallback*) VIntCallback);

   FIRST_TIME_FLAG = TRUE;
}
Exemplo n.º 3
0
Arquivo: main.c Projeto: clbr/SGDK
int main()
{
    u16 i, j;
    const driver_def *cur_driver;
    const cmd_def *cur_cmd;

    JOY_setEventHandler(joyEvent);

    VDP_setScreenWidth320();
    VDP_setHInterrupt(0);
    VDP_setHilightShadow(0);
    SYS_setVIntCallback(vintEvent);

    // point to first driver
    driver = &drivers[0];
    cmd = NULL;
    dmaMethod = 0;

    for(i = 0, cur_driver = drivers; i < NUM_DRIVER; i++, cur_driver++)
        for(j = 0, cur_cmd = cur_driver->cmds; j < MAX_CMD; j++, cur_cmd++)
            params_value[i][j] = cur_cmd->params;

    VDP_setPalette(PAL0, font_pal_lib.data);
    VDP_setPaletteColor((PAL1 * 16) + 15, 0x0888);
    VDP_setTextPalette(PAL0);
    VDP_drawText("Current Z80 driver", 10, 1);
    VDP_drawText("DMA Method:", 1, 26);

    refreshDriverInfos();


    while(1)
    {
        VDP_waitVSync();
    }
}