LTS

Your mips tutorial #4 on printing a character

Letters

The correct code for printing characters is 11, not 4, and you should always use single quotes for characters.

http://courses.missouristate.edu/KenVollmar/mars/Help/SyscallHelp.html

What you actually did in the tutorial is to print a string that is one character long, and that is a different thing. You were lucky (or perhaps unlucky) that the next byte after your character happened to be zero and therefore terminated the string for you. When you use syscall code 4, it will print until it gets to a zero byte.

For example, try this code. It prints \”mabc\”.

.data
chr: .byte \’m\’
.byte \’a\’
.byte \’b\’
.byte \’c\’

.text

li $v0 4
la $a0 chr
syscall

This code does the right thing:

li $v0 11
lb $a0 chr
syscall

as does this:

li $v0 11
li $a0 \’m\’
syscall

One other thing: there\’s an assemble button right next to the run button, so you don\’t have to go to the menu to assemble your file.

12-10-15

Dear sender,

Thank you very much for the correction. We will fix this.

Sincerely,
Smartvania