Assemble and Execute

I assembled the program using the IFOX00 Assembler running on MVS 3.8 under Hercules.  I then link edited and ran the program using the following JCL:

//CARD80 JOB (TXXOS),'GEN IPL DECK',CLASS=A,MSGCLASS=A
//CARD80 EXEC PGM=CARD80
//STEPLIB  DD DISP=SHR,DSN=TXXOS.CARD.LOAD
//PUNCH    DD UNIT=00D

I chose to send the output directly to the card punch device (located at 00D on my system) instead of sending it to the spool and then punching it using JES2.  Before running the program verify the device address for your punch device and verify it is not allocated to JES2 (using $du).  If necessary you can stop the JES device using something like $ppun1.

Also before running the program you will need to prepare the Hercules punch.  At the Hercules console I used the DEVINIT command:

DEVINIT 00D card.ipl ebcdic

This command tells Hercules to set device 00D to output to the file “card80.ipl”.  You can specify a path if you desire or else the file will be created in the directory you started Hercules from.  For example you might use something like “../punch/card80.ipl” as the file path and name.  I chose to simply place it in the default directory and then move it using a Linux line command.  It is very important you specify ebcdic so Hercules does not attempt to translate the output into ASCII.  ASCII translation will mangle the CCWs and machine code in the IPL deck and the IPL will fail.

Once the program has completed execution you can close the output file by simply using the Hercules command:

DEVINIT 00D

At this point we have our IPL deck and we are ready to set up a Hercules mainframe to run it.

[Next -Hercules Setup and IPL]

CARD80 Assembly Listing

                                                                                                               PAGE    2

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

                                      1 **********************************************************************  00010000
                                      2 * CARD80                                                                00020000
                                      3 *                                                                       00030000
                                      4 * PUNCH OUT A CARD DECK THAT WILL IPL AND THEN READ REMAINDING CARD     00040000
                                      5 * IN CARD READER AND LIST THEM TO A PRINTER                             00050000
                                      6 *                                                                       00060000
                                      7 **********************************************************************  00070000
000000                                8 CARD80   CSECT ,                                                        00080000
000000 90EC D00C      0000C           9          STM   R14,R12,12(R13)    SAVE CALLERS REGISTERS                00090000
000004 18CF                          10          LR    R12,R15            R12 IS PROGRAM BASE                   00100000
                            00000    11          USING CARD80,R12                                               00110000
                                     12 *                                                                       00120000
000006 4110 C128      00128          13          LA    R1,SAVEA           POINT TO NEW SAVE AREA                00130000
00000A 5010 D008      00008          14          ST    R1,8(,R13)         CHAIN                                 00140000
00000E 50D0 1004      00004          15          ST    R13,4(,R1)              ON                               00150000
000012 18D1                          16          LR    R13,R1                    SAVEAREA                       00160000
                                     17 *                                                                       00170000
                                     18 *                                                                       00180000
                                     19          OPEN  (PUNCH,OUTPUT)     OPEN OUTPUT FILE                      00190000
000014                               20+         CNOP  0,4                               ALIGN LIST TO FULLWORD 01740001
000014 4510 C01C      0001C          21+         BAL   1,*+8                             LOAD REG1 W/LIST ADDR. 01780000
000018 8F                            22+         DC    AL1(143)                          OPTION BYTE            01900000
000019 000170                        23+         DC    AL3(PUNCH)                        DCB ADDRESS            01920000
00001C 0A13                          24+         SVC   19                                ISSUE OPEN SVC         04000000
                                     25 **********************************************************************  00200000
                                     26 *  WRITE FIRST IPL CARD WITH 24 BYTES OF DATA (PSW,CCW,CCW)             00210000
                                     27 **********************************************************************  00220000
                                     28          PUT   PUNCH,CARD0        WRITE INITIAL IPL RECORD              00230000
