52 lines
2.1 KiB
C
52 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
#ifndef VCC_SDC_H
|
|
#define VCC_SDC_H
|
|
|
|
#define SDC_OK 0
|
|
#define SDC_END 1
|
|
#define SDC_UNAVAILABLE 2
|
|
#define SDC_TIMEOUT 3
|
|
#define SDC_INVALID 0x84
|
|
#define SDC_IO 0x88
|
|
#define SDC_NOT_FOUND 0x90
|
|
#define SDC_IN_USE 0xa0
|
|
#define SDC_PROTECTED 0xc0
|
|
|
|
#define SDC_READ_ONLY 0x01
|
|
#define SDC_DIRECTORY 0x10
|
|
|
|
typedef struct {
|
|
char name[13]; // NUL-terminated 8.3 basename (or "..").
|
|
unsigned char attributes;
|
|
unsigned long size; // Bytes; zero for a directory.
|
|
} SdcEntry;
|
|
|
|
// Foreground calls from a normal low-memory CMOC program under CoCo 3 BASIC.
|
|
// The SDC-DOS cartridge must supply both the selected ROM and I/O. Each
|
|
// operation restores normal controller mode and the caller's interrupt mask.
|
|
unsigned char sdc_probe(void);
|
|
|
|
// Start one card-directory search. NULL or "" lists the current directory.
|
|
// Use "/" for the card root, e.g. "/GAMES/*.DSK" for a filtered listing.
|
|
// Paths use printable ASCII and must fit within 253 bytes. A new search
|
|
// replaces the previous one. The card's current directory stays unchanged.
|
|
unsigned char sdc_list_begin(const char *pattern);
|
|
|
|
// Return one entry, SDC_END after the last, or an error. The controller has
|
|
// one listing cursor: finish before another program or routine starts a list.
|
|
unsigned char sdc_list_next(SdcEntry *entry);
|
|
|
|
// Inspect drive 0 or 1. SDC_NOT_FOUND means no image is mounted. Entry output
|
|
// is valid only on SDC_OK. name is the image basename, including extension.
|
|
unsigned char sdc_mounted(unsigned char drive, SdcEntry *entry);
|
|
|
|
// Mount an image by its exact 8.3 guest filename (including its extension),
|
|
// optionally within card directories. Close any files using the target drive
|
|
// and finish any decbfile session with a cached FAT before changing media.
|
|
// Mounting uses the controller listing cursor and ends the previous search.
|
|
// An empty name is invalid. Never ejects or creates media as a fallback.
|
|
// After a transport timeout, query the drive before retrying the operation.
|
|
unsigned char sdc_mount(unsigned char drive, const char *path);
|
|
|
|
#endif
|