龙芯的 Helloworld :)
国际惯例,学习一门新的语言,要从 Hello World 开始,下面我们用龙芯的汇编编写一个Hello world程序,代码用gcc编译:
.text
.globl main
.ent main
main:
lui $4, %hi(cmd)
addiu $4, $4, %lo(cmd)
lui $5, %hi(argv)
addiu $5, $5, %lo(argv)
move $6, $0
li $2, 4011
syscall
move $2, $0
jr $31
.end main
.data
cmd:
.asciiz "/bin/echo"
msg:
.asciiz "Hello world!"
argv:
.word cmd
.word msg
.word 0x0
page revision: 1, last edited: 28 Dec 2007 13:31