1.1 --- a/vga.S Mon May 22 01:44:31 2017 +0200
1.2 +++ b/vga.S Sun May 28 01:30:33 2017 +0200
1.3 @@ -711,20 +711,23 @@
1.4
1.5 .section .flash, "a"
1.6
1.7 -exception_handler:
1.8 - li $t8, 2500000
1.9 -exc_loop:
1.10 - addiu $t8, $t8, -1
1.11 - bnez $t8, exc_loop
1.12 - nop
1.13 - la $v0, PORTA
1.14 - li $v1, (1 << 2) /* PORTA<2> = RA2 */
1.15 - sw $v1, INV($v0)
1.16 +/* TLB error servicing. */
1.17 +
1.18 +tlb_handler:
1.19 j exception_handler
1.20 nop
1.21
1.22
1.23
1.24 +/* General exception servicing. */
1.25 +
1.26 +.org 0x180
1.27 +
1.28 +exception_handler:
1.29 + j exc_handler
1.30 + nop
1.31 +
1.32 +
1.33 /* Interrupt servicing. */
1.34
1.35 .org 0x200
1.36 @@ -823,6 +826,48 @@
1.37
1.38
1.39
1.40 +exc_handler:
1.41 + li $t9, 0x80000000
1.42 + mfc0 $t6, CP0_CAUSE
1.43 + nop
1.44 +exc_loop:
1.45 + and $t7, $t9, $t6
1.46 + beqz $t7, exc_errorepc_zero
1.47 + nop
1.48 +exc_errorepc_one:
1.49 + la $v0, PORTA
1.50 + li $v1, (1 << 2) /* PORTA<2> = RA2 */
1.51 + sw $v1, SET($v0)
1.52 + j exc_loop_wait
1.53 + nop
1.54 +exc_errorepc_zero:
1.55 + la $v0, PORTA
1.56 + li $v1, (1 << 3) /* PORTA<3> = RA3 */
1.57 + sw $v1, SET($v0)
1.58 +exc_loop_wait:
1.59 + li $t8, 5000000
1.60 +exc_loop_delay:
1.61 + addiu $t8, $t8, -1
1.62 + bnez $t8, exc_loop_delay
1.63 + nop
1.64 + la $v0, PORTA
1.65 + li $v1, (3 << 2) /* PORTA<3:2> = RA3, RA2 */
1.66 + sw $v1, CLR($v0)
1.67 +exc_loop_wait_again:
1.68 + li $t8, 2500000
1.69 +exc_loop_delay_again:
1.70 + addiu $t8, $t8, -1
1.71 + bnez $t8, exc_loop_delay_again
1.72 + nop
1.73 +exc_errorepc_next:
1.74 + srl $t9, $t9, 1
1.75 + bnez $t9, exc_loop
1.76 + nop
1.77 + j exc_handler
1.78 + nop
1.79 +
1.80 +
1.81 +
1.82 /* Event routines. */
1.83
1.84 /* The vertical back porch. */