Ejemplo n.º 1
0
/*
 * f_prtmtab - Prints out a header, then entries from both magic
 *	tables, mtab1 and mtab2, if any exist.
 */
void
f_prtmtab(void)
{
	Entry	*mtab;
	Entry	*ep;
	int	count;

	(void) printf("%-7s %-7s %-10s %-7s %-11s %s\n",
		"level", "off", "type", "opcode", "value", "string");
	for (mtab = mtab1, count = 1; count <= 2; count++, mtab = mtab2) {
		if (mtab == (Entry *)NULL) {
			continue;
		}
		for (ep = mtab; ep->e_off != -1L; ep++) {
			(void) printf("%-7d %-7ld %-10s %-7c ",
			    ep->e_level,
			    ep->e_off, type_to_name(ep),
			    op_to_name(ep->e_opcode));
			if (ep->e_type == STR) {
				showstr(ep->e_value.str, 10);
			} else {	/* numeric */
				(void) printf("%-#11llo", ep->e_value.num);
			}
			(void) printf(" %s", ep->e_str);
			if (ep->e_opcode & SUB)
				(void) printf("\tsubst");
			(void) printf("\n");
		}
	}
}
Ejemplo n.º 2
0
/*
	function to drop an object
 */
static void
dropobj(void)
{
	int    i;
	unsigned char  *p;
	long            amt;
	p = &item[playerx][playery];
	while (1) {
		if ((i = whatitem("drop")) == '\33')
			return;
		if (i == '*')
			showstr();
		else {
			if (i == '.') {	/* drop some gold */
				if (*p) {
					lprcat("\nThere's something here already!");
					return;
				}
				lprcat("\n\n");
				cl_dn(1, 23);
				lprcat("How much gold do you drop? ");
				if ((amt = readnum((long) c[GOLD])) == 0)
					return;
				if (amt > c[GOLD]) {
					lprcat("\nYou don't have that much!");
					return;
				}
				if (amt <= 32767) {
					*p = OGOLDPILE;
					i = amt;
				} else if (amt <= 327670L) {
					*p = ODGOLD;
					i = amt / 10;
					amt = 10 * i;
				} else if (amt <= 3276700L) {
					*p = OMAXGOLD;
					i = amt / 100;
					amt = 100 * i;
				} else if (amt <= 32767000L) {
					*p = OKGOLD;
					i = amt / 1000;
					amt = 1000 * i;
				} else {
					*p = OKGOLD;
					i = 32767;
					amt = 32767000L;
				}
				c[GOLD] -= amt;
				lprintf("You drop %ld gold pieces", (long)amt);
				iarg[playerx][playery] = i;
				bottomgold();
				know[playerx][playery] = 0;
				dropflag = 1;
				return;
			}
			drop_object(i - 'a');
			return;
		}
	}
}
Ejemplo n.º 3
0
static void pretty_print_error_at(char *str, int pos, const char *message)
{
    int chars_to_error;
    char *error;

    if (pos > 10)
    {
        /* Ok, we got some context to print ... */
        str = str + pos - 10; /* Print from 10 char before error. */
        chars_to_error = showstr(str, 10); /* Print up to error. */
        showstr(str + 10, 10); /* Print after error, to get context. */
    }
    else
    {
        /* Error is around the start of the string, we don't have context */
        chars_to_error = showstr(str, pos); /* Print up to error. */
        showstr(str + pos, 10); /* Print after error, to get context. */
    }
    fprintf(stderr, "\n%*s^ %s\n", (int)(chars_to_error), "", message);
}
Ejemplo n.º 4
0
/*
 * Play a single game
 * Reset the word lists from last game
 * Keep track of the running stats
 */
