FXM

These files store music written on Fuxoft AY Language (terminology and file header was got from RDOSPLAY documentation).

Fuxoft (Frantisek Fuka) designed this language.

FXM-file structure

OffsetSizeNameDescription
+04IDIdentifier 'FXSM'
+42AddrData block allocation address in Z80 memory
+6?DataData block

Data block is original structure from software, in which this music is used.

Data block structure

OffsetSizeNameDescription
+02AddrAFuxoft AY Language program first byte address for channel A
+22AddrBFuxoft AY Language program first byte address for channel B
+42AddrCFuxoft AY Language program first byte address for channel C
+6?ProgsPrograms, subprograms on Fuxoft AY Language, samples, ornaments, and also (very seldom) subprograms on Z80 machine codes

Programs and subprograms (as in any other program language) consist of sequence of commands. In this sequence can to select phrases. Phrase is totality of commands is needed for setting one note to playing. Note command and Silence command define the end of phrase.

16 words size stack is given to each channel for playing module. So, maximal number of subprograms calls from other subprograms is 16. Recursive calls are not allowed.

Fuxoft AY Language commands description (hex numbers)

00 XX – silence

Sound off command. Byte parameter XX after this command code is number of interrupts, during which no sound in corresponding channel.

01..54 XX – note number increased by 1

Sets note (number from 00 to 53) for playing during XX interrupts. AY tone register value 0FBF corresponds to note number 00 is note A of subcontroctave (if chip frequency is 1773400 MHz). Range between two closest notes is semitone.

80 XX XX – jumping to address XXXX

Simple jump to address XXXX (Z80 JP command analog). Usually, this command ends main programs of corresponding channels (in this case it jumps to infinite loop command address).

81 XX XX – subprogram at address XXXX calling

Stores in stack address of next command and jumps to XXXX address (subprogram calling, Z80 CALL analog). Stack size is 16 words limited.

82 XX – setting loop point and number of reiterations

Stores in stack address of next command (loop point) and XX parameter (number of reiterations increased by 1). Program part from this loop point to command 83 will be repeated (XX – 1) times (reprise).

83 – reprise

Reiterates (XX – 1) times from loop point is set by 82 XX command. This command pops from stack XX parameter and loop point address, decreases XX by 1, and, if it not equals to zero, stores both parameter and loop point address in stack and jump to loop point.

84 XX – noise

Parameter XX (00..1F) is AY noise register value.

85 XX– mixer

Parameter XX (set/reset bit 0 for enable/disable ton, and same for bit 3 for noise, all other bits are zeros) sets value of AY mixer register of corresponding channel.

86 XX XX – ornament

Parameter XXXX defines address of ornament for using with this phrase note (and by default will be used in next phrases).

87 XX XX – sample

Parameter XXXX defines address of sample for using with this phrase note (and by default will be used in next phrases; command 8A defines to continue play this sample from current position in it with next notes and command 8B defines to restart playing of this sample with next notes; by default, second described mode is on).

88 XX – transposition

Sets transposition equal to XX semitones. XX is signed byte. By default, transposition is zero.

89 – return from subprogram

Pops address from stack and jump to it (Z80 RET analog).

8A – do not initialize sample

Switch to mode during which setting of new notes do not allows to restart current sample playing (it simply continues to play from current position in this sample).

8B – initialize sample

Switch to mode during which setting of new note restarts sample playing from its beginning (default mode).

8C XX XX – gives control to Z80 subprogram

Gives control to subprogram in Z80 machine codes. I met only one FXM, which uses this command, and its Z80 subprogram does nothing for sounding. Command 8C is not supported in Ay_Emul. I think Fuxoft designed this command to synchronize some visual effects with playing melody.

8D XX – addition to noise

Addition to AY noise register current value by module 20 (or 10 in some versions, see Andsix parameter in AY-files description).

8E XX – addition to transposition

Addition to current transposition value in semitones.

8F – push transposition

Pushes current transposition value into channel stack.

90 – pop transposition

Pops transposition value from channel stack.

Sample structure

Sample in this language has simple structure and controls amplitude of output signal only. As programs, sample is commands sequence.

00..0F XX – amplitude

Defines amplitude value in this and next interrupts (XX defines number of interrupts).

32..41 – amplitude

Defines amplitude value in only this interrupt (increased by 32).

80 XX XX – jump to loop point

Jumps to XXXX loop point of this sample.

Ornament structure

Ornament is a bit compounder structure. It changes current frequency of tone register in current interrupt by given value.

80 XX XX – jump to loop point

Jumps to XXXX loop point of this ornament.

82 – semitones

Directs that all ornament values are in semitones.

83 – tone register units

Directs taht all ornament values are in AY tone register units.

84 – invert mixer bits

Inverts both AY mixer bits for corresponding channel.

Other values – addition

Changes value of AY tone register by adding this addition (signed byte) to it. Can be in semitones or in tone register units (set by commands 82 and 83).