home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / VDH / XGAMAC.INC < prev    next >
Text File  |  1995-04-14  |  15KB  |  389 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12. ;/*****************************************************************************
  13. ;*
  14. ;* SOURCE FILE NAME = XGAMAC.INC
  15. ;*
  16. ;* DESCRIPTIVE NAME = Macros needed by CGA
  17. ;*
  18. ;*
  19. ;* VERSION      V2.0
  20. ;*
  21. ;* DATE         
  22. ;*
  23. ;* DESCRIPTION  Macros needed by CGA 
  24. ;*
  25. ;* FUNCTIONS    NONE
  26. ;*
  27. ;* NOTES        NONE
  28. ;*
  29. ;* STRUCTURES   NONE
  30. ;*
  31. ;* EXTERNAL REFERENCES
  32. ;*
  33. ;*              NONE
  34. ;*
  35. ;* EXTERNAL FUNCTIONS
  36. ;*
  37. ;*              NONE
  38. ;*
  39. ;* CHANGE ACTIVITY =
  40. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  41. ;*   --------  ----------  -----  --------------------------------------
  42. ;*   mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
  43. ;*
  44. ;*****************************************************************************/
  45.  
  46. ;/***************************************************************************
  47. ;*
  48. ;* MACRO NAME    = invoke - call a procedure 
  49. ;*
  50. ;* DESCRIPTION   = Generate a call to procedure "name."  If the procedure     
  51. ;*                 "name" is not defined in the current file then an extrn    
  52. ;*                 name:near is also generated.  This also causes larger .obj 
  53. ;*                 file and slower link time because the extrn causes a flush 
  54. ;*                 of the LEDATA record (data structure used by the assembler)
  55. ;*                 for the current segment, generates an EXTRN record, then   
  56. ;*                 re-opens the LEDATA record.  The fast way is to lump all   
  57. ;*                 EXTRN's in one place.                                      
  58. ;*
  59. ;*        WARNING: Use is discouraged because it increases link time and
  60. ;*                 encourages people to not declare external procedures
  61. ;*                 explicitly.
  62. ;*
  63. ;* INPUT         = name = name of procedure to call 
  64. ;*
  65. ;* OUTPUT        = call and extrn (if necessary) generated. 
  66. ;*
  67. ;* RETURN-NORMAL = NONE
  68. ;* RETURN-ERROR  = NONE
  69. ;*
  70. ;**************************************************************************/
  71.  
  72. invoke  MACRO   name
  73.  
  74. IFNDEF name
  75.         extrn   name:far
  76. ENDIF
  77.         CALL    name
  78. ENDM
  79.  
  80.  
  81. ;/***************************************************************************
  82. ;*
  83. ;* MACRO NAME    = REP_MOVSW
  84. ;*
  85. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  86. ;*                 update routines that VGA and EGA use.  At compile time,       
  87. ;*                 the macro is replaced by either the simple data movement      
  88. ;*                 instructions or a call to a routine that handles the          
  89. ;*                 movement for the CGA.                                         
  90. ;*
  91. ;*        WARNING: Use is discouraged because it increases link time and
  92. ;*                 encourages people to not declare external procedures
  93. ;*                 explicitly.
  94. ;*
  95. ;* INPUT         = (ds:si) - source pointer         
  96. ;*                 (es:di) - destination pointer    
  97. ;*                 (cx) - number of iterations
  98. ;* OUTPUT        = (ds:si) - end of source         
  99. ;*                 (es:di) - end of destination
  100. ;*                 (cx) - zero                     
  101. ;* RETURN-NORMAL = NONE
  102. ;* RETURN-ERROR  = NONE
  103. ;*
  104. ;**************************************************************************/
  105.  
  106. REP_MOVSW   MACRO
  107.  
  108. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  109.         rep movsw
  110. ELSE
  111.         call    CGA_REP_MOVSW
  112. ENDIF
  113.  
  114. ENDM
  115.  
  116. ;/***************************************************************************
  117. ;*
  118. ;* MACRO NAME    = REP_STOSW
  119. ;*
  120. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  121. ;*                 update routines that VGA and EGA use.  At compile time,       
  122. ;*                 the macro is replaced by either the simple data movement      
  123. ;*                 instructions or a call to a routine that handles the          
  124. ;*                 movement for the CGA.                                         
  125. ;*
  126. ;* INPUT         = (es:di) - destination pointer         
  127. ;*                 (cx) - number of iterations           
  128. ;*                                                       
  129. ;* OUTPUT        = (es:di) - end of destination          
  130. ;*                 (cx) - zero                           
  131. ;*                 
  132. ;* RETURN-NORMAL = NONE
  133. ;* RETURN-ERROR  = NONE
  134. ;*
  135. ;**************************************************************************/
  136.  
  137. REP_STOSW   MACRO
  138.  
  139. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  140.         rep stosw
  141. ELSE
  142.         call    CGA_REP_STOSW
  143. ENDIF
  144.  
  145. ENDM
  146.  
  147. ;/***************************************************************************
  148. ;*
  149. ;* MACRO NAME    = REP_MOVSB_INCSI_LOOP
  150. ;*
  151. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  152. ;*                 update routines that VGA and EGA use.  At compile time,       
  153. ;*                 the macro is replaced by either the simple data movement      
  154. ;*                 instructions or a call to a routine that handles the          
  155. ;*                 movement for the CGA.                                         
  156. ;*
  157. ;* INPUT         = (ds:si) - source pointer              
  158. ;*                 (es:di) - destination pointer         
  159. ;*                 (cx) - number of iterations           
  160. ;* OUTPUT        = (ds:si) - end of source               
  161. ;*                 (es:di) - end of destination          
  162. ;*                 (cx) - zero                  
  163. ;* RETURN-NORMAL = NONE
  164. ;* RETURN-ERROR  = NONE
  165. ;*
  166. ;**************************************************************************/
  167.  
  168. REP_MOVSB_INCSI_LOOP    MACRO
  169.  
  170. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  171.             .repeat                     ; 
  172.                 movsb                   ; Transfer chars to destination
  173.                 inc     si              ; 
  174.             .loop                       ; 
  175.  
  176. ELSE
  177.         call    CGA_REP_MOVSB_INCSI_LOOP
  178. ENDIF
  179.  
  180. ENDM
  181.  
  182. ;/***************************************************************************
  183. ;*
  184. ;* MACRO NAME    = REP_MOVSB_STOSW_LOOP
  185. ;*
  186. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  187. ;*                 update routines that VGA and EGA use.  At compile time,       
  188. ;*                 the macro is replaced by either the simple data movement      
  189. ;*                 instructions or a call to a routine that handles the          
  190. ;*                 movement for the CGA.                                         
  191. ;*
  192. ;* INPUT         = (ds:si) - source pointer              
  193. ;*                 (es:di) - destination pointer         
  194. ;*                 (cx) - number of iterations           
  195. ;* OUTPUT        = (ds:si) - end of source               
  196. ;*                 (es:di) - end of destination          
  197. ;*                 (cx) - zero                  
  198. ;* RETURN-NORMAL = NONE
  199. ;* RETURN-ERROR  = NONE
  200. ;*
  201. ;**************************************************************************/
  202.  
  203. REP_MOVSW_STOSW_LOOP    MACRO
  204.  
  205. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  206.             .repeat
  207.                 movsw           ; Transfer cells to destination
  208.                 stosw
  209.             .loop
  210. ELSE
  211.         call    CGA_REP_MOVSW_STOSW_LOOP
  212. ENDIF
  213.  
  214. ENDM
  215.  
  216. ;/***************************************************************************
  217. ;*
  218. ;* MACRO NAME    = REP_INCDI_STOSB_LOOP
  219. ;*
  220. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  221. ;*                 update routines that VGA and EGA use.  At compile time,       
  222. ;*                 the macro is replaced by either the simple data movement      
  223. ;*                 instructions or a call to a routine that handles the          
  224. ;*                 movement for the CGA.                                         
  225. ;*
  226. ;* INPUT         = (ds:si) - source pointer              
  227. ;*                 (es:di) - destination pointer         
  228. ;*                 (cx) - number of iterations           
  229. ;* OUTPUT        = (ds:si) - end of source               
  230. ;*                 (es:di) - end of destination          
  231. ;*                 (cx) - zero                  
  232. ;* RETURN-NORMAL = NONE
  233. ;* RETURN-ERROR  = NONE
  234. ;*
  235. ;**************************************************************************/
  236.  
  237. REP_INCDI_STOSB_LOOP    MACRO
  238.  
  239. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  240.             .repeat
  241.                 inc     di                  ; skip the character
  242.                 stosb                       ; save the attribute
  243.             .loop
  244. ELSE
  245.         call    CGA_REP_INCDI_STOSB_LOOP
  246. ENDIF
  247.  
  248. ENDM
  249.  
  250.  
  251. ;/***************************************************************************
  252. ;*
  253. ;* MACRO NAME    = REP_STOSB_INCDI_LOOP
  254. ;*
  255. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  256. ;*                 update routines that VGA and EGA use.  At compile time,       
  257. ;*                 the macro is replaced by either the simple data movement      
  258. ;*                 instructions or a call to a routine that handles the          
  259. ;*                 movement for the CGA.                                         
  260. ;*
  261. ;* INPUT         = (es:di) - destination pointer         
  262. ;*                 (cx) - number of iterations           
  263. ;* OUTPUT        = (es:di) - end of destination          
  264. ;*                 (cx) - zero                  
  265. ;* RETURN-NORMAL = NONE
  266. ;* RETURN-ERROR  = NONE
  267. ;*
  268. ;**************************************************************************/
  269.  
  270. REP_STOSB_INCDI_LOOP    MACRO
  271.  
  272.  
  273. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  274.             .repeat
  275.                 stosb
  276.                 inc     di                  ; skip the attribute
  277.             .loop
  278. ELSE
  279.         call    CGA_REP_STOSB_INCDI_LOOP
  280. ENDIF
  281.  
  282. ENDM
  283.  
  284.  
  285. ;/***************************************************************************
  286. ;*
  287. ;* MACRO NAME    = REP_LODSB_STOSW_LOOP
  288. ;*
  289. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  290. ;*                 update routines that VGA and EGA use.  At compile time,       
  291. ;*                 the macro is replaced by either the simple data movement      
  292. ;*                 instructions or a call to a routine that handles the          
  293. ;*                 movement for the CGA.                                         
  294. ;*
  295. ;* INPUT         = (ds:si) - source pointer              
  296. ;*                 (es:di) - destination pointer         
  297. ;*                 (cx) - number of iterations           
  298. ;* OUTPUT        = (ds:si) - end of source               
  299. ;*                 (es:di) - end of destination          
  300. ;*                 (cx) - zero                  
  301. ;* RETURN-NORMAL = NONE
  302. ;* RETURN-ERROR  = NONE
  303. ;*
  304. ;**************************************************************************/
  305.  
  306. REP_LODSB_STOSW_LOOP    MACRO
  307.  
  308. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  309.             .repeat
  310.                 lodsb                       ; (al) = char , (ah) = attribute
  311.                 stosw                       ; write the cell
  312.             .loop
  313. ELSE
  314.         call    CGA_REP_LODSB_STOSW_LOOP
  315. ENDIF
  316.  
  317. ENDM
  318.  
  319.  
  320. ;/***************************************************************************
  321. ;*
  322. ;* MACRO NAME    = REP_MOVSB_INCDI_LOOP
  323. ;*
  324. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  325. ;*                 update routines that VGA and EGA use.  At compile time,       
  326. ;*                 the macro is replaced by either the simple data movement      
  327. ;*                 instructions or a call to a routine that handles the          
  328. ;*                 movement for the CGA.                                         
  329. ;*
  330. ;* INPUT         = (ds:si) - source pointer              
  331. ;*                 (es:di) - destination pointer         
  332. ;*                 (cx) - number of iterations           
  333. ;* OUTPUT        = (ds:si) - end of source               
  334. ;*                 (es:di) - end of destination          
  335. ;*                 (cx) - zero                  
  336. ;* RETURN-NORMAL = NONE
  337. ;* RETURN-ERROR  = NONE
  338. ;*
  339. ;**************************************************************************/
  340.  
  341. REP_MOVSB_INCDI_LOOP    MACRO
  342.  
  343.  
  344. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  345.             .repeat                         
  346.                 movsb                       
  347.                 inc     di
  348.             .loop
  349. ELSE
  350.         call    CGA_REP_MOVSB_INCDI_LOOP
  351. ENDIF
  352.  
  353. ENDM
  354.  
  355.  
  356. ;/***************************************************************************
  357. ;*
  358. ;* MACRO NAME    = REP_MOVSB_ADDSI2_LOOP
  359. ;*
  360. ;* DESCRIPTION   = This macro is used so that CGA can use the same buffer        
  361. ;*                 update routines that VGA and EGA use.  At compile time,       
  362. ;*                 the macro is replaced by either the simple data movement      
  363. ;*                 instructions or a call to a routine that handles the          
  364. ;*                 movement for the CGA.                                         
  365. ;*
  366. ;* INPUT         = (ds:si) - source pointer              
  367. ;*                 (es:di) - destination pointer         
  368. ;*                 (cx) - number of iterations           
  369. ;* OUTPUT        = (ds:si) - end of source               
  370. ;*                 (es:di) - end of destination          
  371. ;*                 (cx) - zero                  
  372. ;* RETURN-NORMAL = NONE
  373. ;* RETURN-ERROR  = NONE
  374. ;*
  375. ;**************************************************************************/
  376.  
  377. REP_MOVSW_ADDSI2_LOOP   MACRO
  378.  
  379. IF NOT VDHCGA OR CGA_ALWAYS_FAST                                        ;MS??
  380.             .repeat                 
  381.                 movsw               
  382.                 add     si,2        ; Transfer cells to destination
  383.             .loop                   ; skip final word of attribute
  384. ELSE
  385.         call    CGA_REP_MOVSW_ADDSI2_LOOP
  386. ENDIF
  387.  
  388. ENDM
  389.