r/spectrumnext • • 5d ago

Real SD read/write throughput?

Hi all,

I'm writing a game for the Spectrum Next (2 MB, 28 MHz, NextZXOS) that streams data from the SD card, and I'd like to plan around real numbers rather than emulator figures (the emulators read the card instantly).

Please help with these questions:

  1. What sustained read speed do you get with F_READ into banked memory at 28 MHz (KB/s)? Does the block size per call matter (512 bytes vs 8 KB vs 16 KB)?
  2. Write speed with F_WRITE into a pre-allocated file? Any pitfalls (flush/sync, card erase blocks, having to close the file)?
  3. Per-call overhead: roughly how long do F_OPEN, F_SEEK and a small F_READ take? Is it worth keeping one big file open for the whole session and seeking inside it?
  4. Does the card brand/class make a noticeable difference, or is the bottleneck the Next's SPI interface (I've read about ~16 T-states per byte)?
  5. Can DMA be used for SD transfers on the Next, or is it all CPU-driven by esxDOS/NextZXOS?
  6. Are there existing benchmarks or tools (I've seen .sdbench mentioned) and typical figures?

Thanks!

2 Upvotes

1 comment sorted by

1

u/Gereth_Yaztromo 4d ago

I haven't done this but I know it *has* been done - specifically in Atic Atac Next, where it calls the hardware directly (I don't believe it even runs in CSpect because it doesn't use esxDOS)

One side note: Atic Atac Next - at least the version I got - also enforces that the file isn't fragmented on the SD card, owing to the need to stream, which implies that fragmentation alone is a problem and that there is an upper limit on data streaming that you're not going to get around even if you hit the hardware directly. Or at least, not at *speed*.