2

I'm struggling to get a macro to work in my lab code. This is how I wrote it:

.macro print_char($arg)
    li $v0, 11
    add $a0, $zero, $arg
    syscall
.end_macro

I don't think it should matter where it is relative to other labels but it is after .data and before .text. SPIM gives me this syntax error:

spim: (parser) syntax error on line 11 of file /Users/charliecooper/Cabrillo/compsci/cs24/MIPS_code/name_swap.s

      .macro printchar($arg)

Is there a noticeable problem with how I wrote the macro?

polar
  • 194
  • 1
  • 15
  • 2
    SPIM doesn't support macros AFAIK. You'll either have to use some kind of pre-processor before passing the code to SPIM, or you could try using MARS instead of SPIM. – Michael Sep 14 '20 at 05:21
  • @Michael Thanks, I was confused because my textbook taught macros and our class uses QtSpim. – polar Sep 14 '20 at 05:52

1 Answers1

3

In case anyone finds this post @Michael is right in the comments: macros are a feature in MARS not SPIM.

polar
  • 194
  • 1
  • 15