Philip Smart dbfa22baa4 Fix SFD700 build failures caused by Glass assembler IF scope limitations
Glass Z80 assembler (v0.5.1) makes labels inside IF blocks invisible from
outside those blocks. This caused multiple build failures for the SFD700
target:

- JP _PRTMZF/_PRTDBG in jump table: replaced with DB 0C3H + DW encoding
  which resolves same-condition scope forward references via DW
- LD DE,MSG* across IF scopes: created LDDE macro (DB 011H + DW) that
  produces identical machine code to LD DE,nn for all build targets
- SFD700 command table (CMDTABLE2): moved after all INCLUDE statements
  so DW function references resolve as backward same-scope references
- Removed FD/FDDIR entry from SFD700 command table — FDDIR only exists
  for ROMDISK/picoZ80 builds (MZ-700 WD1773 FDC direct access)
- Fixed PRTSTR→PRINTMSG undefined symbol in rfs_bank7.asm
- Fixed BUILD_PICOZ80 comment (was incorrectly labelled as SFD700)

All three build targets (ROMDISK, SFD700, picoZ80) verified clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 22:55:26 +00:00
2023-02-22 21:41:30 +00:00
2023-02-22 21:43:12 +00:00
2026-03-25 13:47:58 +00:00

RFS

Website: engineers@work | Repository: git.eaw.app/eaw/RFS


Overview

The Rom Filing System (RFS) is a Z80 assembly language firmware package that provides an interactive monitor with mass-storage filing system, application launch, memory utilities and debugging tools for the Sharp MZ-80A and compatible hardware.

RFS replaces the Monitor ROM and User ROM of the host machine via socket lifters connected to the expansion board. It presents itself to the user as an enhanced version of the original SA-1510 monitor program with the same familiar * prompt, all original commands intact and a comprehensive set of new commands for SD card and ROM filing, CP/M boot, BASIC load and much more.

The firmware supports four hardware platforms, each selected at compile time via a flag in rfs_definitions.asm:

  • RomDisk card — the original target. Up to 4×512 KB Flash RAMs, 512 KB Static RAM and an SDXC card reader. Monitor and User ROMs are bank-switched across the Flash RAM.
  • SFD-700 — the Sharp Floppy Disk Interface board. RFS occupies the CPLD/ROM space of the SFD-700 and provides monitor, BASIC load, floppy boot and a built-in Z80 assembler/disassembler.
  • tranZPUter FusionX — the FPGA-based Z80 enhancement board. RFS runs within its Flash ROM space.
  • picoZ80 — the Raspberry Pi Pico based Z80 replacement/emulator board.

RFS Monitor

On boot the familiar SA-1510 sign-on banner appears, appended with "+ RFS" when the filing system has initialised successfully. The original SA-1510 command set is fully available alongside a set of extended commands. Some extended commands (SD card operations, drive selection) are only present in the RomDisk / picoZ80 build; the SFD700 build instead adds the inline assembler and disassembler.

The full command set is listed below. Commands marked (R) are present only in the RomDisk / picoZ80 build; commands marked (S) are present only in the SFD700 build.

