Media Spanning subsystem
The Media Spanning (MSPAN) subsystem allows systems with a BLK
(see doc/blk) media having a capacity that is lower in size than
the size of the blkfs to conveniently manage the spanning of
blocks over multiple media.
For example, in the case of 5 1/4 floppies, you can't have the
whole of Collapse OS on one floppy. You'll probably want to have
100 blocks per disk (with double density, you can have about
180, but if you put 180 blocks per disk, spanning gets at odds
with Collapse OS blkfs organization, which is 100-based).
You can do this without any subsystem, but you'll have a problem
with loader words. For example, if you want to load Z80A, you'll
have 2 distinct problems:
1. B320 is outside the range of a floppy, your disk driver won't
find the proper track/sector.
2. When B007 (Flow words) is loaded at the end, you need to swap
disks.
The MSPAN media inserts itself between your blk drivers and the
BLK subsystem and whenever (blk@) or (blk!) is called, it checks
whether the block currently being requested is on the same disk
as the one inserted before. If it is, it lets the request
continue, while adjusting the block number (for example, if disk
3 is inserted with a span of 100 blocks per disk and that B342
is requested, the block number is adjusted to 42). If it's not,
it prompts the user with a message asking her to insert the
proper disk and then press a key.
Media block adjustments are made through the (msdsks) array
defined at compile time. It's the list of each media block
count. For example, if your list is 100,200,100, then block 42
is assigned to disk 0, 142 to disk 1, 399 to disk 2. If the
requested block is out of bounds, the block is assigned to the
last disk.
Dual drives system
If the system has multiple drives, it can implement DRVSEL. If
it is, you can press keys 0-9 to indicate to the MSPAN system
in which drive the needed disk is.
MSPAN protocol
At compile time, the following constants must be defined:
MSPAN_MEM Address for MSPAN sysvars. 1 byte used.
Required words:
(ms@) blkno dest -- Replaces (blk@)
(ms!) blkno dest -- Replaces (blk!)
(msdsks) -- 'dsks 0-terminated array of 1b disk sizes
Optional words:
DRVSEL drv -- Make drv the active drive. This word is always
called on a FLUSHed system, assume cleanliness.
Provided words:
(blk@) blkno dest -- Plugs in BLKSUB
(blk!) blkno dest -- Plugs in BLKSUB
MSPAN$ -- Initializes the subsystem
Defined variables:
MSPAN_DISK 1b. Currently selected disk. Initializes at 0.
Example implementation:
[...]
SYSVARS $80 + VALUE MSPAN_MEM
[...]
COREL
ALIAS (myfd@) (ms@)
ALIAS (myfd!) (ms!)
CREATE (msdsks) 100 C, 100 C, 180 C, 0 C,
[...]
MSPANSUB
[...]
: INIT [...] MSPAN$ [...] ;
XWRAP
This page generated at 2024-11-24 21:05:03 from documentation in CollapseOS snapshot 20230427.