mirror of
https://github.com/foxsen/archbase.git
synced 2026-04-14 10:39:45 +08:00
initial import to public repository
This commit is contained in:
15
materials/chapter4/syscall_write.S
Normal file
15
materials/chapter4/syscall_write.S
Normal file
@@ -0,0 +1,15 @@
|
||||
.section .rodata
|
||||
.align 3
|
||||
.hello:
|
||||
.ascii "Hello World!\012\000"
|
||||
|
||||
.text
|
||||
.align 3
|
||||
.global main
|
||||
main:
|
||||
li $a7, 64 #write的系统调用号
|
||||
li $a0, 1 # fd == 1是stdout的文件描述符号
|
||||
la.local $a1, .hello # 字符串地址
|
||||
li $a2, 14 # 字符串长度
|
||||
syscall 0x0
|
||||
jr $ra # 返回
|
||||
Reference in New Issue
Block a user