Command Parameters Description
0 .. 9 (R) Select the active RFS SD card drive (09).
40 (R) Switch to 40column display mode (requires Kuma 40/80 upgrade or Video Module).
80 (R) Switch to 80column display mode (requires Kuma 40/80 upgrade or Video Module).
ASM (S) <address> Interactive Z80 assembler. Enter assembly mnemonics directly into memory starting at the given address.
B Toggle the keyboard bell.
BASIC Locate BASIC SA-5510 on the active SD drive or ROM, load and execute it.
C [<8bit value>] Clear (initialise) memory from 0x1200 to top of RAM with 0x00 or the supplied byte value.
CP <src> <dst> <size> Copy a block of memory. All three arguments are 4digit hex: source address, destination address, byte count.
CPM Locate CP/M 2.2 on the active SD drive or ROM, load and boot it.
D <addr> [<addr2>] Dump memory from <addr> to <addr2> (or 20 lines) in hex and ASCII. Output pauses at each screenful; press a key to continue, 'U' to page up, 'X' to exit. Repeating 'D' without an address continues from the last displayed location.
DASM (S) <addr> [<addr2>] Disassemble Z80 machine code from <addr> to <addr2>.
EC (R) <name> or <file no.> Erase a file from the active SD card drive by name or file number.
F [<drive>] Boot from the specified floppy drive. If omitted, you are prompted to enter a drive number.
f Execute the original floppy AFI boot code at 0xF000.
H Display the command help screen (paginated, press Space to continue).
IC (R) Paged directory listing of files on the active SD card drive. Each entry shows a hex file number and filename.
IR Paged directory listing of programs stored in the Flash ROM drives.
J <address> Jump to (execute from) the given address.
L | LT [<filename>] Load a file from tape (CMT) and execute it.
LTNX [<filename>] Load a file from tape (CMT) without executing.
LR <name> or <file no.> Load a program from ROM by name or file number and execute it.
LRNX <name> or <file no.> Load a program from ROM by name or file number without executing.
LC (R) <name> or <file no.> Load a program from the SD card and execute it.
LCNX (R) <name> or <file no.> Load a program from the SD card without executing.
M <address> Interactive memory editor starting at <address>.
P Run a test on the connected printer.
R Run a DRAM memory test.
S | ST <start> <end> <exec> Save a memory range to tape (CMT). You are prompted for a filename. Example: S120020001203 saves from 0x1200 to 0x2000 with execution at 0x1203.
SC (R) <start> <end> <exec> Save a memory range to the active SD card drive. You are prompted for a filename.
SD2T (R) <name> or <file no.> Copy a file from the SD card to tape in the CMT.
T Test the 8253 timer.
T2SD (R) Load a program from tape and write it to the active SD card drive.
V Verify a tape save against the data currently in memory.
X (R) Exchange to the hiload ROM variant so DRAM spans 0x00000xCFFF.

If the Kuma 40/80 column upgrade or the Video Module is installed, typing 4 switches to 40column display and 8 switches to 80column display. In 80column mode the directory listing commands (IC / IR) display four columns.


Upgraded Applications

The Sharp MZ series are known as "clean machines" — almost no software lives permanently in ROM; everything is loaded from tape or floppy. The applications that existed therefore had no knowledge of the enhanced storage that RFS provides, other than being able to load them rapidly from the RFS monitor.

To make the machines more usable, key applications have been updated to use RFS natively and the Microsoft BASIC interpreter has been ported to the platform. CP/M 2.2 has also been brought up via a custom CBIOS that uses RFS facilities.

Sharp BASIC SA-5510

The original Sharp SA-5510 BASIC has been disassembled and extended with RFS-aware LOAD, SAVE and DIR commands. The byte layout of the interpreter is preserved so that programs that rely on known fixed addresses continue to work. Extensions are applied outside the main interpreter image.

The extended version is named SA-5510RFS on the ROM drive and SD drive. On boot it uses the active SD drive (drives 09) for all file operations. The standard LOAD and SAVE syntax is unchanged; the drive qualifier prefix is the only addition.

Command Parameter Description
LOAD "TEST" Search the active drive for a program named TEST, load and run it.
LOAD Load the next sequential file from the active drive. If file 5 was last loaded, this loads file 6.
LOAD "3:TEST" Load TEST from RFS drive 3, making drive 3 active.
LOAD "C:TEST" Load TEST from the internal cassette (CMT), making CMT the active drive.
SAVE "TEST" Overwrite an existing file named TEST on the active drive, or create it if absent. On CMT, writes immediately at the current tape position.
SAVE Save the current program under an auto-generated name DEFAULT<n>, where <n> is the current sequence number.
SAVE "3:TEST" Save/create TEST on RFS drive 3 and make drive 3 active.
SAVE "C:TEST" Save to CMT with the name TEST and make CMT active.
DIR List the SD card directory for the active drive in RFS format (file number + filename).
DIR "3:" List the directory on drive 3 and make drive 3 active.

See SD Card Organisation below for the default drive layout.

Microsoft BASIC

While most MZ-80A BASIC interpreters are available only as binaries, Microsoft BASIC (NASCOM 4.7b) has freely available source code and a large library of existing programs. RFS includes a ported and extended version that supports native RFS storage across three configurations matching the target hardware:
  • MS-BASIC(MZ-80A) — for original MZ-80A hardware, cassette storage only.
  • MS-BASIC(RFS40) — RFS with 40column display; adds SD card, CLOAD, CSAVE, DIR.
  • MS-BASIC(RFS80) — RFS with 80column display; adds SD card, CLOAD, CSAVE, DIR.

Each variant appears on the RFS ROM drive and SD drive. Consult the NASCOM Basic Manual for the full standard command set. The table below lists the extensions added for RFS.

