Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
ArtistA beautiful purple-haired woman wearing a long purple velvet ankle-length dress with flouncy sleeves and purple suede high heels. She is cutting a square out of a large sheet of paper.
// Here we have the page header, which contains the page name, version, and free space pointers
// It is used by BALLOC, the Buf Memory Allocator, to point to the unused portions of a page frame
// There are three active areas on each page :
// FRONT : The memory on a page immediately after the page header (ES:$0000) is called Front Space, and contains Buf headers and Dope Vectors
// MID : In the middle of a page frame is Mid Space, and contains short(ish) data pointed to by the Dope Vectors
// BACK : At the high addresses of a page (ES:$7FFF) is Back Space, for holding large data blocks, again pointed to by Dope Vectors
// Declare Macros
PageHeader <:: (= pagename:120; pageflags:8; checksum:32; lba:32; version:32; timestamp:64; endfront:32; startmid:32; endmid:32; startback:32 =);
// The pagename is a 15character string, such as "::WOOITY::" (or "::SHE+ILA::" for the Kernel boot image)
// The lba is the absolute disk position of this page, for use by a structure checker (similar to CHKDSK or FSCK)
// The version is like the F11ACP generation level, and is incremented on every swapout
{_; // Start of ASM block
BALLOC: _PROC
// Page frame at ES:EBX, requested length in ECX, returns address in EDI
// Here we just update endfront (two more similar functions will handle mid and back)
_MOV EDI,ES:[endfront] // Return pointer to requested space
_ADD ES:[endfront],ECX // Update size of free space
// TO DO: If we run out of space, then try the other free block or convert to a MULTIPAGE SEGMENT
_RET
STRETCH: _PROC; // Stretch the existing block at ESI by ECX bytes
_MOV EDI,ESI
_ADD EDI,ECX
_MOV EAX,ES:[endfront]
_SUB EAX,ESI
_ADD ES:[endfront],ECX
_MOV ECX,EAX; // How many bytes to move
_STD; // Move from end to avoid overwrites
_ADD ESI,ECX
_ADD EDI,ECX
_REP ES:MOVSB
_RET
_}; // End ASM block