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:
parent
0da8709ce3
commit
66f898ade4
1 changed files with 24 additions and 24 deletions
48
src/uxnasm.c
48
src/uxnasm.c
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue