Gotchas: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) m (→Arrays) |
Puppydrum64 (talk | contribs) |
||
Line 9: | Line 9: | ||
=={{header|6502 Assembly}}== |
=={{header|6502 Assembly}}== |
||
===Numeric Literals=== |
===Numeric Literals=== |
||
Integer literals used in instruction operands need to begin with a #, otherwise, the CPU considers them to be a pointer to memory. This applies to any integer representation, even ASCII. |
Integer literals used in instruction operands need to begin with a #, otherwise, the CPU considers them to be a pointer to memory, which will be dereferenced. This applies to any integer representation, even ASCII. |
||
<syntaxhighlight lang="6502asm">LDA 'J' ;load the 8-bit value stored at memory address 0x004A into the accumulator. |
<syntaxhighlight lang="6502asm">LDA 'J' ;load the 8-bit value stored at memory address 0x004A into the accumulator. |
||
OR 3 ;bitwise OR the accumulator with the 8-bit value stored at memory address 0x0003 |
OR 3 ;bitwise OR the accumulator with the 8-bit value stored at memory address 0x0003 |
||
Line 19: | Line 19: | ||
<syntaxhighlight lang="6502asm">byte $45 ;this is the literal constant value $45, not "the value stored at memory address 0x0045"</syntaxhighlight> |
<syntaxhighlight lang="6502asm">byte $45 ;this is the literal constant value $45, not "the value stored at memory address 0x0045"</syntaxhighlight> |
||
===Memory-Mapped Hardware=== |
===Memory-Mapped Hardware=== |