Today we continue discuss low-level ideas of assembly language using Hack. We start with a little number I like to call What Does This Do. I will show some code, which you should read any mentally evaluate. After a few moments, we’ll discuss.
@R0 D=M @R1 M=D @R0 D=M @R1 M=D+M
@R6 D=M @FOO M=D @R7 D=M @R6 M=D @FOO D=M @R7 M=D
Then let’s work through some more assembly exercises together:
R4[R5] = R6.
shorts with these contents:
[R0 * 1, R0 * 2, R0 * 3, R0 * 4, R0 * 5].
R15 = R14 * 32.
Remember, no class on Friday! I’m at a Code.org workshop.
See you next class!
P.S. It’s Haiku Wednesday!
Assembly is like…
The day before groceries
P.S. Here’s the code we wrote together:
@R0 D=!M D=D+1 @R1 M=D
// Load base pointer. @R4 D=M // Load offset. @R5 D=D+M // Make temporary. @TMP M=D // Load up the RHS. @R6 D=M @TMP A=M M=D
@V @W @X @Y @Z @R0 D=M @V M=D @R0 D=D+M @W M=D @R0 D=D+M @X M=D @R0 D=D+M @Y M=D @R0 D=D+M @Z M=D @R0 D=D+M