Convert Char to Int in MIPS, however do it using the $fp register and $sp regist
ID: 2268452 • Letter: C
Question
Convert Char to Int in MIPS, however do it using the $fp register and $sp register.
For example:
li $t0, 97
sb $t0, -1($fp)
lb $t1, -1($fp)
sb $t1, y
lb $t3, -1($fp)
la $sp, -4($sp)
sw $t3, 0($sp)
jal print_int
This will print 97.
However, I am having trouble converting the byte into an integer, what I tried:
li $t0, 97
sb $t0, -1($fp)
lb $t1, -1($fp)
sb $t1, y
lb $t2, -1($fp)
sw $t2, -5($fp)
lb $t3, -5($fp)
la $sp, -4($sp)
sw $t3, 0($sp)
jal print_int
This will print 0. Help please.
Explanation / Answer
So it is my suggestion to try this one using the ASCII code rather than converting the Char to Int, So that u can get the desired output
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.