Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199512_2.adf » !Regulars » Regulars/RuntheRisc/Riff/!Riff/!RunImage

Regulars/RuntheRisc/Riff/!Riff/!RunImage

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199512_2.adf » !Regulars
Filename: Regulars/RuntheRisc/Riff/!Riff/!RunImage
Read OK:
File size: 1DF1 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM > Riff
    2
    3REM This program is Copyright 1994 Denis Howe.  You may
    4REM distribute verbatim or modified copies of this program
    5REM provided each such copy is distributed with a copyright
    6REM notice and distribution conditions identical to these.
    7
    8REM Please send me a copy of any changes you
    9REM make and add the details to the list below.
   10
   11REM Denis Howe <dbh@doc.ic.ac.uk>
   12REM 48 Anson Road, London, NW2 3UU
   13REM +44 (181) 450 9448
   14
   15REM 12 May 1992 0.00 Written by Denis Howe <dbh@doc.ic.ac.uk>
   16REM 14 Dec 1994 0.01 WIMP version
   17
   18Task$="Riff"
   19Purpose$="Random MIDI patterns"
   20Author$="� Denis Howe 1994"
   21Version$="0.01 (14 Dec 1994)"
   22
   23ON ERROR PROCError
   24
   25Seed%=17                     :REM Change this to get different "tunes"
   26
   27Dummy%=RND(-Seed%)
   28BeatLength%=100+RND(200)     :REM Initial tempo
   29RhythmChannel%=-3
   30PROCWimpInit
   31PROCMajorMinor
   32PROCNew
   33PROCMidiInit
   34REPEAT
   35  IF RND(200)=1 PROCReset
   36  IF RND(5)=1 PROCCopy ELSE PROCNew
   37  Time%=FNTime:StartTime%=Time%
   38  FOR T%=0 TO NT%-1
   39    IF T% AND 3 Velocity%=80 ELSE Velocity%=120
   40    FOR Chan%=0 TO NChan%-1
   41      IF Pitch%(T%,Chan%) THEN
   42        PROCNote(Chan%,0,0,Time%)
   43        PROCNote(Chan%,Pitch%(T%,Chan%),Velocity%,Time%)
   44      ENDIF
   45    NEXT Chan%
   46    Time%+=BeatLength%
   47  NEXT T%
   48  PROCAllOff(Time%)
   49  REPEAT PROCWait:UNTIL FNTime>StartTime%+NT%*BeatLength%
   50  IF RND(10)=1 BeatLength%+=.1*BeatLength%*(RND(2)-1.5)
   51  IF BeatLength%<100 BeatLength%=100
   52  IF BeatLength%>300 BeatLength%=300
   53UNTIL FALSE
   54
   55DEF PROCSet(T%,Chan%,P%)
   56Pitch%(T%,Chan%)=P%
   57PROCDrawNote(T%,Chan%)
   58ENDPROC
   59
   60DEF PROCReset
   61Pitch%()=0
   62PROCForce
   63ENDPROC
   64
   65REM ========================== WIMP =========================
   66 
   67DEF PROCWimpInit
   68DIM b% 260:b%+=4
   69NChan%=4
   70Log2NT%=5:NT%=1<<Log2NT%
   71DIM P%(6),UH%(11)
   72DIM Pitch%(NT%-1,NChan%-1),CurrentPitch%(NChan%-1),Swap%(NChan%-1)
   73P%()=0,2,4,5,7,9,11
   74UH%()=0,1,1,0,0,0,1,0,0,0,1,1 :REM unharmonius intervals (semitones)
   75
   76StartTime%=0:OldY%=-999
   77
   78$b%="TASK":SYS "Wimp_Initialise",200,!b%,Task$ TO,Task%
   79
   80REM Bar icon
   81b%!0=-1:b%!4=0:b%!8=0
   82b%!12=68:b%!16=68:b%!20=&3002
   83$(b%+24)="!Riff"
   84SYS "Wimp_CreateIcon",,b%
   85
   86REM Menu
   87DIM Menu% 100
   88$Menu%=Task$
   89Menu%?12=7:Menu%?13=2:Menu%?14=7:Menu%?15=0
   90Menu%!16=100:Menu%!20=44:Menu%!24=0
   91REM Item 0
   92Menu%!28=1<<7 :REM last
   93Menu%!32=-1
   94Menu%!36=1 OR 1<<5 OR 7<<24 OR 0<<28
   95$(Menu%+40)="Quit"
   96
   97REM Window
   98CharW%=16:CharH%=32
   99ChanW%=3*CharW%
  100WinW%=ChanW%*NChan%+CharW%
  101WinH%=CharH%*NT%+8
  102Title$=Task$+" "+STR$ Seed%
  103TitleW%=CharW%*LEN(Title$)+100
  104IF TitleW%>WinW% WinW%=TitleW%
  105b%!0=9999:b%!4=-WinH%:b%!8=b%!0+WinW%:b%!12=0
  106b%!16=0:b%!20=0:b%!24=-1:b%!28=&FF000002
  107b%?32=7:b%?33=2:b%?34=7:b%?35=0
  108b%?36=3:b%?37=1:b%?38=12:b%?39=0
  109b%!40=0:b%!44=-WinH%:b%!48=WinW%:b%!52=0
  110b%!56=&07000039:b%!60=0:b%!64=1:b%!68=&10001
  111$(b%+72)=Title$:b%!84=0
  112SYS "Wimp_CreateWindow",,b% TO WH%
  113b%!-4=WH%
  114SYS "Wimp_OpenWindow",,b%-4
  115T%=TIME+100:REPEAT PROCWait:UNTIL TIME>T%
  116ENDPROC
  117
  118DEF PROCPoll
  119LOCAL More%,R%,Y%
  120SYS "Wimp_Poll",&FFF9FDBC,b% TO R%
  121CASE R% OF
  122WHEN 0:PROCMoveCursor
  123WHEN 1
  124  SYS "Wimp_RedrawWindow",,b% TO More%
  125  WkOrX%=b%!4-b%!20:WkOrY%=b%!16-b%!24
  126  WHILE More%
  127    PROCRedraw(WkOrX%,WkOrY%)
  128    SYS "Wimp_GetRectangle",,b% TO More%
  129  ENDWHILE
  130WHEN 2:SYS "Wimp_OpenWindow",,b%
  131WHEN 3:SYS "Wimp_CloseWindow",,b%
  132WHEN 6
  133  CASE b%!8 OF
  134  WHEN 2
  135    IF b%!12=-2 Y%=1*44+96 ELSE Y%=b%!4+28
  136    SYS "Wimp_CreateMenu",,Menu%,b%!0-64,Y%
  137  WHEN 4
  138    !b%=WH%:SYS "Wimp_GetWindowState",,b%
  139    IF b%!32 AND 1<<16 THEN
  140      SYS "Wimp_CloseWindow",,b%
  141    ELSE
  142      SYS "Wimp_OpenWindow",,b%
  143    ENDIF
  144  ENDCASE
  145WHEN 9:PROCQuit
  146WHEN 17,18
  147  CASE b%!16 OF
  148  WHEN 0,8:PROCQuit
  149  WHEN &400C2:IF b%!4<>Task% AND FNString(b%+28)=Task$ PROCQuit
  150  ENDCASE
  151ENDCASE
  152ENDPROC
  153
  154DEF PROCDrawNote(T%,Chan%)
  155LOCAL X%,Y%
  156X%=Chan%*ChanW%:Y%=-T%*CharH%
  157SYS "Wimp_ForceRedraw",WH%,X%+CharW%,Y%-CharH%,X%+ChanW%+CharW%,Y%
  158ENDPROC
  159
  160DEF PROCForce
  161SYS "Wimp_ForceRedraw",WH%,0,-WinH%,WinW%,0
  162ENDPROC
  163
  164DEF PROCMoveCursor
  165LOCAL More%,Now%,X%,Y%,y%,oldy%
  166Now%=FNTime
  167Y%=(StartTime%-Now%)*CharH% DIV BeatLength%-8
  168IF ABS(Y%-OldY%)<4 ENDPROC
  169b%!0=WH%:b%!4=0:b%!8=-WinH%:b%!12=CharW%:b%!16=0
  170SYS "Wimp_UpdateWindow",,b% TO More%
  171X%+=b%!4-b%!20:y%=Y%+b%!16-b%!24:oldy%=OldY%+b%!16-b%!24
  172WHILE More%
  173  SYS "Wimp_SetColour",0:MOVE X%,oldy%:PRINT "�";
  174  SYS "Wimp_SetColour",11:MOVE X%,y%:PRINT "�";
  175  SYS "Wimp_GetRectangle",,b% TO More%
  176ENDWHILE
  177OldY%=Y%
  178ENDPROC
  179
  180DEF PROCRedraw(WkOrX%,WkOrY%)
  181LOCAL Chan%,T%,P%
  182FOR T%=0 TO NT%-1
  183  FOR Chan%=0 TO NChan%-1
  184    MOVE WkOrX%+Chan%*ChanW%+CharW%,WkOrY%-T%*CharH%-8
  185    P%=Pitch%(T%,Chan%)
  186    IF P% PRINT MID$("CDEFGAB", P% MOD 7+1,1);P% DIV 7; ELSE PRINT "��";
  187  NEXT
  188NEXT  
  189ENDPROC
  190
  191REM ========================== MIDI =========================
  192
  193DEF PROCMidiInit
  194SYS "MIDI_Init"
  195SYS "MIDI_FastClock",1
  196PROCAllOffNow
  197ENDPROC
  198
  199DEF FNTime
  200LOCAL T%
  201SYS "MIDI_FastClock",-1 TO,T%
  202=T%
  203
  204DEF PROCWait
  205LOCAL F%
  206REPEAT
  207  PROCPoll
  208  SYS "MIDI_InqBufferSize",1 TO F%
  209UNTIL F%
  210ENDPROC
  211
  212DEF PROCNote(Chan%,P%,V%,Time%)
  213LOCAL Command%
  214IF V% CurrentPitch%(Chan%)=FNP(P%) ELSE P%=CurrentPitch%(Chan%)
  215Command%=&90 OR Chan% OR CurrentPitch%(Chan%)<<8 OR V%<<16
  216SYS "MIDI_TxCommand",Command%,Time%
  217ENDPROC
  218
  219DEF PROCAllOff(Time%)
  220LOCAL Chan%
  221FOR Chan%=0 TO NChan%-1
  222  PROCNote(Chan%,0,0,Time%)
  223NEXT Chan%
  224ENDPROC
  225
  226DEF PROCAllOffNow
  227LOCAL Chan%
  228AllOff%=&03007BB0
  229FOR Chan%=0 TO NChan%-1
  230  SYS "MIDI_TxCommand",AllOff%+Chan%
  231NEXT
  232ENDPROC
  233
  234DEF PROCMajorMinor
  235IF RND<0 P%(2)=3:P%(5)=8 ELSE P%(2)=4:P%(5)=9
  236ENDPROC
  237 
  238DEF PROCNew
  239LOCAL D%,T%,M%,P%,TT%,CC%,MP%
  240Chan%=RND(NChan%)-1
  241IF Chan%=RhythmChannel% PROCRhythm:ENDPROC
  242T%=RND(NT%)-1
  243IF Pitch%(T%,Chan%) AND RND>0 Pitch%(T%,Chan%)=0:ENDPROC
  244REM Round T% down to biggest silent power of two
  245M%=NOT 1
  246REPEAT
  247  TT%=T% AND M%
  248  IF Pitch%(TT%,Chan%)=0 T%=TT%:M%=M%<<1 ELSE M%=0
  249UNTIL (NT% AND M%)=0
  250P%=RND(15)+6:MP%=FNP(P%)
  251FOR CC%=0 TO NChan%-1
  252  IF CC%<>Chan% AND Pitch%(T%,CC%) THEN
  253    D%=ABS(MP%-FNP(Pitch%(T%,CC%)))
  254    IF UH%(D% MOD 12) ENDPROC
  255  ENDIF
  256NEXT
  257PROCSet(T%,Chan%,P%)
  258ENDPROC
  259
  260DEF PROCRhythm
  261LOCAL D%,T%,P%
  262D%=1<<(RND(Log2NT%+1)-1)
  263T%=RND(NT%)-1
  264P%=RND(22)+6
  265WHILE T%<NT%
  266  PROCSet(T%,RhythmChannel%,P%)
  267  T%+=D%
  268ENDWHILE
  269ENDPROC
  270
  271DEF PROCCopy
  272LOCAL C%,CC%,P%
  273P%=RND>0
  274FOR C%=0 TO NChan%-1
  275  IF P% THEN
  276    REPEAT
  277      Swap%(C%)=RND(NChan%)-1
  278      CC%=0:WHILE Swap%(CC%)<>Swap%(C%) CC%+=1:ENDWHILE
  279    UNTIL CC%=C%
  280  ELSE
  281    Swap%(C%)=C%
  282  ENDIF
  283NEXT
  284LS%=1<<RND(LOG(NT%-1)/LOG2-1)
  285IF LS%*4<NT%-1 LD%=RND(3)*LS% ELSE LD%=LS%
  286TS%=(RND(NT%/LS%)-1)*LS%
  287TD%=(RND(NT%/LD%)-1)*LD%
  288PS%=RND(7)-1:DS%=RND(3)-2
  289FOR T%=0 TO LD%-1
  290  IF TD%+T%<TS% OR TD%+T%>=TS%+LS% THEN
  291    FOR C%=0 TO NChan%-1
  292      P%=Pitch%(TS%+T% MOD LS%, C%)
  293      IF P% THEN
  294        P%+=PS%+DS%*(T% DIV LS%)
  295        WHILE P%>28 P%-=7:ENDWHILE
  296      ENDIF
  297      PROCSet((TD%+T%) MOD NT%,Swap%(C%),P%)
  298    NEXT
  299  ENDIF
  300NEXT
  301ENDPROC
  302
  303DEF FNP(P%)=12*(P% DIV 7)+P%(P% MOD 7)+36
  304
  305REM ========================== Misc =========================
  306
  307DEF FNString(S%)
  308LOCAL P%:P%=S%
  309WHILE ?P%>ASC" ":P%+=1:ENDWHILE
  310$P%=""
  311=$S%
  312
  313DEF PROCError
  314ON ERROR OFF
  315PROCAllOffNow
  316IF ERR<>0 AND ERR<>17 THEN
  317  !b%=ERR:$(b%+4)=REPORT$+" @ "+STR$ ERL
  318  SYS"Wimp_ReportError",b%,1,"Riff"
  319ENDIF
  320PROCQuit
  321ENDPROC
  322
  323DEF PROCQuit
  324PROCMidiInit
  325SYS "MIDI_FastClock",0 :REM Stop
  326$b%="TASK":SYS"Wimp_CloseDown",Task%,!b%
  327QUIT
  328
  329REM Yamaha TX81Z-specific stuff (not used)
  330
  331REM DEF PROCPerf(Chan%)
  332REM LOCAL C%,T%:C%=Chan% AND 7
  333REM REPEAT V%=RND(160)-1:UNTIL V%<136 OR V%>149
  334REM PROCPAR(0,12*C%+1,V%>>7)
  335REM PROCPAR(0,12*C%+2,V% AND 127)
  336REM ENDPROC
  337REM  
  338REM DEF PROCPAR(S%,P%,D%)
  339REM PROCM(&F0):PROCM(&43):PROCM(&10)
  340REM PROCM(&10+S%):PROCM(P%):PROCM(D%)
  341REM PROCM(&F7)
  342REM ENDPROC
  343REM  
  344REM DEF PROCM(A%)      :REM Send A% to MIDI
  345REM SYS "MIDI_TxByte",A%
  346REM ENDPROC
