Perhaps I'm just being dense, but I don't understand how to set the A register to a variable memory location.
So for instance I can do
which draw a row of 16 black pixels starting at the top left
And I can even say
and get the next row of black pixels
But I'm pretty sure that's not the right way to draw 8192 rows of black pixels.
How do I substitute the @SCREEN or @16385 for a variable?
seems like the right start, because @currentLocation will now store 16384, but simply writing to @currentLocation doesn't solve the problem... I want to write to the memory address that @currentLocation points to.
Plan your program before worrying about the Hack assembly.
Mark Blackwell wrote
I don't understand how to set the A register to a variable memory location.
Can you be more specific? The instruction
Specifically stores the address of foo in the A register. This also creates a variable for you in Hack assembly. At this level of abstraction, you don't need to worry about what that specific memory address is (since you've named it). However, variables in Hack assembly are stored in addresses 16 and up.
For the project you're on, isn't your goal to merely write a certain value to addresses @SCREEN through @24575?