0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-23 22:35:11 +00:00

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

View file

@ -59,30 +59,6 @@ static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); whi
#pragma mark - I/O #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 * static Macro *
findmacro(char *name) findmacro(char *name)
{ {
@ -129,6 +105,30 @@ findopcode(char *s)
return 0; 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 * static char *
sublabel(char *src, char *scope, char *name) sublabel(char *src, char *scope, char *name)
{ {