################################################################# # If you use interrupts, unlike the polling, you do not need to # wait a specific amount of time to type a character. ####################################################### .data msg: .asciiz "\n Elapsed time = " .text main: li $a3, 0xffff0000 # base address of I/O li $s1, 2 sw $s1, 0($a3) #enable keyboard interrupt li $s1, 0x0000ffff #mask to enable all interrupts mtc0 $s1,$12 #store enable bits in status register li $s1, 0 countdown: li $s0,2500000 waitloop: addi $s0, $s0,-1 bnez $s0,waitloop bnez $s0,waitloop addi $s1, $s1,5 li $v0,4 la $a0,msg syscall move $a0,$s1 li $v0,1 syscall addi $t0, $s1, -60 bnez $t0, countdown li $v0, 10 syscall