int main() { VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); BMP_init(TRUE, PAL0, FALSE); RSE_Logo3DScreen(); }
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(); } }
int main() { char col; JOY_setEventHandler(joyEvent); VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); BMP_init(TRUE, PLAN_A, PAL0, FALSE); paused = 0; col = 0xFF; /* Initialise particules */ baseposx = intToFix16(BMP_WIDTH / 2); baseposy = intToFix16(BMP_HEIGHT / 2); gravity = FIX16(0.4); initPartic(100); /* Do main job here */ while(1) { char str[8]; handleInput(); if (!paused) { // calculates particules physic updatePartic(partics, numpartic); // ensure previous flip buffer request has been started BMP_waitWhileFlipRequestPending(); // can now draw text BMP_showFPS(0); // display particul number intToStr(numpartic, str, 1); BMP_clearText(1, 3, 4); BMP_drawText(str, 1, 3); // display gravity fix16ToStr(gravity, str, 2); BMP_clearText(1, 4, 5); BMP_drawText(str, 1, 4); // clear bitmap BMP_clear(); // draw particules drawPartic(partics, numpartic, col); // swap buffer BMP_flip(1); } else { BMP_drawText("PAUSE", 1, 4); } } }
int main() { char str[16]; VDP_setScreenWidth256(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); // speed up controller checking JOY_setSupport(PORT_1, JOY_SUPPORT_6BTN); JOY_setSupport(PORT_2, JOY_SUPPORT_OFF); JOY_setEventHandler(handleJoyEvent); BMP_init(TRUE, PAL0, FALSE); camdist = FIX16(15); M3D_reset(); M3D_setCamDistance(camdist); M3D_setLightEnabled(1); M3D_setLightXYZ(FIX16(0.9), FIX16(0.9), FIX16(-0.9)); // allocate translation and rotation structure M3D_setTransform(&transformation, &translation, &rotation); M3D_setTranslation(&transformation, FIX16(0), FIX16(0), FIX16(20)); M3D_setRotation(&transformation, FIX16(0), FIX16(0), FIX16(0)); flatDrawing = 0; while (1) { doActionJoy(JOY_1, JOY_readJoypad(JOY_1)); M3D_setCamDistance(camdist); // do work here rotation.x += rotstep.x; rotation.y += rotstep.y; rotation.z += rotstep.z; transformation.rebuildMat = 1; updatePointsPos(); // ensure previous flip buffer request has been started BMP_waitWhileFlipRequestPending(); BMP_showFPS(1); BMP_clear(); drawPoints(0xFF); BMP_drawText("trans z:", 0, 2); fix16ToStr(translation.z, str, 2); BMP_drawText(str, 10, 2); BMP_drawText("cam dist:", 0, 3); fix16ToStr(camdist, str, 2); BMP_drawText(str, 11, 3); BMP_flip(1); } }
int main() { u16 i, newJoy = 0, oldJoy = 0, autoRepeatDelay = 0, redraw = 1; s16 choice = 0; const char *str; struct FileSystem fs; u16 numFiles; // Init the screen, display message VDP_setScreenWidth320(); VDP_setHInterrupt(0); VDP_setHilightShadow(0); VDP_setTextPalette(PAL0); VDP_drawText("MakeStuff USB MegaDrive Dev Kit v2", 3, 10); VDP_drawText("Reading SD-card...", 11, 12); // Initialise the SD card sdInit(); // Get the geometry of the first SD-card partition fatOpenFileSystem(&fs); // Initialise workspace for the directory list initFiles((u16*)0x440000); // Get the list of game ROMs fatListDirectory(&fs, fs.rootDirCluster, storeFile); // Sort the list alphabetically numFiles = dirPtr - dirList; quickSort((CVPtr *)dirList, 0, numFiles, (CompareFunc)myFileComp); // Display the list for ( ; ; ) { newJoy = JOY_readJoypad(0); if ( newJoy & BUTTON_UP && choice > 0 ) { if ( !(oldJoy & BUTTON_UP) ) { choice--; redraw = 1; autoRepeatDelay = 0; } else { if ( autoRepeatDelay == 10 ) { choice--; redraw = 1; } else { autoRepeatDelay++; } } } if ( newJoy & BUTTON_DOWN && choice < numFiles-1 ) { if ( !(oldJoy & BUTTON_DOWN) ) { choice++; redraw = 1; autoRepeatDelay = 0; } else { if ( autoRepeatDelay == 10 ) { choice++; redraw = 1; } else { autoRepeatDelay++; } } } if ( newJoy & BUTTON_START ) { doSelect(&fs, choice); } oldJoy = newJoy; VDP_waitVSync(); if ( redraw ) { VDP_clearPlan(VDP_PLAN_A, 1); VDP_waitDMACompletion(); for ( i = 2; i < 26; i++ ) { if ( i >= 11-choice && i < numFiles-choice+11 ) { str = dirList[choice+i-11]->fileName; if ( i == 11 ) { VDP_setTextPalette(PAL1); VDP_drawText(str, 2, i); VDP_setTextPalette(PAL0); } else { VDP_drawText(str, 2, i); } } } } redraw = 0; } }