@R1 M=0 // reset R1 @i M=1 // reset i (LOOP) @i D=M @R1 M=M+D // R1 += i @i M=M+1 // i++ @R0 M=M-1 D=M @END D;JEQ @LOOP 0;JMP (END) @END 0;JMP