Flash Hamr v8: a PicoRV32 running FatFS serves two SmartPort drives from an SD card
What I tried
Block Hamr could only serve the one image baked into flash. Flash Hamr puts a PicoRV32 soft core in the FPGA running FatFS, so the card reads disk images off a FAT32 SD card. v1 on 2026-04-07 was the core, FatFS and the SPI SD driver. v2 added a picker UI and mount-to-block-0 at 12.5 MHz SPI. v3 made CREATE and SAVE survive a cold reboot. v4 and v5 on 04-09 got on-demand SD reads working and put an SDRAM block cache in front of them, and v5.1 moved the driver into a $C800 expansion ROM. v6 and v7 on 04-10 added a four-unit SmartPort ROM, multi-drive RTL, and a Merlin picker with a mount flow. v8 on 04-11 settled on Duo Drive: two SmartPort units, D1 boot at SDRAM block 0 and D2 data at block 32768, 16 MB each, with a one-bit active_unit register the ROM writes before every transfer. The picker selects both images, mounts them, and reboots into D1. The old four-unit prototype is kept at tag v7.4-multidrive.
What I measured
- SD write timeouts had to grow to 10 M iterations of pre-busy wait and 20 M for program-complete before writes stopped failing. Persist got three retries on top.
- wait_ready in the ROM is a three-level loop with roughly a 30 s ceiling, and its counter lives on the stack.
- Two images mounted, D1 boots ProDOS, D2 catalogs and takes saves.
What broke or surprised me
Four bugs landed on 04-11 and all four looked like gateware. All four were 6502 code. wait_ready used zero page $3C for its third loop counter, which is ProDOS territory, and every boot died with a RELOCATION/CONFIGURATION ERROR. The same routine had a spurious PLA on its timeout path that popped the JSR return address and crashed into the monitor at $0CCF. ProDOS STATUS returned zero blocks with no error for an unmounted D2 and ProDOS corrupted its device tables on that answer; it now returns ERR_NODEV. And D2 STATUS was reading the D1 block-count registers, so ProDOS thought D2 was 280 blocks and crashed on the first D2 write; the fix checks bit 7 of $43 to pick the register pair.
The SDSC card I had been using threw write garbage-collection storms that broke persistence and corrupted data. SDHC only from here on.
The stale hamr_rom.mem from 04-09 is why generated artifacts now have to be in the build graph, and I check that after every build-affecting change.
The Merlin Pro disk image for the picker needs ProDOS 2.4.1; Merlin’s 1987 PRODOS misbehaves. Subdirectories go in with acx mkdir and acx import –raw.
Next
Rev 2 boards were due any day. Flash Hamr stayed on Rev 1.