Added the sum program from Fig 4.2

This commit is contained in:
Nemo 2020-05-27 19:43:50 +05:30
parent 64c2f79409
commit 56eb3699a4
1 changed files with 35 additions and 0 deletions

35
projects/04/sum/sum.asm Normal file
View File

@ -0,0 +1,35 @@
@i
M=1
@sum
M=0
(LOOP)
@i
D=M
@10
D=D-A
@END // refers to the instruction memory location for END label and puts that in A
D;JGT
@i
D=M
@sum
M=D+M
@i
M=M+1
@LOOP // Put the instruction memory location for LOOP in A
0;JMP // Jump to A
(END)
@sum
D=M
@R0
M=D
@END
0;JMP