Experiments with eco32-30-port-5

Experiment 1: Utilize timer interrupts

This program initializes the timer so that it generates an interrupt every second (divisor = 1000000 = 0x000F4240), and then loops without doing anything. Within the interrupt service routine, a single digit in the range 0 to 9 is output on the console.

Register usage:
$29 stack pointer
$16 address of console output routine
$17 next character to be written
$18 base address of timer

; jump vectors for start, interrupt, and TLB miss (not used)
c0000000: j c000000c
c0000004: j c000004c
c0000008: j c0000008

; initialization
c000000c: ldhi $29,c0000000
c0000010: or $29,$29,1000
c0000014: ldhi $16,e0000000
c0000018: or $16,$16,18
c000001c: add $17,$0,30
c0000020: ldhi $18,f0000000
c0000024: ldhi $19,000f0000
c0000028: or $19,$19,4240
c000002c: stw $19,$18,4
c0000030: add $19,$0,2
c0000034: stw $19,$18,0
c0000038: mvfs $19,0
c000003c: ldhi $20,08800000
c0000040: or $19,$20,4000
c0000044: mvts $19,0
c0000048: j c0000048

; interrupt service routine
c000004c: add $4,$17,0
c0000050: jalr $16
c0000054: add $17,$17,1
c0000058: add $19,$0,3a
c000005c: bne $17,$19,c0000064
c0000060: add $17,$0,30
c0000064: add $19,$0,2
c0000068: stw $19,$18,0
c000006c: rfx