Skip to main content

parse_fds

Function parse_fds 

Source
pub fn parse_fds(bytes: &[u8]) -> Result<FdsDisk, RomError>
Expand description

Parse a .fds / fwNES disk image into an FdsDisk.

Accepts:

  • The fwNES container: a 16-byte header ("FDS\x1A" + byte4 = side count), followed by side_count × FDS_SIDE_LEN-byte sides.
  • The headerless raw form: 1+ concatenated sides, the first of which opens with \x01*NINTENDO-HVC* (the disk-info block).

QD-style 65536-byte sides are accepted and truncated to the 65500-byte read window (Stage 1 does not consume CRC/gap bytes).

§Errors

  • RomError::BadMagic if the bytes are neither a fwNES container nor a recognizable raw disk side.
  • RomError::Truncated if the declared side count would run past the end of the file, or the file is too short to hold a single side.