* testint.asm - Test interrupt function of HC11. #include "registers.asm" ; Declares the HC11 control registers. #include "vectors.asm" ; Declares interrupt & reset vectors. org $2000 main: * Set IRQ for falling-edge-detect mode. * This must be done in the 1st 64 cycles out of reset. ldx #OPTION ; Point X at the OPTION register bset 0,X IRQE ; Set the IRQE bit in the OPTION register * Turn on bits DDRD0-DDRD5 in data direction register D to make PD0-PD5 outputs. ldx #DDRD bset 0,X DDRD5|DDRD4|DDRD3|DDRD2|DDRD1|DDRD0 cli ; Clear I interrupt mask (enable IRQ interrupts) loop1: inc PORTD ; Increment port D contents. bra loop1 ; Just keep doing this forever. myISR: inc PORTB ; Increment port B contents. bne myISR ; Keep going till it gets back to 0. rti ; Return from interrupt. *---------------------------------------------------- * EEPROM region * Establish our interrupt and reset vectors in ROM. *---------------------------------------------------- org VIRQ ; Point the IRQ interrupt vector... fdb myISR ; ...at my Interrupt Service Routine. org VRST ; Point the RESET vector... fdb main ; ...at my main routine.