diff --git a/01_exit/exit.s b/01_exit/exit.s new file mode 100644 index 0000000..18c8b20 --- /dev/null +++ b/01_exit/exit.s @@ -0,0 +1,7 @@ + .section .text + .global _start + + _start: + addi a0, zero, 0 + addi a7, zero, 93 + ecall diff --git a/01_exit/makefile b/01_exit/makefile new file mode 100644 index 0000000..a685760 --- /dev/null +++ b/01_exit/makefile @@ -0,0 +1,12 @@ + +build: + @as -o output.out ./*.s + @ld -o output output.out + +run: + $(MAKE) build + @./output $(EXEC) + $(MAKE) clear + +clear: + @rm -rf ./*.out output diff --git a/02_hello/hello.s b/02_hello/hello.s new file mode 100644 index 0000000..659ce42 --- /dev/null +++ b/02_hello/hello.s @@ -0,0 +1,23 @@ + .equ STDOUT , 0 + .equ EXIT_SUCCESS, 0 + .equ WRITE , 64 + .equ EXIT , 93 + + .section .data + msg: .ascii "Hello World!\n" + + .section .text + .global _start + + _start: + # WRITE + addi a0, zero, STDOUT # STDOUT value + la a1, msg # Load message + addi a2, zero, 13 # Message size + addi a7, zero, WRITE # Write syscall + ecall # Sycall execution + + # EXIT + addi a0, zero, EXIT_SUCCESS # Return value + addi a7, zero, EXIT # Exit syscall + ecall # Syscall execution diff --git a/02_hello/makefile b/02_hello/makefile new file mode 100644 index 0000000..a685760 --- /dev/null +++ b/02_hello/makefile @@ -0,0 +1,12 @@ + +build: + @as -o output.out ./*.s + @ld -o output output.out + +run: + $(MAKE) build + @./output $(EXEC) + $(MAKE) clear + +clear: + @rm -rf ./*.out output