� > Riff

9� This program is Copyright 1994 Denis Howe.  You may
<� distribute verbatim or modified copies of this program
=� provided each such copy is distributed with a copyright
<� notice and distribution conditions identical to these.

.� Please send me a copy of any changes you
	1� make and add the details to the list below.


#� Denis Howe <dbh@doc.ic.ac.uk>
$� 48 Anson Road, London, NW2 3UU

� +44 (181) 450 9448

?� 12 May 1992 0.00 Written by Denis Howe <dbh@doc.ic.ac.uk>
#� 14 Dec 1994 0.01 WIMP version

Task$="Riff"
#Purpose$="Random MIDI patterns"
Author$="� Denis Howe 1994"
!Version$="0.01 (14 Dec 1994)"

� � �Error

HSeed%=17                     :� Change this to get different "tunes"

Dummy%=�(-Seed%)
/BeatLength%=100+�(200)     :� Initial tempo
RhythmChannel%=-3

�WimpInit
�MajorMinor
 �New
!
�MidiInit
"�
#  � �(200)=1 �Reset
$  � �(5)=1 �Copy � �New
%"  Time%=�Time:StartTime%=Time%
&  � T%=0 � NT%-1
'-    � T% � 3 Velocity%=80 � Velocity%=120
(    � Chan%=0 � NChan%-1
)      � Pitch%(T%,Chan%) �
*"        �Note(Chan%,0,0,Time%)
+9        �Note(Chan%,Pitch%(T%,Chan%),Velocity%,Time%)
,      �
-    � Chan%
.    Time%+=BeatLength%
/
  � T%
