Basic pen mode
This commit is contained in:
parent
d466fdec7b
commit
1bebf69c68
|
@ -18,9 +18,9 @@
|
||||||
( | meta )
|
( | meta )
|
||||||
;meta #06 DEO2
|
;meta #06 DEO2
|
||||||
( | theme )
|
( | theme )
|
||||||
#f0ff .System/r DEO2
|
#f08f .System/r DEO2
|
||||||
#f00f .System/g DEO2
|
#f08f .System/g DEO2
|
||||||
#f00f .System/b DEO2
|
#f08f .System/b DEO2
|
||||||
load-theme
|
load-theme
|
||||||
( | size )
|
( | size )
|
||||||
#00e0 .Screen/width DEO2
|
#00e0 .Screen/width DEO2
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
;on-frame .Screen/vector DEO2
|
;on-frame .Screen/vector DEO2
|
||||||
;on-control .Controller/vector DEO2
|
;on-control .Controller/vector DEO2
|
||||||
( | let's go! )
|
( | let's go! )
|
||||||
#01 .selection/sketch STZ
|
|
||||||
file-init <draw-header>
|
file-init <draw-header>
|
||||||
#00 change-page BRK
|
#00 change-page BRK
|
||||||
|
|
||||||
|
@ -74,8 +73,13 @@
|
||||||
DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page }
|
DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page }
|
||||||
POP
|
POP
|
||||||
( | key )
|
( | key )
|
||||||
DUP #08 NEQ ?{ erase }
|
DUP #1b NEQ ?{ toggle-sketch POP BRK }
|
||||||
DUP #7f NEQ ?{ delete }
|
DUP #08 NEQ ?{
|
||||||
|
.selection/sketch LDZ ?{ erase-sketch POP BRK }
|
||||||
|
erase }
|
||||||
|
DUP #7f NEQ ?{
|
||||||
|
.selection/sketch LDZ ?{ erase-sketch POP BRK }
|
||||||
|
delete }
|
||||||
DUP #09 LTH ?{ DUP insert }
|
DUP #09 LTH ?{ DUP insert }
|
||||||
POP BRK
|
POP BRK
|
||||||
|
|
||||||
|
@ -101,9 +105,9 @@
|
||||||
&unchanged BRK
|
&unchanged BRK
|
||||||
|
|
||||||
@on-mouse-body ( -> )
|
@on-mouse-body ( -> )
|
||||||
.selection/sketch LDZ ?on-mouse-body-draw
|
|
||||||
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn <update-cursor>
|
|
||||||
<trap-mouse>
|
<trap-mouse>
|
||||||
|
.selection/sketch LDZ ?on-mouse-sketch
|
||||||
|
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn <update-cursor>
|
||||||
[ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{
|
[ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{
|
||||||
get-position <select-word>
|
get-position <select-word>
|
||||||
[ LIT2 00 -Mouse/state ] DEO }
|
[ LIT2 00 -Mouse/state ] DEO }
|
||||||
|
@ -112,10 +116,23 @@
|
||||||
,&last STR
|
,&last STR
|
||||||
POP BRK
|
POP BRK
|
||||||
|
|
||||||
@on-mouse-body-draw ( -> )
|
@on-mouse-sketch ( -> )
|
||||||
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
|
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
|
||||||
.Mouse/x DEI2 .Mouse/y DEI2 #0012 SUB2 #01 set-pixel <draw-sketch>
|
( | handle states )
|
||||||
BRK
|
[ LIT &last $1 ] .Mouse/state DEI
|
||||||
|
( ) DUP #02 LTH ?{
|
||||||
|
( erase ) }
|
||||||
|
DUP2 #0001 NEQ2 ?{
|
||||||
|
.Mouse/x DEI2 ,&x1 STR2
|
||||||
|
.Mouse/y DEI2 #0012 SUB2 ,&y1 STR2 }
|
||||||
|
DUP2 #0101 NEQ2 ?{
|
||||||
|
( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ]
|
||||||
|
( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2
|
||||||
|
.Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2
|
||||||
|
( paint ) #01 <paint-line>
|
||||||
|
<draw-sketch> }
|
||||||
|
,&last STR
|
||||||
|
POP BRK
|
||||||
|
|
||||||
@on-mouse-foot ( -> )
|
@on-mouse-foot ( -> )
|
||||||
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
|
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
|
||||||
|
@ -170,6 +187,61 @@
|
||||||
@cut-char ( addr* -- )
|
@cut-char ( addr* -- )
|
||||||
get-eof #0001 !<msfl>
|
get-eof #0001 !<msfl>
|
||||||
|
|
||||||
|
(
|
||||||
|
@|sketch )
|
||||||
|
|
||||||
|
@toggle-sketch ( -- )
|
||||||
|
.selection/sketch LDZk #01 EOR SWP STZ
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@erase-sketch ( -- )
|
||||||
|
|
||||||
|
|
||||||
|
@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
|
||||||
|
( >> )
|
||||||
|
|
||||||
|
@remove-pixel ( 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* -- )
|
||||||
|
( 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
|
||||||
|
|
||||||
|
@<paint-line> ( x1* y1* x2* y2* color -- )
|
||||||
|
,&color STR
|
||||||
|
,&y STR2
|
||||||
|
,&x STR2
|
||||||
|
,&y2 STR2
|
||||||
|
,&x2 STR2
|
||||||
|
,&x LDR2 ,&x2 LDR2 SUB2 abs2 ,&dx STR2
|
||||||
|
#0000 ,&y LDR2 ,&y2 LDR2 SUB2 abs2 SUB2 ,&dy STR2
|
||||||
|
#ffff [ LIT2 00 _&x2 ] LDR2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2
|
||||||
|
#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
|
||||||
|
( 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 ?{
|
||||||
|
STH2r ,&dy LDR2 ADD2 STH2
|
||||||
|
,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2 }
|
||||||
|
,&dx LDR2 gts2 ?&>while
|
||||||
|
STH2r ,&dx LDR2 ADD2 STH2
|
||||||
|
,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2
|
||||||
|
!&>while
|
||||||
|
&end POP2r JMP2r
|
||||||
|
|
||||||
(
|
(
|
||||||
@|selection )
|
@|selection )
|
||||||
|
|
||||||
|
@ -439,30 +511,6 @@
|
||||||
INC2 GTH2k ?&>l
|
INC2 GTH2k ?&>l
|
||||||
&end NIP2 JMP2r
|
&end NIP2 JMP2r
|
||||||
|
|
||||||
(
|
|
||||||
@|sketch )
|
|
||||||
|
|
||||||
@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
|
|
||||||
( >> )
|
|
||||||
|
|
||||||
@remove-pixel ( 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* -- )
|
|
||||||
( 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
|
|
||||||
|
|
||||||
(
|
(
|
||||||
@|drawing )
|
@|drawing )
|
||||||
|
|
||||||
|
@ -660,6 +708,16 @@
|
||||||
#0001 SUB2 LTH2k ?&>l
|
#0001 SUB2 LTH2k ?&>l
|
||||||
POP2 POP2 &e POP2r JMP2r
|
POP2 POP2 &e POP2r JMP2r
|
||||||
|
|
||||||
|
@abs2 ( a* -- f )
|
||||||
|
DUP2 #0f SFT2 EQU ?{ #0000 SWP2 SUB2 }
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@lts2 ( a* b* -- f )
|
||||||
|
#8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r
|
||||||
|
|
||||||
|
@gts2 ( a* b* -- f )
|
||||||
|
#8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r
|
||||||
|
|
||||||
(
|
(
|
||||||
@|strings )
|
@|strings )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue