VB.ASM 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. ;****************************************************************************
  19. ;*
  20. ;* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
  21. ;*
  22. ;*---------------------------------------------------------------------------
  23. ;*
  24. ;* FILE
  25. ;* vb.asm
  26. ;*
  27. ;* DESCRIPTION
  28. ;* Vertical blank routines. (32-Bit protected mode)
  29. ;*
  30. ;* PROGRAMMER
  31. ;* Denzil E. Long, Jr.
  32. ;*
  33. ;* DATE
  34. ;* January 26, 1995
  35. ;*
  36. ;*---------------------------------------------------------------------------
  37. ;*
  38. ;* PUBLIC
  39. ;* WaitNoVB - Wait for active scan.
  40. ;* WaitVB - Wait for vertical blank.
  41. ;*
  42. ;****************************************************************************
  43. IDEAL
  44. P386
  45. MODEL USE32 FLAT
  46. LOCALS ??
  47. INCLUDE "video.i"
  48. CODESEG
  49. ;****************************************************************************
  50. ;*
  51. ;* NAME
  52. ;* WaitNoVB - Wait for active scan.
  53. ;*
  54. ;* SYNOPSIS
  55. ;* WaitNoVB()
  56. ;*
  57. ;* void WaitNoVB(void);
  58. ;*
  59. ;* FUNCTION
  60. ;* Sit and wait for the active scan of the display.
  61. ;*
  62. ;* INPUTS
  63. ;* NONE
  64. ;*
  65. ;* RESULT
  66. ;* NONE
  67. ;*
  68. ;****************************************************************************
  69. GLOBAL C WaitNoVB:NEAR
  70. PROC WaitNoVB C NEAR USES edx
  71. ARG vbibit:DWORD
  72. mov eax,[vbibit]
  73. and al,1
  74. shl al,3
  75. mov ah,al
  76. ; loop while VBL bit != VQ_VertBlank
  77. ??no_scan_yet:
  78. mov edx,03DAH
  79. in al,dx
  80. and al,8
  81. xor al,ah
  82. jnz short ??no_scan_yet
  83. ret
  84. ENDP WaitNoVB
  85. ;****************************************************************************
  86. ;*
  87. ;* NAME
  88. ;* WaitVB - Wait for vertical blank.
  89. ;*
  90. ;* SYNOPSIS
  91. ;* WaitVB()
  92. ;*
  93. ;* void WaitVB(void);
  94. ;*
  95. ;* FUNCTION
  96. ;* Sit and wait for the vertical blank of the display.
  97. ;*
  98. ;* INPUTS
  99. ;* NONE
  100. ;*
  101. ;* RESULT
  102. ;* NONE
  103. ;*
  104. ;****************************************************************************
  105. GLOBAL C WaitVB:NEAR
  106. PROC WaitVB C NEAR USES
  107. ARG vbibit:DWORD
  108. mov eax,[vbibit]
  109. and al,1
  110. shl al,3
  111. mov ah,al
  112. ; Loop while VBL bit = VQ_VertBlank
  113. ??no_vbl_yet:
  114. mov edx,03DAH
  115. in al,dx
  116. and al,8
  117. xor al,ah
  118. jz short ??no_vbl_yet
  119. ret
  120. ENDP WaitVB
  121. END