diff --git a/etc/tote.tal.txt b/etc/tote.tal.txt index a9cd9585b..a86320c0f 100644 --- a/etc/tote.tal.txt +++ b/etc/tote.tal.txt @@ -14,6 +14,7 @@ @valid &fwd $1 &bwd $1 &craft $1 @touch-origin &x $2 &y $2 @bagged-mask $1 + @overlay $1 @selection $2 @scroll $2 @Acc/buf $40 &bufend @@ -49,7 +50,7 @@ ( name ) "Tote 0a ( details ) "A 20 "Multiset 20 "Playground 0a ( author ) "By 20 "Hundred 20 "Rabbits 0a - ( date ) "8 20 "Nov 20 "2024 $1 00 + ( date ) "9 20 "Nov 20 "2024 $1 00 ( @|helpers ) @@ -137,8 +138,9 @@ POP2 ( | picking ) [ LIT2 &last $1 -Mouse/state ] DEI DUP ,&last STR - DUP2 #0001 NEQ2 ?{ } + DUP2 #0001 NEQ2 ?{ } DUP2 #0101 NEQ2 ?{ } + DUP2 #0000 NEQ2 ?{ } #0100 NEQ2 ?{ } BRK @@ -153,7 +155,7 @@ BRK -@ ( -- ) +@ ( -- ) .Mouse/x DEI2 .touch-origin/x STZ2 .Mouse/y DEI2 .touch-origin/y STZ2 [ LIT2 00 -bagged-mask ] STZ @@ -170,8 +172,9 @@ Bag/pick .drag STZ2 ! &menu ( -- ) - .Mouse/x DEI2 .size/w LDZ2 #0058 SUB2 SUB2 #0028 DIV2 NIP ? - ! + .Mouse/x DEI2 .size/w LDZ2 #0058 SUB2 SUB2 #0028 DIV2 NIP ?{ ! } + + !Bag/ @ ( -- ) ( x ) .Mouse/x DEI2 #0008 SUB2 #45 SFT2 @@ -234,6 +237,12 @@ ( x ) .Mouse/x DEI2 .touch-origin/x LDZ2 SUB2 ABS2 ( y ) .Mouse/y DEI2 .touch-origin/y LDZ2 SUB2 ABS2 ADD2 #0004 LTH2 JMP2r +@ ( -- ) + .Mouse/x DEI2 #0050 SUB2 #0098 GTH2 ?{ + ( | rules ) + .Mouse/y DEI2 #0010 SUB2 .scroll LDZ2 ADD2 #0018 DIV2 NIP ! } + #ff ! + @ ( -- ) .drag LDZ2 INC2k ORA ?{ POP2 JMP2r } ( | detect lock ) @@ -307,6 +316,10 @@ Bag/ Bag/ ! +@ ( rule -- ) + DUP .overlay LDZ EQU ?{ .overlay STZ ! } + POP JMP2r + ( @|paint-mode ) @@ -609,6 +622,7 @@ &>l ( -- ) #00 STHkr ;rules/meta ADD2 LDA #03 NEQ ?{ DUP2 ;Acc/buf compare-rules #00 EQU ?{ + Bag/ POP2 POP2 [ LITr -valid/fwd ] STZr ! } } INCr #0080 ADD2 GTH2k ?&>l @@ -628,9 +642,7 @@ Bag/ [ LITr 00 ] [ LIT2 -Acc/bufend -Acc/buf ] &>bag-loop ( -- ) - #00 OVR .Acc/buf SUB - ( ) DUP2 - Bag/ + #00 OVR .Acc/buf SUB Bag/ ( ) LDZk #00 EQUk ?{ &>bag-loop2 ( -- ) STHkr Bag/ @@ -695,6 +707,7 @@ Bag/ !& @Bag/ ( id -- ) + #00 OVR /find-free STH2 [ LIT2 &anchor-x 00f8 ] ( ) DUP2 [ LIT2 &dir-x 0010 ] ADD2 ,&anchor-x STR2 @@ -989,6 +1002,7 @@ #3381 ! @ ( -- ) + ;Bag/bufend ;Bag/buf &>l ( -- ) DUP2 @@ -1003,6 +1017,24 @@ [ LIT2 85 -Screen/sprite ] DEO JMP2r +@ ( -- ) + .overlay LDZ ?{ JMP2r } + [ LITr 00 ] [ LIT2 00 -overlay ] LDZ #70 SFT2 ;rules ADD2 DUP2 #0040 ADD2 SWP2 + &>l ( -- ) + DUP2 #0040 ADD2 LDA #00 EQU ?{ #0a00 STHkr } + LDAk #00 EQU ?{ #0f00 STHkr } + INCr INC2 GTH2k ?&>l + POP2 POP2 POPr JMP2r + +@ ( color id* -- ) + [ LIT2 16 -Screen/auto ] DEO + DUP2 id-to-anchor + ( y ) #00 SWP #40 SFT2 #0010 ADD2 .Screen/y DEO2 + ( x ) #00 SWP #40 SFT2 #00f8 ADD2 .Screen/x DEO2 + id-to-sym .Screen/addr DEO2 + .Screen/sprite DEOk DEO + JMP2r + @ ( addr* -- ) ( exists ) LDA2k ORA ?{ POP2 JMP2r } ( in bag ) LDA2k #00e0 LTH2 ?{ diff --git a/site/pocket_rewriting.html b/site/pocket_rewriting.html index 9fe2e9e45..80ad00ec8 100644 --- a/site/pocket_rewriting.html +++ b/site/pocket_rewriting.html @@ -20,7 +20,7 @@

A zine on multiset rewriting.

Try running some of the examples from Pocket Rewriting by dragging things from the creation pane(left) into the rules(middle) or bag(right). Step through the evaluation by pressing the button with the squiggly symbol to rewrite the symbols in the bag, or press the arrow button to apply the rules backward.

-

Click on the symbols in the creation pane to open the Symbol Editor with which you can draw new symbols, save/load the ICN graphics, lock/unlock the dragging of that symbol, activate continuous/step mode for when the symbol is clicked on.

diff --git a/site/tote.html b/site/tote.html index 99ccce364..ca7156dd2 100644 --- a/site/tote.html +++ b/site/tote.html @@ -9,7 +9,7 @@

Try running some of the examples from Pocket Rewriting by dragging things from the creation pane(left) into the rules(middle) or bag(right). Step through the evaluation by pressing the button with the squiggly symbol to rewrite the symbols in the bag, or press the arrow button to apply the rules backward.

-

Click on the symbols in the creation pane to open the Symbol Editor with which you can draw new symbols, save/load the ICN graphics, lock/unlock the dragging of that symbol, activate continuous/step mode for when the symbol is clicked on.

diff --git a/src/htm/tote.htm b/src/htm/tote.htm index b954d334b..970d8d8bd 100644 --- a/src/htm/tote.htm +++ b/src/htm/tote.htm @@ -2,7 +2,7 @@

A little playground

Try running some of the examples from Pocket Rewriting by dragging things from the creation pane(left) into the rules(middle) or bag(right). Step through the evaluation by pressing the button with the squiggly symbol to rewrite the symbols in the bag, or press the arrow button to apply the rules backward.

-

Click on the symbols in the creation pane to open the Symbol Editor with which you can draw new symbols, save/load the ICN graphics, lock/unlock the dragging of that symbol, activate continuous/step mode for when the symbol is clicked on.