Skip to content

BASIC TIMER Functions

Sean P. Harrington edited this page Oct 14, 2024 · 1 revision

TIMER

TYPE: plusBASIC audio pseudovariable


FORMAT: TIMER = count

Action: Sets and starts the countdown timer.

  • count is a number in the range 0 through 16,777,215.
    • Setting the timer to non-zero number starts the countdown.
    • Setting the timer to zero stops the timer.
  • The timer counts down in jiffies, each jiffy being 1/60th second.
    • When the count reaches 0, it stops.

Advanced:

  • The timer is interrupt driven.
    • While the timer is running, it is decremented each VBLANK interrupt.
    • Starting the timer enables interrupts.
    • When the timer stops and no other interrupt routines are active, interrupts are disabled.
    • If a process disables interrupts, the timer will be paused until interrupts are reenabled.

Examples:

TIMER = 300

Starts the countdown timer at 5 seconds.

TIMER = 0

Stops the countdown timer.


FORMAT: TIMER

Action: Returns the current timer count.

Examples:

PRINT TIMER

Displays the current timer count.

10 IF TIMER THEN GOTO 10

Loops until timer reaches 0.

Clone this wiki locally