diff --git a/gui/notepad/spritesheet10x10.chr b/gui/notepad/spritesheet10x10.chr index d9c4ae0..a47455c 100644 Binary files a/gui/notepad/spritesheet10x10.chr and b/gui/notepad/spritesheet10x10.chr differ diff --git a/gui/notepad/src/assets.tal b/gui/notepad/src/assets.tal index 2ab4c90..3481aed 100644 --- a/gui/notepad/src/assets.tal +++ b/gui/notepad/src/assets.tal @@ -16,6 +16,9 @@ @pen-icn [ c0e0 9090 4848 2424 1212 0909 0600 0000 ] +@eraser-icn [ + 7e81 8181 8181 8181 8181 8181 7e00 0000 ] + @bar-icn &a [ 0000 007e 007e 007e 007e 007e 007e 0000 ] &b [ diff --git a/gui/notepad/src/notepad.tal b/gui/notepad/src/notepad.tal index 7c06864..e2a84b7 100644 --- a/gui/notepad/src/notepad.tal +++ b/gui/notepad/src/notepad.tal @@ -38,7 +38,7 @@ ( name ) "Note 20 "Pad 0a ( details ) "Original 20 "by 20 "Donn 20 "Denman 0a ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a - ( date ) "May 20 "30, 20 "2024 00 01 + ( date ) "May 20 "31, 20 "2024 00 01 ( icon ) 83 =appicon ( @@ -117,27 +117,29 @@ POP BRK @on-mouse-sketch ( -> ) - [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;pen-icn + [ LIT2 00 -Mouse/state ] DEI STHk NEQ #41 ADD ;eraser-icn ;pen-icn STHr #01 GTH ?{ SWP2 } + POP2 ( | handle states ) - [ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR - ( ) DUP2 #0100 NEQ2 ?{ file-save } - ( ) DUP2 #0200 NEQ2 ?{ file-save } - DUP2 #0200 NEQ2 ?{ - ( from ) ,&x1 LDR2 ,&y1 LDR2 - ( to x ) ,&x1 LDR2 .Mouse/x DEI2 snap - ( to y ) ,&y1 LDR2 .Mouse/y DEI2 #0012 SUB2 snap - ( paint ) #01 - } - DUP2 #00 NEQ #0001 NEQ2 ?{ + [ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{ POP #02 } + DUP ,&last STR + ( ) SWPk #00 NEQ #0001 NEQ2 ?{ file-save } + DUP2 #0001 NEQ2 ?{ + ( | down mouse1 ) .Mouse/x DEI2 DUP2 ,&x1 STR2 .Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2 - #01 set-pixel } - DUP2 #0101 NEQ2 ?{ + #01 + } + DUP #01 NEQ ?{ + ( release/drag mouse1 ) ( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ] ( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2 .Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2 ( paint ) #01 } + DUP #02 NEQ2 ?{ + ( | release/drag mouse2 ) + .Mouse/x DEI2 .Mouse/y DEI2 #0012 SUB2 + } POP2 BRK @on-mouse-foot ( -> ) @@ -201,8 +203,7 @@ @toggle-sketch ( -- ) .selection/sketch LDZk #01 EOR SWP STZ #41 ;pen-icn ;caret-icn .selection/sketch LDZ ?{ SWP2 } - POP2 - JMP2r + POP2 ! @erase-sketch ( -- ) ;&mcpy .System/expansion DEO2 @@ -212,24 +213,37 @@ @get-row ( x* y* -- row* ) STH2k #03 SFT2 SWP2 #03 SFT2 SWP2 #001c MUL2 ADD2 #30 SFT2 STH2r #0007 AND2 ADD2 ;sketch ADD2 JMP2r -@set-pixel ( x* y* color -- ) - ?add-pixel +@ ( x* y* color -- ) + ? ( >> ) -@remove-pixel ( x* y* -- ) +@ ( x* y* -- ) ( keep x* ) OVR2 NIP #07 AND STH ( get byte ) get-row LDAk ( mask ) #0107 STHr SUB #40 SFT SFT #ff EOR AND ( save ) ROT ROT STA JMP2r -@add-pixel ( x* y* -- ) +@ ( x* y* -- ) ( keep x* ) OVR2 NIP #07 AND STH ( get byte ) get-row LDAk ( mask ) #0107 STHr SUB #40 SFT SFT ORA ( save ) ROT ROT STA JMP2r +@ ( x* y* -- ) + ,&y STR2 + ,&x STR2 + #000a #0000 + &>v ( -- ) + STH2k #0006 #0000 + &>h ( -- ) + ( x ) DUP2 [ LIT2 &x $2 ] ADD2 + ( y ) STH2kr [ LIT2 &y $2 ] ADD2 + INC2 GTH2k ?&>h + POP2 POP2 POP2r INC2 GTH2k ?&>v + POP2 POP2 JMP2r + @ ( x1* y1* x2* y2* color -- ) ,&color STR ,&y STR2 @@ -242,7 +256,7 @@ #ffff [ LIT2 00 _&y2 ] LDR2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2 [ LIT2 &dx $2 ] [ LIT2 &dy $2 ] ADD2 STH2 &>while ( -- ) - ( draw ) ,&x2 LDR2 ,&y2 LDR2 [ LIT &color $1 ] set-pixel + ( draw ) ,&x2 LDR2 ,&y2 LDR2 [ LIT &color $1 ] ( x ) [ LIT2 &x2 $2 ] [ LIT2 &x $2 ] EQU2 ( y ) [ LIT2 &y2 $2 ] [ LIT2 &y $2 ] EQU2 AND ?&end STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?{