Absolute Object Deck Loader

Now that we have managed to write a stand-alone program we can IPL and execute it would be nice to not have to write it as a program-in-a-program.  Although it gets the job done it is not as straight forward as simply writing a program, assembling it, dropping the resulting object deck in our card reader and hitting IPL.

By building a simple object deck loader we can do just that.  Our object deck loader will be a few cards containing a stand alone program that will IPL and then read an object deck from the card reader.  It will load the object deck into memory and then transfer execution when all cards have been read.

We will write an absolute loader.  Usually we think of a relocating loader that will allow us to load our program into any memory address and handle the necessary work to update relocatable addresses.  Our loader will not attempt to update relocatable addresses.

Since we want to use the object deck created by the assembler we need to understand what types of records make up an object deck.  There are five types of cards or records that may be found in an object deck.  For our simple loader we will only need to be concerned with just two of these.  We can safely ignore the other three types.

Object deck records always start with a x’02’ in column one followed by a three character code that identifies the type of record.  These types are SYM for symbolic debugging information, ESD for external sysbols, TXT for text records, RLD for relocatable symbol information and END for the end record.

We will ignore everything except TXT and END records.

The TXT record has the following layout:

  X     '02'     Object Deck Record
  CL3   'TXT'    Text Record
  C     blank
  XL3            24 bit address of first byte of text data
  CL2   blank
  XL2            Number of byes of text data
  CL2   blank
  XL2            ESD identifier of SD for control section
  XL56           Variable Text Data

The END record data we are concerned with is:

  X     x'02'    Object Deck Record
  CL3   'END'    End Record
  C     blank
  XL3            24 bit address of entry point

The logic of the loader is pretty simple. We start by reading a card.  We then verify it is an object deck record (x’02’ in the first byte).  We then check to see if it is a TXT or END card.  If it is anything else we ignore it and read the next card.

For TXT cards we move the number of bytes specified in the length field from the text data area to the main memory address specified in the 24 bit address field.

When we encounter an END card we branch to the location contained in the entry point address.

If we encounter any errors we can load a wait state PSW to signal an error condition.

[ Next – Absolute Loader Assembly Listing]

Leave a Reply

Your email address will not be published. Required fields are marked *