( the beginnings of a euclidian sequencer thing ) %RTN { JMP2r } %MOD { DUP2 DIV MUL SUB } ( devices ) |00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ] |10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ] |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] |30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] |b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] ( variables ) ( audio0 - backbeat, audio1 - euclid ) |0000 @tick $1 @cycle $1 ( position in cycle ) |0100 ( -> ) ;square .Audio0/addr DEO2 #0100 .Audio0/adsr DEO2 #40 .Audio0/volume DEO #0002 .Audio0/length DEO2 ;square .Audio1/addr DEO2 #0100 .Audio1/adsr DEO2 #04 .Audio1/volume DEO #0002 .Audio1/length DEO2 ;on-frame/run .Screen/vector DEO2 BRK @on-frame ( -> ) &run .tick LDZ #01 ADD DUP .tick STZ #10 NEQ ,&next JCN ( if the tick is not 0x10, skip. This makes a beat every 16 frames ) ;on-tick/run JSR2 #00 .tick STZ &next BRK @on-tick &run .cycle LDZ #01 ADD .cycle STZ #40 .Audio0/pitch DEO .cycle LDZ #05 MOD #00 NEQ ,&clockup JCN #4c .Audio1/pitch DEO &clockup .cycle LDZ #10 NEQ ,&end JCN #00 .cycle STZ &end RTN @square [ ff 00 ]