(uxnasm) More explicit resolve errors
This commit is contained in:
parent
cdd6008b7a
commit
68d6a5f604
|
@ -97,7 +97,7 @@ findopcode(char *s)
|
||||||
else if(s[m] == 'k')
|
else if(s[m] == 'k')
|
||||||
i |= (1 << 7);
|
i |= (1 << 7);
|
||||||
else
|
else
|
||||||
return 0;
|
return error_top("Unknown opcode mode", s);
|
||||||
m++;
|
m++;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
@ -177,7 +177,7 @@ makemacro(char *name, FILE *f, Context *ctx)
|
||||||
if(c == 0xa) ctx->line += 1;
|
if(c == 0xa) ctx->line += 1;
|
||||||
while(f && fread(&c, 1, 1, f) && c != '}') {
|
while(f && fread(&c, 1, 1, f) && c != '}') {
|
||||||
if(c == 0xa) ctx->line += 1;
|
if(c == 0xa) ctx->line += 1;
|
||||||
if(c == '%') return 0;
|
if(c == '%') return error_top("Nested macro", name);
|
||||||
if(c == '(')
|
if(c == '(')
|
||||||
walkcomment(f, ctx);
|
walkcomment(f, ctx);
|
||||||
else
|
else
|
||||||
|
@ -331,7 +331,7 @@ resolve(void)
|
||||||
for(i = 0; i < refs_len; i++) {
|
for(i = 0; i < refs_len; i++) {
|
||||||
Item *r = &refs[i], *l = findlabel(r->name);
|
Item *r = &refs[i], *l = findlabel(r->name);
|
||||||
Uint8 *rom = data + r->addr;
|
Uint8 *rom = data + r->addr;
|
||||||
if(!l) return 0;
|
if(!l) return error_top("Unknown label", r->name);
|
||||||
switch(r->rune) {
|
switch(r->rune) {
|
||||||
case '_':
|
case '_':
|
||||||
case ',':
|
case ',':
|
||||||
|
@ -401,7 +401,7 @@ main(int argc, char *argv[])
|
||||||
ptr = PAGE;
|
ptr = PAGE;
|
||||||
copy("on-reset", scope, 0);
|
copy("on-reset", scope, 0);
|
||||||
if(argc == 1) return error_top("usage", "uxnasm [-v] input.tal output.rom");
|
if(argc == 1) return error_top("usage", "uxnasm [-v] input.tal output.rom");
|
||||||
if(scmp(argv[1], "-v", 2)) return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 28 Mar 2024.\n");
|
if(scmp(argv[1], "-v", 2)) return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 29 Mar 2024.\n");
|
||||||
if(!assemble(argv[1]) || !length) return !error_top("Assembly", "Failed to assemble rom.");
|
if(!assemble(argv[1]) || !length) return !error_top("Assembly", "Failed to assemble rom.");
|
||||||
if(!resolve()) return !error_top("Assembly", "Failed to resolve symbols.");
|
if(!resolve()) return !error_top("Assembly", "Failed to resolve symbols.");
|
||||||
if(!build(argv[2])) return !error_top("Assembly", "Failed to build rom.");
|
if(!build(argv[2])) return !error_top("Assembly", "Failed to build rom.");
|
||||||
|
|
Loading…
Reference in New Issue