'===========================================================================
' Subject: TSR EXAMPLE                        Date: 05-01-96 (19:26)       
'  Author: Dave Navarro, Jr.                  Code: PB                     
'  Origin: dave@powerbasic.com              Packet: PB.ABC
'===========================================================================
'=============================================================================
'                   Source code snippet: PowerBASIC for DOS
'
'           Author: Dave Navarro, Jr. (dave@powerbasic.com)
' Copyright status: Public Domain
'
' TSR example.  Stuff's the keyword buffer with the word BACKUP and a carriage
' return at 1:30am.  It assumes the computer is sitting at the DOS prompt.
'
'=============================================================================

DEFINT A-Z
Dummy& = SETMEM(-700000)
POPUP TIMER 1092              'pop-up every 60 seconds
POPUP SLEEP USING EMS, "C:\BACKUP.$$$"

DO
  POPUP SLEEP                 'pop-down and wait
                              'once a minute has passed, PowerBASIC
                              'will pop back up and execute the next
                              'statement after POPUP SLEEP
  IF LEFT$(TIME$,5) = "01:30" THEN  ' is it 1:30 am?
    POPUP STUFF "BACKUP"+CHR$(13), 0, 0
  END IF
LOOP                          'keep looping
