Category : Files from Magazines
Archive   : CL-MAR88.ZIP
Filename : TSR.C
#include
#include
#include
#include
#include "tsr.h"
static union REGS rg;
static struct SREGS sg;
/* -------- modify this for each TSR ------------ */
unsigned heaplen = 128; /* heap length */
unsigned scancode = 52; /* (Period) HOT KEY SCAN CODE */
unsigned keymask = 8; /* (Alt) HOT KEY STATUS MASK */
char signature [] = "CLOCK"; /* TSR SIGNATURE */
void main(void);
/* --------- main function for the TSR program ------- */
void main()
{
int r;
if ((r = resident(signature)) == 0) {
printf("\nResident clock is loaded");
openfiles();
resinit();
}
printf("\nClock is %s", (r == 1 ? "already resident" : "restarted"));
}
/* ------------- get a keyboard character ---------------- */
int get_char()
{
int c;
while (keyhit() == 0)
;
c = _bios_keybrd(_KEYBRD_READ);
return ((c&0xff)==0) ? (((c>>8)&0xff)|128) : (c&0xff);
}
/* ------- set the Disk Transfer Address ---------- */
void setdta(char far *dta)
{
rg.h.ah = 0x1a;
rg.x.dx = FP_OFF(dta);
sg.ds = FP_SEG(dta);
int86x(0x21, &rg, &rg, &sg);
}
/* ------- get the Disk Transfer Address ---------- */
char far *getdta(void)
{
static char far *dta;
rg.h.ah = 0x2f;
int86x(0x21, &rg, &rg, &sg);
FP_SEG(dta) = sg.es;
FP_OFF(dta) = rg.x.bx;
return dta;
}
/* ----- peek, peekb, poke --------- */
unsigned peek(unsigned s, unsigned o)
{
static unsigned far *ip;
FP_SEG(ip) = s;
FP_OFF(ip) = o;
return *ip;
}
char peekb(unsigned s, unsigned o)
{
static char far *ip;
FP_SEG(ip) = s;
FP_OFF(ip) = o;
return *ip;
}
void poke(unsigned s, unsigned o, unsigned c)
{
static unsigned far *ip;
FP_SEG(ip) = s;
FP_OFF(ip) = o;
*ip = c;
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/