Skip to content
Phosphoricwiki
Contents

Tapes, floppies and save states

The Oric loaded its programs from an audio tape, then from 3-inch floppies. Phosphoric does both, from the instant shortcut down to the tape signal and the timing of a real drive.

On this page

The tape

Tape programs are .tap files: the sequence of blocks the ROM would write on the tape. Phosphoric loads them in three ways:

ModeOptionHowFor whom
Direct injection-t prog.tap -fthe content is copied into memory, then the program is startedalmost everything, instantly
Patched ROM-t prog.tapthe ROM’s CLOAD, whose tape reading is patched to read the filewhat goes through the ROM
Signal level-t prog.tap --tape-signalthe real tape signal arrives on the VIA’s CB1 input, and the ROM reads it as on the machinecustom loaders and protections

Signal mode is exact to the cycle: it is clocked by the master clock, and its frame parity was corrected in 2.0 (odd, not even). It is not the default, by choice: it loads the same content in 2.4 times more cycles.

Tape handling follows several blocks, re-links a BASIC program after CLOAD, and can write (CSAVE). The tap2wav tool does the reverse: it turns a .tap into an audio file that can be played to a real Oric.

Floppies: the Microdisc

The Microdisc is a floppy interface for the Oric: a WD1793 controller, up to four drives (A to D), and a ROM that overlays the BASIC one.

oric1-emu -r roms/basic10.rom --disk-rom roms/microdis.rom -d SEDO40u.DSK

When the Microdisc takes over, the BASIC ROM disappears: $C000-$DFFF becomes RAM, and the controller’s ROM appears at $E000. The controller’s registers are at $0310-$031F.

The timing of a real drive

By default, the WD1793 follows the mechanical timing of a 3-inch drive:

  • the datasheet step rates: 6, 12, 20 or 30 ms per track;
  • rotation at 300 revolutions per minute: you wait for the sector to pass under the head;
  • “Record Not Found” after 5 index pulses without finding it.

--fdc-timing fast restores the short delays of before, for those who prefer speed.

What the controller reports

SituationWhat Phosphoric does
The processor does not read a byte within 32 µsthe LOST DATA bit is raised (and counted at the end of the session)
Write-protected floppythe write is refused, status bit 6; also deduced from a .dsk that is read-only on the host
Multi-sector read at the end of a trackends with “Record Not Found”, like the real controller
Damaged sector--bad-sector [D:]S:T:N makes it unreadable; the damage follows the floppy from drive to drive

Writes

A game’s writes stay in memory and in save states by default. With --disk-writeback, a modified floppy is written back to its .dsk file on exit, or when it is ejected from the F1 menu.

The other interface: Jasmin

The Jasmin interface uses a WD177x controller at $03F4-$03FF and a 2 KB boot ROM at $F800. It boots TDOS floppies. It excludes the Microdisc, and also the DTL 2000 and the Mageco card, which overlap the same addresses.

oric1-emu -r roms/basic11b.rom --jasmin-rom JASMIN_ROM -d DISK.DSK

The Sedoric format

Sedoric is a widespread disk system on the Oric. Its .dsk images use the MFM_DISK format: a 256-byte header (sides, tracks, geometry), then one 6,400-byte block per track, all side 0 tracks first. Each track holds its sectors with their marks and their CRC-16.

Track 20Role
sector 1the disk name and the start-up command (INIST, 60 bytes)
sector 2the allocation table: free sectors, number of files
sector 4the directory, in 16-byte entries (name, extension, track, sector, size, status)

The project’s tools make use of it: tap2sedoric puts a .tap on a floppy, sedoric-info inspects a floppy, dsk2hfe produces an HFE image for drive emulators (HxC, Gotek, Greaseweazle). See The tools.

Save states

A save state (.ost) freezes the whole machine in a binary file:

  • checked by a CRC32;
  • split into 20 section types: processor, memory, VIA, PSG, video, clock, keyboard, controller, floppies, bad sectors, tape, serial, metadata, plus one section per card (ULA-NG, Mageco, DTL 2000, Jasmin, SP0256, MEA 8000);
  • an unknown section is ignored: an older or newer file remains readable;
  • ROMs, host resources and tables that can be recomputed are not in it.

It is an exact resume point: taken mid-frame, it resumes with the same beam position, the same VIA state and the same interrupt sample as an uninterrupted run. Taken in the middle of a floppy transfer, it recomputes on loading the sector being read or written.

To doHow
Quick save, quick loadF2, F4
Save on exit, load at launch--save-state FILE, --load-state FILE
Choose from a listF1 menu, “Snapshots” line (snapshots/etatNNNN.ost)
In the browserthe .ost save and restore button

Sharing with the host

--hostfs FOLDER gives the emulated Oric access to a folder of the host computer. The LOCI cartridge also offers full mass storage (flash, USB key, SD card): see The LOCI.

Sources in the repository : README.md, docs/HARDWARE_CONFORMANCE.md, docs/SEDORIC.md, docs/TOOLS.md, docs/ACCURACY.md.