ZX SPECTRUM SOUND CHIP EMULATOR FILES FXM

From MSX MUSIC WIKI
Jump to: navigation, search

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

Fuxoft (Frantisek Fuka) designed this language.

FXM file has next structure.

Offset Size Name Description +0 4 ID Identifier ‘FXSM’ +4 2 Addr Data block allocation address in Z80 memory +6 ? Data Data block Data block is original structure from software, in which this music is used.

Data block format

Offset Size Name Description +0 2 AddrA Fuxoft AY Language program first byte address for channel A +2 2 AddrB Fuxoft AY Language program first byte address for channel B +4 2 AddrC Fuxoft AY Language program first byte address for channel C +6 ? From this point a programs, subprograms on Fuxoft AY Language, samples, ornaments, and also (very seldom) subprograms on Z80 machine codes follows (mixed). 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-word stack is got to each channel for playing module. So, maximal number of subprogram calls from other subprograms is 16. Recursive calls are not allowed.

Farther description of this language commands follows (hex numbers).

00 XX – silence.

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

01..54 XX – note number is increased by 1.

Set for playing note (number from 00 to 53) during XX interrupts. AY tone register value 0FBF corresponds to note number 00 is note LA of sub counter octave (if chip frequency is 1773400 MHz). Range between two close notes is halftone.

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 jump 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 equal 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 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.

Set transposition equal to XX halftones. XX is signed byte. By default transposition is zero.

89 – return from subprogram.

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

8A – do not initialize sample.

Switch to mode during which setting of new note do not allows to restart current sample playing (it simply continue 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. In this Emulator command 8C is not supported. 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 halftones.

8F – push transposition.

Pushes current transposition value into channel stack.

90 – pop transposition.

Pops transposition value from channel stack.

Sample in this language has simple structure and control only amplitude of output signal. 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 is a bit compound 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 – halftones.

Directs to consider all values in ornaments are in halftones.

83 – tone register units.

Directs to consider all values in ornaments 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 halftones or in tone register units (set by commands 82 and 83).

Seeing at this module structure, you can to understand, why searching for FXM tunes of this Emulator not so reliable, as other modules searching. So, there are many tunes, which you must to rip manually from your favorite soft. But you can to try use auto searching first, why not? During manual ripping FXM, you can try to use data in its player (same for all FXM).