feat: rename

This commit is contained in:
2026-01-30 20:04:51 +01:00
parent 4f39392c80
commit 42641a1b43
3 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
// mult.asm
//
// Create a program that multiplies R0 & R1 and puts the result in R2
// Algorithm is based on repetetive action.
//
//
// okay let's go.
// Get R0
// Create a loop based on the number of R0. I.e loop 10 times if R0 is 10.
// Everytime around sum of R2 should be incremented by R1
// Need variable @i which is the index. If that reaches 0. Loop end
// Variables
@i
M=1
@R2
M=0
// Check if loop is needed.
@R0
D=M
@END // Jump to End if R0 is 0. Nothing to add.
D;JEQ
@R1
D=M
@END // Jump to End if R1 is 0. Nothing to add.
D;JEQ
(LOOP)
// get R1
@R1
D=M
// Add R1 to R2
@R2
M=D+M
// add one to i
@i
M=M+1
D=M
@R0
D=D-M
// check if R0 - i is greater or equal than 0
@LOOP
D;JLE
// Then jump to loop
// else just move on
(END) // End of Program
@END
0;JMP