A2VERA · Apple //e · VERA SD/MMC SPI

Four tools.
One SD card.

A hex sector editor, a FAT32 formatter, a resident ProDOS block driver and a preliminary FAT32 client — written in pure 6502 and talking straight to the VERA card’s SD/MMC SPI. Every disk boots here, in your browser.

Each link opens Apple2TS in a new tab with VERA in slot 2 and a disposable SD card image already mounted, streamed from this repository. The first boot pulls that card from GitHub — 128 MiB FAT32 for the editor, formatter, and FAT32 client, 32 MiB ProDOS for the block driver — so give it a few seconds; click the emulator once for keyboard focus and audio.

  • 4 bootable disks
  • 32-bit LBA
  • 65,535 ProDOS blocks
  • 128 MiB FAT32 test card
VeraSDEdit in AppleWin: the LBA 800 FAT32 boot sector drawn as 16 hex bytes and an ASCII dump, with the editor cursor flashing in the ASCII pane
verasdedit.po — LBA 800hex + ASCII · 80 columns

The toolkit

Four bootable disks, four jobs

All four are bootable ProDOS 2.4.3 volumes that probe the VERA card in slot 2 ($C200) then slot 4 ($C400) and address the SPI registers at base+$1E / base+$1F. Run them from the floppy image, or from a directory on your own ProDOS disk.

verasdedit.po

140 KiB · floppy
VeraSDEdit showing its hex and ASCII view of a FAT32 boot sector

A PC-Tools-style sector browser and editor. Reads any 32-bit LBA over SPI, shows the 512-byte sector as hex + ASCII across two 256-byte pages, and writes the whole sector back with CMD24. Boot volume VERASDEDIT.

  • 6502
  • Hex + ASCII
  • 32-bit LBA
  • CMD24 writes

verasdformat.po

140 KiB · floppy
VeraSDFormat progress screen: stages 00 to 10 each at 100 percent, followed by five OK verification lines and PASS

Formats a VERA SD image to FAT32 for CMDR-DOS and A2VERA: MBR partition type $0C at LBA 2048, VBR, FSInfo, both FATs, then a clean root cluster. Format and Verify share the same metadata templates. Boot volume VERASDFORMAT.

  • MBR + FAT32
  • 11 stages
  • CMD24 only
  • Verify pass

VeraSD-IFS-ProDOS.po

boot disk + 32 MiB card
Bitsy Bye catalog on the ProDOS boot disk with VERASD.SYSTEM selected

A resident ProDOS 8 block driver. Mounts a raw ProDOS SD image as a normal volume of up to 65,535 blocks, stays installed after BYE, and hands the boot chain on to the next .SYSTEM. Boot volume VERASDIFSPRODOS.

  • ProDOS 8
  • 32 MiB volume
  • Language-card bank 2
  • Copy II Plus

VeraSD-IFS-FAT32.po

boot disk + 128 MiB card
FAT32 client screen: mounted sector count, a root 8.3 catalog with HELLO.TXT and TESTNOW.BIN, and an ASCII checksum line

The preliminary FAT32 client: catalogs root 8.3 names, reads a file and overwrites a preallocated test file on cards larger than ProDOS can address. It is a standalone test app, not yet an IFS driver. Boot volume VERASDIFSFAT32.

  • WIP
  • Raw FAT32
  • 128 MiB fixture
  • Read / write test

verasdedit.po · LBA 800

The sector editor

The card is addressed as 512-byte sectors, so the editor speaks the same language as a partition table, a FAT32 VBR or a Boot II sector. It opens on LBA 800 and reads the card’s CSD register through CMD9 at startup to show the true sector total.

  • Toggle page (256-byte halves)Space
  • Next sector — wraps from the last to 0N
  • Previous sector — wraps from 0 to total − 1P
  • Reload the current sectorR
  • Select an LBA (1–8 hex digits)L
  • Enter editor modeE
  • Back to ProDOS, clear screenQ
Display

Inverse and flash, not a guess

A byte shows inverse only if it differs from the last loaded sector. The cursor nibble or ASCII character always flashes, so the position stays visible even on an edited byte. Editing a byte back to its original value clears the inverse.

Safety

Did the card change?

Before writing, the editor re-reads the LBA and compares it with the buffer it loaded. If the card was swapped, it asks SD Card Changed. Force Write (y/n)? instead of applying the old card’s sector to the new image.

Recovery

Write-protect and retry

The data-response token separates a protected card ($0D, shown as SD Write Protected!) from a genuine failure. A generic failure re-runs SD init once before reporting SD Write failed!.


verasdformat.po · menu 1–3

Build a FAT32 volume, then prove it

The formatter writes an MBR first, then builds the FAT32 metadata inside the partition at LBA 2048. Free-space stages use one CMD24 per sector, because Apple2TS implements CMD24 but not CMD25.

