Work across two disks: copy between them, and run a program from one on
files from the other Two things anybody expects of a second disk, and each needed something different. COPYING NEEDED TWO THINGS TO REMEMBER A DRIVE. The write stream is the only thing here that lives across service calls, so it is the only thing whose drive can change underneath it: every osFileBlock names its source path again and goes back to the source drive, and then osFileWrite has to come home. It records the drive it was opened on and returns there. And the file lookup CACHE. It keeps the last path resolved so a reader walking a file does not re-walk the directory for every block - and skipping the walk skipped the drive the path named, so block one of a cross-drive copy read the source's block numbers off the DESTINATION disk. It only showed on files of more than one block, because a file of one is never looked up twice. One block worked and two did not, which is a suspicious enough shape to have suspected sooner. RUNNING A PROGRAM FROM ELSEWHERE NEEDED A THIRD PLACE TO LOOK, and two restorations. The shell tried where you are and /Apps on the disk you are on. It now tries /Apps on drive 0 as well, which is what makes the system's programs work from a disk of your own - one with your files on it and no system, which is most of the point of having a second disk. The drive goes back after the load, because by then the program is in memory and the blocks it came from mean nothing; and again when it exits, because a program that copies between disks moves the drive as its own paths need to and being left wherever it finished is not what was asked for. Copy 1:/a 0:/b now leaves you exactly where you were. The fixture disk grew an /Apps, because it kept its programs at the root and so could not exercise the third place at all. Two hours of the debugging above were spent on a stale disk image. The machine boots the system that is ON the image, so a rebuilt cosmos.bin means nothing until the image is rebuilt too - and the trace said my new code never ran, which was true. Third time this project has been misled by one. 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
4cc6393f5b
commit
e4f4bae762
@@ -127,6 +127,23 @@ printf 'this lives on the other disk' > other.txt
|
||||
# A name that begins with a digit, because a drive prefix is a digit and a colon and the
|
||||
# colon is the whole of what tells them apart. Without it this would be drive 2.
|
||||
"$TOOL" mkdir "$DISKS/other.img" /2things >/dev/null
|
||||
# A file of more than one block, because a cross-drive copy of a single block never looks
|
||||
# the path up twice and so never meets the cache that used to hand back the right blocks of
|
||||
# the wrong disk.
|
||||
python3 -c "open('twoblocks.txt','w').write('the second disk, at length. ' * 20)"
|
||||
"$TOOL" put "$DISKS/other.img" twoblocks.txt >/dev/null
|
||||
|
||||
# ---- And a /Apps on drive 0, because that is where a system keeps its programs ----
|
||||
#
|
||||
# The apps above sit at the root of this image, which is where they were put before there
|
||||
# were directories and is fine for finding a program on the disk you are standing on. The
|
||||
# THIRD place the shell looks is /Apps on drive 0, and nothing could exercise it while this
|
||||
# disk had no such place.
|
||||
"$TOOL" mkdir "$DISKS/cosmos.img" /Apps >/dev/null
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/Libraries" -I "$ROOT/Programs/CosmOS/Source" \
|
||||
"$ROOT/Programs/CosmOS/Apps/Copy.asm" -o "$WORK/Copy.sbx" >/dev/null
|
||||
"$TOOL" put "$DISKS/cosmos.img" "$WORK/Copy.sbx" /Apps/Copy.sbx >/dev/null
|
||||
"$TOOL" put "$DISKS/cosmos.img" "$WORK/Say.sbx" /Apps/Say.sbx >/dev/null
|
||||
|
||||
# ---- Scripts, including the ones that are meant to go wrong ----
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user