Variable size/Set: Difference between revisions

Content added Content deleted
m (→‎{{header|6502 Assembly}}: fixed broken code closer)
Line 50: Line 50:
dd 0</lang>
dd 0</lang>


For programs that are executed solely from ROM, such as video game console cartridges, you won't be able to use the above method. The assembler can often use an <code>enum<code> or <code>rsset</code> directive to sequentially assign labels to a series of consecutive memory locations in the system's RAM.
For programs that are executed solely from ROM, such as video game console cartridges, you won't be able to use the above method. The assembler can often use an <code>enum</code> or <code>rsset</code> directive to sequentially assign labels to a series of consecutive memory locations in the system's RAM.


<lang 6502asm>.rsset $00 ;starting at $0400, the following labels represent sequential memory locations of length ".rs n"
<lang 6502asm>.rsset $00 ;starting at $0400, the following labels represent sequential memory locations of length ".rs n"
Line 61: Line 61:
tempStack .rs 1 ;$07</lang>
tempStack .rs 1 ;$07</lang>


Assemblers that don't have an <code>enum<code> or <code>rsset</code> directive can use the <code>equ</code> directive instead. This method lets you immediately see what each memory location actually is, but it makes it harder to insert a new one without having to redo all the numbering. Certain 6502 instructions rely on two memory addresses being consecutive.
Assemblers that don't have an <code>enum</code> or <code>rsset</code> directive can use the <code>equ</code> directive instead. This method lets you immediately see what each memory location actually is, but it makes it harder to insert a new one without having to redo all the numbering. Certain 6502 instructions rely on two memory addresses being consecutive.


<lang 6502asm>VBlankFlag equ $00
<lang 6502asm>VBlankFlag equ $00