PATTERNER 1.5 - CYCLE library
-----------------------------
This file contains detailed information about the included CYCLER
library file and some programming examples.

To recapture:
In PATTERNER you can assemble a system of interacting data
structures that create MIDI messages. But these structures are fixed
and therefore have limitations. The CYCLE system provides 'hooks' in
the playback chain where you can 'plug' in assembly routines that
change system parameters while playing back. Exactly what is changed
and to what extend is up to the user. At this time there are about
half of the system parameters and functions accessable by routines in
this library. I am working on the other (and without doubt more
interesting) half.

In general routines can have up to twenty inputs/outputs. There are
no restrictions whatsoever about CYCLE assembly. Any combinations are
possible. Of course there are routine sequences that don't make any
sense but the user will find this out by reading about the individual
routine functions.

Probably the most important aspect of assembling CYCLES is the
parameter stack. For example routine '35 GET CHANNELS':
This piece of code will read the status of the Sound Channel
selection buttons (the sixteen buttons in a vertical row right beside
the BEAT GRID on the main page). The routine will return one
parameter on the stack. The parameter returned is a 16bit value; for
every selected button in the channel selection pattern you'll find a
set bit, bit 0 will correspond with channel 0, etc. The next step
could be '41 SET SYSSPEED'. This routine picks up a value from the
stack (in this case the 16bit channel selection pattern). It will
then use this value to set the system speed (of course it 'clips' the
number - system speed can exceed 255, but we can't be sure that
the number on the stack is within that limit). All values pushed
to/and pulled from the stack are 16bit values (words).

In short:
   35 GET CHANNELS   [1 0]    ;get channel selection pattern, put it
                              ;on the stack
   41 SET SYSSPEED   [0 1]    ;most recent stack value up and use it
                              ;to set the System Speed


The CYCLER stack works on a last in/first out basis. You can put up
to twenty parameters on the stack. However, you will then have to
pick up everything before the particular CYCLE is ended. As example:

   Routine 1 --> push value 1 to stack (stack = 1)
   Routine 2 --> push value 2 to stack (stack = 2)
   Routine 3 --> pull value 2 from stack/the most recently pushed
   (stack = 1)
   Routine 4 --> pull value 1 from stack (stack = 0)
   END

If you SAVE CODE (which will try to create a CYCLER assembly file),
PATTERNER checks if the stack = 0 in all CYCLES. If the is a mismacth
in the number of in/outputs in any of the eight CYCLES you'll get an
error message.


List of all available routines in CYCLES.LIB V1.40
--------------------------------------------------
All routines are shown as:
<number in library><name><[inputs outputs]>
Note that routines 00-09 are not accessible in the CYCLE programmer.
These pieces of code are used automaticly when the assembly file is
created.


00 CYCLE INIT [0 0]
The data transfer buffer is initialized. This enables PATTERNER to
access data within the CYCLE file and also tells the routines in the
CYCLE file the locations of important data within PATTERNER. It also
reserves the parameter stack.


01 TIC CYCLE [0 0]
First routine that is executed when PATTERNER 'detours' into the
CYCLE file on after a finished TIC. Initializes data pointers and
then executes the rest of the code until CYCLE END.


02 BEAT CYCLE [0 0]
First routine in BEAT CYCLE 'detour'.


03 PATTERN CYCLE [0 0]
First routine in PATTERN CYCLE 'detour'.


04 SONG CYCLE [0 0]
Same for SONG CYCLE.


05 MANUAL 1 CYCLE [0 0]
First routine to be executed when MANUAL 1 CYCLE is launched by
pressing the <1> key on the ST keyboard (not numberpad!). This
routine can also be launched when playback os stopped.


06 MANUAL 2 CYCLE [0 0]
Same for MANUAL 2 CYCLE.


07 MANUAL 3 CYCLE [0 0]
Same for MANUAL 3 CYCLE.


08 MANUAL 4 CYCLE [0 0]
Same for MANUAL 4 CYCLE.


09 CYCLE END [0 0]
This is last routine at the end of each CYCLE. It restores all
altered processor registers and leads back into the regular playback
chain.


User accessible routines

10 Raw RANDOM [0 1]
This returns a 16bit random value on the stack. While the random
number is derived using a GEMDOS routine, it is put through some
alteration to make it 'more' random. It's probably random enough for
most purposes. The returned parameter can be any number between 0 and
65535.
Example: 10 Raw RANDOM  ;put 16bit random value on stack


