global _start extern hello [section .text] _start: call hello mov rax, 60 mov rdi, 0 syscall
global hello [section .data] string1: db "Hello", 0x0a length1: equ $ - string1 [section .text] hello: mov rax, 1 mov rdi, 1 mov rsi, string1 mov rdx, length1 syscall ret
このような関数は作れるのですが、引数をもらって値を返す関数の書き方がわかりません。
そこで、引数である整数をもらって、それを二乗して返す関数を作りたいのですが、作り方を教えてください。
環境は、
NASM (2.13.02)
ld (2.30)
Ubuntu 18.04
です。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。