cleanup example

This commit is contained in:
Nico 2021-09-10 14:50:11 +01:00
parent 139c1293de
commit df583bcdec
1 changed files with 25 additions and 25 deletions

View File

@ -1,3 +1,4 @@
( example of basic monome grid + uxn interactions )
%RTN { JMP2r }
@ -31,44 +32,43 @@
BRK
( each time a byte comes in, store it in the message and increase the count. If the count is #02, a whole message is read, so do stuff with it.
grid messages are 3 bytes - state , x, and y )
@read
( initialise local variables for reading grid messages. Message stores the 3-byte message from the grid, count is how many bytes have been read )
&message $3
&count $1
( initialise local variables for reading grid messages. Message stores the 3-byte message from the grid, count is how many bytes have been read )
&message $3
&count $1
&run
.Console/read DEI ,&count LDR #00 SWP ;&message ADD2 STA
,&count LDR #01 ADD ,&count STR
,&count LDR #03 EQU ,&process JCN
&run
( each time a byte comes in, store it in the message and increase the count. If the count is #03, a whole message is read, so do stuff with it. Grid messages are 3 bytes - state , x, and y )
.Console/read DEI ,&count LDR #00 SWP ;&message ADD2 STA
,&count LDR #01 ADD ,&count STR
,&count LDR #03 EQU ,&process JCN
BRK
&process
#00 ,&count STR ( reset counter )
#00 ,&count STR ( reset counter )
( draw a block on the display at the position of the grid button press )
;&message #0001 ADD2 LDA ( get message X position )
#00 SWP ( convert to a short )
#0008 MUL2 .Screen/x DEO2 ( set display X position )
;&message #0001 ADD2 LDA ( get message X position )
#00 SWP ( convert to a short )
#0008 MUL2 .Screen/x DEO2 ( set display X position )
;&message #0002 ADD2 LDA ( get message Y position )
#00 SWP ( convert to a short )
#0008 MUL2 .Screen/y DEO2 ( set display Y position )
;&message #0002 ADD2 LDA ( get message Y position )
#00 SWP ( convert to a short )
#0008 MUL2 .Screen/y DEO2 ( set display Y position )
;block .Screen/addr DEO2 ( set sprite to a block )
;block .Screen/addr DEO2 ( set sprite to a block )
;&message LDA .Screen/sprite DEO ( draw the sprite )
;&message LDA .Screen/sprite DEO ( draw the sprite )
( output to the grid to change the square. Write a #00 to send a set message, then the x, y, and state )
#00 .Console/write DEO
;&message #0001 ADD2 LDA .Console/write DEO
;&message #0002 ADD2 LDA .Console/write DEO
;&message LDA .Console/write DEO
( output to the grid to change the square. Write a #00 to send a set message, then the x, y, and state )
#00 .Console/write DEO
;&message #0001 ADD2 LDA .Console/write DEO
;&message #0002 ADD2 LDA .Console/write DEO
;&message LDA .Console/write DEO
BRK