exemplos da aula 5
This commit is contained in:
parent
7df3f44f24
commit
0f2dad4b0c
2 changed files with 30 additions and 0 deletions
17
curso/exemplos/05/salve.asm
Normal file
17
curso/exemplos/05/salve.asm
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
section .rodata
|
||||||
|
msg db "Salve, simpatia!", 10
|
||||||
|
len equ $ - msg
|
||||||
|
|
||||||
|
section .text
|
||||||
|
global _start
|
||||||
|
|
||||||
|
_start:
|
||||||
|
mov rax, 1 ; syscall write
|
||||||
|
mov rdi, 1 ; stdout
|
||||||
|
mov rsi, msg
|
||||||
|
mov rdx, len
|
||||||
|
syscall
|
||||||
|
|
||||||
|
mov rax, 60 ; syscall exit
|
||||||
|
mov rdi, 0 ; código de saída 0
|
||||||
|
syscall
|
13
curso/exemplos/05/soma.c
Normal file
13
curso/exemplos/05/soma.c
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int soma(int a, int b) {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int x = 10;
|
||||||
|
int y = 20;
|
||||||
|
int r = soma(x, y);
|
||||||
|
printf("Soma: %d\n", r);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue