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
@@ -0,0 +1,75 @@
|
||||
; Choosing which disk the registers mean.
|
||||
;
|
||||
; SEVERAL DISKS ARE ONE CONTROLLER AND NOT SEVERAL DEVICES, and the instruction set is the
|
||||
; reason. A port is an immediate byte inside the OUT that names it, so a program cannot
|
||||
; compute one - "the disk on port 0x20 plus drive times four" is not a thing this machine can
|
||||
; say. Two disks as two devices would mean a branch per access in every place the filesystem
|
||||
; names a disk port.
|
||||
;
|
||||
; So the drive is a register, the way a floppy controller has always done it.
|
||||
;
|
||||
; Written by Anachronaut
|
||||
|
||||
#Program
|
||||
|
||||
start:
|
||||
; How many are plugged in. A fact about the machine, so it is read only.
|
||||
INA 0x25
|
||||
INIB 0d48
|
||||
CCF
|
||||
ADD
|
||||
OUTQ 0x00
|
||||
|
||||
INIA 0d1
|
||||
OUTA 0x24
|
||||
INA 0x24
|
||||
CCF
|
||||
ADD ; B is still 48, from the count above.
|
||||
OUTQ 0x00 ; It took.
|
||||
|
||||
; ---- A drive that is not there is refused, not wrapped ----
|
||||
;
|
||||
; Wrapping to drive 0 would mean a program asking for a drive this machine does not have
|
||||
; quietly reading the one it does. That is the same shape of fault as taking a bank number
|
||||
; somebody else is using: it succeeds, and the wrong disk answers.
|
||||
INIA 0d9
|
||||
OUTA 0x24
|
||||
INA 0x24
|
||||
CCF
|
||||
ADD
|
||||
OUTQ 0x00 ; Still 1.
|
||||
|
||||
; ---- And reading follows the selection ----
|
||||
;
|
||||
; Drive 1 has no disk in it here, which is not the same as not existing: the controller has
|
||||
; four drives whether or not there are disks in them, so this selects, reads, and fails.
|
||||
INIA 0d1
|
||||
OUTA 0x24
|
||||
RSTA
|
||||
OUTA 0x20
|
||||
OUTA 0x21
|
||||
INIA 0x01
|
||||
OUTA 0x22
|
||||
waitDisk:
|
||||
INA 0x23
|
||||
INIB 0x01
|
||||
AND
|
||||
BNQ waitDisk
|
||||
INA 0x23
|
||||
INIB 0x02
|
||||
AND
|
||||
BRQ readWorked
|
||||
INIA 0d78 ; 'N', which is what an empty drive should give.
|
||||
OUTA 0x00
|
||||
BRI done
|
||||
readWorked:
|
||||
INIA 0d89
|
||||
OUTA 0x00
|
||||
done:
|
||||
INIA 0d10
|
||||
OUTA 0x00
|
||||
HALT
|
||||
|
||||
#Vectors
|
||||
|
||||
Boot start
|
||||
Reference in New Issue
Block a user