;; count with interrupt .symbol stop 0 cnt 20 .code 0 :main mv r1 #isr1 st r1 1000 ;; set up int vector mv r27 #2000 ;; set sp mv r1 #0 st r1 cnt ;; cnt = 0 :loop ;; this is almost empty loop ld r1 cnt eq r2 r1 #10 jf r2 loop trap stop ;; the counting routine is split into two :isr1 ld r3 cnt add r3 r3 #1 savr r27 mv r4 #isr2 st r4 1000 ;; change interrupt vector reti :isr2 resr r27 st r3 cnt mv r4 #isr1 st r4 1000 ;; change int vec reti .end