home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
MONITOR.ZIP
/
MONITOR.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-09-22
|
6KB
|
166 lines
;
; MONITOR.ASM - Copyright (C) 1993 - Tony Doimeadios - All Rights Reserved
;
; Made-----------: 09/22/93
; Last Modified--: 09/22/93
;
; This function will return the type of video card in the system.
; 1 = MCGA Color
; 2 = MCGA Mono
; 3 = VGA Color
; 4 = VGA Mono
; 5 = EGA
; 6 = CGA
; 7 = Hercules
; 8 = MDA
;
; How to use it:
; This function is linked in with QB4.5 or PDS7.1
; Declare Function Monitor%()
; Print Monitor%
; would declare and activate the function.
;
; Technical Details:
; I used Turbo Assembler 3.0 to compile this source code.
; TASM MONITOR
; LIB MONITOR.LIB +MONITOR.OBJ;
; LINK /Q /SEG:1024 MONITOR.LIB,,NUL,QBXQLB;
; This produces MONITOR.LIB and MONITOR.QLB
; To load it into QB/QBX: QBX /L MONITOR
;
;
;
;
; This program is hereby released into the Public Domain.
; This program can be freely copied and distributed as
; long as the information in this block of comments is
; not changed.
;
; If you have any problems, complaints or requests, you can
; address them to the author. I'm always happy to hear
; from people that use my programs.
; ┌─────────────────────────────────────────────────────┐
; │ Tony Doimeadios, P.O. Box 431, Brunswick, GA 31521 │
; └─────────────────────────────────────────────────────┘
DOSSEG
.MODEL MEDIUM, BASIC
.DATA
.CODE
mov ax,@Data
mov ds,ax ;set DS to point to the data segment
public Monitor
;---------------------------------------------------------------------
Monitor PROC FAR
;this is a BASIC FUNCTION that returns a number, indicating monitor type
;usage--: PRINT Monitor%
mov ax,1A00h ;function number
int 10h ;call VIDEO BIOS
cmp al,1Ah ;is this a VGA/MCGA system?
jne TryEGA ;nope, go test for EGA
TryMCGAColor:
cmp bl,Ch ;see if we're MCGA Color
jne TryMCGAMono ;nope, go see if we're MCGA Mono
xor ax,ax ;yes, zero out register
mov ax,1 ;put 1 in returned register
jmp short Done ;bail out
TryMCGAMono:
cmp bl,Bh ;see if we're MCGA Mono
jne TryVGAColor ;nope, go see if we're VGA Color
xor ax,ax ;yes, zero out register
mov ax,2 ;put 2 in returned register
jmp short Done ;bail out
TryVGAColor:
cmp bl,08h ;see if we're VGA Color
jne TryVGAMono ;nope, go see if we're VGA Mono
xor ax,ax ;yes, zero out register
mov ax,3 ;put 3 in returned register
jmp short Done ;bail out
TryVGAMono:
cmp bl,07h ;see if we're VGA Mono
jne TryEGA ;nope, go see if we're VGA Mono
xor ax,ax ;yes, zero out register
mov ax,4 ;put 4 in returned register
jmp short Done ;bail out
TryEGA:
xor ax,ax ;zero out register
mov ah,12h ;function number
mov bl,10h ;request EGA info
int 10h ;call EGA BIOS
cmp bl,10h ;bl will still hold 10h if its not an EGA
je TryCGA ;yes, can't be EGA
xor ax,ax ;no, zero out register
mov ax,5 ;put 5 in returned register
jmp short Done ;bail out
TryCGA:
mov dx,3D4h ;point to 6845 address register
xor ax,ax ;zero out register
mov al,0Fh ;request cursor register
out dx,al ;index the register
inc dx ;point to data register
in al,dx ;get current reading
xchg ah,al ;save the value
mov al,100 ;use 100 as a test value
out dx,al ;send it
mov cx,100h ;must delay a bit
Delay: Loop Delay ;make the delay
in al,dx ;read back the value
cmp al,100 ;compare
jne TryHerc ;jump if it changed (no CGA)
xchg ah,al ;CGA is there, so restore original reading
out dx,al ;send it
xor ax,ax ;zero out register
mov ax,6 ;put 6 in returned register
jmp short Done ;bail out
TryHerc: ;it's monochrome - test for Herc
mov dx,3BAh ;CRT Status
in al,dx ;read the port
and al,80h ;isolate bit 7
mov bl,al ;save the value
mov cx,8000h ;ready to loop
Repeat:in al,dx ;read the port again
and al,80h ;isolate bit 7
cmp bl,al ;compare to saved value
loope Repeat ;repeat if no change
je MDA ;it didn't change - must be MDA
xor ax,ax ;it changed - must be a Herc - zero register
mov ax,7 ;put 7 in returned register
jmp short Done ;bail out
MDA:
xor ax,ax ;zero out register
mov ax,8 ;put 8 in returned register
Done:
ret ;we're thru
Monitor ENDP
;---------------------------------------------------------------------
END