Example #1
0
unsigned char* cbm_input(unsigned char len,unsigned char cursor){
	unsigned char key=0;
	unsigned char* eingabestring=calloc(len,1);
	unsigned char eglen;

	if(NULL!=eingabestring){
		if(kbhit()){cgetc();}
		while(('\n'!=key)){
			eglen=strlen(eingabestring);
			putchar(cursor);
			key=cgetc();
			switch(key){
				case CH_DEL:{
					if(0<eglen){
						eingabestring[eglen-1]='\0';
						putchar(CH_DEL);
						break;
					}
				}
				case CH_ENTER:{break;}
				default:{
					if(len>eglen){
						eingabestring[eglen]=key;
						putchar(key);
					}
				}
			}
		}
		putchar(' ');
		/*clrscr();
		write_room_info();
		write_death();*/
	}
	return eingabestring;
}
Example #2
0
uint16_t cgeti(CFILE *f)
{
   uint16_t a, b;
	a = cgetc(f);
	b = cgetc(f);
	return (b << 8) | (a);
}
Example #3
0
int main(void)
{
	char c;
        NEWLINE;

        cursor (1);
	PRINTF("enter key (cursor on): ");
	c = cgetc();
        NEWLINE;

        cursor (0);
	PRINTF("enter key (cursor off): ");
	c = cgetc();
        NEWLINE;

	PRINTF("enter key (cursor on): ");
        cursor (1);
	c = cgetc();
        NEWLINE;

	PRINTF("enter key (cursor off): ");
        cursor (0);
	c = cgetc();
        NEWLINE;

        PRINTF("hit any key to exit...");
        c = cgetc();
        NEWLINE;

	return(0);
}
Example #4
0
uint32_t cgetl(CFILE *f)
{
   uint32_t a, b, c, d;
	a = cgetc(f);
	b = cgetc(f);
	c = cgetc(f);
	d = cgetc(f);
	return (d << 24) | (c << 16) | (b << 8) | (a);
}
Example #5
0
bool loadGame(tUpdatePosCallback callback)
{
    bool isValid = false;
    bool result = false;
    FILE *saveFile= fopen(SAVE_GAME_FILE, "rb");
    
    if (saveFile == NULL) {
#ifdef LOAD_GAME_DEBUG
        printf("Cannot open save game file\n");
        cgetc();
#endif
        return false;
    }
    
    if ((fread(&isValid, sizeof(isValid), 1, saveFile) != 1) ||
        (!isValid)) {
        fclose(saveFile);
#ifdef LOAD_GAME_DEBUG
        printf("Save is not valid\n");
        cgetc();
#endif
        return false;
    }
    
    if (fread(&theGame, sizeof(theGame), 1, saveFile) != 1) {
        fclose(saveFile);
        deleteGame();
#ifdef LOAD_GAME_DEBUG
        printf("Unable to read game from save\n");
        cgetc();
#endif
        return false;
    }
    
    theGame.callback = callback;
    
    // The saved start time is an elapsed time.  Convert it back into a start time relative to now.
    if (theGame.startTime != 0xffffffff) {
        theGame.startTime = _systime() - theGame.startTime;
    }
    
    theGame.puzzle = loadPuzzle(saveFile);
    
    fclose(saveFile);
    deleteGame();
    
    if (theGame.puzzle == NULL) {
#ifdef LOAD_GAME_DEBUG
        printf("Unable to read puzzle from save\n");
        cgetc();
#endif
        return false;
    }
    
    return true;
}
Example #6
0
int main (void)
{
	static byte rowNumber, columnNumber, synthesizing;
	static byte rowBit, columnBits, lastColumnBits[8], changedColumnBits;

     /* If we have a character, remove it from the buffer */
    if (kbhit ()) {
       	cgetc ();
    }

	resetSound();
    setUpScreen();
	synthesizing=TRUE;

    //main loop
    while(synthesizing)
    {
		//do keyboard scan
		for (rowNumber = 0; rowNumber <= KeyRows-1; rowNumber++)
		{
			rowBit = 1 << rowNumber;
			
			CIA1.pra = ~rowBit; 		//write the row we want to read
			columnBits = ~CIA1.prb;   	//read the keys pressed in the row
									
			if (lastColumnBits[rowNumber] != columnBits)
			{
				changedColumnBits=lastColumnBits[rowNumber]^columnBits;
				lastColumnBits[rowNumber]=columnBits;
				
				for(columnNumber = 0; 
					columnNumber<= KeyColumns-1 && changedColumnBits != 0; 
					columnNumber++)
				{
					if(changedColumnBits & 1)
					{
						changeFunctionStatus(functionMatrix[rowNumber][columnNumber], 
											columnBits & 1);
					}
					changedColumnBits >>= 1;
					columnBits >>= 1;
				}				
			}
		}

		if(kbhit()){
			if (cgetc()==13)
				synthesizing=FALSE;
		}
    }
Example #7
0
char * main_menu ()
{
    bool valid;

    cursor(true);
    for (;;)
    {
        MENU("Dir / ");
        MENU("Load / ");
        MENU("Input ? ");
        valid = false;

        while (!valid)
        {
            switch (toupper (cgetc ()))
            {
            case 'D':
                valid = true;
                printf ("D\r\n\r\n");
                dir ();
                printf ("\r\n");
                break;
            case 'L':
                puts ("L\r\n");
                printf ("Filename? ");
                gets(filename);
                puts ("\r\n");
                return filename;
            case 'I':
                printf ("I\r\n\r\n");
                return 0;
            }
        }
    }
}
Example #8
0
void process_checkbox(tgui_Window *win, tgui_Obj *obj){
int x, y;
char key;

    x=win->x1 + 1 + obj->x;
    y=win->y1 + 2 + obj->y;

	gotoxy(x+1,y);
	cursor(1);
	revers(1);
	if (obj->state==0) cputc(' ');
	else cputc('X');

	do {
		gotoxy(x+1,y);
	    revers(1);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	    gotoxy(x+1, y);
	    key=cgetc();

	    if (key==' ') {
	        if(obj->state == 0 ) obj->state =1;
			else obj->state = 0;
		}

	} while (key != CH_ENTER);

		gotoxy(x+1,y);
	    revers(0);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	cursor(0);

}  // process_checkbox
Example #9
0
void main (void)
{
    log ("Calling overlay 1 from main");

    /* The symbols _OVERLAY1_LOAD__ and _OVERLAY1_SIZE__ were generated by the
     * linker. They contain the overlay area address and size specific to a
     * certain program.
     */
    if (loadfile ("ovrldemo.1", _OVERLAY1_LOAD__, _OVERLAY1_SIZE__)) {

        /* The linker makes sure that the call to foo() ends up at the right mem
         * addr. However it's up to user to make sure that the - right - overlay
         * is actually loaded before making the the call.
         */
        foo ();
    }

    log ("Calling overlay 2 from main");

    /* Replacing one overlay with another one can only happen from the main
     * program. This implies that an overlay can never load another overlay.
     */
    if (loadfile ("ovrldemo.2", _OVERLAY2_LOAD__, _OVERLAY2_SIZE__)) {
        bar ();
    }

    log ("Calling overlay 3 from main");
    if (loadfile ("ovrldemo.3", _OVERLAY3_LOAD__, _OVERLAY3_SIZE__)) {
        foobar ();
    }

    cgetc ();
}
Example #10
0
static char GetKeyUpdate (void)
/* Wait for a key updating the windows in the background */
{
    static unsigned char Win;

    /* While there are no keys... */
    while (!kbhit ()) {

        switch (Win) {

            case 0:
                UpdateAsm ();
                break;

            case 1:
                UpdateStack ();
                break;

            case 2:
                UpdateCStack ();
                break;

            case 3:
                UpdateDump ();
                break;
        }

        Win = (Win + 1) & 0x03;

    }

    /* We have a key - return it */
    return cgetc ();
}
Example #11
0
static void refreshLevel(tLevel level)
{
    bool waiting = true;
    
    videomode(VIDEOMODE_80x24);
    mixedTextMode();
    speakLevelComplete();
    
    gotoxy(0, 0);
    cprintf(      "               Completed level %u!!", level);
    cputsxy(0, 2, "               Press space to continue to the next level...");
    
    while (waiting) {
        switch (cgetc()) {
            case ' ':
                waiting = false;
                break;
                
            default:
                badThingHappened();
                break;
        }
    }
    
    showAndClearDblLoRes();
    speakGetReady();
}
Example #12
0
uint8_t display_control_line(uint8_t line_count)
{
    char c;

    revers(true);
    cputs("--More--");
    revers(false);
    c = tolower(cgetc());
    erase_backward(8);
    switch (c) {
        case 'b':
            /* Go back one page.*/
            break;
        case ' ':
            /* Print the next page.*/
            line_count = 0;
            break;
        case 'q':
            /* Quit.*/
            exit(EXIT_SUCCESS);
        case CARRIAGE_RETURN:
            /* Display one more line. */
            line_count -= 1;
            break;
    }
    return line_count;
}
Example #13
0
static void save_anim() {
    switch_to_console_screen();
    if (prompt_open("save", CBM_WRITE, TYPE_USR)) {
        const char curr_screen_saved = curr_screen;

        const char version = 3;
        mycbm_write(MY_LFN, &version, 1);  // Version.
        ++end_frame;
        mycbm_write(MY_LFN, &end_frame, 1);  // Frame count.
        --end_frame;

        for (curr_screen = 0; curr_screen <= end_frame; ++curr_screen) {
            lz77_write_screen();
        }
        curr_screen = curr_screen_saved;

        mycbm_close(MY_LFN);
        if (_oserror) {
            textcolor(COLOR_RED);
            cputs("disk full?");
            cgetc();
        }
    }
    redraw_edit_screen();
    show_cursor();
    invalidate_loaded_anim();
}
Example #14
0
/*
 * get_input_terminated_by() reads input (handling backspace correctly) until
 * a terminator of |terminators| is encountered or |out| is full (outlen-1
 * characters were read).
 *
 * get_input_terminated_by() returns the terminator it encountered.
 *
 */
input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators, char *out, BYTE outlen) {
	BYTE i = strlen(out);
	BYTE c, x, y;
	x = wherex() - i;
	y = wherey();
	while (1) {
		c = cgetc();
		if (((terminators & INPUT_TERMINATOR_RETURN) == INPUT_TERMINATOR_RETURN) && (c == PETSCII_CR)) {
			return INPUT_TERMINATOR_RETURN;
		} else if (((terminators & INPUT_TERMINATOR_SPACE) == INPUT_TERMINATOR_SPACE) && (c == PETSCII_SP)) {
			return INPUT_TERMINATOR_SPACE;
		} else if (c == PETSCII_DEL) {
			/* If you are at the left-most position, do nothing */
			if (i == 0)
				continue;
			out[--i] = '\0';
			cputcxy(x+i, y, ' ');
			gotoxy(x+i, y);
			continue;
		}
		if (i == (outlen-1)) {
			continue;
		}
		cputc(c);
		out[i++] = c;
	}
}
Example #15
0
int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
Example #16
0
void processMenu() {
    uint8_t c = 0;
    uint8_t current = 0;

    cursor(0);
    while(1) {
        renderMenu(current);

        c = cgetc();
        if (c == 157) {
            // Left
            if (current == 0) {
                current = menuSize - 1;
            } else {
                current--;
            }
        } else if (c == 29) {
            // Right
            current++;
            if (current >= menuSize) {
                current = 0;
            }
        } else if (c == 3) {
            break;
        }
    }

    renderMenu(100);
    cursor(1);
    revers(0);
}
Example #17
0
/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_output(void))
{
  ctk_arch_key_t c;
  char *ptr;
  
  PT_BEGIN(&s.outpt);
  
  while(1) {
    PT_WAIT_UNTIL(&s.outpt, (ctk_mode_get() == CTK_MODE_EXTERNAL) &&
		  kbhit());


    ptr = s.outputbuf;
    s.len = 0;    
    while(kbhit() && s.len < sizeof(s.outputbuf)) {
      c = cgetc();
      *ptr = c;
      ++ptr;
      ++s.len;   
    }

    PT_WAIT_THREAD(&s.outpt, send());
  }
  PT_END(&s.outpt);      
}
Example #18
0
static void endGame(void)
{
    videomode(VIDEOMODE_80x24);
    mixedTextMode();
    
    speakNoMoreMoves();
    
    cputsxy(0, 0, "               No more moves  -  GAME OVER!!");
    gotoxy(0,1);
    cprintf(      "               You made it to level %u", getLevel());
    cputsxy(0, 3, "                    Play again (Y/N)?");
    
    while (true) {
        switch (cgetc()) {
            case 'y':
            case 'Y':
                return;
                
            case 'n':
            case 'N':
            case CH_ESC:
            case 'q':
            case 'Q':
                quitGame();
                break;
                
            default:
                badThingHappened();
                break;
        }
    }
}
Example #19
0
static void copy() {
    remember_screen();  // Saves edit screen to SCREEN_BASE area.

    CLIP_X1 = cur_x;
    CLIP_X2 = cur_x;
    CLIP_Y1 = cur_y;
    CLIP_Y2 = cur_y;

    for (;;) {
        redraw_edit_screen();
        paint_copy_mark();
poll_key:
        switch (cgetc()) {
            case CH_CURS_DOWN:
                if (CLIP_Y2 < 24) ++CLIP_Y2;
                break;
            case CH_CURS_UP:
                if (CLIP_Y2) --CLIP_Y2;
                break;
            case CH_CURS_RIGHT:
                if (CLIP_X2 < 39) ++CLIP_X2;
                break;
            case CH_CURS_LEFT:
                if (CLIP_X2) --CLIP_X2;
                break;
            case CH_F5:
                goto done;
            default:
                goto poll_key;
        }
    }

done:
    redraw_edit_screen();
    memcpy(CLIPBOARD, DISPLAY_BASE, 40 * 25);
    memcpy(CLIPBOARD + 40 * 25, (char*)0xd800, 40 * 25);

    if (CLIP_X1 == CLIP_X2 && CLIP_Y1 == CLIP_Y2) {
        // Copies entire screen. Flashes screen to give some kind of feedback.
        *(char*)0xd021 ^= 0xf;
        {
            unsigned long now = clock();
            while (now + 8 != clock()) {}
        }
        *(char*)0xd021 ^= 0xf;
    } else {
        // Order coordinates.
        if (CLIP_X1 > CLIP_X2) {
            const char tmp = CLIP_X1;
            CLIP_X1 = CLIP_X2;
            CLIP_X2 = tmp;
        }
        if (CLIP_Y1 > CLIP_Y2) {
            const char tmp = CLIP_Y1;
            CLIP_Y1 = CLIP_Y2;
            CLIP_Y2 = tmp;
        }
    }
}
Example #20
0
static void AskForDisk (const char* Name, unsigned char Drive)
/* Ask the user to insert a specific disk */
{
    ClearLine ();
    cprintf ("\rInsert %s Disk into Drive %d !", Name, Drive);

    cgetc ();
}
Example #21
0
void menu (void)
{
    unsigned char ch;
    clrscr();
    revers(1);          //1234567890123456789012345678901234567890
    gotoxy(0,0); cprintf("                        SynthMark64 v0.2");
    gotoxy(0,24); cprintf("CPU %s, RAM %5d KB (%3d BANKS) %s",
        cpu_type == CPU_65816 ? "65816" : cpu_type == CPU_65C02 ? "65C02" : "6502 ",
        ram_banks * 64, ram_banks, vic_pal ? "PAL " : "NTSC");
    revers(0);
    while (1) {
        gotoxy(1,2); cprintf("[F1] disable screen during tests: %s", screenoff ? "yes" : "no ");
        gotoxy(1,4); cprintf("[F3] use C128 fast mode: %s", c128turbo ? "yes" : "no ");
        gotoxy(1,6); cprintf("[F5] use DTV fast mode(s): %s", dtvturbo ? "yes" : "no ");
        gotoxy(1,8); cprintf("[F7] use SCPU optimization: %s", scpumode == 0 ? "default" : scpumode == 1 ? "none   " : "full   ");
        gotoxy(1,10); cprintf("[RETURN] start benchmark");
        ch = cgetc();
        if (ch == 0x0d) {
            break;
        }
#ifdef DEBUG
        gotoxy (0,0); cprintf("%02x", ch);
#endif
        switch (ch) {
            case 0x85:
                screenoff ^= 1;
                break;
            case 0x86:
                c128turbo ^= 1;
                break;
            case 0x87:
                dtvturbo ^= 1;
                break;
            case 0x88:
                scpumode++;
                if (scpumode > 2) {
                    scpumode = 0;
                }
                break;
        }
    }
    while (kbhit()) {
        cgetc();
    }
}
Example #22
0
File: hello.c Project: cc65/cc65
int main (void)
{
    unsigned char XSize, YSize;

    /* Set screen colors */
    (void) textcolor (COLOR_WHITE);
    (void) bordercolor (COLOR_BLACK);
    (void) bgcolor (COLOR_BLACK);

    /* Clear the screen, put cursor in upper left corner */
    clrscr ();

    /* Ask for the screen size */
    screensize (&XSize, &YSize);

    /* Draw a border around the screen */

    /* Top line */
    cputc (CH_ULCORNER);
    chline (XSize - 2);
    cputc (CH_URCORNER);

    /* Vertical line, left side */
    cvlinexy (0, 1, YSize - 2);

    /* Bottom line */
    cputc (CH_LLCORNER);
    chline (XSize - 2);
    cputc (CH_LRCORNER);

    /* Vertical line, right side */
    cvlinexy (XSize - 1, 1, YSize - 2);

    /* Write the greeting in the mid of the screen */
    gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
    cprintf ("%s", Text);

#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__) || defined(__ATARI5200__)

    /* Wait for the user to press a button */
    joy_install (joy_static_stddrv);
    while (!joy_read (JOY_1)) ;
    joy_uninstall ();

#else

    /* Wait for the user to press a key */
    cgetc ();

#endif

    /* Clear the screen again */
    clrscr ();

    /* Done */
    return EXIT_SUCCESS;
}
Example #23
0
void
skiptonl(char c)
{
	while (c != '\n') {
		if (!(c = cgetc(0)))
			return;
	}
	ungetc('\n', stdin);
	return;
}
Example #24
0
bool SIFLoader::LoadHeader(const char *filename)
{
CFILE *fp;
uint32_t magick;

	ClearIndex();
	
	if (fFP) cclose(fFP);
	fp = fFP = copen(filename, "rb");
	
	if (!fp)
	{
		NX_ERR("SIFLoader::LoadHeader: failed to open file '%s'\n", filename);
		return 1;
	}
	
	if ((magick = cgetl(fp)) != SIF_MAGICK)
	{
		NX_ERR("SIFLoader::LoadHeader: magick check failed--this isn't a SIF file or is wrong version?\n");
		NX_ERR(" (expected %08x, got %08x)\n", SIF_MAGICK, magick);
		return 1;
	}
	
	int nsections = cgetc(fp);
	NX_LOG("SIFLoader::LoadHeader: read index of %d sections\n", nsections);
	
	for(int i=0;i<nsections;i++)
	{
		SIFIndexEntry *entry = new SIFIndexEntry;
		
		entry->type = cgetc(fp);		// section type
		entry->foffset = cgetl(fp);		// absolute offset in file
		entry->length = cgetl(fp);		// length of section data
		entry->data = NULL;				// we won't load it until asked
		
		fIndex.AddItem(entry);
		//NX_LOG("  - Sect%02d @ %04x\n", entry->type, entry->foffset);
	}
	
	// ..leave file handle open, its ok
	return 0;
}
Example #25
0
static char Input (char* Prompt, char* Buf, unsigned char Count)
/* Read input from the user, return 1 on success, 0 if aborted */
{
    int Frame;
    unsigned char OldColor;
    unsigned char OldCursor;
    unsigned char x1;
    unsigned char i;
    unsigned char done;
    char c;

    /* Clear the current prompt line */
    cclearxy (0, MAX_Y-1, MAX_X);

    /* Display the new prompt */
    OldColor = textcolor (COLOR_TEXTHIGH);
    cputsxy (0, MAX_Y-1, Prompt);
    (void) textcolor (COLOR_TEXTLOW);

    /* Remember where we are, enable the cursor */
    x1 = wherex ();
    OldCursor = cursor (1);

    /* Get input and handle it */
    i = done = 0;
    do {
        c = cgetc ();
        if (isalnum (c) && i < Count) {
            Buf [i] = c;
            cputcxy (x1 + i, MAX_Y-1, c);
            ++i;
        } else if (i > 0 && c == CH_DEL) {
            --i;
            cputcxy (x1 + i, MAX_Y-1, ' ');
            gotoxy (x1 + i, MAX_Y-1);
        } else if (c == '\n') {
            Buf [i] = '\0';
            done = 1;
        } else if (IsAbortKey (c)) {
            /* Abort */
            done = 2;
        }
    } while (!done);

    /* Reset settings, display old prompt line */
    cursor (OldCursor);
    (void) textcolor (OldColor);
    DrawFrames ();
    Frame = ActiveFrame;
    ActiveFrame = -1;
    ActivateFrame (Frame, 0);

    return (done == 1);
}
Example #26
0
int main(void)
{
    char key;

    timerInitTOD();
    screenInit();
    progressInit();

    g_strFileName[0] = '\0';
    g_nDrive = *(uint8_t*)0xba;
    if (g_nDrive < 8)
        g_nDrive = 8;

    internalCartType = INTERNAL_CART_TYPE_NONE;

    g_bFastLoaderEnabled = 1;
    updateFastLoaderText();

    refreshMainScreen();
    showAbout();
    refreshMainScreen();
    screenBing();

    // this also makes visible 16kByte of flash memory
    checkFlashType();

    checkRAM();

    for (;;)
    {
        setStatus("Ready. Press <m> for Menu.");

        key = cgetc();
        switch (key)
        {
        case 'm':
            execMenu(&menuMain);
            break;

        case 'o':
            execMenu(&menuOptions);
            break;

        case 'e':
            execMenu(&menuExpert);
            break;

        case 'h':
            execMenu(&menuHelp);
            break;
        }
    }
    return 0;
}
Example #27
0
void printInstructions(void)
{
    int seed = 0;
    
    unshowDblLoRes();
    videomode(VIDEOMODE_80x24);
    clrscr();
    printf(
          //      0000000001111111111222222222233333333334444444444555555555566666666667
          //      1234567890123456789012345678901234567890123456789012345678901234567890
           "                              Apple // Bejeweled             (" VERSION ")\n"
           "                                by Jeremy Rand\n"
           "\n"
           "     Use I-J-K-M, the arrow keys, joystick or mouse to move your selection.\n"
           "     Hold either apple key, joystick or mouse button and move your selection\n"
           "     to swap two jewels and match 3 or more jewels.  When you match three\n"
           "     jewels, they disappear and new jewels will drop from the top.\n"
           "\n"
           "     If you match four jewels or three jewels in two directions, then the\n"
           "     jewel does not disappear.  Match it again and it explodes taking more\n"
           "     jewels with it.  Match five jewels and a special jewel will appear.\n"
           "     Swap it with any other jewel and all jewels of that colour will\n"
           "     disappear.\n"
           "\n"
           "     When the score bar on the right fills, the board reloads and you level\n"
           "     up.  Play ends when no more matches can be made.\n"
           "\n"
           "                    Press Q or escape to quit at any time.\n"
           "                    Press R to start a new game.\n"
           "                    Press O to select options.\n"
           "                    Press H to get a hint.\n"
           "                    Press ? to see this info again.\n"
           "\n"
           "                           Press any key to start");
    
    // The amount of time the user waits to read the in
    while (!kbhit())
        seed++;
    
    srand(seed);
    
    switch (cgetc()) {
        case 'o':
        case 'O':
            selectOptions();
            break;
            
        default:
            break;
    }
    
    clrscr();
}
Example #28
0
bool cverifystring(CFILE *f, const char *str)
{
   int i;
   char result = 1;
   int stringlength = strlen(str);

   for(i = 0; i < stringlength; i++)
      if (cgetc(f) != str[i])
         result = 0;

   return result;
}
Example #29
0
int main(void)
{
  printf("\ncc65 time routines test program\n");
  printf("-------------------------------\n");

  printf("clocks per second: %d\n", CLOCKS_PER_SEC);
  printf("current clock: %ld\n", clock());

  printf("hit <return> to exit...");
  cgetc();
  printf("\n");
  return(0);
}
Example #30
0
static void DoWarning (void)
/* Warn the user that a driver is needed for this program. */
{
    cprintf ("Warning: This program needs\r\n"
             "the driver with the name\r\n"
             "    %s\r\n"
             "on a disk! Press 'y' if you have it;\r\n"
             "or, any other key to exit.\r\n", mouse_stddrv);
    if (tolower (cgetc ()) != 'y') {
        exit (EXIT_SUCCESS);
    }
    cprintf ("OK. Please wait patiently...\r\n");
}