home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / SRC_DBCS / VDHV / XGAMAC.INC < prev    next >
Text File  |  1995-04-14  |  9KB  |  330 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. ;***    invoke - call a procedure
  47. ;
  48. ;       WARNING: Use is discouraged because it increases link time and
  49. ;                encourages people to not declare external procedures
  50. ;                explicitly.
  51. ;
  52. ;       Generate a call to procedure "name." If the procedure "name"
  53. ;       is not defined in the current file then an extrn name:near is
  54. ;       also generated. This also causes larger .obj file and slower
  55. ;       link time because the extrn causes a flush of the LEDATA
  56. ;       record (data structure used by the assembler) for the current
  57. ;       segment, generates an EXTRN record, then re-opens the LEDATA
  58. ;       record. The fast way is to lump all EXTRN's in one place.
  59. ;
  60. ;       ENTRY:  name = name of procedure to call
  61. ;
  62. ;       EXIT:   call and extrn (if necessary) generated.
  63.  
  64. invoke  MACRO   name
  65.  
  66. IFNDEF name
  67.         extrn   name:far
  68. ENDIF
  69.         CALL    name
  70. ENDM
  71.  
  72.  
  73. ;***    REP_MOVSW
  74. ;
  75. ;       This macro is used so that CGA can use the same buffer update
  76. ;       routines that VGA and EGA use.  At compile time, the macro is
  77. ;       replaced by either the simple data movement instructions or a
  78. ;       call to a routine that handles the movement for the CGA.
  79. ;
  80. ;       ENTRY:  (ds:si) - source pointer
  81. ;               (es:di) - destination pointer
  82. ;               (cx) - number of iterations
  83. ;
  84. ;       EXIT:   (ds:si) - end of source
  85. ;               (es:di) - end of destination
  86. ;               (cx) - zero
  87. ;
  88.  
  89. REP_MOVSW   MACRO
  90.  
  91. IFNDEF  VDHCGA
  92.         rep movsw
  93. ELSE
  94.         call    CGA_REP_MOVSW
  95. ENDIF
  96.  
  97. ENDM
  98.  
  99. ;***    REP_STOSW
  100. ;
  101. ;       This macro is used so that CGA can use the same buffer update
  102. ;       routines that VGA and EGA use.  At compile time, the macro is
  103. ;       replaced by either the simple data movement instructions or a
  104. ;       call to a routine that handles the movement for the CGA.
  105. ;
  106. ;       ENTRY:  (es:di) - destination pointer
  107. ;               (cx) - number of iterations
  108. ;
  109. ;       EXIT:   (es:di) - end of destination
  110. ;               (cx) - zero
  111. ;
  112.  
  113. REP_STOSW   MACRO
  114.  
  115. IFNDEF  VDHCGA
  116.             rep stosw
  117. ELSE
  118.         call    CGA_REP_STOSW
  119. ENDIF
  120.  
  121. ENDM
  122.  
  123. ;***    REP_MOVSB_INCSI_LOOP
  124. ;
  125. ;       This macro is used so that CGA can use the same buffer update
  126. ;       routines that VGA and EGA use.  At compile time, the macro is
  127. ;       replaced by either the simple data movement instructions or a
  128. ;       call to a routine that handles the movement for the CGA.
  129. ;
  130. ;       ENTRY:  (ds:si) - source pointer
  131. ;               (es:di) - destination pointer
  132. ;               (cx) - number of iterations
  133. ;
  134. ;       EXIT:   (ds:si) - end of source
  135. ;               (es:di) - end of destination
  136. ;               (cx) - zero
  137. ;
  138.  
  139. REP_MOVSB_INCSI_LOOP    MACRO
  140.  
  141. IFNDEF  VDHCGA
  142.             .repeat                     ; 
  143.                 movsb                   ; Transfer chars to destination
  144.                 inc     si              ; 
  145.             .loop                       ; 
  146.  
  147. ELSE
  148.         call    CGA_REP_MOVSB_INCSI_LOOP
  149. ENDIF
  150.  
  151. ENDM
  152.  
  153. ;***    REP_MOVSB_STOSW_LOOP
  154. ;
  155. ;       This macro is used so that CGA can use the same buffer update
  156. ;       routines that VGA and EGA use.  At compile time, the macro is
  157. ;       replaced by either the simple data movement instructions or a
  158. ;       call to a routine that handles the movement for the CGA.
  159. ;
  160. ;       ENTRY:  (ds:si) - source pointer
  161. ;               (es:di) - destination pointer
  162. ;               (cx) - number of iterations
  163. ;
  164. ;       EXIT:   (ds:si) - end of source
  165. ;               (es:di) - end of destination
  166. ;               (cx) - zero
  167. ;
  168.  
  169. REP_MOVSW_STOSW_LOOP    MACRO
  170.  
  171. IFNDEF  VDHCGA
  172.             .repeat
  173.                 movsw           ; Transfer cells to destination
  174.                 stosw
  175.             .loop
  176. ELSE
  177.         call    CGA_REP_MOVSW_STOSW_LOOP
  178. ENDIF
  179.  
  180. ENDM
  181.  
  182. ;***    REP_INCDI_STOSB_LOOP
  183. ;
  184. ;       This macro is used so that CGA can use the same buffer update
  185. ;       routines that VGA and EGA use.  At compile time, the macro is
  186. ;       replaced by either the simple data movement instructions or a
  187. ;       call to a routine that handles the movement for the CGA.
  188. ;
  189. ;       ENTRY:  (ds:si) - source pointer
  190. ;               (es:di) - destination pointer
  191. ;               (cx) - number of iterations
  192. ;
  193. ;       EXIT:   (ds:si) - end of source
  194. ;               (es:di) - end of destination
  195. ;               (cx) - zero
  196. ;
  197.  
  198. REP_INCDI_STOSB_LOOP    MACRO
  199.  
  200. IFNDEF  VDHCGA
  201.             .repeat
  202.                 inc     di                  ; skip the character
  203.                 stosb                       ; save the attribute
  204.             .loop
  205. ELSE
  206.         call    CGA_REP_INCDI_STOSB_LOOP
  207. ENDIF
  208.  
  209. ENDM
  210.  
  211.  
  212. ;***    REP_INCDI_STOSB_LOOP
  213. ;
  214. ;       This macro is used so that CGA can use the same buffer update
  215. ;       routines that VGA and EGA use.  At compile time, the macro is
  216. ;       replaced by either the simple data movement instructions or a
  217. ;       call to a routine that handles the movement for the CGA.
  218. ;
  219. ;       ENTRY:  (es:di) - destination pointer
  220. ;               (cx) - number of iterations
  221. ;
  222. ;       EXIT:   (es:di) - end of destination
  223. ;               (cx) - zero
  224. ;
  225.  
  226. REP_STOSB_INCDI_LOOP    MACRO
  227.  
  228.  
  229. IFNDEF  VDHCGA
  230.             .repeat
  231.                 stosb
  232.                 inc     di                  ; skip the attribute
  233.             .loop
  234. ELSE
  235.         call    CGA_REP_STOSB_INCDI_LOOP
  236. ENDIF
  237.  
  238. ENDM
  239.  
  240.  
  241. ;***    REP_LODSB_STOSW_LOOP
  242. ;
  243. ;       This macro is used so that CGA can use the same buffer update
  244. ;       routines that VGA and EGA use.  At compile time, the macro is
  245. ;       replaced by either the simple data movement instructions or a
  246. ;       call to a routine that handles the movement for the CGA.
  247. ;
  248. ;       ENTRY:  (ds:si) - source pointer
  249. ;               (es:di) - destination pointer
  250. ;               (cx) - number of iterations
  251. ;
  252. ;       EXIT:   (ds:si) - end of source
  253. ;               (es:di) - end of destination
  254. ;               (cx) - zero
  255. ;
  256.  
  257. REP_LODSB_STOSW_LOOP    MACRO
  258.  
  259. IFNDEF  VDHCGA
  260.             .repeat
  261.                 lodsb                       ; (al) = char , (ah) = attribute
  262.                 stosw                       ; write the cell
  263.             .loop
  264. ELSE
  265.         call    CGA_REP_LODSB_STOSW_LOOP
  266. ENDIF
  267.  
  268. ENDM
  269.  
  270.  
  271. ;***    REP_MOVSB_INCDI_LOOP
  272. ;
  273. ;       This macro is used so that CGA can use the same buffer update
  274. ;       routines that VGA and EGA use.  At compile time, the macro is
  275. ;       replaced by either the simple data movement instructions or a
  276. ;       call to a routine that handles the movement for the CGA.
  277. ;
  278. ;       ENTRY:  (ds:si) - source pointer
  279. ;               (es:di) - destination pointer
  280. ;               (cx) - number of iterations
  281. ;
  282. ;       EXIT:   (ds:si) - end of source
  283. ;               (es:di) - end of destination
  284. ;               (cx) - zero
  285. ;
  286.  
  287. REP_MOVSB_INCDI_LOOP    MACRO
  288.  
  289.  
  290. IFNDEF  VDHCGA
  291.             .repeat                         
  292.                 movsb                       
  293.                 inc     di
  294.             .loop
  295. ELSE
  296.         call    CGA_REP_MOVSB_INCDI_LOOP
  297. ENDIF
  298.  
  299. ENDM
  300.  
  301.  
  302. ;***    REP_MOVSB_ADDSI2_LOOP
  303. ;
  304. ;       This macro is used so that CGA can use the same buffer update
  305. ;       routines that VGA and EGA use.  At compile time, the macro is
  306. ;       replaced by either the simple data movement instructions or a
  307. ;       call to a routine that handles the movement for the CGA.
  308. ;
  309. ;       ENTRY:  (ds:si) - source pointer
  310. ;               (es:di) - destination pointer
  311. ;               (cx) - number of iterations
  312. ;
  313. ;       EXIT:   (ds:si) - end of source
  314. ;               (es:di) - end of destination
  315. ;               (cx) - zero
  316. ;
  317.  
  318. REP_MOVSW_ADDSI2_LOOP   MACRO
  319.  
  320. IFNDEF  VDHCGA
  321.             .repeat                 
  322.                 movsw               
  323.                 add     si,2        ; Transfer cells to destination
  324.             .loop                   ; skip final word of attribute
  325. ELSE
  326.         call    CGA_REP_MOVSW_ADDSI2_LOOP
  327. ENDIF
  328.  
  329. ENDM
  330.