100 *Init '*** 初期化 *** 110 cls 120 t$=time$ 130 active=1 ' タイマー実行中フラグ 140 *MainLoop '*** メインループ *** 150 ' キー入力を1文字読み込む 160 c$=inkey$ 170 ' qで終了、pで停止/再開 180 if c$="q" then end 190 if c$="p" then active=1-active 200 ' time$ (=hh:mm:ss) が変化したらタイマー発動 210 if t$=time$ then goto *MainLoop 220 t$=time$ 230 if active=1 then gosub *OnTimer 240 goto *MainLoop 250 *OnTimer '*** タイマーイベントハンドラ *** 260 print "a" 270 return