# # below here is the print debugging support code # .data _spaceString: .asciiz " " _newlineString: .asciiz "\n" .text .globl printInt # int reg -> unit .globl printSpace # unit -> unit .globl printNewline # unit -> unit printInt: # int reg->unit # The syscall takes its argument in $a0 add $t0, $v0, $zero # since this function does not return anything, it should probably preserve $v0 li $v0, 1 # print_int syscall syscall add $v0, $t0, $zero # restore $v0 jr $ra printSpace: # unit->unit add $t0, $v0, $zero la $a0, _spaceString # address of string to print li $v0, 4 # system call code for print_str syscall # print the string add $v0, $t0, $zero jr $ra printNewline: # unit->unit add $t0, $v0, $zero la $a0, _newlineString # address of string to print li $v0, 4 # system call code for print_str syscall # print the string add $v0, $t0, $zero jr $ra