diff --git a/projects/examples/demos/life.tal b/projects/examples/demos/life.tal index c045745..e88a46b 100644 --- a/projects/examples/demos/life.tal +++ b/projects/examples/demos/life.tal @@ -4,7 +4,7 @@ ( Any live cell with more than three live neighbours dies, as if by overpopulation. ) ( Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. ) -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 +|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 @@ -62,11 +62,11 @@ BRK @on-control ( -> ) - ( | toggle play ) - .Controller/key DEI #20 NEQ ?{ - ;on-frame #0000 .Screen/vector DEI2 EQU2k ?{ ROT2 } - POP2 POP2 .Screen/vector DEO2 } - .Controller/button DEI #08 NEQ ?{ ;bank1 #0400 mclr } + .Controller/key DEI + ( ) DUP #20 NEQ ?{ + #0000 ;on-frame .Screen/vector DEI2 ORA ?{ SWP2 } + POP2 .Screen/vector DEO2 } + ( ) #1b NEQ ?{ ;mmu/clear1 .System/expansion DEO2 } BRK ( @@ -74,7 +74,7 @@ @ ( -- ) ( | clear buffer ) - ;bank2 #1000 mclr + ;mmu/clear2 .System/expansion DEO2 ( | grid ) #4000 &ver ( -- ) @@ -85,7 +85,7 @@ POP2 POPr INC GTHk ?&ver POP2 ( | move buffer ) - ;bank2 ;bank1 #1000 mcpy + ;mmu/move21 .System/expansion DEO2 ( | draw ) ! @@ -152,10 +152,12 @@ @ ( short* -- ) SWP + ( >> ) @ ( byte color -- ) DUP #04 SFT #0f AND + ( >> ) @ ( char color -- ) #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 @@ -169,6 +171,7 @@ .Mouse/x DEI2 ,/x STR2 .Mouse/y DEI2 ,/y STR2 .Screen/addr DEO2 + ( >> ) @ ( color -- ) [ LIT2 &x $2 ] .Screen/x DEO2 @@ -186,27 +189,14 @@ POP2 POP2 POPr #01 JMP2r &skip POP2 POP2 POPr #00 JMP2r -( -@|stdlib ) - -@mclr ( addr* len* -- ) - OVR2 ADD2 SWP2 - &loop ( -- ) - STH2k #00 STH2r STA - INC2 GTH2k ?&loop - POP2 POP2 JMP2r - -@mcpy ( src* dst* len* -- ) - SWP2 STH2 - OVR2 ADD2 SWP2 - &loop ( -- ) - LDAk STH2kr STA - INC2r INC2 GTH2k ?&loop - POP2 POP2 POP2r JMP2r - ( @|assets ) +@mmu ( programs ) + &clear1 [ 01 1000 0000 =bank3 0000 =bank1 ] + &clear2 [ 01 1000 0000 =bank3 0000 =bank2 ] + &move21 [ 01 1000 0000 =bank2 0000 =bank1 ] + @cursor-icn [ 80c0 e0f0 f8e0 1000 ] @fill-icn [ ffff ffff ffff ffff ] @@ -226,5 +216,7 @@ @bank1 $1000 -@bank2 +@bank2 $1000 + +@bank3 $1000