Uxnasm now outputs a symbols file

This commit is contained in:
neauoire 2022-12-09 12:30:04 -08:00
parent 42aab23dc1
commit d4c55e2f48
2 changed files with 17 additions and 1 deletions

View File

@ -15,7 +15,7 @@
#f0af .System/g DEO2 #f0af .System/g DEO2
#f0af .System/b DEO2 #f0af .System/b DEO2
#0130 .Screen/width DEO2 #0150 .Screen/width DEO2
#0050 .Screen/height DEO2 #0050 .Screen/height DEO2
;await-src .Console/vector DEO2 ;await-src .Console/vector DEO2

View File

@ -448,6 +448,21 @@ review(char *filename)
p.mlen); p.mlen);
} }
static void
writesym(char *filename)
{
char symdst[0x40];
FILE *fp = fopen(scat(scpy(filename, symdst, slen(filename) + 1), ".sym"), "w");
int i;
if(fp != NULL) {
for(i = 0; i < p.llen; i++) {
fwrite(&p.labels[i].addr, 2, 1, fp);
fwrite(p.labels[i].name, slen(p.labels[i].name) + 1, 1, fp);
}
}
fclose(fp);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -464,5 +479,6 @@ main(int argc, char *argv[])
return !error("Assembly", "Output rom is empty."); return !error("Assembly", "Output rom is empty.");
fwrite(p.data + TRIM, p.length - TRIM, 1, dst); fwrite(p.data + TRIM, p.length - TRIM, 1, dst);
review(argv[2]); review(argv[2]);
writesym(argv[2]);
return 0; return 0;
} }