__guard: .space 200 __store_GP: .word 0 __store_SP: .word 0 __store_FP: .word 0 __chr_Reg: .asciiz "Register save mask (should be 0, {$gp, $sp, $fp, $s7-0}): " __chr_Tild: .asciiz "Number of '\\0's rewritten to '~': " __chr_Char: .asciiz "Number of characters printed: " __chr_Hash: .asciiz "#" __chr_Line: .asciiz "\n" __chr_PGF: .asciiz "Pre-guard overwritten\n" __chr_PGO: .asciiz "Pre-guard okay\n" __chr_AGF: .asciiz "After-guard overwritten\n" __chr_AGO: .asciiz "After-guard okay\n" .text __start: # Set up guard values in the buffer la $t0, __MIPSCALL_arg0 la $t1, __MIPSCALL_arg0_end li $t2, '*' __initloop: sb $t2, 0($t0) addiu $t0, $t0, 1 bne $t0, $t1, __initloop # Save the preserved pointer registers la $t0, __store_GP sw $gp, 0($t0) la $t0, __store_SP sw $sp, 0($t0) la $t0, __store_FP sw $fp, 0($t0) # Put fixed values in all the non-saved registers (to check that sutdents initialize their registers properly) li $at, 0xC0ED0000 li $v0, 0xC0ED1111 li $v1, 0xC0ED2222 li $a0, 0xC0ED3333 li $a1, 0xC0ED4444 li $a2, 0xC0ED5555 li $a3, 0xC0ED6666 li $t0, 0xC0ED7777 li $t1, 0xC0ED8888 li $t2, 0xC0ED9999 li $t3, 0xC0EDAAAA li $t4, 0xC0EDBBBB li $t5, 0xC0EDCCCC li $t6, 0xC0EDDDDD li $t7, 0xC0EDEEEE li $t8, 0xC0EDFFFF li $t9, 0xC0ED1010 li $k0, 0xC0ED1111 li $k1, 0xC0ED1212 # Put fixed values in the save registers li $s0, 0x57AB0000 li $s1, 0x57AB1111 li $s2, 0x57AB2222 li $s3, 0x57AB3333 li $s4, 0x57AB4444 li $s5, 0x57AB5555 li $s6, 0x57AB6666 li $s7, 0x57AB7777 # Put fixed values in all the non-saved registers (to check that sutdents initialize their registers properly) li $at, 0xC0ED0000