unit 4+5+6

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards

What are A-instructions?

@value are called A-instructions.

2
New cards

What does the A, D registers serve for?

A: data and address register.

D: data register.

3
New cards

What are C-instructions?

dest = comp; jump

4
New cards

What can dest be?

dest = {A, D , M, AD, AM, DM, ADM, null}

5
New cards

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

6
New cards

What can jump be?

jump = JGT , JEQ , JGE , JLT , JNE , JLE , JMP, or null

7
New cards

How is true and false represented in assembly?

True is represented as -1 and False as 0.

8
New cards

What are the saves variables R0 → R15?

They represent the memory addresses from ram 0 to ram 15.

9
New cards

How many registers do we have in the hack computer?

We have 32K registers.

10
New cards

How do we define a variable in Assembly?

We do @variable_name, and it has to be lowercase.

11
New cards

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.

12
New cards

What is the ram of the SCREEN constant?

Ram 16384/ hexadecimal = 4000

13
New cards

What is the ram of the KBD constant?

Ram 24576 / hexadecimal = 6000

14
New cards

What does the SP, LCL, ARG, THIS, THAT represent?

The RAM addresses 0 to 4 respectively.

15
New cards

How many rows are there in a SCREEN and how many pixels per row?

There are 256 rows with 512 pixels per row

16
New cards

What is an allowed constant?

They can be values between 0 and 2^15 -1

17
New cards

How do we get NOT(y) using the Mux gate?

We do Mux(a=true,b=false,sel=y,out=noty)

18
New cards

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.

19
New cards

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.

20
New cards

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.

21
New cards

What keeps the addresses of all the symbols that are defines throughout the file?

The symbol table

22
New cards

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.

23
New cards

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

24
New cards

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.

25
New cards

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.