theinterruptroutine.asm 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. ;export symbols
  2. XDEF RTI_ISR
  3. XREF __SEG_END_SSTACK,TON,TOFF,PRESSED,PORT_T,COUNTER
  4. RTI_ISR:
  5. TheInterruptMain:
  6. LDAA COUNTER ;load the counter from the instructions into Acc. A
  7. INCA ;increment A
  8. STAA COUNTER ;now the counter has been incremented
  9. CMPA TON ;compare the (already incremented) counter to TON
  10. BLE SetTAndReturn ;branch if less than or equal to TON
  11. ;continue if the count is greater then TON
  12. CMPA #15 ;check if the count (still in A) is less than or equal to 15
  13. BLE ClearTAndReturn ;branch if Acc. A (the count) is less than or equal to 15
  14. ;continue if the count is greater than 15
  15. BCLR COUNTER,#$FF ;clear the count
  16. BRA Return ;exit the interrupt routine
  17. ClearTAndReturn:
  18. BCLR PORT_T,#%00001000 ;clear bit 3 of Port T
  19. BRA Return ;exit the interrupt
  20. SetTAndReturn:
  21. BSET PORT_T,#%00001000 ;set bit 3 of Port T
  22. BRA Return ;exit the interrupt routine
  23. Return:
  24. RTI