Simplified LIT opcode

This commit is contained in:
neauoire 2022-04-18 12:32:42 -07:00
parent d8f27c84ab
commit 9137114bd2
3 changed files with 4 additions and 5 deletions

View File

@ -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. All you need is X11.
```sh ```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 ### 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: If you wish to build the emulator without graphics mode:
```sh ```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 ## Usage

View File

@ -1,6 +1,6 @@
#!/bin/sh -e #!/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" 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" 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" CLI_INC="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli"

View File

@ -51,8 +51,7 @@ uxn_eval(Uxn *u, Uint16 pc)
bs = instr & 0x20 ? 1 : 0; bs = instr & 0x20 ? 1 : 0;
switch(instr & 0x1f) { switch(instr & 0x1f) {
/* Stack */ /* Stack */
case 0x00: /* LIT */ if(bs) { PEEK16(a, pc) PUSH16(src, a) pc += 2; } case 0x00: /* LIT */ PEEK(a, pc) PUSH(src, a) pc += 1 + bs; break;
else { a = u->ram[pc]; PUSH8(src, a) pc++; } break;
case 0x01: /* INC */ POP(a) PUSH(src, a + 1) break; case 0x01: /* INC */ POP(a) PUSH(src, a + 1) break;
case 0x02: /* POP */ POP(a) break; case 0x02: /* POP */ POP(a) break;
case 0x03: /* NIP */ POP(a) POP(b) PUSH(src, a) break; case 0x03: /* NIP */ POP(a) POP(b) PUSH(src, a) break;