uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit d4c55e2f481bccadbcb080de3fbe409b1524957f
parent 42aab23dc17679b1eebd29eacd11bdb3e3215e7b
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri,  9 Dec 2022 12:30:04 -0800

Uxnasm now outputs a symbols file

Diffstat:
Mprojects/utils/metadata.tal | 2+-
Msrc/uxnasm.c | 16++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/projects/utils/metadata.tal b/projects/utils/metadata.tal @@ -15,7 +15,7 @@ #f0af .System/g DEO2 #f0af .System/b DEO2 - #0130 .Screen/width DEO2 + #0150 .Screen/width DEO2 #0050 .Screen/height DEO2 ;await-src .Console/vector DEO2 diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -448,6 +448,21 @@ review(char *filename) 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 main(int argc, char *argv[]) { @@ -464,5 +479,6 @@ main(int argc, char *argv[]) return !error("Assembly", "Output rom is empty."); fwrite(p.data + TRIM, p.length - TRIM, 1, dst); review(argv[2]); + writesym(argv[2]); return 0; }