(uxnasm) Added support for label sized pads
This commit is contained in:
parent
edfa734817
commit
00ed056e51
25
src/uxnasm.c
25
src/uxnasm.c
|
@ -253,6 +253,7 @@ parse(char *w, FILE *f)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char word[0x40], subw[0x40], c;
|
char word[0x40], subw[0x40], c;
|
||||||
|
Label *l;
|
||||||
Macro *m;
|
Macro *m;
|
||||||
if(slen(w) >= 63)
|
if(slen(w) >= 63)
|
||||||
return error("Invalid token", w);
|
return error("Invalid token", w);
|
||||||
|
@ -278,14 +279,30 @@ parse(char *w, FILE *f)
|
||||||
return error("Invalid macro", w);
|
return error("Invalid macro", w);
|
||||||
break;
|
break;
|
||||||
case '|': /* pad-absolute */
|
case '|': /* pad-absolute */
|
||||||
if(!sihx(w + 1))
|
if(sihx(w + 1))
|
||||||
return error("Invalid padding", w);
|
|
||||||
p.ptr = shex(w + 1);
|
p.ptr = shex(w + 1);
|
||||||
|
else if(w[1] == '&') {
|
||||||
|
if(!sublabel(subw, p.scope, w + 2) || !(l = findlabel(subw)))
|
||||||
|
return error("Invalid sublabel", w);
|
||||||
|
p.ptr = l->addr;
|
||||||
|
} else {
|
||||||
|
if(!(l = findlabel(w + 1)))
|
||||||
|
return error("Invalid label", w);
|
||||||
|
p.ptr = l->addr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '$': /* pad-relative */
|
case '$': /* pad-relative */
|
||||||
if(!sihx(w + 1))
|
if(sihx(w + 1))
|
||||||
return error("Invalid padding", w);
|
|
||||||
p.ptr += shex(w + 1);
|
p.ptr += shex(w + 1);
|
||||||
|
else if(w[1] == '&') {
|
||||||
|
if(!sublabel(subw, p.scope, w + 2) || !(l = findlabel(subw)))
|
||||||
|
return error("Invalid sublabel", w);
|
||||||
|
p.ptr += l->addr;
|
||||||
|
} else {
|
||||||
|
if(!(l = findlabel(w + 1)))
|
||||||
|
return error("Invalid label", w);
|
||||||
|
p.ptr += l->addr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '@': /* label */
|
case '@': /* label */
|
||||||
if(!makelabel(w + 1))
|
if(!makelabel(w + 1))
|
||||||
|
|
Loading…
Reference in New Issue