Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Addressing mode
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==={{anchor|REGISTER PLUS IMMIEDIATE CONSTANT}}Base plus offset, and variations=== This is sometimes referred to as 'base plus displacement' or 'truncated'. +------+-----+-----+----------------+ | load | reg | base| offset | reg := RAM[base + offset] +------+-----+-----+----------------+ (Effective address = offset + contents of specified base register) If the offset is zero, this becomes an example of ''register indirect'' addressing; the effective address is just the value in the base register. On many RISC machines, register 0 is fixed at the value zero. If register 0 is used as the base register, this becomes an example of ''absolute addressing''. However, only a small portion of memory can be accessed. The offset is often small in relation to the size of current computer memories. However, the principle of [[locality of reference]] applies: over a short time span, most of the data items a program wants to access are fairly close to each other. This addressing mode is closely related to the indexed absolute addressing mode. ''Example 1'': Within a subroutine a programmer will mainly be interested in the parameters and the local variables, for which one base register (the [[frame pointer]]) usually suffices. If this routine is a class method in an object-oriented language, then a second base register is needed which points at the attributes for the current object ('''this''' or '''self''' in some high level languages). ''Example 2'': If the base register contains the address of a [[composite type]] (a record or structure), the offset can be usually used to select a field from that record.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)