uxn

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

commit f4423ad62990f8251ec141fb6c831537cf2d7d52
parent 5610b9eb7775e89f03557bc96b27cfe8c843b933
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 21 Mar 2021 10:38:46 -0700

Fixed issue with label length in pass2

Diffstat:
Massembler.c | 10+++++++---
Mbuild.sh | 2+-
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/assembler.c b/assembler.c @@ -29,7 +29,7 @@ typedef struct { typedef struct { char name[64]; Uint8 refs, maps; - Uint16 addr; + Uint16 addr, len; Map map[16]; } Label; @@ -236,7 +236,8 @@ makevariable(char *name, Uint16 *addr, FILE *f) if(word[0] == '}') break; scpy(word, l->map[l->maps].name, 64); fscanf(f, "%u", &l->map[l->maps].size); - *addr += l->map[l->maps++].size; + *addr += l->map[l->maps].size; + l->len += l->map[l->maps++].size; } return 1; } @@ -384,11 +385,14 @@ pass2(FILE *f) char w[64], scope[64], subw[64]; printf("Pass 2\n"); while(fscanf(f, "%s", w) == 1) { - if(w[0] == ';') continue; if(w[0] == '$') continue; if(w[0] == '%') continue; if(skipblock(w, &ccmnt, '(', ')')) continue; if(skipblock(w, &ctemplate, '{', '}')) continue; + if(w[0] == ';') { + p.ptr += findlabel(w + 1)->len; + continue; + } if(w[0] == '|') { p.ptr = shex(w + 1); continue; diff --git a/build.sh b/build.sh @@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator # run -./bin/assembler projects/software/nasu.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom ./bin/emulator bin/boot.rom