CSE365
Elements of Computing Systems
|
Assembly Reference
A Instructions
- Load Constant Value
@value // A=value (where value is a non-negative decimal number).
- Load ROM Location/Instruction Location
@LABELNAME // A=Location in ROM of LABELNAME
- Load arbitrary RAM location
@symbol // A=Location in RAM of symbol
Each symbol is guaranteed unique (by the assembler) and has a value>15.
- Use predefined symbols
@KBD, @SCREEN, @R1..@R15, @SP, @LCL, @ARG, @THIS, @THAT
C Instructions
dest=comp; jump
- comp - Required!
Possible values:
- 0, 1, -1
- D,A,M
- !D,!A,!M,-D,-A,-M
- D+1,A+1,M+1,D-1,A-1,M-1
- D+A,D+M
- D-A,A-D,D-M,M-D
- D&A, D&M
- D|A, D|M
- and a couple other more complicated cases
- dest - Optional. If not used, the '=' is omitted
Possible values:
- jump - Optional. If not used, the ';' is omitted
Possible values:
jump | Jump if | Comment
|
---|
JMP | out<0 | or | out==0 | or | out>0 | Always jump
|
---|
JLE | out<0 | or | out==0 | | | If out <= 0, jump
|
---|
JNE | out<0 | | or | | out>0 | If out != 0, jump
|
---|
JLT | out<0 | | | | | If out < 0, jump
|
---|
JGE | | | out==0 | or | out>0 | If out >= 0, jump
|
---|
JEQ | | | out==0 | | | If out == 0, jump
|
---|
JGT | | | | | out>0 | If out > 0, jump
|
---|
null | | | false | | | Never jump
|
---|
Labels
(LABEL) - Can be used before defined
|