Esempio n. 1
0
//------------------------------------------------------------------------------
// Public Functions:
//------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	// System Initialize
	System_Initialize(hInstance, nCmdShow);

	// GSM Initialize
	GSM_Initialize(GS_L1);

	// Game Flow
	while(Current != GS_Quit)
	{
	if(Current == GS_Restart)
	{
	Current = Previous;
	Next = Previous;
	}
	else
	{
	// GSM Update
	GSM_Update(Current);
	pLoad();
	}

	pIni();

	// Game Loop
	while(Current == Next)
	{
	AESysFrameStart();
	//Input_Handle();  »Øµ÷º¯Êý
	pUpdate();
	pDraw();
	AESysFrameEnd();
	}

	pFree();

	if(Next != GS_Restart)
	pUnload();

	Previous = Current;
	Current = Next;
	}

	// System Exit
	system("pause");
	System_Exit();

	return 0;
}
Esempio n. 2
0
void main(void)
{
	System_Initialize();

	GSM_Initialize(1);

	while (Current != Quit)
	{

		FrameInitialization();

		if (Current == Restart)
		{
			Current = Previous;
			Next = Previous;
		}
		else
		{
			GSM_Update();
			pLoad();
		}

		pInitialize();

		while (Current == Next)
		{
			FrameControllerStart();
			Input_Handle();
			pUpdate();
			pDraw();
			FrameControllerEnd();
		}

		pFree();

		if (Next != Restart)
		{
			pUnload();
		}

		Previous = Current;
		Current = Next;
	}

	System_Exit();
}
Esempio n. 3
0
int main()
{
	int i,k,ipl_mode=1;
	//UINT r;

	// Initialize Disk I/F and ROM
	System_Initialize();

	/* Event loop never exits. */
	while (1){
		// IPL
		if(ipl_mode==1){
			// System Program Load
			IPL();
			// Start MZ
			MZ_release();
			ipl_mode=0;
		}

		// CMT Control
		if((z80_sts.status&S_CMT)==S_CMT){
			z80_sts.status&=~S_CMT;
			// Eject and Set Tape
			if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_OPEN)==C_OPEN){
				IOWR_8DIRECT(REG_BASE, MZ_CMT_STATUS, C_OPEN);
				tape_unmount();
				fname[0]='\0';
				key0(settape);
				z80_sts.status|=S_FBTN;	// Set Flag
				MZ_Brequest();
				menu_process();
				MZ_Brelease();
				z80_sts.status&=~S_FBTN;	// Clear Flag
			}
			// Load
			if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_PLAY)==C_PLAY){
				IOWR_8DIRECT(REG_BASE, MZ_CMT_STATUS, C_PLAY);
				IOWR_8DIRECT(REG_BASE, MZ_CMT_CTRL, C_MTON+C_TAPE);	// Motor On
				cmtload();
			}
			// Rewind
			if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_REW)==C_REW){
				if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_APSS)==C_APSS){
					apss_r();
				} else {
					tape_rewind();
					IOWR_8DIRECT(REG_BASE, MZ_CMT_STATUS, C_REW);
				}
			}
			// F.Forward
			if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_FF)==C_FF){
				if((IORD_8DIRECT(REG_BASE, MZ_CMT_STATUS)&C_APSS)==C_APSS){
					apss_f();
				} else {
					IOWR_8DIRECT(REG_BASE, MZ_CMT_STATUS, C_FF);
				}
			}
		}

		// Function Button
		if((z80_sts.status&S_FBTN)==S_FBTN){
			MZ_Brequest();
			menu_process();
			MZ_Brelease();
			z80_sts.status&=~S_FBTN;
		}

		// BST check
		if((IORD_8DIRECT(REG_BASE, MZ_SYS_STATUS)&S_BST)==S_BST){
			ipl_mode=1;
		}

		// Quick Load/Save
//		if((z80_sts.status&0x02)==0x02){
//			if(IORD(CMT_0_BASE, 3)==0x0f){	// CMD is Load
//				IOWR(CMT_0_BASE, 2, 0x80);	// set STAT busy

				// Wait for confirm busy by Z80
//				while(IORD(CMT_0_BASE, 3)!=0);

//				if(tname[0]=='\0'){	// if tape file is empty
//					z80_sts.status=0x03;
//					// Z80-Bus request
//					MZ_Brequest();
//					key0(settape);
//					k=menu(0,0,0);	// Root menu
//					// Z80-Bus release
//					MZ_Brelease();
//					z80_sts.status=0x02;
//					if(k!=10){
//						z80_sts.status=0;
//						IOWR(CMT_0_BASE, 2, 0xff);	// set STAT error
//						continue;
//					}
//					//keybuf_clear();
//					strcpy(tname, fname);
//					IOWR(CMT_0_BASE, 1, 1);
//					ql_pt=0;
//				}