void
playgame(void)
{
	int i, *p, *q;
	time_t t;
	char buf[MAXWORDLEN + 1];

	ngames++;
	npwords = 0;
	pwordsp = pwords;
	nmwords = 0;
	mwordsp = mwords;

	time(&start_t);

	q = &wordpath[MAXWORDLEN + 1];
	p = wordpath;
	while (p < q)
		*p++ = -1;
	showboard(board);
	startwords();
	if (setjmp(env)) {
		badword();
		goto timesup;
	}

	while (1) {
		if (get_line(buf) == NULL) {
			if (feof(stdin))
				clearerr(stdin);
			break;
		}
		time(&t);
		if (t - start_t >= tlimit) {
			badword();
			break;
		}
		if (buf[0] == '\0') {
			int remaining;

			remaining = tlimit - (int) (t - start_t);
			(void)snprintf(buf, sizeof(buf),
			    "%d:%02d", remaining / 60, remaining % 60);
			showstr(buf, 1);
			continue;
		}
		if (strlen(buf) < (size_t)minlength) {
			badword();
			continue;
		}

		p = wordpath;
		while (p < q && *p != -1)
			*p++ = -1;
		usedbits = 0;

		if (checkword(buf, -1, wordpath) < 0)
			badword();
		else {
			if (debug) {
				(void) printf("[");
				for (i = 0; wordpath[i] != -1; i++)
					(void) printf(" %d", wordpath[i]);
				(void) printf(" ]\n");
			}
			for (i = 0; i < npwords; i++) {
				if (strcmp(pword[i], buf) == 0)
					break;
			}
			if (i != npwords) {	/* already used the word */
				badword();
				showword(i);
			}
			else if (!validword(buf))
				badword();
			else {
				int len;

				if (npwords == maxpwords - 1) {
					maxpwords += MAXPWORDS;
					pword = realloc(pword,
					    maxpwords * sizeof(char *));
					if (pword == NULL) {
						cleanup();
						errx(1, strerror(ENOMEM));
					}
				}
				len = strlen(buf) + 1;
				if (pwordsp + len >= &pwords[maxpspace]) {
					maxpspace += MAXPSPACE;
					pwords = realloc(pwords, maxpspace);
					if (pwords == NULL) {
						cleanup();
						errx(1, strerror(ENOMEM));
					}
				}
				pword[npwords++] = pwordsp;
				memcpy(pwordsp, buf, len);
				pwordsp += len;
				addword(buf);
			}
		}
	}

timesup: ;

	/*
	 * Sort the player's words and terminate the list with a null
	 * entry to help out checkdict()
	 */
	qsort(pword, npwords, sizeof(pword[0]), compar);
	pword[npwords] = NULL;

	/*
	 * These words don't need to be sorted since the dictionary is sorted
	 */
	checkdict();

	tnmwords += nmwords;
	tnpwords += npwords;

	results();
}
Ejemplo n.º 5
0
static RList* symbols(RBinFile *arch) {
	ut32 *vtable = (ut32*)arch->buf->buf;
	const char *name;
	SMD_Header *hdr;
	int i;
	RList *ret = NULL;

	if (!(ret = r_list_new ()))
		return NULL;
	ret->free = free;
	// TODO: store all this stuff in SDB
	hdr = (SMD_Header*)(arch->buf->buf + 0x100);
	addsym (ret, "rom_start", hdr->RomStart);
	addsym (ret, "rom_end", hdr->RomEnd);
	addsym (ret, "ram_start", hdr->RamStart);
	addsym (ret, "ram_end", hdr->RamEnd);
	showstr ("Copyright", hdr->CopyRights, 32);
	showstr ("DomesticName", hdr->DomesticName, 48);
	showstr ("OverseasName", hdr->OverseasName, 48);
	showstr ("ProductCode", hdr->ProductCode, 14);
	eprintf ("Checksum: 0x%04x\n", (ut32)hdr->CheckSum);
	showstr ("Peripherials", hdr->Peripherials, 16);
	showstr ("SramCode", hdr->CountryCode, 12);
	showstr ("ModemCode", hdr->CountryCode, 12);
	showstr ("CountryCode", hdr->CountryCode, 16);
	/* parse vtable */
	for (i=0; i<64; i++) {
		switch (i) {
		case 0: name = "SSP"; break;
		case 1: name = "Reset"; break;
		case 2: name = "BusErr"; break;
		case 3: name = "InvOpCode"; break;
		case 4: name = "DivBy0"; break;
		case 5: name = "Check"; break;
		case 6: name = "TrapV"; break;
		case 7: name = "GPF"; break;
		case 8: name = "Trace"; break;
		case 9: name = "Reserv0"; break;
		case 10: name = "Reserv1"; break;
		case 11: name = "Reserv2"; break;
		case 12: name = "Reserv3"; break;
		case 13: name = "Reserv4"; break;
		case 14: name = "BadInt"; break;
		case 15: name = "Reserv10"; break;
		case 16: name = "Reserv11"; break;
		case 17: name = "Reserv12"; break;
		case 18: name = "Reserv13"; break;
		case 19: name = "Reserv14"; break;
		case 20: name = "Reserv15"; break;
		case 21: name = "Reserv16"; break;
		case 22: name = "Reserv17"; break;
		case 23: name = "BadIRQ"; break;
		case 24: name = "IRQ1"; break;
		case 25: name = "EXT"; break;
		case 26: name = "IRQ3"; break;
		case 27: name = "HBLANK"; break;
		case 28: name = "IRQ5"; break;
		case 29: name = "VBLANK"; break;
		case 30: name = "IRQ7"; break;
		case 31: name = "Trap0"; break;
		case 32: name = "Trap1"; break;
		case 33: name = "Trap2"; break;
		case 34: name = "Trap3"; break;
		case 35: name = "Trap4"; break;
		case 36: name = "Trap5"; break;
		case 37: name = "Trap6"; break;
		case 38: name = "Trap7"; break;
		case 39: name = "Trap8"; break;
		case 40: name = "Trap9"; break;
		case 41: name = "Trap10"; break;
		case 42: name = "Trap11"; break;
		case 43: name = "Trap12"; break;
		case 44: name = "Trap13"; break;
		case 45: name = "Trap14"; break;
		case 46: name = "Trap15"; break;
		case 47: name = "Reserv30"; break;
		case 48: name = "Reserv31"; break;
		case 49: name = "Reserv32"; break;
		case 50: name = "Reserv33"; break;
		case 51: name = "Reserv34"; break;
		case 52: name = "Reserv35"; break;
		case 53: name = "Reserv36"; break;
		case 54: name = "Reserv37"; break;
		case 55: name = "Reserv38"; break;
		case 56: name = "Reserv39"; break;
		case 57: name = "Reserv3A"; break;
		case 58: name = "Reserv3B"; break;
		case 59: name = "Reserv3C"; break;
		case 60: name = "Reserv3D"; break;
		case 61: name = "Reserv3E"; break;
		case 62: name = "Reserv3F"; break;
		default: name = NULL;
		}
		if (!name || !vtable[i]) continue;
		addsym (ret, name, vtable[i]);
	}
	return ret;
}
Ejemplo n.º 6
0
/*
	function to drop an object
 */
