Fred module structure --------------------- 0x0000 B 4 0x4efa???? jmp Init 0x0004 B 4 0x4efa???? jmp Play 0x0008 B 4 0x4efa???? jmp End 0x000c B 4 0x4efa???? jmp ??? Init: B 4 0x123a???? move.b nb_songs(pc),d1 B 2 0xb001 cmp.b d1,d0 B ... ... B 2 0x4e75 rts (end of replayroutine) B 1 replay used B 1 replay used W 1 replay used B 1 replay used B 1 ? W 72 periods module_start: 0x00 B 1 played song nb_songs: 0x01 B 1 max song-1 0x02 B 1 same as follows but for the played subsong 0x03 B 11 for subsongs 0x0E L 1 inst infos part offset 0x12 L 1 inst/note part offset B 4 replay used area 0x7a B 4*128 replay used area (channel info) 0x00 L 1 voice pos ptr 0x04 L 1 0x08 L 1 note ptr 0x0c L 1 current instr info ptr 0x10 B 1 vib delay 0x11 B 1 0x12 B 1 vib speed 0x13 B 1 vib ampl 0x14 B 1 vib value 0x15 B 1 port running ? 0x16 W 1 port delay ? (0x81 . . x) B 1 0x19 B 1 note 0x1a W 1 port ? 0x1c W 1 current audio period 0x1e B 1 ok (ST/SF) B 1 0x20 W 1 nb ticks with same step 0x22 B 1 vib started (bit 0 and bit 7 also used) 0x23 B 1 port target note ? (0x81 . x .) 0x24 W 1 initial per before port 0x26 W 1 $1a-$1c 0x28 W 1 counter : from 1 to $2a 0x2a W 1 port speed (0x81 x . .) 0x2c B 1 (enveloppe) volume 0x2d B 1 enveloppe state : 0=attack,1=decay,2=sustain,3=release 0x2e B 1 sustain speed (counter) 0x2f B 1 current arp index 0x30 B 1 arp speed (counter to 0) 0x31 B 1 pulse pos L 0x32 B 1 pulse delay 0x33 B 1 pulse 0x34 B 1 pulse speed B 1 0x36 W 1 blend, initially to 1 0x38 B 1 blend, initially to 0 0x39 B 1 blend delay ? instr+$30 0x3a W 1 offset from beginning of voice = current pos offset 0x3c B 1 pulse shoot 0x3d B 1 blend ? instr info+$32, counter to 0 0x3e 0x40 B 32 current synth instr ? 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0x27a W 4*sub voice ptr table : offset from the beginning of this table to the start of the sequence for each voice for each subs (song0 voice1 voice2 voice3 voice4) (song1 voice1 ...) W ??? sequences part : offsets for each voice (base = inst/note part) (each voice offset seq ended by 80xx=jump xx, or ffff=stop) B ??? inst/note part (commands = 0x80, 0x81 ?? ?? ??, 0x82 ??, 0x83 ??, 0x84) B 64*inst inst info part 0x00 L 1 sample offset (base = 0) 0x04 W 1 -1 if synth else repeat length ? 0x06 W 1 sample length 0x08 W 1 period ? 0x0a B 1 vib delay 0x0c B 1 vib speed 0x0d B 1 vib ampl 0x0e B 1 env vol 0x0f B 1 attack speed 0x10 B 1 attack volume 0x11 B 1 decay speed 0x12 B 1 decay volume 0x13 B 1 sustain speed 0x14 B 1 release speed 0x15 B 1 release volume 0x16 B 16 arpeggio table 0x26 B 1 arp speed 0x27 B 1 instr type : 0=sampled, 1=pulse, 2=blend 0x28 B 1 pulse rate - 0x29 B 1 pulse rate + 0x2a B 1 pulse speed 0x2b B 1 pulse pos L 0x2c B 1 pulse pos H 0x2d B 1 pulse delay 0x2e B 1 pulse synchro (9=OFF, 0x11=ON) 0x2f B 1 blend (power of 2) 0x30 B 1 blend delay ? 0x31 B 1 pulse shoot 0x32 B 1 blend ? 0x33 B 1 arpeggio count 0x34 B 1 samples per cycle : 16, 32 or 64 0x3a w 1 ok 0x40 b 32 B ??? samples Note ---- Sometimes the replay contains some ASCII comments between the beginning JMP and the rest of the replay. You have to scan 68000 code to find the start of the module data ! move.l Data,a0 moveq #-1,d1 ; not a FRED module cmpi.w #$4efa,$00(a0) ;jmp Init bne.s ChkEnd cmpi.w #$4efa,$04(a0) ;jmp Play bne.s ChkEnd cmpi.w #$4efa,$08(a0) ;jmp End bne.s ChkEnd cmpi.w #$4efa,$0c(a0) ;jmp ??? bne.s ChkEnd add.w 2(a0),a0 ;init sub offset moveq #4-1,d1 ChkLoop cmpi.w #$123a,2(a0) ;move.b bne.s ChkNext cmpi.w #$b001,6(a0) ;cmp.b beq.s ChkSong ChkNext addq.l #2,a0 dbra d1,ChkLoop bra.s ChkEnd ; not FRED ChkSong add.w 4(a0),a0 ; max subsong adress moveq #0,d1 move.b 4(a0),d1 ; max subsong value move.w d1,MaxSong moveq #0,d0 ; FRED recognized ChkEnd rts (routine supplied with Delitracker or APlayer) Example (trip to mars) ------- 0x0000 4efa004e 4efa00e2 4efa00cc 4efa00ba 0x0010 0f20 0x0012 "Music by Fred, Player by JC & Fred. Greetings to Rob HUBBARD! " 000050: 123a0881 b001 6200 007e 47fa 0876 1680 ... 0040721f 18db51c9 fffc4e75 0x083c ff 0x083d 00 0x083e 0000 0x0840 00 00 0x0842 2000 1e30 1c80 1ae8 1968 17f8 16a0 1558 1428 1308 11f8 10f0 1000 0f18 ... 008f 0087 0x08d2 00 played subsong 0x08d3 06 subsongs-1 0x08d4 00 0x08d5 03 03 03 03 04 03 03 02 02 02 00 0x08e0 00002204 inst infos offset 00000e22 offset 0x08e8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0x94c 00000000 ... 00000000 00000000 00000000 0x09cc 00000000 ... 00000000 00000000 00000000 0x0a4c 00000000 ... 00000000 00000000 00000000 0x0acc 00000000 ... 00000000 00000000 00000000 0xb4c 0038 0060 00a4 00d2 0 0102 0158 01ae 01ec 1 0242 0254 0266 0278 2 027c 028e 0298 02a2 3 02a6 02aa 02ae 02b2 4 02b6 02ba 02be 02c2 5 02c6 02ca 02ce 02d2 6 subsong0 0x38= 0x0b84 12e70000 00000000 00000115 02990299 029904b1 05b504b1 05320299 02990299 02990d4d 0d6b8000 ;jump 0 0x60= 0x0bac 13da13da 00240024 00240024 024d03a3 024d03a3 04130413 063c0647 0647087d 087d087d 08a4087d 087d087d 08a4087d 087d087d 08a4087d 087d087d 08a40d28 0dbc8000 000bf0 12d60016 00160016 010a010a 02170232 02170232 04a604a6 13da06c2 074508c9 08ec08ec 09c513d5 13d50d66 8000 0x0c1e 13da 13da13da 00b700b7 00b703ca 03ca03eb 03eb03ca 03ca03eb 03eb0408 040806b5 06b5086a 086a086a 086a0d60 8000 subsong1 0x0c4e 0a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a480a11 0a110a11 0a488000 0x0ca4 0aa60aa6 0aa60aa6 0aa60aa6 ... 0aa60aa6 0aa60aa6 8000 0x0cfa 13d5 13d513d5 ... 0bf40c33 0c338000 0x0d38 13d513d5 0b440b44 ... 000d80: 0b8a0b8a 0b440b44 0b440b44 8000 subsong2 0x0d8f 0deb 0x0d90: 0deb0deb 0deb0f42 0deb1052 10528000 ... subsong3 0x0dc8 1168 1168 11a3 11a3 1168 1168 11de 11de 8000 0x0dda 0e6e 0fc5 0e6e 0fcb 8000 0x0de4 1219 1262 1219 12a9 8000 0x0dee 1143 8000 subsong4 0x0df2 1323 ffff 1338 ffff 1345 ffff 1352 ffff sub5 0x0e02 1369 ffff 1378 ffff 0fd1 ffff 0c7a ffff sub6 0x0e12 0a87 ffff 0af7 ffff 0b0c ffff 0b2d ffff inst/note sequences 0x0e22 0x00 8300 24c11fc1 22c11dc1 80 8301 24c11fc1 22c11dc1 80 0x16 8300 84 8301 24c11fc122c11d c2 80 0x24 8303 18fd18fd 18fd18fd 18fd18fd 18fd18ff 13ff18fd 18fd18fd 18fd18fd 18fd18fd 18ff11ff 13fd13fd 13fd13fd 13fd13fd ... 11fd11fd 11ff0cff 80 0xb7 810424 04 830222 e527fd27 fd24fd81 04270429 e926f11f 102ee12c fb2bfb29 fd24d180 0x10a 830424c1 2bc12ec1 29c18083 0527fd83 0739fd83 ... 0627ff27 ff27fd80 80 0x217 830824 fb24fb24 ... fb24fd80 0x232 83081ffb 1ffb1ffd 1ffb1ffb ... 30fd8307 39fd8305 27fd27fd 831330ff 30fd30ff 30f58083 0084e180 830084a1 a1bf8000 inst info part 0x2204 00000000 ffff 0010 01ac 00 00 01 02 60 55 ae 09 a4 00 00 92 0003 070c 0f0e 0c07 0000 00000000 0000 06 01 ae 48 00 02 1c 00 0a 04 00 01 00 08 20000000 00000000 00000000 0x2244 00000000 ffff0010 01ac0000 01024955 ae09a400 00920003 070c0f0e 0c070000 00000000 00000601 ae480002 1c000a04 00010008 20000000 00000000 00000000 ... 0x2344 00002944 00000185 01ac0000 0000ffff ff00ffff 00ff0000 00000000 00000000 00000000 00000200 807f0210 1e000a04 00000001 20000000 00000000 00000000 0x2384 00002c4e 00000307 01ac0000 0000ffff ff00ffff 00ff0000 00000000 00000000 00000000 00000200 807f0210 1e000a04 00000001 20000000 00000000 00000000 0x23c4 0000325c 000003ba 01ac0000 0000b749 ff00ffff 00ffff00 00000000 00000000 00000000 00000200 807f0210 1e000a04 00000002 20000000 00000000 00000000 0x2404 00000000 ffff0010 01ac0000 00008aff ff20ae00 081c0003 070a0c00 00000000 00000000 00000101 d27a0011 1e000804 00000004 20000000 00000000 00000000 ... 0x2684 00000000 ffff0010 01ac0000 0000a013 ff50a000 02000003 07000000 00000000 00000000 00000201 800d0211 1e000a04 00000003 20000000 00000000 00000000 ... 0x2904 00000000 ffff0010 01ac0000 00005cb7 b7087700 002e0004 070c0000 00000000 00000000 00000101 807f0202 1e000a04 00000004 20000000 00000000 00000000 1st sample 0x2944 03030404 04040003 b5ce0300 ... fdfefdfe fffeffff 00ffff00 0000 2nd sample 0x2c4e 0000 ... fffffeff 000000ff ffff0000 3rd sample 0x325c 000200f9 ... 00fc0303 f90302fe 06fc0003 00000000 4th sample 0x39d0 000055d8 acebf8e4 cdf604e3 dbfa0bda ... fffefe02 fd03ff02 end 0x4d48