uxn

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

commit ebdb079cae3b90e4ad9b70535d19e44ecf80508c
parent c2a5c8cac27755fe0bc7b5e55c81c6d02243e7a8
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 28 Mar 2021 10:20:24 -0700

Fixed issue with assembler segfault

Diffstat:
Mbuild.sh | 2+-
Mprojects/examples/dev.keys.usm | 15+++++++++++++++
Msrc/assembler.c | 10+++++-----
Msrc/emulator.c | 1+
4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/build.sh b/build.sh @@ -28,7 +28,7 @@ else fi echo "Assembling.." -./bin/assembler projects/software/noodle.usm bin/boot.rom +./bin/assembler projects/software/left.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/examples/dev.keys.usm b/projects/examples/dev.keys.usm @@ -2,6 +2,10 @@ %8+ { #0008 ADD2 } %8* { #0030 SFT2 } +%MOD2 { #03 AND } + +;cursor { x 2 y 2 blink 1 } + |0100 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 } @@ -15,6 +19,15 @@ @FRAME + ( update cursor ) + #02 ~cursor.blink #01 EQU ADD =Sprite.color + + ,cursor_icn =Sprite.addr + ~cursor.blink MOD2 #00 EQU =cursor.blink + + + + ~Keys #00 EQU ^$end JNZ ( enter key ) @@ -34,6 +47,8 @@ BRK +@cursor_icn [ ffff ffff ffff ffff ] + @font ( spectrum-zx font ) [ 0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 diff --git a/src/assembler.c b/src/assembler.c @@ -263,11 +263,11 @@ walktoken(char *w) if(findopcode(w) || scmp(w, "BRK", 4)) return 1; switch(w[0]) { - case '=': return 4 - (findlabeladdr(w + 1) < 0x0100); /* POK/STR helper (lit addr(1/2) str) */ - case '~': return 4 - (findlabeladdr(w + 1) < 0x0100); /* PEK/LDR helper (lit addr(1/2) ldr) */ - case ',': return 3; /* lit2 addr-hb addr-lb */ - case '.': return 2; /* addr-hb addr-lb */ - case '^': return 2; /* Relative jump: lit addr-offset */ + case '=': return 4 - (findlabel(w + 1) && findlabeladdr(w + 1) < 0x0100); /* POK/STR helper (lit addr(1/2) str) */ + case '~': return 4 - (findlabel(w + 1) && findlabeladdr(w + 1) < 0x0100); /* PEK/LDR helper (lit addr(1/2) ldr) */ + case ',': return 3; /* lit2 addr-hb addr-lb */ + case '.': return 2; /* addr-hb addr-lb */ + case '^': return 2; /* Relative jump: lit addr-offset */ case '#': return (slen(w + 1) == 2 ? 2 : 3); } if((m = findmacro(w))) { diff --git a/src/emulator.c b/src/emulator.c @@ -436,6 +436,7 @@ datetime_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) m[ptr + 8] = (t->tm_yday & 0xff00) >> 8; m[ptr + 9] = t->tm_yday & 0xff; m[ptr + 10] = t->tm_isdst; + (void)b0; return b1; }