void dropobj (void)
{
	int i, pitflag=0;
	char *p;
	long amt;

	p = &item[playerx][playery];
	while (1) {
		if ((i = whatitem("drop"))==ESC)  
			return;
		if (i=='*') 
			showstr(); 
		else {
			/* drop some gold */
			if (i=='.')	{
				if (*p == OPIT) pitflag=1;
				if (*p && !pitflag) { 
				lprcat("\nThere's something here already!"); 
						return; 
				}
				lprcat("\n\n");
				cl_dn(1,23);
				lprcat("How much gold do you drop? ");
				if ((amt=readnum((long)c[GOLD])) <= 0) return;
				if (amt>c[GOLD]) { 
					lprcat("\nYou don't have that much!"); 
					return; 
				}
				if (amt<=32767) { 
					*p=OGOLDPILE; 
					i=(int)amt; 
				}
				else if (amt<=327670L) { 
					*p=ODGOLD; 
					i=(int)amt/10; 
					amt = 10L*i; 
				}
				else if (amt<=3276700L) { 
					*p=OMAXGOLD; 
					i=(int)amt/100; 
					amt = 100L*i; 
				}
				else if (amt<=32767000L) { 
					*p=OKGOLD; 
					i=(int)amt/1000; 
					amt = 1000L*i; 
				}
				else { 
					*p=OKGOLD; 
					i=(int)32767; 
					amt = 32767000L; 
				}
				c[GOLD] -= amt; 
				lprintf("You drop %d gold piece%s.",(long)amt,(amt==1)?"":"s");
				if (pitflag) {
					*p = OPIT;
					lprcat("\nThe gold disappears down the pit.");
				} else
					iarg[playerx][playery]=i; 
				bottomgold();
				know[playerx][playery]=0; 
				dropflag=1;  
				return;
			}
			drop_object(i-'a');
			return;
		}
	}
}
Ejemplo n.º 7
0
// Main input routine
// - doesn't accept words longer than MAXWORDLEN or containing caps
char *boggle_getline(char *q)
{
    int ch, done;
    char *p;
    int row, col;

    p = q;
    done = 0;
    while (!done) {
	ch = timerch();
	switch (ch) {
	    case '\n':
	    case '\r':
	    case ' ':
		done = 1;
		break;
	    case '\033':
		findword();
		break;
	    case '\177':      // <del>
	    case '\010':      // <bs>
		if (p == q)
		    break;
		p--;
		getyx(stdscr, row, col);
		move(row, col - 1);
		clrtoeol();
		refresh();
		break;
	    case '\025':      // <^u>
	    case '\027':      // <^w>
		if (p == q)
		    break;
		getyx(stdscr, row, col);
		move(row, col - (int) (p - q));
		p = q;
		clrtoeol();
		refresh();
		break;
#ifdef SIGTSTP
	    case '\032':      // <^z>
		stop_catcher(0);
		break;
#endif
	    case '\023':      // <^s>
		stoptime();
		printw("<PAUSE>");
		refresh();
		while ((ch = inputch()) != '\021' && ch != '\023');
		move(crow, ccol);
		clrtoeol();
		refresh();
		starttime();
		break;
	    case '\003':      // <^c>
		cleanup();
		exit(0);
	     /*NOTREACHED*/ case '\004':	// <^d>
		done = 1;
		ch = EOF;
		break;
	    case '\014':      // <^l>
	    case '\022':      // <^r>
		redraw();
		break;
	    case '?':
		stoptime();
		if (help() < 0)
		    showstr("Can't open help file", 1);
		starttime();
		break;
	    default:
		if (!islower(ch))
		    break;
		if ((int) (p - q) == MAXWORDLEN) {
		    p = q;
		    badword();
		    break;
		}
		*p++ = ch;
		addch(ch);
		refresh();
		break;
	}
    }
    *p = '\0';
    if (ch == EOF)
	return (char *) NULL;
    return q;
}
Ejemplo n.º 8
0
Archivo: main.c Proyecto: HunterZ/larn
/*
 * parse()
 *
 * get and execute a command
 */
