[英]adding two numeric strings - MIPS ASSEMBLY
我正在研究MIPS匯編程序。 我對此很陌生,遇到了一些麻煩。
如何將.asciiz字符串中的數字轉換為數字計數器部分。
例如:“ 1”-> 49
假設您使用http://sourceforge.net/projects/spimsimulator/之類的模擬器:
.data
input: .asciiz "1234"
.text
main:
la $t0, input # load address of input
loop:
lb $a0, ($t0) # load one byte
beq $a0, $0, exit # exit if null-byte
li $v0, 1 # print integer system call
syscall
addi $t0, $t0, 1 # increment address
j loop
exit:
jr $ra
輸出:49505152
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.