Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
6.6 KiB

  1. ;*************************************************************************
  2. ;** INTEL Corporation Proprietary Information
  3. ;**
  4. ;** This listing is supplied under the terms of a license
  5. ;** agreement with INTEL Corporation and may not be copied
  6. ;** nor disclosed except in accordance with the terms of
  7. ;** that agreement.
  8. ;**
  9. ;** Copyright (c) 1995 Intel Corporation.
  10. ;** All Rights Reserved.
  11. ;**
  12. ;*************************************************************************
  13. ;//
  14. ;// $Header: S:\h26x\src\dec\adjpels.asv 1.2 22 Dec 1995 15:54:30 KMILLS $
  15. ;//
  16. ;// $Log: S:\h26x\src\dec\adjpels.asv $
  17. ;//
  18. ;// Rev 1.2 22 Dec 1995 15:54:30 KMILLS
  19. ;//
  20. ;// added new copyright notice
  21. ;//
  22. ;// Rev 1.1 31 Oct 1995 10:50:56 BNICKERS
  23. ;// Save/restore ebx.
  24. ;//
  25. ;// Rev 1.0 01 Sep 1995 17:14:04 DBRUCKS
  26. ;// add adjustpels
  27. ;*
  28. ;* Rev 1.0 29 Mar 1995 12:17:14 BECHOLS
  29. ;* Initial revision.
  30. ;//
  31. ;// Rev 1.2 07 Dec 1994 16:21:04 BNICKERS
  32. ;// Prepare entry sequence for flat model.
  33. ;//
  34. ;// Rev 1.1 05 Dec 1994 09:45:18 BNICKERS
  35. ;// Prepare for flat model.
  36. ;//
  37. ;// Rev 1.0 15 Jul 1994 11:10:20 BECHOLS
  38. ;// Initial revision.
  39. ;//
  40. ;////////////////////////////////////////////////////////////////////////////
  41. ;
  42. ; adjpels -- This function adjusts pel values to track the user's tinkering
  43. ; with brightness, contrast, and saturation knobs. Each call
  44. ; to this function adjusts one plane.
  45. OPTION PROLOGUE:None
  46. OPTION EPILOGUE:ReturnAndRelieveEpilogueMacro
  47. include locals.inc
  48. ;include decinst.inc
  49. IFNDEF DSEGNAME
  50. IFNDEF WIN32
  51. DSEGNAME TEXTEQU <DataAdjustPels>
  52. ENDIF
  53. ENDIF
  54. IFDEF WIN32
  55. .xlist
  56. include memmodel.inc
  57. .list
  58. .DATA
  59. ELSE
  60. DSEGNAME SEGMENT WORD PUBLIC 'DATA'
  61. ENDIF
  62. ; any data would go here
  63. IFNDEF WIN32
  64. DSEGNAME ENDS
  65. .xlist
  66. include memmodel.inc
  67. .list
  68. ENDIF
  69. IFNDEF SEGNAME
  70. IFNDEF WIN32
  71. SEGNAME TEXTEQU <_CODE32>
  72. ENDIF
  73. ENDIF
  74. ifdef WIN32
  75. .CODE
  76. else
  77. SEGNAME SEGMENT PARA PUBLIC USE32 'CODE'
  78. endif
  79. ifdef WIN32
  80. ASSUME cs : FLAT
  81. ASSUME ds : FLAT
  82. ASSUME es : FLAT
  83. ASSUME fs : FLAT
  84. ASSUME gs : FLAT
  85. ASSUME ss : FLAT
  86. else
  87. ASSUME CS : SEGNAME
  88. ASSUME DS : Nothing
  89. ASSUME ES : Nothing
  90. ASSUME FS : Nothing
  91. ASSUME GS : Nothing
  92. endif
  93. ; void FAR ASM_CALLTYPE AdjustPels (U8 FAR * InstanceBase,
  94. ; X32 PlaneBase,
  95. ; DWORD PlaneWidth,
  96. ; DWORD PlanePitch,
  97. ; DWORD PlaneHeight,
  98. ; X32 AdjustmentTable);
  99. ;
  100. ; In 16-bit Microsoft Windows (tm), InstanceBase provides the segment
  101. ; descriptor for the plane and the adjustment table.
  102. ;
  103. ; In 32-bit Microsoft Windows (tm), InstanceBase provides the base to apply
  104. ; to the plane base and the adjustment table.
  105. PUBLIC AdjustPels
  106. ; due to the need for the ebp reg, these parameter declarations aren't used,
  107. ; they are here so the assembler knows how many bytes to relieve from the stack
  108. AdjustPels proc DIST LANG AInstanceBase: DWORD,
  109. APlaneBase: DWORD,
  110. APlaneWidth: DWORD,
  111. APlanePitch: DWORD,
  112. APlaneHeight: DWORD,
  113. AAdjustmentTable: DWORD
  114. IFDEF WIN32
  115. LocalFrameSize = 0
  116. RegisterStorageSize = 16
  117. ; Arguments:
  118. InstanceBase = LocalFrameSize + RegisterStorageSize + 4
  119. PlaneBase = LocalFrameSize + RegisterStorageSize + 8
  120. PlaneWidth = LocalFrameSize + RegisterStorageSize + 12
  121. PlanePitch = LocalFrameSize + RegisterStorageSize + 16
  122. PlaneHeight = LocalFrameSize + RegisterStorageSize + 20
  123. AdjustmentTable = LocalFrameSize + RegisterStorageSize + 24
  124. EndOfArgList = LocalFrameSize + RegisterStorageSize + 28
  125. ; No Locals (on local stack frame)
  126. LCL EQU <esp+>
  127. ELSE
  128. RegisterStorageSize = 20 ; Put local variables on stack.
  129. ; Arguments:
  130. InstanceBase_zero = RegisterStorageSize + 4
  131. InstanceBase_SegNum = RegisterStorageSize + 6
  132. PlaneBase = RegisterStorageSize + 8
  133. PlaneWidth = RegisterStorageSize + 12
  134. PlanePitch = RegisterStorageSize + 14
  135. PlaneHeight = RegisterStorageSize + 16
  136. AdjustmentTable = RegisterStorageSize + 18
  137. EndOfArgList = RegisterStorageSize + 20
  138. LCL EQU <>
  139. ENDIF
  140. push esi
  141. push edi
  142. push ebp
  143. push ebx
  144. IFDEF WIN32
  145. sub esp,LocalFrameSize
  146. mov eax,PD InstanceBase[esp]
  147. mov esi,PD AdjustmentTable[esp]
  148. mov edi,PD PlaneBase[esp]
  149. add esi,eax
  150. add edi,eax
  151. mov ecx,PD PlaneWidth[esp]
  152. mov edx,PD PlaneHeight[esp]
  153. mov ebp,PD PlanePitch[esp]
  154. ELSE
  155. xor eax,eax
  156. mov eax,ds
  157. push eax
  158. mov ebp,esp
  159. and ebp,00000FFFFH
  160. mov ds, PW [ebp+InstanceBase_SegNum]
  161. movzx esi,PW [ebp+AdjustmentTable]
  162. mov edi,PD [ebp+PlaneBase]
  163. movzx ecx,PW [ebp+PlaneWidth]
  164. movzx edx,PW [ebp+PlaneHeight]
  165. movzx ebp,PW [ebp+PlanePitch]
  166. ENDIF
  167. sub ebp,ecx
  168. xor ebx,ebx
  169. shl ecx,5
  170. dec edx
  171. shl edx,16
  172. xor eax,eax
  173. ; Register usage:
  174. ; ebp -- skip distance, i.e. pitch minus width.
  175. ; esi -- Adjustment table address.
  176. ; edi -- Plane cursor.
  177. ; edx[16:31] -- height.
  178. ; dh -- width counter.
  179. ; ch -- width.
  180. ; dl -- An adjusted pel.
  181. ; cl -- An adjusted pel.
  182. ; bl -- A raw pel.
  183. ; al -- A raw pel.
  184. NextLine:
  185. mov al,PB [edi ]
  186. mov bl,PB [edi+4]
  187. mov dh,ch
  188. Next8Pels:
  189. mov cl,PB [esi+eax]
  190. mov dl,PB [esi+ebx+256+16] ; Table duplicated; avoids many bank conflicts.
  191. mov al,PB [edi+1]
  192. mov bl,PB [edi+5]
  193. mov PB [edi ],cl
  194. mov PB [edi+4],dl
  195. mov cl,PB [esi+eax]
  196. mov dl,PB [esi+ebx+256+16]
  197. mov al,PB [edi+2]
  198. mov bl,PB [edi+6]
  199. mov PB [edi+1],cl
  200. mov PB [edi+5],dl
  201. mov cl,PB [esi+eax]
  202. mov dl,PB [esi+ebx+256+16]
  203. mov al,PB [edi+3]
  204. mov bl,PB [edi+7]
  205. mov PB [edi+2],cl
  206. mov PB [edi+6],dl
  207. mov cl,PB [esi+eax]
  208. mov dl,PB [esi+ebx+256+16]
  209. mov al,PB [edi+8]
  210. mov bl,PB [edi+12]
  211. mov PB [edi+3],cl
  212. mov PB [edi+7],dl
  213. add edi,8
  214. dec dh
  215. jne Next8Pels
  216. add edi,ebp
  217. sub edx,000010000H
  218. jge NextLine
  219. IFDEF WIN32
  220. add esp,LocalFrameSize
  221. ELSE
  222. pop ebx
  223. mov ds,ebx
  224. ENDIF
  225. pop ebx
  226. pop ebp
  227. pop edi
  228. pop esi
  229. rturn
  230. AdjustPels endp
  231. IFNDEF WIN32
  232. SEGNAME ENDS
  233. ENDIF
  234. END