//				quick_load();
//				IOWR(CMT_0_BASE, 2, 0);	// set STAT free
//				z80_sts.status&=0xfffffffd;
//			}

//			if(IORD(CMT_0_BASE, 3)==0xf0){	// CMD is Save
//				IOWR(CMT_0_BASE, 2, 0x80);	// set STAT busy

//				// Wait for confirm busy by Z80
//				while(IORD(CMT_0_BASE, 3)!=0);

//				if(tname[0]=='\0'){	// if tape file is empty
//					// Z80-Bus request
//					MZ_Brequest();
//					i=input_file_name();
//					// Z80-Bus release
//					MZ_Brelease();
//					if(tname[0]=='\0'||i<0){
//						z80_sts.status=0;
//						IOWR(CMT_0_BASE, 2, 0xff);	// set STAT error
//						continue;
//					}
//					keybuf_clear();
//					IOWR(CMT_0_BASE, 1, 1);
//				}

//				if(quick_save()!=FR_OK)
//					IOWR(CMT_0_BASE, 2, 0xff);	// set STAT error
//				else
//					IOWR(CMT_0_BASE, 2, 0);	// set STAT free
//				z80_sts.status&=0xfffffffd;
//			}
// 		}
	}

	return 0;
}
Esempio n. 4
0
//Entry point of the application
int WINAPI WinMain(HINSTANCE instance, HINSTANCE hPreviousInstance, LPSTR command_line, int show)
{
	WNDCLASS wc;
	HWND hWnd;
	MSG msg;

	wc.style = CS_HREDRAW | CS_VREDRAW;							/*Class style*/
	wc.lpfnWndProc = WinProc;									/*A function pointer which should point to the procedure function. Remember that the procedure function handles the window messages*/
	wc.cbClsExtra = 0;											/*The number of extra bytes you want to allocate for this window class structure. The default value is 0*/
	wc.cbWndExtra = 0;											/*The number of extra bytes you want to allocate for the window instance*/
	wc.hInstance = instance;									/*Instance of the module associated with the window. This is the 1st paramter passed to the WinMain function*/
	wc.hIcon = LoadIcon(NULL, IDI_EXCLAMATION);					/*Handle to the icon class which will be displayed on the top left part of the window*/
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);					/*Handle to the cursor class which will be used in this window class*/
	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);		/*Handle to the class background brush. It can be a color value*/
	wc.lpszMenuName = NULL;										/*Pointer to a null terminated string which specifies the name of the menu resources used by this window class (if any)*/
	wc.lpszClassName = "Window Class Name";						/*String that specifies thw window class name. This is needed to create any window based on this window class*/

	RegisterClass(&wc);


	hWnd = CreateWindow(wc.lpszClassName,			/*The class name we chose for the window class*/
		"Win32 Sample",								/*The window caption*/
		WS_OVERLAPPEDWINDOW,						/*The style of the window, which determines if the window will have a minimize/maximize buttons, if its frame is thick or not.. */
		200,										/*The X position of the top left corner of the window. Remember that (0,0) is the top left of the monitor*/
		100,										/*The Y position of the top left corner of the window. Remember that (0,0) is the top left of the monitor*/
		640,										/*The width of the window*/
		480,										/*The heiht of the window*/
		NULL,										/*Handle to the parent window (in case this was a child window)*/
		NULL,										/*Handle to a menu (In case there is a menu for this window)*/
		instance,									/*Instance of the module associated with the window. This is the 1st paramter passed to the WinMain function*/
		NULL);										/*Pointer to a value sent to the window in the WM_CREATE message*/
	ShowWindow(hWnd, show);
	UpdateWindow(hWnd);

	UnregisterClass(wc.lpszClassName, instance);

	System_Initialize();

	GSM_Initialize(1);

	while (Current != Quit)
	{

		while (GetMessage(&msg, NULL, 0, 0))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}


		FrameInitialization();

		if (Current == Restart)
		{
			Current = Previous;
			Next = Previous;
		}
		else
		{
			GSM_Update();
			pLoad();
		}

		pInitialize();

		while (Current == Next)
		{
			FrameControllerStart();
			Input_Handle();
			pUpdate();
			pDraw();
			FrameControllerEnd();
		}

		pFree();

		if (Next != Restart)
		{
			pUnload();
		}

		Previous = Current;
		Current = Next;
	}

	System_Exit();


	return (int)msg.wParam;
}