#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); / * Frame change interval * / / * Set to 2/60 seconds * /
for(;;){ memcpy(vram,command,sizeof(command)); / * Set sprite command in VRAM * /
-------- / * Scroll data set * / SCL_DisplayFrame (); / * Wait for V-BLANK interrupt * / / * Display sprite and scroll * / } }
−V blank processing routine (source file different from the above main) −
#include
#include "sega_spr.h" #include "sega_scl.h" #pragma interrupt(VbStart) #pragma interrupt(VbEnd)
void VbStart(void) { SCL_VblankStart (); / * V blank start VDP interrupt handling * /