Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:cs:chapter_3_10 [2025/01/08 08:24] – [Program control flow destination addressing] ktokarzen:multiasm:cs:chapter_3_10 [2025/01/09 08:19] (current) – [Program control flow destination addressing] ktokarz
Line 93: Line 93:
 </code> </code>
  
-<figure jumpdirect>+<figure jumpindirect>
 {{ :en:multiasm:cs:jump_indirect.png?600 |Illustration of addressing in indirect jump}} {{ :en:multiasm:cs:jump_indirect.png?600 |Illustration of addressing in indirect jump}}
 <caption>Illustration of addressing in indirect jump</caption> <caption>Illustration of addressing in indirect jump</caption>
Line 100: Line 100:
 ===== Absolute and Relative addressing ===== ===== Absolute and Relative addressing =====
  
-In all previous examples, the addresses were specified as the values which represent the **absolute** memory location. The resulting address (even calculated as the sum of some values) was the memory location counted from the beginning of the memory - address "0".+In all previous examples, the addresses were specified as the values which represent the **absolute** memory location. The resulting address (even calculated as the sum of some values) was the memory location counted from the beginning of the memory - address "0"It is presented in Fig{{ref>addrabsolute}}. 
 + 
 +<figure addrabsolute> 
 +{{ :en:multiasm:cs:addressing_absolute.png?600 |Illustration of absolute addressing of the variable}} 
 +<caption>Illustration of absolute addressing of the variable</caption> 
 +</figure>
  
 Absolute addressing is simple and doesn't require any additional calculations by the processor. It is often used in embedded systems, where the software is installed and configured by the designer and the location of programs does not change. Absolute addressing is simple and doesn't require any additional calculations by the processor. It is often used in embedded systems, where the software is installed and configured by the designer and the location of programs does not change.
-Absolute addressing is very hard to use in general-purpose operating systems like Linux or Windows where the user can start a variety of different programs, and their placement in the memory differs every time they're loaded and executed. Much more useful is the **relative addressing** where operands are specified as differences from memory location and some known value which can be easily modified and accessed. Often the operands are provided relative to the Instruction Pointer which allows the program to be loaded at any address in the address space, but the distance between the currently executed instruction and the location of the data it wants to reach is always the same. This is the default addressing mode in the Windows operating system working on x64 machines.+Absolute addressing is very hard to use in general-purpose operating systems like Linux or Windows where the user can start a variety of different programs, and their placement in the memory differs every time they're loaded and executed. Much more useful is the **relative addressing** where operands are specified as differences from memory location and some known value which can be easily modified and accessed. Often the operands are provided relative to the Instruction Pointer which allows the program to be loaded at any address in the address space, but the distance between the currently executed instruction and the location of the data it wants to reach is always the same. This is the default addressing mode in the Windows operating system working on x64 machines. It is illustrated in Fig{{ref>addrrelative}}. 
 + 
 +<figure addrrelative> 
 +{{ :en:multiasm:cs:addressing_relative.png?600 |Illustration of IP relative addressing of the variable}} 
 +<caption>Illustration of IP relative addressing of the variable</caption> 
 +</figure>
  
 Relative addressing is also implemented in many jump, branch or loop instructions. Relative addressing is also implemented in many jump, branch or loop instructions.
en/multiasm/cs/chapter_3_10.1736324692.txt.gz · Last modified: 2025/01/08 08:24 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0