I am working on a MIPS Assembly program. I am new at this, and am having some trouble.
How do you convert digits in a .asciiz string to there numeric counter parts.
EX: "1" -> 49
Assuming you use a simulator like 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
Output: 49505152
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.