+/TECS

git clone https://git.julia.blue/+/TECS

Joseph Ryanstart chapter 93311316

master
407 B29 linesraw
1// This file is part of www.nand2tetris.org
2// and the book "The Elements of Computing Systems"
3// by Nisan and Schocken, MIT Press.
4// File name: projects/04/Mult.asm
5
6// Multiplies R0 and R1 and stores the result in R2.
7// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
8
9	@R2
10	M=0
11(LOOP)
12	@R0
13	D=M
14	@END
15	D;JEQ
16	@R0
17	M=M-1
18	@R2
19	D=M
20	@R1
21	D=D+M
22	@R2
23	M=D
24
25	@LOOP
26	0;JMP
27(END)
28	@END
29	0;JMP