Browse code

Added notes

neauoire authored on 04/02/2021 01:43:13
Showing 6 changed files
... ...
@@ -56,6 +56,10 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
56 56
 - Implement addressing
57 57
 - Implement 16 bits operations
58 58
 
59
+## Notes
60
+
61
+- Forth logic operators pop 2 items and add a bool to the stack, is that viable in uxn?
62
+
59 63
 ## Refs
60 64
 
61 65
 https://code.9front.org/hg/plan9front/file/a7f9946e238f/sys/src/games/nes/cpu.c
... ...
@@ -14,5 +14,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
14 14
 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
15 15
 
16 16
 # run
17
-./uxnasm examples/arithmetic.usm boot.rom
17
+./uxnasm examples/core.usm boot.rom
18 18
 ./uxn boot.rom
... ...
@@ -1,4 +1,6 @@
1 1
 < core >
2 2
 
3
-0102
3
+34 34 EQU .label JSZ ff BRK
4
+
5
+:label ee RTS
4 6
 
5 7
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+< subcond >
2
+
... ...
@@ -1,25 +1,9 @@
1 1
 < subroutines >
2 2
 
3
-:begin
4
-  .addall JSI ADD ADD
5
-  06 EQU .isequal JSI
6
-  BRK
3
+.part1 JSI 44 BRK
7 4
 
8
-:add1
9
-  01 RTS
5
+:part1 11 .part2 JSI RTS
10 6
 
11
-:add2
12
-  02 RTS
7
+:part2 22 .part3 JSI RTS
13 8
 
14
-:add3
15
-  03 RTS
16
-
17
-:addall
18
-  .add1 JSI
19
-  .add2 JSI
20
-  .add3 JSI
21
-  RTS
22
-
23
-:isequal
24
-  .addall JSI ff
25
-  RTS
9
+:part3 33 RTS
26 10
\ No newline at end of file
... ...
@@ -123,12 +123,14 @@ reset(void)
123 123
 	int i;
124 124
 	cpu.status = 0x00;
125 125
 	cpu.counter = 0x00;
126
+	cpu.literal = 0x00;
126 127
 	cpu.rom.ptr = 0x00;
127 128
 	cpu.wst.ptr = 0x00;
128
-	cpu.literal = 0x00;
129 129
 	cpu.rst.ptr = 0x00;
130
-	for(i = 0; i < 256; i++)
130
+	for(i = 0; i < 256; i++) {
131 131
 		cpu.wst.dat[i] = 0x00;
132
+		cpu.rst.dat[i] = 0x00;
133
+	}
132 134
 }
133 135
 
134 136
 int