Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
intfunct_64
; intfunct_64.asm this is a main function ; call integer function long int sum(long int x, long int y) ; compile: nasm -f elf64 -l intfunct_64.lst intfunct_64.asm ; link: gcc -m64 -o intfunct_64 intfunct_64.o ; run: ./intfunct_64 > intfunct_64.out ; view: cat intfunct_64.out ; result: 5 = sum(2,3) extern printf extern sum extern sub extern mult section .data x: dq 2 y: dq 3 fmt: db "%ld = sum(%ld,%ld)",10,0 section .bss z: resq 1 section .text global main main: push rbp ; set up stack mov rdi, [x] ; pass arguments for sum mov rsi, [y] call sum ; in separate file mov [z],rax ; save result from sum mov rdi, fmt ; print mov rsi, [z] mov rdx, [x] ; yes, rdx comes before rcx mov rcx, [y] mov rax, 0 ; no float or double call printf pop rbp ; restore stack mov rax,0 ret ; end main ; end intfunct_64.asm
run
|
edit
|
history
|
help
0
index2
accept and display 16 digit
sdffdsafdsfsda
Psn2
text.asm
Input and Display a number
dsafdafdfds
Lec4b
Exp1
FirstProgramLab