Description of Machine Code File Handling Routines

From Bitchin100 DocGarden
Revision as of 10:39, 14 April 2009 by Jhoger (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Saving a machine code program into a RAM file

In this chapter, the method to save machine code program that resides in memory into RAM file as a ".CO" file is described. In fact, the object to be saved needs not necessarily machine code program. It can be binary data. The routines described later in this chapter saved the contents of specified portion of memory exactly as they are, just appending some control information.

The control information consists of three words: load address, length, and execution address. The contents of the file is always loaded back to the location where the contents (machine code program) were located when saved. The load address in the file contains the location. Note that this is NOT the address of the file itself.

Procedure to save machine code program

To save machine code program in memory as a ".CO" file, follow the steps below. Address of individual routines used in this chapter will be described later in this document.

1. Set up file name,

Set up file name in FILNAM. This is the same step used to open an ASCII file except the extnsion should be "CO" in case of machine code program save. Body of file anme (i.e. string that precedes the extension) should be 6 characters long, space filled to the extension.

[FILNAM] <= 1st character of file name
[FILNAM+5] <= 6th character of file name
[FILNAM+6] <= "C"
[FILNAM+7] <= "O"
[FILNAM+8] <= " "

2. Set up parameters

Then set address of machine code program, its length and execution address.

[BINADR] <= Start address of binary data
[BINLEN] <= Length of binary data
[BINEXE] <= Execution start address; 0 if not executable at IPL

4. Fix up directory structure.

Refer to "Description of ROM routines in PC_8201 for detail of LNKFIL routine.

		CALL	LNKFIL		; Fix up directory structure