0  �AllOff(Time%)
10  � �Wait:� �Time>StartTime%+NT%*BeatLength%
26  � �(10)=1 BeatLength%+=.1*BeatLength%*(�(2)-1.5)
3'  � BeatLength%<100 BeatLength%=100
4'  � BeatLength%>300 BeatLength%=300
5� �
6
7� �Set(T%,Chan%,P%)
8Pitch%(T%,Chan%)=P%
9�DrawNote(T%,Chan%)
:�
;
<� �Reset
=Pitch%()=0
>
�Force
?�
@
A?� ========================== WIMP =========================
B 
C� �WimpInit
D� b% 260:b%+=4
ENChan%=4
FLog2NT%=5:NT%=1<<Log2NT%
G� P%(6),UH%(11)
HD� Pitch%(NT%-1,NChan%-1),CurrentPitch%(NChan%-1),Swap%(NChan%-1)
IP%()=0,2,4,5,7,9,11
JFUH%()=0,1,1,0,0,0,1,0,0,0,1,1 :� unharmonius intervals (semitones)
K
LStartTime%=0:OldY%=-999
M
N9$b%="TASK":ș "Wimp_Initialise",200,!b%,Task$ �,Task%
O
P� Bar icon
Qb%!0=-1:b%!4=0:b%!8=0
R!b%!12=68:b%!16=68:b%!20=&3002
S$(b%+24)="!Riff"
Tș "Wimp_CreateIcon",,b%
U
V
� Menu
W� Menu% 100
X$Menu%=Task$
Y/Menu%?12=7:Menu%?13=2:Menu%?14=7:Menu%?15=0
Z'Menu%!16=100:Menu%!20=44:Menu%!24=0
[� Item 0
\Menu%!28=1<<7 :� last
]Menu%!32=-1
^%Menu%!36=1 � 1<<5 � 7<<24 � 0<<28
_$(Menu%+40)="Quit"
`
a� Window
bCharW%=16:CharH%=32
cChanW%=3*CharW%
dWinW%=ChanW%*NChan%+CharW%
eWinH%=CharH%*NT%+8
fTitle$=Task$+" "+� Seed%
g TitleW%=CharW%*�(Title$)+100
h!� TitleW%>WinW% WinW%=TitleW%
i1b%!0=9999:b%!4=-WinH%:b%!8=b%!0+WinW%:b%!12=0
j,b%!16=0:b%!20=0:b%!24=-1:b%!28=&FF000002
k#b%?32=7:b%?33=2:b%?34=7:b%?35=0
l$b%?36=3:b%?37=1:b%?38=12:b%?39=0
m,b%!40=0:b%!44=-WinH%:b%!48=WinW%:b%!52=0
n0b%!56=&07000039:b%!60=0:b%!64=1:b%!68=&10001
o$(b%+72)=Title$:b%!84=0
p$ș "Wimp_CreateWindow",,b% � WH%
q
b%!-4=WH%
rș "Wimp_OpenWindow",,b%-4
sT%=�+100:� �Wait:� �>T%
t�
u
v� �Poll
w� More%,R%,Y%
x$ș "Wimp_Poll",&FFF9FDBC,b% � R%
yȎ R% �
z� 0:�MoveCursor
{� 1
|(  ș "Wimp_RedrawWindow",,b% � More%
}*  WkOrX%=b%!4-b%!20:WkOrY%=b%!16-b%!24
~  ȕ More%
    �Redraw(WkOrX%,WkOrY%)
�*    ș "Wimp_GetRectangle",,b% � More%
�  �
� � 2:ș "Wimp_OpenWindow",,b%
�!� 3:ș "Wimp_CloseWindow",,b%
�� 6
�  Ȏ b%!8 �
�	  � 2
�*    � b%!12=-2 Y%=1*44+96 � Y%=b%!4+28
�.    ș "Wimp_CreateMenu",,Menu%,b%!0-64,Y%
�	  � 4
�,    !b%=WH%:ș "Wimp_GetWindowState",,b%
�    � b%!32 � 1<<16 �
�#      ș "Wimp_CloseWindow",,b%
�	    �
�"      ș "Wimp_OpenWindow",,b%
�	    �
�  �
�
� 9:�Quit
�� 17,18
�  Ȏ b%!16 �
�  � 0,8:�Quit
�9  � &400C2:� b%!4<>Task% � �String(b%+28)=Task$ �Quit
�  �
��
��
�
�� �DrawNote(T%,Chan%)
�� X%,Y%
�!X%=Chan%*ChanW%:Y%=-T%*CharH%
�Eș "Wimp_ForceRedraw",WH%,X%+CharW%,Y%-CharH%,X%+ChanW%+CharW%,Y%
��
�
�� �Force
�.ș "Wimp_ForceRedraw",WH%,0,-WinH%,WinW%,0
��
�
�� �MoveCursor
�� More%,Now%,X%,Y%,y%,oldy%
�Now%=�Time
�/Y%=(StartTime%-Now%)*CharH% � BeatLength%-8
�� �(Y%-OldY%)<4 �
�4b%!0=WH%:b%!4=0:b%!8=-WinH%:b%!12=CharW%:b%!16=0
�&ș "Wimp_UpdateWindow",,b% � More%
�<X%+=b%!4-b%!20:y%=Y%+b%!16-b%!24:oldy%=OldY%+b%!16-b%!24
�ȕ More%
�-  ș "Wimp_SetColour",0:� X%,oldy%:� "�";
�+  ș "Wimp_SetColour",11:� X%,y%:� "�";
�(  ș "Wimp_GetRectangle",,b% � More%
��
�OldY%=Y%
��
�
�� �Redraw(WkOrX%,WkOrY%)
�� Chan%,T%,P%
�� T%=0 � NT%-1
�  � Chan%=0 � NChan%-1
�7    � WkOrX%+Chan%*ChanW%+CharW%,WkOrY%-T%*CharH%-8
�    P%=Pitch%(T%,Chan%)
�8    � P% � �"CDEFGAB", P% � 7+1,1);P% � 7; � � "��";
�  �
��  
��
�
�?� ========================== MIDI =========================
�
�� �MidiInit
�ș "MIDI_Init"
�ș "MIDI_FastClock",1
��AllOffNow
��
�
�� �Time
�� T%
�ș "MIDI_FastClock",-1 �,T%
�=T%
�
�� �Wait
�� F%
��
�  �Poll
�$  ș "MIDI_InqBufferSize",1 � F%
�� F%
��
�
�� �Note(Chan%,P%,V%,Time%)
�� Command%
�>� V% CurrentPitch%(Chan%)=�P(P%) � P%=CurrentPitch%(Chan%)
�;Command%=&90 � Chan% � CurrentPitch%(Chan%)<<8 � V%<<16
�&ș "MIDI_TxCommand",Command%,Time%
��
�
�� �AllOff(Time%)
�� Chan%
�� Chan%=0 � NChan%-1
�  �Note(Chan%,0,0,Time%)
�� Chan%
��
�
�� �AllOffNow
�� Chan%
�AllOff%=&03007BB0
�� Chan%=0 � NChan%-1
�'  ș "MIDI_TxCommand",AllOff%+Chan%
��
��
�
�� �MajorMinor
�+� �<0 P%(2)=3:P%(5)=8 � P%(2)=4:P%(5)=9
��
� 
�
� �New
�� D%,T%,M%,P%,TT%,CC%,MP%
�Chan%=�(NChan%)-1
�$� Chan%=RhythmChannel% �Rhythm:�
�T%=�(NT%)-1
�1� Pitch%(T%,Chan%) � �>0 Pitch%(T%,Chan%)=0:�
�2� Round T% down to biggest silent power of two
�
M%=� 1
��
�  TT%=T% � M%
�2  � Pitch%(TT%,Chan%)=0 T%=TT%:M%=M%<<1 � M%=0
�� (NT% � M%)=0
�P%=�(15)+6:MP%=�P(P%)
�� CC%=0 � NChan%-1
�%  � CC%<>Chan% � Pitch%(T%,CC%) �
�$    D%=�(MP%-�P(Pitch%(T%,CC%)))
�    � UH%(D% � 12) �
�  �
�
�Set(T%,Chan%,P%)
�


� �Rhythm
� D%,T%,P%
D%=1<<(�(Log2NT%+1)-1)
T%=�(NT%)-1
P%=�(22)+6
	
ȕ T%<NT%

   �Set(T%,RhythmChannel%,P%)
  T%+=D%
�

�

� �Copy
� C%,CC%,P%

P%=�>0
� C%=0 � NChan%-1
  � P% �
	    �
      Swap%(C%)=�(NChan%)-1
1      CC%=0:ȕ Swap%(CC%)<>Swap%(C%) CC%+=1:�
    � CC%=C%
  �
    Swap%(C%)=C%
  �
�
LS%=1<<�(�(NT%-1)/�2-1)
(� LS%*4<NT%-1 LD%=�(3)*LS% � LD%=LS%
TS%=(�(NT%/LS%)-1)*LS%
TD%=(�(NT%/LD%)-1)*LD%
 PS%=�(7)-1:DS%=�(3)-2
!� T%=0 � LD%-1
"&  � TD%+T%<TS% � TD%+T%>=TS%+LS% �
#    � C%=0 � NChan%-1
$%      P%=Pitch%(TS%+T% � LS%, C%)
%      � P% �
&"        P%+=PS%+DS%*(T% � LS%)
'        ȕ P%>28 P%-=7:�
(      �
)+      �Set((TD%+T%) � NT%,Swap%(C%),P%)
*	    �
+  �
,�
-�
.
/&� �P(P%)=12*(P% � 7)+P%(P% � 7)+36
0
1?� ========================== Misc =========================
2
3� �String(S%)
4� P%:P%=S%
5ȕ ?P%>�" ":P%+=1:�
6
$P%=""
7=$S%
8
9� �Error
:	� � �
;�AllOffNow
<� �<>0 � �<>17 �
=   !b%=�:$(b%+4)=�$+" @ "+� �
>&  ș"Wimp_ReportError",b%,1,"Riff"
?�
@	�Quit
A�
B
C� �Quit
D
�MidiInit
E!ș "MIDI_FastClock",0 :� Stop
F+$b%="TASK":ș"Wimp_CloseDown",Task%,!b%
GȘ
H
I,� Yamaha TX81Z-specific stuff (not used)
J
K� DEF PROCPerf(Chan%)
L � LOCAL C%,T%:C%=Chan% AND 7
M1� REPEAT V%=RND(160)-1:UNTIL V%<136 OR V%>149
N� PROCPAR(0,12*C%+1,V%>>7)
O#� PROCPAR(0,12*C%+2,V% AND 127)
P
� ENDPROC
Q�  
R� DEF PROCPAR(S%,P%,D%)
S&� PROCM(&F0):PROCM(&43):PROCM(&10)
T'� PROCM(&10+S%):PROCM(P%):PROCM(D%)
U� PROCM(&F7)
V
� ENDPROC
W�  
X-� DEF PROCM(A%)      :REM Send A% to MIDI
Y� SYS "MIDI_TxByte",A%
Z
� ENDPROC
�
00000000  0d 00 01 0c f4 20 3e 20  52 69 66 66 0d 00 02 04  |..... > Riff....|
00000010  0d 00 03 39 f4 20 54 68  69 73 20 70 72 6f 67 72  |...9. This progr|
00000020  61 6d 20 69 73 20 43 6f  70 79 72 69 67 68 74 20  |am is Copyright |
00000030  31 39 39 34 20 44 65 6e  69 73 20 48 6f 77 65 2e  |1994 Denis Howe.|
00000040  20 20 59 6f 75 20 6d 61  79 0d 00 04 3c f4 20 64  |  You may...<. d|
00000050  69 73 74 72 69 62 75 74  65 20 76 65 72 62 61 74  |istribute verbat|
00000060  69 6d 20 6f 72 20 6d 6f  64 69 66 69 65 64 20 63  |im or modified c|
00000070  6f 70 69 65 73 20 6f 66  20 74 68 69 73 20 70 72  |opies of this pr|
00000080  6f 67 72 61 6d 0d 00 05  3d f4 20 70 72 6f 76 69  |ogram...=. provi|
00000090  64 65 64 20 65 61 63 68  20 73 75 63 68 20 63 6f  |ded each such co|
000000a0  70 79 20 69 73 20 64 69  73 74 72 69 62 75 74 65  |py is distribute|
000000b0  64 20 77 69 74 68 20 61  20 63 6f 70 79 72 69 67  |d with a copyrig|
000000c0  68 74 0d 00 06 3c f4 20  6e 6f 74 69 63 65 20 61  |ht...<. notice a|
000000d0  6e 64 20 64 69 73 74 72  69 62 75 74 69 6f 6e 20  |nd distribution |
000000e0  63 6f 6e 64 69 74 69 6f  6e 73 20 69 64 65 6e 74  |conditions ident|
000000f0  69 63 61 6c 20 74 6f 20  74 68 65 73 65 2e 0d 00  |ical to these...|
00000100  07 04 0d 00 08 2e f4 20  50 6c 65 61 73 65 20 73  |....... Please s|
00000110  65 6e 64 20 6d 65 20 61  20 63 6f 70 79 20 6f 66  |end me a copy of|
00000120  20 61 6e 79 20 63 68 61  6e 67 65 73 20 79 6f 75  | any changes you|
00000130  0d 00 09 31 f4 20 6d 61  6b 65 20 61 6e 64 20 61  |...1. make and a|
00000140  64 64 20 74 68 65 20 64  65 74 61 69 6c 73 20 74  |dd the details t|
00000150  6f 20 74 68 65 20 6c 69  73 74 20 62 65 6c 6f 77  |o the list below|
00000160  2e 0d 00 0a 04 0d 00 0b  23 f4 20 44 65 6e 69 73  |........#. Denis|
00000170  20 48 6f 77 65 20 3c 64  62 68 40 64 6f 63 2e 69  | Howe <dbh@doc.i|
00000180  63 2e 61 63 2e 75 6b 3e  0d 00 0c 24 f4 20 34 38  |c.ac.uk>...$. 48|
00000190  20 41 6e 73 6f 6e 20 52  6f 61 64 2c 20 4c 6f 6e  | Anson Road, Lon|
000001a0  64 6f 6e 2c 20 4e 57 32  20 33 55 55 0d 00 0d 18  |don, NW2 3UU....|
000001b0  f4 20 2b 34 34 20 28 31  38 31 29 20 34 35 30 20  |. +44 (181) 450 |
000001c0  39 34 34 38 0d 00 0e 04  0d 00 0f 3f f4 20 31 32  |9448.......?. 12|
000001d0  20 4d 61 79 20 31 39 39  32 20 30 2e 30 30 20 57  | May 1992 0.00 W|
000001e0  72 69 74 74 65 6e 20 62  79 20 44 65 6e 69 73 20  |ritten by Denis |
000001f0  48 6f 77 65 20 3c 64 62  68 40 64 6f 63 2e 69 63  |Howe <dbh@doc.ic|
00000200  2e 61 63 2e 75 6b 3e 0d  00 10 23 f4 20 31 34 20  |.ac.uk>...#. 14 |
00000210  44 65 63 20 31 39 39 34  20 30 2e 30 31 20 57 49  |Dec 1994 0.01 WI|
00000220  4d 50 20 76 65 72 73 69  6f 6e 0d 00 11 04 0d 00  |MP version......|
00000230  12 10 54 61 73 6b 24 3d  22 52 69 66 66 22 0d 00  |..Task$="Riff"..|
00000240  13 23 50 75 72 70 6f 73  65 24 3d 22 52 61 6e 64  |.#Purpose$="Rand|
00000250  6f 6d 20 4d 49 44 49 20  70 61 74 74 65 72 6e 73  |om MIDI patterns|
00000260  22 0d 00 14 1f 41 75 74  68 6f 72 24 3d 22 a9 20  |"....Author$=". |
00000270  44 65 6e 69 73 20 48 6f  77 65 20 31 39 39 34 22  |Denis Howe 1994"|
00000280  0d 00 15 21 56 65 72 73  69 6f 6e 24 3d 22 30 2e  |...!Version$="0.|
00000290  30 31 20 28 31 34 20 44  65 63 20 31 39 39 34 29  |01 (14 Dec 1994)|
000002a0  22 0d 00 16 04 0d 00 17  0e ee 20 85 20 f2 45 72  |"......... . .Er|
000002b0  72 6f 72 0d 00 18 04 0d  00 19 48 53 65 65 64 25  |ror.......HSeed%|
000002c0  3d 31 37 20 20 20 20 20  20 20 20 20 20 20 20 20  |=17             |
000002d0  20 20 20 20 20 20 20 20  3a f4 20 43 68 61 6e 67  |        :. Chang|
000002e0  65 20 74 68 69 73 20 74  6f 20 67 65 74 20 64 69  |e this to get di|
000002f0  66 66 65 72 65 6e 74 20  22 74 75 6e 65 73 22 0d  |fferent "tunes".|
00000300  00 1a 04 0d 00 1b 14 44  75 6d 6d 79 25 3d b3 28  |.......Dummy%=.(|
00000310  2d 53 65 65 64 25 29 0d  00 1c 2f 42 65 61 74 4c  |-Seed%).../BeatL|
00000320  65 6e 67 74 68 25 3d 31  30 30 2b b3 28 32 30 30  |ength%=100+.(200|
00000330  29 20 20 20 20 20 3a f4  20 49 6e 69 74 69 61 6c  |)     :. Initial|
00000340  20 74 65 6d 70 6f 0d 00  1d 15 52 68 79 74 68 6d  | tempo....Rhythm|
00000350  43 68 61 6e 6e 65 6c 25  3d 2d 33 0d 00 1e 0d f2  |Channel%=-3.....|
00000360  57 69 6d 70 49 6e 69 74  0d 00 1f 0f f2 4d 61 6a  |WimpInit.....Maj|
00000370  6f 72 4d 69 6e 6f 72 0d  00 20 08 f2 4e 65 77 0d  |orMinor.. ..New.|
00000380  00 21 0d f2 4d 69 64 69  49 6e 69 74 0d 00 22 05  |.!..MidiInit..".|
00000390  f5 0d 00 23 17 20 20 e7  20 b3 28 32 30 30 29 3d  |...#.  . .(200)=|
000003a0  31 20 f2 52 65 73 65 74  0d 00 24 1b 20 20 e7 20  |1 .Reset..$.  . |
000003b0  b3 28 35 29 3d 31 20 f2  43 6f 70 79 20 8b 20 f2  |.(5)=1 .Copy . .|
000003c0  4e 65 77 0d 00 25 22 20  20 54 69 6d 65 25 3d a4  |New..%"  Time%=.|
000003d0  54 69 6d 65 3a 53 74 61  72 74 54 69 6d 65 25 3d  |Time:StartTime%=|
000003e0  54 69 6d 65 25 0d 00 26  14 20 20 e3 20 54 25 3d  |Time%..&.  . T%=|
000003f0  30 20 b8 20 4e 54 25 2d  31 0d 00 27 2d 20 20 20  |0 . NT%-1..'-   |
00000400  20 e7 20 54 25 20 80 20  33 20 56 65 6c 6f 63 69  | . T% . 3 Veloci|
00000410  74 79 25 3d 38 30 20 8b  20 56 65 6c 6f 63 69 74  |ty%=80 . Velocit|
00000420  79 25 3d 31 32 30 0d 00  28 1c 20 20 20 20 e3 20  |y%=120..(.    . |
00000430  43 68 61 6e 25 3d 30 20  b8 20 4e 43 68 61 6e 25  |Chan%=0 . NChan%|
00000440  2d 31 0d 00 29 1e 20 20  20 20 20 20 e7 20 50 69  |-1..).      . Pi|
00000450  74 63 68 25 28 54 25 2c  43 68 61 6e 25 29 20 8c  |tch%(T%,Chan%) .|
00000460  0d 00 2a 22 20 20 20 20  20 20 20 20 f2 4e 6f 74  |..*"        .Not|
00000470  65 28 43 68 61 6e 25 2c  30 2c 30 2c 54 69 6d 65  |e(Chan%,0,0,Time|
00000480  25 29 0d 00 2b 39 20 20  20 20 20 20 20 20 f2 4e  |%)..+9        .N|
00000490  6f 74 65 28 43 68 61 6e  25 2c 50 69 74 63 68 25  |ote(Chan%,Pitch%|
000004a0  28 54 25 2c 43 68 61 6e  25 29 2c 56 65 6c 6f 63  |(T%,Chan%),Veloc|
000004b0  69 74 79 25 2c 54 69 6d  65 25 29 0d 00 2c 0b 20  |ity%,Time%)..,. |
000004c0  20 20 20 20 20 cd 0d 00  2d 0f 20 20 20 20 ed 20  |     ...-.    . |
000004d0  43 68 61 6e 25 0d 00 2e  1a 20 20 20 20 54 69 6d  |Chan%....    Tim|
000004e0  65 25 2b 3d 42 65 61 74  4c 65 6e 67 74 68 25 0d  |e%+=BeatLength%.|
000004f0  00 2f 0a 20 20 ed 20 54  25 0d 00 30 14 20 20 f2  |./.  . T%..0.  .|
00000500  41 6c 6c 4f 66 66 28 54  69 6d 65 25 29 0d 00 31  |AllOff(Time%)..1|
00000510  30 20 20 f5 20 f2 57 61  69 74 3a fd 20 a4 54 69  |0  . .Wait:. .Ti|
00000520  6d 65 3e 53 74 61 72 74  54 69 6d 65 25 2b 4e 54  |me>StartTime%+NT|
00000530  25 2a 42 65 61 74 4c 65  6e 67 74 68 25 0d 00 32  |%*BeatLength%..2|
00000540  36 20 20 e7 20 b3 28 31  30 29 3d 31 20 42 65 61  |6  . .(10)=1 Bea|
00000550  74 4c 65 6e 67 74 68 25  2b 3d 2e 31 2a 42 65 61  |tLength%+=.1*Bea|
00000560  74 4c 65 6e 67 74 68 25  2a 28 b3 28 32 29 2d 31  |tLength%*(.(2)-1|
00000570  2e 35 29 0d 00 33 27 20  20 e7 20 42 65 61 74 4c  |.5)..3'  . BeatL|
00000580  65 6e 67 74 68 25 3c 31  30 30 20 42 65 61 74 4c  |ength%<100 BeatL|
00000590  65 6e 67 74 68 25 3d 31  30 30 0d 00 34 27 20 20  |ength%=100..4'  |
000005a0  e7 20 42 65 61 74 4c 65  6e 67 74 68 25 3e 33 30  |. BeatLength%>30|
000005b0  30 20 42 65 61 74 4c 65  6e 67 74 68 25 3d 33 30  |0 BeatLength%=30|
000005c0  30 0d 00 35 07 fd 20 a3  0d 00 36 04 0d 00 37 17  |0..5.. ...6...7.|
000005d0  dd 20 f2 53 65 74 28 54  25 2c 43 68 61 6e 25 2c  |. .Set(T%,Chan%,|
000005e0  50 25 29 0d 00 38 17 50  69 74 63 68 25 28 54 25  |P%)..8.Pitch%(T%|
000005f0  2c 43 68 61 6e 25 29 3d  50 25 0d 00 39 17 f2 44  |,Chan%)=P%..9..D|
00000600  72 61 77 4e 6f 74 65 28  54 25 2c 43 68 61 6e 25  |rawNote(T%,Chan%|
00000610  29 0d 00 3a 05 e1 0d 00  3b 04 0d 00 3c 0c dd 20  |)..:....;...<.. |
00000620  f2 52 65 73 65 74 0d 00  3d 0e 50 69 74 63 68 25  |.Reset..=.Pitch%|
00000630  28 29 3d 30 0d 00 3e 0a  f2 46 6f 72 63 65 0d 00  |()=0..>..Force..|
00000640  3f 05 e1 0d 00 40 04 0d  00 41 3f f4 20 3d 3d 3d  |?....@...A?. ===|
00000650  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000660  3d 3d 3d 3d 3d 3d 3d 20  57 49 4d 50 20 3d 3d 3d  |======= WIMP ===|
00000670  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00000680  3d 3d 3d 3d 3d 3d 0d 00  42 05 20 0d 00 43 0f dd  |======..B. ..C..|
00000690  20 f2 57 69 6d 70 49 6e  69 74 0d 00 44 12 de 20  | .WimpInit..D.. |
000006a0  62 25 20 32 36 30 3a 62  25 2b 3d 34 0d 00 45 0c  |b% 260:b%+=4..E.|
000006b0  4e 43 68 61 6e 25 3d 34  0d 00 46 1c 4c 6f 67 32  |NChan%=4..F.Log2|
000006c0  4e 54 25 3d 35 3a 4e 54  25 3d 31 3c 3c 4c 6f 67  |NT%=5:NT%=1<<Log|
000006d0  32 4e 54 25 0d 00 47 13  de 20 50 25 28 36 29 2c  |2NT%..G.. P%(6),|
000006e0  55 48 25 28 31 31 29 0d  00 48 44 de 20 50 69 74  |UH%(11)..HD. Pit|
000006f0  63 68 25 28 4e 54 25 2d  31 2c 4e 43 68 61 6e 25  |ch%(NT%-1,NChan%|
00000700  2d 31 29 2c 43 75 72 72  65 6e 74 50 69 74 63 68  |-1),CurrentPitch|
00000710  25 28 4e 43 68 61 6e 25  2d 31 29 2c 53 77 61 70  |%(NChan%-1),Swap|
00000720  25 28 4e 43 68 61 6e 25  2d 31 29 0d 00 49 17 50  |%(NChan%-1)..I.P|
00000730  25 28 29 3d 30 2c 32 2c  34 2c 35 2c 37 2c 39 2c  |%()=0,2,4,5,7,9,|
00000740  31 31 0d 00 4a 46 55 48  25 28 29 3d 30 2c 31 2c  |11..JFUH%()=0,1,|
00000750  31 2c 30 2c 30 2c 30 2c  31 2c 30 2c 30 2c 30 2c  |1,0,0,0,1,0,0,0,|
00000760  31 2c 31 20 3a f4 20 75  6e 68 61 72 6d 6f 6e 69  |1,1 :. unharmoni|
00000770  75 73 20 69 6e 74 65 72  76 61 6c 73 20 28 73 65  |us intervals (se|
00000780  6d 69 74 6f 6e 65 73 29  0d 00 4b 04 0d 00 4c 1b  |mitones)..K...L.|
00000790  53 74 61 72 74 54 69 6d  65 25 3d 30 3a 4f 6c 64  |StartTime%=0:Old|
000007a0  59 25 3d 2d 39 39 39 0d  00 4d 04 0d 00 4e 39 24  |Y%=-999..M...N9$|
000007b0  62 25 3d 22 54 41 53 4b  22 3a c8 99 20 22 57 69  |b%="TASK":.. "Wi|
000007c0  6d 70 5f 49 6e 69 74 69  61 6c 69 73 65 22 2c 32  |mp_Initialise",2|
000007d0  30 30 2c 21 62 25 2c 54  61 73 6b 24 20 b8 2c 54  |00,!b%,Task$ .,T|
000007e0  61 73 6b 25 0d 00 4f 04  0d 00 50 0e f4 20 42 61  |ask%..O...P.. Ba|
000007f0  72 20 69 63 6f 6e 0d 00  51 19 62 25 21 30 3d 2d  |r icon..Q.b%!0=-|
00000800  31 3a 62 25 21 34 3d 30  3a 62 25 21 38 3d 30 0d  |1:b%!4=0:b%!8=0.|
00000810  00 52 21 62 25 21 31 32  3d 36 38 3a 62 25 21 31  |.R!b%!12=68:b%!1|
00000820  36 3d 36 38 3a 62 25 21  32 30 3d 26 33 30 30 32  |6=68:b%!20=&3002|
00000830  0d 00 53 14 24 28 62 25  2b 32 34 29 3d 22 21 52  |..S.$(b%+24)="!R|
00000840  69 66 66 22 0d 00 54 1c  c8 99 20 22 57 69 6d 70  |iff"..T... "Wimp|
00000850  5f 43 72 65 61 74 65 49  63 6f 6e 22 2c 2c 62 25  |_CreateIcon",,b%|
00000860  0d 00 55 04 0d 00 56 0a  f4 20 4d 65 6e 75 0d 00  |..U...V.. Menu..|
00000870  57 0f de 20 4d 65 6e 75  25 20 31 30 30 0d 00 58  |W.. Menu% 100..X|
00000880  10 24 4d 65 6e 75 25 3d  54 61 73 6b 24 0d 00 59  |.$Menu%=Task$..Y|
00000890  2f 4d 65 6e 75 25 3f 31  32 3d 37 3a 4d 65 6e 75  |/Menu%?12=7:Menu|
000008a0  25 3f 31 33 3d 32 3a 4d  65 6e 75 25 3f 31 34 3d  |%?13=2:Menu%?14=|
000008b0  37 3a 4d 65 6e 75 25 3f  31 35 3d 30 0d 00 5a 27  |7:Menu%?15=0..Z'|
000008c0  4d 65 6e 75 25 21 31 36  3d 31 30 30 3a 4d 65 6e  |Menu%!16=100:Men|
000008d0  75 25 21 32 30 3d 34 34  3a 4d 65 6e 75 25 21 32  |u%!20=44:Menu%!2|
000008e0  34 3d 30 0d 00 5b 0c f4  20 49 74 65 6d 20 30 0d  |4=0..[.. Item 0.|
000008f0  00 5c 19 4d 65 6e 75 25  21 32 38 3d 31 3c 3c 37  |.\.Menu%!28=1<<7|
00000900  20 3a f4 20 6c 61 73 74  0d 00 5d 0f 4d 65 6e 75  | :. last..].Menu|
00000910  25 21 33 32 3d 2d 31 0d  00 5e 25 4d 65 6e 75 25  |%!32=-1..^%Menu%|
00000920  21 33 36 3d 31 20 84 20  31 3c 3c 35 20 84 20 37  |!36=1 . 1<<5 . 7|
00000930  3c 3c 32 34 20 84 20 30  3c 3c 32 38 0d 00 5f 16  |<<24 . 0<<28.._.|
00000940  24 28 4d 65 6e 75 25 2b  34 30 29 3d 22 51 75 69  |$(Menu%+40)="Qui|
00000950  74 22 0d 00 60 04 0d 00  61 0c f4 20 57 69 6e 64  |t"..`...a.. Wind|
00000960  6f 77 0d 00 62 17 43 68  61 72 57 25 3d 31 36 3a  |ow..b.CharW%=16:|
00000970  43 68 61 72 48 25 3d 33  32 0d 00 63 13 43 68 61  |CharH%=32..c.Cha|
00000980  6e 57 25 3d 33 2a 43 68  61 72 57 25 0d 00 64 1e  |nW%=3*CharW%..d.|
00000990  57 69 6e 57 25 3d 43 68  61 6e 57 25 2a 4e 43 68  |WinW%=ChanW%*NCh|
000009a0  61 6e 25 2b 43 68 61 72  57 25 0d 00 65 16 57 69  |an%+CharW%..e.Wi|
000009b0  6e 48 25 3d 43 68 61 72  48 25 2a 4e 54 25 2b 38  |nH%=CharH%*NT%+8|
000009c0  0d 00 66 1c 54 69 74 6c  65 24 3d 54 61 73 6b 24  |..f.Title$=Task$|
000009d0  2b 22 20 22 2b c3 20 53  65 65 64 25 0d 00 67 20  |+" "+. Seed%..g |
000009e0  54 69 74 6c 65 57 25 3d  43 68 61 72 57 25 2a a9  |TitleW%=CharW%*.|
000009f0  28 54 69 74 6c 65 24 29  2b 31 30 30 0d 00 68 21  |(Title$)+100..h!|
00000a00  e7 20 54 69 74 6c 65 57  25 3e 57 69 6e 57 25 20  |. TitleW%>WinW% |
00000a10  57 69 6e 57 25 3d 54 69  74 6c 65 57 25 0d 00 69  |WinW%=TitleW%..i|
00000a20  31 62 25 21 30 3d 39 39  39 39 3a 62 25 21 34 3d  |1b%!0=9999:b%!4=|
00000a30  2d 57 69 6e 48 25 3a 62  25 21 38 3d 62 25 21 30  |-WinH%:b%!8=b%!0|
00000a40  2b 57 69 6e 57 25 3a 62  25 21 31 32 3d 30 0d 00  |+WinW%:b%!12=0..|
00000a50  6a 2c 62 25 21 31 36 3d  30 3a 62 25 21 32 30 3d  |j,b%!16=0:b%!20=|
00000a60  30 3a 62 25 21 32 34 3d  2d 31 3a 62 25 21 32 38  |0:b%!24=-1:b%!28|
00000a70  3d 26 46 46 30 30 30 30  30 32 0d 00 6b 23 62 25  |=&FF000002..k#b%|
00000a80  3f 33 32 3d 37 3a 62 25  3f 33 33 3d 32 3a 62 25  |?32=7:b%?33=2:b%|
00000a90  3f 33 34 3d 37 3a 62 25  3f 33 35 3d 30 0d 00 6c  |?34=7:b%?35=0..l|
00000aa0  24 62 25 3f 33 36 3d 33  3a 62 25 3f 33 37 3d 31  |$b%?36=3:b%?37=1|
00000ab0  3a 62 25 3f 33 38 3d 31  32 3a 62 25 3f 33 39 3d  |:b%?38=12:b%?39=|
00000ac0  30 0d 00 6d 2c 62 25 21  34 30 3d 30 3a 62 25 21  |0..m,b%!40=0:b%!|
00000ad0  34 34 3d 2d 57 69 6e 48  25 3a 62 25 21 34 38 3d  |44=-WinH%:b%!48=|
00000ae0  57 69 6e 57 25 3a 62 25  21 35 32 3d 30 0d 00 6e  |WinW%:b%!52=0..n|
00000af0  30 62 25 21 35 36 3d 26  30 37 30 30 30 30 33 39  |0b%!56=&07000039|
00000b00  3a 62 25 21 36 30 3d 30  3a 62 25 21 36 34 3d 31  |:b%!60=0:b%!64=1|
00000b10  3a 62 25 21 36 38 3d 26  31 30 30 30 31 0d 00 6f  |:b%!68=&10001..o|
00000b20  1b 24 28 62 25 2b 37 32  29 3d 54 69 74 6c 65 24  |.$(b%+72)=Title$|
00000b30  3a 62 25 21 38 34 3d 30  0d 00 70 24 c8 99 20 22  |:b%!84=0..p$.. "|
00000b40  57 69 6d 70 5f 43 72 65  61 74 65 57 69 6e 64 6f  |Wimp_CreateWindo|
00000b50  77 22 2c 2c 62 25 20 b8  20 57 48 25 0d 00 71 0d  |w",,b% . WH%..q.|
00000b60  62 25 21 2d 34 3d 57 48  25 0d 00 72 1e c8 99 20  |b%!-4=WH%..r... |
00000b70  22 57 69 6d 70 5f 4f 70  65 6e 57 69 6e 64 6f 77  |"Wimp_OpenWindow|
00000b80  22 2c 2c 62 25 2d 34 0d  00 73 1b 54 25 3d 91 2b  |",,b%-4..s.T%=.+|
00000b90  31 30 30 3a f5 20 f2 57  61 69 74 3a fd 20 91 3e  |100:. .Wait:. .>|
00000ba0  54 25 0d 00 74 05 e1 0d  00 75 04 0d 00 76 0b dd  |T%..t....u...v..|
00000bb0  20 f2 50 6f 6c 6c 0d 00  77 11 ea 20 4d 6f 72 65  | .Poll..w.. More|
00000bc0  25 2c 52 25 2c 59 25 0d  00 78 24 c8 99 20 22 57  |%,R%,Y%..x$.. "W|
00000bd0  69 6d 70 5f 50 6f 6c 6c  22 2c 26 46 46 46 39 46  |imp_Poll",&FFF9F|
00000be0  44 42 43 2c 62 25 20 b8  20 52 25 0d 00 79 0b c8  |DBC,b% . R%..y..|
00000bf0  8e 20 52 25 20 ca 0d 00  7a 13 c9 20 30 3a f2 4d  |. R% ...z.. 0:.M|
00000c00  6f 76 65 43 75 72 73 6f  72 0d 00 7b 07 c9 20 31  |oveCursor..{.. 1|
00000c10  0d 00 7c 28 20 20 c8 99  20 22 57 69 6d 70 5f 52  |..|(  .. "Wimp_R|
00000c20  65 64 72 61 77 57 69 6e  64 6f 77 22 2c 2c 62 25  |edrawWindow",,b%|
00000c30  20 b8 20 4d 6f 72 65 25  0d 00 7d 2a 20 20 57 6b  | . More%..}*  Wk|
00000c40  4f 72 58 25 3d 62 25 21  34 2d 62 25 21 32 30 3a  |OrX%=b%!4-b%!20:|
00000c50  57 6b 4f 72 59 25 3d 62  25 21 31 36 2d 62 25 21  |WkOrY%=b%!16-b%!|
00000c60  32 34 0d 00 7e 0e 20 20  c8 95 20 4d 6f 72 65 25  |24..~.  .. More%|
00000c70  0d 00 7f 1e 20 20 20 20  f2 52 65 64 72 61 77 28  |....    .Redraw(|
00000c80  57 6b 4f 72 58 25 2c 57  6b 4f 72 59 25 29 0d 00  |WkOrX%,WkOrY%)..|
00000c90  80 2a 20 20 20 20 c8 99  20 22 57 69 6d 70 5f 47  |.*    .. "Wimp_G|
00000ca0  65 74 52 65 63 74 61 6e  67 6c 65 22 2c 2c 62 25  |etRectangle",,b%|
00000cb0  20 b8 20 4d 6f 72 65 25  0d 00 81 07 20 20 ce 0d  | . More%....  ..|
00000cc0  00 82 20 c9 20 32 3a c8  99 20 22 57 69 6d 70 5f  |.. . 2:.. "Wimp_|
00000cd0  4f 70 65 6e 57 69 6e 64  6f 77 22 2c 2c 62 25 0d  |OpenWindow",,b%.|
00000ce0  00 83 21 c9 20 33 3a c8  99 20 22 57 69 6d 70 5f  |..!. 3:.. "Wimp_|
00000cf0  43 6c 6f 73 65 57 69 6e  64 6f 77 22 2c 2c 62 25  |CloseWindow",,b%|
00000d00  0d 00 84 07 c9 20 36 0d  00 85 0f 20 20 c8 8e 20  |..... 6....  .. |
00000d10  62 25 21 38 20 ca 0d 00  86 09 20 20 c9 20 32 0d  |b%!8 .....  . 2.|
00000d20  00 87 2a 20 20 20 20 e7  20 62 25 21 31 32 3d 2d  |..*    . b%!12=-|
00000d30  32 20 59 25 3d 31 2a 34  34 2b 39 36 20 8b 20 59  |2 Y%=1*44+96 . Y|
00000d40  25 3d 62 25 21 34 2b 32  38 0d 00 88 2e 20 20 20  |%=b%!4+28....   |
00000d50  20 c8 99 20 22 57 69 6d  70 5f 43 72 65 61 74 65  | .. "Wimp_Create|
00000d60  4d 65 6e 75 22 2c 2c 4d  65 6e 75 25 2c 62 25 21  |Menu",,Menu%,b%!|
00000d70  30 2d 36 34 2c 59 25 0d  00 89 09 20 20 c9 20 34  |0-64,Y%....  . 4|
00000d80  0d 00 8a 2c 20 20 20 20  21 62 25 3d 57 48 25 3a  |...,    !b%=WH%:|
00000d90  c8 99 20 22 57 69 6d 70  5f 47 65 74 57 69 6e 64  |.. "Wimp_GetWind|
00000da0  6f 77 53 74 61 74 65 22  2c 2c 62 25 0d 00 8b 19  |owState",,b%....|
00000db0  20 20 20 20 e7 20 62 25  21 33 32 20 80 20 31 3c  |    . b%!32 . 1<|
00000dc0  3c 31 36 20 8c 0d 00 8c  23 20 20 20 20 20 20 c8  |<16 ....#      .|
00000dd0  99 20 22 57 69 6d 70 5f  43 6c 6f 73 65 57 69 6e  |. "Wimp_CloseWin|
00000de0  64 6f 77 22 2c 2c 62 25  0d 00 8d 09 20 20 20 20  |dow",,b%....    |
00000df0  cc 0d 00 8e 22 20 20 20  20 20 20 c8 99 20 22 57  |...."      .. "W|
00000e00  69 6d 70 5f 4f 70 65 6e  57 69 6e 64 6f 77 22 2c  |imp_OpenWindow",|
00000e10  2c 62 25 0d 00 8f 09 20  20 20 20 cd 0d 00 90 07  |,b%....    .....|
00000e20  20 20 cb 0d 00 91 0d c9  20 39 3a f2 51 75 69 74  |  ...... 9:.Quit|
00000e30  0d 00 92 0b c9 20 31 37  2c 31 38 0d 00 93 10 20  |..... 17,18.... |
00000e40  20 c8 8e 20 62 25 21 31  36 20 ca 0d 00 94 11 20  | .. b%!16 ..... |
00000e50  20 c9 20 30 2c 38 3a f2  51 75 69 74 0d 00 95 39  | . 0,8:.Quit...9|
00000e60  20 20 c9 20 26 34 30 30  43 32 3a e7 20 62 25 21  |  . &400C2:. b%!|
00000e70  34 3c 3e 54 61 73 6b 25  20 80 20 a4 53 74 72 69  |4<>Task% . .Stri|
00000e80  6e 67 28 62 25 2b 32 38  29 3d 54 61 73 6b 24 20  |ng(b%+28)=Task$ |
00000e90  f2 51 75 69 74 0d 00 96  07 20 20 cb 0d 00 97 05  |.Quit....  .....|
00000ea0  cb 0d 00 98 05 e1 0d 00  99 04 0d 00 9a 19 dd 20  |............... |
00000eb0  f2 44 72 61 77 4e 6f 74  65 28 54 25 2c 43 68 61  |.DrawNote(T%,Cha|
00000ec0  6e 25 29 0d 00 9b 0b ea  20 58 25 2c 59 25 0d 00  |n%)..... X%,Y%..|
00000ed0  9c 21 58 25 3d 43 68 61  6e 25 2a 43 68 61 6e 57  |.!X%=Chan%*ChanW|
00000ee0  25 3a 59 25 3d 2d 54 25  2a 43 68 61 72 48 25 0d  |%:Y%=-T%*CharH%.|
00000ef0  00 9d 45 c8 99 20 22 57  69 6d 70 5f 46 6f 72 63  |..E.. "Wimp_Forc|
00000f00  65 52 65 64 72 61 77 22  2c 57 48 25 2c 58 25 2b  |eRedraw",WH%,X%+|
00000f10  43 68 61 72 57 25 2c 59  25 2d 43 68 61 72 48 25  |CharW%,Y%-CharH%|
00000f20  2c 58 25 2b 43 68 61 6e  57 25 2b 43 68 61 72 57  |,X%+ChanW%+CharW|
00000f30  25 2c 59 25 0d 00 9e 05  e1 0d 00 9f 04 0d 00 a0  |%,Y%............|
00000f40  0c dd 20 f2 46 6f 72 63  65 0d 00 a1 2e c8 99 20  |.. .Force...... |
00000f50  22 57 69 6d 70 5f 46 6f  72 63 65 52 65 64 72 61  |"Wimp_ForceRedra|
00000f60  77 22 2c 57 48 25 2c 30  2c 2d 57 69 6e 48 25 2c  |w",WH%,0,-WinH%,|
00000f70  57 69 6e 57 25 2c 30 0d  00 a2 05 e1 0d 00 a3 04  |WinW%,0.........|
00000f80  0d 00 a4 11 dd 20 f2 4d  6f 76 65 43 75 72 73 6f  |..... .MoveCurso|
00000f90  72 0d 00 a5 1f ea 20 4d  6f 72 65 25 2c 4e 6f 77  |r..... More%,Now|
00000fa0  25 2c 58 25 2c 59 25 2c  79 25 2c 6f 6c 64 79 25  |%,X%,Y%,y%,oldy%|
00000fb0  0d 00 a6 0e 4e 6f 77 25  3d a4 54 69 6d 65 0d 00  |....Now%=.Time..|
00000fc0  a7 2f 59 25 3d 28 53 74  61 72 74 54 69 6d 65 25  |./Y%=(StartTime%|
00000fd0  2d 4e 6f 77 25 29 2a 43  68 61 72 48 25 20 81 20  |-Now%)*CharH% . |
00000fe0  42 65 61 74 4c 65 6e 67  74 68 25 2d 38 0d 00 a8  |BeatLength%-8...|
00000ff0  15 e7 20 94 28 59 25 2d  4f 6c 64 59 25 29 3c 34  |.. .(Y%-OldY%)<4|
00001000  20 e1 0d 00 a9 34 62 25  21 30 3d 57 48 25 3a 62  | ....4b%!0=WH%:b|
00001010  25 21 34 3d 30 3a 62 25  21 38 3d 2d 57 69 6e 48  |%!4=0:b%!8=-WinH|
00001020  25 3a 62 25 21 31 32 3d  43 68 61 72 57 25 3a 62  |%:b%!12=CharW%:b|
00001030  25 21 31 36 3d 30 0d 00  aa 26 c8 99 20 22 57 69  |%!16=0...&.. "Wi|
00001040  6d 70 5f 55 70 64 61 74  65 57 69 6e 64 6f 77 22  |mp_UpdateWindow"|
00001050  2c 2c 62 25 20 b8 20 4d  6f 72 65 25 0d 00 ab 3c  |,,b% . More%...<|
00001060  58 25 2b 3d 62 25 21 34  2d 62 25 21 32 30 3a 79  |X%+=b%!4-b%!20:y|
00001070  25 3d 59 25 2b 62 25 21  31 36 2d 62 25 21 32 34  |%=Y%+b%!16-b%!24|
00001080  3a 6f 6c 64 79 25 3d 4f  6c 64 59 25 2b 62 25 21  |:oldy%=OldY%+b%!|
00001090  31 36 2d 62 25 21 32 34  0d 00 ac 0c c8 95 20 4d  |16-b%!24...... M|
000010a0  6f 72 65 25 0d 00 ad 2d  20 20 c8 99 20 22 57 69  |ore%...-  .. "Wi|
000010b0  6d 70 5f 53 65 74 43 6f  6c 6f 75 72 22 2c 30 3a  |mp_SetColour",0:|
000010c0  ec 20 58 25 2c 6f 6c 64  79 25 3a f1 20 22 89 22  |. X%,oldy%:. "."|
000010d0  3b 0d 00 ae 2b 20 20 c8  99 20 22 57 69 6d 70 5f  |;...+  .. "Wimp_|
000010e0  53 65 74 43 6f 6c 6f 75  72 22 2c 31 31 3a ec 20  |SetColour",11:. |
000010f0  58 25 2c 79 25 3a f1 20  22 89 22 3b 0d 00 af 28  |X%,y%:. ".";...(|
00001100  20 20 c8 99 20 22 57 69  6d 70 5f 47 65 74 52 65  |  .. "Wimp_GetRe|
00001110  63 74 61 6e 67 6c 65 22  2c 2c 62 25 20 b8 20 4d  |ctangle",,b% . M|
00001120  6f 72 65 25 0d 00 b0 05  ce 0d 00 b1 0c 4f 6c 64  |ore%.........Old|
00001130  59 25 3d 59 25 0d 00 b2  05 e1 0d 00 b3 04 0d 00  |Y%=Y%...........|
00001140  b4 1c dd 20 f2 52 65 64  72 61 77 28 57 6b 4f 72  |... .Redraw(WkOr|
00001150  58 25 2c 57 6b 4f 72 59  25 29 0d 00 b5 11 ea 20  |X%,WkOrY%)..... |
00001160  43 68 61 6e 25 2c 54 25  2c 50 25 0d 00 b6 12 e3  |Chan%,T%,P%.....|
00001170  20 54 25 3d 30 20 b8 20  4e 54 25 2d 31 0d 00 b7  | T%=0 . NT%-1...|
00001180  1a 20 20 e3 20 43 68 61  6e 25 3d 30 20 b8 20 4e  |.  . Chan%=0 . N|
00001190  43 68 61 6e 25 2d 31 0d  00 b8 37 20 20 20 20 ec  |Chan%-1...7    .|
000011a0  20 57 6b 4f 72 58 25 2b  43 68 61 6e 25 2a 43 68  | WkOrX%+Chan%*Ch|
000011b0  61 6e 57 25 2b 43 68 61  72 57 25 2c 57 6b 4f 72  |anW%+CharW%,WkOr|
000011c0  59 25 2d 54 25 2a 43 68  61 72 48 25 2d 38 0d 00  |Y%-T%*CharH%-8..|
000011d0  b9 1b 20 20 20 20 50 25  3d 50 69 74 63 68 25 28  |..    P%=Pitch%(|
000011e0  54 25 2c 43 68 61 6e 25  29 0d 00 ba 38 20 20 20  |T%,Chan%)...8   |
000011f0  20 e7 20 50 25 20 f1 20  c1 22 43 44 45 46 47 41  | . P% . ."CDEFGA|
00001200  42 22 2c 20 50 25 20 83  20 37 2b 31 2c 31 29 3b  |B", P% . 7+1,1);|
00001210  50 25 20 81 20 37 3b 20  8b 20 f1 20 22 b7 b7 22  |P% . 7; . . ".."|
00001220  3b 0d 00 bb 07 20 20 ed  0d 00 bc 07 ed 20 20 0d  |;....  ......  .|
00001230  00 bd 05 e1 0d 00 be 04  0d 00 bf 3f f4 20 3d 3d  |...........?. ==|
00001240  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00001250  3d 3d 3d 3d 3d 3d 3d 3d  20 4d 49 44 49 20 3d 3d  |======== MIDI ==|
00001260  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00001270  3d 3d 3d 3d 3d 3d 3d 0d  00 c0 04 0d 00 c1 0f dd  |=======.........|
00001280  20 f2 4d 69 64 69 49 6e  69 74 0d 00 c2 12 c8 99  | .MidiInit......|
00001290  20 22 4d 49 44 49 5f 49  6e 69 74 22 0d 00 c3 19  | "MIDI_Init"....|
000012a0  c8 99 20 22 4d 49 44 49  5f 46 61 73 74 43 6c 6f  |.. "MIDI_FastClo|
000012b0  63 6b 22 2c 31 0d 00 c4  0e f2 41 6c 6c 4f 66 66  |ck",1.....AllOff|
000012c0  4e 6f 77 0d 00 c5 05 e1  0d 00 c6 04 0d 00 c7 0b  |Now.............|
000012d0  dd 20 a4 54 69 6d 65 0d  00 c8 08 ea 20 54 25 0d  |. .Time..... T%.|
000012e0  00 c9 1f c8 99 20 22 4d  49 44 49 5f 46 61 73 74  |..... "MIDI_Fast|
000012f0  43 6c 6f 63 6b 22 2c 2d  31 20 b8 2c 54 25 0d 00  |Clock",-1 .,T%..|
00001300  ca 07 3d 54 25 0d 00 cb  04 0d 00 cc 0b dd 20 f2  |..=T%......... .|
00001310  57 61 69 74 0d 00 cd 08  ea 20 46 25 0d 00 ce 05  |Wait..... F%....|
00001320  f5 0d 00 cf 0b 20 20 f2  50 6f 6c 6c 0d 00 d0 24  |.....  .Poll...$|
00001330  20 20 c8 99 20 22 4d 49  44 49 5f 49 6e 71 42 75  |  .. "MIDI_InqBu|
00001340  66 66 65 72 53 69 7a 65  22 2c 31 20 b8 20 46 25  |fferSize",1 . F%|
00001350  0d 00 d1 08 fd 20 46 25  0d 00 d2 05 e1 0d 00 d3  |..... F%........|
00001360  04 0d 00 d4 1e dd 20 f2  4e 6f 74 65 28 43 68 61  |...... .Note(Cha|
00001370  6e 25 2c 50 25 2c 56 25  2c 54 69 6d 65 25 29 0d  |n%,P%,V%,Time%).|
00001380  00 d5 0e ea 20 43 6f 6d  6d 61 6e 64 25 0d 00 d6  |.... Command%...|
00001390  3e e7 20 56 25 20 43 75  72 72 65 6e 74 50 69 74  |>. V% CurrentPit|
000013a0  63 68 25 28 43 68 61 6e  25 29 3d a4 50 28 50 25  |ch%(Chan%)=.P(P%|
000013b0  29 20 8b 20 50 25 3d 43  75 72 72 65 6e 74 50 69  |) . P%=CurrentPi|
000013c0  74 63 68 25 28 43 68 61  6e 25 29 0d 00 d7 3b 43  |tch%(Chan%)...;C|
000013d0  6f 6d 6d 61 6e 64 25 3d  26 39 30 20 84 20 43 68  |ommand%=&90 . Ch|
000013e0  61 6e 25 20 84 20 43 75  72 72 65 6e 74 50 69 74  |an% . CurrentPit|
000013f0  63 68 25 28 43 68 61 6e  25 29 3c 3c 38 20 84 20  |ch%(Chan%)<<8 . |
00001400  56 25 3c 3c 31 36 0d 00  d8 26 c8 99 20 22 4d 49  |V%<<16...&.. "MI|
00001410  44 49 5f 54 78 43 6f 6d  6d 61 6e 64 22 2c 43 6f  |DI_TxCommand",Co|
00001420  6d 6d 61 6e 64 25 2c 54  69 6d 65 25 0d 00 d9 05  |mmand%,Time%....|
00001430  e1 0d 00 da 04 0d 00 db  14 dd 20 f2 41 6c 6c 4f  |.......... .AllO|
00001440  66 66 28 54 69 6d 65 25  29 0d 00 dc 0b ea 20 43  |ff(Time%)..... C|
00001450  68 61 6e 25 0d 00 dd 18  e3 20 43 68 61 6e 25 3d  |han%..... Chan%=|
00001460  30 20 b8 20 4e 43 68 61  6e 25 2d 31 0d 00 de 1c  |0 . NChan%-1....|
00001470  20 20 f2 4e 6f 74 65 28  43 68 61 6e 25 2c 30 2c  |  .Note(Chan%,0,|
00001480  30 2c 54 69 6d 65 25 29  0d 00 df 0b ed 20 43 68  |0,Time%)..... Ch|
00001490  61 6e 25 0d 00 e0 05 e1  0d 00 e1 04 0d 00 e2 10  |an%.............|
000014a0  dd 20 f2 41 6c 6c 4f 66  66 4e 6f 77 0d 00 e3 0b  |. .AllOffNow....|
000014b0  ea 20 43 68 61 6e 25 0d  00 e4 15 41 6c 6c 4f 66  |. Chan%....AllOf|
000014c0  66 25 3d 26 30 33 30 30  37 42 42 30 0d 00 e5 18  |f%=&03007BB0....|
000014d0  e3 20 43 68 61 6e 25 3d  30 20 b8 20 4e 43 68 61  |. Chan%=0 . NCha|
000014e0  6e 25 2d 31 0d 00 e6 27  20 20 c8 99 20 22 4d 49  |n%-1...'  .. "MI|
000014f0  44 49 5f 54 78 43 6f 6d  6d 61 6e 64 22 2c 41 6c  |DI_TxCommand",Al|
00001500  6c 4f 66 66 25 2b 43 68  61 6e 25 0d 00 e7 05 ed  |lOff%+Chan%.....|
00001510  0d 00 e8 05 e1 0d 00 e9  04 0d 00 ea 11 dd 20 f2  |.............. .|
00001520  4d 61 6a 6f 72 4d 69 6e  6f 72 0d 00 eb 2b e7 20  |MajorMinor...+. |
00001530  b3 3c 30 20 50 25 28 32  29 3d 33 3a 50 25 28 35  |.<0 P%(2)=3:P%(5|
00001540  29 3d 38 20 8b 20 50 25  28 32 29 3d 34 3a 50 25  |)=8 . P%(2)=4:P%|
00001550  28 35 29 3d 39 0d 00 ec  05 e1 0d 00 ed 05 20 0d  |(5)=9......... .|
00001560  00 ee 0a dd 20 f2 4e 65  77 0d 00 ef 1d ea 20 44  |.... .New..... D|
00001570  25 2c 54 25 2c 4d 25 2c  50 25 2c 54 54 25 2c 43  |%,T%,M%,P%,TT%,C|
00001580  43 25 2c 4d 50 25 0d 00  f0 15 43 68 61 6e 25 3d  |C%,MP%....Chan%=|
00001590  b3 28 4e 43 68 61 6e 25  29 2d 31 0d 00 f1 24 e7  |.(NChan%)-1...$.|
000015a0  20 43 68 61 6e 25 3d 52  68 79 74 68 6d 43 68 61  | Chan%=RhythmCha|
000015b0  6e 6e 65 6c 25 20 f2 52  68 79 74 68 6d 3a e1 0d  |nnel% .Rhythm:..|
000015c0  00 f2 0f 54 25 3d b3 28  4e 54 25 29 2d 31 0d 00  |...T%=.(NT%)-1..|
000015d0  f3 31 e7 20 50 69 74 63  68 25 28 54 25 2c 43 68  |.1. Pitch%(T%,Ch|
000015e0  61 6e 25 29 20 80 20 b3  3e 30 20 50 69 74 63 68  |an%) . .>0 Pitch|
000015f0  25 28 54 25 2c 43 68 61  6e 25 29 3d 30 3a e1 0d  |%(T%,Chan%)=0:..|
00001600  00 f4 32 f4 20 52 6f 75  6e 64 20 54 25 20 64 6f  |..2. Round T% do|
00001610  77 6e 20 74 6f 20 62 69  67 67 65 73 74 20 73 69  |wn to biggest si|
00001620  6c 65 6e 74 20 70 6f 77  65 72 20 6f 66 20 74 77  |lent power of tw|
00001630  6f 0d 00 f5 0a 4d 25 3d  ac 20 31 0d 00 f6 05 f5  |o....M%=. 1.....|
00001640  0d 00 f7 11 20 20 54 54  25 3d 54 25 20 80 20 4d  |....  TT%=T% . M|
00001650  25 0d 00 f8 32 20 20 e7  20 50 69 74 63 68 25 28  |%...2  . Pitch%(|
00001660  54 54 25 2c 43 68 61 6e  25 29 3d 30 20 54 25 3d  |TT%,Chan%)=0 T%=|
00001670  54 54 25 3a 4d 25 3d 4d  25 3c 3c 31 20 8b 20 4d  |TT%:M%=M%<<1 . M|
00001680  25 3d 30 0d 00 f9 12 fd  20 28 4e 54 25 20 80 20  |%=0..... (NT% . |
00001690  4d 25 29 3d 30 0d 00 fa  19 50 25 3d b3 28 31 35  |M%)=0....P%=.(15|
000016a0  29 2b 36 3a 4d 50 25 3d  a4 50 28 50 25 29 0d 00  |)+6:MP%=.P(P%)..|
000016b0  fb 16 e3 20 43 43 25 3d  30 20 b8 20 4e 43 68 61  |... CC%=0 . NCha|
000016c0  6e 25 2d 31 0d 00 fc 25  20 20 e7 20 43 43 25 3c  |n%-1...%  . CC%<|
000016d0  3e 43 68 61 6e 25 20 80  20 50 69 74 63 68 25 28  |>Chan% . Pitch%(|
000016e0  54 25 2c 43 43 25 29 20  8c 0d 00 fd 24 20 20 20  |T%,CC%) ....$   |
000016f0  20 44 25 3d 94 28 4d 50  25 2d a4 50 28 50 69 74  | D%=.(MP%-.P(Pit|
00001700  63 68 25 28 54 25 2c 43  43 25 29 29 29 0d 00 fe  |ch%(T%,CC%)))...|
00001710  18 20 20 20 20 e7 20 55  48 25 28 44 25 20 83 20  |.    . UH%(D% . |
00001720  31 32 29 20 e1 0d 00 ff  07 20 20 cd 0d 01 00 05  |12) .....  .....|
00001730  ed 0d 01 01 15 f2 53 65  74 28 54 25 2c 43 68 61  |......Set(T%,Cha|
00001740  6e 25 2c 50 25 29 0d 01  02 05 e1 0d 01 03 04 0d  |n%,P%)..........|
00001750  01 04 0d dd 20 f2 52 68  79 74 68 6d 0d 01 05 0e  |.... .Rhythm....|
00001760  ea 20 44 25 2c 54 25 2c  50 25 0d 01 06 1a 44 25  |. D%,T%,P%....D%|
00001770  3d 31 3c 3c 28 b3 28 4c  6f 67 32 4e 54 25 2b 31  |=1<<(.(Log2NT%+1|
00001780  29 2d 31 29 0d 01 07 0f  54 25 3d b3 28 4e 54 25  |)-1)....T%=.(NT%|
00001790  29 2d 31 0d 01 08 0e 50  25 3d b3 28 32 32 29 2b  |)-1....P%=.(22)+|
000017a0  36 0d 01 09 0d c8 95 20  54 25 3c 4e 54 25 0d 01  |6...... T%<NT%..|
000017b0  0a 20 20 20 f2 53 65 74  28 54 25 2c 52 68 79 74  |.   .Set(T%,Rhyt|
000017c0  68 6d 43 68 61 6e 6e 65  6c 25 2c 50 25 29 0d 01  |hmChannel%,P%)..|
000017d0  0b 0c 20 20 54 25 2b 3d  44 25 0d 01 0c 05 ce 0d  |..  T%+=D%......|
000017e0  01 0d 05 e1 0d 01 0e 04  0d 01 0f 0b dd 20 f2 43  |............. .C|
000017f0  6f 70 79 0d 01 10 0f ea  20 43 25 2c 43 43 25 2c  |opy..... C%,CC%,|
00001800  50 25 0d 01 11 0a 50 25  3d b3 3e 30 0d 01 12 15  |P%....P%=.>0....|
00001810  e3 20 43 25 3d 30 20 b8  20 4e 43 68 61 6e 25 2d  |. C%=0 . NChan%-|
00001820  31 0d 01 13 0c 20 20 e7  20 50 25 20 8c 0d 01 14  |1....  . P% ....|
00001830  09 20 20 20 20 f5 0d 01  15 1f 20 20 20 20 20 20  |.    .....      |
00001840  53 77 61 70 25 28 43 25  29 3d b3 28 4e 43 68 61  |Swap%(C%)=.(NCha|
00001850  6e 25 29 2d 31 0d 01 16  31 20 20 20 20 20 20 43  |n%)-1...1      C|
00001860  43 25 3d 30 3a c8 95 20  53 77 61 70 25 28 43 43  |C%=0:.. Swap%(CC|
00001870  25 29 3c 3e 53 77 61 70  25 28 43 25 29 20 43 43  |%)<>Swap%(C%) CC|
00001880  25 2b 3d 31 3a ce 0d 01  17 10 20 20 20 20 fd 20  |%+=1:.....    . |
00001890  43 43 25 3d 43 25 0d 01  18 07 20 20 cc 0d 01 19  |CC%=C%....  ....|
000018a0  14 20 20 20 20 53 77 61  70 25 28 43 25 29 3d 43  |.    Swap%(C%)=C|
000018b0  25 0d 01 1a 07 20 20 cd  0d 01 1b 05 ed 0d 01 1c  |%....  .........|
000018c0  1b 4c 53 25 3d 31 3c 3c  b3 28 ab 28 4e 54 25 2d  |.LS%=1<<.(.(NT%-|
000018d0  31 29 2f ab 32 2d 31 29  0d 01 1d 28 e7 20 4c 53  |1)/.2-1)...(. LS|
000018e0  25 2a 34 3c 4e 54 25 2d  31 20 4c 44 25 3d b3 28  |%*4<NT%-1 LD%=.(|
000018f0  33 29 2a 4c 53 25 20 8b  20 4c 44 25 3d 4c 53 25  |3)*LS% . LD%=LS%|
00001900  0d 01 1e 1a 54 53 25 3d  28 b3 28 4e 54 25 2f 4c  |....TS%=(.(NT%/L|
00001910  53 25 29 2d 31 29 2a 4c  53 25 0d 01 1f 1a 54 44  |S%)-1)*LS%....TD|
00001920  25 3d 28 b3 28 4e 54 25  2f 4c 44 25 29 2d 31 29  |%=(.(NT%/LD%)-1)|
00001930  2a 4c 44 25 0d 01 20 19  50 53 25 3d b3 28 37 29  |*LD%.. .PS%=.(7)|
00001940  2d 31 3a 44 53 25 3d b3  28 33 29 2d 32 0d 01 21  |-1:DS%=.(3)-2..!|
00001950  12 e3 20 54 25 3d 30 20  b8 20 4c 44 25 2d 31 0d  |.. T%=0 . LD%-1.|
00001960  01 22 26 20 20 e7 20 54  44 25 2b 54 25 3c 54 53  |."&  . TD%+T%<TS|
00001970  25 20 84 20 54 44 25 2b  54 25 3e 3d 54 53 25 2b  |% . TD%+T%>=TS%+|
00001980  4c 53 25 20 8c 0d 01 23  19 20 20 20 20 e3 20 43  |LS% ...#.    . C|
00001990  25 3d 30 20 b8 20 4e 43  68 61 6e 25 2d 31 0d 01  |%=0 . NChan%-1..|
000019a0  24 25 20 20 20 20 20 20  50 25 3d 50 69 74 63 68  |$%      P%=Pitch|
000019b0  25 28 54 53 25 2b 54 25  20 83 20 4c 53 25 2c 20  |%(TS%+T% . LS%, |
000019c0  43 25 29 0d 01 25 10 20  20 20 20 20 20 e7 20 50  |C%)..%.      . P|
000019d0  25 20 8c 0d 01 26 22 20  20 20 20 20 20 20 20 50  |% ...&"        P|
000019e0  25 2b 3d 50 53 25 2b 44  53 25 2a 28 54 25 20 81  |%+=PS%+DS%*(T% .|
000019f0  20 4c 53 25 29 0d 01 27  1c 20 20 20 20 20 20 20  | LS%)..'.       |
00001a00  20 c8 95 20 50 25 3e 32  38 20 50 25 2d 3d 37 3a  | .. P%>28 P%-=7:|
00001a10  ce 0d 01 28 0b 20 20 20  20 20 20 cd 0d 01 29 2b  |...(.      ...)+|
00001a20  20 20 20 20 20 20 f2 53  65 74 28 28 54 44 25 2b  |      .Set((TD%+|
00001a30  54 25 29 20 83 20 4e 54  25 2c 53 77 61 70 25 28  |T%) . NT%,Swap%(|
00001a40  43 25 29 2c 50 25 29 0d  01 2a 09 20 20 20 20 ed  |C%),P%)..*.    .|
00001a50  0d 01 2b 07 20 20 cd 0d  01 2c 05 ed 0d 01 2d 05  |..+.  ...,....-.|
00001a60  e1 0d 01 2e 04 0d 01 2f  26 dd 20 a4 50 28 50 25  |......./&. .P(P%|
00001a70  29 3d 31 32 2a 28 50 25  20 81 20 37 29 2b 50 25  |)=12*(P% . 7)+P%|
00001a80  28 50 25 20 83 20 37 29  2b 33 36 0d 01 30 04 0d  |(P% . 7)+36..0..|
00001a90  01 31 3f f4 20 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.1?. ===========|
00001aa0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 20  |=============== |
00001ab0  4d 69 73 63 20 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |Misc ===========|
00001ac0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 0d 01  |==============..|
00001ad0  32 04 0d 01 33 11 dd 20  a4 53 74 72 69 6e 67 28  |2...3.. .String(|
00001ae0  53 25 29 0d 01 34 0e ea  20 50 25 3a 50 25 3d 53  |S%)..4.. P%:P%=S|
00001af0  25 0d 01 35 17 c8 95 20  3f 50 25 3e 97 22 20 22  |%..5... ?P%>." "|
00001b00  3a 50 25 2b 3d 31 3a ce  0d 01 36 0a 24 50 25 3d  |:P%+=1:...6.$P%=|
00001b10  22 22 0d 01 37 08 3d 24  53 25 0d 01 38 04 0d 01  |""..7.=$S%..8...|
00001b20  39 0c dd 20 f2 45 72 72  6f 72 0d 01 3a 09 ee 20  |9.. .Error..:.. |
00001b30  85 20 87 0d 01 3b 0e f2  41 6c 6c 4f 66 66 4e 6f  |. ...;..AllOffNo|
00001b40  77 0d 01 3c 14 e7 20 9f  3c 3e 30 20 80 20 9f 3c  |w..<.. .<>0 . .<|
00001b50  3e 31 37 20 8c 0d 01 3d  20 20 20 21 62 25 3d 9f  |>17 ...=   !b%=.|
00001b60  3a 24 28 62 25 2b 34 29  3d f6 24 2b 22 20 40 20  |:$(b%+4)=.$+" @ |
00001b70  22 2b c3 20 9e 0d 01 3e  26 20 20 c8 99 22 57 69  |"+. ...>&  .."Wi|
00001b80  6d 70 5f 52 65 70 6f 72  74 45 72 72 6f 72 22 2c  |mp_ReportError",|
00001b90  62 25 2c 31 2c 22 52 69  66 66 22 0d 01 3f 05 cd  |b%,1,"Riff"..?..|
00001ba0  0d 01 40 09 f2 51 75 69  74 0d 01 41 05 e1 0d 01  |..@..Quit..A....|
00001bb0  42 04 0d 01 43 0b dd 20  f2 51 75 69 74 0d 01 44  |B...C.. .Quit..D|
00001bc0  0d f2 4d 69 64 69 49 6e  69 74 0d 01 45 21 c8 99  |..MidiInit..E!..|
00001bd0  20 22 4d 49 44 49 5f 46  61 73 74 43 6c 6f 63 6b  | "MIDI_FastClock|
00001be0  22 2c 30 20 3a f4 20 53  74 6f 70 0d 01 46 2b 24  |",0 :. Stop..F+$|
00001bf0  62 25 3d 22 54 41 53 4b  22 3a c8 99 22 57 69 6d  |b%="TASK":.."Wim|
00001c00  70 5f 43 6c 6f 73 65 44  6f 77 6e 22 2c 54 61 73  |p_CloseDown",Tas|
00001c10  6b 25 2c 21 62 25 0d 01  47 06 c8 98 0d 01 48 04  |k%,!b%..G.....H.|
00001c20  0d 01 49 2c f4 20 59 61  6d 61 68 61 20 54 58 38  |..I,. Yamaha TX8|
00001c30  31 5a 2d 73 70 65 63 69  66 69 63 20 73 74 75 66  |1Z-specific stuf|
00001c40  66 20 28 6e 6f 74 20 75  73 65 64 29 0d 01 4a 04  |f (not used)..J.|
00001c50  0d 01 4b 19 f4 20 44 45  46 20 50 52 4f 43 50 65  |..K.. DEF PROCPe|
00001c60  72 66 28 43 68 61 6e 25  29 0d 01 4c 20 f4 20 4c  |rf(Chan%)..L . L|
00001c70  4f 43 41 4c 20 43 25 2c  54 25 3a 43 25 3d 43 68  |OCAL C%,T%:C%=Ch|
00001c80  61 6e 25 20 41 4e 44 20  37 0d 01 4d 31 f4 20 52  |an% AND 7..M1. R|
00001c90  45 50 45 41 54 20 56 25  3d 52 4e 44 28 31 36 30  |EPEAT V%=RND(160|
00001ca0  29 2d 31 3a 55 4e 54 49  4c 20 56 25 3c 31 33 36  |)-1:UNTIL V%<136|
00001cb0  20 4f 52 20 56 25 3e 31  34 39 0d 01 4e 1e f4 20  | OR V%>149..N.. |
00001cc0  50 52 4f 43 50 41 52 28  30 2c 31 32 2a 43 25 2b  |PROCPAR(0,12*C%+|
00001cd0  31 2c 56 25 3e 3e 37 29  0d 01 4f 23 f4 20 50 52  |1,V%>>7)..O#. PR|
00001ce0  4f 43 50 41 52 28 30 2c  31 32 2a 43 25 2b 32 2c  |OCPAR(0,12*C%+2,|
00001cf0  56 25 20 41 4e 44 20 31  32 37 29 0d 01 50 0d f4  |V% AND 127)..P..|
00001d00  20 45 4e 44 50 52 4f 43  0d 01 51 07 f4 20 20 0d  | ENDPROC..Q..  .|
00001d10  01 52 1b f4 20 44 45 46  20 50 52 4f 43 50 41 52  |.R.. DEF PROCPAR|
00001d20  28 53 25 2c 50 25 2c 44  25 29 0d 01 53 26 f4 20  |(S%,P%,D%)..S&. |
00001d30  50 52 4f 43 4d 28 26 46  30 29 3a 50 52 4f 43 4d  |PROCM(&F0):PROCM|
00001d40  28 26 34 33 29 3a 50 52  4f 43 4d 28 26 31 30 29  |(&43):PROCM(&10)|
00001d50  0d 01 54 27 f4 20 50 52  4f 43 4d 28 26 31 30 2b  |..T'. PROCM(&10+|
00001d60  53 25 29 3a 50 52 4f 43  4d 28 50 25 29 3a 50 52  |S%):PROCM(P%):PR|
00001d70  4f 43 4d 28 44 25 29 0d  01 55 10 f4 20 50 52 4f  |OCM(D%)..U.. PRO|
00001d80  43 4d 28 26 46 37 29 0d  01 56 0d f4 20 45 4e 44  |CM(&F7)..V.. END|
00001d90  50 52 4f 43 0d 01 57 07  f4 20 20 0d 01 58 2d f4  |PROC..W..  ..X-.|
00001da0  20 44 45 46 20 50 52 4f  43 4d 28 41 25 29 20 20  | DEF PROCM(A%)  |
00001db0  20 20 20 20 3a 52 45 4d  20 53 65 6e 64 20 41 25  |    :REM Send A%|
00001dc0  20 74 6f 20 4d 49 44 49  0d 01 59 1a f4 20 53 59  | to MIDI..Y.. SY|
00001dd0  53 20 22 4d 49 44 49 5f  54 78 42 79 74 65 22 2c  |S "MIDI_TxByte",|
00001de0  41 25 0d 01 5a 0d f4 20  45 4e 44 50 52 4f 43 0d  |A%..Z.. ENDPROC.|
00001df0  ff                                                |.|
00001df1