RX Instructions



High Level Assembler(HLASM) for MVS & VM & VSE

RX Instructions

Postby tanu_2302 » Wed Dec 21, 2016 5:59 pm

Hi all,
I need clarification on the use of index Reg and displacement. When we use RX instruction, we define second operand by giving index,base and displacement. Can any one tell me how displacement and index works? why we are using them? Individual significance of index,displacement and base.
Thanks in advance :)
tanu_2302
 
Posts: 9
Joined: Tue Nov 08, 2016 12:45 pm
Has thanked: 1 time
Been thanked: 0 time

Re: RX Instructions

 

Re: RX Instructions

Postby steve-myers » Wed Dec 21, 2016 7:54 pm

The concept of calculating a data area address using a "displacement" and a "base register" is described in Assembler text books and I won't repeat this here.

When you specify an "index register" in an RX instruction the computer adds the contents of the register to the address computed by using the displacement and base register.

These users thanked the author steve-myers for the post:
tanu_2302 (Thu Dec 22, 2016 10:31 am)
steve-myers
Global moderator
 
Posts: 1869
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 192 times

Re: RX Instructions

Postby steve-myers » Fri Dec 30, 2016 8:13 pm

The following program uses an index register twice -
INDEXR   RSECT
         USING *,2
         SAVE  (14,2)
         LR    2,15
         TIME  BIN
         SR    0,0
         STM   0,1,64(13)
         CVB   1,64(,13)
         D     0,=F'1000'
         LA    14,1900(,1)
         LR    15,14
         LR    1,0
         LA    0,B'11'
         NR    14,0
         BNZ   NOTLEAP
         D     14,=F'100'
         LTR   14,14
         BNZ   ISLEAP
         NR    15,0
         BZ    ISLEAP
NOTLEAP  CH    1,=AL2(31+28)
         BNH   ISLEAP
         LA    1,1(,1)
ISLEAP   IC    14,TAB1(1)  <- First use of an index register
         SLL   14,1
         SH    1,TAB2(14)  <- Second use of an index register
         LR    15,1
         RETURN (14,2),RC=(15)
         LTORG ,
TAB2     EQU   *-2
         DC    AL2(0)
         DC    AL2(31)
         DC    AL2(31+29)
         DC    AL2(31+29+31)
         DC    AL2(31+29+31+30)
         DC    AL2(31+29+31+30+31)
         DC    AL2(31+29+31+30+31+30)
         DC    AL2(31+29+31+30+31+30+31)
         DC    AL2(31+29+31+30+31+30+31+31)
         DC    AL2(31+29+31+30+31+30+31+31+30)
         DC    AL2(31+29+31+30+31+30+31+31+30+31)
         DC    AL2(31+29+31+30+31+30+31+31+30+31+30)
TAB1     EQU   *-1
         DC    31AL1(1),29AL1(2),31AL1(3)
         DC    30AL1(4),31AL1(5),30AL1(6)
         DC    31AL1(7),31AL1(8),30AL1(9)
         DC    31AL1(10),30AL1(11),31AL1(12)
         END   INDEXR

If someone out there makes an honest attempt to understand this program, what will be in register 15 when the program returns when it is run December 30, 2016?
steve-myers
Global moderator
 
Posts: 1869
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 192 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post