Operator precedence: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) mNo edit summary |
|||
Line 16: | Line 16: | ||
=={{header|8th}}== |
=={{header|8th}}== |
||
In 8th it's very simple: the currently invoked word has precedence, and items are operated upon in the order they are popped off the stack. |
In 8th it's very simple: the currently invoked word has precedence, and items are operated upon in the order they are popped off the stack. |
||
=={{header|6502 Assembly}}== |
|||
There are two types of indirect addressing: Indirect X and Indirect Y. These differ in that the indirect X mode applies the offset before looking up the address. |
|||
<lang 6502asm>LDX #$02 |
|||
LDY #$03 |
|||
LDA ($20,x) ;uses the values stored at $20+x and $21+x as a memory address, and reads the byte at that address. |
|||
LDA ($20),y ;uses the values store at $20 and $21 as a memory address, and reads the byte at that address + Y.</lang> |
|||
The use of parentheses for these modes is required, and nicely illustrates the order of operations. To put it in terms of a hierarchy: |
|||
<pre> |
|||
Highest: Indirection: () |
|||
Middle: Offsetting: ,x ,y |
|||
Lowest: Reading at the specified address. |
|||
</pre> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |