'Mips make string with integers and chars
I'm very very new to mips. I'm not sure where to start with this:
let's say I have
li $t1, -3
li $t2, -9
I want to print a string that is
(-3,-9)
What data structure do I store this in? .byte? .space?
This is what I have so far, it prints out "(,)"; Am I on the right track? Where do I go from here?
string: .space 10
.text
.globl main
main: la $t0, string
li $t1, -3
li $t2, -9
li $t3, '('
li $t4, ','
li $t5, ')'
li $t6, '-'
sb $t3, ($t0)
sb $t4, 1($t0)
sb $t5, 2($t0)
j exit
exit:
li $v0, 4 # print the string
la $a0, string
syscall
li $v0, 10 # terminate program
syscall
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
