(uxnasm) Added support for = and - runes

This commit is contained in:
neauoire 2022-11-09 16:21:07 -08:00
parent 1b2049e238
commit 261b574671
1 changed files with 13 additions and 1 deletions

View File

@ -316,9 +316,14 @@ parse(char *w, FILE *f)
if(!writeshort(0xffff, 1)) return 0; if(!writeshort(0xffff, 1)) return 0;
break; break;
case ':': /* raw short absolute */ case ':': /* raw short absolute */
case '=':
makereference(p.scope, w, p.ptr); makereference(p.scope, w, p.ptr);
if(!writeshort(0xffff, 0)) return 0; if(!writeshort(0xffff, 0)) return 0;
break; break;
case '-': /* raw byte absolute */
makereference(p.scope, w, p.ptr);
if(!writebyte(0xff)) return 0;
break;
case '"': /* raw string */ case '"': /* raw string */
i = 0; i = 0;
while((c = w[++i])) while((c = w[++i]))
@ -375,6 +380,7 @@ resolve(void)
l->refs++; l->refs++;
break; break;
case ';': case ';':
case '=':
if(!(l = findlabel(r->name))) if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name); return error("Unknown absolute reference", r->name);
p.data[r->addr + 1] = l->addr >> 0x8; p.data[r->addr + 1] = l->addr >> 0x8;
@ -384,10 +390,16 @@ resolve(void)
case ':': case ':':
if(!(l = findlabel(r->name))) if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name); return error("Unknown absolute reference", r->name);
p.data[r->addr + 0] = l->addr >> 0x8; p.data[r->addr] = l->addr >> 0x8;
p.data[r->addr + 1] = l->addr & 0xff; p.data[r->addr + 1] = l->addr & 0xff;
l->refs++; l->refs++;
break; break;
case '-':
if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name);
p.data[r->addr] = l->addr & 0xff;
l->refs++;
break;
default: default:
return error("Unknown reference", r->name); return error("Unknown reference", r->name);
} }