getting values in machine language -- SOLVED

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

getting values in machine language -- SOLVED

smcbot
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: getting values in machine language

cadet1620
Administrator
For this loop, you always want to run the same number of iterations, so you dont need the loop count in a variable.

Just put the 8192 directly into A and subtract it.

There is also a handy feature of Hack assembly language that you can have more than one destination on the left of the '='. This lets you easily do "pre increment" assignments.

Your increment and test can become

@i
MD=M+1  // D = ++i
@8192
D=D-A

If you need it elsewhere, you can set a variable to a constant

@8192
D=A
@n
M=D

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: getting values in machine language

smcbot
Thank you so much!