libspectrum(3)

πŸ’– libspectrum(3) β€” the Emulators section, bestie πŸ’–

okay so you found the man page for libspectrum, the Sinclair ZX Spectrum support library, and I am so glad you're here because this thing is iconic and also kind of a lot. Manual section 3, we love her. πŸŽ€


✨ NAME ✨

libspectrum β€” Sinclair ZX Spectrum support library


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libspectrum.h>

libspectrum_error libspectrum_init( void );
void libspectrum_end( void );
libspectrum_error libspectrum_identify_file( libspectrum_id_t *type,
const char *filename, const unsigned char *buffer, size_t length );
libspectrum_error libspectrum_snap_read( libspectrum_snap *snap, const
libspectrum_byte *buffer, size_t length, libspectrum_id_t type, const
char *filename );
libspectrum_error libspectrum_tape_read( libspectrum_tape *tape, const
libspectrum_byte *buffer, size_t length, libspectrum_id_t type, const
char *filename );
libspectrum_error libspectrum_rzx_read( libspectrum_rzx *rzx, const
libspectrum_byte *buffer, size_t length );

and there's a whole extra pile of public helper APIs, all documented over in libspectrum.txt, bestie, including:

  • the zlib helpers libspectrum_zlib_inflate() and libspectrum_zlib_compress()
  • the allocation helper macros libspectrum_new, libspectrum_new0 and libspectrum_renew
  • the growable buffer API, libspectrum_buffer_alloc() through libspectrum_buffer_append()
  • RZX signature inspection helpers like libspectrum_rzx_get_keyid() and libspectrum_rzx_get_signature()
  • state/query helpers like libspectrum_tape_state() and libspectrum_ide_dirty()

like, the range. the versatility. we stan. πŸ’…


🌸 DESCRIPTION 🌸

libspectrum is a library for reading and writing some of the file formats used by emulators of the Sinclair ZX Spectrum. and not just that β€” it also has routines serving up info about all the various Spectrum clones that were out there in the wild. history lesson AND a library, no cap. πŸ“šβœ¨

the file formats it currently supports are:

  • Snapshots: .z80, .szx, .sna (all read/write), and .zxs, .sp., .snp and +D snapshots (read only).
  • Tape images: .tzx, .tap, .spc, .sta, .ltp (read/write) and .pzx, Warajevo .tap, Z80Em and CSW version 1 (read only).
  • Input recordings: .rzx (read/write).
  • Disk images: .dsk (both plain and extended), .d40, .d80, .fdi, .img, .mgt, .opd, .sad, .scl, .td0, .trd and .udi (identification only).
  • Timex cartridges: .dck (read only).
  • IDE hard disk images: .hdf (read/write).
  • Microdrive cartridge images: .mdr (read/write).

and the chef's kiss part: any files compressed with bzip2(3), gzip(3) or zip(3) can be read, and they'll get transparently decompressed for you. she just handles it. πŸ‘‘

real talk though β€” the full documentation for libspectrum lives in libspectrum.txt. this page is the vibe check, that file is the whole syllabus. πŸ“–

πŸ’€ SEE ALSO πŸ’€

also the comp.sys.sinclair Spectrum FAQ, sitting pretty at http://www.worldofspectrum.org/faq/index.html β€” go read it, fr fr. 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Philip Kendall (philip-fuse@shadowmagic.org.uk)


and that's the whole page, bestie!! πŸ’œ this was Version 1.6.3, dated 25th July, 2026, and yes I'm mentioning it here instead of copying the footer line, because we keep the facts but ditch the boring formatting. mwah. πŸ’…πŸ«Ά

πŸ“¦ where this page comes from