pub struct Nsf {Show 15 fields
pub total_songs: u8,
pub starting_song: u8,
pub load_addr: u16,
pub init_addr: u16,
pub play_addr: u16,
pub bankswitched: bool,
pub initial_banks: [u8; 8],
pub expansion: u8,
pub pal: bool,
pub play_speed_ntsc: u16,
pub play_speed_pal: u16,
pub prg: Vec<u8>,
pub song_name: Box<str>,
pub artist: Box<str>,
pub copyright: Box<str>,
}Expand description
Parsed NSF header + program image.
Fields§
§total_songs: u8Total number of songs in the file (1-based count).
starting_song: u8The 1-based song the file wants to start on.
load_addr: u1616-bit load address of the program image.
init_addr: u16init routine address (called once per track with A = song index).
play_addr: u16play routine address (called once per frame).
bankswitched: booltrue when the file uses $5FF8-$5FFF 4 KiB bank switching.
initial_banks: [u8; 8]Initial bank register values ($070-$077 of the header).
expansion: u8Expansion-chip bitfield ($07B). Routed into the matching synth cores
by the nsf_expansion module when any bit is set (v1.7.0 G2/G3).
pal: booltrue when the file declares a PAL or dual-region timing preference.
play_speed_ntsc: u16NTSC play-speed divider (header $6E-$6F), in microseconds per play
call. 0 means “use the hardware default” (≈16639 µs ≈ 60.0988 Hz).
Classic NESM only; NSFe has no µs word and derives the rate from region.
play_speed_pal: u16PAL play-speed divider (header $78-$79), in microseconds per play
call. 0 means the PAL hardware default (≈19997 µs ≈ 50.007 Hz).
prg: Vec<u8>The program image, padded + 4 KiB-aligned when bank-switched.
song_name: Box<str>UTF-8-lossy song / artist / copyright strings (trimmed at the first NUL).
artist: Box<str>Artist name.
copyright: Box<str>Copyright holder.
Implementations§
Source§impl Nsf
impl Nsf
Sourcepub const fn effective_speed_us(&self) -> u16
pub const fn effective_speed_us(&self) -> u16
The effective play-speed divider (µs) this file wants, resolving a 0
header word to the region hardware default and picking NTSC vs PAL by the
region flag.
Sourcepub fn nonstandard_play_period_cycles(&self) -> Option<u32>
pub fn nonstandard_play_period_cycles(&self) -> Option<u32>
The play period in NTSC CPU cycles, or None when the file plays at
the standard once-per-NTSC-frame 60 Hz rate (the fast, vblank-NMI-driven
path). Some(cycles) selects the cycle-timer IRQ driver — a PAL tune
(50 Hz) or any custom divider on the NTSC console.