mklemos
mklemos

Reputation: 69

Using QtSpim on OSX, MIPS error: "unknown character" for simple ascii declaration

I am taking my first ever Architecture class and I was given the snippet below of code to test and learn.

Unfortunately, when I run the darn thing I get this error message:

spim: (parser) Unknown character on line 2 of file /Users/X/Desktop/example_mips.asm .asciiz “Enter in an Integer:” ^

Now given that this is an in-class example I am a little frustrated it won't run.

I am however using my own computer, a Mac running OS X 10.10.1 on QtSpim Version 9.1.16.

The school computers we initially tested this on are running windows. Could this make a difference?

Any noticeable errors? I am assuming this is all valid code:

    .data
    prompt: .asciiz “Enter in an Integer:”
    str1:   .asciiz “The answer is:”
    newline:.asciiz “\n”
    bye:    .asciiz “Goodbye!\n”

    .globl main

    .text
main:
    #init
    li  $s0, 10

    #prompt for input
    li  $v0, 4
    la  $a0, prompt
    syscall

    #read in the value
    li  $v0, 5
    syscall
    move $s0, $v0

loop:
    #print str1
    li  $v0, 4
    la  $a0, str1
    syscall

    #print loop value
    li  $v0, 1
    move    $a0, $s0
    syscall

    #print newline
    li  $v0, 4
    la  $a0, newline
    syscall

    #decrement loop value and branch if not negative
    sub $s0, $s0, 1
    bgez    $a0, loop

    #print goodbye message
    li  $v0, 4
    la  $a0, bye
    syscall

    #exit
    li  $v0, 10
    syscall

Upvotes: 0

Views: 2744

Answers (1)

Michael
Michael

Reputation: 58427

spim: (parser) Unknown character on line 2

Something appears to have gone wrong when you copy-pasted the code. Replace the characters with the normal ASCII quotation mark character ".

Upvotes: 1

Related Questions