diff --git a/blk/003 b/blk/003 index b8bf848..f3d061b 100644 --- a/blk/003 +++ b/blk/003 @@ -13,4 +13,4 @@ Contents 4 Number literals 6 Compilation vs meta-comp. 8 Interpreter I/O 11 Signed-ness 14 Addressed devices 17 DOES> - +18 Disk blocks diff --git a/blk/018 b/blk/018 new file mode 100644 index 0000000..c2b7f3f --- /dev/null +++ b/blk/018 @@ -0,0 +1,16 @@ +Disk blocks + +Disk blocks are Collapse OS' main access to permanent storage. +The system is exceedingly simple: blocks are contiguous +chunks of 1024 bytes each living on some permanent media such +as floppy disks or SD cards. They are mostly used for text, +either informational or source code, which is organized into +16 lines of 64 characters each. + +Blocks are referred to by number, 0-indexed. They are read +through BLK@ and written through BLK!. When a block is read, +its 1024 bytes content is copied to an in-memory buffer +starting at BLK( and ending at BLK). Those read/write +operations are often implicit. For example, LIST calls BLK@. + + (cont.) diff --git a/blk/019 b/blk/019 new file mode 100644 index 0000000..cb3e4d1 --- /dev/null +++ b/blk/019 @@ -0,0 +1,11 @@ +When a word modifies the buffer, it sets the buffer as dirty +by calling BLK!!. BLK@ checks, before it reads its buffer, +whether the current buffer is dirty and implicitly calls BLK! +when it is. + +The index of the block currently in memory is kept in BLK>. + +Many blocks contain code. That code can be interpreted through +LOAD. Programs stored in blocks frequently have "loader blocks" +that take care of loading all blocks relevant to the program. +