/*--------------------------------------- * Select 3D & Sprite Execute Environment *----------------------------------------*/ #define SPR_SYNC_VB_OUT #define USE_SLAVE #define USE_DSP #define USE_INBETWEEN_OBJECT #define USE_DEBUG_INFO
extern int dbgComputePol; /* Number of calculation polygons */ extern int dbgDrawPol; /* Number of polygons to draw */
This variable is already defined in sega_spr.h .
#include< machine.h>
#include "saga_spr.h"
#include "sega_scl.h"
#include "sega_int.h"
extern void vbStart(void); /* V-BLANK IN interrupt routine */
extern void vbEnd(void); /* V-BLANK OUT interrupt routine */
main()
{
Uint8 *vram; /* VRAM address storage area */
set_imask(0); /* Enable interrupts */
SCL_Vdp2Init(); /* Scroll and priority initialization */
SCL_SetPriority(SCL_SP0|SCL_SP1|SCL_SP2|SCL_SP3|SCL_SP4|
SCL_SP5|SCL_SP6|SCL_SP7,7);
SCL_SetSpriteMode(SCL_TYPE1,SCL_MIX,SCL_SP_WINDOW);
SPR_Initial(&vram); /* Initialize sprite */
INT_ChgMsk(INT_MSK_NULL, INT_MSK_VBL_IN | INT_MSK_VBL_OUT);
/* Disable V-BLANK interrupt */
INT_SetFunc(INT_SCU_VBLK_IN, &vbStart);
/* Register V-BLANK IN interrupt routine */
INT_SetFunc(INT_SCU_VBLK_OUT, &vbEnd);
/* Register V-BLANK OUT interrupt routine */
INT_ChgMsk(INT_MSK_VBL_IN | INT_MSK_VBL_OUT, INT_MSK_NULL);
/* Enable V-BLANK interrupt */
SCL_SetFrameInterval(2); /* Set frame change interval */
/* set to 2/60 seconds */
for(;;){
memcpy(vram,command,sizeof(command));
/* Set sprite command to VRAM */
-------- /* Scroll data set */
SCL_DisplayFrame(); /* Waiting for V-BLANK interrupt */
/* Display sprite and perform scrolling */
}
}
−V blank processing routine (source file separate from the main above) −
#include< machine.h>
#include "sega_spr.h"
#include "sega_scl.h"
#pragma interrupt(VbStart)
#pragma interrupt(VbEnd)
void VbStart(void)
{
SCL_VblankStart(); /* V blank start VDP interrupt processing */
-------- /* Other V blank start processing */
}
void VbEnd(void)
{
SCL_VblankEnd(); /* V blank end VDP interrupt processing */
-------- /* Other V blank end processing */
}
★ PROGRAMMER'S GUIDE ★ VDP1 library