Oct 4, 2026 · Updated Oct 11, 2026 · @Craig Taylor
In West's book this chapter covered the C64's cassette tape. The MEGA65 has no cassette port. Its everyday mass storage is the SD card, which holds the system itself, the configuration, and the user's software and data, mostly in the form of disk images. This chapter covers the SD card as storage: how it is organised, how disk images on it are used, how BASIC and machine language reach its files directly, and how files get onto it. Chapter 15 then covers the disk commands that work on images and real drives alike.
The MEGA65 has two SD card slots: a full-size slot inside the case, reached from underneath, and a microSD slot at the rear. Only one is used at a time; a card in the rear slot takes over, and the internal card is ignored. The rear slot is the more convenient for moving a card between the MEGA65 and a PC (MEGA65 Book, p. 4-9).
The MEGA65 supports SDHC cards between 4GB and 32GB. Smaller cards and larger SDXC cards are not expected to work.
An SD card must be prepared by the MEGA65's own SD Card Utility; a card formatted by a PC will not work, even if only its FAT32 partition is changed. The utility creates two partitions (MEGA65 Book, pp. 4-9, 4-10):
| Partition | Contents |
|---|---|
| Hidden | Configuration settings and freeze states |
| FAT32 | System files, disk images and other files, readable by a PC |
A backup that copies only the files on the FAT32 partition misses the configuration and freeze states; a complete backup needs a tool that copies whole partitions.
Switch the MEGA65 off, hold ALT and switch it on to open the utility
menu, then choose 2, the SD card utility. Choose the card to prepare, 0
for internal and 1 for the rear microSD, and confirm by typing DELETE
EVERYTHING. The utility partitions the card and then copies the system
files, MEGA65.ROM and the .M65 programs, from the core. Formatting cannot be
undone, and the Book advises not erasing the internal card that came
with the machine (MEGA65 Book, pp. 4-10, 4-11).
| Files | Purpose |
|---|---|
MEGA65.ROM |
The ROM image loaded at power-on |
.M65 files |
The Freezer and its utility programs |
MEGA65.D81 |
The Intro Disk, mounted at start-up by default |
Other .D81 and .D64 files |
Disk images of software and data |
.PRG and other files |
Programs and data stored directly on the card |
Files can be organised into subdirectories, which the Freezer's file browser and BASIC's CHDIR command understand.
Most MEGA65 software is distributed as D81 files: images of 3.5" Commodore 1581 disks. A mounted image behaves exactly like a real disk in a drive, so every disk command in Chapter 15 works on it. The MEGA65 also mounts D64 images of 1541 disks.
The MEGA65 provides two managed drives alongside anything on the IEC port (MEGA65 Book, pp. 6-3, 6-4):
| Managed drive | Can hold | Unit number |
|---|---|---|
| First | A D81 or D64 image, or the internal 3.5" drive | 8 or 10 |
| Second | A D81 or D64 image | 9 or 11 |
Commands addressed to these units are handled by the MEGA65; any other unit number goes to the IEC port. The unit assignments are temporary and return to their defaults at power-on.
In the Freezer, press 0 or 1 to choose a managed drive, pick an image from the file browser, and press 8 or 9 to change its unit number. From BASIC, MOUNT does the same, using the current directory on the card:
MOUNT "MEGA65.D81"
MOUNT "GAMES.D81", U9
The Freezer can also create a new, formatted D81 image: choose the first managed drive and select NEW D81 DD IMAGE at the top of the file list (MEGA65 Book, pp. 6-5, 6-6).
A few BASIC commands can reach files on the card directly, outside any disk image, by using unit 12 (MEGA65 Book, pp. 6-10, 6-11):
10 DIR U12, P : REM LIST THE CARD, A PAGE AT A TIME
20 DLOAD "MYPROGRAM.PRG", U12 : REM NOTE THE .PRG SUFFIX
30 CHDIR "DEMOS", U12 : REM CHANGE THE CURRENT DIRECTORY
40 CHDIR "..", U12 : REM BACK TO THE PARENT
Unit 12 is not a full disk drive. Directory listing, loading with
DLOAD or LOAD, TYPE (from ROM 920417) and CHDIR work on it, and from
ROM 920410 DIR also takes a pattern, as in DIR "M*", U12;
DSAVE does not, so a program cannot save to the card this way (MEGA65 ROM change log).
MOUNT does not take U12, because its U argument chooses the unit to
mount the image on, but it does use the directory set by CHDIR. Support
for subdirectories is still developing; for example, changing the
current directory unmounts an image that was mounted from a subdirectory
(MEGA65 Book, p. 6-6).
The configuration utility chooses an image to mount at power-on. If
that image holds a program named AUTOBOOT.C65, it runs
automatically; this is how the Intro Disk starts. Saving a short program
under that name, perhaps one that sets a font, colours and KEY macros,
gives a personal start-up routine (MEGA65 Book, p. 6-10).
The KERNAL reaches disk images through the usual OPEN, LOAD and SAVE calls. For files on the card itself, machine language uses the Hypervisor's file services, which work even when a program has switched the KERNAL out:
| Service | A | Use |
|---|---|---|
| setname | $2E |
Set the file name: a page-aligned ASCII name, page in Y |
| loadfile | $36 |
Load the whole file to chip RAM |
| loadfile_attic | $3E |
Load the whole file to attic RAM |
| findfirst, findnext | $30, $32 |
Search the current directory |
| openfile, readfile, closefile | $18, $1A, $20 |
Read a file a sector at a time |
| chdir, cdrootdir | $0C, $3C |
Change directory |
| attach | $4A |
Mount or unmount a disk image: X bit 0 selects the drive, bit 7
unmounts. The older d81attach0 and d81attach1 ($40,
$46) still work but are deprecated from Hyppo 1.3 |
Chapter 8 gives a complete loading example, and Chapter 11 lists every service and which ones the current Hypervisor implements. loadfile_attic can load a large file, such as a game's levels or music, straight into attic RAM at start-up.
There are three ways to move files between a PC and the MEGA65's SD card:
Cross-development tools, covered in the Book's development chapters, can also load and run a program in memory over USB serial without writing it to the card at all.
Chapter 15 covers the disk commands themselves.