diff --git a/README.md b/README.md index 0c2b3e7..e0c9ff1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The stack mapping is 254 bytes of data, a byte for the pointer and a byte for an All you need is X11. ```sh -gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11 +gcc -Os -DNDEBUG -g0 -s src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11 ``` ### Terminal @@ -33,7 +33,7 @@ gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/screen.c src/ If you wish to build the emulator without graphics mode: ```sh -gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli +gcc -Os -DNDEBUG -g0 -s src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli ``` ## Usage diff --git a/build.sh b/build.sh index 89a57d0..b32c8e8 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -RELEASE_FLAGS="-Os -DNDEBUG -g0 -s -Wall" +RELEASE_FLAGS="-Os -DNDEBUG -g0 -s" DEBUG_FLAGS="-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined" EMU_INC="src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11" CLI_INC="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli" diff --git a/src/uxn.c b/src/uxn.c index 3136af0..6aaa73a 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -51,8 +51,7 @@ uxn_eval(Uxn *u, Uint16 pc) bs = instr & 0x20 ? 1 : 0; switch(instr & 0x1f) { /* Stack */ - case 0x00: /* LIT */ if(bs) { PEEK16(a, pc) PUSH16(src, a) pc += 2; } - else { a = u->ram[pc]; PUSH8(src, a) pc++; } break; + case 0x00: /* LIT */ PEEK(a, pc) PUSH(src, a) pc += 1 + bs; break; case 0x01: /* INC */ POP(a) PUSH(src, a + 1) break; case 0x02: /* POP */ POP(a) break; case 0x03: /* NIP */ POP(a) POP(b) PUSH(src, a) break;