On Fri, 16 Nov 2018 02:17:47 +1100, Greg Price wrote:
>On 2018-11-16 1:47 AM, Ward Able, Grant wrote:
>> Can someone point me to a reasonably simple example?
>
>If you can do branch instructions then you can do branch-relative
>instructions. Apart from RR instructions (BR, BASR, BALR, BASSM, BSM,
>BAKR and any others I've missed) replace the B that starts the branch
>instruction mnemonic with BR, or as I prefer to do, with J (for jump).
>
>eg. BNH -> JNH and BCT -> JCT and BAS -> JAS etc.
The only thing that you can't do is an indexed branch, where you use a
base register and an index register.
>Put all the stuff which needs to be cover by a base register after all
>the instructions, and start the area with a label, and "use" that.
That's one way to do it. Another is to consolidate all the constants at the
beginning of the program using LOCTR. For example, like this:
PROGNAME J START
DATA LOCTR
(any eyecatcher data that you want at the beginning of your program)
CODE LOCTR
START STM 14,12,12(13) or whatever method you use to save the registers
LARL 12,PROGNAME establish base register for the program
USING PROGNAME,12 Register 12 is just an example
(more code)
DATA LOCTR
(constants for the main routine)
CODE LOCTR
(code for the first subroutine)
DATA LOCTR
(constants for the first subroutine)
CODE LOCTR
(code for the second subroutine)
DATA LOCTR
(constants for the second subroutine)
...
LTORG
"DATA" and "CODE" are arbitrary labels that are used to name the
location counters that you need for your program. The assembler
will consolidate all of the sections that use the same named location
counter together, and will put them together in the order that each
named location counter is first used. Because "DATA" is the first one
used in the program, all DATA will be before all CODE.
There is also an unnamed location counter that is used for the first
instruction (J START).
--
Tom Marchant
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN