|
Hello - I am currently studying for an upcoming exam on computer structures and operating systems and I tried to run this program (as seen in the coursera Nand2Tetris course), but it constantly gives me the following error:
Jump Directive Expected
I´m using this code with the CPU Emulator.
//This Program computes RAM[1]= 1+2+...+n
//Number n is stored in RAM[0]
@R0
D=M
@n
M=D //n=R0
@i
M=1 /i=1
@sum
M=0
(LOOP)
@i
D=M
@n
D=D-M
@STOP
D;JGT //if i>n goto STOP
@sum
D=M
@i
D=D+M
@sum
M=D //sum = sum +1
@i
M=M+1
@LOOP
0;JMP
(STOP)
@sum
D=M
@R1
M=D // R[1]=sum
(END)
@END
0;JMP
Thank you so much in advance!!
|