basic layout

This commit is contained in:
sejo 2021-08-24 13:27:43 -05:00
parent d3e20b6628
commit a3d6b4588c
1 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,79 @@
# uxn tutorial: day 5, the mouse and uxntal goodies
(work in progress)
this is the fifth section of the <(uxn tutorial)>! here we introduce the varvara mouse device to explore more possible interactions, and we cover the remaining elements of uxntal and uxn: the return stack, the return mode and the keep mode.
we also discuss possible structures to create loops using these resources!
# the mouse device
the mouse device in the varvara computer has some similarities with the controller device: it has a vector that is called with any mouse event (change of buttons state, movement, wheel movement) and a couple of bytes to check its state.
it also has a couple of shorts corresponding to the x,y coordinates of the mouse pointer.
we see this device defined in uxntal in the following way:
```
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
```
## state byte
the state byte has the possible values:
* 01 when the left button is pressed
* 10 when the right button is pressed
* 11 when both buttons are pressed
* 00 when none of the buttons are pressed
## wheel byte
the wheel byte has the possible values:
* 01 when the mouse wheel is moving upwards
* ff when the mouse wheel is moving downwards
* 00 when the mouse wheel is not moving
## mouse vector
the mouse vector will be fired in any of the following events:
* a button was pressed
* a button was released
* the mouse was moved
* the mouse wheel was moved
here's a 1bpp sprite of a mouse pointer, taken from the uxn examples:
```
@pointer_icn [ 80c0 e0f0 f8e0 1000 ]
```
* mouse device and vector
* return stack and mode
* subroutines: parameters, calling, returning
* keep mode
* loops
* practice: sprite as pointer
* practice: simple drawing tool
new instructions: STH, JSR
# instructions of day 5
these are all the uxntal instructions that we discussed today!
* STH
* JSR
# coming soon: day 6
meanwhile, i invite you to keep exploring, to share your findings, and to also take a break!
stay tuned!
# support
if you found this tutorial to be helpful, consider sharing it and giving it your <(support)> :)