| ... | ... |
@@ -22,17 +22,17 @@ |
| 22 | 22 |
|
| 23 | 23 |
( devices ) |
| 24 | 24 |
|
| 25 |
-|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] |
|
| 26 |
-|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |
|
| 27 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
| 28 |
-|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
|
| 29 |
-|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
|
| 30 |
-|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
|
| 31 |
-|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
|
| 32 |
-|80 @Controller [ &vector $2 &button $1 &key $1 ] |
|
| 33 |
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
|
| 34 |
-|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ] |
|
| 35 |
-|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] |
|
| 25 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 26 |
+|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
|
| 27 |
+|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 28 |
+|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 29 |
+|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 30 |
+|50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 31 |
+|60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 32 |
+|80 @Controller &vector $2 &button $1 &key $1 |
|
| 33 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |
|
| 34 |
+|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
| 35 |
+|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |
|
| 36 | 36 |
|
| 37 | 37 |
( variables ) |
| 38 | 38 |
|
| ... | ... |
@@ -20,14 +20,13 @@ |
| 20 | 20 |
|
| 21 | 21 |
( devices ) |
| 22 | 22 |
|
| 23 |
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
|
| 24 |
-|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ] |
|
| 25 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
| 26 |
-|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
|
| 27 |
-|70 @Midi [ &vector $2 &channel $1 ¬e $1 &velocity $1 ] |
|
| 28 |
-|80 @Controller [ &vector $2 &button $1 &key $1 ] |
|
| 29 |
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
|
| 30 |
-|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ] |
|
| 23 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 24 |
+|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
|
| 25 |
+|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 26 |
+|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 27 |
+|80 @Controller &vector $2 &button $1 &key $1 |
|
| 28 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |
|
| 29 |
+|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
| 31 | 30 |
|
| 32 | 31 |
( variables ) |
| 33 | 32 |
|
| ... | ... |
@@ -35,11 +34,16 @@ |
| 35 | 34 |
|
| 36 | 35 |
@last-note $1 |
| 37 | 36 |
@octave $1 |
| 38 |
-@pointer [ &x $2 &y $2 ] |
|
| 39 |
-@center [ &x $2 &y $2 ] |
|
| 40 |
-@adsr-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
| 41 |
-@wave-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
| 42 |
-@octave-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
| 37 |
+@pointer |
|
| 38 |
+ &x $2 &y $2 |
|
| 39 |
+@center |
|
| 40 |
+ &x $2 &y $2 |
|
| 41 |
+@adsr-view |
|
| 42 |
+ &x1 $2 &y1 $2 &x2 $2 &y2 $2 |
|
| 43 |
+@wave-view |
|
| 44 |
+ &x1 $2 &y1 $2 &x2 $2 &y2 $2 |
|
| 45 |
+@octave-view |
|
| 46 |
+ &x1 $2 &y1 $2 &x2 $2 &y2 $2 |
|
| 43 | 47 |
|
| 44 | 48 |
( program ) |
| 45 | 49 |
|
| ... | ... |
@@ -8,15 +8,17 @@ |
| 8 | 8 |
|
| 9 | 9 |
( devices ) |
| 10 | 10 |
|
| 11 |
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
|
| 12 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
| 13 |
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
|
| 11 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 12 |
+|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 13 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |
|
| 14 | 14 |
|
| 15 | 15 |
|0000 |
| 16 | 16 |
|
| 17 | 17 |
@color $1 |
| 18 |
-@line [ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ] |
|
| 19 |
-@pointer [ &x $2 &y $2 &lastx $2 &lasty $2 &state $1 ] |
|
| 18 |
+@line |
|
| 19 |
+ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 |
|
| 20 |
+@pointer |
|
| 21 |
+ &x $2 &y $2 &lastx $2 &lasty $2 &state $1 |
|
| 20 | 22 |
|
| 21 | 23 |
( program ) |
| 22 | 24 |
|
| ... | ... |
@@ -73,19 +75,16 @@ BRK |
| 73 | 75 |
|
| 74 | 76 |
@draw-cursor ( -- ) |
| 75 | 77 |
|
| 76 |
- ;pointer_icn .Screen/addr DEO2 |
|
| 78 |
+ ;pointer-icn .Screen/addr DEO2 |
|
| 79 |
+ |
|
| 77 | 80 |
( clear last cursor ) |
| 78 | 81 |
.pointer/x LDZ2 .Screen/x DEO2 |
| 79 | 82 |
.pointer/y LDZ2 .Screen/y DEO2 |
| 80 | 83 |
#40 .Screen/sprite DEO |
| 81 | 84 |
|
| 82 |
- ( record pointer positions ) |
|
| 83 |
- .Mouse/x DEI2 .pointer/x STZ2 |
|
| 84 |
- .Mouse/y DEI2 .pointer/y STZ2 |
|
| 85 |
- |
|
| 86 | 85 |
( draw new cursor ) |
| 87 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
| 88 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
| 86 |
+ .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
|
| 87 |
+ .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
|
| 89 | 88 |
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO |
| 90 | 89 |
|
| 91 | 90 |
RTN |
| ... | ... |
@@ -118,4 +117,4 @@ RTN |
| 118 | 117 |
|
| 119 | 118 |
RTN |
| 120 | 119 |
|
| 121 |
-@pointer_icn [ 80c0 e0f0 f8e0 1000 ] |
|
| 120 |
+@pointer-icn 80c0 e0f0 f8e0 1000 |
| ... | ... |
@@ -14,31 +14,33 @@ WITH REGARD TO THIS SOFTWARE. |
| 14 | 14 |
*/ |
| 15 | 15 |
|
| 16 | 16 |
void |
| 17 |
-mouse_xy(Device *d, Uint16 x, Uint16 y) |
|
| 17 |
+mouse_down(Device *d, Uint8 mask) |
|
| 18 | 18 |
{
|
| 19 |
- poke16(d->dat, 0x2, x); |
|
| 20 |
- poke16(d->dat, 0x4, y); |
|
| 19 |
+ d->dat[6] |= mask; |
|
| 21 | 20 |
uxn_eval(d->u, d->vector); |
| 22 | 21 |
} |
| 23 | 22 |
|
| 24 | 23 |
void |
| 25 |
-mouse_z(Device *d, Uint8 z) |
|
| 24 |
+mouse_up(Device *d, Uint8 mask) |
|
| 26 | 25 |
{
|
| 27 |
- d->dat[7] = z; |
|
| 26 |
+ d->dat[6] &= (~mask); |
|
| 28 | 27 |
uxn_eval(d->u, d->vector); |
| 29 |
- d->dat[7] = 0x00; |
|
| 30 | 28 |
} |
| 31 | 29 |
|
| 32 | 30 |
void |
| 33 |
-mouse_down(Device *d, Uint8 mask) |
|
| 31 |
+mouse_pos(Device *d, Uint16 x, Uint16 y) |
|
| 34 | 32 |
{
|
| 35 |
- d->dat[6] |= mask; |
|
| 33 |
+ poke16(d->dat, 0x2, x); |
|
| 34 |
+ poke16(d->dat, 0x4, y); |
|
| 36 | 35 |
uxn_eval(d->u, d->vector); |
| 37 | 36 |
} |
| 38 | 37 |
|
| 39 | 38 |
void |
| 40 |
-mouse_up(Device *d, Uint8 mask) |
|
| 39 |
+mouse_mod(Device *d, Uint16 x, Uint16 y) |
|
| 41 | 40 |
{
|
| 42 |
- d->dat[6] &= (~mask); |
|
| 41 |
+ poke16(d->dat, 0xa, x); |
|
| 42 |
+ poke16(d->dat, 0xc, y); |
|
| 43 | 43 |
uxn_eval(d->u, d->vector); |
| 44 |
+ poke16(d->dat, 0xa, 0); |
|
| 45 |
+ poke16(d->dat, 0xc, 0); |
|
| 44 | 46 |
} |
| 45 | 47 |
\ No newline at end of file |
| ... | ... |
@@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | 10 |
WITH REGARD TO THIS SOFTWARE. |
| 11 | 11 |
*/ |
| 12 | 12 |
|
| 13 |
-void mouse_xy(Device *d, Uint16 x, Uint16 y); |
|
| 14 |
-void mouse_z(Device *d, Uint8 z); |
|
| 15 | 13 |
void mouse_down(Device *d, Uint8 mask); |
| 16 | 14 |
void mouse_up(Device *d, Uint8 mask); |
| 15 |
+void mouse_pos(Device *d, Uint16 x, Uint16 y); |
|
| 16 |
+void mouse_mod(Device *d, Uint16 x, Uint16 y); |
| ... | ... |
@@ -501,13 +501,13 @@ run(Uxn *u) |
| 501 | 501 |
uxn_eval(u, peek16((devaudio0 + (event.type - audio0_event))->dat, 0)); |
| 502 | 502 |
/* Mouse */ |
| 503 | 503 |
else if(event.type == SDL_MOUSEWHEEL) |
| 504 |
- mouse_z(devmouse, event.wheel.y); |
|
| 504 |
+ mouse_mod(devmouse, event.wheel.x, event.wheel.y); |
|
| 505 | 505 |
else if(event.type == SDL_MOUSEBUTTONUP) |
| 506 | 506 |
mouse_up(devmouse, 0x1 << (event.button.button - 1)); |
| 507 | 507 |
else if(event.type == SDL_MOUSEBUTTONDOWN) |
| 508 | 508 |
mouse_down(devmouse, 0x1 << (event.button.button - 1)); |
| 509 | 509 |
else if(event.type == SDL_MOUSEMOTION) |
| 510 |
- mouse_xy(devmouse, |
|
| 510 |
+ mouse_pos(devmouse, |
|
| 511 | 511 |
clamp(event.motion.x - PAD, 0, ppu.width - 1), |
| 512 | 512 |
clamp(event.motion.y - PAD, 0, ppu.height - 1)); |
| 513 | 513 |
/* Controller */ |