Give the disk four drives, behind one controller
SEVERAL DISKS ARE ONE CONTROLLER AND NOT SEVERAL DEVICES, and the instruction set decided that rather than taste. A port is an immediate byte inside the OUT that names it - portOut takes it from Program Memory - so a program cannot compute one. "The disk on port 0x20 plus drive times four" is not something this machine can say, and two disks as two devices would mean a branch on the drive number in all eleven places sbfs.asm names a disk port. A drive register is what a floppy controller has always been. 0x24 Drive, which the block, command and status registers refer to 0x25 Drives, read only: how many are plugged in --disk given more than once fills them in order. What is per drive is the image, its size and its write protection; the block register, the status and the one buffer belong to the controller, which is the same division real hardware makes. A drive that is not there is refused rather than wrapped, because wrapping means a program asking for a drive this machine has not got quietly reading the one it has - the same shape of fault as taking a bank number somebody else was using. An EMPTY drive is a different thing and is selectable: a controller has its drives whether or not there are disks in them, and reading one fails with the error bit the way an empty drive should. Changing drives finishes whatever the one being left was in the middle of. A transfer waits for the clock, so one may be owed at any moment, and running it against the disk that is arriving would be a fault with no owner. Also stops parseOptions setting its defaults field by field. It was nine assignments beside a struct, and a list beside a thing drifts from the thing: adding two fields left them holding whatever was on the stack, so a machine given one disk was told it already had four drives. It is one zeroing now, and a default that is not nought can be written under it where it reads as the exception. That struct growing a field once before left Voyager linked against an object that disagreed about its size. Nothing in CosmOS uses any of this yet. The mount record is next. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
3b650cabcd
commit
b1538e0618
+23
-10
@@ -57,15 +57,17 @@ uint8_t parseOptions(int argc, char *argv[], EmulatorOptions *options) {
|
||||
int opt;
|
||||
int option_index = 0;
|
||||
|
||||
options->debug = 0;
|
||||
options->fast = 0;
|
||||
options->cycles = 0;
|
||||
options->disk = NULL;
|
||||
options->writeProtect = 0;
|
||||
options->diskCycles = 0;
|
||||
options->screen = NULL;
|
||||
options->keyboard = NULL;
|
||||
options->sound = NULL;
|
||||
// ---- Everything off, in one line rather than nine ----
|
||||
//
|
||||
// This was a list of assignments, one per field, and a list beside a struct drifts from
|
||||
// the struct: adding `disks` and `diskCount` left them holding whatever was on the stack,
|
||||
// so a machine given one disk was told it already had four drives. The same struct
|
||||
// growing a field once before left Voyager linking against an object that disagreed
|
||||
// about its size.
|
||||
//
|
||||
// Every default here is nought or nothing, and a default that is not can be written
|
||||
// below this line where it will be read as the exception it is.
|
||||
*options = (EmulatorOptions){0};
|
||||
|
||||
// Parse options
|
||||
while ((opt = getopt_long(argc, argv, "dc:fhD:WL:S:K:N:", long_options, &option_index)) != -1) {
|
||||
@@ -90,7 +92,18 @@ uint8_t parseOptions(int argc, char *argv[], EmulatorOptions *options) {
|
||||
options->fast = 1;
|
||||
break;
|
||||
case 'D':
|
||||
options->disk = optarg;
|
||||
// Each one is the next drive. The first is also left in `disk`, because a
|
||||
// machine with one disk is what almost every caller means and reading it
|
||||
// that way keeps them all unchanged.
|
||||
if (options->diskCount >= DISK_DRIVE_COUNT) {
|
||||
fprintf(stderr, "Error: This machine has %d drives.\n",
|
||||
DISK_DRIVE_COUNT);
|
||||
return 1;
|
||||
}
|
||||
options->disks[options->diskCount++] = optarg;
|
||||
if (options->disk == NULL) {
|
||||
options->disk = optarg;
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
options->writeProtect = 1;
|
||||
|
||||
Reference in New Issue
Block a user