This commit is contained in:
kaltinsoy committed 2025-09-23 13:44:14 +03:00
commit a84b8fcfde
91 files changed
+88177

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
# Hello world !
.section .text
.globl main
main:
.L0:
la a0, hello
call putstring
j .L0
putstring:
addi sp,sp,-4 # save ra on the stack
sw ra,0(sp) # (need to do that for functions that call functions)
mv t2,a0
.L1: lbu a0,0(t2)
beqz a0,.L2
call putchar
addi t2,t2,1
j .L1
.L2: lw ra,0(sp) # restore ra
addi sp,sp,4 # restore sp
ret
.section .data
hello:
.asciz "Hello, world !\n"