~ndiddy/a65

a636aa0c2c9cac585fcdc7ffb0bb5f86a6bcaa3a — Nathan Misner 4 months ago 4f2f4f2
fixed mac compiler warnings and a small bug
5 files changed, 15 insertions(+), 14 deletions(-)

M .gitignore
M a65.c
M a65.h
M a65eval.c
M a65util.c
M .gitignore => .gitignore +1 -0
@@ 13,6 13,7 @@ variables.asm
*.o
*.d
a65
*.swp

# User-specific files
*.rsuser

M a65.c => a65.c +8 -7
@@ 49,7 49,8 @@ char errcode, line[MAXLINE + 1], title[MAXLINE];
int pass = 0;
int eject, filesp, forwd, forceabs, listhex;
unsigned address, argattr, bytes, errors, listleft, obj[MAXLINE], pagelen, pc;
FILE_INFO filestk[FILES], *source;
FILE_INFO filestk[FILES];
FILE *source;
TOKEN token;

/* Static function definitions: */


@@ 200,7 201,7 @@ static void do_label() {
    if (label[0]) {
		listhex = TRUE;

		// strip off the trailing colon if it exists
		/* strip off the trailing colon if it exists */
		ch = label;
		while (*ch) {
			if ((ch[0] == ':') && (ch[1] == '\0')) {


@@ 210,14 211,14 @@ static void do_label() {
		}

		if (pass == 1) {
			// add the label to the symbol tree
			/* add the label to the symbol tree */
			if (!((l = new_symbol(label)) -> attr)) {
				l -> attr = FORWD + VAL;
				l -> valu = pc;
			}
		}
		else {
			if (l = find_symbol(label)) {
			if ((l = find_symbol(label))) {
				l -> attr = VAL;
				if (l -> valu != pc) error('M');
			}


@@ 400,7 401,7 @@ static void pseudo_op() {
				}
			}
			else {
				if (l = find_symbol(label)) {
				if ((l = find_symbol(label))) {
					l -> attr = VAL;
					address = expr();
					if (forwd) error('P');


@@ 416,7 417,7 @@ static void pseudo_op() {
		if (++ifsp == IFDEPTH) fatal_error(IFOFLOW);
		address = expr();
		if (forwd) { error('P');  address = TRUE; }
		if (off) { listhex = FALSE;  ifstack[ifsp] = NULL; }
		if (off) { listhex = FALSE;  ifstack[ifsp] = 0; }
		else {
			ifstack[ifsp] = address ? ON : OFF;
			if (!address) off = TRUE;


@@ 498,7 499,7 @@ static void pseudo_op() {
				}
			}
			else {
				if (l = find_symbol(label)) {
				if ((l = find_symbol(label))) {
					address = expr();
					if (forwd) error('P');
					else if (l -> attr & SOFT) {

M a65.h => a65.h +1 -1
@@ 147,7 147,7 @@ typedef enum {
	IMM,			/* immediate designator */
	REG,			/* register designator */
	ABS,			/* force absolute addressing */
};
} LEX_ATTR;

/*  Lexical analyzer (A65EVAL.C) token attribute word flag masks:	*/


M a65eval.c => a65eval.c +4 -4
@@ 59,7 59,7 @@ unsigned do_args() {
		break;

	case EOL:   
		argattr = NULL;  
		argattr = 0;  
		break;

	case IMM:


@@ 94,7 94,7 @@ unsigned do_args() {
				argattr = (ARGIND + ARGNUM);  trash();
				if ((c = popc()) == '\n') return u;
				if (c == ',') {
					if (lex() -> attr & TYPE != REG || token.valu != 'Y')
					if (((lex() -> attr) & TYPE) != REG || token.valu != 'Y')
						exp_error('S');
					else argattr += ARGY;
					return bad ? 0 : u;


@@ 247,13 247,13 @@ TOKEN *lex() {
	trash();
	if (isalph(c = popc())) {
		pushc(c);  pops(token.sval);
		if (o = find_operator(token.sval)) {
		if ((o = find_operator(token.sval))) {
			token.attr = o -> attr;
			token.valu = o -> valu;
		}
		else {
			token.attr = VAL;  token.valu = 0;
			if (s = find_symbol(token.sval)) {
			if ((s = find_symbol(token.sval))) {
				token.valu = s -> valu;
				if (pass == 2 && s -> attr & FORWD) forwd = TRUE;
			}

M a65util.c => a65util.c +1 -2
@@ 281,7 281,7 @@ static void list_sym(SYMBOL *sp) {
    if (sp) {
		list_sym(sp -> left);
		fprintf(list,"%04x  %-10s",sp -> valu,sp -> sname);
		if (col = ++col % SYMCOLS) fprintf(list,"    ");
		if ((++col) % SYMCOLS) fprintf(list,"    ");
		else {
			fprintf(list,"\n");
			if (sp -> right) check_page();


@@ 307,7 307,6 @@ static void check_page() {
static FILE *outfile = NULL;
static unsigned cnt = 0;
static unsigned addr = 0;
static unsigned sum = 0;
static uint8_t buf[HEXSIZE];

/*  Binary file open routine.  If the file is already open, a warning	*/