From d6c14dd24d541893bfd4042685c3ea3da1bd3c2e Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 24 Aug 2024 09:49:55 -0700 Subject: [PATCH] (pond.tal) Starting new demo --- projects/examples/demos/pond.tal | 95 ++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 projects/examples/demos/pond.tal diff --git a/projects/examples/demos/pond.tal b/projects/examples/demos/pond.tal new file mode 100644 index 0000000..ee67a3b --- /dev/null +++ b/projects/examples/demos/pond.tal @@ -0,0 +1,95 @@ +( pond.tal ) + +|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 +|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 + +|000 + +@color $1 +@circle [ &xc $2 &yc $2 &x $2 &y $2 &r $2 &d $2 ] + +|100 + +@on-reset ( -> ) + ( | theme ) + #c2c2 DUP2 .System/r DEO2 + DUP2 .System/g DEO2 + .System/b DEO2 + + ;on-mouse .Mouse/vector DEO2 + BRK + +@on-mouse ( -> ) + #c1 ;touch-chr/down ;touch-chr .Mouse/state DEI ?{ SWP2 } + POP2 + .Mouse/state DEI ?{ BRK } + ( | touch ) + .Mouse/x DEI2 .Mouse/y DEI2 #0010 #01 draw-circle + + BRK + +@ ( color addr* -- ) + ;fill-icn .Screen/addr DEO2 + #40 + .Screen/addr DEO2 + .Mouse/x DEI2 ,/x STR2 + .Mouse/y DEI2 ,/y STR2 + ( >> ) + +@ ( color -- ) + [ LIT2 16 -Screen/auto ] DEO + [ LIT2 &x $2 ] .Screen/x DEO2 + [ LIT2 &y $2 ] .Screen/y DEO2 + .Screen/sprite DEOk DEO + JMP2r + +%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } +%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } + +@ ( xc* yc* r color -- ) + + ( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2 + #0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2 + .circle/r LDZ2 #10 SFT2 .circle/d STZ2 + ( draw ) ;&seg JSR2 + &loop + ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2 + .circle/d LDZ2 #0001 LTS2 ,&else JCN + ( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2 + .circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 + ;&end JMP2 + &else + .circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 + &end + ( draw ) ;&seg JSR2 + .circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN + JMP2r + &seg + .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO + +JMP2r + + +@touch-chr [ + 0000 0000 0814 1417 0000 0000 0008 0808 + 0000 0000 0000 00c0 0000 0000 0000 0000 + 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 + 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ] + &down [ + 0000 0000 0000 0817 0000 0000 0000 0008 + 0000 0000 0000 00c0 0000 0000 0000 0000 + 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 + 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ] + +@fill-icn [ + ffff ffff ffff ffff ffff ffff ffff ffff + ffff ffff ffff ffff ffff ffff ffff ffff ] +