这段代码虽然非常简单,但是里面包含了很多有价值内容: .data # section declaration - variables only # 这里是我加注的便于区分是立即数还是rx寄存器 #define r0 0 #define r3 3 #define r4 4 #define r5 5 msg: .string "Hello, world!/n" len = . - msg # length of our dear string .text # section declaration - begin code .global _start _start: # write our string to stdout li r0,4 # syscall number (sys_write) li r3,1 # first argument: file descriptor (stdout) # second argument: pointer to message to write lis r4,msg@ha # load top 16 bits of &msg addi r4,r4,msg@l # load bottom 16 bits li r5,len # third argument: message length sc # call kernel # and exit li 0,1 # syscall number (sys_exit) li 3,0 # first argument: exit code sc