SkillAgentSearch skills...

NODISKEMU

SD/MMC to IEEE-488 interface/controller

Install / Use

/learn @nils-eilers/NODISKEMU
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

NODISKEMU

SD/MMC to IEEE-488 interface/controller

Introduction

NODISKEMU is firmware, used in hardware designs like petSD, petSD+ or Dave Curran's pet microSD that allows the IEEE-488 bus to access SD cards - think of it as a CBM 2031 with a modern storage medium instead of disks. The project was inspired by (and uses a few bits of code from) MMC2IEC[1] by Lars Pontoppidan and once ran on the same hardware before it grew too big for the ATmega32 used there.

Currently, the firmware provide good DOS and file-level compatibility with CBM drives, but much work remains. Unless specifically noted, anything that tries to execute code on the device will not work, this includes every software fastloader.

NODISKEMU is a fork of sd2iec[2] by Ingo Korb (et al.) and is not intended to be used on devices equipped with a Commodore serial bus, such as MMC2IEC, SD2IEC or uIEC. Though most code still persists, compilation for these targets may break at any time or is already broken. You better keep using sd2iec for those.

  1. http://pontoppidan.info/lars/index.php?proj=mmc2iec
  2. http://sd2iec.de

Are you kidding me?

This actually IS a disk emulator, isn't?

NODISKEMU does not emulate any particular vintage Commodore disk drive. It neither emulates a 6502 CPU nor does it run any Commodore DOS. It's just a storage solution that is capable to interact on low level functions such as OPEN or TALK and interprets commands sent to channel 15 in a way similar to other drives.

The deeper meaning of this name is to clarify that there actually are and ever will be some differences compared to real floppy drives.

Supported cards

MMC, SD and SHDC cards (resp. microSD/microSDHC cards) are supported, formatted with either FAT16 or FAT32.

SDXC, microSDXC or ex-FAT won't work.

If you card refuses to work, try to format it with SD Formatter 4.0, freely available for Windows and Mac from https://www.sdcard.org/downloads/formatter_4/

Compatibility (IEEE-488)

Known good

Devices with IEEE-488 bus are compatible with any CBM/PET computer equipped with either BASIC 2, BASIC 4 or BSOS.

The CBM-II series are fully supported, however you might want to upgrade to a recent KERNAL because the older ones contain a couple of bugs. The PROXA 7000 extension is fully supported.

OS-9 on the SuperPET is reported to boot from the FAT filesystem, but not from disk images.

Issues

The original PET equipped with BASIC 1 is not compatible because of its hopelessly broken IEEE routines.

There are known issues with printer interfaces by Ultra Eletronic or several clones of them, including mine.

Untested

Tests are still missing for the Z-RAM card (a Z80 CP/M board) and the softbox by Small Systems Engineering, Ltd. which is a Z80 CP/M computer attached to the IEEE-488 bus.

Directories

petSD's default unit number became 11 in order to avoid any conflicts with CBM 8296 built-in drives which usually are set to 8. You may even use a further disk drive as unit 9 without any conflicts to petSD's 11.

Displaying directories works as usual, either the BASIC 2 way with

LOAD"$",11
LIST

or CATALOG for BASIC 4. You can abbreviate to cA and specify the unit address:

cAu11

There are however some more advanced features:

Directory filters

To show only directories, both =B (CMD-compatible) and =D can be used. On a real Commodore drive D matches everything. To include hidden files in the directory, use *=H - on a 1541 this doesn't do anything. NODISKEMU marks hidden files with an H after the lock mark, i.e. "PRG<H" or "PRG H".

CMD-style "short" and "long" directory listings with timestamps are supported ("$=T"), including timestamp filters. Please read a CMD manual for a complete description of the syntax, two basic examples are provided here:

Short format:

LOAD"$=T",11
LIST

Long format:

LOAD"$=T:*=L",11
LIST

Partition directory

The CMD-style partition directory ($=P) is supported, including filters ($=P:S*). All partitions are listed with type "FAT", although this could change to "NAT" later for compatibility.

Printing the directory

This example assumes a printer attached as unit 4:

LOAD "$",11
OPEN 4,4:CMD 4
LIST
PRINT#4:CLOSE 4

Sending Disk Commands

BASIC 2 has only a very limited number of disk commands built-in: LOAD, SAVE, VERIFY, OPEN, CLOSE, GET#, INPUT# and PRINT#. For anything else beyond basic loading and saving programs and displaying the directory, you have to send disk commands to the command channel 15 of the drive.

