uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 66f898ade4cde8c821ca39af3c7a4a5182906d0f
parent 0da8709ce361cc24ab47f44c2c5b4a742f3063ae
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 29 Aug 2021 11:25:58 -0700

Removed hardcoded number for LIT opcode in asm

Diffstat:
Msrc/uxnasm.c | 48++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/uxnasm.c b/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) {