00001E 4110 C170      00170          29+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
000022 4100 C1D0      001D0          30+         LA    0,CARD0                           LOAD PARAMETER REG 0   02500002
000026 58F0 1030      00030          31+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
00002A 05EF                          32+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
                                     33 **********************************************************************  00240000
                                     34 *  WRITE SECOND IPL CARD WITH ADDITIONAL READ CCW'S                     00250000
                                     35 **********************************************************************  00260000
                                     36          PUT   PUNCH,CARD1        WRITE SECOND IPL RECORD               00270000
00002C 4110 C170      00170          37+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
000030 4100 C220      00220          38+         LA    0,CARD1                           LOAD PARAMETER REG 0   02500002
000034 58F0 1030      00030          39+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
000038 05EF                          40+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
                                     41 **********************************************************************  00280000
                                     42 *  WRITE 3 CARDS CONTAINING EXECUTABLE CODE                             00290000
                                     43 **********************************************************************  00300000
                                     44          PUT   PUNCH,CARD2        WRITE DATA                            00310000
                                                                                                               PAGE    3

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

00003A 4110 C170      00170          45+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
00003E 4100 C270      00270          46+         LA    0,CARD2                           LOAD PARAMETER REG 0   02500002
000042 58F0 1030      00030          47+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
000046 05EF                          48+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
                                     49          PUT   PUNCH,CARD2+80     WRITE DATA                            00320000
000048 4110 C170      00170          50+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
00004C 4100 C2C0      002C0          51+         LA    0,CARD2+80                        LOAD PARAMETER REG 0   02500002
000050 58F0 1030      00030          52+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
000054 05EF                          53+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
                                     54          PUT   PUNCH,CARD2+160    WRITE DATA                            00330000
000056 4110 C170      00170          55+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
00005A 4100 C310      00310          56+         LA    0,CARD2+160                       LOAD PARAMETER REG 0   02500002
00005E 58F0 1030      00030          57+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
000062 05EF                          58+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
                                     59 **********************************************************************  00340000
                                     60 *                                                                       00350000
                                     61 *        NOW WRITE SOME TEST DATA CARDS BECHIND IPL PROGRAM             00360000
                                     62 *                                                                       00370000
                                     63 **********************************************************************  00380000
000064 4130 000A      0000A          64          LA    R3,10              TIMES TO REPEAT LOOP                  00390000
000068 4140 C0B8      000B8          65          LA    R4,=C'01020304050607080910'                              00400000
00006C 4150 C0CC      000CC          66          LA    R5,=C'*+@#$%-() '                                        00410000
000070                               67 LOOP     DS    0H                                                       00420000
000070 D200 C0D6 5000 000D6 00000    68          MVC   BUF(1),0(R5)       CHAR TO REPEAT                        00430000
000076 D24E C0D7 C0D6 000D7 000D6    69          MVC   BUF+1(79),BUF      FILL BUFFER                           00440000
00007C D201 C0D6 4000 000D6 00000    70          MVC   BUF(2),0(R4)       CARD NUMBER                           00450000
000082 9240 C0D8      000D8          71          MVI   BUF+2,C' '         AND A SPACE                           00460000
                                     72          PUT   PUNCH,BUF                                                00470000
000086 4110 C170      00170          73+         LA    1,PUNCH                           LOAD PARAMETER REG 1   01900002
00008A 4100 C0D6      000D6          74+         LA    0,BUF                             LOAD PARAMETER REG 0   02500002
00008E 58F0 1030      00030          75+         L     15,48(0,1)               LOAD PUT ROUTINE ADDR           00550000
000092 05EF                          76+         BALR  14,15                    LINK TO PUT ROUTINE             00600000
000094 4140 4002      00002          77          LA    R4,2(,R4)          INCREMENT                             00480000
000098 4150 5001      00001          78          LA    R5,1(,R5)                                                00490000
00009C 4630 C070      00070          79          BCT   R3,LOOP            LOOP BACK                             00500000
                                     80 *                                                                       00510000
                                     81          CLOSE (PUNCH)                                                  00520000
