uxn

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

commit 78853ac5c6f28ceaf1c706d7b1314950fffa92d2
parent fbbddf50d61a4c9bc3857e9806e60810cdc4336c
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat, 27 Nov 2021 14:20:56 -0800

(uxnasm) Removed lit flag for writebyte

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

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