(logic.tal) Displaying basic gates

This commit is contained in:
Devine Lu Linvega 2021-11-20 16:17:26 -05:00
parent 65d7de8176
commit a0ba0e4e79
1 changed files with 26 additions and 19 deletions

View File

@ -49,8 +49,6 @@
&x $2 &y $2 &x2 $2 &y2 $2 &x $2 &y $2 &x2 $2 &y2 $2
@input @input
&a $1 &b $1 &a $1 &b $1
@center
&x $2 &y $2
@pointer @pointer
&x $2 &y $2 &x $2 &y $2
@ -66,13 +64,11 @@
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
.Screen/width DEI2 2// .Screen/width DEI2 2//
DUP2 .center/x STZ2
DUP2 #0040 -- .a-frame/x STZ2 DUP2 #0040 ++ .a-frame/x2 STZ2 DUP2 #0040 -- .a-frame/x STZ2 DUP2 #0040 ++ .a-frame/x2 STZ2
DUP2 #0040 -- .b-frame/x STZ2 #0040 ++ .b-frame/x2 STZ2 DUP2 #0040 -- .b-frame/x STZ2 #0040 ++ .b-frame/x2 STZ2
.Screen/height DEI2 2// .Screen/height DEI2 2// #0020 --
DUP2 .center/y STZ2
DUP2 #0010 -- .a-frame/y STZ2 DUP2 #0000 ++ .a-frame/y2 STZ2 DUP2 #0010 -- .a-frame/y STZ2 DUP2 #0000 ++ .a-frame/y2 STZ2
DUP2 .b-frame/y STZ2 #0010 ++ .b-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/x LDZ2 .Screen/x DEO2
.a-frame/y LDZ2 .Screen/y 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/x LDZ2 .Screen/x DEO2
.b-frame/y LDZ2 .Screen/y 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 RTN
@draw-byte ( value -- ) @draw-byte ( value -- )
STH STH STH
#0800 #0800
&loop &loop
DUP #07 SWP - 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 INC GTHk ,&loop JCN
POP2 POP2
.Screen/y DEI2 #0003 ++ .Screen/y DEO2 .Screen/y DEI2 #0003 ++ .Screen/y DEO2
STHr ;draw-hex JSR2 STHr ;draw-hex JSR2
POPr
RTN RTN
@draw-bit ( value -- ) @draw-bit ( value color -- )
STH STH STH
#05 .Screen/auto DEO #05 .Screen/auto DEO
;button-icns/off [ #00 STHkr 20* ++ ] .Screen/addr DEO2 ;button-icns/off [ #00 STHkr 20* ++ ] .Screen/addr DEO2
#01 .Screen/sprite DEO OVRr STHr .Screen/sprite DEO
#01 .Screen/sprite DEO OVRr STHr .Screen/sprite DEO
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 .Screen/y DEI2 #0008 ++ .Screen/y DEO2
.Screen/x DEI2 #0010 -- .Screen/x DEO2 .Screen/x DEI2 #0010 -- .Screen/x DEO2
OVRr STHr .Screen/sprite DEO
#01 .Screen/sprite DEO OVRr STHr .Screen/sprite DEO
#01 .Screen/sprite DEO
#00 .Screen/auto DEO #00 .Screen/auto DEO
.Screen/y DEI2 #0008 -- .Screen/y DEO2 .Screen/y DEI2 #0008 -- .Screen/y DEO2
POPr POPr POPr
RTN RTN