11 Clipped RANDOM [2 1]
This uses the same core like the previous routine but the user can
set the lower and upper margin. When this routine is called there
must be (at least) two parameters on the stack. The first parameter
to be picked up is the upper margin, the second one is lower margin.
That means you have to put the lower margin value on the stack first,
then the upper margin value.
Example: 50 PUSH 00001     ;push value '1' on stack (lower margin)
         50 PUSH 00032     ;push value '32' on the stack (upper
 margin)
         11 Clipper RANDOM ;put clipped random number on stack
         <now we'll find a random value between 1 and 32 on the
         stack>


12 SET SCALE wBEAT [1 0]
This routine means: SET the SCALE number in the current workBEAT.
The term 'workBEAT' refers to the BEAT that is played back at this
very moment - workBEAT doesn't neccessarily have to be the one
displayed in the GRID. This routine picks up one value from the
stack. If the value is out of range (i.e. there is no entry by that
number in the SCALE BANK), no change takes place.
Example: 35 GET CHANNELS      ;put channel selection pattern on stack
         12 SET SCALE wBEAT   ;pick up value and set SCALE


13 GET SCALE wBEAT [0 1]
This routine means: GET the SCALE number of the current workBEAT.
This actually looks up the work SCALE, meaning the SCALE that is
currently used. The return value is pushed on the stack.
Example: 13 GET SCALE wBEAT   ;put workSCALE on stack
         34 SET CHANNELS      ;pick up value and set channel
                              ;selection pattern accordingly

14 SET MMAC wBEAT [1 0]
Means: SET Midi MACro in current working BEAT. Picks up one value
from the stack and uses it to set the MIDI MACRO attached to the
workBEAT. If the value is out of range no change takes place.
Example: 13 GET SCALE wBEAT   ;put workSCALE on stack
         14 SET MMAC wBEAT    ;pick up value and set MIDI MACRO of
                              ;workBEAT


15 GET MMAC wBEAT [0 1]
Means: GET Midi MACro number of current workBEAT. Or: GET work MIDI
MACRO. Pushes the number of the work MIDI MACRO on the stack.
Example: 15 GET MMAC wBEAT    ;push work MIDI MACRO on stack
         57 SUB 00010         ;subtract 10 from most recent stack
                              ;entry
         34 SET CHANNELS      ;pick up stack value and set channel
                              ;selection pattern


16 SET TICS wBEAT [1 0]
Means: SET TICS in current workBEAT. Picks up one value from the
stack and uses it to set the TIC value of the workBEAT. The value is
clipped to be within the range of 1-32 by clearing all bits above 5.
Example: 41 GET SYSSPEED      ;push the system speed on the stack
         16 SET TICS wBEAT    ;pick up stack value and use to set
                              ;TICS in workBEAT


17 GET TICS wBEAT [0 1]
Means: GET TICS of workBEAT. Writes the TIC value of the current
workBEAT to the stack. The value returned is in the range of 1-32.
Example: 17 GET TICS wBEAT    ;push TIC value of workBEAT on stack
         54 NOT <STACK>       ;perform logical NOT on most recent
                              ;stack entry
         22 TRANS ALL up      ;pick up stack value and transpose all
                              ;pitches in the workSCALE up by <value>
                              ;halfsteps


18 TRANS ALL up 1 [0 0]
Means: TRANSpose ALL MIDI keynumbers (pitches) in workSCALE up by one
halfnote.
Example: 18 TRANS ALL up 1    ;transpose all piches up in wSCALE


19 TRANS ALL dn 1 [0 0]
Means: TRANSpose ALL MIDI keynumbers in workSCALE down by one
halfnote.
Example: 19 TRANS ALL dn 1    ;transpose all pitches down in wSCALE


20 TRANS SEL up 1 [0 0]
Means: TRANSpose MIDI keynumbers on selected sound channels
(according to channel selection pattern) up by one halfstep in
workSCALE.
Example: 20 TRANS SEL up 1    ;transpose selected channels up


21 TRANS SEL dn 1 [0 0]
Means: TRANSpose MIDI keynumbers on selected sound channels down by
one halfstep in workSCALE.
Example: 21 TRANSSEL dn 1     ;transpose selected channels down


