(uxnasm) Removed lit flag for writebyte
This commit is contained in:
parent
fbbddf50d6
commit
78853ac5c6
24
src/uxnasm.c
24
src/uxnasm.c
|
@ -162,9 +162,8 @@ makelabel(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
writebyte(Uint8 b, int lit)
|
writebyte(Uint8 b)
|
||||||
{
|
{
|
||||||
if(lit) writebyte(findopcode("LIT"), 0);
|
|
||||||
p.data[p.ptr++] = b;
|
p.data[p.ptr++] = b;
|
||||||
p.length = p.ptr;
|
p.length = p.ptr;
|
||||||
litlast = 0;
|
litlast = 0;
|
||||||
|
@ -173,9 +172,10 @@ writebyte(Uint8 b, int lit)
|
||||||
static void
|
static void
|
||||||
writeshort(Uint16 s, int lit)
|
writeshort(Uint16 s, int lit)
|
||||||
{
|
{
|
||||||
if(lit) writebyte(findopcode("LIT2"), 0);
|
if(lit)
|
||||||
writebyte((s >> 8) & 0xff, 0);
|
writebyte(findopcode("LIT2"));
|
||||||
writebyte(s & 0xff, 0);
|
writebyte(s >> 8);
|
||||||
|
writebyte(s & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -185,12 +185,10 @@ writelitbyte(Uint8 b)
|
||||||
Uint8 hb = p.data[p.ptr - 1];
|
Uint8 hb = p.data[p.ptr - 1];
|
||||||
p.ptr -= 2;
|
p.ptr -= 2;
|
||||||
writeshort((hb << 8) + b, 1);
|
writeshort((hb << 8) + b, 1);
|
||||||
litlast = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.data[p.ptr++] = findopcode("LIT");
|
writebyte(findopcode("LIT"));
|
||||||
p.data[p.ptr++] = b;
|
writebyte(b);
|
||||||
p.length = p.ptr;
|
|
||||||
litlast = 1;
|
litlast = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,22 +290,22 @@ tokenize(char *w, FILE *f)
|
||||||
writeshort(0xffff, 0);
|
writeshort(0xffff, 0);
|
||||||
break;
|
break;
|
||||||
case '\'': /* raw char */
|
case '\'': /* raw char */
|
||||||
writebyte((Uint8)w[1], 0);
|
writebyte((Uint8)w[1]);
|
||||||
break;
|
break;
|
||||||
case '"': /* raw string */
|
case '"': /* raw string */
|
||||||
i = 0;
|
i = 0;
|
||||||
while((c = w[++i]))
|
while((c = w[++i]))
|
||||||
writebyte(c, 0);
|
writebyte(c);
|
||||||
break;
|
break;
|
||||||
case '[': break; /* ignored */
|
case '[': break; /* ignored */
|
||||||
case ']': break; /* ignored */
|
case ']': break; /* ignored */
|
||||||
default:
|
default:
|
||||||
/* opcode */
|
/* opcode */
|
||||||
if(findopcode(w) || scmp(w, "BRK", 4))
|
if(findopcode(w) || scmp(w, "BRK", 4))
|
||||||
writebyte(findopcode(w), 0);
|
writebyte(findopcode(w));
|
||||||
/* raw byte */
|
/* raw byte */
|
||||||
else if(sihx(w) && slen(w) == 2)
|
else if(sihx(w) && slen(w) == 2)
|
||||||
writebyte(shex(w), 0);
|
writebyte(shex(w));
|
||||||
/* raw short */
|
/* raw short */
|
||||||
else if(sihx(w) && slen(w) == 4)
|
else if(sihx(w) && slen(w) == 4)
|
||||||
writeshort(shex(w), 0);
|
writeshort(shex(w), 0);
|
||||||
|
|
Loading…
Reference in New Issue