commit 08f20d35c84bd733b1979320d5429a946f08f87c
parent a92fd8fb223524a519a8161fd9b02bd6ee38f191
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sat, 28 Aug 2021 07:51:48 +0100
Fixed addr being reset in include's pass1
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -36,6 +36,7 @@ typedef struct {
} Program;
Program p;
+static Uint16 addr = 0;
/* clang-format off */
@@ -170,7 +171,7 @@ makemacro(char *name, FILE *f)
}
static int
-makelabel(char *name, Uint16 addr)
+makelabel(char *name)
{
Label *l;
if(findlabel(name))
@@ -303,7 +304,6 @@ static int
pass1(FILE *f)
{
int ccmnt = 0;
- Uint16 addr = 0;
char w[64], scope[64], subw[64];
while(fscanf(f, "%63s", w) == 1) {
if(skipblock(w, &ccmnt, '(', ')')) continue;
@@ -317,11 +317,11 @@ pass1(FILE *f)
if(!makemacro(w + 1, f))
return error("Pass 1 - Invalid macro", w);
} else if(w[0] == '@') {
- if(!makelabel(w + 1, addr))
+ if(!makelabel(w + 1))
return error("Pass 1 - Invalid label", w);
scpy(w + 1, scope, 64);
} else if(w[0] == '&') {
- if(!makelabel(sublabel(subw, scope, w + 1), addr))
+ if(!makelabel(sublabel(subw, scope, w + 1)))
return error("Pass 1 - Invalid sublabel", w);
} else if(scmp(w, "include", 8)) {
if(!doinclude(f, pass1))