How does the TIMER function work in Extended Color BASIC? How does the number keep incrementing even when the computer appears to be doing nothing?

  • My guess would be an interrupt handler triggered by something like a vertical retrace, so it'd always be triggered at 60hz, allowing measurement of time in 1/60-second increments.
    – Cactus
    Commented Apr 27, 2016 at 4:23
  • @cactus Please turn that into an answer (rather than a comment).
    – tlindner
    Commented Apr 27, 2016 at 14:41
  • @tlindner I commented instead of answering because I was only speculating.
    – Cactus
    Commented Apr 27, 2016 at 23:08

1 Answer 1


The CoCo has an interrupt called fast interrupt (FIRQ) which is connected to the video output horizontal sync pulse. The IRQ happens every 1/16 of a millisecond (62.5 microseconds). The extended basic command timer uses this interrupt to increment its counter. Remember that the IRQ happens independently of what you see on screen so this is why the number keeps increasing even if "nothing" is happening.

According to this paper from 1987 written by Arthur J. Flexser, the TIMER command of the Extended CoCo BASIC counts "horizontal synchronization pulses, which are approximately 1/16 of a millisecond. This count is multiplied by a constant to convert to milliseconds and is then rounded to the nearest integer."

The document also explains that holding a keyboard key down or keep the joystick button pressed will make the timer to halt, since the TIMER routine first check to see if both of them (key and joystick button) are in released state.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .