示例#1
0
int main()
{
	VDP_setScreenWidth256();
	VDP_setHInterrupt(0);
	VDP_setHilightShadow(0);

	BMP_init(TRUE, PAL0, FALSE);

	RSE_Logo3DScreen();
}
示例#2
0
void bios_boot_demo(void)
{
	VDP_clearPlan(VDP_PLAN_A, 0);
	VDP_clearPlan(VDP_PLAN_B, 0);

	VDP_setHInterrupt(0);
	term_print("  ___   ___  ___   ___     ___   ___       ___  ___     ___", 1);
	term_print(" |___  |__  |  _  |___|   |  _  |__  |\\ | |__  |___  | |___ ", 1);
	term_print("  ___| |___ |___| |   |   |___| |___ | \\| |___  ___| |  ___|", 1);
	term_print("", 20);
	term_print(" Entry Vector 0x202", 2);
	term_print(" CSHBIOS(C)2016 Computer Science House", 2);
	term_print(" MD-VA6 BOOT ROM Revision 3", 30);
	term_print("", 0);
	term_print(" CPU1 : Motorola 68000 7.6MHz", 2);
	term_print("   Speed : 7.61 MHz", 2);
	term_print("", 0);
	term_print(" CPU2 : Zilog Z80 3.8MHz", 2);
	term_print("   Speed : 3.80 MHz", 60);
	term_print("", 0);

	term_print(" Press DEL to run Setup", 0);
	term_print(" Press <F8> for BBS POPUP", 170);
	term_print("", 0);

	term_print(" SRAM Asynchronous 2 x 65256 (64k x 8), single channel, parallel", 16);
	term_print("  Checking SRAM...", 60);
	term_print(" 8K  OK", 7);
	term_print(" 16K OK", 7);
	term_print(" 24K OK", 7);
	term_print(" 32K OK", 7);
	term_print(" 40K OK", 7);
	term_print(" 48K OK", 7);
	term_print(" 56K OK", 7);
	term_print(" 64K OK", 60);
	term_print("", 0);

	term_print(" VDP : Sega 315-5313 (Yamaha YM7101)", 2);
	term_print("   Speed: 56MHz", 2);
	term_print("   VRAM: 64K Serial Out Parallel Load DRAM", 2);
	term_print("   CRAM: 64 x 9", 2);
	term_print("   TMSS Enabled", 1);
	term_print("", 60);
	term_print(" 0xC00000 : Data Port", 20);
	term_print(" 0xC00004 : Control Port", 20);
	term_print(" 0xC00008 : H/V counter", 20);
	term_print(" 0xC00011 : SN76489", 20);
	term_print(" 0xC0001C : Debug Register", 70);
	term_print("", 0);
	term_print(" Starting demo...", 120);
}
示例#3
0
void startup_stretch(void)
{
	SYS_setHIntCallback((_voidCallback *)h_int_scroll);
	VDP_setHIntCounter(3);
	VDP_setHInterrupt(1);


	u16 counter = 240;
	while (counter--)
	{
		while (vbl_wait)
		{	
			__asm__("nop");
		}
		VDP_setHInterrupt(0);
		VDP_setPaletteColor(14,palette[counter % 32]);
		vbl_wait = 1;
		counter--;
		scroll_off = 0;
		dscroll = counter / 4;
		VDP_setHInterrupt(1);
	}
	VDP_setHInterrupt(0);
}
示例#4
0
文件: main.c 项目: clbr/SGDK
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();
    }
}
示例#5
0
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);
        }
    }
}
示例#6
0
int main(void)
{
	music_init();
	music_play(3);
	u16 delay_mod = 4;
	u16 col_inc_cnt = 0;
	setup();
reset_demo:

		hint_val = 3;
	col = 0;
	col_off = 0;
	phrase_num = 0;
	scroll_off = 0;
	dscroll = 0;
	term_pos = 0;
	term_scrolling = 0;

	sprites_dma_simple();
	term_pos = 0;
	VDP_setHInterrupt(0);

	VDP_clearPlan(VDP_PLAN_A, 0);
	VDP_clearPlan(VDP_PLAN_B, 0);
	// Greyscale palette for text
	VDP_setPaletteColor(0,0x000);
	VDP_setPaletteColor(1,0x444);
	VDP_setPaletteColor(2,0x888);
	VDP_setPaletteColor(3,0xEEE);

	VDP_setScreenWidth256();
	bios_boot_demo();
	VDP_setScreenWidth320();
	VDP_clearPlan(VDP_PLAN_A, 0);
	VDP_clearPlan(VDP_PLAN_B, 0);


	awful_put_logo(8, 2);
	startup_stretch();

	VDP_setVerticalScroll(PLAN_A, 252);
	VDP_setVerticalScroll(PLAN_B, 252);

	VDP_setHIntCounter(hint_val);
	SYS_setHIntCallback((_voidCallback *)h_int);
	volatile u8 p1 = pad_read(0);
	sprites_init();

	col_puts40(8,0,"Computer Science House");

	// Initialize background stars
	star stars[NUM_STARS];
	u16 i = 0;
	for (i = 0; i < NUM_STARS; i++)
	{
		stars[i].x = i * 5;
		stars[i].y = 128 + i * 8;
		stars[i].speed = (i % 7) + 1;
		stars[i].offset = (3 * i) % 4;
		stars[i].size = (i % 4 == 0) ? ('.' + COL_FONT_VRAM_OFFSET) : (128 + '.' + COL_FONT_VRAM_OFFSET);
	}

	print_phrase(8);
	u16 delay = 0;
	u8 dir = 0;
	VDP_setHInterrupt(1);
	for (;;)
	{
		delay++;
		if (col_inc_cnt == 0)
		{
			col_inc_cnt = hint_val;
			col_off += 0x002;
		}
		else
		{
			col_inc_cnt--;
		}
		if (delay == 512)
		{
			if (phrase_num == 8)
			{
				phrase_num = 0;

				VDP_setHInterrupt(0);
				sprite_set(0, 0, 0, 0, 0, 0);
				sprites_dma_simple();
				while (vbl_wait)
		{	
			__asm__("nop");
		}

		vbl_wait = 1;
				goto reset_demo;
			}
			hint_val++;
			if (hint_val == 10)
			{
				hint_val = 3;
			}
			delay_mod = delay_mod >> 1;
			if (delay_mod == 0)
			{
				delay_mod = delay_mod = 4;
			}
			VDP_setHIntCounter(hint_val);
			VDP_setHInterrupt(0);
			print_phrase(phrase_num);
			VDP_setHInterrupt(1);
			phrase_num++;

			delay = 0;
		}	
		process_stars(&stars);
		while (vbl_wait)
		{	
			__asm__("nop");
		}
		VDP_setHInterrupt(0);
		VDP_setPaletteColor(14,palette[col]);
		col = col_off;
		vbl_wait = 1;
		sprites_dma_simple();
		VDP_setHInterrupt(1);
	}
	return 0;	
}
示例#7
0
文件: main.c 项目: kubilus1/SGDK
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);
    }
}
示例#8
0
文件: main.c 项目: MintyTheCat/umdkv2
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;
	}
}