22 TRANS ALL up [1 0]
Means: TRANSpose ALL MIDI keynumbers in workSCALE up by halfsteps
according to the value picked from the stack. Picks up one value from
the stack and uses it as transposition interval. The MIDI note number
range is from 0-127. All pitch changes are clipped this way:
<new pitch>=(<old pitch>+<stack value>) AND 127
Example: 50 PUSH 00005        ;push value '5' on stack
         22 TRANS ALL up      ;pick up stack value and transpose
                              ;workSCALE up so many halfsteps


23 TRANS ALL dn [1 0]
Means: TRANSpose ALL MIDI keynumbers in workSCALE down by halfsteps
according to the value picked from the stack. Picks up one value from
the stack and uses it as transposition interval. Pitches are clipped
within proper range.
Example: 42 GET SYSSPEED      ;push system speed on stack
         23 TRANS ALL dn      ;pick up stack value and transpose
                              ;workSCALE down by so many halfsteps


24 TRANS SEL up [1 0]
Means: TRANSpose MIDI keynumbers of selected sound channels in
workSCALE up by halfsteps according to the value picked from the
stack. Picks up one value from the stack and uses it as transposition
interval for all selected sound channels. Pitches are clipped.
Example: 17 GET TICS wBEAT    ;push TICS value of workBEAT on stack
         24 TRANS SEL up      ;pick up stack value and transpose
                              ;selected sound channels up


25 TRANS SEL dn [1 0]
Means: TRANSpose MIDI keynumbers of selected sound channels in
workSCALE down by halfsteps according to the value picked from the
stack. Picks up one value from the stack and uses it as transposition
interval for all selected sound channels. Pitches are clipped.
Example: 10 Raw RANDOM     ;push random value on stack
         25 TRANS SEL dn   ;pick up stack value and transpose
                           ;selected sound channels down


26 MIDI ALL up 1 [0 0]
Means: Increase ALL MIDI channels in current workSCALE by one step.
Increase beyond 15 resets the channel to 0.
Example: 26 MIDI ALL up 1  ;raise all MIDI channels in workSCALE


27 MIDI ALL dn 1 [0 0]
Means: Decrease ALL MIDI channels in current workSCALE by one step.
Decrease below 0 resets the channel to 15.
Example: 27 MIDI ALL dn 1  ;lower all MIDI channels in workSCALE


28 MIDI SEL up 1 [0 0]
Means: Increase MIDI channels on SELected sound channels in workSCALE
by one. Values are clipped.
Example: 28 MIDI SEL up 1  ;raise MIDI channels on selected sound
                           ;channels in workBEAT


29 MIDI SEL dn 1 [0 0]
Means: Decrease MIDI channels on SELected sound channels in workSCALE
by one. Value are clipped.
Example: 29 MIDI SEL dn 1  ;lower MIDI channels on selected sound
                           ;channels in workBEAT


30 MIDI ALL up [1 0]
Means: Increase ALL MIDI channels in workSCALE by steps according to
value picked from stack. Picks up one value from stack and raises
MIDI channels using this value. All values are clipped between 0-15.
Example: 42 GET SYSSPEED   ;push system speed on stack
         30 MIDI ALL up    ;pick value from stack and increase all
                           ;MIDI channels


31 MIDI ALL dn [1 0]
Means: Decrease ALL MIDI channels in workSCALE by steps according to
value picked from stack. Picks up one value from stack and lowers
MIDI channels using this value. All values are clipped between 0-15.
Example: 35 GET CHANNELS      ;push channel selection pattern on stack
         39 GET PITCH wSCALE  ;pick up stack value/look up keynumber
                              ;on that sound channel in workSCALE and
                              ;push keynumber on stack
         31 MIDI ALL dn       ;pick up value from stack and decrease
                              ;MIDI channels


32 MIDI SEL up [1 0]
Means: Increase all selected MIDI channels in workSCALE by steps
according to value picked from stack. Picks up one value from stack
and raises all selected MIDI channels using this value. All values
are clipped between 0-15.
Exameple: 50 PUSH 0005        ;push value '5' on stack
          59 MULTIPLY 0005    ;multiply most recent stack entry
          32 MIDI SEL up      ;pick upstack value and increase MIDI
                              ;channels