0000A0                               82+         CNOP  0,4                               ALIGN LIST TO FULLWORD 02420002
0000A0 4510 C0A8      000A8          83+         BAL   1,*+8                             LOAD REG1 W/LIST ADDR  02460002
0000A4 80                            84+         DC    AL1(128)                          OPTION BYTE            02580000
0000A5 000170                        85+         DC    AL3(PUNCH)                        DCB ADDRESS            02600000
0000A8 0A14                          86+         SVC   20                                ISSUE CLOSE SVC        01640000
                                     87 *                                                                       00530000
                                     88 *                                                                       00540000
                                                                                                               PAGE    4

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

0000AA 58D0 D004      00004          89          L     R13,4(,R13)        PREV SAVE AREA                        00550000
0000AE 98EC D00C      0000C          90          LM    R14,R12,12(R13)    RESTORE CALLERS REGISTERS             00560000
0000B2 1FFF                          91          SLR   R15,R15            RC=0                                  00570000
0000B4 07FE                          92          BR    R14                                                      00580000
                                     93 *                                                                       00590000
0000B8                               94          LTORG ,                                                        00600000
0000B8 F0F1F0F2F0F3F0F4              95                =C'01020304050607080910'
0000CC 5C4E7C7B5B6C604D              96                =C'*+@#$%-() '
                                     97 *                                                                       00610000
0000D6                               98 BUF      DS    CL80               CARD BUFFER                           00620000
                                     99 *                                                                       00630000
000128                              100 SAVEA    DS    18F                SAVEA AREA                            00640000
                                    101 *                                                                       00650000
                                    102 *                                                                       00660000
                                    103          PRINT NOGEN                                                    00670000
                                    104 PUNCH    DCB   DSORG=PS,MACRF=PM,BLKSIZE=80,LRECL=80,RECFM=F,          +00680000
                                                       DDNAME=PUNCH                                             00690000
                                    158          PRINT GEN                                                      00700000
                                    159 *                                                                       00710000
                                    160 *                                                                       00720000
                                    161          DROP  R12                                                      00730000
                                    162 **********************************************************************  00740000
                                    163 **********************************************************************  00750000
                                    164 ** FRIST CARD OF OUR IPL DECK                                           00760000
                                    165 **    IT CONTAINS 24 BYTES - PSW AND TWO CCW'S                          00770000
                                    166 **********************************************************************  00780000
                                    167 **********************************************************************  00790000
                                    168 *                                                                       00800000
0001D0                              169          DS    0D                                                       00810000
0001D0 0000000000000000             170 CARD0    DC    80XL1'00'          INITIAL IPL CARD                      00820000
000220                      001D0   171          ORG   CARD0                                                    00830000
                                    172 *                                                                       00840000
                                    173 **********************************************************************  00850000
                                    174 *        PSW                                                            00860000
                                    175 **********************************************************************  00870000
                                    176 *                                                                       00880000
0001D0 00                           177 IPLPSW   DC    X'00'              I/O & EXT INTERRUPTS DISABLED         00890000
0001D1 00                           178          DC    X'00'              KEY=0; BC; EXT INT DISABLED; SUP      00900000
0001D2 0000                         179          DC    X'0000'                                                  00910000
0001D4 00                           180          DC    X'00'              PROG INT DISABLED                     00920000
0001D5 000400                       181          DC    AL3(1024)          INITIAL EXECUTION ADDRESS             00930000
                                    182 *                                                                       00940000
                                    183 **********************************************************************  00950000
                                    184 *        CCW                                                            00960000
                                                                                                               PAGE    5

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

                                    185 **********************************************************************  00970000
                                    186 *                                                                       00980000
0001D8 02                           187 CCW1     DC    X'02'              READ                                  00990000
0001D9 000200                       188          DC    AL3(512)           ADDRESS FOR DATA                      01000000
0001DC 60                           189          DC    X'60'              CC + SLI                              01010000
0001DD 00                           190          DC    X'00'                                                    01020000
0001DE 0050                         191          DC    AL2(80)            LENGTH                                01030000
                                    192 *                                                                       01040000
                                    193 **********************************************************************  01050000
                                    194 *        CCW                                                            01060000
                                    195 **********************************************************************  01070000
                                    196 *                                                                       01080000
