diff options
Diffstat (limited to 'projects/08/ProgramFlow/BasicLoop')
-rw-r--r-- | projects/08/ProgramFlow/BasicLoop/BasicLoop.asm | 140 | ||||
-rw-r--r-- | projects/08/ProgramFlow/BasicLoop/BasicLoop.out | 2 |
2 files changed, 142 insertions, 0 deletions
diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoop.asm b/projects/08/ProgramFlow/BasicLoop/BasicLoop.asm new file mode 100644 index 0000000..62aa0cf --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.asm @@ -0,0 +1,140 @@ +@256 +D=A +@SP +M=D +@0 +D=A +@SP +A=M +M=D +@SP +M=M+1 +@LCL +D=M +@0 +D=A+D +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +(LOOP_START) +@ARG +D=M +@0 +D=A+D +A=D +D=M +@SP +A=M +M=D +@SP +M=M+1 +@LCL +D=M +@0 +D=A+D +A=D +D=M +@SP +A=M +M=D +@SP +M=M+1 +@SP +AM=M-1 +D=M +@SP +AM=M-1 +D=M+D +@SP +A=M +M=D +@SP +M=M+1 +@LCL +D=M +@0 +D=A+D +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +D=M +@0 +D=A+D +A=D +D=M +@SP +A=M +M=D +@SP +M=M+1 +@1 +D=A +@SP +A=M +M=D +@SP +M=M+1 +@SP +AM=M-1 +D=M +@SP +AM=M-1 +D=M-D +@SP +A=M +M=D +@SP +M=M+1 +@ARG +D=M +@0 +D=A+D +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +D=M +@0 +D=A+D +A=D +D=M +@SP +A=M +M=D +@SP +M=M+1 +@SP +AM=M-1 +D=M +@LOOP_START +D;JNE +@LCL +D=M +@0 +D=A+D +A=D +D=M +@SP +A=M +M=D +@SP +M=M+1 +(END) +@END +0;JMP
\ No newline at end of file diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoop.out b/projects/08/ProgramFlow/BasicLoop/BasicLoop.out new file mode 100644 index 0000000..1786c7c --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.out @@ -0,0 +1,2 @@ +| RAM[0] |RAM[256]| +| 257 | 6 | |