This is an old revision of the document!


Interrupt Scheduler

The Interrupt Scheduler handles system timers and counters.

Interrupt Scheduler Routines

Name Description
ACTINT Activate automatic interrupt service (timers, music, blackout)
CTIMER Call custom timer
DECCTS Decrement counters/timers under mask (used by ACTINT and DECCTS)
STIMER Track and decrement game timers

Interrupt Scheduler Routine Descriptions

ACTINT

ACTIVE INTERRUPTS

Calling Sequence:
SYSTEM    ACTINT

or

SYSSUK    ACTINT
Arguments: None
Outputs: None
Description: ACTINT provides automatic interrupt service and runs the seconds timer, the game timer, the music processor, and blackout timers, plus CT0–CT3.
Notes: Timers function every 1/60th of a second.

Once ACTINT is called, it sets:

  • Z80 Interrupt mode 2 (IM 2)
  • INLIN = 200 (line 100)
  • I register and Interrupt Feedback (INFBK)
  • Enable interrupts (EI)

ACTINT also calls TIMEX and TIMEY which decrement counters/timers.

CTIMER

CUSTOM TIMER

Calling Sequence:
CALL      CTIMER
Input: HL = address of custom time base
B = value to load into time base 1 to 0 transition
C = counter mask as in DECCTS
Description: HL is loaded and decremented. If HL != 0, then a return is executed, otherwise, HL is loaded with B and DECCTS is called.
Registers HL, DE, BC, and AF are undefined upon exit.

DECCTS

DECREMENT COUNTERS/TIMERS

Calling Sequence:
SYSTEM    DECCTS

or

SYSSUK    DECCTS
DB        (mask)
Arguments: C = mask for which counters to decrement
Outputs: SENTRY will notify the program
Description: Decrements counter if they are non-zero. If any counters go from 1 to 0, SENTRY is notified.

STIMER

DECREMENT TIMERS

Calling Sequence:
PUSH      AF
PUSH      BC
PUSH      DE
PUSH      HL
CALL      STIMER
POP       HL
POP       DE
POP       BC
POP       AF
Input: None
Description: STIMER keeps track of game time. If it hits 0, then GSBEND bit in the game status byte (GAMSTB) is set.
Uses: AF, BC, DE, HL
Calls: Music processor on note (duration) expiration
Note: Sets bit 7 of KEYSEX to 1 on every second