A disk made of memory, brought up by whoever owns it
THE MACHINE SUPPLIES BLOCKS AND SAYS WHAT A DRIVE IS. It says nothing about filesystems, which is what leaves room for a system that would rather have its own - and is why the volatile bit is a fact about the hardware rather than a promise about SBFS. 0x26 what the selected drive is: bit 0, contents do not survive 0x27, 0x28 how many blocks it has --ram-disk N a drive of N blocks with memory behind it A drive of memory selects, reads, writes and has a size like any other, and a program cannot tell the difference except by how fast it was. The one thing it cannot work out for itself is that the contents are volatile, because an empty disk and a volatile disk look identical from outside. THAT BIT IS THE DIFFERENCE BETWEEN A DRIVE A SYSTEM MAY FORMAT ON SIGHT AND ONE IT MUST NOT. CosmOS formats a volatile drive it cannot read, because there was never anything on it to lose, and leaves every other unreadable drive alone - an unformatted floppy is not an invitation, it is a blank floppy. Removing that check formats somebody's blank disk, which is checked rather than asserted: cosmosBlankDisk boots with one and requires it to be refused. So CosmOS grew a format. The size comes from the drive rather than from a superblock, since a superblock states a size too and that is no use on a disk which has not got one yet. Sixteen directory blocks, 128 names, chosen rather than worked out: a scratch disk runs out of names long before room, and this machine cannot divide. The RAM disk is no faster on this emulator by default, and that is honest rather than disappointing: the emulated disk has no seek time unless asked for one. With --disk-cycles 10000 the same copy is 7.94M cycles against 8.70M, the difference being every write. run.sh takes "ram:2048" where an image name goes, which needs no removing between runs because there is nothing to remove. 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
6b51d6391f
commit
04f1ffabd4
+25
-1
@@ -66,7 +66,7 @@
|
||||
// that spans more than one port raises its line on its base, which is the rule the
|
||||
// machine has not needed until now: the controller spans sixteen and never interrupts.
|
||||
#define PORT_DISK 0x20
|
||||
#define PORT_DISK_TOP 0x25
|
||||
#define PORT_DISK_TOP 0x28
|
||||
#define DISK_BLOCK_HIGH 0x20
|
||||
#define DISK_BLOCK_LOW 0x21
|
||||
#define DISK_COMMAND 0x22
|
||||
@@ -87,6 +87,26 @@
|
||||
#define DISK_DRIVE 0x24
|
||||
#define DISK_DRIVES 0x25
|
||||
|
||||
// ---- What a drive IS, which is the machine's business ----
|
||||
//
|
||||
// Not what is on it, which is the system's. A drive backed by memory loses everything when
|
||||
// the machine stops, and that is the one fact about it a system cannot work out for itself -
|
||||
// an empty disk and a volatile disk look identical from the outside.
|
||||
//
|
||||
// It matters because it is the difference between a drive a system may FORMAT on sight and
|
||||
// one it must not. An unformatted floppy somebody put in deliberately is not an invitation;
|
||||
// an unformatted RAM disk is, because there was never anything there to lose. The machine
|
||||
// says which kind it is and says nothing about filesystems, so a system that would rather
|
||||
// have its own reads the same bit and does as it likes.
|
||||
#define DISK_FLAGS 0x26
|
||||
#define DISK_FLAG_VOLATILE 0x01
|
||||
|
||||
// How many blocks the selected drive has. A fact about the drive rather than about what is
|
||||
// on it - and the one a system needs before it can put anything on it, since the size a
|
||||
// superblock states is no use on a disk that has not got one yet.
|
||||
#define DISK_SIZE_HIGH 0x27
|
||||
#define DISK_SIZE_LOW 0x28
|
||||
|
||||
// Four is a floppy controller's worth. The cost of another is a file handle.
|
||||
#define DISK_DRIVE_COUNT 4
|
||||
// ---- The screen ----
|
||||
@@ -317,6 +337,10 @@ void setDiskLatency(unsigned long cycles);
|
||||
// equivalent of the tab on the side of a floppy. Returns 1 if it could not attach.
|
||||
uint8_t attachDisk(const char *path, uint8_t writeProtect);
|
||||
|
||||
// A drive of that many blocks, backed by memory rather than by a file. It comes up as
|
||||
// zeroes, which is not a filesystem - bringing it up is the system's job.
|
||||
uint8_t attachRamDisk(uint32_t blocks);
|
||||
|
||||
void detachDisk(void);
|
||||
|
||||
// How many bytes a device's entry in the registry runs to. Reading past the end gives
|
||||
|
||||
Reference in New Issue
Block a user