r/Assembly_language • u/Mindless-Item-5136 • 5d 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
4
u/Some-Comparison4863 3d ago
I dont think that assembly what assembly is it? because I know only NASM and GAS
3
u/Last_Bet_8677 3d ago
Good job, Claude.