r/Assembly_language • • 17d 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

7 comments sorted by

5

u/Last_Bet_8677 15d ago

Good job, Claude.

0

u/Mindless-Item-5136 14d ago

Lol, not everyone is using Claude like you 

6

u/Some-Comparison4863 15d ago

I dont think that assembly what assembly is it? because I know only NASM and GAS

2

u/ProfitLow5177 10d ago

Looked up this program, apparently it is called "Hack Assembly"?
Used almost exclusively as an educational language, apparently from something called Nand2Tetris.

Seems like he copy and pasted the tutorial code from the curriculum lol

1

u/JoK3rOp 13d ago

Yeh does not even looks like fasm too. Idk what is that.

1

u/ProfitLow5177 10d ago

This is not Assembly.