Exemplo n.º 1
0
void *Util_realloc(void *ptr, size_t size)
{
	ptr = realloc(ptr, size);
	if (ptr == NULL) {
		Atari800_Exit(FALSE);
		printf("Fatal error: out of memory\n");
		exit(1);
	}
	return ptr;
}
Exemplo n.º 2
0
void *Util_malloc(size_t size)
{
	void *ptr = malloc(size);
	if (ptr == NULL) {
		Atari800_Exit(FALSE);
		printf("Fatal error: out of memory\n");
		exit(1);
	}
  memset(ptr, 0, size);
	return ptr;
}
Exemplo n.º 3
0
static RETSIGTYPE sigint_handler(int num)
{
	int restart;

	restart = Atari800_Exit(TRUE);
	if (restart) {
		signal(SIGINT, sigint_handler);
		return;
	}

	exit(0);
}
Exemplo n.º 4
0
void Palette_SetVideoSystem(int mode) {
  if (mode == TV_NTSC) {
    colortable = colortable_ntsc;
    color_settings = &color_settings_ntsc;
  }
  else if (mode == TV_PAL) {
    colortable = colortable_pal;
    color_settings = &color_settings_pal;
  }
  else {
    Atari800_Exit(FALSE);
    Aprint("Interal error: Invalid tv_mode\n");
    exit(1);
  }
}
Exemplo n.º 5
0
static BOOL CtrlHandler(DWORD fdwCtrlType)
{
	switch (fdwCtrlType)
	{
	case CTRL_CLOSE_EVENT:
	case CTRL_BREAK_EVENT:
	case CTRL_LOGOFF_EVENT:
	case CTRL_SHUTDOWN_EVENT:
		/* Perform a normal exit. */
		Atari800_Exit(FALSE);
	case CTRL_C_EVENT:
		/* Ctrl+C is handled in atari.c */
		return TRUE;
	default:
		return FALSE;
	}
}
Exemplo n.º 6
0
int main(int argc, char **argv)
{
    /* initialise Atari800 core */
    if (!Atari800_Initialise(&argc, argv))
        return 3;

    /* main loop */
    for (;;) {
        INPUT_key_code = PLATFORM_Keyboard();
        Atari800_Frame();
        if (Atari800_display_screen)
            PLATFORM_DisplayScreen();
        if (JAVANVM_CheckThreadStatus()) {
            Atari800_Exit(FALSE);
            exit(0);
        }
    }
}
Exemplo n.º 7
0
// Used where necessary to keep UI 
// responsive to system events 
void DoEvents()
{
	MSG msg;
	msg.message = WM_NULL; 
	
	PLATFORM_DisplayScreen();
	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
	{
		if (msg.message == WM_QUIT) 
		{
			PostQuitMessage(10);
			Atari800_Exit(FALSE);
			exit(0);
		}
		else
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{
	/* initialise Atari800 core */
	if (!Atari800_Initialise(&argc, argv))
		return 3;

	/* main loop */
	while (TRUE) {
		int refresh_counter = 0;
		int keycode = Atari_Keyboard();

		switch (keycode) {
		case AKEY_COLDSTART:
			Coldstart();
			break;
		case AKEY_WARMSTART:
			Warmstart();
			break;
		case AKEY_EXIT:
			Atari800_Exit(FALSE);
			exit(1);
		case AKEY_UI:
#ifdef SOUND
			Sound_Pause();
#endif
			ui((UBYTE *)atari_screen);
#ifdef SOUND
			Sound_Continue();
#endif
			break;
		case AKEY_SCREENSHOT:
			Save_PCX_file(FALSE, Find_PCX_name());
			break;
		case AKEY_SCREENSHOT_INTERLACE:
			Save_PCX_file(TRUE, Find_PCX_name());
			break;
		case AKEY_BREAK:
			key_break = 1;
			break;
		default:
			key_break = 0;
			key_code = keycode;
			break;
		}

		if (mouse_mode != MOUSE_OFF) {
			union REGS rg;
			rg.x.ax = 0x0b;
			int86(0x33, &rg, &rg);
			mouse_delta_x = (short) rg.x.cx;	/* signed! */
			mouse_delta_y = (short) rg.x.dx;	/* signed! */
			rg.x.ax = 0x03;
			int86(0x33, &rg, &rg);
			mouse_buttons = rg.x.bx;
		}

		if (++refresh_counter == refresh_rate) {
			Atari800_Frame(EMULATE_FULL);
#ifndef DONT_SYNC_WITH_HOST
			atari_sync(); /* here seems to be the best place to sync */
#endif
			update_disk_led();
			Atari_DisplayScreen((UBYTE *) atari_screen);
			refresh_counter = 0;
		}
		else {
#ifdef VERY_SLOW
			Atari800_Frame(EMULATE_BASIC);
#else	/* VERY_SLOW */
			Atari800_Frame(EMULATE_NO_SCREEN);
#ifndef DONT_SYNC_WITH_HOST
			atari_sync();
#endif
#endif	/* VERY_SLOW */
		}
	}
}