diff options
Diffstat (limited to 'projects/08/ProgramFlow/BasicLoop')
-rw-r--r-- | projects/08/ProgramFlow/BasicLoop/BasicLoop.asm | 125 |
1 files changed, 125 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..7ba9165 --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.asm @@ -0,0 +1,125 @@ +@0 +D=A +@SP +A=M +M=D +@SP +M=M+1 +@0 +D=A +@LCL +M=M+D +@SP +M=M-1 +A=M +D=M +@LCL +A=M +M=D +@0 +D=A +@LCL +M=M-D +(LOOP_START) +@ARG +D=M +@0 +A=D+A +D=M +@SP +A=M +M=D +@SP +M=M+1 +@LCL +D=M +@0 +A=D+A +D=M +@SP +A=M +M=D +@SP +M=M+1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +D=A +@LCL +M=M+D +@SP +M=M-1 +A=M +D=M +@LCL +A=M +M=D +@0 +D=A +@LCL +M=M-D +@ARG +D=M +@0 +A=D+A +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 +A=A-1 +M=M-D +@0 +D=A +@ARG +M=M+D +@SP +M=M-1 +A=M +D=M +@ARG +A=M +M=D +@0 +D=A +@ARG +M=M-D +@ARG +D=M +@0 +A=D+A +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 +A=D+A +D=M +@SP +A=M +M=D +@SP +M=M+1 |