This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:cs:chapter_3_10 [2025/12/10 10:39] – [Data addressing] ktokarz | en:multiasm:cs:chapter_3_10 [2025/12/10 13:22] (current) – [Absolute and Relative addressing] ktokarz | ||
|---|---|---|---|
| Line 50: | Line 50: | ||
| </ | </ | ||
| - | **Variations of indirect addressing**. The indirect addressing mode can have many variations where the final address doesn' | + | **Variations of indirect addressing**. The indirect addressing mode can have many variations where the final address doesn' |
| < | < | ||
| copy R1, table[R0] | copy R1, table[R0] | ||
| Line 78: | Line 78: | ||
| The operand of jump, branch, or function call instructions addresses the destination of the program flow control. The result of these instructions is the change of the Instruction Pointer content. Jump instructions should be avoided in structural or object-oriented high-level languages, but they are rather common in assembler programming. Our examples will use the hypothetic //jump// instruction with a single operand—the destination address. | The operand of jump, branch, or function call instructions addresses the destination of the program flow control. The result of these instructions is the change of the Instruction Pointer content. Jump instructions should be avoided in structural or object-oriented high-level languages, but they are rather common in assembler programming. Our examples will use the hypothetic //jump// instruction with a single operand—the destination address. | ||
| - | **Direct addressing** of the destination is similar to direct data addressing. It specifies the destination address as the constant value, usually represented by the name. In assembler, we define the names of the addresses in code as //labels//. In the following example, the code will jump to the label named //destin//: | + | **Direct addressing** of the destination is similar to direct data addressing. It specifies the destination address as the constant value, usually represented by a name. In assembler, we define the names of the addresses in code as //labels//. In the following example, the code will jump to the label named //destin//: |
| < | < | ||
| jump destin | jump destin | ||
| Line 88: | Line 88: | ||
| </ | </ | ||
| - | **Indirect addressing** of the destination uses the content of the register as the address where the program will jump. In the following example, the processor will jump to the destination address which is stored in //R0//: | + | **Indirect addressing** of the destination uses the content of the register as the address where the program will jump. In the following example, the processor will jump to the destination address, which is stored in //R0//: |
| < | < | ||
| jump [R0] | jump [R0] | ||
| 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 | + | 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 " |
| <figure addrabsolute> | <figure addrabsolute> | ||
| Line 107: | Line 107: | ||
| </ | </ | ||
| - | Absolute addressing is simple and doesn' | + | Absolute addressing is simple and doesn' |
| - | 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' | + | 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' |
| <figure addrrelative> | <figure addrrelative> | ||