0001E0 08                           197 CCW2     DC    X'08'              TIC                                   01090000
0001E1 000200                       198          DC    AL3(512)           NEXT CCW ADDRESS                      01100000
0001E4 00                           199          DC    X'00'              CC + SLI                              01110000
0001E5 00                           200          DC    X'00'                                                    01120000
0001E6 0000                         201          DC    AL2(0)             LENGTH                                01130000
                                    202 *                                                                       01140000
                                    203 *                                                                       01150000
0001E8                      00220   204          ORG   ,                  RESTORE LOC TO HIGHEST                01160000
                                    205 *                                                                       01170000
                                    206 **********************************************************************  01180000
                                    207 **********************************************************************  01190000
                                    208 ** SECOND CARD OF OUR IPL DECK                                          01200000
                                    209 **    IT CONTAINS THREE CCW'S                                           01210000
                                    210 **    THESE CCW'S READ THE THREE CARDS CONTAINING EXECUTABLE CODE       01220000
                                    211 **********************************************************************  01230000
                                    212 **********************************************************************  01240000
000220                              213          DS    0D                                                       01250000
000220 0000000000000000             214 CARD1    DC    80XL1'00'          SECOND IPL CARD                       01260000
000270                      00220   215          ORG   CARD1                                                    01270000
                                    216 *                                                                       01280000
                                    217 **********************************************************************  01290000
                                    218 *        CCW                                                            01300000
                                    219 **********************************************************************  01310000
                                    220 *                                                                       01320000
000220 02                           221 CCW3     DC    X'02'              READ                                  01330000
000221 000400                       222          DC    AL3(1024)          ADDRESS FOR DATA                      01340000
000224 60                           223          DC    X'60'              CC + SLI                              01350000
000225 00                           224          DC    X'00'                                                    01360000
000226 0050                         225          DC    AL2(80)            LENGTH                                01370000
                                    226 *                                                                       01380000
                                    227 **********************************************************************  01390000
                                    228 *        CCW                                                            01400000
                                                                                                               PAGE    6

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

                                    229 **********************************************************************  01410000
                                    230 *                                                                       01420000
000228 02                           231 CCW4     DC    X'02'              READ                                  01430000
000229 000450                       232          DC    AL3(1024+80)       ADDRESS FOR DATA                      01440000
00022C 60                           233          DC    X'60'              CC + SLI                              01450000
00022D 00                           234          DC    X'00'                                                    01460000
00022E 0050                         235          DC    AL2(80)            LENGTH                                01470000
                                    236 *                                                                       01480000
                                    237 **********************************************************************  01490000
                                    238 *        CCW                                                            01500000
                                    239 **********************************************************************  01510000
                                    240 *                                                                       01520000
000230 02                           241 CCW5     DC    X'02'              READ                                  01530000
000231 0004A0                       242          DC    AL3(1024+160)      ADDRESS FOR DATA                      01540000
000234 20                           243          DC    X'20'              SLI                                   01550000
000235 00                           244          DC    X'00'                                                    01560000
000236 0050                         245          DC    AL2(80)            LENGTH                                01570000
                                    246 *                                                                       01580000
                                    247 *                                                                       01590000
                                    248 *                                                                       01600000
                                    249 *                                                                       01610000
000238                      00270   250          ORG   ,                  RESTORE LOC TO HIGHEST                01620000
                                    251 *                                                                       01630000
                                    252 **********************************************************************  01640000
                                    253 **********************************************************************  01650000
                                    254 ** THIRD, FOURTH AND FIFTH CARDS OF IPL DECK                            01660000
                                    255 **    IT CONTAINS THE EXECUTABLE PROGRAM                                01670000
                                    256 **********************************************************************  01680000
                                    257 **********************************************************************  01690000
000270                              258          DS    0D                                                       01700000
000270                              259 CARD2    DS    0X                 SECOND IPL CARD                       01710000
                                    260 **********************************************************************  01720000
                                    261 *        EXECUTABLE PROGRAM BEINGS HERE                                 01730000
                                    262 **********************************************************************  01740000
