commit 69d255bfff808ef63c270abe1ed56413b129b65b
parent 1422c5dc6ed33ceb8aff4b81252f4bfede44409c
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 3 Feb 2021 17:43:13 -0800
Added notes
Diffstat:
6 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
@@ -56,6 +56,10 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
- Implement addressing
- Implement 16 bits operations
+## Notes
+
+- Forth logic operators pop 2 items and add a bool to the stack, is that viable in uxn?
+
## Refs
https://code.9front.org/hg/plan9front/file/a7f9946e238f/sys/src/games/nes/cpu.c
diff --git a/build.sh b/build.sh
@@ -14,5 +14,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
cc -std=c89 -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 uxn.c -o uxn
# run
-./uxnasm examples/arithmetic.usm boot.rom
+./uxnasm examples/core.usm boot.rom
./uxn boot.rom
diff --git a/examples/core.usm b/examples/core.usm
@@ -1,4 +1,6 @@
< core >
-0102
+34 34 EQU .label JSZ ff BRK
+
+:label ee RTS
diff --git a/examples/subcond.usm b/examples/subcond.usm
@@ -0,0 +1,2 @@
+< subcond >
+
diff --git a/examples/subroutines.usm b/examples/subroutines.usm
@@ -1,25 +1,9 @@
< subroutines >
-:begin
- .addall JSI ADD ADD
- 06 EQU .isequal JSI
- BRK
+.part1 JSI 44 BRK
-:add1
- 01 RTS
+:part1 11 .part2 JSI RTS
-:add2
- 02 RTS
+:part2 22 .part3 JSI RTS
-:add3
- 03 RTS
-
-:addall
- .add1 JSI
- .add2 JSI
- .add3 JSI
- RTS
-
-:isequal
- .addall JSI ff
- RTS
+:part3 33 RTS
+\ No newline at end of file
diff --git a/uxn.c b/uxn.c
@@ -123,12 +123,14 @@ reset(void)
int i;
cpu.status = 0x00;
cpu.counter = 0x00;
+ cpu.literal = 0x00;
cpu.rom.ptr = 0x00;
cpu.wst.ptr = 0x00;
- cpu.literal = 0x00;
cpu.rst.ptr = 0x00;
- for(i = 0; i < 256; i++)
+ for(i = 0; i < 256; i++) {
cpu.wst.dat[i] = 0x00;
+ cpu.rst.dat[i] = 0x00;
+ }
}
int