コード例 #1
0
ファイル: main.c プロジェクト: gsrr/Python
int main(int argc, char **argv)
{
	setcfgfilename(argv[0]);
	readoptions();
	timer_init();
	atexit(cleanup);
#if UNIX
	signal(SIGINT, finish);
#endif
	gettermsize();
	getlang();
	if (argc > 1) {
#if ALLEGRO && WIN32 && !ALLEGRO_USE_CONSOLE
		freopen("stdout.tmp", "w", stdout);
#endif
		proc_args(argv+1, argc-1);
	}
	gettermoptions();
#ifdef SOCKET
	startup(socket_fd>0 ? 2+is_inet() : 0);
#else
	startup(0);
#endif
#if !NO_MENU
	writeconfig_message();
#endif
	return 0;
}
コード例 #2
0
ファイル: main.c プロジェクト: gsrr/Python
static void setupgame(int i)
{
	allocgame(i & 2);
	initgame();
#if !NO_MENU
	if (!in_menu)
		goto skipmenu;
	while (gamemenu()) {
		in_menu = 0;
		rm_invitfile();
skipmenu:
#endif
		writeconfig();
		do textgfx_entergame();
		while (startgame());
#if !NO_MENU
		clearwin(0);
		in_menu = 1;
		textgfx_entermenu();
		readoptions();
	}
	inputdevs_player[0] = 0;
# ifdef SOCKET
	rmsocket();
	mk_invitfile();
# endif
#endif
	game = NULL;
}
コード例 #3
0
ファイル: restdist.c プロジェクト: OS2World/APP-SCIENCE-LVB
void inputoptions()
{
  /* read the options information */
  Char ch;
  long i, extranum, cursp, curst;

  if (!firstset) {
    if (eoln(infile)) {
      fscanf(infile, "%*[^\n]");
      getc(infile);
    }
    fscanf(infile, "%ld%ld", &cursp, &curst);
    if (cursp != spp) {
      printf("\nERROR: INCONSISTENT NUMBER OF SPECIES IN DATA SET %4ld\n",
             ith);
      exxit(-1);
    }
    sites = curst;
  }
  for (i = 1; i <= sites; i++)
    weight[i] = 1;
  weightsum = sites;
  extranum = 0;
  fscanf(infile, "%*[ 0-9]");
  readoptions(&extranum, "W");
  for (i = 1; i <= extranum; i++) {
      matchoptions(&ch, "W");
      inputweights2(1, sites+1, &weightsum, weight, &weights, "RESTDIST");
  }
}  /* inputoptions */
コード例 #4
0
ファイル: conunix.cpp プロジェクト: cunhalima/cgcam
void SYS_ReadOptions(int argc, char **argv) {
    readoptions(argc, argv);

    // FIXME: should read from cmfline
    opt.client = true;
    opt.server = true;
    opt.xres = 640;
    opt.yres = 400;
    opt.fullscreen = false;

}
コード例 #5
0
ファイル: conwin.cpp プロジェクト: cunhalima/cgcam
void SYS_ReadOptions(int argc, char **argv) {
	// if no console arguments, read them from INI
	readoptions(argc, argv);

	// FIXME: should read from INI
	opt.client = true;
	opt.server = true;
	//opt.xres = 1366;
	//opt.yres = 768;
	opt.xres = 640;
	opt.yres = 400;
	opt.fullscreen = false;
	//opt.forceGL21 = true;
}
コード例 #6
0
ファイル: stub.c プロジェクト: BR903/cmdline
int main(int argc, char *argv[])
{
    char	buf[256];
    int		n;

    if (argc == 1) {
	while (fgets(buf, sizeof buf - 1, stdin)) {
	    makecmdline(buf, &argc, &argv);
	    for (n = argv[0] ? 0 : 1 ; n < argc ; ++n)
		printf("arg %d == <%s>\n", n, argv[n]);
	    if (argv[argc])
		printf("arg %d == <%s> !!\n", argc, argv[argc]);
	}
    } else {
	n = readoptions(options, argc, argv, optcallback, NULL);
	if (n)
	    printf("readoptions returned %d\n", n);
    }

    return 0;
}
コード例 #7
0
ファイル: cpp1.c プロジェクト: Echo360/LibreOffice-core
int MAIN(int argc, char** argv)
{
    int    i;
    char** useargv;
    char** pfargv;

    if( nRunde == 0 )
    {
        pCppIn = stdin;
        pCppOut = stdout;
    }

    nRunde++;
    InitCpp1();
    InitCpp2();
    InitCpp3();
    InitCpp4();
    InitCpp5();
    InitCpp6();

#if HOST == SYS_VMS
    argc = getredirection(argc, argv);      /* vms >file and <file  */
#endif
    initdefines();                          /* O.S. specific def's  */
    if ( argv[argc-1][0] == '@' )
    {
        i = readoptions( argv[1], &pfargv );    /* Command file */
        useargv=pfargv;
    }
    else
    {
        i = dooptions(argc, argv);              /* Command line -flags  */
        useargv=argv;
    }
    switch (i)
    {
#if OSL_DEBUG_LEVEL > 1
    case 4:
        if ( bDumpDefs )
        {
            /*
             * Get defBase file, "-" means use stdout.
             */
            if (!streq(useargv[3], "-"))
            {
#if HOST == SYS_VMS
                /*
                 * On vms, reopen stdout with "vanilla rms" attributes.
                 */
                if ((i = creat(useargv[3], 0, "rat=cr", "rfm=var")) == -1
                    || dup2(i, fileno(stdout)) == -1)
#else
                pDefOut = fopen( useargv[3], "w" );
                if( pDefOut == NULL )
#endif
                {
                    perror(useargv[3]);
                    cerror("Can't open output file \"%s\"", useargv[3]);
                    exit(IO_ERROR);
                }
            }                           /* Continue by opening output    */
        }
#endif
    case 3:
        /*
         * Get output file, "-" means use stdout.
         */
        if (!streq(useargv[2], "-"))
        {
#if HOST == SYS_VMS
            /*
             * On vms, reopen stdout with "vanilla rms" attributes.
             */
            if ((i = creat(useargv[2], 0, "rat=cr", "rfm=var")) == -1
                || dup2(i, fileno(stdout)) == -1)
#else
            pCppOut = fopen( useargv[2], "w" );
            if( pCppOut == NULL )
#endif
            {
                perror(useargv[2]);
                cerror("Can't open output file \"%s\"", useargv[2]);
                exit(IO_ERROR);
            }
        }                           /* Continue by opening input    */
    case 2:                         /* One file -> stdin            */
        /*
         * Open input file, "-" means use stdin.
         */
        if (!streq(useargv[1], "-"))
        {
            pCppIn = fopen( useargv[1], "r" );
            if( pCppIn == NULL)
            {
                perror(useargv[1]);
                cerror("Can't open input file \"%s\"", useargv[1]);
                exit(IO_ERROR);
            }
            strncpy(work, useargv[1], NWORK);  /* Remember input filename      */
            break;
        }                           /* Else, just get stdin         */
    case 0:                         /* No args?                     */
    case 1:                         /* No files, stdin -> stdout    */
#if (HOST == SYS_UNIX) || (HOST == SYS_UNKNOWN)
        work[0] = EOS;              /* Unix can't find stdin name   */
#else
        fgetname(stdin, work);      /* Vax-11C, Decus C know name   */
#endif
        break;

    default:
        exit(IO_ERROR);             /* Can't happen                 */
    }

    setincdirs();                   /* Setup -I include directories */
    addfile( pCppIn, work);           /* "open" main input file       */
#if OSL_DEBUG_LEVEL > 1
    if (debug > 0 || bDumpDefs)
        dumpdef("preset #define symbols");
#endif
    if( pCppIn != stdin )
        rewind( pCppIn );

    cppmain();                      /* Process main file            */

    if ((i = (ifptr - &ifstack[0])) != 0)
    {
#if OLD_PREPROCESSOR
        ciwarn("Inside #ifdef block at end of input, depth = %d", i);
#else
        cierror("Inside #ifdef block at end of input, depth = %d", i);
#endif
    }
#if OSL_DEBUG_LEVEL > 1
    if( pDefOut != stdout && pDefOut != stderr )
        fclose( pDefOut );
#endif
    if( pCppOut != stdout && pCppOut != stderr )
        fclose( pCppOut );

    if (errors > 0)
    {
        fprintf(stderr, (errors == 1)
                ? "%d error in preprocessor\n"
                : "%d errors in preprocessor\n", errors);
        if (!eflag)
            exit(IO_ERROR);
    }
#ifdef NOMAIN                  /* BP */ /* kein exit im der LIB-Version */
    return( IO_NORMAL );
#else
    exit(IO_NORMAL);                /* No errors or -E option set   */
#endif

}
コード例 #8
0
ファイル: lp_params.c プロジェクト: jmarshallnz/lpSolve
MYBOOL __WINAPI read_params(lprec *lp, char *filename, char *options)
{
    int ret, looping, line;
    FILE *fp;
    hashtable *hashfunctions, *hashparameters;
    hashelem *hp;
    int i, j, elements, n, intvalue, state = 0;
    REAL REALvalue;
    char buf[4096], *header = NULL, *ptr, *ptr1, *ptr2;

    if((fp = ini_open(filename)) == NULL)
        ret = FALSE;
    else {
        /* create hashtable of all callable commands to find them quickly */
        hashfunctions = create_hash_table(sizeof(functions) / sizeof(*functions), 0);
        for (n = 0, i = 0; i < (int) (sizeof(functions)/sizeof(*functions)); i++) {
            puthash(functions[i].par, i, NULL, hashfunctions);
            if(functions[i].values != NULL)
                n += functions[i].elements;
        }
        /* create hashtable of all arguments to find them quickly */
        hashparameters = create_hash_table(n, 0);
        for (n = 0, i = 0; i < (int) (sizeof(functions)/sizeof(*functions)); i++) {
            if(functions[i].values != NULL) {
                elements = functions[i].elements;
                for(j = 0; j < elements; j++)
                    if((strcmp(functions[i].values[j].svalue, "0") != 0) &&
                            (strcmp(functions[i].values[j].svalue, "1") != 0))
                        puthash(functions[i].values[j].svalue, j, NULL, hashparameters);
            }
        }

        readoptions(options, &header);

        STRUPR(header);
        ret = looping = TRUE;
        line = 0;
        while((ret) && (looping)) {
            line++;
            switch(ini_readdata(fp, buf, sizeof(buf), FALSE)) {
            case 0: /* End of file */
                looping = FALSE;
                break;
            case 1: /* header */
                switch(state) {
                case 0:
                    STRUPR(buf);
                    if(strcmp(buf, header) == 0)
                        state = 1;
                    break;
                case 1:
                    looping = FALSE;
                    break;
                }
                break;
            case 2: /* data */
                if(state == 1) {
                    for(ptr = buf; (*ptr) && (isspace(*ptr)); ptr++);
                }
                else
                    ptr = NULL;
                if((ptr != NULL) && (*ptr)) {
                    STRUPR(buf);
                    ptr = strchr(buf, '=');
                    if(ptr == NULL) {
                        report(lp, IMPORTANT, "read_params: No equal sign on line %d\n", line);
                        ret = FALSE;
                    }
                    else {
                        *ptr = 0;
                        for(ptr1 = buf; isspace(*ptr1); ptr1++);
                        for(ptr2 = ptr - 1; (ptr2 >= ptr1) && (isspace(*ptr2)); ptr2--);
                        if(ptr2 <= ptr1) {
                            report(lp, IMPORTANT, "read_params: No parameter name before equal sign on line %d\n", line);
                            ret = FALSE;
                        }
                        else {
                            ptr2[1] = 0;
                            hp = findhash(ptr1, hashfunctions);
                            if(hp == NULL) {
                                report(lp, IMPORTANT, "read_params: Unknown parameter name (%s) before equal sign on line %d\n", ptr1, line);
                                ret = FALSE;
                            }
                            else {
                                i = hp->index;
                                ptr1 = ++ptr;
                                intvalue = 0;
                                REALvalue = 0;
                                if(functions[i].values == NULL) {
                                    switch(functions[i].type) {
                                    case intfunction:
                                    case longfunction:
                                    case MYBOOLfunction:
                                        intvalue = strtol(ptr1, &ptr2, 10);
                                        while((*ptr2) && (isspace(*ptr2)))
                                            ptr2++;
                                        if(*ptr2) {
                                            report(lp, IMPORTANT, "read_params: Invalid integer value on line %d\n", line);
                                            ret = FALSE;
                                        }
                                        break;
                                    case REALfunction:
                                        REALvalue = strtod(ptr1, &ptr2);
                                        while((*ptr2) && (isspace(*ptr2)))
                                            ptr2++;
                                        if(*ptr2) {
                                            report(lp, IMPORTANT, "read_params: Invalid real value on line %d\n", line);
                                            ret = FALSE;
                                        }
                                        break;
                                    }
                                }
                                else {
                                    while(ret) {
                                        ptr = strchr(ptr1, '+');
                                        if(ptr == NULL)
                                            ptr = ptr1 + strlen(ptr1);
                                        for(; isspace(*ptr1); ptr1++);
                                        for(ptr2 = ptr - 1; (ptr2 >= ptr1) && (isspace(*ptr2)); ptr2--);
                                        if(ptr2 <= ptr1)
                                            break;
                                        else {
                                            ptr2[1] = 0;
                                            hp = findhash(ptr1, hashparameters);
                                            if (hp == NULL) {
                                                report(lp, IMPORTANT, "read_params: Invalid parameter name (%s) on line %d\n", ptr1, line);
                                                ret = FALSE;
                                            }
                                            else {
                                                j = hp->index;
                                                if((j >= functions[i].elements) ||
                                                        (strcmp(functions[i].values[j].svalue, ptr1))) {
                                                    report(lp, IMPORTANT, "read_params: Inappropriate parameter name (%s) on line %d\n", ptr1, line);
                                                    ret = FALSE;
                                                }
                                                else {
                                                    intvalue += functions[i].values[j].value;
                                                }
                                            }
                                            ptr1 = ptr + 1;
                                        }
                                    }
                                }
                                if(ret) {
                                    switch(functions[i].type) {
                                    case intfunction:
                                        functions[i].set_function.int_set_function(lp, intvalue);
                                        break;
                                    case longfunction:
                                        functions[i].set_function.long_set_function(lp, intvalue);
                                        break;
                                    case MYBOOLfunction:
                                        functions[i].set_function.MYBOOL_set_function(lp, (MYBOOL) intvalue);
                                        break;
                                    case REALfunction:
                                        functions[i].set_function.REAL_set_function(lp, REALvalue);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }
        }

        FREE(header);
        free_hash_table(hashfunctions);
        free_hash_table(hashparameters);

        ini_close(fp);
    }

    return( (MYBOOL) ret );
}
コード例 #9
0
ファイル: lp_params.c プロジェクト: jmarshallnz/lpSolve
MYBOOL __WINAPI write_params(lprec *lp, char *filename, char *options)
{
    int k, ret, params_written;
    FILE *fp, *fp0;
    int state = 0, looping, newline;
    char buf[4096], *filename0, *ptr1, *ptr2, *header = NULL;

    readoptions(options, &header);

    k = strlen(filename);
    filename0 = (char *) malloc(k + 1 + 1);
    strcpy(filename0, filename);
    ptr1 = strrchr(filename0, '.');
    ptr2 = strrchr(filename0, '\\');
    if((ptr1 == NULL) || ((ptr2 != NULL) && (ptr1 < ptr2)))
        ptr1 = filename0 + k;
    memmove(ptr1 + 1, ptr1, k + 1 - (int) (ptr1 - filename0));
    ptr1[0] = '_';
    if(rename(filename, filename0)) {
        switch(errno) {
        case ENOENT: /* File or path specified by oldname not found */
            FREE(filename0);
            filename0 = NULL;
            break;
        case EACCES: /* File or directory specified by newname already exists or could not be created (invalid path); or oldname is a directory and newname specifies a different path. */
            FREE(filename0);
            FREE(header);
            return(FALSE);
            break;
        }
    }

    if((fp = ini_create(filename)) == NULL)
        ret = FALSE;
    else {
        params_written = FALSE;
        newline = TRUE;
        if(filename0 != NULL) {
            fp0 = ini_open(filename0);
            if(fp0 == NULL) {
                rename(filename0, filename);
                FREE(filename0);
                FREE(header);
                return(FALSE);
            }
            looping = TRUE;
            while(looping) {
                switch(ini_readdata(fp0, buf, sizeof(buf), TRUE)) {
                case 0: /* End of file */
                    looping = FALSE;
                    break;
                case 1: /* header */
                    ptr1 = strdup(buf);
                    STRUPR(buf);
                    ptr2 = strdup(header);
                    STRUPR(ptr2);
                    if(strcmp(buf, ptr2) == 0) {
                        write_params1(lp, fp, ptr1, newline);
                        params_written = TRUE;
                        newline = TRUE;
                        state = 1;
                    }
                    else {
                        state = 0;
                        ini_writeheader(fp, ptr1, newline);
                        newline = TRUE;
                    }
                    FREE(ptr2);
                    FREE(ptr1);
                    break;
                case 2: /* data */
                    if(state == 0) {
                        ini_writedata(fp, NULL, buf);
                        newline = (*buf != 0);
                    }
                    break;
                }
            }
            ini_close(fp0);
        }

        if(!params_written)
            write_params1(lp, fp, header, newline);

        ini_close(fp);
        ret = TRUE;
    }

    if(filename0 != NULL) {
        remove(filename0);
        FREE(filename0);
    }

    FREE(header);

    return( (MYBOOL) ret );
}
コード例 #10
0
ファイル: elfls.c プロジェクト: unixaaa/LuxCC
/* main().
 */
int main(int argc, char *argv[])
{
    textline   *lines = NULL;
    char      **arg;
    int		ret = 0;
    int		count, i;

    readoptions(argc, argv);
    if (optind == argc) {
	err("nothing to do.");
	exit(EXIT_FAILURE);
    }

    for (arg = argv + optind ; (thefilename = *arg) != NULL ; ++arg) {
	if (!(thefile = fopen(thefilename, "rb"))) {
	    perror(thefilename);
	    ++ret;
	    continue;
	}
	if (!readelfhdr() || !readproghdrs() || !readsecthdrs()) {
	    fclose(thefile);
	    ++ret;
	    continue;
	}

	describeehdr(stdout);
	if (ldepls && proghdrs) {
	    if ((count = getlibraries(&lines))) {
		outputlist(stdout, lines, count, "Dependencies: ");
		free(lines);
	    }
	}
	if (srcfls && secthdrs) {
	    if ((count = getsrcfiles(&lines))) {
		qsort(lines, count, sizeof *lines, linesorter);
		outputlist(stdout, lines, count, "Source files: ");
		free(lines);
	    }
	}

	makenumberfmts();
	if (phdrls && proghdrs) {
	    printf("Program header table entries: %d", elffhdr.e_phnum);
	    if (dooffs)
		printf(" (%lX - %lX)",
		       (unsigned long)elffhdr.e_phoff,
		       (unsigned long)elffhdr.e_phoff +
				elffhdr.e_phnum * elffhdr.e_phentsize);
	    putchar('\n');
	    lines = gettextlines(elffhdr.e_phnum);
	    for (i = 0 ; i < elffhdr.e_phnum ; ++i) {
		append(lines + i, "%2d ", i);
		describephdr(lines + i, proghdr + i);
	    }
	    formatlist(stdout, lines, elffhdr.e_phnum);
	    free(lines);
	}

	if (shdrls && secthdrs) {
	    printf("Section header table entries: %d", elffhdr.e_shnum);
	    if (dooffs)
		printf(" (%lX - %lX)",
		       (unsigned long)elffhdr.e_shoff,
		       (unsigned long)elffhdr.e_shoff +
					elffhdr.e_shnum * elffhdr.e_shentsize);
	    putchar('\n');
	    lines = gettextlines(elffhdr.e_shnum);
	    for (i = 0 ; i < elffhdr.e_shnum ; ++i) {
		append(lines + i, "%2d ", i);
		describeshdr(lines + i, secthdr + i);
	    }
	    formatlist(stdout, lines, elffhdr.e_shnum);
	    free(lines);
	}

	fclose(thefile);
	free(proghdr);
	free(secthdr);
	free(sectstr);
    }

    return ret;
}
コード例 #11
0
int main ( int argc, char** argv )
{
    int done, pause, bookmark;
    int joypads[NJOYSTICKS];

    mastersystem *sms = NULL;
    appenv *environment = NULL;
    romspecs *rspecs = NULL;

    display screen;
    SDL_version sdlvers;

    char *romfilename=NULL;
    int nosound = 0;
    int codemasters = 0;

    tmachine machine = UNDEFINED;
    video_mode vmode = UNDEFINED;

    screen.fullscreen = 0;
    screen.scale = DEFAULT_SCALE;
    screen.minscale = (float)224.0 / 192;

#ifndef DEBUG
    assert(0);
#endif

    environment = getappenv();
    initmodules(environment->basedir);

    log4me_print("-==| %s version %s |==-\n", PACKAGE, VERSION);
#ifdef DEBUG
    log4me_print("  => DEBUG version\n");
#endif
    readoptions(argc, argv, &romfilename, &screen.fullscreen, &machine, &vmode, &nosound, &screen.scale, &codemasters);

    SDL_GetVersion(&sdlvers);
    log4me_print("SDL : %d.%d.%d\n", sdlvers.major, sdlvers.minor, sdlvers.patch);
    log4me_print("SDL : Video driver (%s)\n", getcurrentvideodriver());
    log4me_print("SDL : Rendered driver (%s)\n", getcurrentrendererdriver());
    log4me_print("SDL : Audio driver (%s)\n", SDL_GetCurrentAudioDriver());

    // Init joypads
    int i;
    for(i=0;i<NJOYSTICKS;i++) joypads[i] = input_new_pad();

    // Display joypads informations
    if(input_pad_detected()) {
        padinfos infos;
        for(i=0;i<NJOYSTICKS;i++) {
            if(joypads[i]==NO_JOYPAD) continue;
            input_pad_getinfos(joypads[i], &infos);
            log4me_print("SDL : Player %d joystick detected => %s\n", i+1, infos.name);
            log4me_print("\tButtons : %d, Axis : %d, Hats : %d\n", infos.buttons, infos.axis, infos.hats);
        }
    } else
        log4me_print("SDL : No joystick detected\n");

    rspecs = getromspecs(romfilename, machine, vmode, codemasters);
    machine = getrommachine(rspecs);
    vmode = getromvideomode(rspecs);

    assert((machine==JAPAN) || (machine==EXPORT));
    assert((vmode==VM_NTSC) || (vmode==VM_PAL));
    log4me_print("SMS : Use %s machine with %s video mode\n", machine==EXPORT ? "Export" : "Japan", vmode==VM_PAL ? "PAL" : "NTSC");

    switch(getromgameconsole(rspecs)) {
        case GC_SMS:
            screen.width = 256;
            screen.height = 192;
            screen.margin = DEFAULT_MARGIN;
            break;
        case GC_GG:
            screen.width = 160;
            screen.height = 144;
            screen.margin = 0;
            break;
        default:
            assert(0);
            break;
    }
    setvideomode(&screen);

    sms = ms_init(&screen, rspecs, nosound ? SND_OFF : SND_ON, joypads[0], joypads[1], environment->backup);
    if(sms==NULL) {
        log4me_error(LOG_EMU_MAIN, "Unable to allocate and initialize the SMS emulator.\n");
        exit(EXIT_FAILURE);
    }

    SDL_SetWindowTitle(screen.window, CSTR(sms->romname));

    done = pause = bookmark = 0;

    ms_start(sms);
    while (!done)
    {
        SDL_Event event;
        while(SDL_PollEvent(&event)) {
            input_process_event(&event);
            done |= (event.type==SDL_QUIT);
        }

        done |= input_key_pressed(SDL_SCANCODE_ESCAPE);

        if(input_key_down(SDL_SCANCODE_PAUSE)) {
            pause ^= 1;
            ms_pause(sms, pause);
        }

        if(input_key_down(SDL_SCANCODE_F9))
            takesnapshot(sms, environment->snapshots);

        if(input_key_down(SDL_SCANCODE_F10))
            takescreenshot(sms, environment->screenshots);

        if(input_key_down(SDL_SCANCODE_F2)) {
            ms_pause(sms, 1);
            screen.scale -= 0.2;
            setvideomode(&screen);
            ms_pause(sms, 0);
        }

        if(input_key_down(SDL_SCANCODE_F3)) {
            ms_pause(sms, 1);
            screen.scale += 0.2;
            setvideomode(&screen);
            ms_pause(sms, 0);
        }

        if(input_key_down(SDL_SCANCODE_F4)) {
            ms_pause(sms, 1);
            screen.fullscreen ^= 1;
            setvideomode(&screen);
            ms_pause(sms, 0);
        }

#ifdef DEBUG
        if(input_key_down(SDL_SCANCODE_B))
            log4me_print("[BKM] %d\n", bookmark++);

        if(input_key_down(SDL_SCANCODE_F5))
            savetiles(sms, environment->debug);

        if(input_key_down(SDL_SCANCODE_F6))
            tms9918a_toggledisplaypalette(&sms->vdp);
#endif

        if(!ms_ispaused(sms)) ms_execute(sms);
    }

    releaseobject(sms);
    releaseobject(rspecs);
    for(i=0;i<NJOYSTICKS;i++) input_release_pad(joypads[i]);

    releaseobject(environment);

    return 0;
}