|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |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 &chord $1 |0000 @f $2 @cursor &x $2 &y $2 |0100 ( theme ) #ff09 .System/r DEO2 #0fa6 .System/g DEO2 #0f25 .System/b DEO2 ( size ) #0100 .Screen/width DEO2 #0080 .Screen/height DEO2 ( animate ) #01 .Screen/auto DEO ;on-frame .Screen/vector DEO2 ;on-mouse .Mouse/vector DEO2 BRK ( @|vectors ) @on-mouse ( -> ) #40 ;draw-cursor JSR2 ( draw new cursor ) .Mouse/x DEI2 .cursor/x STZ2 .Mouse/y DEI2 .cursor/y STZ2 ;cursor-icn .Screen/addr DEO2 #41 .Mouse/state DEI #00 NEQ ADD ;draw-cursor JSR2 .Mouse/state DEI #00 NEQ JMP BRK .Mouse/x DEI2 .Mouse/y DEI2 ;paint-pixel JSR2 BRK @cursor-icn 80c0 e0f0 f8e0 1000 @draw-cursor ( color -- ) #00 .Screen/auto DEO .cursor/x LDZ2 .Screen/x DEO2 .cursor/y LDZ2 .Screen/y DEO2 .Screen/sprite DEO JMP2r @on-frame ( -> ) ( paint pixels ) .f LDZ2k INC2 #007f AND2 ROT STZ2 BRK ( @|helpers ) @get-pixel ( x* y* -- color ) ( channel 1 ) OVR2 SWP2 ,get-pixel-addr JSR [ STH2k ] LDA ROT ROT NIP #07 AND [ STHk ] #07 SWP SUB SFT #01 AND ( channel 2 ) [ STHr ] [ STH2r ] #0008 ADD2 LDA SWP #07 SWP SUB SFT #01 AND DUP ADD ADD JMP2r @get-pixel-addr ( x* y* -- addr* ) ( get row ) DUP2 #0007 AND2 ( get tile ) ( width ) SWP2 #93 SFT2 ADD2 ( height ) SWP2 #43 SFT2 ADD2 ;texture ADD2 JMP2r @put-pixel ( x* y* color -- ) STH OVR2 SWP2 ,get-pixel-addr JSR ( ch1 ) OVR2 OVR2 STHkr #00 ,toggle-pixel JSR ( ch2 ) #0008 ADD2 STHr #01 @toggle-pixel ( x* addr* color -- ) STH2 LDAk STH SWP2 NIP STHr SWP STH2r SFT #01 AND ,&do-set JCN ( mask ) #0107 ROT #07 AND SUB #40 SFT SFT #ff EOR AND ( save ) ROT ROT STA JMP2r &do-set ( mask ) #0107 ROT #07 AND SUB #40 SFT SFT ORA ( save ) ROT ROT STA JMP2r @paint-pixel ( x* y* -- ) OVR2 OVR2 ;get-pixel JSR2 INC2 #03 AND ;put-pixel JSR2 ;draw-texture JSR2 JMP2r @draw-texture ( -- ) #05 .Screen/auto DEO #0000 .Screen/y DEO2 ;texture .Screen/addr DEO2 #1000 ( height ) &h #0000 .Screen/x DEO2 #2000 ( width ) &w #81 .Screen/sprite DEO INC GTHk ,&w JCN POP2 .Screen/y DEI2k #0008 ADD2 ROT DEO2 INC GTHk ,&h JCN POP2 JMP2r ( @|assets ) @print ( short* -- ) SWP ,&byte JSR &byte ( byte -- ) DUP #04 SFT ,&char JSR &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r @tile-icn ffff ffff ffff ffff @circle-icn 030f 3f3f 7f7f ffff c0f0 fcfc fefe ffff ffff 7f7f 3f3f 0f03 ffff fefe fcfc f0c0 @cos ( cos256 ) ffff ffff ffff fefe fdfc fcfb faf9 f8f7 f6f5 f3f2 f0ef edec eae8 e6e4 e2e0 dedc dad8 d5d3 d1ce ccc9 c7c4 c1bf bcb9 b6b3 b0ae aba8 a5a2 9f9c 9895 928f 8c89 8683 807c 7976 7370 6d6a 6763 605d 5a57 5451 4f4c 4946 4340 3e3b 3836 3331 2e2c 2a27 2523 211f 1d1b 1917 1513 1210 0f0d 0c0a 0908 0706 0504 0303 0201 0100 0000 0000 0000 0000 0000 0101 0203 0304 0506 0708 090a 0c0d 0f10 1213 1517 191b 1d1f 2123 2527 2a2c 2e31 3336 383b 3e40 4346 494c 4f51 5457 5a5d 6063 676a 6d70 7376 797c 7f83 8689 8c8f 9295 989c 9fa2 a5a8 abae b0b3 b6b9 bcbf c1c4 c7c9 ccce d1d3 d5d8 dadc dee0 e2e4 e6e8 eaec edef f0f2 f3f5 f6f7 f8f9 fafb fcfc fdfe feff ffff ffff @texture