000270                              263 BEGIN    DS    0H                                                       01750000
000270 05A0                         264          BALR  R10,0              ESTABLISH BASE REG                    01760000
                            00272   265          USING *,R10                                                    01770000
                                    266 *                                                                       01780000
                                    267 **********************************************************************  01790000
                                    268 *        GET DEVICE PHYSICAL ADDRESSES R3=RDR R4=PRT                    01800000
                                    269 **********************************************************************  01810000
                                    270 *                                                                       01820000
000272 1F33                         271          SLR   R3,R3              CLEAR R3                              01830000
000274 BF33 0002      00002         272          ICM   R3,B'0011',2       GET IPL DEVICE (CARD RDR)             01840000
                                                                                                               PAGE    7

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

000278 4140 000E      0000E         273          LA    R4,X'E'            ASSUME PRINTER AT 00E                 01850000
                                    274 *                                                                       01860000
                                    275 **********************************************************************  01870000
                                    276 *        PUT THE I/O BUFFER ADDRESS INTO THE CCW'S                      01880000
                                    277 **********************************************************************  01890000
                                    278 *                                                                       01900000
00027C 4110 A0C0      00332         279          LA    R1,RDBUF           READ BUFFER                           01910000
000280 BE17 A067      002D9         280          STCM  R1,B'0111',RDCCW+1 ADDRESS TO READ CCW                   01920000
000284 BE17 A06F      002E1         281          STCM  R1,B'0111',PRCCW+1 ADDRESS TO PRINT CCW                  01930000
                                    282 *                                                                       01940000
                                    283 **********************************************************************  01950000
                                    284 *        PROGRAM MAIN LOOP                                              01960000
                                    285 **********************************************************************  01970000
                                    286 *                                                                       01980000
000288                              287 RDLP     DS    0H                                                       01990000
000288 4110 A066      002D8         288          LA    R1,RDCCW           GET ADDR OF READ CCW                  02000000
00028C 5010 0048      00048         289          ST    R1,72              PUT INTO CAW                          02010000
                                    290 *                                                                       02020000
000290 9C00 3000      00000         291          SIO   0(R3)              ISSUE READ                            02030000
000294 4770 A080      002F2         292          BNZ   ERR1               BRANCH IF ERROR                       02040000
                                    293 *                                                                       02050000
                                    294 **********************************************************************  02060000
                                    295 *        WAIT FOR READ I/O TO COMPLETE                                  02070000
                                    296 **********************************************************************  02080000
                                    297 *                                                                       02090000
000298                              298 RDTIO    DS    0H                                                       02100000
000298 9D00 3000      00000         299          TIO   0(R3)              CHECK FOR I/O COMPLETION              02110000
00029C 4780 A036      002A8         300          BZ    PRT                GO PRINT IF GOOD                      02120000
0002A0 4710 A084      002F6         301          BC    1,ERR2             BRAHCH IF ERR                         02130000
0002A4 47F0 A026      00298         302          B     RDTIO              WAIT AGAIN                            02140000
                                    303 *                                                                       02150000
                                    304 **********************************************************************  02160000
                                    305 *        CHECK FOR SUCCESSFUL COMPLETION OF I/O                         02170000
                                    306 *                                                                       02180000
                                    307 *        EXPECT ONLY CHANNEL END + DEVICE END                           02190000
                                    308 *                                                                       02200000
                                    309 *        ANYTHING ELSE WE QUIT                                          02210000
                                    310 *                                                                       02220000
                                    311 **********************************************************************  02230000
                                    312 *                                                                       02240000
0002A8                              313 PRT      DS    0H                                                       02250000
0002A8 D501 A0BE 0044 00330 00044   314          CLC   CEDE,68            CE+DE                                 02260000
0002AE 4770 A076      002E8         315          BNE   ERR0               NO - QUIT                             02270000
                                    316 *                                                                       02280000
                                                                                                               PAGE    8

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

                                    317 **********************************************************************  02290000
                                    318 *        SET UP CAW FOR PRINT                                           02300000
                                    319 **********************************************************************  02310000
                                    320 *                                                                       02320000
