The pieces of an ASSEMBLER program

 

 

Linkage Conventions:

  1. On entry to an assembler program, R15 contains the address of the entry point (ie. the beginning of the program). R15 may be used as a base register.

  2. On entry to an assembler program, R14 contains the return address, which is an address in the operating system to branch to when the program is finished.

 

A sample ASSEMBLER program:

Address          Code to execute
 000000          EXMPL1  CSECT
 000000                  L     5,24(,15)
 000004                  A     5,28(,15)
 000008                  ST    5,36(,15)
 00000C                  L     4,32(,15)
 000010                  SR    4,5
 000012                  ST    4,40(,15)
 000016                  BCR   B’1111’,14
 000018          NUM1    DC    F’15’
 00001C          NUM2    DC    F’7’
 000020          NUM3    DC    F’8’
 000024          RESULT1 DS    F
 000028          RESULT2 DS    F
                         END   EXMPL1

 

Wouldn’t it have been nice to be able to use the labels NUM1, NUM2, etc...?

 

Implicit Addressing

 

A revised sample ASSEMBLER program:

Address          Code to execute
 000000          EXMPL1  CSECT
 000000                  USING EXMPL1,15
 000000                  L     5,NUM1
 000004                  A     5,NUM2
 000008                  ST    5,RESULT1
 00000C                  L     4,NUM3
 000010                  SR    4,5
 000012                  ST    4,RESULT2
 000016                  BCR   B’1111’,14
 000018          NUM1    DC    F’15’
 00001C          NUM2    DC    F’7’
 000020          NUM3    DC    F’8’
 000024          RESULT1 DS    F
 000028          RESULT2 DS    F
                         END   EXMPL1