forked from ccccourse1/co111a
-
Notifications
You must be signed in to change notification settings - Fork 0
Mult
4YCAaaa edited this page Jan 4, 2023
·
1 revision
- Multiplies R0 and R1 and stores the result in R2.
- R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.
// Put your code here.
//first set D to 0
@0
D=A
//return the result to 0
@2
M=D
//loop1
@0
//set R0 as a counter
D=M
@16
//D=0 and jumps out of the loop
D;JLE
@1
//value input D
D=M
@2
//add D value to R2
M=D+M
@0
//counter -1
M=M-1
@4
//back to loop1
0;JMP
@16
0;JMP