home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!utcsri!torn!watserv2.uwaterloo.ca!mach1!litt3509
- From: litt3509@mach1.wlu.ca (Carl Litt u)
- Subject: Alarm interrupt programming in TP6 -- Please read
- Message-ID: <Bz41KB.Jt8@mach1.wlu.ca>
- Sender: litt3509@mach1.wlu.ca
- Organization: Wilfrid Laurier University
- Date: Fri, 11 Dec 1992 19:45:46 GMT
- Lines: 49
-
- One little peice of info that I picked up while flipping through one of
- my MSDOS programming reference manuals, is that the IBM has a software
- interrupt for a built-in alarm. Basically, the way it works is that
- the system clock interrupt 1A (hex) has a service that allows you to
- program the alarm to activate interrupt 4A (hex) at a given time. The
- So what you do is make a user interrupt procedure and link it to Int 4A,
- and when the alarm goes off, your procedure will run. I suspect this is
- the way some viruses work. Anyways, I'm trying to write a program to make
- use of this 'alarm', but it doesn't seem to work. Here's what I've got:
-
- program TestAlarm;
- uses dos;
- var regs : registers;
- tempptr : pointer;
-
- procedure AlarmProc; interrupt;
- begin {AlarmProc}
- writeln('The alarm has sounded');
- end; {AlarmProc}
-
- procedure {main}
- checkbreak:=false;
- setintvec($4A,@AlarmProc);
- with regs do begin
- ah:=6; {the service that sets the alarm}
- cl:=0; {0 hours}
- ch:=0; {0 minutes}
- dl:=30; {30 seconds}
- end;
- intr($1A,regs);
- write('Waiting for the alarm to go off...press any key to exit');
- repeat until keypressed;
- checkbreak:=true;
- end. {main}
-
- What I expect to program to do is write a message to the screen, and wait.
- After 30 seconds, the 'alarm' goes off, and my AlarmProc interrupt gets
- called. But, in my tests, the alarm never goes off. I have 2 sources
- of information on the alarm, and one says the alarm goes off after the
- given amount of time has elapsed. The other says the alarm goes off
- when the real-time clock reaches the given time. I've tried it both
- ways, and it doesn't work. Has anyone been playing around with this
- alarm, and if you got it to work, how did you do it?
-
- BTW: Right now my only concern is getting the alarm to go off. I don't
- care what the program does after the alarm goes off.
-
- litt3509@mach1.wlu.ca
-
-