HACK Machine Language & Assembler Flashcards
Week 2.1 (36 cards)
what is machine language
an agreed upon formalism, designed to code low-level programs as a series of machine instructions
use of machine language
- define the interface between programming & logic gates
- define low level operations:
- manipulating memory
- basic logic operations
what is opcode
corresponds to operations defined in the decoder circuitry
what are the HACK machine registers
what is the HACK machine computer
is a theoretical, simplified computer architecture designed for educational purposes
- von neumann
- 16-bit registers
what does the D register store
data
what does the A register store
data or address
what does M stand for
implicit label which refers to the value of memory location pointed to by A
- RAM[A]
what register do jump instructuions use
A
how to load an immediate value into A
@value
what is D;JGT condition
D > 0
what is D;JGE condition
D >= 0
what is D;JLT condition
D < 0
what is D;JLE condition
D <= 0
what is D;JEQ condition
D = 0
what is D;JNE condition
D != 0
what is 0;JMPcondition
unconditional jump
how to define a jump in HACK machine language
@label
condition
i.e
@positive
D;JGE
command to load data in memory into the data register
@value
D=M
command to store data in data register into memory
M = D
binary syntax of a C-instruction
111accccccdddjjj
- first 1 = C-instruction opcode
- second & third 1s = not used
- acccccc = comp bits
- ddd = dest bits
- jjj = jump bits
binary syntax of A value
0vvvvvvvvvvvvvvvv
- 0 = A-instruction op-code
- vvvvvvvvvvvvvvv - 15-bit binary representation of the constant, therefore <= 32767
HACK assembler translation steps
- symbols
- non-instructions
- instructions
types of symbols
- predefined
- labels
- variables