33 MIDI SEL dn [1 0]
Means: Decrease all selected MIDI channels in workSCALE by steps
according to value picked from stack. Picks up one value from stack
and lowers all selected MIDI channels using this value. All values
are clipped between 0-15.
Example: 50 PUSH 00003        ;push value '3' on stack
         51 Re-Stack STACK    ;make a copy of the most recent stack
                              ;entry
         34 SET CHANNELS      ;pick up stack and set channel
                              ;selection pattern (select channel 3)
         33 MIDI SEL dn       ;pick up stack and decrase MIDI
                              ;channels


34 SET CHANNELS [1 0]
Picks up one value from the stack and uses it to set the main page
channel selection pattern. Bits 0-15 correspond with sound channels
0-F.
Example: 50 PUSH 00015        ;push value '15' on stack
         34 SET CHANNELS      ;pick up value and set channel
                              ;selection pattern (all in this case)


35 GET CHANNELS [0 1]
Looks up the channel selection pattern and pushes it on the stack.
Example: 35 GET CHANNELS      ;push channel selection on stack
         59 DIVIDE 000010     ;divide topmost stack entry
         34 SET CHANNELS      ;pick up value and set channels


36 NOT CHANNELS [0 0]
Reverses the sound channel selection pattern. This corresponds to
clicking over the sound channel selection column on the main page
while holding down the CONTROL key.
Example: 36 NOT CHANNELS      ;reverse channel selection pattern


37 ROL CHANNELS [0 0]
Rotates the sound channel selection pattern left. Or actually from
top to bottom. With wrap around.
Example: 37 ROL CHANNELS      ;rotate selection pattern down


38 ROR CHANNELS [0 0]
Rotates the sound channel selection pattern right. Or from bottom to
top. With wrap around.
Example: 38 ROR CHANNELS      ;rotate selection pattern up


39 GET PITCH wSCALE [1 1]
Means: GET PITCH (MIDI keynumber) from a specified sound channel in
the workSCALE. Picks up one value from the stack. This value is
clipped 0-15 and used as sound channel index. Now the MIDI keynumber
at this position in the workSCALE is looked up and pushed to the
stack.
Example: 50 PUSH 00010        ;push value '10' to the stack
         39 GET PITCH wSCALE  ;pick up value get MIDI keynumber of
                              ;specified channel and push it on stack
         41 SET SYSSPEED      ;pick up value and use it to set system
                              ;speed


40 SET PITCH wSCALE [2 0]
Means: SET PITCH (MIDI keynumber) of specified sound channel in
workSCALE to specified new pitch. First picks up sound channel index
then new pitch (so make sure to push the new pitch first and sound
channel index second). The pitch number is clipped to 0-127.
Example: 50 PUSH 00080        ;push new pitch number
         50 PUSH 00010        ;push sound channel index
         40 SET PITCH wSCALE  ;pick up both values and set keynumber


41 SET SYSSPEED [1 0]
Picks up one value from the stack and uses it to set the system speed.
The value is clipped to be between 0-255.
Example: 17 GET TICS wBEAT    ;push tics value of workBEAT on stack
         41 SET SYSSPEED      ;picks up value and uses it to set
                              ;system speed


42 GET SYSSPEED [0 1]
Reads system speed and pushes in on the stack.
Example: 42 GET SYSSPEED      ;push system speed on the stack
         52 AND 00607         ;perform logical AND on topmost stack
                              ;entry
         16 SET TICS wBEAT    ;pick up value and use to set tics
                              ;value


43 NOT BEATSPEED [0 0]
Reverse the current status of internal/system speed flag of workBEAT.
This makes the BEAT either use its internal speed or system speed.
Example: 43 NOT BEATSPEED     ;reverse internal/system speed flag


44 wBEAT INT SPEED [0 0]
Sets the internal/system speed flag of workBEAT to internal speed.
Example: 44 wBEAT INT SPEED   ;set workBEAT to internal speed


45 wBEAT SYS SPEED [0 0]
Sets the internal/system speed falg of workBEAT to system speed.
Example: 45 wBEAT SYS SPEED   ;set workBEAT to system speed


46 wBEAT NOT Mflag [0 0]
Reverses the status of the M-MAC (MIDI MACRO enable flag) of
workBEAT. This flag enables the BEAT to carry out its attached MIDI
MACRO if set.
Example: 46 wBEAT NOT Mflag   ;toggle status of MIDI MACRO enable
                              ;flag


