Without casting the pointer the +1 pointer offset yields the incorrect
high byte of the symbol address. There may be another way to fix it,
but this is what worked for me.
-Dave
--- a/src/uxnasm.c
+++ b/src/uxnasm.c
@@ -451,7 +451,7 @@ 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, 1, fp);
fwrite(&p.labels[i].addr, 1, 1, fp);
fwrite(p.labels[i].name, slen(p.labels[i].name) + 1, 1, fp);
}
Cheers Dave :)
Good catch, merged.
On 1/11/23, Dave VanEe <dave.vanee@gmail.com> wrote:
> Without casting the pointer the +1 pointer offset yields the incorrect
> high byte of the symbol address. There may be another way to fix it,
> but this is what worked for me.
>
> -Dave
>
> --- a/src/uxnasm.c
> +++ b/src/uxnasm.c
> @@ -451,7 +451,7 @@ 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, 1, fp);
> fwrite(&p.labels[i].addr, 1, 1, fp);
> fwrite(p.labels[i].name, slen(p.labels[i].name) + 1, 1, fp);
> }
>