diff --git a/bin/main b/bin/main new file mode 100755 index 0000000..5830395 Binary files /dev/null and b/bin/main differ diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..e8fd549 --- /dev/null +++ b/compile.sh @@ -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." \ 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 +