1/24
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What are A-instructions?
@value are called A-instructions.
What does the A, D registers serve for?
A: data and address register.
D: data register.
What are C-instructions?
dest = comp; jump
What can dest be?
dest = {A, D , M, AD, AM, DM, ADM, null}
What can comp be?
comp = 0, 1, -1 , D , A , !D , !A , -D , -A , D+1 ,
A+1 , D-1, A-1 , D+A , D-A , A-D , D&A ,
D|A , M , !M , -M ,M+1, M-1 , D+M , D-M ,
M-D , D&M , D|M
What can jump be?
jump = JGT , JEQ , JGE , JLT , JNE , JLE , JMP, or null
How is true and false represented in assembly?
True is represented as -1 and False as 0.
What are the saves variables R0 → R15?
They represent the memory addresses from ram 0 to ram 15.
How many registers do we have in the hack computer?
We have 32K registers.
How do we define a variable in Assembly?
We do @variable_name, and it has to be lowercase.
How do we define a label in Assembly?
We do (LABEL_NAME) the name has to be uppercase, and when we call the label we do @LABEL_NAME also uppercase letters.
What is the ram of the SCREEN constant?
Ram 16384/ hexadecimal = 4000
What is the ram of the KBD constant?
Ram 24576 / hexadecimal = 6000
What does the SP, LCL, ARG, THIS, THAT represent?
The RAM addresses 0 to 4 respectively.
How many rows are there in a SCREEN and how many pixels per row?
There are 256 rows with 512 pixels per row
What is an allowed constant?
They can be values between 0 and 2^15 -1
How do we get NOT(y) using the Mux gate?
We do Mux(a=true,b=false,sel=y,out=noty)
How to know if the screen or the keyboard were chosen?
If the address[14] and address[13] are both 1 then we are accessing the keyboard segment else screen.
How do we know if we are accessing the data segment or the screen and keyboard segment?
If the address[13] and address[14] are both 0 then we are accessing the data segment else the screen or the keyboard.
How to know if the given instruction is of type C or type A?
We look at the MSB in the instruction if it’s 1 then we have C-type instructions, else A type.
What keeps the addresses of all the symbols that are defines throughout the file?
The symbol table
When declaring a Label in our file, how does it get translated into the symbol table?
The address of the label becomes the number of the line that it was declared in and the line right after it has the same number of the line that the label is declared on.
Where are variables placed in the symbol table when declared in our file?
It gets the address of the empty register begging with register 16
How do we parse the symbols in our file?
We do two-passes, in the first we add all the label symbols to the symbol table, and then in the second pass we add the variable symbols to the symbol tabel.
How do we translate variable symbols in the second pass?
We look up the symbol in the symbol table if found we replace it with its numeric value, else we add it to the symbol table <xxx, address(k)> where k is the next available address in the RAM begging with address 16.