0002B2 4110 A06E      002E0         321          LA    R1,PRCCW           POINT TO PRINT CCW                    02330000
0002B6 5010 0048      00048         322          ST    R1,72              SAVE ADDRESS IN CAW                   02340000
                                    323 *                                                                       02350000
0002BA 9C00 4000      00000         324          SIO   0(R4)              PRINT LINE                            02360000
0002BE 4770 A088      002FA         325          BNZ   ERR3               BRANCH IF ERROR                       02370000
                                    326 *                                                                       02380000
                                    327 **********************************************************************  02390000
                                    328 *        WAIT FOR I/O TO COMPLETE                                       02400000
                                    329 **********************************************************************  02410000
                                    330 *                                                                       02420000
0002C2                              331 PRTTIO   DS    0H                                                       02430000
0002C2 9D00 4000      00000         332          TIO   0(R4)              CHECK FOR I/O COMPLETE                02440000
0002C6 4780 A016      00288         333          BZ    RDLP               DONE - GO READ NEXT CARD              02450000
0002CA 4710 A08C      002FE         334          BC    1,ERR4             BRANCH IF ERROR                       02460000
                                    335 *                                                                       02470000
                                    336 **********************************************************************  02480000
                                    337 *        LOOP BACK AND READ NEXT CARD                                   02490000
                                    338 **********************************************************************  02500000
                                    339 *                                                                       02510000
0002CE 47F0 A050      002C2         340          B     PRTTIO             WAIT AGAIN                            02520000
                                    341 *                                                                       02530000
                                    342 *                                                                       02540000
                                    343 **********************************************************************  02550000
                                    344 *        CCW'S TO READ AND PRINT                                        02560000
                                    345 **********************************************************************  02570000
                                    346 *                                                                       02580000
                                    347 *                                                                       02590000
0002D8                              348          DS    0D                                                       02600000
0002D8 0200000000000050             349 RDCCW    DC    X'02',AL3(0),X'0000',AL2(80)                             02610000
0002E0 0900000000000050             350 PRCCW    DC    X'09',AL3(0),X'0000',AL2(80)                             02620000
                                    351 *                                                                       02630000
                                    352 *                                                                       02640000
                                    353 **********************************************************************  02650000
                                    354 *        ERROR ROUTINES                                                 02660000
                                    355 *           LOAD PSW WITH WAIT BIT SET TO ONE                           02670000
                                    356 **********************************************************************  02680000
                                    357 *                                                                       02690000
                                    358 *                                                                       02700000
0002E8 D201 A09C 0044 0030E 00044   359 ERR0     MVC   PSWERR0+6(2),68                                          02710000
0002EE 8200 A096      00308         360          LPSW  PSWERR0                                                  02720000
                                                                                                               PAGE    9

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

0002F2 8200 A09E      00310         361 ERR1     LPSW  PSWERR1                                                  02730000
0002F6 8200 A0A6      00318         362 ERR2     LPSW  PSWERR2                                                  02740000
0002FA 8200 A0AE      00320         363 ERR3     LPSW  PSWERR3                                                  02750000
0002FE 8200 A0B6      00328         364 ERR4     LPSW  PSWERR4                                                  02760000
                                    365 *                                                                       02770000
                                    366 *                                                                       02780000
                                    367 **********************************************************************  02790000
                                    368 *        WAIT PSW'S                                                     02800000
                                    369 **********************************************************************  02810000
                                    370 *                                                                       02820000
                                    371 *                                                                       02830000
