Category : C Source Code
Archive   : QCTSR.ZIP
Filename : CLOCK.C

 
Output of file : CLOCK.C contained in archive : QCTSR.ZIP
/*
* A sample TSR that is connected with the TSR Library
* functions. This program will display the current date
* and time on the screen when the hot key is pressed.
* The display remains and the TSR stays popped up until
* another key is pressed.
*/

#include
#include
#include "tsr.h"

#define VSG 0xb800 /* video memory segment (MDA=0xb000) */
#define ROW 10 /* where the clock displays */
#define COL 30
#define vad(x,y) ((y)*160+(x)*2)

extern int terminating, suspending;
/* --- function called when TSR is popped up ----- */
void popup()
{
int c, v;
unsigned sv[24];
char *tm;
long tim;

for (v = 0; v < 24; v++) /* save the video memory */
sv[v] = vpeek(VSG, vad(COL+v, ROW));
while (!keyhit()) { /* run until a key is pressed */
time(&tim); /* get the current date and time */
tm = ctime(&tim); /* display the date and time */
for (v = 0; v < 24; v++)
vpoke(VSG, vad(COL+v, ROW), *(tm + v) | 0x7000);
}

terminating = ((c = get_char()) == 'u');
suspending = (c == 's');

/* -------- restore the video memory ---- */
for (v = 0; v < 24; v++)
vpoke(VSG, vad(COL+v, ROW), sv[v]);
}
/* --- null startup & shutdown functions --- */
void openfiles() {}
void closefiles() {}



  3 Responses to “Category : C Source Code
Archive   : QCTSR.ZIP
Filename : CLOCK.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/