You can use named variables in Hack ASM. The assembler assigns them to RAM addresses starting with 16. That way you don't need to keep track of where in RAM all your variables are.
To use addresses stored in RAM variables, you need to load the
address of the variable into the A register and then load the
value of the variable into the A register.
In this example, 'i' is the first variable used so it gets address 16
@i // A = address of i (16)
M=0 // i = 0
(LOOP)
@i // A = address of i (16)
A=M // A = i (RAM[16])
D=M // D = RAM[i]
...
@i
M=M+1 // i = i+1
--Mark
[You want to read posts and respond to then in the forum. You'll see the final posts rather than the initial posts with typos 8-( and your responses will be cleaner without the extra email text.]