\nThe correct code for printing characters is 11, not 4, and you should always use single quotes for characters.<\/p>\n
http:\/\/courses.missouristate.edu\/KenVollmar\/mars\/Help\/SyscallHelp.html<\/p>\n
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.<\/p>\n
For example, try this code. It prints \\”mabc\\”.<\/p>\n
.data
\nchr: .byte \\’m\\’
\n .byte \\’a\\’
\n .byte \\’b\\’
\n .byte \\’c\\’<\/p>\n
.text<\/p>\n
li\t$v0 4
\nla\t$a0 chr
\nsyscall<\/p>\n
This code does the right thing:<\/p>\n
li\t$v0 11
\nlb\t$a0 chr
\nsyscall<\/p>\n
as does this:<\/p>\n
li\t$v0 11
\nli\t$a0 \\’m\\’
\nsyscall<\/p>\n
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.\n<\/p><\/blockquote>\n
12-10-15<\/p>\n
Dear sender, <\/p>\n
Thank you very much for the correction. We will fix this.<\/p>\n
Sincerely,
\nSmartvania<\/p>\n","protected":false},"excerpt":{"rendered":"
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 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[26],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/923"}],"collection":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/comments?post=923"}],"version-history":[{"count":3,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/923\/revisions"}],"predecessor-version":[{"id":926,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/923\/revisions\/926"}],"wp:attachment":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/media?parent=923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/categories?post=923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/tags?post=923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}