Added source files.
This commit is contained in:
parent
cc9810839e
commit
8900a1bac1
22
compile.sh
Executable file
22
compile.sh
Executable 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
19
src/main.asm
Normal 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
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user