circles.tal (1093B)
1 ( draw a circle at the center of the screen ) 2 3 |00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 4 |20 @Screen &vector $2 &width $2 &height $2 &auto $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 5 6 |100 7 8 @on-reset ( -> ) 9 #f0ff .System/r DEO2 10 #f0f6 .System/g DEO2 11 #f0f2 .System/b DEO2 12 #300c 13 &>l ( -- ) 14 STHk 15 ( x ) #00 STHkr DUP2 MUL2 #03 SFT2 #00c0 ADD2 16 ( y ) #00a0 17 ( radius ) #00 #30 STHkr SUB #20 SFT 18 ( color ) STHr #01 AND INC <draw-circle> 19 INC GTHk ?&>l 20 POP2 BRK 21 22 @<draw-circle> ( x* y* r* color -- ) 23 ,&color STR 24 DUP2k MUL2 ,&r STR2 25 [ LIT2r 0000 ] STH2 26 ,&y STR2 27 ,&x STR2 28 STH2kr SUB2kr STH2r INC2 29 &>y ( -- ) 30 DUP2 [ LIT2 &y $2 ] ADD2 .Screen/y DEO2 31 STH2kr SUB2kr STH2r INC2 32 &>x ( -- ) 33 ( x ) ROT2k ABS2-SQ 34 ( y ) SWP2 ABS2-SQ 35 ( + ) ADD2 NIP2 [ LIT2 &r $2 ] GTH2 ?{ 36 DUP2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2 37 [ LIT2 &color 02 -Screen/pixel ] DEO } 38 ( ) INC2 NEQ2k ?&>x 39 POP2 POP2 40 ( ) INC2 NEQ2k ?&>y 41 POP2 POP2 POP2r POP2r JMP2r 42 43 @ABS2-SQ ( a* -- res* ) 44 DUP2k #1f SFT2 MUL2 SUB2 DUP2 MUL2 JMP2r 45