#define SCREEN_PAGES 2 static ScreenContext screen; CreateBasicDisplay(&screen, DI_TYPE_DEFAULT, SCREEN_PAGES); |
static Item bitmapItems[SCREEN_PAGES]; static Bitmap *bitmaps[SCREEN_PAGES]; for(i=0; i<SCREEN_PAGES; i++) { bitmapItems[i] = screen.sc_BitmapItems[i]; bitmaps[i] = screen.sc_Bitmaps[i]; } |
void clearScreen(ubyte test) { Bitmap *screenBmp = bitmaps[visibleScreenPage]; memset((unsigned char*)screenBmp->bm_Buffer, test, screenBmp->bm_Width * screenBmp->bm_Width * 2); } |
void display() { DisplayScreen(screen.sc_Screens[visibleScreenPage], 0 ); visibleScreenPage = (visibleScreenPage + 1) % SCREEN_PAGES; } |
static Item VRAMIOReq; static IOInfo ioInfo; |
VRAMIOReq = CreateVRAMIOReq(); |
void initSPORTwriteValue(unsigned value) { memset(&ioInfo,0,sizeof(ioInfo)); ioInfo.ioi_Command = FLASHWRITE_CMD; ioInfo.ioi_CmdOptions = 0xffffffff; ioInfo.ioi_Offset = value; // background colour ioInfo.ioi_Recv.iob_Buffer = bitmaps[visibleScreenPage]->bm_Buffer; ioInfo.ioi_Recv.iob_Len = SCREEN_SIZE_IN_BYTES; } |
void initSPORTcopyImage(ubyte *srcImage) { memset(&ioInfo,0,sizeof(ioInfo)); ioInfo.ioi_Command = SPORTCMD_COPY; ioInfo.ioi_Offset = 0xffffffff; // mask ioInfo.ioi_Send.iob_Buffer = srcImage; ioInfo.ioi_Send.iob_Len = SCREEN_SIZE_IN_BYTES; ioInfo.ioi_Recv.iob_Buffer = bitmaps[visibleScreenPage]->bm_Buffer; ioInfo.ioi_Recv.iob_Len = SCREEN_SIZE_IN_BYTES; } |
void display() { DisplayScreen(screen.sc_Screens[visibleScreenPage], 0 ); visibleScreenPage = (visibleScreenPage + 1) % SCREEN_PAGES; ioInfo.ioi_Recv.iob_Buffer = bitmaps[visibleScreenPage]->bm_Buffer; DoIO(VRAMIOReq, &ioInfo); } |
backgroundBufferPtr = LoadImage("data/background.img", NULL, (VdlChunk **)NULL, &screen); |