| ... | ... |
@@ -169,19 +169,15 @@ BRK |
| 169 | 169 |
@on-mouse ( -> ) |
| 170 | 170 |
|
| 171 | 171 |
;draw-cursor JSR2 |
| 172 |
+ |
|
| 172 | 173 |
.Mouse/state DEI #00 ! #01 JCN [ BRK ] |
| 173 |
- ( wave-view ) |
|
| 174 |
- .Mouse/x DEI2 DUP2 .wave-view/x1 LDZ2 >> ROT ROT .wave-view/x2 LDZ2 #0001 ++ << #0101 == |
|
| 175 |
- .Mouse/y DEI2 DUP2 .wave-view/y1 LDZ2 >> ROT ROT .wave-view/y2 LDZ2 << #0101 == |
|
| 176 |
- #0101 == ;on-touch-wave-view JCN2 |
|
| 177 |
- ( adsr-view ) |
|
| 178 |
- .Mouse/x DEI2 DUP2 .adsr-view/x1 LDZ2 >> ROT ROT .adsr-view/x2 LDZ2 << #0101 == |
|
| 179 |
- .Mouse/y DEI2 DUP2 .adsr-view/y1 LDZ2 >> ROT ROT .adsr-view/y2 LDZ2 << #0101 == |
|
| 180 |
- #0101 == ;on-touch-adsr-view JCN2 |
|
| 181 |
- ( octave-view ) |
|
| 182 |
- .Mouse/x DEI2 DUP2 .octave-view/x1 LDZ2 >> ROT ROT .octave-view/x2 LDZ2 << #0101 == |
|
| 183 |
- .Mouse/y DEI2 DUP2 .octave-view/y1 LDZ2 >> ROT ROT .octave-view/y2 LDZ2 << #0101 == |
|
| 184 |
- #0101 == ;on-touch-octave-view JCN2 |
|
| 174 |
+ |
|
| 175 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .wave-view ;within-rect JSR2 |
|
| 176 |
+ ;on-touch-wave-view JCN2 |
|
| 177 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .adsr-view ;within-rect JSR2 |
|
| 178 |
+ ;on-touch-adsr-view JCN2 |
|
| 179 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .octave-view ;within-rect JSR2 |
|
| 180 |
+ ;on-touch-octave-view JCN2 |
|
| 185 | 181 |
|
| 186 | 182 |
BRK |
| 187 | 183 |
|
| ... | ... |
@@ -459,6 +455,23 @@ RTN |
| 459 | 455 |
|
| 460 | 456 |
RTN |
| 461 | 457 |
|
| 458 |
+@within-rect ( x* y* rect -- flag ) |
|
| 459 |
+ |
|
| 460 |
+ STH |
|
| 461 |
+ ( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN |
|
| 462 |
+ ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN |
|
| 463 |
+ SWP2 |
|
| 464 |
+ ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN |
|
| 465 |
+ ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN |
|
| 466 |
+ POP2 POP2 POPr |
|
| 467 |
+ #01 |
|
| 468 |
+RTN |
|
| 469 |
+ &skip |
|
| 470 |
+ POP2 POP2 POPr |
|
| 471 |
+ #00 |
|
| 472 |
+ |
|
| 473 |
+RTN |
|
| 474 |
+ |
|
| 462 | 475 |
@cursor |
| 463 | 476 |
80c0 e0f0 f8e0 1000 |
| 464 | 477 |
|
| ... | ... |
@@ -1,10 +1,13 @@ |
| 1 | 1 |
( GUI Hover ) |
| 2 | 2 |
|
| 3 | 3 |
%RTN { JMP2r }
|
| 4 |
+%DEBUG { .Console/byte DEO #0a .Console/char DEO }
|
|
| 5 |
+%DEBUG2 { .Console/short DEO2 #0a .Console/char DEO }
|
|
| 4 | 6 |
|
| 5 | 7 |
( devices ) |
| 6 | 8 |
|
| 7 | 9 |
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
| 10 |
+|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ] |
|
| 8 | 11 |
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] |
| 9 | 12 |
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] |
| 10 | 13 |
|
| ... | ... |
@@ -33,40 +36,38 @@ |
| 33 | 36 |
( no BRK, run through to on-mouse ) |
| 34 | 37 |
|
| 35 | 38 |
@on-mouse |
| 36 |
- |
|
| 39 |
+ |
|
| 40 |
+ ( defaults ) |
|
| 37 | 41 |
;pointer_icn .pointer/sprite STZ2 |
| 38 | 42 |
|
| 39 | 43 |
#01 .color STZ |
| 40 |
- ( matrix comparison ) |
|
| 41 |
- .Mouse/x DEI2 .r1/x1 LDZ2 GTH2 .Mouse/x DEI2 .r1/x2 LDZ2 LTH2 #0101 EQU2 |
|
| 42 |
- .Mouse/y DEI2 .r1/y1 LDZ2 GTH2 .Mouse/y DEI2 .r1/y2 LDZ2 LTH2 #0101 EQU2 |
|
| 43 |
- #0101 NEQ2 ,&draw1 JCN #02 .color STZ ;hand_icn .pointer/sprite STZ2 |
|
| 44 |
- &draw1 .r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 44 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .r1 ;within-rect JSR2 #00 EQU ,&draw1 JCN |
|
| 45 |
+ #02 .color STZ |
|
| 46 |
+ ;hand_icn .pointer/sprite STZ2 |
|
| 47 |
+ &draw1 |
|
| 48 |
+ .r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 45 | 49 |
|
| 46 | 50 |
#01 .color STZ |
| 47 |
- ( 2-step comparison ) |
|
| 48 |
- .Mouse/x DEI2 .r2/x1 LDZ2 GTH2 .Mouse/x DEI2 .r2/x2 LDZ2 LTH2 #0101 NEQ2 ,&draw2 JCN |
|
| 49 |
- .Mouse/y DEI2 .r2/y1 LDZ2 GTH2 .Mouse/y DEI2 .r2/y2 LDZ2 LTH2 #0101 NEQ2 ,&draw2 JCN |
|
| 50 |
- #03 .color STZ ;hand_icn .pointer/sprite STZ2 |
|
| 51 |
- &draw2 .r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 51 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .r2 ;within-rect JSR2 #00 EQU ,&draw2 JCN |
|
| 52 |
+ #03 .color STZ |
|
| 53 |
+ ;hand_icn .pointer/sprite STZ2 |
|
| 54 |
+ &draw2 |
|
| 55 |
+ .r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 52 | 56 |
|
| 53 | 57 |
#01 .color STZ |
| 54 |
- ( 4-step comparison ) |
|
| 55 |
- .Mouse/x DEI2 .r3/x1 LDZ2 LTH2 ,&draw3 JCN |
|
| 56 |
- .Mouse/x DEI2 .r3/x2 LDZ2 GTH2 ,&draw3 JCN |
|
| 57 |
- .Mouse/y DEI2 .r3/y1 LDZ2 LTH2 ,&draw3 JCN |
|
| 58 |
- .Mouse/y DEI2 .r3/y2 LDZ2 GTH2 ,&draw3 JCN |
|
| 59 |
- #02 .color STZ ;hand_icn .pointer/sprite STZ2 |
|
| 60 |
- &draw3 .r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 58 |
+ .Mouse/x DEI2 .Mouse/y DEI2 .r3 ;within-rect JSR2 #00 EQU ,&draw3 JCN |
|
| 59 |
+ #02 .color STZ |
|
| 60 |
+ ;hand_icn .pointer/sprite STZ2 |
|
| 61 |
+ &draw3 |
|
| 62 |
+ .r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2 |
|
| 61 | 63 |
|
| 62 | 64 |
;draw-cursor JSR2 |
| 63 | 65 |
|
| 64 | 66 |
BRK |
| 65 | 67 |
|
| 66 |
-@draw-cursor |
|
| 68 |
+@draw-cursor ( -- ) |
|
| 67 | 69 |
|
| 68 | 70 |
( clear last cursor ) |
| 69 |
- ;clear_icn .Screen/addr DEO2 |
|
| 70 | 71 |
.pointer/x LDZ2 .Screen/x DEO2 |
| 71 | 72 |
.pointer/y LDZ2 .Screen/y DEO2 |
| 72 | 73 |
#30 .Screen/color DEO |
| ... | ... |
@@ -82,6 +83,23 @@ BRK |
| 82 | 83 |
|
| 83 | 84 |
RTN |
| 84 | 85 |
|
| 86 |
+@within-rect ( x* y* rect -- flag ) |
|
| 87 |
+ |
|
| 88 |
+ STH |
|
| 89 |
+ ( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN |
|
| 90 |
+ ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN |
|
| 91 |
+ SWP2 |
|
| 92 |
+ ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN |
|
| 93 |
+ ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN |
|
| 94 |
+ POP2 POP2 POPr |
|
| 95 |
+ #01 |
|
| 96 |
+RTN |
|
| 97 |
+ &skip |
|
| 98 |
+ POP2 POP2 POPr |
|
| 99 |
+ #00 |
|
| 100 |
+ |
|
| 101 |
+RTN |
|
| 102 |
+ |
|
| 85 | 103 |
@line-rect ( x1* y1* x2* y2* color -- ) |
| 86 | 104 |
|
| 87 | 105 |
( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2 |
| ... | ... |
@@ -99,6 +117,5 @@ RTN |
| 99 | 117 |
|
| 100 | 118 |
RTN |
| 101 | 119 |
|
| 102 |
-@clear_icn [ 0000 0000 0000 0000 ] |
|
| 103 | 120 |
@pointer_icn [ 80c0 e0f0 f8e0 1000 ] |
| 104 | 121 |
@hand_icn [ 4040 4070 f8f8 f870 ] |