|
|
|
@ -61,7 +61,7 @@ static int parse(char *w, FILE *f, Context *ctx); |
|
|
|
static char * |
|
|
|
static char * |
|
|
|
push(char *s, char c) |
|
|
|
push(char *s, char c) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *d = dict; |
|
|
|
char *d; |
|
|
|
for(d = dict; d < dictnext; d++) { |
|
|
|
for(d = dict; d < dictnext; d++) { |
|
|
|
char *ss = s, *dd = d, a, b; |
|
|
|
char *ss = s, *dd = d, a, b; |
|
|
|
while((a = *dd++) == (b = *ss++)) |
|
|
|
while((a = *dd++) == (b = *ss++)) |
|
|
|
@ -126,7 +126,7 @@ walkmacro(Item *m, Context *ctx) |
|
|
|
char *dataptr = m->data, *_token = token; |
|
|
|
char *dataptr = m->data, *_token = token; |
|
|
|
while((c = *dataptr++)) { |
|
|
|
while((c = *dataptr++)) { |
|
|
|
if(c < 0x21) { |
|
|
|
if(c < 0x21) { |
|
|
|
*_token++ = 0x00; |
|
|
|
*_token = 0x00; |
|
|
|
if(token[0] && !parse(token, NULL, ctx)) return 0; |
|
|
|
if(token[0] && !parse(token, NULL, ctx)) return 0; |
|
|
|
_token = token; |
|
|
|
_token = token; |
|
|
|
} else if(_token - token < 0x2f) |
|
|
|
} else if(_token - token < 0x2f) |
|
|
|
@ -144,7 +144,7 @@ walkfile(FILE *f, Context *ctx) |
|
|
|
char *_token = token; |
|
|
|
char *_token = token; |
|
|
|
while(f && fread(&c, 1, 1, f)) { |
|
|
|
while(f && fread(&c, 1, 1, f)) { |
|
|
|
if(c < 0x21) { |
|
|
|
if(c < 0x21) { |
|
|
|
*_token++ = 0x00; |
|
|
|
*_token = 0x00; |
|
|
|
if(token[0] && !parse(token, f, ctx)) return 0; |
|
|
|
if(token[0] && !parse(token, f, ctx)) return 0; |
|
|
|
if(c == 0xa) ctx->line++; |
|
|
|
if(c == 0xa) ctx->line++; |
|
|
|
_token = token; |
|
|
|
_token = token; |
|
|
|
@ -153,7 +153,7 @@ walkfile(FILE *f, Context *ctx) |
|
|
|
else |
|
|
|
else |
|
|
|
return error_asm("Token size exceeded"); |
|
|
|
return error_asm("Token size exceeded"); |
|
|
|
} |
|
|
|
} |
|
|
|
*_token++ = 0; |
|
|
|
*_token = 0; |
|
|
|
return parse(token, f, ctx); |
|
|
|
return parse(token, f, ctx); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -293,7 +293,7 @@ static int |
|
|
|
assemble(char *filename) |
|
|
|
assemble(char *filename) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FILE *f; |
|
|
|
FILE *f; |
|
|
|
int res = 0; |
|
|
|
int res; |
|
|
|
Context ctx; |
|
|
|
Context ctx; |
|
|
|
ctx.line = 1; |
|
|
|
ctx.line = 1; |
|
|
|
ctx.path = push(filename, 0); |
|
|
|
ctx.path = push(filename, 0); |
|
|
|
|