| ... | ... |
@@ -1,12 +1,13 @@ |
| 1 | 1 |
( dev/mouse ) |
| 2 | 2 |
|
| 3 | 3 |
%RTN { JMP2r }
|
| 4 |
-%8+ { #0008 ADD2 }
|
|
| 5 |
-%++ { #0001 ADD2 }
|
|
| 6 |
-%-- { #0001 SUB2 }
|
|
| 4 |
+%8+ { #0008 ADD2 }
|
|
| 5 |
+%++ { #0001 ADD2 }
|
|
| 6 |
+%-- { #0001 SUB2 }
|
|
| 7 | 7 |
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
|
| 8 | 8 |
|
| 9 |
-%%->x { .%/x PEK2 }
|
|
| 9 |
+%%^ { .% PEK2 } %%= { .% POK2 }
|
|
| 10 |
+%%? { .% DEI2 } %%! { .% DEO2 }
|
|
| 10 | 11 |
|
| 11 | 12 |
( devices ) |
| 12 | 13 |
|
| ... | ... |
@@ -19,7 +20,6 @@ |
| 19 | 20 |
|0000 |
| 20 | 21 |
|
| 21 | 22 |
@line [ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ] |
| 22 |
- |
|
| 23 | 23 |
@pointer [ &x $2 &y $2 &lastx $2 &lasty $2 &state $1 ] |
| 24 | 24 |
@color $1 |
| 25 | 25 |
|
| ... | ... |
@@ -28,11 +28,11 @@ |
| 28 | 28 |
|0100 ( -> ) |
| 29 | 29 |
|
| 30 | 30 |
( theme ) |
| 31 |
- #f0fd .System/r DEO2 |
|
| 32 |
- #f003 .System/g DEO2 |
|
| 33 |
- #f002 .System/b DEO2 |
|
| 31 |
+ #f0fd System/r! |
|
| 32 |
+ #f003 System/g! |
|
| 33 |
+ #f002 System/b! |
|
| 34 | 34 |
|
| 35 |
- ( vectors ) ;on-mouse .Mouse/vector DEO2 |
|
| 35 |
+ ( vectors ) ;on-mouse Mouse/vector! |
|
| 36 | 36 |
|
| 37 | 37 |
BRK |
| 38 | 38 |
|
| ... | ... |
@@ -56,27 +56,25 @@ BRK |
| 56 | 56 |
@on-mouse-down ( -> ) |
| 57 | 57 |
|
| 58 | 58 |
( record start position ) |
| 59 |
- .Mouse/x DEI2 DUP2 .pointer/x POK2 .pointer/lastx POK2 |
|
| 60 |
- .Mouse/y DEI2 DUP2 .pointer/y POK2 .pointer/lasty POK2 |
|
| 59 |
+ Mouse/x? DUP2 pointer/x= pointer/lastx= |
|
| 60 |
+ Mouse/y? DUP2 pointer/y= pointer/lasty= |
|
| 61 | 61 |
.Mouse/state DEI .pointer/state POK |
| 62 |
- |
|
| 63 |
- pointer->x .Console/short DEO2 |
|
| 64 | 62 |
|
| 65 | 63 |
BRK |
| 66 | 64 |
|
| 67 | 65 |
@on-mouse-drag ( -> ) |
| 68 | 66 |
|
| 69 | 67 |
( draw line ) |
| 70 |
- .pointer/lastx PEK2 |
|
| 71 |
- .pointer/lasty PEK2 |
|
| 72 |
- .pointer/x PEK2 |
|
| 73 |
- .pointer/y PEK2 |
|
| 68 |
+ pointer/lastx^ |
|
| 69 |
+ pointer/lasty^ |
|
| 70 |
+ pointer/x^ |
|
| 71 |
+ pointer/y^ |
|
| 74 | 72 |
#01 ( add mouse state ) [ .Mouse/state DEI #10 EQU #02 MUL ADD ] |
| 75 | 73 |
;hairline JSR2 |
| 76 | 74 |
|
| 77 | 75 |
( record last position ) |
| 78 |
- .Mouse/x DEI2 .pointer/lastx POK2 |
|
| 79 |
- .Mouse/y DEI2 .pointer/lasty POK2 |
|
| 76 |
+ Mouse/x? pointer/lastx= |
|
| 77 |
+ Mouse/y? pointer/lasty= |
|
| 80 | 78 |
.Mouse/state DEI .pointer/state POK |
| 81 | 79 |
|
| 82 | 80 |
BRK |
| ... | ... |
@@ -84,19 +82,19 @@ BRK |
| 84 | 82 |
@draw-cursor ( -- ) |
| 85 | 83 |
|
| 86 | 84 |
( clear last cursor ) |
| 87 |
- ;clear .Screen/addr DEO2 |
|
| 88 |
- .pointer/x PEK2 .Screen/x DEO2 |
|
| 89 |
- .pointer/y PEK2 .Screen/y DEO2 |
|
| 85 |
+ ;clear Screen/addr! |
|
| 86 |
+ pointer/x^ Screen/x! |
|
| 87 |
+ pointer/y^ Screen/y! |
|
| 90 | 88 |
#30 .Screen/color DEO |
| 91 | 89 |
|
| 92 | 90 |
( record pointer positions ) |
| 93 |
- .Mouse/x DEI2 .pointer/x POK2 |
|
| 94 |
- .Mouse/y DEI2 .pointer/y POK2 |
|
| 91 |
+ Mouse/x? pointer/x= |
|
| 92 |
+ Mouse/y? pointer/y= |
|
| 95 | 93 |
|
| 96 | 94 |
( draw new cursor ) |
| 97 |
- ;cursor .Screen/addr DEO2 |
|
| 98 |
- .pointer/x PEK2 .Screen/x DEO2 |
|
| 99 |
- .pointer/y PEK2 .Screen/y DEO2 |
|
| 95 |
+ ;cursor Screen/addr! |
|
| 96 |
+ pointer/x^ Screen/x! |
|
| 97 |
+ pointer/y^ Screen/y! |
|
| 100 | 98 |
|
| 101 | 99 |
( colorize on state ) |
| 102 | 100 |
.Mouse/state DEI #00 NEQ |
| ... | ... |
@@ -106,28 +104,28 @@ RTN |
| 106 | 104 |
|
| 107 | 105 |
@hairline ( x1 y1 x2 y2 color -- ) |
| 108 | 106 |
|
| 109 |
- ( load ) .color POK .line/y0 POK2 .line/x0 POK2 .line/y POK2 .line/x POK2 |
|
| 110 |
- .line/x0 PEK2 .line/x PEK2 SUB2 ABS2 .line/dx POK2 |
|
| 111 |
- .line/y0 PEK2 .line/y PEK2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy POK2 |
|
| 112 |
- #ffff #00 .line/x PEK2 .line/x0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sx POK2 |
|
| 113 |
- #ffff #00 .line/y PEK2 .line/y0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sy POK2 |
|
| 114 |
- .line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 |
|
| 107 |
+ ( load ) .color POK line/y0= line/x0= line/y= line/x= |
|
| 108 |
+ line/x0^ line/x^ SUB2 ABS2 line/dx= |
|
| 109 |
+ line/y0^ line/y^ SUB2 ABS2 #0000 SWP2 SUB2 line/dy= |
|
| 110 |
+ #ffff #00 line/x^ line/x0^ LTS2 #0002 MUL2 ADD2 line/sx= |
|
| 111 |
+ #ffff #00 line/y^ line/y0^ LTS2 #0002 MUL2 ADD2 line/sy= |
|
| 112 |
+ line/dx^ line/dy^ ADD2 line/e1= |
|
| 115 | 113 |
&loop |
| 116 |
- .line/x PEK2 .Screen/x DEO2 .line/y PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO |
|
| 117 |
- .line/x PEK2 .line/x0 PEK2 EQU2 .line/y PEK2 .line/y0 PEK2 EQU2 #0101 EQU2 ,&end JNZ |
|
| 118 |
- .line/e1 PEK2 #0002 MUL2 .line/e2 POK2 |
|
| 119 |
- .line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JNZ |
|
| 120 |
- .line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 |
|
| 121 |
- .line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2 |
|
| 114 |
+ line/x^ Screen/x! line/y^ Screen/y! .color PEK .Screen/color DEO |
|
| 115 |
+ line/x^ line/x0^ EQU2 line/y^ line/y0^ EQU2 #0101 EQU2 ,&end JNZ |
|
| 116 |
+ line/e1^ #0002 MUL2 line/e2= |
|
| 117 |
+ line/e2^ line/dy^ LTS2 ,&skipy JNZ |
|
| 118 |
+ line/e1^ line/dy^ ADD2 line/e1= |
|
| 119 |
+ line/x^ line/sx^ ADD2 line/x= |
|
| 122 | 120 |
&skipy |
| 123 |
- .line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JNZ |
|
| 124 |
- .line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2 |
|
| 125 |
- .line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2 |
|
| 121 |
+ line/e2^ line/dx^ GTS2 ,&skipx JNZ |
|
| 122 |
+ line/e1^ line/dx^ ADD2 line/e1= |
|
| 123 |
+ line/y^ line/sy^ ADD2 line/y= |
|
| 126 | 124 |
&skipx |
| 127 | 125 |
,&loop JMP |
| 128 | 126 |
&end |
| 129 | 127 |
|
| 130 | 128 |
RTN |
| 131 | 129 |
|
| 132 |
-@clear [ 0000 0000 0000 0000 ] |
|
| 133 |
-@cursor [ 80c0 e0f0 f8e0 1000 ] |
|
| 130 |
+@clear [ 0000 0000 0000 0000 ] |
|
| 131 |
+@cursor [ 80c0 e0f0 f8e0 1000 ] |