ar i;
	unsigned j;
	for (i = j = 0; i < (SYMLEN / 2); i++)
	{
		j += (*symbol++ << 8) + *symbol++;
	}
	return(j % SYMBOLS);
}

/*
Function to sort the symbol table.  The function
returns the number of entries in the table.
*/

sortsym()
{
	int n, symcmp();
	struct symbtbl *tptr;
	n = 0;
	for (tptr = sympoint = symtbl; tptr < symend; tptr++)
	{
		if ((tptr -> symname[0] & 0x7f) != '\0')
		{
			movmem(tptr->symname,sympoint->symname,(SYMLEN+2));
			sympoint++;
			n++;
		}
	}
	qsort(&symtbl,n,(SYMLEN+2),&symcmp);
	return n;
}

/*
This function compares two symbols.  It returns zero if the
symbols are the same, not zero if they are different.
*/

symcmp(sym1,sym2)
char *sym1, *sym2;
{
	char i;
	int t;
	for (i = 0; i < SYMLEN; i++)
	{
		if ((t = (*sym1++ & 0x7f) - (*sym2++ & 0x7f)) != 0) break;
	}
	return(t);
}

/*
Function to abort an assembly.  The parameter reason holds a string that
will be printed to explain why the assembly bombed.  Note that I can't just
call exit since this will not restore the currently logged disk drive, and
software that changes the currently logged disk drive annoys me greatly.
*/

wipeout(reason)
char *reason;
{
	puts(reason);
	bdos(LOGDISK,curdrive);
	exit();
}
int n, symcmp();
	struct symbtbl *tptr;
	n = 0;
	for (tptr = sympoint = symtbl; tptr < symend; tptr++)
	{
		if ((tptr -> symname[0] & 0x7f) != '\0')
		{
			movmem(tptr->symname,sympoint->symname,(SYMLEN+2));
			sympoint++;
			n++;
		}
	}
	qsort(&symtbl,n,(SYMLEN+2),&symcmp);
	return n;
}

/*
This function compares two symbols.  It returns zero if the
symbols are the same, not zero if they are different.
*/

symcmp(sym1,sym2)
char *sym1, *sym2;
{
	char i;
	int t;
	for (i = 0; i < SYMLEN; i++)
	{
		if ((t = (*sym1++ & 0x7f) - (*sym2++ & 0x7f)) != 0) break;
	}
	return(t);
}

/*
Function to abort an assembly.  The parameter reason holds a string that
will be printed to explain why the assembly bombed.  Note that I can't just
c                            }
                                                switch (c = valu2)
                                                {
                                                    case '+':   valu1 += eval(ADDIT); break;

                                                    case '-':   valu1 -= eval(ADDIT); break;

                                                    case '*':   valu1 *= eval(MULT); break;

                                                    case '/':   valu1 /= eval(MULT); break;

                                                    case MOD:   valu1 %= eval(MULT); break;

                                                    case AND:	valu1 &= eval(LOG1); break;

                                                    case OR:    valu1 |= eval(LOG2); break;

                                                    case XOR:   valu1 ^= eval(LOG2); break;

                                                    case '>':   valu1 = (valu1 > eval(RELAT)) ? 0xffff : 0; break;

                                                    case GRTEQ: valu1 = (valu1 >= eval(RELAT)) ? 0xffff : 0; break;

                                                    case '=':   valu1 = (valu1 == eval(RELAT)) ? 0xffff : 0; break;

                                                    case NOTEQ: valu1 = (valu1 != eval(RELAT)) ? 0xffff : 0; break;

                                                    case '<':   valu1 = (valu1 < eval(RELAT)) ? 0xffff : 0; break;

                                                    case LESEQ: valu1 = (valu1 <= eval(RELAT)) ? 0xffff : 0; break;

                                                    case SHL:   if ((valu2 = eval(MULT)) > 15)
                                                                {
                                                                    evalerr = TRUE;
                                                                    markerr('E');
                                                                    break;
                                                                }
                                                                valu1 = valu1 << valu2;
                                                                break;

                                                    case SHR:   if ((valu2 = eval(MULT)) > 15)
                                                                {
                                                                    evalerr = TRUE;
                                                                    markerr('E');
                                                                    break;
                                                                }
                                                                valu1 = valu1 >> valu2;
                                                                break;

                                                    case ')':   if (prec == LPREN) return valu1;
                                                                else
        