Removed hardcoded number for LIT opcode in asm

This commit is contained in:
neauoire 2021-08-29 11:25:58 -07:00
parent 0da8709ce3
commit 66f898ade4
1 changed files with 24 additions and 24 deletions

View File

@ -59,30 +59,6 @@ static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); whi
#pragma mark - I/O
static void
pushbyte(Uint8 b, int lit)
{
if(lit) pushbyte(0x80, 0);
p.data[p.ptr++] = b;
p.length = p.ptr;
}
static void
pushshort(Uint16 s, int lit)
{
if(lit) pushbyte(0x20, 0);
pushbyte((s >> 8) & 0xff, 0);
pushbyte(s & 0xff, 0);
}
static void
pushword(char *s)
{
int i = 0;
char c;
while((c = s[i++])) pushbyte(c, 0);
}
static Macro *
findmacro(char *name)
{
@ -129,6 +105,30 @@ findopcode(char *s)
return 0;
}
static void
pushbyte(Uint8 b, int lit)
{
if(lit) pushbyte(findopcode("LIT"), 0);
p.data[p.ptr++] = b;
p.length = p.ptr;
}
static void
pushshort(Uint16 s, int lit)
{
if(lit) pushbyte(findopcode("LIT2"), 0);
pushbyte((s >> 8) & 0xff, 0);
pushbyte(s & 0xff, 0);
}
static void
pushword(char *s)
{
int i = 0;
char c;
while((c = s[i++])) pushbyte(c, 0);
}
static char *
sublabel(char *src, char *scope, char *name)
{