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/01/08 07:27] – [Data addressing] ktokarz | en:multiasm:cs:chapter_3_10 [2025/01/09 08:19] (current) – [Program control flow destination addressing] ktokarz | ||
|---|---|---|---|
| Line 74: | Line 74: | ||
| - | ===== Program flow destination addressing ===== | + | ===== Program |
| - | Addressing the destination of the program flow change is the operand of jump, branch or function call instructions. | + | The operand of jump, branch, or function call instructions |
| **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 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//: | ||
| Line 82: | Line 82: | ||
| jump destin | jump destin | ||
| </ | </ | ||
| + | |||
| + | <figure jumpdirect> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| **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//: | ||
| Line 87: | Line 92: | ||
| jump [R0] | jump [R0] | ||
| </ | </ | ||
| + | |||
| + | <figure jumpindirect> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| ===== 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 " | + | 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> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| 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> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| Relative addressing is also implemented in many jump, branch or loop instructions. | Relative addressing is also implemented in many jump, branch or loop instructions. | ||