Eleven stages of a quick format
#StageWhat it writes
00Master boot recordPartition type $0C starting at LBA 2048
01Boot sectorFAT32 VBR: sectors/cluster, reserved count, FAT size
02FSInfoFree-cluster and next-free hints
03Boot sector backupThe VBR copy at the end of the reserved area
04FSInfo backupThe matching backup FSInfo sector
05FAT 1, first sectorMedia descriptor and first allocated clusters
06FAT 1, free spaceZeroes through the free-cluster hint
07FAT 2, first sectorThe second FAT starts with identical entries
08FAT 2, free spaceZeroes through the second copy
09Erase root directoryFirst root-cluster sector, keeping the volume label
10Erase root remainderEvery remaining sector of the root cluster

Two ways to reach a card

A ProDOS volume, or a FAT32 filesystem

One path makes the SD image look like a normal ProDOS disk, limited to 65,535 blocks. The other reaches past the 32 MiB boundary and speaks FAT32 directly — but it is not a ProDOS device yet.

VeraSD-IFS-ProDOS

resident driver

A ProDOS 8 block driver in language-card bank 2 at $D400, with its common bridge at $FF00. After installation the SD volume is catalogued like any other ProDOS disk, and it survives BYE.

  • 65,535 blocks (about 32 MiB) per raw ProDOS image.
  • SDHC block addressing and SDSC byte addressing, VERA in slot 2 or 4.
  • Reads starting below page $CE write straight into the caller’s buffer and poll SPI inline; reads at $CE00 and above keep the bank-switching path.
  • VERASD.SYSTEM is type $FF (SYS); VERASD.BIN is type $06 for BRUN.
  • After the result, the SYS helper loads the next root .SYSTEM; QUIT.SYSTEM sits last in the catalog.
VERASDIFSPRODOS 65,535 blocks Copy II Plus 8.4

VeraSD-IFS-FAT32

WIP / preliminary

A standalone ProDOS-launched client for raw FAT32 or the first FAT32 MBR partition. It reaches the 128 MiB fixture and its fragmented files beyond the ProDOS 32 MiB limit, but does not register a ProDOS disk device.

  • C catalog root 8.3 names and sizes.
  • R read a named file; show its size, first bytes and checksum.
  • W then Y overwrite the preallocated 1,024-byte TESTNOW.BIN.
  • Q return to BASIC.
  • Still missing: create, allocate, append/resize, delete, rename, subdirectories, long names and a ProDOS file interface.
VERASDIFSFAT32 128 MiB fixture BRUN FAT32.SYSTEM

Under the hood

Everything is 6502, ProDOS MLI and SPI

There is no host-side disk driver: the same binaries run on a real Apple IIe with a VERA card. The hard-won details below are why the tools work on both emulators and hardware.

Display

80 columns interleave AUX and MAIN

Each 40-address text-page cell renders AUX on the left and MAIN on the right, so PUTCH swaps banks every character. Without it the editor’s hex columns land in the wrong half of the screen.

Banking

RAMWRT leaks out of the display code

$0200–$BFFF follows the RAMWRT/RAMRD soft switches. Any routine that writes scratch or FAT metadata after a display call has to force RAMWRTOFF first, or the values land in the auxiliary bank and the output turns to garbage.

SPI

512 bytes without a call per byte

Sector reads and CMD24 writes poll the SPI status register inline in their transfer loops. At the compatible 390 kHz clock the gain is lower CPU overhead, not a faster bus; buffer and timeout behaviour stays unchanged.

Assembler

Two traps in the vendored 6502 assembler

CPX/CPY must choose zero-page for ZP labels (a missing mode broke LBA entry), and AND/ORA must never take an indexed-Y operand — the assembler silently assembled that as address $0000. Bit masks are shifted, not looked up.


Build it

One dependency, everything else vendored

The 6502 assembler, the Applesoft compiler, the shared ProDOS base disk, the volume-name writer and the file-date writer all live in this repository. Node.js is the only external requirement.

REM needs Node.js only
git clone https://github.com/anomixer/verasdtool
cd verasdtool

build.bat all                       REM editor + formatter + FAT32 + ProDOS
node src/verasd-prodos/verasd.mjs     REM one target at a time

npm run test:prodos                 REM 20 driver cases + installer cases
npm run test:fat32                  REM 25 assembled-client cases
  • build.bat verasdedit, verasdformat, fat32, prodos or all picks a target.
  • The ProDOS builder accepts --boot-output=<path>; --reset-sd recreates the SD image, so use it only on disposable data.
  • The FAT32 fixture is rebuilt with python src/verasd-fat32/fat32-fixture.py, which refuses to overwrite an existing image.
  • Tests need Python and py65; the optional check_fat32_image.py uses pyfatfs.
  • Boot disks and card archives are tracked; raw 32 MiB and 128 MiB .img files stay out of git.