Browse code

Uxnasm now outputs a symbols file

neauoire authored on 09/12/2022 20:30:04
Showing 2 changed files
... ...
@@ -15,7 +15,7 @@
15 15
 	#f0af .System/g DEO2
16 16
 	#f0af .System/b DEO2
17 17
 
18
-	#0130 .Screen/width DEO2
18
+	#0150 .Screen/width DEO2
19 19
 	#0050 .Screen/height DEO2
20 20
 
21 21
 	;await-src .Console/vector DEO2
... ...
@@ -448,6 +448,21 @@ review(char *filename)
448 448
 		p.mlen);
449 449
 }
450 450
 
451
+static void
452
+writesym(char *filename)
453
+{
454
+	char symdst[0x40];
455
+	FILE *fp = fopen(scat(scpy(filename, symdst, slen(filename) + 1), ".sym"), "w");
456
+	int i;
457
+	if(fp != NULL) {
458
+		for(i = 0; i < p.llen; i++) {
459
+			fwrite(&p.labels[i].addr, 2, 1, fp);
460
+			fwrite(p.labels[i].name, slen(p.labels[i].name) + 1, 1, fp);
461
+		}
462
+	}
463
+	fclose(fp);
464
+}
465
+
451 466
 int
452 467
 main(int argc, char *argv[])
453 468
 {
... ...
@@ -464,5 +479,6 @@ main(int argc, char *argv[])
464 479
 		return !error("Assembly", "Output rom is empty.");
465 480
 	fwrite(p.data + TRIM, p.length - TRIM, 1, dst);
466 481
 	review(argv[2]);
482
+	writesym(argv[2]);
467 483
 	return 0;
468 484
 }