home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l231 / 3.ddi / INCLUDE / BIOS.IN$ / BIOS
Encoding:
Text File  |  1992-09-28  |  9.2 KB  |  387 lines

  1. ; BIOS Interface Macros - Version 1.2 - for Microsoft Macro Assembler 6.1
  2. ; (C) Copyright Microsoft Corporation, 1987,1988,1989,1990
  3.  
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5. ;
  6. ;  Syntax:    @GetMode
  7. ;
  8. ;  Summary:   Gets the current video mode and page
  9. ;
  10. ;  Arguments: None
  11. ;
  12. ;  Returns:   AL     Mode
  13. ;          AH     Width in characters
  14. ;          BH     Page
  15. ;
  16. ;  Modifies:  AX, BH
  17. ;
  18. ;  Uses:      Interrupt 10h Function 0Fh
  19. ;
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. @GetMode MACRO
  22.     mov   ah, 0Fh
  23.     int   10h
  24. ENDM
  25.  
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27. ;
  28. ;  Syntax:    @SetMode mode
  29. ;
  30. ;  Summary:   Sets the current video mode and page
  31. ;
  32. ;  Argument:  <mode>     8-bit video mode.
  33. ;
  34. ;  Returns:   No return value
  35. ;
  36. ;  Modifies:  AX
  37. ;
  38. ;  Uses:      Interrupt 10h Function 00h
  39. ;
  40. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  41. @SetMode MACRO mode
  42.     mov   al, mode
  43.     xor   ah, ah
  44.     int   10h
  45. ENDM
  46.  
  47. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48. ;
  49. ;  Syntax:    @SetColor color
  50. ;
  51. ;  Summary:   Sets the background color
  52. ;
  53. ;  Argument:  <color>      8-bit background color (0-15); border
  54. ;              color in text modes
  55. ;
  56. ;  Returns:   No return value
  57. ;
  58. ;  Modifies:  AX, BX
  59. ;
  60. ;  Uses:      Interrupt 10h Function 0Bh
  61. ;
  62. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  63. @SetColor MACRO color
  64.     sub   bh, bh
  65.     mov   bl, color
  66.     mov   ah, 0Bh
  67.     int   10h
  68. ENDM
  69.  
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  71. ;
  72. ;  Syntax:    @SetPalette color
  73. ;
  74. ;  Summary:   Sets the color palette
  75. ;
  76. ;  Argument:  <color>      8-bit color palette; 0-1 for modes 5 and 6
  77. ;
  78. ;  Returns:   No return value
  79. ;
  80. ;  Modifies:  AX, BX
  81. ;
  82. ;  Uses:      Interrupt 10h Function 0Bh
  83. ;
  84. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  85. @SetPalette MACRO color
  86.     mov   bh, 1
  87.     mov   bl, color
  88.     mov   ah, 0Bh
  89.     int   10h
  90. ENDM
  91.  
  92. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  93. ;
  94. ;  Syntax:    @SetPage page
  95. ;
  96. ;  Summary:   Sets the video page
  97. ;
  98. ;  Argument:  <page>     8-bit page number; 0-3 for modes 2 and 3
  99. ;
  100. ;  Returns:   No return value
  101. ;
  102. ;  Modifies:  AX
  103. ;
  104. ;  Uses:      Interrupt 10h Function 05h
  105. ;
  106. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  107. @SetPage MACRO pagenum
  108.     mov   al, pagenum
  109.     mov   ah, 05h
  110.     int   10h
  111. ENDM
  112.  
  113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  114. ;
  115. ;  Syntax:    @GetCsr [page]
  116. ;
  117. ;  Summary:   Gets the cursor position and size
  118. ;
  119. ;  Argument:  <page>     8-bit page with cursor; if none given,
  120. ;             0 assumed
  121. ;
  122. ;  Returns:   DL     Column
  123. ;          DH     Row
  124. ;          CL     Starting scan line
  125. ;          CH     Ending scan line
  126. ;
  127. ;  Modifies:  AX, DX, CX, BH
  128. ;
  129. ;  Uses:      Interrupt 10h Function 03h
  130. ;
  131. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  132. @GetCsr MACRO pagenum
  133.     IFNB <pagenum>
  134.         mov   bh, pagenum
  135.     ELSE
  136.         xor   bh, bh
  137.     ENDIF
  138.     mov   ah, 03h
  139.     int   10h
  140. ENDM
  141.  
  142. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  143. ;
  144. ;  Syntax:    @SetCsrPos [column] [,[row] [,page]]
  145. ;
  146. ;  Summary:   Sets the cursor position
  147. ;
  148. ;  Arguments: <column>       8-bit column; if none given, DL used.
  149. ;
  150. ;          <row>       8-bit row; if none given, DH used.
  151. ;
  152. ;          <page>       8-bit page with cursor; if none given,
  153. ;               0 assumed.
  154. ;
  155. ;  Returns:   No return value
  156. ;
  157. ;  Modifies:  AX, DX, BH
  158. ;
  159. ;  Uses:      Interrupt 10h Function 02h
  160. ;
  161. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  162. @SetCsrPos MACRO column, row, pagenum
  163.     IFNB <column>
  164.         mov   dl, column
  165.     ENDIF
  166.     IFNB <row>
  167.         mov   dh, row
  168.     ENDIF
  169.     IFNB <pagenum>
  170.         mov   bh, pagenum
  171.     ELSE
  172.         xor   bh, bh
  173.     ENDIF
  174.     mov   ah, 02h
  175.     int   10h
  176. ENDM
  177.  
  178. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  179. ;
  180. ;  Syntax:    @SetCsrSize startline, endline
  181. ;
  182. ;  Summary:   Sets the cursor size and shape by specifying active scan
  183. ;          lines. For color adapters, the lines are 0-7. For the
  184. ;          monochrome adapter, the lines are 0-13.
  185. ;
  186. ;  Arguments: <startline>     8-bit starting scan line (default CGA = 6;
  187. ;                  MA = 12)
  188. ;
  189. ;          <endline>       8-bit ending scan line (default CGA = 7;
  190. ;                  MA = 13)
  191. ;
  192. ;  Returns:   No return value
  193. ;
  194. ;  Modifies:  AX, CX
  195. ;
  196. ;  Uses:      Interrupt 10h Function 01h
  197. ;
  198. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  199. @SetCsrSize MACRO first, last
  200.     mov   ch, first
  201.     mov   cl, last
  202.     mov   ah, 01h
  203.     int   10h
  204. ENDM
  205.  
  206. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  207. ;
  208. ;  Syntax:    @GetCharAtr [page]
  209. ;
  210. ;  Summary:   Gets the character and attribute at the cursor location
  211. ;
  212. ;  Argument:  <page>     8-bit page to check; if none given, 0 assumed
  213. ;
  214. ;  Returns:   AH     Attribute
  215. ;          AL     ASCII character
  216. ;
  217. ;  Modifies:  AX, BH
  218. ;
  219. ;  Uses:      Interrupt 10h Function 08h
  220. ;
  221. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  222. @GetCharAtr MACRO pagenum
  223.     IFNB <pagenum>
  224.         mov   bh, pagenum
  225.     ELSE
  226.         sub   bh, bh
  227.     ENDIF
  228.     mov   ah, 08h
  229.     int   10h
  230. ENDM
  231.  
  232. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  233. ;
  234. ;  Syntax:    @PutCharAtr [character] [,[attrib] [,[page] [,count]]]
  235. ;
  236. ;          @PutChar [character] [,[page] [,count]]
  237. ;
  238. ;  Summary:   Puts one or more characters and attributes at the current
  239. ;          cursor position. For @PutChar, the current attribute is
  240. ;          used in text modes and any specified attribute is ignored.
  241. ;
  242. ;  Arguments: <character>     8-bit ASCII character to put; if none
  243. ;                  given, AL used.
  244. ;
  245. ;          <attrib>          8-bit attribute to put; if none given,
  246. ;                  BL used.
  247. ;
  248. ;          <page>          8-bit page to put on; if none given, 0
  249. ;                  assumed.
  250. ;
  251. ;          <count>          Number to put; if none given, 1 assumed.
  252. ;
  253. ;  Returns:   No return value
  254. ;
  255. ;  Modifies:  AX, BX, CX
  256. ;
  257. ;  Uses:      Interrupt 10h Function 09h
  258. ;
  259. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  260. @PutCharAtr MACRO chr, atrib, pagenum, loops
  261.     IFNB <chr>
  262.         mov   al, chr
  263.     ENDIF
  264.     IFNB    <atrib>
  265.         mov   bl, atrib
  266.     ENDIF
  267.     IFNB <pagenum>
  268.         mov   bh, pagenum
  269.     ELSE
  270.         xor   bh, bh
  271.     ENDIF
  272.     IFNB <loops>
  273.         mov   cx, loops
  274.     ELSE
  275.         mov   cx, 1
  276.     ENDIF
  277.     mov   ah, 09h
  278.     int   10h
  279. ENDM
  280.  
  281. ; 0Ah
  282. @PutChar MACRO chr, atrib, pagenum, loops
  283.     IFNB <chr>
  284.         mov   al, chr
  285.     ENDIF
  286.     IFNB    <atrib>
  287.         mov   bl, atrib
  288.     ENDIF
  289.     IFNB <pagenum>
  290.         mov   bh, pagenum
  291.     ELSE
  292.         xor   bh, bh
  293.     ENDIF
  294.     IFNB <loops>
  295.         mov   cx, loops
  296.     ELSE
  297.         mov   cx, 1
  298.     ENDIF
  299.     mov   ah, 0Ah
  300.     int   10h
  301. ENDM
  302.  
  303. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  304. ;
  305. ;  Syntax:    @Scroll dist [,[attr][,[upcol [,[uprow [,[dncol][,dnrow]]]]]]]
  306. ;
  307. ;  Summary:   Scrolls a specified window up or down
  308. ;
  309. ;  Arguments: <dist>      8-bit number of lines to scroll; positive
  310. ;              scrolls down; negative scrolls up; 0 clears.
  311. ;
  312. ;          <attr>      8-bit attribute for blank lines; if none
  313. ;              given, 07h (white on black).
  314. ;
  315. ;          <upcol>      Upper left column; if none given, CL used.
  316. ;
  317. ;          <uprow>      Upper left row; if none given, CH used.
  318. ;
  319. ;          <dncol>      Lower right column; if none given, DL used.
  320. ;
  321. ;          <dnrow>      Lower right row; if none given, DH used.
  322. ;
  323. ;  Returns:   No return value
  324. ;
  325. ;  Modifies:  AX, CX, DX, BH
  326. ;
  327. ;  Uses:      Interrupt 10h Function 06h and 07h
  328. ;
  329. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  330. @Scroll MACRO distance:REQ, atrib:=<07h>, upcol, uprow, dncol, dnrow
  331.     IFNB <upcol>
  332.         mov   cl, upcol
  333.     ENDIF
  334.     IFNB <uprow>
  335.         mov   ch, uprow
  336.     ENDIF
  337.     IFNB <dncol>
  338.         mov   dl, dncol
  339.     ENDIF
  340.     IFNB <dnrow>
  341.         mov   dh, dnrow
  342.     ENDIF
  343.     mov   bh, atrib
  344.     IF distance LE 0
  345.         mov   ax, 0600h + (-(distance) AND 0FFh)
  346.     ELSE
  347.         mov   ax, 0700h + (distance AND 0FFh)
  348.     ENDIF
  349.     int   10h
  350. ENDM
  351.  
  352. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  353. ;
  354. ;  Syntax:    @Cls [page]
  355. ;
  356. ;  Summary:   Clears the screen
  357. ;
  358. ;  Argument:  <page>     Video page (8-bit); if none given, 0 assumed
  359. ;
  360. ;  Returns:   No return value
  361. ;
  362. ;  Modifies:  AX, BX, CX, DX
  363. ;
  364. ;  Uses:      Interrupt 10h Function 08h, 06h, and 02h
  365. ;
  366. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  367. @Cls MACRO pagenum
  368.     IFNB <pagenum>
  369.         IFDIFI <pagenum>, <bh>
  370.             mov   bh, pagenum
  371.         ENDIF
  372.     ELSE
  373.         sub   bh, bh
  374.     ENDIF
  375.     mov   ah, 08h
  376.     int   10h
  377.     mov   bh, ah
  378.     sub   cx, cx
  379.     mov   dx, 324Fh
  380.     mov   ax, 0600h
  381.     int   10h
  382.     mov   bh, bl
  383.     sub   dx, dx
  384.     mov   ah, 02h
  385.     int   10h
  386. ENDM
  387.