static void parse(void)
{
	int i, j, k, flag;

    while   (1)
        {
        k = yylex();
        switch(k)   /*  get the token from the input and switch on it   */
            {
            case 'h':   moveplayer(4);  return;     /*  west        */
            case 'H':   run(4);         return;     /*  west        */
            case 'l':   moveplayer(2);  return;     /*  east        */
            case 'L':   run(2);         return;     /*  east        */
            case 'j':   moveplayer(1);  return;     /*  south       */
            case 'J':   run(1);         return;     /*  south       */
            case 'k':   moveplayer(3);  return;     /*  north       */
            case 'K':   run(3);         return;     /*  north       */
            case 'u':   moveplayer(5);  return;     /*  northeast   */
            case 'U':   run(5);         return;     /*  northeast   */
            case 'y':   moveplayer(6);  return;     /*  northwest   */
            case 'Y':   run(6);         return;     /*  northwest   */
            case 'n':   moveplayer(7);  return;     /*  southeast   */
            case 'N':   run(7);         return;     /*  southeast   */
            case 'b':   moveplayer(8);  return;     /*  southwest   */
            case 'B':   run(8);         return;     /*  southwest   */

            case '.':                               /*  stay here       */
                if (yrepcount) 
                    viewflag=1;
                return;

            case 'c':
                yrepcount=0;
                cast();
                return;     /*  cast a spell    */

            case 'd':
                yrepcount=0;
                if (c[TIMESTOP]==0)
                    dropobj();
                return; /*  to drop an object   */

            case 'e':
                yrepcount=0;
                if (c[TIMESTOP]==0)
                    if (!floor_consume( OCOOKIE, "eat" ))
                        consume( OCOOKIE, "eat", showeat );
                return; /*  to eat a fortune cookie */

            case 'g':   
                yrepcount = 0 ;
                cursors();
                lprintf("\nThe stuff you are carrying presently weighs %d pounds",(long)packweight());
                break ;

            case 'i':       /* inventory */
                yrepcount=0;
                nomove=1;
                showstr(FALSE);
                return;

            case 'p':           /* pray at an altar */
                yrepcount = 0;
                    pray_at_altar();
                return;

            case 'q':           /* quaff a potion */
                yrepcount=0;
                if (c[TIMESTOP]==0)
                    if (!floor_consume( OPOTION, "quaff"))
                        consume( OPOTION, "quaff", showquaff );
                return;

            case 'r':
                yrepcount=0;
                if (c[BLINDCOUNT])
                    {
                    cursors();
                    lprcat("\nYou can't read anything when you're blind!");
                    }
                else if (c[TIMESTOP]==0)
                    if (!floor_consume( OSCROLL, "read" ))
                        if (!floor_consume( OBOOK, "read" ))
                            consume( OSCROLL, "read", showread );
                return;     /*  to read a scroll    */

            case 's':
                yrepcount = 0 ;
                    sit_on_throne();
                return ;

            case 't':                       /* Tidy up at fountain */
                yrepcount = 0 ;
                    wash_fountain() ;
                return ;

            case 'v':
                yrepcount=0;
                nomove = 1;
                cursors();
                lprintf("\nLarn, Version %d.%d.%d, Diff=%d",(long)VERSION,(long)SUBVERSION,(long)PATCHLEVEL,(long)c[HARDGAME]);
                if (wizard)
                    lprcat(" Wizard");
                if (cheat) 
                    lprcat(" Cheater");
                return;

            case 'w':                       /*  wield a weapon */
                yrepcount=0;
                wield();
                return;

            case 'A':
                yrepcount = 0;
                    desecrate_altar();
                return;

            case 'C':                       /* Close something */
                yrepcount = 0 ;
                    close_something();
                return;

            case 'D':                       /* Drink at fountain */
                yrepcount = 0 ;
                    drink_fountain() ;
                return ;

            case 'E':               /* Enter a building */
                yrepcount = 0 ;
                    enter() ;
                break ;

            case 'I':              /*  list spells and scrolls */
                yrepcount=0;
                seemagic(0);
                nomove=1;
                return;

            case 'O':               /* Open something */
                yrepcount = 0 ;
                    open_something();
                return;

            case 'P':
                cursors();
                yrepcount = 0;
                nomove = 1;
                if (outstanding_taxes>0)
                    lprintf("\nYou presently owe %d gp in taxes.",(long)outstanding_taxes);
                else
                    lprcat("\nYou do not owe any taxes.");
                return;

            case 'Q':    /*  quit        */
                yrepcount=0;
                quit();
                nomove=1;
                return;

            case 'R' :          /* remove gems from a throne */
                yrepcount = 0 ;
                    remove_gems( );
                return ;

            case 'S':
                /* And do the save.
                 */
                cursors();
                lprintf("\nSaving to `%s' . . . ", savefilename);
                lflush();
                save_mode = 1;
                savegame(savefilename);
                clear();
                lflush();
                wizard=1;
                died(-257); /* doesn't return */
                break;


            case 'T':   yrepcount=0;    cursors();  if (c[SHIELD] != -1) { c[SHIELD] = -1; lprcat("\nYour shield is off"); bottomline(); } else
                                        if (c[WEAR] != -1) { c[WEAR] = -1; lprcat("\nYour armor is off"); bottomline(); }
                        else lprcat("\nYou aren't wearing anything");
                        return;

            case 'W':
                yrepcount=0;
                wear();
                return; /*  wear armor  */

            case 'Z':
                yrepcount=0;
                if (c[LEVEL]>9) 
                    { 
                    oteleport(1);
                    return; 
                    }
                cursors(); 
                lprcat("\nAs yet, you don't have enough experience to use teleportation");
                return; /*  teleport yourself   */

            case ' ':   yrepcount=0;    nomove=1;  return;

            case 'L'-64:  yrepcount=0;  drawscreen();  nomove=1; return;    /*  look        */

#if WIZID
#ifdef EXTRA
            case 'A'-64:    yrepcount=0;    nomove=1; if (wizard) { diag(); return; }  /*   create diagnostic file */
                        return;
#endif
#endif
	    
	    case '<':                       /* Go up stairs or vol shaft */
                yrepcount = 0;
                    up_stairs();
                return ;

            case '>':                       /* Go down stairs or vol shaft*/
                yrepcount = 0 ;
                    down_stairs();
                return ;

            case '?':                       /* give the help screen */
                yrepcount=0;
                help();
                nomove=1;
                return; 

        case ',':                       /* pick up an item */
            yrepcount = 0 ;
            /* pickup, don't identify or prompt for action */
            lookforobject( FALSE, TRUE, FALSE );
        return;

            case ':':                       /* look at object */
                yrepcount = 0 ;
            /* identify, don't pick up or prompt for action */
                    lookforobject( TRUE, FALSE, FALSE );
                nomove = 1;  /* assumes look takes no time */
                return;

        case '/':        /* identify object/monster */
            specify_object();
            nomove = 1 ;
            yrepcount = 0 ;
            return;

        case '^':                       /* identify traps */
                flag = yrepcount = 0;
                cursors();
                lprc('\n');
                for (j=playery-1; j<playery+2; j++)
                    {
                    if (j < 0)
                        j=0;
                    if (j >= MAXY)
                        break;
                    for (i=playerx-1; i<playerx+2; i++)
                        {
                        if (i < 0) 
                            i=0;
                        if (i >= MAXX) 
                            break;
                        switch(item[i][j])
                            {
                            case OTRAPDOOR:     case ODARTRAP:
                            case OTRAPARROW:    case OTELEPORTER:
                            case OPIT:
                                lprcat("\nIts ");
                                lprcat(objectname[item[i][j]]);
                                flag++;
                            };
                        }
                    }
                if (flag==0) 
                    lprcat("\nNo traps are visible");
                return;

#if WIZID
            case '_':   /*  this is the fudge player password for wizard mode*/
                        yrepcount=0;    cursors(); nomove=1;

                        if (getpassword()==0)
                            {
                            scbr(); /* system("stty -echo cbreak"); */ return;
                            }
                        wizard=1;  scbr(); /* system("stty -echo cbreak"); */
                        for (i=0; i<6; i++)  c[i]=70;  iven[0]=iven[1]=0;
                        take(OPROTRING,50);   take(OLANCE,25);  c[WIELD]=1;
                        c[LANCEDEATH]=1;   c[WEAR] = c[SHIELD] = -1;
                        raiseexperience(6000000L);  c[AWARENESS] += 25000;
                        {
                        int i,j;
                        for (i=0; i<MAXY; i++)
                            for (j=0; j<MAXX; j++)  know[j][i]=KNOWALL;
                        for (i=0; i<SPNUM; i++) spelknow[i]=1;
                        for (i=0; i<MAXSCROLL; i++)  scrollname[i][0]=' ';
                        for (i=0; i<MAXPOTION; i++)  potionname[i][0]=' ';
                        }
                        for (i=0; i<MAXSCROLL; i++)
                          if (strlen(scrollname[i])>2) /* no null items */
                            { item[i][0]=OSCROLL; iarg[i][0]=i; }
                        for (i=MAXX-1; i>MAXX-1-MAXPOTION; i--)
                          if (strlen(potionname[i-MAXX+MAXPOTION])>2) /* no null items */
                            { item[i][0]=OPOTION; iarg[i][0]=i-MAXX+MAXPOTION; }
                        for (i=1; i<MAXY; i++)
                            { item[0][i]=i; iarg[0][i]=0; }
                        for (i=MAXY; i<MAXY+MAXX; i++)
                            { item[i-MAXY][MAXY-1]=i; iarg[i-MAXY][MAXY-1]=0; }
            for (i=MAXX+MAXY; i<MAXOBJECT; i++)
                {
                item[MAXX-1][i-MAXX-MAXY]=i;
                iarg[MAXX-1][i-MAXX-MAXY]=0;
                }
                        c[GOLD]+=250000;    drawscreen();   return;
#endif

            };
        }
}
Ejemplo n.º 9
0
/*
	parse()

	get and execute a command
 */
