Files
learnFPGA/FIRMWARE/hello.S
2025-08-02 06:09:31 +03:00

28 lines
412 B
ArmAsm

# 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"