uxn

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

commit 261b574671bb8ca4a1edac1ea00af078854ff04b
parent 1b2049e238df96f32335edf1c6db35bd09f8b42d
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed,  9 Nov 2022 16:21:07 -0800

(uxnasm) Added support for = and - runes

Diffstat:
Msrc/uxnasm.c | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -316,9 +316,14 @@ parse(char *w, FILE *f) if(!writeshort(0xffff, 1)) return 0; break; case ':': /* raw short absolute */ + case '=': makereference(p.scope, w, p.ptr); if(!writeshort(0xffff, 0)) return 0; break; + case '-': /* raw byte absolute */ + makereference(p.scope, w, p.ptr); + if(!writebyte(0xff)) return 0; + break; case '"': /* raw string */ i = 0; while((c = w[++i])) @@ -375,6 +380,7 @@ resolve(void) l->refs++; break; case ';': + case '=': if(!(l = findlabel(r->name))) return error("Unknown absolute reference", r->name); p.data[r->addr + 1] = l->addr >> 0x8; @@ -384,10 +390,16 @@ resolve(void) case ':': if(!(l = findlabel(r->name))) return error("Unknown absolute reference", r->name); - p.data[r->addr + 0] = l->addr >> 0x8; + p.data[r->addr] = l->addr >> 0x8; p.data[r->addr + 1] = l->addr & 0xff; l->refs++; break; + case '-': + if(!(l = findlabel(r->name))) + return error("Unknown absolute reference", r->name); + p.data[r->addr] = l->addr & 0xff; + l->refs++; + break; default: return error("Unknown reference", r->name); }