29 lines
404 B
NASM
29 lines
404 B
NASM
//Flip.asm
|
|
//flips the values of RAM[0] and RAM[1]
|
|
|
|
//temp=R1
|
|
//R1=R0
|
|
//R0=temp
|
|
|
|
@R1
|
|
D=M
|
|
@temp // Variable
|
|
M=D // temp = R1
|
|
|
|
@R0
|
|
D=M
|
|
@R1
|
|
M=D // R1 = R0
|
|
|
|
@temp
|
|
D=M
|
|
@R0
|
|
M=D // R0 = temp
|
|
|
|
(END)
|
|
@END
|
|
0;JMP
|
|
|
|
//@temp --> find some available memory register (register n)
|
|
//and use it to represent the variable temp. So, from now on, each
|
|
//occurance of @temp in the program will be translated into @n |