home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
screen
/
getfrq
/
getfreq.das
next >
Wrap
Text File
|
1993-11-12
|
4KB
|
163 lines
`-----------------------------------------------------------------------------
` GET VIDEO VERTICAL RETRACE FREQUENCY
`
`This program gives the vertical frequency of the video display. The value
` differ from the current video mode.
`
`Written in DASH 1.0
`Sebastien Demers November 10, 1993
`
include extfunc.dh
objinclude system.lib
word TimeCnt
dword OldInt8
byte SOption
`-----------------------------------------------------------------------------
` Wait for vertical retrace (at bit set 1) (normal)
`
void waitfor1()
a1: mov dx,3dah
jmp far a2 `wait a little
a2: in al,dx
test al,1000b
jz a1
.
`-----------------------------------------------------------------------------
` Wait for vertical retrace (at bit set 0 )
void waitfor0()
a1: mov dx,3dah
jmp far a2 `wait a little
a2: in al,dx
test al,1000b
jnz a1
.
`-----------------------------------------------------------------------------
` New interrupt 8 routine
void NewInt8()
push ax
push ds
mov ax,seg _data
mov ds,ax
inc TimeCnt
pushf
call OldInt8
pop ds
pop ax
iret
.
`-----------------------------------------------------------------------------
` CLEAR_SCREEN
`
`Clear the all 128k buffer without changing the video mode
`
void clear_screen()
cmp SOption,0 `Do not clear the screen option?
jnz ne `yes
es= 0a000h; di= 0
mov cx,8192
a1: push cx
mov cx,16/2
ax=0
rep stosw
pop cx
es=es+1; di=0
loop a1
ne:
.
`----------------------------------------------------------------------------
` RESTORE SCREEN
`
void restore_screen()
cmp SOption,0
jnz ne
mov ax,3
int 10h
ne:
.
`-----------------------------------------------------------------------------
` Read command line
byte ReadCL()
ds= _PspAdrs
si= 81h
a1: lodsb
cmp al,13
je ne
cmp al,'/'
jne a1
lodsb
cmp al,'?'
je a2 `help command
and al,223
cmp al,'D'
je a3
jmp a1
a2: Printf "GET VIDEO FREQUENCY Copyright (c) 1993 by Sebastien Demers\e"\\
" Option: \e"\\
" /D Do not clear the screen while testing\e\e" \\
" Run only on COLOR displays and may not run in windows 386 enhanced mode\e"
ds=ss
return 1
a3: ss:SOption=1
jmp a1
ne: ds=ss
return 0
.
`------------------------------------------------------------------------------
` MAIN
begin
word counter
byte flag
ReadCL()
or al,al
jnz terminate
clear_screen()
OldInt8= GetIntVec( 8 )
mov dwtemp[\word 0], offset #glb NewInt8
mov dwtemp[\word 2], cs
SetIntVec( 8, dwtemp )
SetTimer( 4, 1193280/20 ) `stop the timer
Waitfor0()
Waitfor1()
SetTimer( 3, 1193280/20 ) `start it at frequency of 20Hz
TimeCnt=0
Counter=0
a1: cmp TimeCnt, 20
jae aend
inc Counter
Waitfor0()
Waitfor1()
jmp a1
aend: SetTimer( 3, 0 ) `18.2 normal
SetIntVec( 8, OldInt8 )
Restore_screen()
printf "Video vertical frequency: %u Hz", Counter
terminate:
end