home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
BURKS
/
SOFTWARE
/
LIBS
/
TESS110.ZIP
/
TSDAYTIM.PAS
(
.txt
)
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-07-03
|
18KB
|
512 lines
{****************************************************************************
* TSDAYTIM.PAS -- Turbo Pascal 4.0 demonstration program
***************************************************************************
SUBTTL TesSeRact Revision Level 1
;--------------------------------------------------------------------------
; TesSeRact(tm) -- A Library of Routines for Creating Ram-Resident (TSR)
; programs for the IBM PC and compatible Personal
; Computers.
;
;The software, documentation and source code are:
;
; Copyright (C) 1986, 1987, 1988 Tesseract Development Team
; All Rights Reserved
;
; c/o Chip Rabinowitz
; Innovative Data Concepts
; 2084 Woodlawn Avenue
; Glenside, PA 19038
; 1-215-884-3373
;
;--------------------------------------------------------------------------
; This product supports the TesSeRact Standard for Ram-Resident Program
; Communication. For information about TesSeRact, contact the TesSeRact
; Development Team at:
; Compuserve: 70731,20
; MCIMAIL: 315-5415
; This MCIMAIL Account has been provided to the TesSeRact Development
; Team by Borland International, Inc. The TesSeRact Development Team
; is in no way associated with Borland International, Inc.
;--------------------------------------------------------------------------}
PROGRAM TSDayTim; { Copyright 1988 TesSeRact Development Team }
{$R-,S-,I-,D+,T+,F-,V-,B-,N-,L+ }
{$M 1024,0,0 } { this line needed to reduce stack and heap! }
Uses DOS, CRT, TESSTP; { program redone 02-24-88, Jim Kyle, for RDT }
{*************************************************************************
* This program is a VERY simple-minded TSR that merely displays the *
* time and date in the top RH corner, and which can also pop up and *
* remove itself from memory. All of the fancy frills (snow-free write *
* to CGA screens, full compatibility with EGA/VGA modes, file I/O, and *
* the like) have been left out, to concentrate on those actions which *
* are REQUIRED to interface TesSeRact with Turbo Pascal 4 programs. *
*************************************************************************}
{ first we declare constants and such....... }
CONST
MAXVIDSIZE = 2000 ; { TP4 version only uses 80x25 }
MONONORM = $07 ;
MONOREV = $70 ;
VAR
savescreen : array [1..MAXVIDSIZE] of word ;
{ buffer to save screen image }
NormAtt, { Default Normal Attribute }
RevAtt, { Default Reverse Attribute }
curmode, { Current video mode }
oldcur, { Old Cursor shape }
oldpos : word; { Old Cursor position }
biosvid : pointer; { Pointer to video buffer }
BackStack : array [0..1023] of char; { Stack area for BackGround }
buffer : array [0..17] of byte ; { work buffer for date/time format}
BackFlag : word; { Background flag to signal }
{ additional processing }
idnum, { TSR Identification Number }
hours, { Current hour of day }
mins, { Current minute of hour }
secs, { Current seconds of minute }
yr, { for date report }
mon,
day,
ticks : word; { Timer-tick counter }
regs : registers; { workspace for INTR interfaces }
{***********************************************************
* Video Support Routines *
*********************************************************CR}
PROCEDURE c_str( row : integer; str : string );
{ Print a string, centered }
VAR
wid : integer; { temporary width variable }
BEGIN
wid := (80 - length(str)) SHR 1; { calculate cursor position }
gotoxy(wid, row); { go there }
write(str); { display the string }
END;
PROCEDURE getscrn; { very primitive screen saver }
BEGIN { WILL snow with CGA... }
move( biosvid^, savescreen, sizeof(savescreen) );
END;
PROCEDURE putscrn; { very primitive screen restore }
BEGIN { WILL snow with CGA... }
move( savescreen, biosvid^, sizeof(savescreen) );
END;
PROCEDURE SaveCursor; { save current cursor size and }
BEGIN { position }
Regs.AH := 3; { Get Cursor Position }
Regs.BH := 0;
Intr( $10, Regs );
oldpos := Regs.DX; { Save return values }
oldcur := Regs.CX;
{ known bug on some monochrome }
{ adapters reports the wrong }
{ cursor shape when both color }
{ and monochrome systems are }
{ installed. }
IF( (curmode = MONO) AND (oldcur = $0607) ) THEN
oldcur := $0c0d;
Regs.AH := 1;
Regs.CX := $ffff;
Intr( $10, Regs );
END;
PROCEDURE RestoreCursor; { restore saved cursor position }
BEGIN { and size }
Regs.AH := 2; { restore saved position }
Regs.BH := 0;
Regs.DX := oldpos;
Intr( $10, Regs );
Regs.AH := 1; { restore saved cursor type }
Regs.BH := 0;
Regs.CX := oldcur;
Intr( $10, Regs );
END;
{****************************< FixRows >******************************
* *
* Determine current video mode and set it up *
* ------------------------------------------ *
* *
* This function determines the current video mode at popup time, and *
* if it is one of the four text modes sets to 80 columns, the *
* default color scheme, and initializes the video RAM pointer. *
* Note that this program does NOT restore to 40-column mode after popping *
* up; that, like de-snowing the video, is left for you to program. *
* *
* Parameters: *
* None *
* *
* Returns: *
* None *
* *
*************************************************************************CR}
PROCEDURE fixrows; { Re-initialize current video }
BEGIN { information for new instance }
{ of video usage }
curmode := word( mem[$40:$49] ); { Get current mode at popup }
CASE (curmode) OF { deal with text modes }
BW40:
BEGIN
textmode(BW80); { we need 80 columns }
NormAtt := MONONORM; { use Monochrome Attributes }
RevAtt := MONOREV;
END;
BW80, MONO:
BEGIN
NormAtt := MONONORM; { use Monochrome Attributes }
RevAtt := MONOREV;
END;
C40:
BEGIN
textmode(C80); { we need 80 columns }
{ use Color attributes }
NormAtt := (YELLOW + (BLUE SHL 4)) ;
RevAtt := (WHITE + (RED SHL 4)) ;
END;
C80:
BEGIN { use Color attributes }
NormAtt := (YELLOW + (BLUE SHL 4)) ;
RevAtt := (WHITE + (RED SHL 4)) ;
END;
END;
IF(curmode = MONO) THEN { If monochrome .... }
biosvid := ptr($b000,124) { ... set pointer }
else { That means color .... }
biosvid := ptr($b800,124); { ... so set pointer }
END;
{****************************< SizeOfCode >******************************
* *
* Determine size of program to keep resident *
* ------------------------------------------ *
* *
* This function is an example of a function that can be used to determine *
* the size of the TSR that is to remain resident. For use with TP4, *
* no parameters are supplied and the value is like that for ALLHEAP *
* with MSC 5.0 or Turbo C 1.5; the stack is below the heap and the *
* entire heap and stack are counted in the value. *
* *
* Parameters: *
* None *
* *
* Returns: *
* Number of 16-byte paragraphs of memory to keep when going resident. *
* *
*************************************************************************CR}
FUNCTION SizeOfCode : word;
VAR
used : word;
BEGIN
used := Seg(HeapPtr^) - PrefixSeg; { these are built-ins for TP4.. }
SizeOfCode := used; { return number of paragraphs }
END;
{****************************< do_cpyrt >******************************
* *
* Display Copyr