| 1 |
# ROM export technical details |
| 2 |
|
| 3 |
## instrument data |
| 4 |
|
| 5 |
TODO |
| 6 |
|
| 7 |
## macro data |
| 8 |
|
| 9 |
read length, loop and then release (1 byte). |
| 10 |
if it is a 2-byte macro, read a dummy byte. |
| 11 |
|
| 12 |
then read data. |
| 13 |
|
| 14 |
## binary command stream |
| 15 |
|
| 16 |
this is the Furnace Command Stream specification. |
| 17 |
all numbers are little-endian unless the "big-endian mode" flag is set. |
| 18 |
|
| 19 |
``` |
| 20 |
size | description |
| 21 |
-----|------------------------------------ |
| 22 |
4 | "FCS\0" format magic |
| 23 |
2 | channel count |
| 24 |
1 | flags |
| 25 |
| - bit 1: big-endian mode |
| 26 |
| - bit 0: pointer size (off: short; on: long) |
| 27 |
1 | reserved |
| 28 |
1?? | preset delays |
| 29 |
| - 16 values |
| 30 |
1?? | speed dial commands |
| 31 |
| - 16 values |
| 32 |
??? | pointers to channel data |
| 33 |
| - pointers are short (2-byte) or long (4-byte), set in flags |
| 34 |
1?? | maximum stack size per channel |
| 35 |
| - length: channel count |
| 36 |
??? | channel data |
| 37 |
``` |
| 38 |
|
| 39 |
program follows. |
| 40 |
|
| 41 |
### commands/instructions |
| 42 |
|
| 43 |
command parameters (including their types) are indicated within parentheses. for example, (cs) means "read a char (8-bit) and a short (16-bit)". |
| 44 |
|
| 45 |
the types are: |
| 46 |
|
| 47 |
- `c`: signed char |
| 48 |
- `s`: signed short (16-bit) |
| 49 |
- `i`: signed int (32-bit) |
| 50 |
- `b`: unsigned char (byte) |
| 51 |
- `S`: unsigned short |
| 52 |
- `U`: unsigned int |
| 53 |
- `X`: custom (described under the command name) |
| 54 |
|
| 55 |
|
| 56 |
the command list follows. |
| 57 |
|
| 58 |
``` |
| 59 |
hex | description |
| 60 |
----|------------------------------------ |
| 61 |
00 | note on: C-(-5) |
| 62 |
01 | note on: C#(-5) |
| 63 |
02 | note on: D-(-5) |
| 64 |
.. | ... |
| 65 |
b1 | note on: A-9 |
| 66 |
b2 | note on: A#9 |
| 67 |
b3 | note on: B-9 |
| 68 |
b4 | note on: null |
| 69 |
----|------------------------------------ |
| 70 |
b5 | note off |
| 71 |
b6 | note off env |
| 72 |
b7 | env release |
| 73 |
b8 | instrument (b) |
| 74 |
c0 | pre porta (X) |
| 75 |
| - bit 7: inPorta |
| 76 |
| - bit 6: isPortaOrSlide |
| 77 |
c1 | arpeggio speed (b) |
| 78 |
c2 | vibrato (X) |
| 79 |
| - bit 4-7: speed |
| 80 |
| - bit 0-3: depth |
| 81 |
c3 | vibrato range (b) |
| 82 |
c4 | vibrato shape (b) |
| 83 |
c5 | pitch (c) |
| 84 |
c6 | arpeggio (X) |
| 85 |
| - bit 4-7: note 1 |
| 86 |
| - bit 0-3: note 2 |
| 87 |
c7 | volume (b) |
| 88 |
c8 | vol slide (s) |
| 89 |
c9 | porta (bb) // target, speed |
| 90 |
ca | legato (b) // note... $ff is null note |
| 91 |
cb | volume slide with target (sS) // amount, target |
| 92 |
cc | tremolo (X) |
| 93 |
| - bit 4-7: speed |
| 94 |
| - bit 0-3: depth |
| 95 |
cd | panbrello (X) |
| 96 |
| - bit 4-7: speed |
| 97 |
| - bit 0-3: depth |
| 98 |
ce | pan slide (c) |
| 99 |
cf | panning (bb) // left, right |
| 100 |
----|------------------------------------ |
| 101 |
d0 | UNUSED - placeholder used during optimization passes (3-byte nonce follows) |
| 102 |
d1 | no operation |
| 103 |
d2 | UNUSED |
| 104 |
d3 | UNUSED |
| 105 |
d4 | UNUSED - call symbol (32-bit index follows; only used internally) |
| 106 |
d5 | call sub-block (32-bit address follows) |
| 107 |
d6 | note off + wait one tick |
| 108 |
d7 | full command (command and data follows) |
| 109 |
d8 | call sub-block (16-bit address follows) |
| 110 |
d9 | return from sub-block |
| 111 |
da | jump (address follows) |
| 112 |
db | set tick rate (4 bytes) |
| 113 |
dc | wait (16-bit) |
| 114 |
dd | wait (8-bit) |
| 115 |
de | wait one tick |
| 116 |
df | stop |
| 117 |
----|------------------------------------ |
| 118 |
e0 | speed dial command 0 |
| 119 |
e1 | speed dial command 1 |
| 120 |
.. | ... |
| 121 |
ef | speed dial command 15 |
| 122 |
----|------------------------------------ |
| 123 |
f0 | preset delay 0 |
| 124 |
f1 | preset delay 1 |
| 125 |
.. | ... |
| 126 |
ff | preset delay 15 |
| 127 |
``` |
| 128 |
|
| 129 |
## full commands |
| 130 |
|
| 131 |
``` |
| 132 |
hex | description |
| 133 |
----|------------------------------------ |
| 134 |
1c | sample mode (b) |
| 135 |
1d | sample freq (b) |
| 136 |
1e | legacy sample bank (b) |
| 137 |
1f | sample position (U) |
| 138 |
20 | sample direction (b) |
| 139 |
----|------------------------------------ |
| 140 |
| **FM commands** |
| 141 |
21 | hard reset (b) |
| 142 |
22 | LFO speed (b) |
| 143 |
23 | LFO waveform (b) |
| 144 |
24 | TL (bb) |
| 145 |
25 | AM (bb) |
| 146 |
26 | AR (bb) |
| 147 |
27 | DR (bb) |
| 148 |
28 | SL (bb) |
| 149 |
29 | D2R (bb) |
| 150 |
2a | RR (bb) |
| 151 |
2b | DT (bb) |
| 152 |
2c | DT2 (bb) |
| 153 |
2d | RS (bb) |
| 154 |
2e | KSR (bb) |
| 155 |
2f | VIB (bb) |
| 156 |
30 | SUS (bb) |
| 157 |
31 | WS (bb) |
| 158 |
32 | SSG-EG (bb) |
| 159 |
33 | REV (bb) |
| 160 |
34 | EG-Shift (bb) |
| 161 |
35 | FB (b) |
| 162 |
36 | MULT (bb) |
| 163 |
37 | FINE (bb) |
| 164 |
38 | fixed frequency (XX) |
| 165 |
| - byte 0: frequency low |
| 166 |
| - byte 1: |
| 167 |
| - bit 4-5: operator |
| 168 |
| - bit 0-2: frequency high |
| 169 |
39 | ExtCh (b) |
| 170 |
3a | AM depth (b) |
| 171 |
3b | PM depth (b) |
| 172 |
3c | LFO2 speed (b) |
| 173 |
3d | LFO2 wave (b) |
| 174 |
----|------------------------------------ |
| 175 |
| **PSG commands** |
| 176 |
3e | noise freq (b) |
| 177 |
3f | noise mode/duty/whatever (b) |
| 178 |
40 | waveform (b) |
| 179 |
----|------------------------------------ |
| 180 |
| **Game Boy commands** |
| 181 |
41 | sweep time (b) |
| 182 |
42 | sweep direction (b) |
| 183 |
----|------------------------------------ |
| 184 |
| **PC Engine commands** |
| 185 |
43 | LFO mode (b) |
| 186 |
44 | LFO speed (b) |
| 187 |
----|------------------------------------ |
| 188 |
| **NES commands** |
| 189 |
45 | sweep (X) |
| 190 |
| - bit 3: on |
| 191 |
| - rest of bits: sweep time/amount |
| 192 |
46 | set DMC (b) |
| 193 |
----|------------------------------------ |
| 194 |
| **C64 commands** |
| 195 |
47 | coarse cutoff (b) |
| 196 |
48 | resonance (b) |
| 197 |
49 | filter mode (b) |
| 198 |
4a | reset time (b) |
| 199 |
4b | reset mask (b) |
| 200 |
4c | filter reset (b) |
| 201 |
4d | duty reset (b) |
| 202 |
4e | extended (b) |
| 203 |
4f | duty (S) |
| 204 |
50 | cutoff (S) |
| 205 |
----|------------------------------------ |
| 206 |
| **AY commands** |
| 207 |
51 | set envelope (b) |
| 208 |
52 | envelope freq low (b) |
| 209 |
53 | envelope freq high (b) |
| 210 |
54 | envelope slide (b) |
| 211 |
55 | noise AND mask (b) |
| 212 |
56 | noise OR mask (b) |
| 213 |
57 | auto envelope (b) |
| 214 |
58 | I/O port write (bb) |
| 215 |
59 | AutoPWM (bb) |
| 216 |
----|------------------------------------ |
| 217 |
| **FDS commands** |
| 218 |
5a | mod depth (b) |
| 219 |
5b | mod speed high (b) |
| 220 |
5c | mod speed low (b) |
| 221 |
5d | mod position (b) |
| 222 |
5e | mod waveform (b) |
| 223 |
----|------------------------------------ |
| 224 |
| **SAA1099 commands** |
| 225 |
5f | envelope (b) |
| 226 |
----|------------------------------------ |
| 227 |
| **Amiga commands** |
| 228 |
60 | toggle filter (b) |
| 229 |
61 | AM (b) |
| 230 |
62 | period modulation (b) |
| 231 |
----|------------------------------------ |
| 232 |
| **Lynx commands** |
| 233 |
63 | load LFSR (S) |
| 234 |
----|------------------------------------ |
| 235 |
| **QSound commands** |
| 236 |
64 | echo feedback (b) |
| 237 |
65 | echo delay (S) |
| 238 |
66 | echo level (b) |
| 239 |
67 | surround (b) |
| 240 |
----|------------------------------------ |
| 241 |
| **X1-010 commands** |
| 242 |
68 | envelope shape (b) |
| 243 |
69 | UNUSED - envelope enable (b) |
| 244 |
6a | envelope mode (b) |
| 245 |
6b | envelope period (b) |
| 246 |
6c | envelope slide (b) |
| 247 |
6d | auto envelope (b) |
| 248 |
6e | sample bank slot (b) |
| 249 |
----|------------------------------------ |
| 250 |
| **WonderSwan commands** |
| 251 |
6f | sweep time (b) |
| 252 |
70 | sweep amount (b) |
| 253 |
----|------------------------------------ |
| 254 |
| **Namco 163 commands** |
| 255 |
71 | wave position (b) |
| 256 |
72 | wave length (b) |
| 257 |
73 | UNUSED (b) |
| 258 |
74 | UNUSED (b) |
| 259 |
75 | wave load position (b) |
| 260 |
76 | wave load length (b) |
| 261 |
77 | UNUSED (b) |
| 262 |
78 | channel limit (b) |
| 263 |
79 | global wave load (b) |
| 264 |
7a | global wave load position (b) |
| 265 |
7b | UNUSED (b) |
| 266 |
7c | UNUSED (b) |
| 267 |
----|------------------------------------ |
| 268 |
| **Sound Unit commands** |
| 269 |
7d | sweep period low (bb) |
| 270 |
7e | sweep period high (bb) |
| 271 |
7f | sweep bound (bb) |
| 272 |
80 | sweep enable (bb) |
| 273 |
81 | sync period low (b) |
| 274 |
82 | sync period high (b) |
| 275 |
----|------------------------------------ |
| 276 |
83 | ADPCM-A volume (b) |
| 277 |
----|------------------------------------ |
| 278 |
| **SNES commands** |
| 279 |
84 | echo (b) |
| 280 |
85 | pitch mod (b) |
| 281 |
86 | invert (b) |
| 282 |
87 | gain mode (b) |
| 283 |
88 | gain (b) |
| 284 |
89 | echo enable (b) |
| 285 |
8a | echo delay (b) |
| 286 |
8b | echo vol left (c) |
| 287 |
8c | echo vol right (c) |
| 288 |
8d | echo feedback (c) |
| 289 |
8e | echo filter (bc) |
| 290 |
----|------------------------------------ |
| 291 |
| **NES commands (continued)** |
| 292 |
8f | envelope mode (b) |
| 293 |
90 | length counter (b) |
| 294 |
91 | frame counter rate/count mode (b) |
| 295 |
----|------------------------------------ |
| 296 |
| **macro control** |
| 297 |
92 | macro off (b) |
| 298 |
93 | macro on (b) |
| 299 |
----|------------------------------------ |
| 300 |
94 | surround panning (bb) |
| 301 |
----|------------------------------------ |
| 302 |
| **FM commands (continued)** |
| 303 |
95 | AM depth 2 (b) |
| 304 |
96 | PM depth 2 (b) |
| 305 |
----|------------------------------------ |
| 306 |
| **ES5506 commands** |
| 307 |
97 | filter mode (b) |
| 308 |
98 | filter K1 (SS) |
| 309 |
99 | filter K2 (SS) |
| 310 |
9a | filter K1 slide (bb) |
| 311 |
9b | filter K2 slide (bb) |
| 312 |
9c | envelope count (S) |
| 313 |
9d | envelope left vol ramp (b) |
| 314 |
9e | envelope right vol ramp (b) |
| 315 |
9f | envelope K1 ramp (bb) |
| 316 |
a0 | envelope K2 ramp (bb) |
| 317 |
a1 | pause (b) |
| 318 |
----|------------------------------------ |
| 319 |
| **SNES commands (continued)** |
| 320 |
a3 | global vol left (c) |
| 321 |
a4 | global vol right (c) |
| 322 |
----|------------------------------------ |
| 323 |
a5 | NES linear counter length (b) |
| 324 |
----|------------------------------------ |
| 325 |
a6 | external command (b) |
| 326 |
----|------------------------------------ |
| 327 |
| **C64 commands (continued)** |
| 328 |
a7 | attack/decay (X) |
| 329 |
| - bit 4-7: attack |
| 330 |
| - bit 0-3: decay |
| 331 |
a8 | sustain/release (X) |
| 332 |
| - bit 4-7: sustain |
| 333 |
| - bit 0-3: release |
| 334 |
----|------------------------------------ |
| 335 |
| **ESFM commands** |
| 336 |
a9 | operator panning (bb) |
| 337 |
aa | output level (bb) |
| 338 |
ab | modulation input (bb) |
| 339 |
ac | envelope delay (bb) |
| 340 |
----|------------------------------------ |
| 341 |
ad | restart macro (b) |
| 342 |
----|------------------------------------ |
| 343 |
| **PowerNoise commands** |
| 344 |
ae | load counter (bb) |
| 345 |
af | I/O write (bb) |
| 346 |
----|------------------------------------ |
| 347 |
| **Dave commands** |
| 348 |
b0 | high pass (b) |
| 349 |
b1 | ring mod (b) |
| 350 |
b2 | swap counters (b) |
| 351 |
b3 | low pass (b) |
| 352 |
b4 | clock divider (b) |
| 353 |
----|------------------------------------ |
| 354 |
b5 | MinMod echo setup (b) |
| 355 |
----|------------------------------------ |
| 356 |
| **Bifurcator commands** |
| 357 |
b6 | state load (bb) |
| 358 |
b7 | set parameter (bb) |
| 359 |
----|------------------------------------ |
| 360 |
b8 | FDS auto mod (b) |
| 361 |
----|------------------------------------ |
| 362 |
b9 | FM operator mask (b) |
| 363 |
----|------------------------------------ |
| 364 |
| **MultiPCM commands** |
| 365 |
ba | mix FM (b) |
| 366 |
bb | mix PCM (b) |
| 367 |
bc | LFO (b) |
| 368 |
bd | VIB (b) |
| 369 |
be | AM (b) |
| 370 |
bf | AR (b) |
| 371 |
c0 | D1R (b) |
| 372 |
c1 | DL (b) |
| 373 |
c2 | D2R (b) |
| 374 |
c3 | RC (b) |
| 375 |
c4 | RR (b) |
| 376 |
c5 | damp (b) |
| 377 |
c6 | pseudo-reverb (b) |
| 378 |
c7 | LFO reset (b) |
| 379 |
c8 | level direct (b) |
| 380 |
----|------------------------------------ |
| 381 |
| **SID3 commands** |
| 382 |
c9 | special wave (b) |
| 383 |
ca | ring mod source (b) |
| 384 |
cb | hard sync source (b) |
| 385 |
cc | phase mod source (b) |
| 386 |
cd | wave mix (b) |
| 387 |
ce | LFSR feedback bits (bb) |
| 388 |
cf | 1-bit noise (b) |
| 389 |
d0 | filter distortion (bb) |
| 390 |
d1 | filter output volume (bb) |
| 391 |
d2 | channel invert (b) |
| 392 |
d3 | filter connection (b) |
| 393 |
d4 | filter matrix (b) |
| 394 |
d5 | filter enable (b) |
| 395 |
----|------------------------------------ |
| 396 |
| **slide commands** |
| 397 |
d6 | pulse width slide (bc) |
| 398 |
d7 | cutoff slide (bc) |
| 399 |
----|------------------------------------ |
| 400 |
| **SID3 commands (continued)** |
| 401 |
d8 | phase reset (b) |
| 402 |
d9 | noise phase reset (b) |
| 403 |
da | envelope reset (b) |
| 404 |
db | cutoff scaling (b) |
| 405 |
dc | resonance scaling (b) |
| 406 |
----|------------------------------------ |
| 407 |
dd | WonderSwan speaker volume (b) |
| 408 |
----|------------------------------------ |
| 409 |
| **FM commands (continued)** |
| 410 |
de | ALG (b) |
| 411 |
df | FMS (b) |
| 412 |
e0 | AMS (b) |
| 413 |
e1 | FMS2 (b) |
| 414 |
e2 | AMS2 (b) |
| 415 |
``` |