| ... | ... |
@@ -20,6 +20,8 @@ |
| 20 | 20 |
%DEBUG { ;print-hex JSR2 #0a .Console/write DEO }
|
| 21 | 21 |
%DEBUG2 { SWP ;print-hex JSR2 ;print-hex JSR2 #0a .Console/write DEO }
|
| 22 | 22 |
|
| 23 |
+%RELEASE-MOUSE { #0096 DEO }
|
|
| 24 |
+ |
|
| 23 | 25 |
%RTN { JMP2r }
|
| 24 | 26 |
%TOS { #00 SWP }
|
| 25 | 27 |
|
| ... | ... |
@@ -41,6 +43,10 @@ |
| 41 | 43 |
|
| 42 | 44 |
|0000 |
| 43 | 45 |
|
| 46 |
+@a-frame |
|
| 47 |
+ &x $2 &y $2 &x2 $2 &y2 $2 |
|
| 48 |
+@b-frame |
|
| 49 |
+ &x $2 &y $2 &x2 $2 &y2 $2 |
|
| 44 | 50 |
@input |
| 45 | 51 |
&a $1 &b $1 |
| 46 | 52 |
@center |
| ... | ... |
@@ -48,19 +54,27 @@ |
| 48 | 54 |
@pointer |
| 49 | 55 |
&x $2 &y $2 |
| 50 | 56 |
|
| 57 |
+ |
|
| 51 | 58 |
( program ) |
| 52 | 59 |
|
| 53 | 60 |
|0100 ( -> ) |
| 54 | 61 |
|
| 55 | 62 |
( theme ) |
| 56 |
- #0fe5 .System/r DEO2 |
|
| 57 |
- #0fc5 .System/g DEO2 |
|
| 58 |
- #0f25 .System/b DEO2 |
|
| 63 |
+ #0fe7 .System/r DEO2 |
|
| 64 |
+ #0fce .System/g DEO2 |
|
| 65 |
+ #0f2c .System/b DEO2 |
|
| 59 | 66 |
|
| 60 | 67 |
;on-mouse .Mouse/vector DEO2 |
| 61 | 68 |
|
| 62 |
- .Screen/width DEI2 2// .center/x STZ2 |
|
| 63 |
- .Screen/height DEI2 2// .center/y STZ2 |
|
| 69 |
+ .Screen/width DEI2 2// |
|
| 70 |
+ DUP2 .center/x STZ2 |
|
| 71 |
+ DUP2 #0040 -- .a-frame/x STZ2 DUP2 #0040 ++ .a-frame/x2 STZ2 |
|
| 72 |
+ DUP2 #0040 -- .b-frame/x STZ2 #0040 ++ .b-frame/x2 STZ2 |
|
| 73 |
+ |
|
| 74 |
+ .Screen/height DEI2 2// |
|
| 75 |
+ DUP2 .center/y STZ2 |
|
| 76 |
+ DUP2 #0010 -- .a-frame/y STZ2 DUP2 #0000 ++ .a-frame/y2 STZ2 |
|
| 77 |
+ DUP2 .b-frame/y STZ2 #0010 ++ .b-frame/y2 STZ2 |
|
| 64 | 78 |
|
| 65 | 79 |
;redraw JSR2 |
| 66 | 80 |
|
| ... | ... |
@@ -72,19 +86,50 @@ BRK |
| 72 | 86 |
|
| 73 | 87 |
.Mouse/state DEI #00 ! JMP [ BRK ] |
| 74 | 88 |
|
| 89 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .a-frame ;within-rect JSR2 |
|
| 90 |
+ ;on-touch-a JCN2 |
|
| 91 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .b-frame ;within-rect JSR2 |
|
| 92 |
+ ;on-touch-b JCN2 |
|
| 93 |
+ |
|
| 75 | 94 |
BRK |
| 76 | 95 |
|
| 77 |
-@redraw ( -- ) |
|
| 96 |
+@on-touch-a ( -> ) |
|
| 97 |
+ |
|
| 98 |
+ .Mouse/x DEI2 .a-frame/x LDZ2 -- |
|
| 99 |
+ 10// NIP #07 SWP - STH |
|
| 100 |
+ |
|
| 101 |
+ .input/a LDZ |
|
| 102 |
+ #01 [ STHr #40 SFT ] SFT EOR |
|
| 103 |
+ .input/a STZ |
|
| 104 |
+ |
|
| 105 |
+ ;redraw JSR2 |
|
| 106 |
+ RELEASE-MOUSE |
|
| 107 |
+ |
|
| 108 |
+BRK |
|
| 109 |
+ |
|
| 110 |
+@on-touch-b ( -> ) |
|
| 78 | 111 |
|
| 79 |
- .center/x LDZ2 #0040 -- .Screen/x DEO2 |
|
| 80 |
- .center/y LDZ2 #0010 -- .Screen/y DEO2 |
|
| 112 |
+ .Mouse/x DEI2 .b-frame/x LDZ2 -- |
|
| 113 |
+ 10// NIP #07 SWP - STH |
|
| 81 | 114 |
|
| 82 |
- #4f ;draw-byte JSR2 |
|
| 115 |
+ .input/b LDZ |
|
| 116 |
+ #01 [ STHr #40 SFT ] SFT EOR |
|
| 117 |
+ .input/b STZ |
|
| 83 | 118 |
|
| 84 |
- .center/x LDZ2 #0040 -- .Screen/x DEO2 |
|
| 85 |
- .center/y LDZ2 #0000 ++ .Screen/y DEO2 |
|
| 119 |
+ ;redraw JSR2 |
|
| 120 |
+ RELEASE-MOUSE |
|
| 121 |
+ |
|
| 122 |
+BRK |
|
| 123 |
+ |
|
| 124 |
+@redraw ( -- ) |
|
| 125 |
+ |
|
| 126 |
+ .a-frame/x LDZ2 .Screen/x DEO2 |
|
| 127 |
+ .a-frame/y LDZ2 .Screen/y DEO2 |
|
| 128 |
+ .input/a LDZ ;draw-byte JSR2 |
|
| 86 | 129 |
|
| 87 |
- #e7 ;draw-byte JSR2 |
|
| 130 |
+ .b-frame/x LDZ2 .Screen/x DEO2 |
|
| 131 |
+ .b-frame/y LDZ2 .Screen/y DEO2 |
|
| 132 |
+ .input/b LDZ ;draw-byte JSR2 |
|
| 88 | 133 |
|
| 89 | 134 |
RTN |
| 90 | 135 |
|
| ... | ... |
@@ -93,7 +138,8 @@ RTN |
| 93 | 138 |
STH |
| 94 | 139 |
#0800 |
| 95 | 140 |
&loop |
| 96 |
- DUP STHkr SWP SFT #01 AND ;draw-bit JSR2 |
|
| 141 |
+ DUP #07 SWP - |
|
| 142 |
+ STHkr SWP SFT #01 AND ;draw-bit JSR2 |
|
| 97 | 143 |
INC GTHk ,&loop JCN |
| 98 | 144 |
POP2 |
| 99 | 145 |
.Screen/y DEI2 #0003 ++ .Screen/y DEO2 |
| ... | ... |
@@ -144,7 +190,24 @@ RTN |
| 144 | 190 |
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
| 145 | 191 |
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
| 146 | 192 |
( colorize on state ) |
| 147 |
- #41 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO |
|
| 193 |
+ #42 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO |
|
| 194 |
+ |
|
| 195 |
+RTN |
|
| 196 |
+ |
|
| 197 |
+@within-rect ( x* y* rect -- flag ) |
|
| 198 |
+ |
|
| 199 |
+ STH |
|
| 200 |
+ ( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN |
|
| 201 |
+ ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN |
|
| 202 |
+ SWP2 |
|
| 203 |
+ ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN |
|
| 204 |
+ ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN |
|
| 205 |
+ POP2 POP2 POPr |
|
| 206 |
+ #01 |
|
| 207 |
+RTN |
|
| 208 |
+ &skip |
|
| 209 |
+ POP2 POP2 POPr |
|
| 210 |
+ #00 |
|
| 148 | 211 |
|
| 149 | 212 |
RTN |
| 150 | 213 |
|