From 5e1c8965544dd7ed08e0dd7f01ac0a0807299cbc Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 12 Jan 2023 08:40:33 -0800 Subject: [PATCH] (uxnasm) endian-agnostic handling of symbols file writing --- src/uxnasm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index 68718bb..b43fa38 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -444,8 +444,9 @@ writesym(char *filename) fp = fopen(scat(scpy(filename, symdst, slen(filename) + 1), ".sym"), "w"); if(fp != NULL) { for(i = 0; i < p.llen; i++) { - fwrite(&p.labels[i].addr + 1, 1, 1, fp); - fwrite((Uint8*)&p.labels[i].addr, 1, 1, fp); + Uint8 hb = p.labels[i].addr >> 8, lb = p.labels[i].addr & 0xff; + fwrite(&hb, 1, 1, fp); + fwrite(&lb, 1, 1, fp); fwrite(p.labels[i].name, slen(p.labels[i].name) + 1, 1, fp); } }