From 0f2dad4b0c3ea710cdff01da0da5fafd06e45437 Mon Sep 17 00:00:00 2001 From: Blau Araujo Date: Thu, 22 May 2025 14:16:05 -0300 Subject: [PATCH] exemplos da aula 5 --- curso/exemplos/05/salve.asm | 17 +++++++++++++++++ curso/exemplos/05/soma.c | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 curso/exemplos/05/salve.asm create mode 100644 curso/exemplos/05/soma.c diff --git a/curso/exemplos/05/salve.asm b/curso/exemplos/05/salve.asm new file mode 100644 index 0000000..feb3e6e --- /dev/null +++ b/curso/exemplos/05/salve.asm @@ -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 diff --git a/curso/exemplos/05/soma.c b/curso/exemplos/05/soma.c new file mode 100644 index 0000000..d293e32 --- /dev/null +++ b/curso/exemplos/05/soma.c @@ -0,0 +1,13 @@ +#include + +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; +}