tspa3570.zip Turbo Pascal 7.0 real mode units for (real:-) programmers

Sat 7-Sep-96: I have updated my collection of Turbo Pascal TPU
units to be

 115483 Sep 7 09:27 ftp://garbo.uwasa.fi/pc/ts/tspa3570.zip
 tspa3570.zip Turbo Pascal 7.0 real mode units for (real:-) programmers.

This collection is also available for earlier Turbo Pascal versions

Corrected an error in WEEKNRFN "Returns the week number for a given
date" in the TSUNTE unit. The function mispresented as week 52 some
very rare year-beginning dates dates as as week 53. Although this
concerns only six days e.g. in the 19th century, we decided to make
the correction. The weekday function is by my colleague Associate
Professor of Statistics Seppo Pynnonen.

   TSUNTJ unit contains "COPYFILE Copy a file from within a Turbo
Pascal program". Added to the documentation the fact that a heap of
80000 bytes should be reserved in the calling program.
   While at it brought up to date some address information in the

Summary of the Functions and Procedures in the tspa3570.zip Package

Functions are indicated by the ending FN, the procedures by the lack
of it.

TSUNTA: (uses Dos, Crt, TSUNTE)
  ATTRIBFN Color attribute for direct write to video memory
  HIGHTFN  Current height of text screen
  PANML    Scroll screen left
  PANMR    Scroll screen right
  VDAEXYFN Direct read of a screen video memory color attribute
  VDCHXY   Direct read from the screen video memory
  VIDXY    Direct write to the screen video memory
  WIDTHFN  Current width of the text screen

TSUNTB: (uses Dos)
  BBINFN   Convert decimal byte to binary string
  BHEXFN   Convert decimal byte to hexadecimal string
  BINDECFN Convert binary string to decimal word
  BINFN    Convert decimal word to binary string
  BITONFN  Boolean status of a bit in a word
  BTEWRDFN Combine two bytes into a single word, inverse of Hi & Lo
  CONVBFN  Convert a number (string) of any base to any other base
  HEXDECFN Convert hexadecimal string to decimal word
  HEXFN    Convert decimal word to hexadecimal string
  HEXLNGFN Convert hexadecimal string to decimal longint up to 7FFFFFFF
  HIWORDFN The high-order (hi) word of the longint argument
  LBINFN   Convert decimal longint to binary string
  LHEXFN   Convert decimal longint to hexadecimal string
  LOWORDFN The low-order (lo) word of the longint argument
  POWERFN  Conventional raising of a positive real to a power
  POWERGFN Generalized raising of any real to a real power
  POWERLFN Raise longint to a non-negative integer power fast
  R16TOFN  Six{*word*249} to a power fast (word)
  TICKSFN  Count of 18.2 times per second ticks (longint)
  TIMERFN  Seconds elapsed since midnight (real)
  TWOTOFN  Two to a power fast (word)
  WRDLNGFN Combine two words into a longint

TSUNTC: (uses Dos, Crt)
  BLBACK   Cancel HIBACK enabling usage of blinking text
  HIBACK   Enable hi-intensity (bright) background colors
  PLAYNOTE Play a note
  REVCOLOR Reverse text colors (a toggle)

TSUNTD: (uses Dos)
  AUDIO    Enhanced Sound procedure, no Crt unit needed
  DOSDELAY Delay without needing the Crt unit
  GETPRTFN Get the number of printer default timeout retry times
  LEADFN   Lead a string with a multiple character (i.e. pad left)
  LOWCASFN The opposite of UpCase (inline coded)
  LPTONLFN Get the online status of the first parallel printer
  PARSE    Extract all substrings from a string faster (1st method)
  PARSENFN Number of substrings in a string (resembles ParamCount)
  PARSERFN Get substrings from a string (resembles ParamStr)
  PRTONLFN Get the online status of a printer (may fail)
  PRTSCR   Print the current screen
  SETPRT   Set the number of default printer timeout retry times
  SPARTFN  Returns a specified substring (resembles ParamStr)
  STRCNTFN Number of substrings in a string (resembles ParamCount)
  TRAILFN  Trail a string with a multiple character (i.e. pad right)
  TRIMLFFN Trim a string left
  TRIMRGFN Trim a string right

TSUNTE: (uses Dos)
  ALLSIZFN Allocated true size of a file in bytes
  ARCFILFN Is a file's archive bit set or not
  BORDER   Change border color (CGA, VGA)
  CAPS     Turn CapsLock on, or off
  CAPSONFN Get CapsLock status
  CLB      Clear the keyboard buffer
  CLUSIZFN Cluster size on a device (cluster is the allocation unit)
  CMDLNFN  Returns the entire command line
  CURSOFF  Turn off cursor (keeps other cursor attributes)
  CURSON   Turn cursor back on as it was
  CURSOR   Change cursor size
  DATEOKFN Is a date a valid, existing date
  DEFDRVFN Get the default drive
  FEXISTFN File existence status, handles ReadOnly files correctly
  FSIZE2FN File size in bytes, alternative method
  FSIZEFN  File size in bytes as in directory (never on open file)
  HIDFILFN Is a file a hidden file or not
  LABELFN  Get a disk's volume label
  LASTDMFN The number of days in a given month and year
  MONOFN   Is it a monochrome video adapter
  NUMLOCK  Turn NumLock on, or off
  NUMLONFN Get NumLock status
  RDOFILFN Is a file a read-only file or not
  SCRLOCK  Turn ScrollLock on, or off
  SCRLONFN Get ScrollLock status
  SYSFILFN Is a file a system file or not
  WEEKNRFN Returns the week number for a given date
  WKDAYFN  Returns modern weekday
  ZELLERFN Zeller's congruence (for comparing dates etc)

TSUNTF: (uses Dos, Crt)
  EDRDEBLN Editable Readln with ctrl-c, break trapping, pre-fill etc
  EDRDEFLN Editable Readln with recall, pre-fill, and insert toggle
  EDRDLN   Readln with line-editing potential (the simplest)
  EDREABLN Edreadln with ctrl-c and break trapping
  EDREADLN Editable Readln with recall, and insert toggle

TSUNTG: (uses Dos)
  ACTDRVFN Which floppy drive is active on a one drive system
  CDROMFN  Is a drive a CD-ROM with MSCDEX driver installed
  CLS      Set 25*80 text mode and clear screen (no Crt required)
  CLS40    Set 25*40 text mode and clear screen (no Crt required)
  DRIVESFN Number of diskette drives on the system
  DSKCNTFN Get the number of disk devices (MsDos 3.0+)
  FDRIVEFN The name of the first diskette drive on the system
  FIXEDFN  Is a drive a fixed disk or not
  FLOPSTFN Floppy disk status. Is it present and formatted.
  GOATXY   As the ordinary GoToXY but no Crt unit required
  INDRIVFN Is a media present in the given drive
  ISANSIFN Has ansi.sys or a similar screen driver been loaded
  ISRAMFN  Is a drive a probable ramdisk
  ISUBSTFN Is a drive a substituted drive (MsDos 3.1+)
  MEDIAFN  What kind of a disk media is present in a drive
  MSCVERFN Get CD-ROM driver MSCDEX.EXE version
  REVAREA  Reverse the colors of an area
  USECON   Restore write and writeln direction to the screen
  USEPRN   Redirect write and writeln to the printer
  WHEREXFN As the ordinary WhereX but no Crt unit required
  WHEREYFN As the ordinary WhereY but no Crt unit required

TSUNTH: (uses Dos)
  COUNTRFN Get country code (MsDos 3.0+)
  CPUFN    Get the type of the processor chip
  DATEFMFN Country-dependent date format (MsDos 3.0+)
  FATSFN   Get number of file allocation tables, not XTs
  GRTABLFN Has MsDos GRAFTABL been loaded or not
  INTERLFN Get interleave coefficient of a harddisk, not XTs
  ISENHAFN To detect an enhanced keyboard
  ISMOUSFN A simple true/true false test of mouse available
  LASTDRFN Get last drive of the system, softcoded, not XTs
  MATHCOFN Is a math coprocessor present
  MOUSTAFN Status (type byte) of the mouse hardware and driver
  NRCYLFN  Number of cylinders on a drive if media present (MsDos 3.2+)
  PARPORFN Get the number of parallel ports (printers installed)
  ROMDTEFN Get ROM BIOS version (date)
  RS232FN  Get the number of serial ports
  TIMEFMFN Country-dependent time format (MsDos 3.0+)
  Z2ASZFN  Convert an Asciiz string into an ordinary ascii string

