Base register



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

Base register

Postby vikram G » Sat Mar 05, 2011 6:14 pm

In assemlber programming how many maximum base registers we can have in a single program :?:
And also registers R0,R14,R15 and R1 can we used as a base registers or in any scenarios we should not use that as a base registers?


Please reply?
vikram G
 
Posts: 9
Joined: Fri Dec 17, 2010 9:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Base register

Postby steve-myers » Sat Mar 05, 2011 6:57 pm

How many registers are there in the hardware?

You cannot use register 0 as a base register.

Registers 14, 15 and 1 are generally considered to be very volatile; you should consider them as being altered in most system macros, so they should not be thought of as suitable for long term base registers for programs, though they are suitable for short term usage.
                                    328          PUT   PRINT,HDR
0003DE 4110 512E            004B8   330+         LA    1,PRINT
0003E2 4100 54F8            00882   331+         LA    0,HDR
0003E6 1FFF                         332+         SLR   15,15
0003E8 BFF7 1031            00031   333+         ICM   15,7,49(1)
0003EC 05EF                         334+         BALR  14,15

In this code, register 5 is the base register for the two LA instructions in the PUT macro. In the ICM 15,7,49(1) instruction register 1 is a base register. Notice that this macro used and altered registers 0, 1, 14 and 15. It uses register 1 as a base register in one instruction. In theory the author of this macro could have used ICM 15,7,PRINT+49, which would have used register 5 as a base register, but it was not done because the user of the macro can use a register in place of a symbol: PUT (register1),(register2), which would require the macro to do LR 1,register-1; LR 0,register-2 in place of the two LA instructions.

In the first two paragraphs I implied you could use 15 registers. In practice you need registers for other uses, so those registers are not available as base registers. I have seen as many as 4 registers used as base registers in some programs, though this is very unusual, and it makes it difficult to alter these programs since you cannot use the base registers for other purposes.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post