0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-30 09:43:02 +00:00

Added _rune

This commit is contained in:
neauoire 2022-11-10 20:54:53 -08:00
parent 02ecc2ee7d
commit f59b214ac1

View file

@ -303,26 +303,30 @@ parse(char *w, FILE *f)
if(!writeshort(shex(w + 1), 1)) return 0;
}
break;
case '.': /* literal byte zero-page */
case '_': /* raw byte relative */
makereference(p.scope, w, p.ptr);
if(!writelitbyte(0xff)) return 0;
if(!writebyte(0xff)) return 0;
break;
case ',': /* literal byte relative */
makereference(p.scope, w, p.ptr);
if(!writelitbyte(0xff)) return 0;
break;
case ';': /* literal short absolute */
case '-': /* raw byte absolute */
makereference(p.scope, w, p.ptr);
if(!writeshort(0xffff, 1)) return 0;
if(!writebyte(0xff)) return 0;
break;
case '.': /* literal byte zero-page */
makereference(p.scope, w, p.ptr);
if(!writelitbyte(0xff)) return 0;
break;
case ':': /* raw short absolute */
case '=':
makereference(p.scope, w, p.ptr);
if(!writeshort(0xffff, 0)) return 0;
break;
case '-': /* raw byte absolute */
case ';': /* literal short absolute */
makereference(p.scope, w, p.ptr);
if(!writebyte(0xff)) return 0;
if(!writeshort(0xffff, 1)) return 0;
break;
case '"': /* raw string */
i = 0;
@ -365,10 +369,12 @@ resolve(void)
for(i = 0; i < p.rlen; i++) {
Reference *r = &p.refs[i];
switch(r->rune) {
case '.':
case '_':
if(!(l = findlabel(r->name)))
return error("Unknown zero-page reference", r->name);
p.data[r->addr + 1] = l->addr & 0xff;
return error("Unknown relative reference", r->name);
p.data[r->addr] = (Sint8)(l->addr - r->addr - 2);
if((Sint8)p.data[r->addr] != (l->addr - r->addr - 2))
return error("Relative reference is too far", r->name);
l->refs++;
break;
case ',':
@ -379,11 +385,16 @@ resolve(void)
return error("Relative reference is too far", r->name);
l->refs++;
break;
case ';':
case '-':
if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name);
p.data[r->addr + 1] = l->addr >> 0x8;
p.data[r->addr + 2] = l->addr & 0xff;
p.data[r->addr] = l->addr & 0xff;
l->refs++;
break;
case '.':
if(!(l = findlabel(r->name)))
return error("Unknown zero-page reference", r->name);
p.data[r->addr + 1] = l->addr & 0xff;
l->refs++;
break;
case ':':
@ -394,10 +405,11 @@ resolve(void)
p.data[r->addr + 1] = l->addr & 0xff;
l->refs++;
break;
case '-':
case ';':
if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name);
p.data[r->addr] = l->addr & 0xff;
p.data[r->addr + 1] = l->addr >> 0x8;
p.data[r->addr + 2] = l->addr & 0xff;
l->refs++;
break;
default: