MIPS - Print a character using ASCII

0

I am in the middle of writing a MIPS program, with restricted syscall 1, 4 and 8. There is a part that I have to print characters using it's ASCII value. Let's say after all the calculation I stored the corresponding number in $s0, which is 65 in this case. And I want it to print "A".

.data
    buf:   .ascii  ""

.text
    li $s0, 65
    sb $s0, buf
    lb $a0, buf
    li $v0, 4
    syscall

The above code terminates with error: Runtime exception at 0x00400018: address out of range 0x00000030

Something very similar used to work a few hours ago, but I lost the file. Please point out the problem.

assembly
ascii
mips
asked on Stack Overflow Oct 21, 2019 by Katharine Kim

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0