VERTBLNK.ASM 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ; $Header: g:/library/wwlib32/video/rcs/vertblnk.asm 1.1 1994/04/18 09:34:51 jeff_wilson Exp $
  19. ;***************************************************************************
  20. ;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  21. ;***************************************************************************
  22. ;* *
  23. ;* Project Name : Library routine *
  24. ;* *
  25. ;* File Name : VERTBLNK.ASM *
  26. ;* *
  27. ;* Programmer : Christopher Yates *
  28. ;* *
  29. ;* Last Update : 20 August, 1990 [CY] *
  30. ;* *
  31. ;*-------------------------------------------------------------------------*
  32. ;* Functions: *
  33. ;* *
  34. ; WORD Get_Vert_Blank(VOID); *
  35. ; VOID Wait_Vert_Blank(VOID); *
  36. ; WORD get_vga_state (VOID) ;
  37. ; VOID set_vga_mode (WORD) ;
  38. ;* *
  39. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  40. IDEAL
  41. P386
  42. MODEL USE32 FLAT
  43. LOCALS ??
  44. GLOBAL Get_Vert_Blank : NEAR
  45. GLOBAL Wait_Vert_Blank : NEAR
  46. GLOBAL get_vga_state : NEAR
  47. GLOBAL set_vga_mode : NEAR
  48. CODESEG
  49. ; ----------------------------------------------------------------
  50. ;
  51. ; Here are prototypes for the routines defined within this module:
  52. ;
  53. ; WORD Get_Vert_Blank(VOID);
  54. ; VOID Wait_Vert_Blank(VOID);
  55. ; WORD get_vga_state (VOID) ;
  56. ; VOID set_vga_mode (WORD) ;
  57. ;
  58. ; ----------------------------------------------------------------
  59. ;----------------------------------------------------------------------------
  60. PROC Get_Vert_Blank C near
  61. USES edx
  62. mov dx,03DAH ; CRTC status register
  63. in al,dx
  64. and al,008H ; look at bit 3 vertical sync
  65. xor ah,ah ; zero ah
  66. ret
  67. ENDP Get_Vert_Blank
  68. ;----------------------------------------------------------------------------
  69. ;----------------------------------------------------------------------------
  70. PROC Wait_Vert_Blank C near
  71. USES eax,ebx,edx
  72. ARG blank:DWORD
  73. mov ebx,[blank] ; get vertical blank 0 or 1 for on
  74. mov edx,03DAH ; CRTC status register
  75. and bl,01b
  76. shl bl,3
  77. ??in_vbi:
  78. in al,dx ; read CRTC status
  79. and al,008h ; only vertical sync bit
  80. xor al,bl
  81. je ??in_vbi ; in vertical sync
  82. ??out_vbi:
  83. in al,dx ; read CRTC status
  84. and al,008h ; only vertical sync bit
  85. xor al,bl
  86. jne ??out_vbi ; not in vertical sync
  87. ret
  88. ENDP Wait_Vert_Blank
  89. ;----------------------------------------------------------------------------
  90. ; WORD get_vga_state (VOID) ;
  91. PROC get_vga_state C near
  92. USES ebx
  93. mov eax,0f00h
  94. int 10h
  95. and eax, 0ffh
  96. ret
  97. ENDP get_vga_state
  98. ;----------------------------------------------------------------------------
  99. ; VOID set_vga_mode (WORD) ;
  100. PROC set_vga_mode C near
  101. ARG mode:dword
  102. mov eax , [mode]
  103. and eax , 0ffh
  104. int 10h
  105. ret
  106. ENDP set_vga_mode
  107. END
  108.