Chapter 7 Flashcards

1
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the VM Translator do?

A

It turns virtual machine code into assembler code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. At what memory location of the Hack’s RAM is the stack pointer saved?
  2. What is the stack’s base address in the Hack computer?
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the translation of the virtual machine command:

“push constant 17”

in Hack assembly?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the logic for turning the VM code command:

“pop local 2”

int Hack machine code?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What gets stored in the following memory segments of the Hack’s RAM:

local

argument

this

that

?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the stages that make the result of a high level Jack program appear on the Hack screen?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the standard VM mapping on the Hack platform?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

We want to write “pop local 2” in Hack assembly.

What is the first step?

What Hack code achieves this step?

A

The first step is to have a variable (D) that will hold the address to which we want to save the poped data.

//D = LCL + 2

@LCL

D=M

@2

D=D+A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. What is the minimal number of Hack commands for the VM code: Push constant i
  2. What are these commands?
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. What is the minimal number of Hack commands for the VM code: Pop temp i
  2. What are these commands?
A

(Base address of temp is 5)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. What is the minimal number of Hack commands for the VM code: Pop (argument/local/this/that) i
  2. What are these commands?
A
17
Q

What will the bottom of the stack be like after:

push 5

push 3

sub

push -3

push 10

sub

A

2

-13

18
Q

let x be any number.

What will the bottom of the stack look like after:

push x

push -1

and

A

the last item on the stack will be:

x

This is because an and operation between any number and “111…111” (= the binary representation of -1) gives back the same number.

19
Q

push 101101

push x

or

What value of x will give us the first number pushed?

A

00000

20
Q

Let x be any value.

What will the bottom of the stack look like after?

push 0000

push 1111

push x

and

or

A

x