-
Notifications
You must be signed in to change notification settings - Fork 0
/
VIDEO.INC
29 lines (24 loc) · 977 Bytes
/
VIDEO.INC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; ==============================================================================
; Generic video functionality.
; ==============================================================================
; --- EXPORTS ------------------------------------------------------------------
externdef setVideoMode:FAR
externdef setPalette:FAR, paletteInitFade:FAR, paletteNextFade:FAR
; --- MACROS AND CONSTANTS -----------------------------------------------------
; Waits for the next start of a vertical blank (VB) period by the video card
waitVBlank MACRO
LOCAL @waitVBlank_wait1, @waitVBlank_wait2
push ax
push dx
mov dx, 03dah ; VGA status port
@waitVBlank_wait1: ; if already in VB, then wait until VB finishes
in al, dx ; read status
and al, 8 ; test bit 3
jnz @waitVBlank_wait1 ; busy wait if in VB
@waitVBlank_wait2: ; wait until begin of a new VB
in al, dx ; read status
and al, 8 ; test bit 3
jz @waitVBlank_wait2 ; busy wait if NOT in VB
pop dx
pop ax
ENDM