home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUIN
/
BEEPER.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
62 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 336 of 355
From : Steven Ziuchkovski 1:105/314.0 10 Jun 93 16:32
To : David Todd
Subj : Tsr's
────────────────────────────────────────────────────────────────────────────────
DT> -=> Quoting David Todd to All <=-
DT> TS> Hello David...
> TS> I've attached my little code to give some example about how
> TS> to use Int 33h SubFunction 18h (which install
> TS> user-alternate-Subroutine).
> TS> Here is the stuff:
DT> Thanks for the code, but....I tried it and it seems to lock it up after
> I've started the beeping.. I dunno what's wrong, is it the code or is i
> just me...But thanks anyways, I think I get it now....
Well, I've done some programming with TSR in TP6, and it doesn't seem to
lock up. If you use interrupt vector $1C, you can make a procedure that
is called 18.2 (or something like that) times per second. The only catch
is that you can't make a call to ANY routines that use things like DOS
functions, disk reads/writes, or anything. You can still
increment/decrement variables and change them and stuff. You can also
manipulate memory, so long as you don't fiddle with another programs
memory.
Here is a simple program that beeps every time you press alt-right
shift:}
CUT HERE---
Program Beeper;
{$M 1024, 0, 0} {The program can't hog ALL the memory!}
Uses Crt, Dos;
Procedure DoBeep;
Interrupt; {specifies this as an interrupt procedure. VERY IMPORTENT}
Begin
If Mem[$0040:$0017] and $09=$09 then {Check the Keyboard for}
Begin {Alt-Right shift}
Sound(440);
Delay(100);
NoSound;
end;
end;
Begin
SetIntVec($1C, @SnapIt); {Set the interrupt to point to your}
{procedure}
Keep(0); {Keep the program in memory instead of terminating.}
{the parameter is the error code to return to DOS.}
end.
CUT HERE---
This should work. I'm not sure if the Delay function will lock up the
computer, since this program is stripped down from a screen snapshot
program I wrote.