000308                              372          DS    0D                                                       02840000
000308 0002000000000000             373 PSWERR0  DC    X'00',X'02',X'0000',X'00',X'000000'                      02850000
000310 0002000000EE0001             374 PSWERR1  DC    X'00',X'02',X'0000',X'00',X'EE0001'                      02860000
000318 0002000000EE0002             375 PSWERR2  DC    X'00',X'02',X'0000',X'00',X'EE0002'                      02870000
000320 0002000000EE0003             376 PSWERR3  DC    X'00',X'02',X'0000',X'00',X'EE0003'                      02880000
000328 0002000000EE0004             377 PSWERR4  DC    X'00',X'02',X'0000',X'00',X'EE0004'                      02890000
                                    378 *                                                                       02900000
                                    379 *                                                                       02910000
                                    380 **********************************************************************  02920000
                                    381 *        CHANNEL END + DEVICE END                                       02930000
                                    382 **********************************************************************  02940000
                                    383 *                                                                       02950000
                                    384 *                                                                       02960000
000330 0C00                         385 CEDE     DC    X'0C00'            CHANNEL END + DEVICE END              02970000
                                    386 *                                                                       02980000
                                    387 *                                                                       02990000
                                    388 **********************************************************************  03000000
                                    389 *        I/O BUFFER AREA                                                03010000
                                    390 **********************************************************************  03020000
                                    391 *                                                                       03030000
                                    392 *                                                                       03040000
                            000C2   393 CARD2LEN EQU   *-CARD2                                                  03050000
000332                              394 RDBUF    DS    0C            I/O BUFFER                                 03060000
000332                      00332   395          ORG   ,                                                        03070000
                                    396 *                                                                       03080000
                                    397 *                                                                       03090000
                                    398 **********************************************************************  03100000
                                    399 *        BUFFER AREA TO MAKE SURE WE HAVE AT LEAST 80 BYTES FOR THE     03110000
                                    400 *        LAST CARD WE WRINTE                                            03120000
                                    401 **********************************************************************  03130000
                                    402 *                                                                       03140000
                                    403 *                                                                       03150000
000332                              404          DS    CL80          *** EXTRA BUFFER AREA ***                  03160000
                                                                                                               PAGE   10

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.10 08/19/11

                                    405 *                                                                       03170000
                                    406 *                                                                       03180000
                                    407 **********************************************************************  03190000
                                    408 *        REGISTER EQUATES                                               03200000
                                    409 **********************************************************************  03210000
                                    410 *                                                                       03220000
                                    411 *                                                                       03230000
                            00000   412 R0       EQU   0                                                        03240000
                            00001   413 R1       EQU   1                                                        03250000
                            00002   414 R2       EQU   2                                                        03260000
                            00003   415 R3       EQU   3                                                        03270000
                            00004   416 R4       EQU   4                                                        03280000
                            00005   417 R5       EQU   5                                                        03290000
                            00006   418 R6       EQU   6                                                        03300000
                            00007   419 R7       EQU   7                                                        03310000
                            00008   420 R8       EQU   8                                                        03320000
                            00009   421 R9       EQU   9                                                        03330000
                            0000A   422 R10      EQU   10                                                       03340000
                            0000B   423 R11      EQU   11                                                       03350000
                            0000C   424 R12      EQU   12                                                       03360000
                            0000D   425 R13      EQU   13                                                       03370000
                            0000E   426 R14      EQU   14                                                       03380000
                            0000F   427 R15      EQU   15                                                       03390000
                                    428 *                                                                       03400000
                                    429 *                                                                       03410000
                                    430          END   ,                                                        03420000

[Next – Assemble and Execute]

Creating The IPL Deck

We can use the Assembler to do the heavy lifting for us.  It is assumed the reader knows the basics of writing, assembling and executing assembler programs.

We are really writing two programs here.  One is the 80-80 list program and the other is a program to create the IPL deck.  When we assemble and run our program only half of the code will be executed – the other half will be punched into a card deck.

We can make use of the ORG Assembler directive to make our work easier.  ORG is not an executable instruction.  It is an instruction to the assembler telling it how to organize storage.   Our first card in the IPL deck is the 24 bytes containing the PSW and two CCWs.  We can get the assembler to help us create it by using:

CARD0    DS    80XL1'00'
         ORG   CARD0
IPLPSW   DC    X'00',X'00',X'0000',X'00',AL3(1024)
CCW1     DC    X'02',AL3(512),X'60',X'00',AL2(80)
CCW2     DC    X'08',AL3(512),X'00',X'00',AL2(0)
         ORG   ,

