home *** CD-ROM | disk | FTP | other *** search
- { File = DOS23.PAS
- Procedures to test the video mode, set colors, and perform other
- DOS functions.
- WPM -- 11/25/87
- Converted to Unit, 12/2/87
- Revised: 1/24/88 }
-
- { -------------------------------------------------------------------------- }
-
- unit dos23 ;
- {$v-}
- interface
-
- uses
- crt, dos, io23unit ;
-
- var
- bgcolor, { background color }
- txcolor : integer ; { text color }
-
- function is_mono : boolean ;
- { whether monitor is monochrome or not }
- procedure rvson ;
- { turn reverse video on }
- procedure rvsoff ;
- { turn reverse video off }
- procedure emphon ;
- { turn emphasis on -- if text is dim, make it bright; if bright make it dim }
- procedure emphoff ;
- { turn emphasis off }
- procedure assigncolors ;
- { change colors on display -- border same as background, but only on CGA }
- procedure getdrive (var drive : str1) ;
- { get current drive }
- function freespace (drive : str1) : real ;
- { get free space on disk }
-
- { ========================================================================== }
-
- implementation
-
- function is_mono : boolean ;
-
- var
- regs : registers ;
-
- begin
- regs.AX := $0F00 ;
- intr ($10,regs) ;
- is_mono := (regs.AL = 7)
- end ;
-
- { --------------------------------------------------------- }
-
- procedure rvson ;
- { turn reverse video on }
- begin
- textcolor(bgcolor) ;
- textbackground(txcolor)
- end ;
-
- procedure rvsoff ;
- { turn reverse video off }
- begin
- textcolor(txcolor) ;
- textbackground(bgcolor)
- end ;
-
- procedure emphon ;
- { turn emphasis on -- if text is dim, make it bright; if bright make it dim }
- begin
- if txcolor in [0..7] then
- textcolor(txcolor + 8)
- else
- textcolor(txcolor - 8)
- end ;
-
- procedure emphoff ;
- { turn emphasis off }
- begin
- textcolor(txcolor)
- end ;
-
- { ------------------------------------------------------------- }
-
- procedure assigncolors ;
- { change colors on display -- border same as background, but only on CGA }
- var
- regs : registers ;
-
- begin
- textbackground(bgcolor) ; { set background color }
- regs.AX := $0B00 ; { set border on CGA }
- regs.BX := bgcolor and $00FF ;
- intr($10,regs) ;
- textcolor(txcolor) { set text color }
- end ; { proc assigncolors }
-
- { ------------------------------------------------------------- }
-
- procedure getdrive (var drive : str1) ;
- { get current drive }
-
- var regs : registers ;
-
- begin
- with regs do
- begin
- AX := $1900 ;
- msdos(Dos.Registers(regs)) ;
- drive := chr(AL + $41)
- end
- end ; { proc getdrive }
-
- { ------------------------------------------------------------- }
-
- function freespace (drive : str1) : real ;
- { get free space on disk }
-
- var
- regs : registers ;
-
- begin
- with regs do
- begin
- AH := $36 ; { Dos function call }
- DL := ord(drive[1]) - $40 ; { 01 = A, 02 = B, etc. }
- msdos (regs) ;
- freespace := 1.0 * ax * bx * cx { mult by 1.0 to get real result }
- end
- end ; { function freespace }
-
- end. { implementation }
-
- { ------ EOF DOS23.PAS ---------------------------------------------------- }