First real program running!

This commit is contained in:
2024-05-12 01:26:32 +02:00
parent 7642349be9
commit b9dd016064
2 changed files with 67 additions and 16 deletions

View File

@ -1,9 +1,22 @@
.section .text
.global _main
_main:
li x1, 5
addi x2, x1, 45
loop:
addi x2, x2, 1
j loop
print:
li t1, 0x80000000
l0:
lb t0, 0(a0)
beqz t0, l1
sb t0, 0(t1)
addi a0, a0, 1
j l0
l1:
ret
_main:
la a0, my_str
call print
halt: j halt
.section .rodata
my_str: .string "Hello, world!\n"