This can be done in two ways, either by appending the command to the OPEN command or by sending it separately with the PRINT# command. An an example:

OPEN1,11,15,"CD:DIRNAME":CLOSE1

This opens the logical channel 1 on device 8 and sends the string CD:DIRNAME to the command channel 15.

BASIC 4 adds some more advanced commands such as CATALOG. BASIC parses the given parameters and builds a command string which is then sent to the command channel 15, so it's just a more convenient wrapper for sending disk commands but it doesn't add any DOS functions, they're still all processed inside the disk drive.

However, even though BASIC 4 knows some more disk commands, they're kind of limited in their usage. The most advanced and most comfortable way is to use a so called DOS wedge. It cannot be used inside programs, only in direct mode.

Preceed any disk command with a @ or a >, everything after that will be sent to the command channel 15, e.g.:

@CD:DIRNAME

A loadable DOS wedge (as a terminate and stay resident program) is available from http://petsd.net/wedge.php for CBM/PET computers with BASIC 2 and BASIC 4 and from http://cbm2wedge.sourceforge.net for the CBM-II series.

Better yet, get an updated editor ROM with built-in wedge[1] or upgrade your CBM 8296 to BSOS[2] to have the wedge available right from the start after power-on.

  1. http://www.6502.org/users/sjgray/projects/editrom
  2. https://github.com/Edilbert/BSOS

Retrieving the Disk Status

If an error occurs, a red LED of the drive flashes to indicate an error. To get the error message, you have to retrieve the disk status by reading from channel 15.

Unfortunately, BASIC 2 has no built-in command for this purpose, so it's rather cumbersome:

10 OPEN1,11,15
20 INPUT#1,E,E$,T,S
30 PRINT E;E$;T;S
40 CLOSE1

INPUT doesn't work in direct mode, so you'll really have to write a short program to retrieve and display the disk status.

BASIC 4 does it better, it includes the pseudo variables ds and ds$ which it updates after disk operations from status channel 15. However, it misses some changes occasionally so if you depend on really getting the current disk status you're stuck with the old-fashioned way.

Again, the most comfortable way is to use a DOS wedge. Just hit @ followed by RETURN and you'll get always the current disk status.

Long File Names

Long file names (i.e names not within the 8.3 limits) are supported on FAT, but for compatibility reasons the 8.3 name is used if the long name exceeds 16 characters. If you use anything but ASCII characters on the PC or their PETSCII equivalents on the Commodore you may get strange characters on the other system because the LFN use Unicode characters on disk, but NODISKEMU parses only the low byte of each character in the name.

Valid FAT Filenames

Valid characters for filenames on the FAT filesystem have an ASCII code greater or equal 32 (space) and less or equal 126 ('~'). In general, no control codes are allowed, only 7 bit ASCII characters minus some special characters. These forbidden characters are:

    " * , / \ : = ? @

Furthermore, neither space nor the full stop ('.') are not allowed as first or last character of a filename. If a filename contains any illegal characters, the creation of X00 files is forced even if XE mode 0 is set.

Changing the Device Address

After power on, the device address gets restored from the EEPROM. If the device has jumpers or switches to set the address, it will take this setting if a change is detected compared to the last setting during power-on.

There are up to three ways to change the device address:

  1. U0 command (see there)
  2. Hardware (jumper or switches)
  3. LCD menu system

Hardware jumpers are only read after power-on, a reset or power cycle is required to apply any changes.

If there are conflicting situations (e.g. hardware jumpers set to address 10 but address 9 stored in EEPROM), the last change or command sets the address.

EEPROM file system

WARNING: The EEPROM file system is a newly-implemented file system that may still contain bugs. Do not store data on it that you cannot afford to lose. Always make sure that you have a backup. Also, the format may change in later releases, so please expect that the partition may need to be erased in the future.

Devices running NODISKEMU always have an EEPROM to store the system configuration, but on some devices this EEPROM is much larger than required. To utilize the empty space on these devices (currently any microcontroller with at least 128K of flash), a special EEPROM file system has been implemented. This can for example be used to store a small file browser or fast loader so it can be used independent of the storage medium that is currently inserted.

The EEPROM file system will always register itself on the last partition number (see "Partitions" below). You can check the list of partitions ("$=P") to find the current partition number of the EEPROM file system or use the alias function (see below) to access it.

To simplify calculations, block numbers on the EEPROMFS are calculated using 256 bytes per block

Related Skills

View on GitHub
GitHub Stars15
CategoryDevelopment
Updated3mo ago
Forks9

Languages

C

Security Score

87/100

Audited on Dec 6, 2025

No findings