DEFINITION MODULE Linker ; (* Linker and .COM writer. The compiler already emits a whole image - the runtime at offset 0, the program after it - so there is nothing to relocate. "Linking" means padding the file so the program's data area exists, and writing it as a DOS .COM, which loads at CS:0100. *) FROM SYSTEM IMPORT BYTE ; PROCEDURE LinkSize () : CARDINAL ; (* Size the .COM must be: the image padded out to cover the whole data area. Usually larger than Compiler.ImageBytes, because the data base is a fixed 4 KiB above the code. *) PROCEDURE WriteCom (path : ARRAY OF CHAR) : BOOLEAN ; (* Write the linked image to `path`. FALSE on failure, and the partial file is removed so it cannot be mistaken for a good one. *) END Linker.