Command Parameters Version Description
CLOAD "<filename>" MZ-80A Load a tokenised BASIC program from cassette.
CSAVE "<filename>" MZ-80A Save the current BASIC program to cassette in tokenised format.
CLOAD "[<drive>:]<filename>" RFS40, RFS80 Load from tape or SD card. <drive> is 09; <filename> is a 17-character MZ name or 2-digit RFS hex number. Example: CLOAD "8:13" or CLOAD "8:othello".
CSAVE "[<drive>:]<filename>" RFS40, RFS80 Save to tape or SD card with optional drive qualifier.
DIR "[<drive>:]" RFS40, RFS80 Display the active or specified RFS drive contents.
ANSITERM 0 = Off, 1 = On All Enable or disable (default on) the built-in ANSI terminal processor. This translates ANSI escape sequences into screen actions, allowing portable BASIC programs to run unchanged. (The Star Trek V2 BASIC program uses ANSI escape sequences.)
NASCOM Cassette Image Converter
NASCOM BASIC programs are commonly distributed as cassette image files containing tape-framing data wrapped around tokenised BASIC. The bundled nasconv tool strips the tape framing and rebuilds the BASIC code in a format loadable on the MZ-80A under RFS. It also remaps token values automatically, since the RFS MS-BASIC extension adds new tokens that shift the table.
nasconv v1.0

Required:
  -i | --image  <file>   Cassette image file to convert.
  -o | --output <file>   Output file for converted BASIC data.

Options:
  -l | --loadaddr <addr> MZ-80A BASIC start address.
  -n | --nasaddr  <addr> Original NASCOM BASIC start address.
  -h | --help            Show this help.
  -v | --verbose         Verbose output.

Example:
  nasconv --image 3dnc.cas --output 3dnc.bas \
          --nasaddr 0x10fa --loadaddr 0x4341

Software Architecture

The User ROM space at 0xE800 is divided into 2 KB banks, each containing a copy of the bank-switching stub so that any bank can call code in any other bank without disturbing execution flow. The Monitor ROM space at 0xC000 / 0xF000 is divided into 4 KB banks. Together the RFS and CP/M CBIOS banks give almost 16 KB of effective ROM program space without consuming any RAM.

The following table lists every source module, its target ROM, bank and function:

Module Target ROM Size Bank Description
rfs.asm User 2 KB 0 Primary RFS entry point, command dispatcher and command table. Contains the bank-switching infrastructure shared by all banks.
rfs_bank1.asm User 2 KB 1 Floppy disk controller (FDC) functions. Handles drive selection and boot.
rfs_bank2.asm User 2 KB 2 SD card controller. SPI driver, SD card initialisation, SDCFS directory and file read/write.
rfs_bank3.asm User 2 KB 3 Monitor memory utilities: hex dump, memory edit, memory copy, tape↔SD copy (T2SD / SD2T).
rfs_bank4.asm User 2 KB 4 CMT (cassette) controller: tape load, save and verify.
rfs_bank5.asm User 2 KB 5 General utility functions: formatted print, string routines and shared helper code.
rfs_bank6.asm User 2 KB 6 Help screen, message strings, ASCII↔Sharp character set conversion table.
rfs_bank7.asm User 2 KB 7 Full Z80 interactive assembler, Z80 disassembler, DRAM memory test and 8253 timer test.
cbios_bank1.asm User 2 KB 8 CP/M CBIOS: audio functions and low-level utilities.
cbios_bank2.asm User 2 KB 9 CP/M CBIOS: screen driver and ANSI terminal emulation.
cbios_bank3.asm User 2 KB 10 CP/M CBIOS: SD card driver (provides CP/M drive A:G:).
cbios_bank4.asm User 2 KB 11 CP/M CBIOS: floppy disk controller.
monitor_sa1510.asm Monitor 4 KB 0 Original SA-1510 monitor ROM (40-column).
monitor_80c_sa1510.asm Monitor 4 KB 1 SA-1510 monitor patched for 80-column display.
cbios.asm Monitor 4 KB 2 CP/M 2.2 CBIOS kernel (loaded to 0xC0000xCFFF).
rfs_mrom.asm Monitor 4 KB 3 RFS Monitor ROM utilities. Because code executing from the User ROM cannot page itself out to scan the remaining ROM, these routines run from Monitor ROM bank 3 to scan and load MZF files stored in the User ROM Flash RAM.
monitor_1z-013a.asm Monitor 4 KB 4 MZ-1Z-013A monitor ROM (MZ-700 / MZ-1200 variant).
monitor_80c_1z-013a.asm Monitor 4 KB 5 MZ-1Z-013A monitor patched for 80-column display.
ipl.asm Monitor 4 KB 6 Initial Program Loader.