First we create an area of 80 bytes of hex zeros.  We can then use ORG to reset the address back to the beginning of the card area.  This will cause the 80 bytes of zeros to be overlayed with the data for the PSW and CCWs.  After we define the PSW and CCWs we use ORG with no operand to reset the address to the highest address previously used before we reset it with the first ORG.  This keeps us from having to count bytes and manually pad out the unused portion of our 80 bytes card area.

We can create our second card containing the additional read CCWs the same way.

         DS    0D
CARD1    DC    80XL1'00'            Second IPL Card
         ORG   CARD1
*
CCW3     DC    X'02',AL3(1024),X'60',x'00',AL2(80)
CCW4     DC    X'02',AL3(1024+80),X'60',X'00',AL2(80)
CCW5     DC    X'02',AL3(1024+160),X'20',X'00',AL2(80)
*
         ORG   ,

The third, fourth and fifth cards of our IPL deck come from the code of our executable program.

Here is the program to punch out our IPL deck:

CARD80   CSECT ,
         STM   R14,R12,12(R13)      Save callers registers
         LR    R12,R15              Use R12 as our program base
         USING CARD80,R12
*
         LA    R1,SAVEA             Point to new Save Area
         ST    R1,8(,R13)           Chain
         ST    R13,4(,R1)                On
         LR    R13,R1                      Save Area
*
         OPEN  (PUNCH,OUTPUT)       Open Output File
*
         PUT   PUNCH,CARD0          Write First Card
*
         PUT   PUNCH,CARD1          Write Second Card
*
* Write Three Cards of Executable Code
*
         PUT   PUNCH,CARD2
         PUT   PUNCH,CARD2+80
         PUT   PUNCH,CARD2+160
*

The way I know to punch three cards for the executable code is simple.  I assembled the program and then looked at the listing to determine the size in bytes of the IPL program.  It was then a simple matter of dividing by 80 and adding one for any nonzero remainder to get the number of cards required.

At this point, we have written five cards that contain our IPL stand alone program, and if we were working with real cards, we would be done, because we would just put some data cards behind our IPL deck after it was punched out and then input the combined deck via the card reader. However, since we are working with virtual cards rather than real ones that we already have on hand, we must also create the data cards we will use for our testing.

To do this, we will generate ten additional data cards. Our first step will be to fill an entire card image with 80 instances of a certain character, and then we will overlay the first three card columns of this card image with a number from 01 to 10, followed by a space. Thus, our first data card will look like the following.

 

01 *****************...

Here is the code I use to create my data cards.

         LA    R3,10          Number of times to repeat
         LA    R4,=C'01020304050607080910'
         LA    R5,=C'*+@#$%-() '
LOOP     DS    0H
         MVC   BUF(1),0(R5)   Move in char to repeat
         MVC   BUF+1(79),BUF  Fill buffer with repeated char
         MVC   BUF(2),0(R4)   Move in card number
         MVI   BUF+2,C' '     Followed by a space
*
         PUT   PUNCH,BUF      Write out card record
*
         LA    R4,2(,R4)      Point to next card number
         LA    R5,1(,R5)      Point to next repeating character
         BCT   R3,LOOP        Loop back for next card image
*

Now we are almost done creating the card deck and we can close the DCB, restore the caller’s registers and exit our program.

         CLOSE (PUNCH)         Close output DCB
*
         L     R13,4(,R13)     Point to caller's save area
         LM    R14,R12,12(R13) Restore caller's registers
         SLR   R15,R15         Set RC=0
         BR    R14             Return to caller
*

All we are missing is some data areas which we now add, as follows.

         LTORG ,               Generate literals here
*
BUF      DS    CL80            Output Buffer
*
SAVEA    DS    18F             Register Save Area
*
PUNCH    DCB   DSORG=PS,MACRF=PM,BLKSIZE=80,LRECL=80,
               RECFM=F,DDNAME=PUNCH
*
*
         DROP  R12              No longer used as a base register

[Next – Card80 Assembly Listing ]