Without bank switching
When the eight bank bytes at +70 to +77 of the header are all zero
the data is loaded in one piece: it is read from +80 and placed from the load address
on, up to the end of the data, and nothing is switched.
With bank switching
When any of the eight bytes is not zero the tune is bank switched. The program’s address
space from $8000 to $FFFF is eight blocks of 4 KB, and the
registers $5FF8 to $5FFF each choose the bank shown in one block:
| Header | Address | Register |
|---|---|---|
+70 | $8000–$8FFF | $5FF8 |
+71 | $9000–$9FFF | $5FF9 |
+72 | $A000–$AFFF | $5FFA |
+73 | $B000–$BFFF | $5FFB |
+74 | $C000–$CFFF | $5FFC |
+75 | $D000–$DFFF | $5FFD |
+76 | $E000–$EFFF | $5FFE |
+77 | $F000–$FFFF | $5FFF |
The banks are the data in 4 KB pieces, numbered from 0, after a padding in front of it: the
number of padding bytes is the load address AND $0FFF. A load address of
$8123 puts $123 zero bytes before the first byte of the data, so that
byte appears at that offset in bank 0. The last bank may be padded out when the data ends
short of it. Before INIT is called, the player writes the eight header values to
$5FF8 to $5FFF; INIT or PLAY may switch banks later by writing the
same registers.
For METROID.NSF, whose bank bytes are all 5 and load address is $8000, there is no
padding and six banks: all eight blocks start with bank 5, which is at 5 × $1000 in the
image.
With the FDS chip
When the FDS flag is set, banks work a little differently:
- Two more registers switch the 4 KB blocks at
$6000and$7000:$5FF6and$5FF7. The header bytes+76and+77then give the first banks of both$6000to$7FFFand$E000to$FFFF, and both areas are set up the same before INIT. - The Famicom Disk System has RAM from
$6000to$DFFF, so this area is writable. Some players treat the banks as RAM that is switched, others treat a bank switch as a copy into RAM. A write may therefore show in another place that has the same bank, and may or may not remain when the bank is switched out and in, or from one song to the next. A tune must not depend on any of these.
Some FDS tunes use a load address below $8000 to fill $6000 to
$7FFF; bank switching is the recommended way, as the other is not universally
supported.
In the explorer
The Tune tab says how many banks the data fills and how many bytes of padding the first has. The
Code tab disassembles each bank separately, at the address of the block that shows it when the tune
starts (a bank that no block shows is placed at $8000). The player keeps the full image
and makes every register write to $5FF6 to $5FFF switch the blocks.
Writes to $8000 to $DFFF are ignored, except for an FDS tune, where they go
to the RAM.