47 wBEAT SET Mflag [0 0]
Enables the workBEAT to carry out its attached MIDI MACRO.
Example: 47 wBEAT SET Mflag   ;enable MIDI MACRO flag


48 wBEAT CLR Mflag [0 0]
Disables the workBEAT to carry out the attached MIDI MACRO.
Example: 48 wBEAT CLR Mflag   ;disbale MIDI MACRO flag


49 wBEAT WRT Chan [2 0]
Means: In workBEAT write a specific bit pattern into the GRID on
specific sound channels. First value picked up will determine which
sound channels are affected - uses the same principle like sound
channel selection pattern. The second value contains the new bit
pattern for the grid. Since this is a sixteen bit value but the GRID
is 32 positions wide it is used twice.
Example: 50 PUSH 65535        ;push value '65535' to the stack
         51 Re-Stack STACK    ;make a copy of topmost stack entry
         49 wBEAT WRT Chan    ;pick up both values and fill channels


50 PUSH # [0 1]
Lets you push a value of your choice on the stack. This routine is
displayed with a '#' in the library source window. As soon as it is
copied over into any CYCLE the '#' is replaced by '00000' - meaning
it pushes the value zero on the stack. To set a push value
double-click over the entry in the CYCLE window. In the value enter
box you can enter: decimal values up to 65535, hexdecimal numbers
using a '$' header (as in $ff4), binary numbers using a '%' header
(as in %110011).


51 Re-Stack STACK [0 1]
Looks up the topmost entry on the stack (without removing it!) and
pushes it to the stack again. After executing this routine there will
be two identical values on top of the stack.
Example: 51 Re-Stack STACK       ;copy topmost stack entry


52 AND # [0 0]
Performs a logical AND operation on the topmost stack entry using the
input value. See '50 PUSH' on how to edit the routine's internal
value.


53 OR # [0 0]
Performs a logical OR operation on the topmost stack entry using the
input value. See '50 PUSH' on how to edit the internal value.


54 NOT <STACK> [0 0]
Performs a logical NOT operation on the topmost stack entry. This
means a reversal of the bit pattern.
Example: 54 NOT <STACK>       ;reverse bit pattern of stack entry


55 EOR # [0 0]
Performs a logical EOR operation on the topmost stack entry using the
input value. See '50 PUSH' on how to edit the internal value.


56 ADD # [0 0]
Add the input value to the topmost stack entry. See '50 PUSH' on how
to edit the internal value.


57 SUB # [0 0]
Subtract the input value from the topmost stack entry. See '50 PUSH'
on how to edit the internal value.


58 MULTIPLY # [0 0]
Multiply the topmost stack entry with the input value. See '50 PUSH'
on how to edit the internal value.


59 DIVIDE # [0 0]
Divide the topmost stack entry by the input value. If the routine's
internal value is 0 then no operation takes place, as the 68000
doesn't like a division by 0.


