commit 2c98e72c86413547b276b50fd381f2ff80efba64 Author: synt-xerror <169557594+synt-xerror@users.noreply.github.com> Date: Fri Jan 23 19:50:32 2026 -0300 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bfec633 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +calculator +calculator.o diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4cc55b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Made for my studies on low-level programming diff --git a/calculator.s b/calculator.s new file mode 100644 index 0000000..6b27284 --- /dev/null +++ b/calculator.s @@ -0,0 +1,70 @@ +; -- Assembly Calculator --------------------------------------- +; +; This project is a practice for my low-level programming study +; -------------------------------------------------------------- + +; x86_64 linux syscalls table +; +; 0: read (needs fd, where to save and length) +; 1: write (needs fd, string and string length) +; 60: exit (needs status code) + +global _start + +section .bss + fnum resb 128 + snum resb 128 + +; "variables" read-only +section .rodata + title db "Assembly Calculator v1.0 by /synt-xerror", 0xA + titlel equ $ - title + + fir db 0xA, "Enter the first number: " + firl equ $ - fir + + sec db "Enter the second number: " + secl equ $ - sec + +section .text + +_start: + ; print title + mov rax, 1 + mov rdi, 1 + mov rsi, title + mov rdx, titlel + syscall + + ; ask to enter first number + mov rax, 1 + mov rdi, 1 + mov rsi, fir + mov rdx, firl + syscall + + ; input to enter the first number + mov rax, 0 + mov rdi, 0 + mov rsi, fnum + mov rdx, 128 + syscall + + ; ask to enter second number + mov rax, 1 + mov rdi, 1 + mov rsi, sec + mov rdx, secl + syscall + + ; input to enter the second number + mov rax, 0 + mov rdi, 0 + mov rsi, snum + mov rdx, 128 + syscall + + ; exit + mov rax, 60 + mov rdi, 0 + syscall