TSUNTI: (uses Dos)
  BRANDEXE Store information within your program's .exe file (MsDos 3.0+)
  CHKSUMFN Checksum selftest to detect any tampering (MsDos 3.0+)
  USECOUNT Get the number of times the program has been used

TSUNTJ: (uses Dos)
  COPYFILE Copy a file from within a Turbo Pascal program
  INTRADDR Show the memory address to which the interrupt points
  INTRLOCA Show the memory address where the interrupt is located
  ISDIR2FN Is a name a directory or not, alternative method
  ISDIR3FN Is a name a directory or not, a slower and surer method
  ISDIRFN  Is a name a directory or not (not for DRDOS)
  OPENEDFN Is an assigned textfile still open or not
  OPENFLFN Is an assigned non-textfile still open or not
  PIPEDIFN Is the standard input from redirection
  PIPEDNFN Is the standard output redirected to nul
  PIPEDOFN Is the standard output redirected

TSUNTK: (uses Dos, TSUNTB)
  BOOTDRFN Get boot device name (MsDos 4.0+)
  GETSERFN Get disk's serial number (MsDos 4.0+)
  GETVOLFN Special get disk volume label (MsDos 4.0+)
  SETSER   Set floppy's serial number (MsDos 4.0+)

TSUNTL: (uses Dos)
  ISEGAFN  Is at least an EGA present. No graph unit needed
  NOLABEL  Delete a disk's volume label.
  SCROLLDN Scroll down a window. No Crt unit needed
  SCROLLUP Scroll up a window. No Crt unit needed
  SETLABEL Set a disk's volume label.

TSUNTM: (uses Dos)
  ALTFN    Is the alt key depressed
  CTRLFN   Is the ctrl key depressed
  GETESCAN Get scancode of key pressed, enhanced keyboard.
  GETSCAN  Get scancode of key pressed, XT keyboard.
  INKEYFN  Basic-like timed character input
  KEYPREFN As the ordinary KeyPressed but no Crt unit required
  LFALTFN  Is the left alt key depressed
  LFCTRLFN Is the left ctrl key depressed
  LFSHFTFN Is the left shift key depressed
  RDENKEFN Enhanced keyboard ReadKey, detects also F11 and F12
  READKEFN As the ordinary ReadKey but no Crt unit required
  RTALTFN  Is the right alt key depressed
  RTCTRLFN Is the right ctrl key depressed
  RTSHFTFN Is the right shift key depressed
  SYSRQFN  Is the SysRq key depressed

TSUNTBOT: (uses Dos)
  COLDBOOT Reboot computer, including memory tests
  REBOOT   Reboot computer with disk closing and cache flushing
  WARMBOOT Warm reboot of the computer (as alt-ctrl-del)

TSUNTENV: (uses Dos)
  ENVADDFN Get the starting segment address of the parent environment
  ENVSIZFN Get the size of the parent environment
  ENVUSEFN Get the current use of the parent environment
  SETENV   Set a parent environment variable (variable=value)
  SETENVSH Set an environment variable for the duration of shelling
  SHOWENV  Write the parent environment table on stdout (for testing)

SELFTEST.PAS: (uses Dos)
  SELFTEST Selftest .exe file's size and date to detect tampering

TSUNT45: (Uses Dos)  (Needed for TP 4.0 only)
  DosVersion Get Dos version
  EnvCount   The number of strings contained in the DOS environment
  EnvStr     The value of an environment string defined by index count
  FExpand    Expand a file name into a fully qualified file name
  GetCBreak  Get the state of Ctr-Break checking in DOS
  GetEnv     The value of an environment string defined by string id
  GetVerify  Get the status of the MsDos write verify flag
  ParamStr0  The name of the program
  SetCBreak  Set the state of Ctr-Break checking in DOS
  SetVerify  Set the status of the MsDos write verify flag

TSERR: (Include verbal run-time error messages)

   All the best, Timo

Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi archives
Department of Accounting and Business Finance  ; University of Vaasa
t...@uwasa.fi http://uwasa.fi/~ts BBS 961-3170972; FIN-65101,  Finland