XGS ME Music Compiler

Reference manual

 

                 Usage

 

                      Invoke the compiler in the following way

 

                                            xgsmc <in> <out>

 

                      Or

 

                                            xgsmc -p <page> <in> <out>

 

                      If you want to specify the starting page (0-15) for the music data.

 

 

To play a song from your SX52 program, include the following lines somewhere in your program (preferably at the beginning, since they'll modify the ORG):

                     

                                            include   "*"      

                                            include   "xgsmp.src"

                                           

Where * is the name of the file generated by xgsmc. You also need these lines at the lower half of a page:

                     

                                            InitMusic          jmp @XgsMpInit

                                            UpdateMusic        jmp @XgsMpUpdate

 

Call InitMusic to initialize the player, and UpdateMusic once for each frame to update the music.

Note: both of these routines will set bit 7 of FSR, so you'll need to clear it afterwards if necessary!

                     

 

                 Syntax

 

There are three channels, denoted A, B and C. You can perform a command on more than one channel at the same time, eg.

 

                                            AC v5     ; Set volume to 5 for channels A and C

 

Notes are entered with common letters (a-g). Sharps are done with the + sign. Valid note lengths are 1-32 (32 being the shortest and 1 the longest).

                      Eg.

 

                                            f+4       ; F sharp, quarter note

 

                      The other commands are as follows:

 

                      L                                         Set loop point

 

                      @<num>                              Set waveform. The available waveforms are:

                                                                                       0: infinite square

                                                                                       1: Long square

                                                                                       2: Short square

                                                                                       4: infinite sine

                                                                                       5: Long sine

                                                                                       6: Short sine

 

                      l<num>                              Set length, num can be 1-32.

 

                      o<num>                              Set octave, num can be 3-7.

 

                      r                                         Rest (turn off output for a given channel). Works the same

                                                                 way as notes.

                                                                 Eg.

                                                                

                                                                                       r4.       ; Rest for 1/4 + 1/8

                                                                                      

                      t<num>                              Set tempo (bpm), num can be 90, 112, 150, 225 or 450.

 

 

                      v<num>                              Set volume, num can be 0-7 (7 being the loudest)

 

                      []<num>                            Repeat everything in between [ and ] num times.

                                                                 Eg.

                                                                

                                                                                       [abc]4    ; Play abc four times

 

                      <                                         Octave down

                     

                      >                                         Octave up

 

                      .                                           Increase note length by defined length/2.

                                                                 Eg.

 

c4..      ; Duration will be 1/4  ; + 1/8 + 1/16

 

                      &                                         Concatenate lengths

                                                                 Eg.

 

c2&8      ; Duration will be 1/2 ; + 1/8