commit 5e1c8965544dd7ed08e0dd7f01ac0a0807299cbc
parent 0f68e08688740a37aefda9560c8bc3b3d388ba87
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Thu, 12 Jan 2023 08:40:33 -0800
(uxnasm) endian-agnostic handling of symbols file writing
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git 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);
}
}