From e904fbf52311de184fd542d011e3f67d811d719a Mon Sep 17 00:00:00 2001 From: Sven Riwoldt Date: Wed, 22 Mar 2023 20:28:50 +0100 Subject: [PATCH] 4.7 --- projects/04/tests/Flip.asm | 29 +++++++++++++++++++++++++++++ projects/04/tests/Frage.txt | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 projects/04/tests/Flip.asm create mode 100644 projects/04/tests/Frage.txt diff --git a/projects/04/tests/Flip.asm b/projects/04/tests/Flip.asm new file mode 100644 index 0000000..c43c084 --- /dev/null +++ b/projects/04/tests/Flip.asm @@ -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 \ No newline at end of file diff --git a/projects/04/tests/Frage.txt b/projects/04/tests/Frage.txt new file mode 100644 index 0000000..dbac032 --- /dev/null +++ b/projects/04/tests/Frage.txt @@ -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