elna/tools/builtin.s

30 lines
404 B
ArmAsm

.global printi
.type printi, @function
.text
printi:
addi sp, sp, -8
sw s0, 0(sp)
sw ra, 4(sp)
addi s0, sp, 8
addi t0, a0, 0
addi a0, a0, '0'
sw a0, 0(s0)
addi a0, x0, 1
addi a1, s0, 0
addi a2, x0, 1
addi a7, x0, 64
ecall
addi t1, x0, '\n'
sw t1, 0(s0)
ecall
addi a0, t0, 0
lw s0, 0(sp)
lw ra, 4(sp)
addi sp, sp, 8
ret