home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
C-ASM_VI.ARJ
/
PROGASM.ZIP
/
PROG010P.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-04-16
|
974b
|
35 lines
;*****************************************************************
; Wait for start of next vertical retrace *
;*****************************************************************
PUBLIC Vertical_Retrace
Vertical_Retrace PROC FAR
PUSH ES
XOR AX,AX ;Get address of STATUS register
MOV ES,AX ;From segment 0
MOV DX,3BAH ;Assume monochrome addressing
TEST BYTE PTR ES:[BIOS_Equipment],2 ;Is mono display attached?
JNZ VR_Address_Ok ;...Yes, address is ok
MOV DX,3DAH ;...No, must set color addressing
VR_Address_Ok:
IN AL,DX ;Read in status
JMP $+2
TEST AL,08H ;Is retrace ON? (if ON bit = 1)
JZ Wait_For_On ;...no, go wait for start
Wait_For_Off: ;...yes, wait for it to go OFF
IN AL,DX
JMP $+2
TEST AL,08H ;Is retrace OFF?
JNZ Wait_For_Off ;...No, keep waiting
Wait_For_On:
IN AL,DX
JMP $+2
TEST AL,08H ;Is retrace ON?
JZ Wait_For_On ;...No, keep on waiting
POP ES
RET
Vertical_Retrace ENDP