0

rn Im playing a bit with the assembly language. I want to write a program which takes two int inputs and then multiplies those too and returns the result. But whatever I type in as an input, the program always multiplies the first input with 10 and returns that result.

Why is that? and which register holds my input?

moving constants into rax and rid is fine. but with my own inputs its not correct. Thats btw my code currently:

global gauss
gauss: 
mov rax, rdi
mul rsi
ret

schmanh
  • 29
  • 2
  • How are you getting input? Publish your full code. Are you on linux or windows? – Julian Oct 29 '22 at 09:10
  • im on linux. Well Im gonna compile my code with nasm and then I write: ./gauss **first input** **second input** – schmanh Oct 29 '22 at 09:15
  • 1
    That's not how you access command line arguments. Also note that command line arguments are strings. As you can see from section 3.4.1 of the ABI document, you have the argument count followed by pointers to arguments at the top of the stack when your program starts. See this video tutorial: https://youtu.be/xtFs1yBVinc – CherryDT Oct 29 '22 at 09:28

0 Answers0