On and
off for five months of trying to figure out the Hack assembly language and re
reading chapter 4 five or six time on
top of taking pages and pages of notes I learned how to use it. Assembly
language is different than any other language I have learned. Calling the
memory location then putting data into that location.
Here is what I played with to figure out the ASM
@1 //this is the address to the memory where the program starts at
//And since the system just started that memory location should be blank or 0
D=M // since the above address memory location is empty then D is the value of the memory
@5 //this is a new value
D=D-A //A is = to 5 and D is equal to 0 so the new Value of D is -5
@100 //the vaule in the A register is now 100
D;JEQ // D = -5 JEQ is Jump to 100 in the program if D is equal to 0
@7 //A is now 200 if 7 then program doesnt move at all
M;JMP // Just jump to 200 in the program if 0 but if M Jump to 200 in memory also
Something like this should have put in the book with that much info on what the coded did.
Here is what I played with to figure out the ASM
@1 //this is the address to the memory where the program starts at
//And since the system just started that memory location should be blank or 0
D=M // since the above address memory location is empty then D is the value of the memory
@5 //this is a new value
D=D-A //A is = to 5 and D is equal to 0 so the new Value of D is -5
@100 //the vaule in the A register is now 100
D;JEQ // D = -5 JEQ is Jump to 100 in the program if D is equal to 0
@7 //A is now 200 if 7 then program doesnt move at all
M;JMP // Just jump to 200 in the program if 0 but if M Jump to 200 in memory also
Something like this should have put in the book with that much info on what the coded did.
No comments:
Post a Comment