This commit is contained in:
Sven Riwoldt
2023-03-22 20:28:50 +01:00
parent 4c52d4ba55
commit e904fbf523
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
//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

View File

@@ -0,0 +1,4 @@
How would a assembler distinguish between a branching symbol and a variable symbol?
Wie würde ein Assembler zwischen einem Verzweigungssymbol und einem variablen Symbol unterscheiden?
A branching symbol has a label declaration somewhere in the program, and a variable symbol doesn't