From 8900a1bac16791c83ae67827aecbcd439cf23dd4 Mon Sep 17 00:00:00 2001 From: AfonsoCMSousa Date: Wed, 19 Mar 2025 21:27:52 +0000 Subject: [PATCH] Added source files. --- bin/main | Bin 0 -> 16536 bytes compile.sh | 22 ++++++++++++++++++++++ src/main.asm | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100755 bin/main create mode 100755 compile.sh create mode 100644 src/main.asm diff --git a/bin/main b/bin/main new file mode 100755 index 0000000000000000000000000000000000000000..5830395c3e7e11c6fc84cffb2420355518dabae6 GIT binary patch literal 16536 zcmeI4KTi}<6vglGC#awh3Zjvi4KW5A7P?J{aWrm(V3Z&Qv3X(HAv+1XB-?J!k=PZu!~E^1JfN8?NTf%e(*dnCBdFZneC&nh%M;_w#F(_=8xcSR2i` zDA>%qq*J`{E8&wxJHn*|STi>T7-&*n!{j`>Bo^;;j z^=k3;Qu)PVdRMJW4)f%~_69W(Tur((6XwjB%{#E>wcgx2$30`Y^N%WsR{^ z_Pp%=b@MyeEI=brvDMruZiSU%wY^n^PrDDXj^hvCAN>3{-~O^0e*Sf~_v0bf#vmKQ z%Rtk(ALDx8hj~j7_u?9#l<@ps_bi>> 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." \ No newline at end of file diff --git a/src/main.asm b/src/main.asm new file mode 100644 index 0000000..cd1f7c0 --- /dev/null +++ b/src/main.asm @@ -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 +