★ PROGRAMMER'S GUIDE ★ VDP1 library/ * ------------------------------------------ * 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 calculated polygons * / extern int dbgDrawPol; / * Number of drawing polygons * /
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 sprites * /
INT_ChgMsk (INT_MSK_NULL, INT_MSK_VBL_IN | INT_MSK_VBL_OUT);
/ * Disable V-BLANK interrupts * /
INT_SetFunc (INT_SCU_VBLK_IN, & vbStart);
/ * Registration of V-BLANK IN interrupt routine * /
INT_SetFunc (INT_SCU_VBLK_OUT, & vbEnd);
/ * Registration of 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 in VRAM * /
-------- / * Scroll dataset * /
SCL_DisplayFrame (); / * Waiting for V-BLANK interrupt * /
/ * Sprite display and scrolling * /
}
}
−V Blank processing routine (source file different from the above main) −
#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