60 MIDI MSG # [x x]
Unlike other routine this one can pick up as many values from the
stack as the user needs. The internal value determines exactly how
many parameters are pulled from the stack. The values from the stack
are then sent to the MIDI port. This lets you 'hardwire' all sorts of
small MIDI commands, from single notes, to chords or more complex
control sequences. Again be aware that this routine will pick up the
topmost stack entry first, therefore the values have to be pushed on
the stack in reverse order! Another difference is that this routine
will shut off the CYCLE's internal error control and you yourself
must make sure that all stack inputs/outputs match up! Finally,
although there can be up to 20 entries on the stack longer MIDI data
chunks should be broken up into multiple 'MIDI MSG' calls.
Example: 50 PUSH 00060        ;push value '60' to stack (note number)
         50 PUSH 00045        ;push value '85' to stack (velocity)
         50 PUSH 00144        ;push value '144' to stack (Note On
                              ;channel 0
         60 MIDI MSG 00003    ;pick up 3 values from stack and send
                              ;to MIDI port (in this case a Note On)


61 MIDI IN FITLERED [0 1]
While this routine works it is still in experimental stage. If you
recall PATTERNER has a MIDI in buffer that records all or filtered
MIDI data. This buffer is 256 bytes in size. The MIDI IN filter box
determines what is actually going to the buffer. These can be
complete MIDI messages, or only fractions. This routine will pick up
the most recently received byte from the MIDI in buffer and push it
to the stack. Since you can filter out everything but note numbers or
velocity values you have access to one data type only.
Example: 61 MIDI IN FILTERED  ;push most recent MIDI In byte on stack


62 Remote Control [1 0]
This also is still very experimental. This is what it is supposed to
do: Whenever a CYCLE executes this routine it will pick up the
topmost value from the stack and place it in a private area in
PATTERNER. Then it writes a <SPACE> character to the keyboard buffer
to tell the GEM Evnt_multi that something has been done by the user.
Via a filter PATTERNER detects that it has just received a message
from a CYCLE and tries to execute that command. Theoretically the
PATTERNER system should be remote controllable from within CYCLES
like that. Practically, however, there are problems with the
communication - that realtime stuff is hard to debug. Usually the
process works after the user has opened some dialog boxes or
something.
Another issue is speed. Consider this CYCLE on a BEAT level (executed
after every finished BEAT):
   50 PUSH 00021     ;push value '21' on stack (code for main page
                     ;UDATE)
   62 Remote Control ;pick up stack value and send to PATTERNER
This will redraw the complete main screen each time it's called. As
stated in the MANUAL.TXT PATTERNER is drawing directly to the screen
memory. This means that the screen redraws will happen ALWAYS, even
if you are in dialog box. Also if playback speed increases above 210
or so, screen updates will happen so often that the computer won't
notice most of your actions. You won't even be able to stop playback.
For this instance there is an 'Emergency Brake': Hold down both SHIFT
& ALTERNATE KEYS the press <ESC>. This will stop playback via
interrupt override.

Here's a list of all currently available remote commands. Be aware
that the names are only taken over from the source code. You must
push the number on the stack:

R_PLAY_BEAT       $01
Start BEAT playback. Remote of BEAT playback button on mainpage.

R_PLAY_STOP       $02
Stop any playback. Remote of STOP button on mainpage, or <ESC>.

R_PLAY_PATT       $03
Start PATTERN playback. Remote of PATTERN playback button on
mainpage.

R_PLAY_SONG       $04
Start SONG playback. Remote of SONG playback button on mainpage.

R_BEAT_MICRO      $05
Launch current BEAT MicroCommand. Same as pressing <F1> from the
mainpage.

R_SCA_MICRO       $06
Launch current SCALE MicroCommand. Same as pressing <F2> from the
mainpage.

R_MANUAL1_C       $07
Launch MANUAL 1 CYCLE. This gives you access to extra code. Same as
pressing <1> on the computer keyboard.

R_MANUAL2_C       $08
Launch MANUAL 2 CYCLE. Same as pressing <2> on the computer keyboard.

R_MANUAL3_C       $09
Launch MANUAL 3 CYCLE. Same as pressing <3> on the computer keyboard.

R_MANUAL4_C       0a
Launch MANUAL 4 CYCLE. Same as pressing <4> on the computer keyboard.

R_MMAC_ENABLE     $0b
Enable MIDI MACRO flag in workBEAT. Same as clicking over MIDI MACRO
enable flag or pressing <INSERT> key.

R_USE             $0c
Same as clicking over USE button on mainpage. Attaches current
SCALE/MIDI MACRO to current BEAT.

R_WORK_PAGES      $0d
Same as clicking EDIT button on mainpage. Has probably no practical
value.

R_MMAC_FLAG       $0e
Toggle global MIDI MACRO enable flag. Same as clicking the menu
entry.

R_NOTEOFF_FLAG    $0f
Toggle note off flag. If flag is set then all empty GRID positions
are sent as Note Offs, otherwise nothing is sent. Same as clicking
the menu entry.

R_SLOT_FLAG       $10
Toggle TIC CYCLE flag. Same as menu entry.

R_BEAT_FLAG       $11
Toggle BEAT CYCLE flag. Same as menu entry.

R_PATT_FLAG       $12
Toggle PATTERN CYCLE flag. Same as menu entry.

R_SONG_FLAG       $13
Toggle SONG CYCLE flag. Same as menu entry.

R_MANUAL_FLAG     $14
Toggle MANUAL CYCLES flag. Same as menu entry.

R_UPDATE          $15
Execute main screen redraw. Same as UPDATE button on mainpage.

R_PAUSE           $16
Pause playback. The system can pause itself, can sitch itself back
on? Same as PAUSE button on mainpage.

R_CLEAR_BEAT      $17
Clear all selected sound channels in current BEAT. Same as graphics
command CLEAR.

R_FILL_BEAT       $18
Fill all selected sound channels in current BEAT. Same as graphics
command FILL.

R_INVERT_BEAT     $19
Invert all selected sound channels in current BEAT. Same as grphics
command INVERT.

R_MIRRX_BEAT      $1a
Mirror BEAT GRID contents of current BEAT. Same as MirrorX button on
mainpage.

R_MIRRY_BEAT      $1b
Mirror BEAT GRID contents of current BEAT. Same as MirrorY button on
mainpage.

R_SHFTX_BEAT      $1c
Simulates ShiftX graphics command. Makes little sense without the
user holding down one of the SHIFT keys.

R_SHFTY_BEAT      $1d
Simulates ShiftY graphics command. Again user must press either SHIFT
key for result.

R_UNDO            $1e
Simulates UNDO command from mainpage.

R_MMC0            $1f
Execute MIDI MACRO attached to numberpad <0>.

R_MMC1            $20
Execute MIDI MACRO attached to numberpad <1>.

R_MMC2            $21
Execute MIDI MACRO attached to numberpad <2>.

R_MMC3            $22
Execute MIDI MACRO attached to numberpad <3>.

R_MMC4            $23
Execute MIDI MACRO attached to numberpad <4>.

R_MMC5            $24
Execute MIDI MACRO attached to numberpad <5>.

R_MMC6            $25
Execute MIDI MACRO attached to numberpad <6>.

R_MMC7            $26
Execute MIDI MACRO attached to numberpad <7>.

R_MMC8            $27
Execute MIDI MACRO attached to numberpad <8>.

R_MMC9            $28
Execute MIDI MACRO attached to numberpad <9>.

R_ARRL            $29
Simulate mouse click over left arrow button in BEAT scroll bar. Moves
backwards through BEAT BANK.

R_ARRR            $2a
Simulate mouse click over right arrow button in BEAT scroll bar. Move
forward through BEAT BANK.


63 SEND MIDI Macro [1 0]
Picks up one value from the stack. Uses value as index number for
MIDI MACRO. Value is clipped to available entries. Then the routine
sends out all contents of the selected MIDI MACRO through the MIDI
port.
Example: 50 PUSH 00011        ;push value '11' on stack
         63 SEND MIDI MACRO   ;pick up value and send specified MIDI
                              ;MACRO


64 SET MUTES [1 0]
Pick up value from stack and set mute buttons according to bit
pattern. Same principle as in channel selection pattern.
Example: 50 PUSH 00001        ;push value '1' to stack (channel 1)
         64 SET MUTES         ;pick up value from stack and set mute
                              ;status


65 GET MUTES [0 1]
Get mute status and push it on the stack.
Example: 65 GET MUTES         ;push mute status on stack
         34 SET CHANNELS      ;pick up stack value and select
                              ;channels


66 NOT MUTES [0 0]
Reverse mute status.
Example: 66 NOT MUTES         ;reverse current mute status


67 ROL MUTES [0 0]
Rotate mute status left. Actually roll status from bottom to top.
Example: 67 ROL MUTES         ;rotate status


68 ROR MUTES [0 0]
Rotate mute status right. Rolls status from top to bottom.


69 GET wBEAT [0 1]
Gets the number of the workBEAT and pushes it to the stack.
Example: 69 GET wBEAT         ;push workBEAT index on stack
         64 SET MUTES         ;pick value from stack and set mute
                              ;status


70 GET dBEAT [0 1]
Gets the number of the displayed BEAT and pushes it to the stack.
Example: 70 GET dBEAT         ;push displayed BEAT index on stack
         71 SET SCALE dBEAT   ;pick up stack value and set display
                              ;SCALE


71 SET SCALE dBEAT [1 0]
Picks a value from stack and uses it as index number for SCALE to be
attached.
Example: 69 GET wBEAT         ;push workBEAT index on stack
         71 SET SCALE dBEAT   ;pick up stack value and set display
                              ;SCALE


72 GET wTIC [0 1]
Push workTIC on stack. This is the current TIC.
Example: 72 GET wTIC          ;push current TIC number on stack
         64 SET MUTES         ;pick up stack value and set mute
                              ;status

