The conversion tools
Six C tools and a few scripts come with the emulator. They make tapes and floppies, inspect them, and go as far as the signal you can play to a real Oric.
Overview
make tools builds the six tools; each one also builds on its own (make tap2wav, for example).
| Tool | Input → output | Role |
|---|---|---|
bas2tap | .bas → .tap | a BASIC program as text becomes a tape |
bin2tap | .bin → .tap | a machine-code binary becomes a tape, with its addresses |
tap2sedoric | .tap + base floppy → .dsk | puts a program on a Sedoric floppy |
sedoric-info | .dsk → text | inspects a Sedoric floppy’s allocation table and directory |
tap2wav | .tap → .wav | the tape signal, to play to a real Oric |
dsk2hfe | .dsk → .hfe | a magnetic image to write a real floppy |
bas2tap and bin2tap
bas2tap game.bas -o game.tap --auto-run
bin2tap demo.bin --start 0x9800 --exec 0x9800 -o demo.tap --name DEMO
bas2tap tokenises the program and writes the 9-byte tape header the ROM reads; --auto-run makes it
start after CLOAD. bin2tap takes the load and execution addresses; beware, --start reads numbers
like strtol in base 0: hexadecimal needs the 0x prefix.
tap2sedoric and sedoric-info
tap2sedoric game.tap -o game.dsk -b master.dsk -n GAME.COM -a
sedoric-info game.dsk
sedoric-info game.dsk --check 640:3
tap2sedoric copies a base floppy (in MFM_DISK format) and stores the program on it as a Sedoric
file: -a makes it automatic, -e gives an execution address, -i the floppy’s start-up command.
sedoric-info --check FREE:FILES exits with an error if the counters differ: a safeguard for the CI.
tap2wav: towards a real tape
tap2wav game.tap game.wav
# play game.wav into the Oric's tape input, then type CLOAD""
The tool produces the Oric’s real tape signal, with the same encoding as the emulator’s signal-mode
generator, modelled on the ROM’s CSAVE:
- a 14-bit frame, least significant bit first: a start bit, 8 data bits, an odd parity, 4 stop bits;
- each bit is a low half-pulse of 208 cycles, then a high half-pulse of 208 cycles (bit 1) or 416 cycles (bit 0), at 1 MHz; the ROM tells them apart around 512 cycles.
| Option | Default | Effect |
|---|---|---|
--rate | 44,100 | sample rate (Hz) |
--leader | 512 | 0x16 sync frames at the start |
--amp | 16,000 | peak amplitude |
--lead-silence, --tail-silence | 200, 500 | silences before and after (ms) |
dsk2hfe: towards a real floppy
dsk2hfe game.dsk game.hfe
# copy game.hfe to the SD card of an HxC or a Gotek, or write it with a Greaseweazle
The tool encodes each track as an MFM stream (16 cells per byte, with the standard sync marks) and
writes an HFE v1 image, the format read and written by HxC drive emulators, Gotek drives under
FlashFloppy and Greaseweazle. Options: --bitrate (250 kbit/s) and --rpm (300).
The image is checked before anything is written: MFM_DISK signature, one or two sides, 1 to 84
tracks, a long enough file. A refused image leaves an existing .hfe untouched.
The scripts
| Script | Role |
|---|---|
dsk_raw2mfm.py | a raw image (sectors end to end) becomes an MFM_DISK container |
sedoric_inject.py | stores a binary as a Sedoric file in an image |
sedoric_mkbare.py | makes a “bare” Sedoric floppy, with no start-up command |
make_bootable_sedoric.sh | the full chain, up to a Sedoric floppy that boots on its own |
Typical chains
# A BASIC program on a floppy that boots
bas2tap game.bas -o game.tap --auto-run
tap2sedoric game.tap -o game.dsk -b master.dsk -n GAME -a
# Towards real hardware
tap2wav game.tap game.wav # through the tape input
dsk2hfe game.dsk game.hfe # a real floppy
# A raw image, then MFM, then HFE
python3 tools/dsk_raw2mfm.py raw.dsk mfm.dsk
dsk2hfe mfm.dsk out.hfe