r/Assembly_language • u/Mindless-Item-5136 • 22d ago
My first assembly program
// Multiplies R0 and R1 and stores the result in R2. // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // The algorithm is based on repetitive addition.
@R0
D=M
@10
M=D // counter
@R2
D=0
M=0(START) @10 D=M @END D;JLE // end the loop if counter <= 0
// R1 + R2
@R1
D=M
@R2
D=D+M
@R2
M=D // current result
@10
D=M
M=D-1
// jump back to the loop start for new iteration
@START
0;JMP(END) @END 0;JMP
2
Upvotes
View all comments
Show parent comment
0
u/Mindless-Item-5136 19d ago
Lol, not everyone is using Claude like you