' tb-screen: 80x25
' tb-clock: 250ms/Zustellpunkt
' tb-keys: <F1>a
' Ereignis-Traps: Zeitquelle, Tasten, UEVENT, Maskierung und Hauptschalter.
' Geprueft werden Verhaeltnisse, keine Zaehlwerte -- wie oft die Frist im
' Lauf faellt, haengt an der Zahl der Zustellpunkte und ist kein Vertrag.
ON TIMER(1) GOSUB Tick
n% = 0

TIMER ON
FOR i% = 1 TO 400
NEXT
PRINT "an:      "; n% > 0

TIMER OFF
m% = n%
FOR i% = 1 TO 400
NEXT
PRINT "aus:     "; n% = m%

TIMER ON
EVENT OFF
m% = n%
FOR i% = 1 TO 400
NEXT
PRINT "klammer: "; n% = m%

EVENT ON
m% = n%
FOR i% = 1 TO 400
NEXT
PRINT "wieder:  "; n% > m%

TIMER STOP
m% = n%
FOR i% = 1 TO 400
NEXT
PRINT "stop:    "; n% = m%
TIMER ON
FOR i% = 1 TO 10
NEXT
PRINT "gemerkt: "; n% = m% + 1
TIMER OFF
PRINT "rueckkehr:"; i% = 11

ON KEY(1) GOSUB Taste
KEY(1) ON
FOR i% = 1 TO 20
NEXT
PRINT "taste:    "; taste% = 1
PRINT "strom:    "; INKEY$ = "a"

ON UEVENT GOSUB Nutzer
UEVENT ON
CALL SetUEvent
FOR i% = 1 TO 20
NEXT
PRINT "uevent:   "; uevent% = 2
PRINT "kein re:  "; wiedereintritt% = 0
END

Tick:
  n% = n% + 1
RETURN

Taste:
  taste% = taste% + 1
RETURN

Nutzer:
  IF im_handler% THEN wiedereintritt% = -1
  im_handler% = -1
  uevent% = uevent% + 1
  IF uevent% = 1 THEN CALL SetUEvent
  im_handler% = 0
RETURN
