commit a0ba0e4e79b3c42b7c94d04fcede92c902d59adb
parent 65d7de817606009edb0d484c7c3d3b58831b87fa
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Sat, 20 Nov 2021 16:17:26 -0500
(logic.tal) Displaying basic gates
Diffstat:
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/projects/examples/demos/logic.tal b/projects/examples/demos/logic.tal
@@ -49,8 +49,6 @@
&x $2 &y $2 &x2 $2 &y2 $2
@input
&a $1 &b $1
-@center
- &x $2 &y $2
@pointer
&x $2 &y $2
@@ -66,13 +64,11 @@
;on-mouse .Mouse/vector DEO2
- .Screen/width DEI2 2//
- DUP2 .center/x STZ2
+ .Screen/width DEI2 2//
DUP2 #0040 -- .a-frame/x STZ2 DUP2 #0040 ++ .a-frame/x2 STZ2
DUP2 #0040 -- .b-frame/x STZ2 #0040 ++ .b-frame/x2 STZ2
- .Screen/height DEI2 2//
- DUP2 .center/y STZ2
+ .Screen/height DEI2 2// #0020 --
DUP2 #0010 -- .a-frame/y STZ2 DUP2 #0000 ++ .a-frame/y2 STZ2
DUP2 .b-frame/y STZ2 #0010 ++ .b-frame/y2 STZ2
@@ -125,46 +121,57 @@ BRK
.a-frame/x LDZ2 .Screen/x DEO2
.a-frame/y LDZ2 .Screen/y DEO2
- .input/a LDZ ;draw-byte JSR2
+ .input/a LDZ #01 ;draw-byte JSR2
.b-frame/x LDZ2 .Screen/x DEO2
.b-frame/y LDZ2 .Screen/y DEO2
- .input/b LDZ ;draw-byte JSR2
+ .input/b LDZ #01 ;draw-byte JSR2
+
+ .b-frame/x LDZ2 .Screen/x DEO2
+ .Screen/y DEI2 #000d ++ .Screen/y DEO2
+ .input LDZ2 AND #03 ;draw-byte JSR2
+
+ .b-frame/x LDZ2 .Screen/x DEO2
+ .Screen/y DEI2 #000d ++ .Screen/y DEO2
+ .input LDZ2 ORA #03 ;draw-byte JSR2
+
+ .b-frame/x LDZ2 .Screen/x DEO2
+ .Screen/y DEI2 #000d ++ .Screen/y DEO2
+ .input LDZ2 EOR #03 ;draw-byte JSR2
RTN
@draw-byte ( value -- )
- STH
+ STH STH
#0800
&loop
DUP #07 SWP -
- STHkr SWP SFT #01 AND ;draw-bit JSR2
+ STHkr SWP SFT #01 AND OVRr STHr ;draw-bit JSR2
INC GTHk ,&loop JCN
POP2
.Screen/y DEI2 #0003 ++ .Screen/y DEO2
STHr ;draw-hex JSR2
+ POPr
RTN
-@draw-bit ( value -- )
+@draw-bit ( value color -- )
- STH
+ STH STH
#05 .Screen/auto DEO
;button-icns/off [ #00 STHkr 20* ++ ] .Screen/addr DEO2
- #01 .Screen/sprite DEO
- #01 .Screen/sprite DEO
+ OVRr STHr .Screen/sprite DEO
+ OVRr STHr .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0010 -- .Screen/x DEO2
-
- #01 .Screen/sprite DEO
- #01 .Screen/sprite DEO
-
+ OVRr STHr .Screen/sprite DEO
+ OVRr STHr .Screen/sprite DEO
#00 .Screen/auto DEO
.Screen/y DEI2 #0008 -- .Screen/y DEO2
- POPr
+ POPr POPr
RTN