IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What exactly is effective address


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Mon Aug 21, 2006 6:52 pm
Reply with quote

All,

This might soud pretty primitve but I need to know what exactly do we mean when we code

D2(X2,B2)???

How is this resolved???
What is the use of Index Register here ???


Thanks
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Tue Aug 22, 2006 4:10 am
Reply with quote

D2(X2,B2) : [D2] + X2 + B2 <== this forms a complete memory address where the Actual data is stored

In Breif,
Effective Address : an address formed using 2 registers, which will allow us to acces Virtual memory of a processor.

X2 : Index register : this are used to create memory address by adding to contents of a address register (in above ex : to the contents of D2). Few processors will have specific Index register (for ex MP 80x86[not sure] have SI/DI as Index register) whereas, few Porcessors like IBm 360/370 will use the 16 GPR registers as index registers.

D2: Addres Rgeister or BaseRegister: the contents of this registers are added to Index registers to form the complete physical address.

B2 : Displacement , some constant value I guess

For further details, go thru some manuals in forum.

guys, plz do correct me if I am wrong.
Back to top
View user's profile Send private message
phetu

New User


Joined: 19 Aug 2006
Posts: 13
Location: Canada

PostPosted: Tue Aug 22, 2006 4:15 am
Reply with quote

You are right except that you wrote "D2:Addres Rgeister or BaseRegister" instead of "B2:Addres Rgeister or BaseRegister" and "B2:Displacement " instead of "D2:Displacement ".

Patrick
Back to top
View user's profile Send private message
Archana_MF

New User


Joined: 21 Jul 2006
Posts: 49
Location: California

PostPosted: Tue Aug 22, 2006 6:44 am
Reply with quote

Thank you.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Tue Aug 22, 2006 8:58 am
Reply with quote

All,

Thanks for the reply.
But can you be more specific about Index Register here??
Why and where can I use Index register???
Back to top
View user's profile Send private message
phetu

New User


Joined: 19 Aug 2006
Posts: 13
Location: Canada

PostPosted: Tue Aug 22, 2006 1:36 pm
Reply with quote

Lets says that you have a table of 10 entries of 80 bytes long and you would like to scan each entry to process a certain address field that is poistionned at an offset of 40 bytes.

Then B2 (base register) could be the address of the table, the I2 (index register) could containt the offset to the current entry (entries number x 80 bytes) and D2 would be the displacement within the entry ( 40 in our case).

So, the code would be:

LA R3,TABLE ---> R3 will be our base register - Initialize to the TABLE's address
LA R4,0 ---> R4 will be the index register - Start at 0 so it will point to the very first entry
LA R5,10 ---> R5 will contain the number of TABLE's entries...in our case it's 10.
LOOP DS 0H ---> Label
L R6,40(R4,R3) ---> Take the content of bytes 40 for 4 bytes long and put it into reg R6
.....
.....
..... ---> Process the R6 register as you want
.....
LA R4,80(R4) ---> Skip to the next entry : Add 80 to the contents of R80
BCTR R5,LOOP ---> Loop until all the entries are process...

Does it answer your question?

Patrick
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Aug 24, 2006 10:18 am
Reply with quote

Thanks Pat, yes it answers my question.

However i get one more doubt here.
Why do we use Index register here ???
I can change me displacement from my base address to get to that table entry ! Isnt it ??? Is it just another way of addressing ??

Thanks
ap
Back to top
View user's profile Send private message
phetu

New User


Joined: 19 Aug 2006
Posts: 13
Location: Canada

PostPosted: Thu Aug 24, 2006 2:45 pm
Reply with quote

It is another way of addressing. In this case you could assume that the R3 is initialize at the beginning of the program and it is never re-initialized. So if you would need to scan the table agin, you would only have to set the Index regs....

The same example with the move instruction (MVC), you would have to use the base register to scan the table because there is no Index register supplied...

Patrick
Back to top
View user's profile Send private message
Bharanidharan

New User


Joined: 20 Jun 2005
Posts: 86
Location: Chennai, India

PostPosted: Fri Aug 25, 2006 6:09 pm
Reply with quote

Whoa, something is nagging me. How can you 'change' your displacement from your base reg, say for a number of times in a loop? You either have to damage the base reg, which may not be desirable, or must use index reg. In the previous example:
L R6,40(R4,R3)
Can you accomplish this without using index reg or without damaging R3? I don't think we can.
Back to top
View user's profile Send private message
phetu

New User


Joined: 19 Aug 2006
Posts: 13
Location: Canada

PostPosted: Fri Aug 25, 2006 11:29 pm
Reply with quote

No, for use we can't do that without using index reg or without damaging R. In that case I used R4 as my index register

Patrick
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts PL/1 Callback address logic in z/OS C... PL/I & Assembler 1
No new posts Access an specific memory address exp... COBOL Programming 1
No new posts Abends using up address spaces? ABENDS & Debugging 6
No new posts *MASTER* address space abending at IPL All Other Mainframe Topics 2
Search our Forums:

Back to Top