static void
parse(void)
{
	int    i, j, k, flag;
	while (1) {
		k = yylex();
		switch (k) {	/* get the token from the input and switch on
				 * it	 */
		case 'h':
			moveplayer(4);
			return;	/* west		 */
		case 'H':
			run(4);
			return;	/* west		 */
		case 'l':
			moveplayer(2);
			return;	/* east		 */
		case 'L':
			run(2);
			return;	/* east		 */
		case 'j':
			moveplayer(1);
			return;	/* south		 */
		case 'J':
			run(1);
			return;	/* south		 */
		case 'k':
			moveplayer(3);
			return;	/* north		 */
		case 'K':
			run(3);
			return;	/* north		 */
		case 'u':
			moveplayer(5);
			return;	/* northeast	 */
		case 'U':
			run(5);
			return;	/* northeast	 */
		case 'y':
			moveplayer(6);
			return;	/* northwest	 */
		case 'Y':
			run(6);
			return;	/* northwest	 */
		case 'n':
			moveplayer(7);
			return;	/* southeast	 */
		case 'N':
			run(7);
			return;	/* southeast	 */
		case 'b':
			moveplayer(8);
			return;	/* southwest	 */
		case 'B':
			run(8);
			return;	/* southwest	 */

		case '.':
			if (yrepcount)
				viewflag = 1;
			return;	/* stay here		 */

		case 'w':
			yrepcount = 0;
			wield();
			return;	/* wield a weapon */

		case 'W':
			yrepcount = 0;
			wear();
			return;	/* wear armor	 */

		case 'r':
			yrepcount = 0;
			if (c[BLINDCOUNT]) {
				cursors();
				lprcat("\nYou can't read anything when you're blind!");
			} else if (c[TIMESTOP] == 0)
				readscr();
			return;	/* to read a scroll	 */

		case 'q':
			yrepcount = 0;
			if (c[TIMESTOP] == 0)
				quaff();
			return;	/* quaff a potion		 */

		case 'd':
			yrepcount = 0;
			if (c[TIMESTOP] == 0)
				dropobj();
			return;	/* to drop an object	 */

		case 'c':
			yrepcount = 0;
			cast();
			return;	/* cast a spell	 */

		case 'i':
			yrepcount = 0;
			nomove = 1;
			showstr();
			return;	/* status		 */

		case 'e':
			yrepcount = 0;
			if (c[TIMESTOP] == 0)
				eatcookie();
			return;	/* to eat a fortune cookie */

		case 'D':
			yrepcount = 0;
			seemagic(0);
			nomove = 1;
			return;	/* list spells and scrolls */

		case '?':
			yrepcount = 0;
			help();
			nomove = 1;
			return;	/* give the help screen */

		case 'S':
			clear();
			lprcat("Saving . . .");
			lflush();
			savegame(savefilename);
			wizard = 1;
			died(-257);	/* save the game - doesn't return	 */

		case 'Z':
			yrepcount = 0;
			if (c[LEVEL] > 9) {
				oteleport(1);
				return;
			}
			cursors();
			lprcat("\nAs yet, you don't have enough experience to use teleportation");
			return;	/* teleport yourself	 */

		case '^':	/* identify traps */
			flag = yrepcount = 0;
			cursors();
			lprc('\n');
			for (j = playery - 1; j < playery + 2; j++) {
				if (j < 0)
					j = 0;
				if (j >= MAXY)
					break;
				for (i = playerx - 1; i < playerx + 2; i++) {
					if (i < 0)
						i = 0;
					if (i >= MAXX)
						break;
					switch (item[i][j]) {
					case OTRAPDOOR:
					case ODARTRAP:
					case OTRAPARROW:
					case OTELEPORTER:
						lprcat("\nIt's ");
						lprcat(objectname[item[i][j]]);
						flag++;
					};
				}
			}
			if (flag == 0)
				lprcat("\nNo traps are visible");
			return;

#if WIZID
		case '_':	/* this is the fudge player password for
				 * wizard mode */
			yrepcount = 0;
			cursors();
			nomove = 1;
			if (userid != wisid) {
				lprcat("Sorry, you are not empowered to be a wizard.\n");
				scbr();	/* system("stty -echo cbreak"); */
				lflush();
				return;
			}
			if (getpassword() == 0) {
				scbr();	/* system("stty -echo cbreak"); */
				return;
			}
			wizard = 1;
			scbr();	/* system("stty -echo cbreak"); */
			for (i = 0; i < 6; i++)
				c[i] = 70;
			iven[0] = iven[1] = 0;
			take(OPROTRING, 50);
			take(OLANCE, 25);
			c[WIELD] = 1;
			c[LANCEDEATH] = 1;
			c[WEAR] = c[SHIELD] = -1;
			raiseexperience(6000000L);
			c[AWARENESS] += 25000;
			{
				int    i, j;
				for (i = 0; i < MAXY; i++)
					for (j = 0; j < MAXX; j++)
						know[j][i] = 1;
				for (i = 0; i < SPNUM; i++)
					spelknow[i] = 1;
				for (i = 0; i < MAXSCROLL; i++)
					scrollname[i] = scrollhide[i];
				for (i = 0; i < MAXPOTION; i++)
					potionname[i] = potionhide[i];
			}
			for (i = 0; i < MAXSCROLL; i++)
				if (strlen(scrollname[i]) > 2) {	/* no null items */
					item[i][0] = OSCROLL;
					iarg[i][0] = i;
				}
			for (i = MAXX - 1; i > MAXX - 1 - MAXPOTION; i--)
				if (strlen(potionname[i - MAXX + MAXPOTION]) > 2) {	/* no null items */
					item[i][0] = OPOTION;
					iarg[i][0] = i - MAXX + MAXPOTION;
				}
			for (i = 1; i < MAXY; i++) {
				item[0][i] = i;
				iarg[0][i] = 0;
			}
			for (i = MAXY; i < MAXY + MAXX; i++) {
				item[i - MAXY][MAXY - 1] = i;
				iarg[i - MAXY][MAXY - 1] = 0;
			}
			for (i = MAXX + MAXY; i < MAXX + MAXY + MAXY; i++) {
				item[MAXX - 1][i - MAXX - MAXY] = i;
				iarg[MAXX - 1][i - MAXX - MAXY] = 0;
			}
			c[GOLD] += 25000;
			drawscreen();
			return;
#endif

		case 'T':
			yrepcount = 0;
			cursors();
			if (c[SHIELD] != -1) {
				c[SHIELD] = -1;
				lprcat("\nYour shield is off");
				bottomline();
			} else if (c[WEAR] != -1) {
				c[WEAR] = -1;
				lprcat("\nYour armor is off");
				bottomline();
			} else
				lprcat("\nYou aren't wearing anything");
			return;

		case 'g':
			cursors();
			lprintf("\nThe stuff you are carrying presently weighs %ld pounds", (long) packweight());
		case ' ':
			yrepcount = 0;
			nomove = 1;
			return;

		case 'v':
			yrepcount = 0;
			cursors();
			lprintf("\nCaverns of Larn, Version %ld.%ld, Diff=%ld",
				(long) VERSION, (long) SUBVERSION,
				(long) c[HARDGAME]);
			if (wizard)
				lprcat(" Wizard");
			nomove = 1;
			if (cheat)
				lprcat(" Cheater");
			lprcat(copyright);
			return;

		case 'Q':
			yrepcount = 0;
			quit();
			nomove = 1;
			return;	/* quit		 */

		case 'L' - 64:
			yrepcount = 0;
			drawscreen();
			nomove = 1;
			return;	/* look		 */

#if WIZID
#ifdef EXTRA
		case 'A':
			yrepcount = 0;
			nomove = 1;
			if (wizard) {
				diag();
				return;
			}	/* create diagnostic file */
			return;
#endif
#endif
		case 'P':
			cursors();
			if (outstanding_taxes > 0)
				lprintf("\nYou presently owe %ld gp in taxes.",
					(long) outstanding_taxes);
			else
				lprcat("\nYou do not owe any taxes.");
			return;
		};
	}
}