Added source files.

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-03-19 21:27:52 +00:00
parent cc9810839e
commit 8900a1bac1
3 changed files with 41 additions and 0 deletions

BIN
bin/main Executable file

Binary file not shown.

22
compile.sh Executable file
View File

@ -0,0 +1,22 @@
echo ">>> Compiling ASM code..."
nasm -f macho64 -o ./bin/obj/main.o ./src/main.asm
if [ $? -ne 0 ]; then
echo " >> Error: Assembly failed."
exit 1
fi
echo ">>> Building executable..."
ld -macos_version_min 10.7 -o ./bin/main ./bin/obj/main.o -lSystem -syslibroot `xcrun --show-sdk-path`
if [ $? -ne 0 ]; then
echo " >> Error: Compilation failed."
exit 1
fi
echo ">>> Cleaning up..."
rm ./bin/obj/main.o
if [ $? -ne 0 ]; then
echo " >> Error: Cleanup failed."
exit 1
fi
echo ">>> ASM code compiled successfully."

19
src/main.asm Normal file
View File

@ -0,0 +1,19 @@
section .data
section .bss
section .text
global _main
_main:
; Lets create a 2D array of 10x10
; 0 = empty
; 1 = bomb
; 2 > number of bombs around
mov rax, 0x2000001 ; syscall: exit
xor rdi, rdi ; status: 0
syscall