Now that we have been through an overview of the IPL process and the basic concepts of the PSW and I/O we can begin to construct a deck of cards to IPL from.   We know that if we set the IPL device address to that of a card reader and press the IPL key the CPU will read a single card and transfer the first 24 bytes of data (card columns 1-24) and ignore the rest of the card.

The contents of our first card should be a PSW followed by two CCWs.

IPLCARD0 DS    0D
*
PSW      DC    X’00’       * I/O & External Interrupts Disabled
         DC    X’00’       * Key=0; BC; Ext Int Disabled; Sup State
         DC    X’0000’
         DC    X’00’       * Prog Int Disabled
         DC    AL3(1024)   * Address to begin Execution
*
*
CCW1     DC    X’02’       * Read
         DC    AL3(512)    * Storage Address For Data
         DC    X’60’       * SLI + CC
         DC    X’00’
         DC    AL2(80)     * Length
*
*
CCW2     DC    X’08’       * Transfer In Channel (TIC)
         DC    AL3(512)    * Address of next CCW
         DC    X’00’
         DC    X’00’
         DC    AL2(0)      * Length Not Used For TIC
*
*

 

This makes up the contents of our first IPL record.  The first eight bytes become our initial PSW when the IPL CCW chain is completed.  The first byte contains the interrupt mask flags for channels 0 through 5, the I/O mask bit (for channels 6 and higher) and the External Interrupt mask.  We set all of these to zero which inhibits these conditions from generating an interrupt.

The next byte contains the protection key in the first four bits.  We will initially set our key to zero which will allow us to access any valid memory location.

The next bit is set to zero to indicate a BC mode PSW.  The Machine Check Interrupt mask is set to zero to inhibit interruptions.  The Wait bit is set to zero so the CPU will immediately begin executing instructions.  The Problem State bit is set to zero placing us in Supervisor State therefore allowing us to execute privileged instructions.

The next two bytes are set to all zeros.  These bytes contain the interruption code and are only meaningful in an Old PSW to indicate the source of the interruption.  When the IPL process is completed the address of the IPL device will be stored here.

The next byte contains the Instruction Length Code (ILC), Condition Code and Program Mask.  We set all of these to zero and disallow any of the related program checks from generating interrupts.

The next three bytes contain the memory address of the first instruction to be executed.  It is our responsibility to load a valid instruction sequence into memory starting at this address.

Following the PSW are two CCWs.  The First CCW is a read command (command code = x’02’).  This will cause the next card in our IPL Deck to be read.  We specify a storage location to receive the contents of the card.  The next byte specifies the flags.  We set the Command Chain flag so a new CCW will be fetched upon completion of the read command.  The Suppress Incorrect Length  (SLI) bit is also set to avoid any problems with reading a short or long block of data.  Since we are reading from a card device the block size is set at 80 so we really shouldn’t need to set this flag.  In general it is a good idea to suppress any exceptional conditions possible since at this time there is no option for error recovery.

The next CCW is a Transfer In Channel (TIC) command.  A TIC is a branch command in a channel program.  The TIC will cause a new CCW to be fetched from the address specified.  We will set the address to point to the contents of the card that was read by the previous CCW.

At this point the IPL process has read two cards into memory.  The first card contained two CCWs to read the second card and then load a new CCW.

Card two needs to contain additional CCWs to read additional cards into memory that contain executable code.

[Next – Second IPL Card]