2024-06-16 23:39:04 +08:00
|
|
|
.macro syscall msg ptr
|
|
|
|
li a0, \msg
|
|
|
|
li a1, \ptr
|
|
|
|
ecall
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.text
|
|
|
|
.global _start
|
|
|
|
_start:
|
|
|
|
la t0, msg
|
|
|
|
.loop:
|
|
|
|
lb a2, 0(t0)
|
2024-07-03 22:51:21 +08:00
|
|
|
beqz a2, .yield
|
2024-09-03 20:32:41 +08:00
|
|
|
# msg: label = DebugPutChar(1), bits = 1, length = 3, transfer_cap = false
|
2024-08-29 19:45:56 +08:00
|
|
|
# ptr: (any)
|
2024-09-03 20:32:41 +08:00
|
|
|
syscall (1<<14 | 0<<8 | 3<<1 | 0), 0
|
2024-06-16 23:39:04 +08:00
|
|
|
addi t0, t0, 1
|
|
|
|
j .loop
|
2024-07-03 22:51:21 +08:00
|
|
|
.yield:
|
2024-09-03 20:32:41 +08:00
|
|
|
# msg: label = Yield(2), bits = 1, length = 2, transfer_cap = false
|
2024-08-29 19:45:56 +08:00
|
|
|
# ptr: (any)
|
2024-09-03 20:32:41 +08:00
|
|
|
syscall (2<<14 | 0<<8 | 2<<1 | 0), 0
|
2024-07-03 22:51:21 +08:00
|
|
|
j _start
|
2024-06-16 23:39:04 +08:00
|
|
|
|
|
|
|
.data
|
|
|
|
msg : .string "Hello, world!\n\0"
|