On Tue, 5 Jun 2012 14:51:48 -0400, Robert A. Rosenberg wrote:

>At 07:57 -0400 on 06/05/2012, Tom Marchant wrote about Re: Base registers:
>
>>By adding a few LOCTR instructions, all of the data can be grouped at
>>the beginning of the program.  If relative branches are used in the code,
>>the base register is needed only for data and literals.
>>
>>MYCSECT  CSECT
>>          USING *,R15
>>          J     BYID
>>DATA     LOCTR
>>ID       DC    C'module-name'
>>BASES    DC    A(MYCSECT)
>>          DC    A(MYCSECT+4096)
>>          DC    A(MYCSECT+2*4096)
>>          DC    A(MYCSECT+3*4096)
>>BYID     DS    0H
>>CODE     LOCTR
>>          LM    R9,R12,BASES
>>          DROP R15
>>          USING MYCSECT,R9,R10,R11,R12
>>...
>>DATA     LOCTR
>>* additional DC statements are coded here
>>          LTORG
>>
>>You can probably do with only one base register for the data.
>
>That BYID needs to be placed after the CODE LOCTR or you will be
>jumping into your DATA area and a DC or the LTORG.

Right.  Thanks for the correction.  The above should be coded as:

>>MYCSECT  CSECT
>>         USING *,R15
>>         J     BYID
>>DATA     LOCTR
>>ID       DC    C'module-name'
>>BASES    DC    A(MYCSECT)
>>         DC    A(MYCSECT+4096)
>>         DC    A(MYCSECT+2*4096)
>>         DC    A(MYCSECT+3*4096)
>>CODE     LOCTR
>>BYID     DS    0H
>>         LM    R9,R12,BASES
>>         DROP R15
>>         USING MYCSECT,R9,R10,R11,R12
>>...
>>DATA     LOCTR
>>* additional DC statements are coded here
>>         LTORG

--
Tom Marchant

Reply via email to