CP/M 2.2 is supported with 47 KB of usable program RAM. Only the CCP and BDOS reside in RAM (and can be overwritten by applications); the CBIOS itself lives in Monitor ROM bank 2 and User ROM banks 811, consuming no program RAM at all.

The Monitor ROM also provides several variant monitor images built at the same time: a standard SA-1510, an 80-column SA-1510, a Kuma-80 version (selected via the KUMA80_ENA flag in rfs_definitions.asm), and hi-load variants of both SA-1510 and 80-column SA-1510 used when DRAM needs to fill the full 0x00000xCFFF range.


Build System

All development is done under Linux (Debian / Ubuntu). Building RFS involves assembling the Z80 source, packaging the ROM images and creating SD card images. The toolchain is almost entirely self-contained within the repository.

Prerequisites

Tool Notes
Java (JRE 8+) Required to run the GLASS Z80 assembler. java must be on PATH.
bash All build scripts are bash.
perl Required by mzftool.pl.
gcc / make Required to compile cpmtools from source (done automatically on first build).
dd, cat, stat Standard Linux utilities used by the packaging scripts.

The GLASS Z80 assembler (glass.jar) is bundled in the tools/ directory — no separate installation is needed.

Build Targets

The build target is selected by editing asm/include/rfs_definitions.asm and setting exactly one of the following flags to 1 (all others must be 0):

Flag Target Description
BUILD_ROMDISK RomDisk card MZ-80A with 4×512 KB Flash RAM + SDXC card expansion.
BUILD_SFD700 SFD-700 Sharp floppy disk interface board. No SD card; adds ASM/DASM.
BUILD_PICOZ80 picoZ80 Raspberry Pi Pico based Z80 replacement board.

Additional optional flags in the same file:

Flag Default Description
KUMA80_ENA 0 Set to 1 if the Kuma 40/80 column upgrade is installed.
VIDEOMODULE_ENA 0 Set to 1 if the 40/80 column colour Video Module is installed.
FUSIONX_ENA 0 Set to 1 when running RFS on the tranZPUter FusionX board.
HW_SPI_ENA 1 Hardware SPI (RomDisk v2+ PCB). Leave at 1 for all current boards.
ENADEBUG 0 Enable assembly-time debug logging.

Building

Clone the repository and run the top-level build script:

git clone https://git.eaw.app/eaw/RFS.git
cd RFS

# Full build (assembles all ROMs, packages ROM images, builds SD card image):
./build.sh

# Full build including re-processing all MZF application files
# (only needed when MZF source files in MZF/ have changed):
./build.sh -m

build.sh performs the following steps in order:

  1. Compiles cpmtools from source (first run only) and adds the result to PATH.
  2. tools/assemble_rfs.sh — assembles rfs.asm and rfs_mrom.asm into roms/rfs.rom and roms/rfs_mrom.rom.
  3. tools/assemble_cpm.sh — assembles the CP/M 2.2 CBIOS (cbios.asm, cbios_bank14.asm, cpm22.asm) into roms/*.rom.
  4. tools/assemble_roms.sh — assembles all monitor variants (SA-1510, 80c SA-1510, 1Z-013A, hi-load variants, Kuma version, IPL) and MZF application files (SA-5510, MS-BASIC variants, etc.) into roms/ and MZB/.
  5. tools/make_roms.sh — packages the assembled ROMs and MZF applications into Flash ROM images (see Output Files below).
  6. tools/make_cpmdisks.sh — builds CP/M disk images in RAW and CPC Extended Disk Format for each of the pre-populated CP/M drive sets.
  7. tools/make_sdcard.sh — assembles the final SD card image combining 10 RFS drive images and 7 CP/M disk images.

The individual scripts can also be run directly from within the tools/ directory for partial rebuilds.

Output Files

After a successful build the roms/ directory contains:

File Flash chip Description
MROM_ROMDISK_256.bin SST39SF040 (Monitor ROM) Monitor ROM image for the RomDisk build. Contains SA-1510, 80c SA-1510, CP/M CBIOS, RFS mrom utilities, 1Z-013A monitors and IPL across 8×4 KB banks.
MROM_PICOZ80_256.bin SST39SF040 (Monitor ROM) Monitor ROM image for the picoZ80 build (bank order differs from ROMDISK).
USER_ROM_256.bin SST39SF040 (User ROM 1) User ROM 1: RFS banks 07, CP/M CBIOS banks 811, CP/M 2.2 image and a packed set of MZF applications.
USER_ROM_II_256.bin SST39SF040 (User ROM 2) User ROM 2: additional MZF applications.
USER_ROM_III_256.bin SST39SF040 (User ROM 3) User ROM 3: additional MZF applications.
SFD700_256.bin SST39SF040 SFD-700 ROM: MZ-80A AFI floppy ROM (0x000000x00FFF), MZ-700 floppy ROM (0x010000x01FFF), RFS firmware (0x020000x0BFFF), then ROM file system.
SHARP_MZ80A_RFS_IMAGE_09.img SD card Ten RFS drive images (one per 09 drive).
SHARP_MZ80A_RFS_CPM_IMAGE_1.img SD card Combined SD card image: 10 RFS drives followed by 7 CP/M disk images. Copy this directly to an SD card.

Programming the Flash ROMs

<<<<<<< HEAD If the 40/80 column card is installed, typing '4' switches to 40 Column display, typing '8' switches to 80 Column display. For the directory listing commands, 4 columns of output will be shown when in 80 column mode.


SFD700 Build Commands

When RFS is built with the BUILD_SFD700 option enabled, it targets the Kersten & Partners SFD700 Floppy Disk Controller. This build supports the full set of RFS monitor commands but is tailored for the SFD700 hardware — SD Card commands are not available as the SFD700 does not include an SD Card interface, and display mode switching commands (40, 80, 700, 7008) are not included. In addition, the SFD700 build provides a built-in Z80 Assembler and Disassembler not present in other builds.

The full set of commands available in the SFD700 build are listed in the table below:

Command Parameters Description
ASM <address> Invoke the built-in Z80 assembler starting at <address>.
B n/a Enable/Disable key entry beep.
BASIC n/a Locates BASIC SA-5510 in ROM, loads and runs it.
C [<8 bit value>] Initialise memory from 0x1200 - Top of RAM with 0x00 or provided value.
CP <src addr> <dst addr> <size> Copy a block of memory. Ie. CP120020003FFF copies 0x3FFF bytes from 0x1200 to 0x2000.
CPM n/a Locates CP/M 2.23 in ROM, loads and runs it.
D <address>[<address2>] Dump memory from <address> to <address2> (or 20 lines) in hex and ascii. When a screen is full, the output is paused until a key is pressed.

Subsequent 'D' commands without an address value continue on from last displayed address.

Recognised keys during paging are:
'D' - page down, 'U' - page up, 'X' - exit, all other keys list another screen of data.
DASM <address>[<address2>] Invoke the built-in Z80 disassembler from <address> to <address2> (or until a key is pressed).
F n/a Boot from the SFD700 Floppy Disk.
H n/a Help screen of all these commands.
IR n/a Paged directory listing of the files stored in ROM. Each file title is preceded with a hex number which can be used to identify the file.
J <address> Jump (start execution) at location <address>.
L | LT n/a Load file into memory from Tape and execute.
LTNX n/a Load file into memory from Tape, dont execute.
LR <name> or
<file number>
Load file into memory from ROM. The ROM is searched for a file with <name> or <file number> and if found, loaded and executed.
LRNX <name> or
<file number>
Load file into memory from ROM. The ROM is searched for a file with <name> or <file number> and if found, loaded and not executed.
M <address> Edit and change memory locations starting at <address>.
P n/a Run a test on connected printer.
R n/a Run a memory test on main memory.
S | ST <start addr> <end addr> <exec addr> Save a block of memory to tape. You will be prompted to enter the filename.

Ie. S120020001203 - Save starting at 0x1200 up until 0x2000 and set execution address to 0x1203.
T n/a Test the 8253 timer.
V n/a Verify a file just written to tape with the original data stored in memory.

Sharp MZ-700 Mode

The tranZPUter SW Version 2.1 board has now been developed and RFS software updated to coexist with this board without a K64F processor (the processor can be present but no use of its services will be made under RFS). This board adds Sharp MZ-700 hardware level compatibility logic, both memory management and keyboard remapping are made within hardware.

In order to cater for this upgrade, RFS has been updated to include the MZ-700 1Z-013A monitor ROM and a command to enable it. When enabled, the machine is set to compatibility mode, the 1Z-013A ROM loaded as the primary monitor and reset. The keyboard is remapped real time and so is the memory. Loading S-BASIC, read/write cassette etc works as expected on an MZ-700.


Building RFS

Building the Rom Filing System involves assembling the Z80 Assembly language source into a machine code binary and packaging it into an image suitable for writing onto a 512Kbyte Flash RAM. You may also want to include MZF applications in the ROMS for rapid exection via the RFS system. If you intend to use CPM, see also the CPM documentation.

To accomplish it you need several tools and at the moment it is a script aided manual process.

Paths

For ease of reading, the following shortnames refer to the corresponding path in this chapter.

Short Name
[<ABS PATH>] The path where this repository was extracted on your system.
<software> [<ABS PATH>]/MZ80A_RFS/software
<roms> [<ABS PATH>]/MZ80A_RFS/software/roms
<CPM> [<ABS PATH>]/MZ80A_RFS/software/CPM
<tools> [<ABS PATH>]/MZ80A_RFS/software/tools
<src> [<ABS PATH>]/MZ80A_RFS/software/src
<MZF> [<ABS PATH>]/MZ80A_RFS/software/MZF
<MZB> [<ABS PATH>]/MZ80A_RFS/software/MZB

Tools

All development has been made under Linux, specifically Debian/Ubuntu. I use Windows for flashing the RAM's and using the GUI version of CP/M Tools but havent dedicated any time into building the RFS under Windows. I will in due course create a Docker image with all necessary tools installed, but in the meantime, in order to assemble the Z80 code, the C programs and work with the CP/M software andCP/M disk images, you will need to obtain and install the following tools.

Z80 Glass Assembler - A Z80 Assembler for converting Assembly files into machine code.
samdisk - A multi-os command line based low level disk manipulation tool.
cpmtools - A multi-os command line CP/M disk manipulation tool.
CPMToolsGUI - A Windows based GUI CP/M disk manipulation tool.
z88dk - An excellent C development kit for the Z80 CPU.
sdcc - Another excellent Small Device C compiler, the Z80 being one of its targets. z88dk provides an enhanced (for the Z80) version of this tool within its package.

Software

Building the software and final ROM images can be done by cloning the repository and running some of the shell scripts and binaries provided.

The basic procedure to build RFS as follows:

  1. Make the RFS binary using <tools>/assemble_rfs.sh, this creates <roms>/rfs.rom for the User Bank Flash RAM and <roms>/rfs_mrom.rom for the Monitor Bank Flash RAM.
  2. Make the original MZ80A monitor roms using <tools>/assemble_roms.sh, this creates <roms>/monitor_SA1510.rom and <roms>/monitor_80c_SA1510.rom for the Monitor Bank Flash RAM.
  3. Make the rom images using <tools>/make_roms.sh, this creates <roms>/USER_ROM_256.bin for the User Bank Flash RAM and <roms>/MROM_256.bin for the Monitor Bank Flash RAM. The rom images also contain a packed set of MZF applications found in the <MZF> directory. Edit the script <tools>/make_roms.sh to add or remove applications from the rom images.

The above procedure has been encoded in a set of shell scripts and C tools, which at the simplest level, is to run these commands:

cd <software>
tools/assemble_cpm.sh
tools/assemble_rfs.sh
tools/assemble_roms.sh
tools/make_cpmdisks.sh
tools/make_roms.sh
tools/make_sdcard.sh

The output of the above commands are ROM images <roms>/MROM_256.bin and <roms>/USER_ROM.256.bin which must be flashed into 512Kbyte Flash RAMS and inserted into the sockets on the RFS adapter.

The applications which can be stored in the Flash RAMS are located in the <MZF> directory. In order to use them within the Flash RAM's, the applications need to be converted into sector rounded binary images and stored in the <MZB> directory. The tool <tool>/processMZFiles.sh has been created for this purpose. Simply copy any MZF application into the <MZF> directory and run this tool:

The ROM images are written to SST39SF040 (512 KB) Flash RAM chips using a TL866 or compatible programmer:

# Monitor ROM (RomDisk build):
minipro --infoic /path/to/minipro/infoic.xml -p SST39SF040 -s -w roms/MROM_ROMDISK_256.bin

# User ROM 1:
minipro --infoic /path/to/minipro/infoic.xml -p SST39SF040 -s -w roms/USER_ROM_256.bin

# SFD-700:
minipro --infoic /path/to/minipro/infoic.xml -p SST39SF040 -s -w roms/SFD700_256.bin

Writing the SD Card Image

Write the combined SD card image directly to the SD card using dd:

# Replace /dev/sdX with your SD card device:
dd if=roms/SHARP_MZ80A_RFS_CPM_IMAGE_1.img of=/dev/sdX bs=512
sync

No partitioning is required. The SDCFS image begins at sector 0. Insert the SD card into the reader on the RomDisk board.

Adding Applications to the ROM Drives

Applications stored in the Flash ROM drives must first be converted from MZF format into sector-padded binary images. Place the MZF files in the appropriate subdirectory under MZF/ and run:

public/main

tools/processMZFfiles.sh

This converts all MZF files into 128-byte and 256-byte sector-padded images stored in MZB/. They are then picked up automatically by make_roms.sh.

To choose which applications appear in each ROM drive, edit tools/make_roms.sh and adjust the addMZFToROMImageList calls. Each call takes four flags (include in ROMDISK build, include in SFD700 build, include in picoZ80 build, reserved) and the path to the sectored binary:

# Format:
#   addMZFToROMImageList  <ROMDISK>  <SFD700>  <picoZ80>  <reserved>  "<MZB path>"
#
# Example — include in all builds:
addMZFToROMImageList 1 1 1 0 "${MZB_PATH}/Common/sa-5510_rfs.${SECTORSIZE}.bin"

# Example — RomDisk and picoZ80 only:
addMZFToROMImageList 1 0 1 0 "${MZB_PATH}/MZ-80A/defender.${SECTORSIZE}.bin"

Applications are packed in the order listed, filling User ROM 1 first, then User ROM 2 and 3. Place applications you always want available at the top of the list.

Build Tools Reference

Script / Tool Description
build.sh Top-level build script. Runs all steps below in order. Pass -m to also reprocess MZF application files.
tools/assemble_rfs.sh Assembles rfs.asm and rfs_mrom.asmroms/rfs.rom, roms/rfs_mrom.rom.
tools/assemble_cpm.sh Assembles the CP/M 2.2 CBIOS and kernel → roms/*.rom.
tools/assemble_roms.sh Assembles all monitor ROM variants and MZF application binaries. Handles the four MS-BASIC build variants via a BUILD_VERSION EQU written to include/msbasic_buildversion.asm before each pass.
tools/make_roms.sh Packages ROM and MZF binaries into Flash ROM images for ROMDISK, SFD700 and picoZ80 targets.
tools/make_cpmdisks.sh Creates CP/M disk images in RAW format (for SD card) and CPC Extended Disk Format (for floppy emulators or physical copying).
tools/make_sdcard.sh Combines RFS drive images and CP/M disk images into a single SD card image.
tools/processMZFfiles.sh Converts MZF application files into 128-byte and 256-byte sector-padded images in MZB/.
tools/mzftool.pl Perl script to create, extract and inspect MZF format images.
tools/sdtool Binary tool that builds the RFS SD card directory structure and populates it with MZF / binary applications.
tools/nasconv Converts NASCOM cassette image files to MZ-80A loadable format, remapping MS-BASIC token values as needed.
tools/glass.jar Bundled GLASS Z80 assembler (Java). Used by all three assembly scripts.
cpmtools/ cpmtools source (cpmcp, cpmls, cpmrm, etc.). Compiled automatically on first build and installed into tools/.

SD Card Filing System

Rather than implementing a FAT file system (which would be too large for the 2 KB and 4 KB ROM banks), RFS uses a purpose-built simple filing system called the SD Card Filing System (SDCFS). Initial v1 boards used a software bit-bang SPI interface; the v2.0 PCB added hardware SPI, giving ROM-level access speeds.

SDCFS Structure

Each SDCFS image contains a 32-byte-per-entry directory for up to 256 files followed by 256 fixed-size file blocks. Ten SDCFS images (drives 09) are stored at the start of the SD card. The remainder of the SD card holds CP/M disk images.

Each directory entry is based on the standard MZF header:

FLAG1 FLAG2 FILE NAME START SECTOR SIZE LOAD ADDR EXEC ADDR RESERVED
1 Byte 1 Byte 17 Bytes 4 Bytes 2 Bytes 2 Bytes 2 Bytes 3 Bytes
Field Description
FLAG1 Bit 7 = 1: valid entry. Bit 7 = 0: inactive / deleted.
FLAG2 MZF execution type (0x01 = binary).
FILE NAME Standard 17-character MZF filename.
START SECTOR First sector within this drive image where the file data begins.
SIZE Actual byte count of the file data.
LOAD ADDR RAM address to load the file data to.
EXEC ADDR Auto-execution address for binary files.
RESERVED Not currently used.

Each file block is a fixed 64 KB, matching the maximum CMT (tape) block size. This keeps the layout simple and allows files to be read or written exactly as if they were on tape, enabling transparent SD↔CMT copy operations.

SD Card Layout

ADDRESS    SECTOR   CONTENT
00000000   00000  ┌─────────────────────────────────────────────────────────────┐
                  │  RFS DRIVE 0                                                │
00000000   00000  │  Directory entry 000 (32 bytes)                             │
                  │  ...                                                        │
00001FE0   0000F  │  Directory entry 255 (32 bytes)                             │
00002000   00010  │  File block 0     (64 KB)                                   │
                  │  ...                                                        │
00FF2000   7FF90  │  File block 255   (64 KB)                                   │
01001FFF   8000F  └─────────────────────────────────────────────────────────────┘
                  ...  (RFS drives 18 follow the same pattern)
09012000   48090  ┌─────────────────────────────────────────────────────────────┐
                  │  RFS DRIVE 9                                                │
0A013FFF   5009F  └─────────────────────────────────────────────────────────────┘
                  ... padding to 256 MB boundary ...
10000000   80000  ┌─────────────────────────────────────────────────────────────┐
                  │  CP/M DISK IMAGE 0   (16 MB, 32 sectors × 1024 tracks)     │
11000000   88000  ├─────────────────────────────────────────────────────────────┤
                  │  CP/M DISK IMAGE 1                                          │
                  │  ...                                                        │
XX000000          │  CP/M DISK IMAGE n                                          │
                  └─────────────────────────────────────────────────────────────┘

SD Card Organisation

The SD card image built by the repository tools is pre-populated as follows:

RFS Drive Contents
0 Common and MZ-80A machine code programs.
1 MZ-80K machine code programs.
2 MZ-700 machine code programs.
3 MZ-800 / MZ-1500 machine code programs.
4 MZ-80B / MZ-2000 machine code programs.
5 BASIC programs, type 2 (MZ-80A).
6 BASIC programs, type 2 (MZ-80K).
7 BASIC programs, type 5 (MZ-700 / MZ-800).
8 Other / miscellaneous programs.
9 Other / miscellaneous programs.
CP/M Drive User# Disk image Contents
0 0 CPM00_SYSTEM CP/M system programs
1 CPM01_TURBOP Turbo Pascal
2 CPM02_HI_C Hi-Soft C
3 CPM03_FORTRAN80 Fortran 80
4 CPM04_MBASIC Microsoft BASIC 80/85
57 CPM0507_COBOL80 Cobol v1.3, v2.0, Cobol 80
8 CPM08_Z80FORTH Z80 Forth
9 CPM09_CPMTEX CP/M TeX
10 CPM10_DISKUTILFUNC5 Disk utilities
11 CPM11_MAC80 Macro Assembler 80
12 CPM29_ZSID_v14 ZSID Debugger
1314 CPM3233_ZCPR3 ZCPR3 CCP enhancement
1 0 CPM12_PASCALMTP_v561 Pascal v5.61
1 CPM26_TPASCAL_v300a Turbo Pascal v3.00a
211 CPM1322_MTPUG_0110 Pascal User Group Disks 0110
2 02 CPM2325_PLI / PLI80 PLI Compiler, PLI 80 v1.3, v1.4
3 CPM28_PLM80 PLM 80
46 CPM27,30,31_WORDSTAR WordStar v3.0, v3.3, v4.0
36 09 CPM_MC_C0F9 Grant Searle CP/M collection disks C0F9

Manuals

Detailed documentation for the Rom Filing System is available in three separate manuals:
Manual Description
User Manual Getting RFS, monitor command reference, using SD drives, BASIC, CP/M, and troubleshooting
Technical Guide Hardware platforms, memory architecture, bank switching, SDCFS design, CP/M CBIOS, and full build system reference
Developer's Guide Z80 assembly primer, full source module walkthroughs (including bank-switching internals), and guides for adding new commands and hardware targets

Credits

Where any component is based on or derived from a third-party design, the original author's copyright notice is included in the relevant source file header. All third-party software is, to the best of knowledge, open source and freely usable. If any component is found to carry licensing restrictions it will be removed and a suitable link provided instead.

Licenses

This design, hardware and software, is licensed under the GNU Public Licence v3.

No commercial use to be made of this design or any hardware/firmware component without express permission from the author. This condition overrides any rights afforded by the GNU GPL 3 license.

The Gnu Public License v3

The source and binary files in this project marked as GPL v3 are free software: you can redistribute them and-or modify them under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The source files are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Description
RFS v1.02 Latest
2026-04-02 06:42:46 +00:00
Languages
Assembly 89.2%
C 6.1%
Shell 3.7%
Perl 1%