home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / biosmac.doc < prev    next >
Text File  |  1988-08-28  |  16KB  |  477 lines

  1.  
  2. FILENAME: BIOSMAC.DOC
  3.  
  4. DESCRIPTION: This file documents the BIOS interface macros implemented in
  5. the files IBIOS.MAC and MBIOS.MAC. Note that the only difference between the
  6. two files is that IBIOS.MAC uses TASM's Ideal mode while MBIOS.MAC uses
  7. TASM's MASM mode.
  8.  
  9.  
  10. CallBIOS
  11. --------
  12. Function: Calls the specified BIOS interrupt/service.
  13. Input
  14.     Interrupt - Interrupt number
  15.     Service   - Service number
  16. Output
  17.     none
  18. Registers modified: ah, flags
  19. Syntax: CallBIOS    Interrupt, Service
  20.  
  21.  
  22. LoadBH
  23. ------
  24. Function: Loads BH with the a value. Presumably the video page. If no value
  25.           is provided BH is initialized to 0.
  26. Input
  27.     Value - value to put in BH
  28. Output
  29.     none
  30. Registers modified: bh
  31. Syntax: LoadBH  Value
  32.  
  33.  
  34. SetVideoMode
  35. ------------
  36. Function: Sets the current video mode.
  37. BIOS Interrupt: 10h     Service: 00h
  38. Input
  39.     Mode - new video mode as defined below
  40.     ----    ----------------------------------------------------
  41.     0h      40x25 Black and White
  42.     1h      40X25 Color
  43.     2h      80x25 Black and White
  44.     3h      80x25 Color
  45.     4h      320x200 4-Color graphics
  46.     5h      320x200 4-Color graphics(color burst off)
  47.     6h      640x200 2-Color graphics
  48.     7h      Monochrome adapter Text display
  49.     8h      160x200 16-Color graphics(PCjr)
  50.     9h      320x200 16-Color graphics(PCjr)
  51.     0Ah     640x200 4-Color graphics(PCjr)
  52.     0Dh     320x200 16-Color graphics(EGA)
  53.     0Eh     640x200 16-Color graphics(EGA)
  54.     0Fh     640x350 Monochrome graphics(EGA)
  55.     10h     640x350 4-Color or 16-Color graphics(EGA)(depends on
  56.             available RAM)
  57.     11h     640x480 2-Color graphics(VGA)
  58.     12h     640x480 16-Color graphics(VGA)
  59.     13h     320x200 256-Color graphics(VGA)
  60.     ----------------------------------------------------
  61. Output
  62.     none
  63. Registers modified: ah, Flags
  64. Syntax: SetVideoMode  Mode
  65.  
  66. SetCursorShape
  67. --------------
  68. Function: Sets the cursors shape. The parameters passed to it indicate the
  69.           starting and ending scan lines to use when displaying the cursor.
  70.           On a monochrome system the default setting is lines 6-7. Setting
  71.           the scan lines to 0-7 would result in a block cursor. On a color
  72.           system the default setting is 14-15. Setting the starting scan line
  73.           to 15 and the ending scan line to 0 would result in a cursor with a
  74.           line on the top and bottom.
  75. BIOS Interrupt: 10h     Service: 01h
  76. Input
  77.     Starting - starting scan line
  78.     Ending   - ending scan line
  79. Output
  80.     none
  81. Registers modified: ah, cx, Flags
  82. Syntax: SetCursorShape  Starting, Ending
  83.  
  84. GotoXY
  85. ------
  86. Function: Positions the cursor.The new cursor position is provided in the
  87.           parameters Row and Column. The caller can optionally provide the
  88.           video page to use. If Page isn't defined, page 0 is assumed.
  89. BIOS Interrupt: 10h     Service: 02h
  90. Input
  91.     Row (y coordinate)
  92.     Column (x coordinate)
  93.     Page - Display page to check
  94. Output
  95.     none
  96. Register modified: ax, bh, dx, Flags
  97. Syntax: GotoXY  Row, Column, Page
  98.  
  99. WhereXY
  100. -------
  101. Function: Determines the current cursor position and the cursors shape. The
  102.           Page parameter indicates the video page to check and is optional.
  103.           If the Page parameter is not specified, page 0 is assumed.
  104. BIOS Interrupt: 10h     Service: 03h
  105. Input
  106.     Page - Display page to check
  107. Output
  108.     ch - Starting line for cursor
  109.     cl - Ending line for cursor
  110.     dh - row (y coordinate)
  111.     dl - column (x coordinate)
  112. Register modified: ax, cx, dx, Flags
  113. Syntax: WhereXY Page
  114.  
  115. GetCursorShape
  116. --------------
  117. Function: Returns the shape of the cursor. Note that because the BIOS call to
  118.           get the cursors position returns this information we simply call
  119.           the WhereXY macro.
  120. BIOS Interrupt: 10h     Service: 03h
  121. Input
  122.     none
  123. Output
  124.     ch - starting scan line of cursor
  125.     cl - ending scan line of cursor
  126. Registers modified: ax, cx, dx, Flags
  127. Syntax: GetCursorShape
  128.  
  129. GetLightPenPos
  130. --------------
  131. Function: Returns the position of the light pen.
  132. BIOS Interrupt: 10h     Service: 04h
  133. Input
  134.     none
  135. Output
  136.     ah = 0 - light pen not down/not triggered
  137.          1 - light pen down/triggered
  138.     ch - pixel vertical coordinate
  139.     bx - pixel horizontal coordinate
  140.     dh - character vertical coordinate
  141.     dl - character horizontal coordinate
  142. Registers modified: ah, bx, ch, dx, Flags
  143. Syntax: GetLightPenPos
  144.  
  145. SetDisplayPage
  146. --------------
  147. Function: Sets the current display page. Note that the Page parameter is
  148.           optional. If it is not provided video page 0 is used.
  149. BIOS Interrupt: 10h     Service: 05h
  150. Input
  151.     Page - Desired display  page as defined below
  152.     PAGE    MODE            HARDWARE
  153.     ----    ----            --------
  154.     0-7     00h and 01h     CGA
  155.     0-3     02h and 03h     CGA
  156.     0-7     02h and 03h     EGA
  157.     0-7     0Dh             EGA
  158.     0-3     0Eh             EGA
  159.     0-1     0Fh             EGA
  160.     0-1     10h             EGA
  161. Output
  162.     none
  163. Registers modified: ah, Flags
  164. Syntax: SetDisplayPage  Page
  165.  
  166. ScrollUp
  167. --------
  168. Function: Scrolls the indicated part of the screen up LineCount times. Any
  169.           blank lines created are initialized to the color indicated in the
  170.           Attrib parameter. The coordinate parameters are optional. If they
  171.           are not provided the routine scrolls the entire screen. The routine
  172.           assumes there are 80 columns on the screen. However, it checks how
  173.           many lines are currently available(25/43/50) if the coordinate
  174.           parameters aren't provided.
  175. BIOS Interrupt: 10h     Service: 06h
  176. Input
  177.     LineCount - # of lines to scroll
  178.     Attrib - Attribute to use for new lines
  179.     x1 - Upper left column
  180.     y1 - Upper row
  181.     x2 - Lower right column
  182.     y2 - Bottom row
  183. Output
  184.     none
  185. Registers modified: ax, bh, cx, dx, Flags
  186. Syntax: ScrollUp    LineCount, Attrib, x1, y1, x2, y2
  187.  
  188.  
  189. ScrollDown
  190. ----------
  191. Function: Scrolls the indicated part of the screen down LineCount times. Any
  192.           blank lines created are initialized to the color indicated in the
  193.           Attrib parameter. The coordinate parameters are optional. If they
  194.           are not provided the routine scrolls the entire screen. The routine
  195.           assumes there are 80 columns on the screen. However, it checks how
  196.           many lines are currently available(25/43/50) if the coordinate
  197.           parameters aren't provided.
  198. BIOS Interrupt: 10h     Service: 07h
  199. Input
  200.     LineCount - # of lines to scroll
  201.     Attrib - Attribute to use for new lines
  202.     x1 - Upper left column
  203.     y1 - Upper row
  204.     x2 - Lower right column
  205.     y2 - Bottom row
  206. Output
  207.     none
  208. Registers modified: ax, bh, cx, dx, Flags
  209. Syntax: ScrollDown    LineCount, Attrib, x1, y1, x2, y2
  210.  
  211. GetCharAttr
  212. -----------
  213. Function: Reads the character and attribute at the current cursor position of
  214.           the indicated video page. See SetDisplayPage for a definition of
  215.           the different video pages available. Note that the Page parameter
  216.           is optional. If it is not provided video page 0 is used.
  217. BIOS Interrupt: 10h     Service: 08h
  218. Input
  219.     Page - the video page to check
  220. Output
  221.     ah - attribute
  222.     al - character
  223. Registers modified: ax
  224. Syntax: GetCharAttr Page
  225.  
  226. PutCharAttr
  227. -----------
  228. Function: Displays a character and attribute 'Count' times starting at the
  229.           current cursor position of the indicated page. Note that the Page
  230.           parameter is optional. If it is not provided video page 0 is used.
  231. BIOS Interrupt: 10h     Service: 09h
  232. Input
  233.     Character - character to display
  234.     Attribute - attribute to display the character(s) in
  235.     Count     - number of times to display the character
  236.     Page      - Video page to display the characters on
  237. Output
  238.     none
  239. Registers modified: ax, bx, cx, Flags
  240. Syntax: PutCharAttr Character, Attribute, Count, Page
  241.  
  242. PutChar
  243. -------
  244. Function: Displays a character Count times beginning at the current cursor
  245.           position on the indicated display page. Note that the Page and
  246.           Color parameters are optional. If you provide the Color parameter
  247.           you must also provide the Page parameter. If the Page parameter is
  248.           not provided video page 0 is used. If the Color is not provided,
  249.           the character attribute of the current cursor location of the
  250.           indicate video page is used.
  251. BIOS Interrupt: 10h     Service: 0Ah
  252. Input
  253.     Character - character to display
  254.     Count     - number of times to display the character
  255.     Page      - video page to display character(s) on
  256. Output
  257.     none
  258. Registers modified: ax, bx, cx, Flags
  259. Syntax: PutChar Character, Count, Page, Color
  260.  
  261. SetColorPalette
  262. ---------------
  263. Function: Sets the CGA color palette that is used while displaying graphics
  264.           in 320x200 graphics mode(4 & 5). For more information on video
  265.           modes see SetVideoMode above.
  266. BIOS Interrupt: 10h     Service: 0Bh
  267. Input
  268.     Entry - Color palette id being set
  269.     Color - New color for palette entry
  270. Output
  271.     none
  272. Registers modified: ah, bx, Flags
  273. Syntax: SetColorPalette Entry, Color
  274.  
  275. PutPixel
  276. --------
  277. Function: Displays a pixel on the screen. Note that the macro may only be
  278.           called while in graphics mode.
  279. BIOS Interrupt: 10h     Service: 0Ch
  280. Input
  281.     X - horizontal position
  282.     Y - vertical position
  283.     Color - color/display method for pixel
  284. Output
  285.     none
  286. Registers modified: ax, cx, dx, Flags
  287. Syntax: PutPixel    X, Y, Color
  288.  
  289. GetPixel
  290. --------
  291. Function: Reads information about the indicated pixel.
  292. BIOS Interrupt: 10h     Service: 0Dh
  293. Input
  294.     X - horizontal position
  295.     Y - vertical position
  296. Output
  297.     al - pixel information
  298. Registers modified: ax, cx, dx, Flags
  299. Syntax: GetPixel    X, Y
  300.  
  301. PutTTY
  302. ------
  303. Function: Displays text to the console using teletype mode. Note that the
  304.           Color parameter is optional. If the Color parameter isn't provided
  305.           the character will be displayed using the attribute of the current
  306.           cursor position.
  307. BIOS Interrupt: 10h     Service: 0Eh
  308. Input
  309.     Character - character to display
  310.     Color     - color to display text in.
  311.     Page      - video page to display character(s) on
  312. Output
  313.     none
  314. Registers modified: ax, bx, Flags
  315. Syntax: PutTTY  Character, Page, Color
  316.  
  317. GetVideoMode
  318. ------------
  319. Function: Determines the current video mode and display page.
  320. BIOS Interrupt: 10h     Service: 0Fh
  321. Input
  322.     None
  323. Output
  324.     ah - Number of columns on screen
  325.     al - display mode as defined below
  326.     ----    ----------------------------------------------------
  327.     0h      40x25 Black and White
  328.     1h      40X25 Color
  329.     2h      80x25 Black and White
  330.     3h      80x25 Color
  331.     4h      320x200 4-Color graphics
  332.     5h      320x200 4-Color graphics(color burst off)
  333.     6h      640x200 2-Color graphics
  334.     7h      Monochrome adapter Text display
  335.     8h      160x200 16-Color graphics(PCjr)
  336.     9h      320x200 16-Color graphics(PCjr)
  337.     0Ah     640x200 4-Color graphics(PCjr)
  338.     0Dh     320x200 16-Color graphics(EGA)
  339.     0Eh     640x200 16-Color graphics(EGA)
  340.     0Fh     640x350 Monochrome graphics(EGA)
  341.     10h     640x350 4-Color or 16-Color graphics(EGA)(depends on
  342.             available RAM)
  343.     11h     640x480 2-Color graphics(VGA)
  344.     12h     640x480 16-Color graphics(VGA)
  345.     13h     320x200 256-Color graphics(VGA)
  346.     ----------------------------------------------------
  347.     bh - Active display page
  348. Register modified: ax, bx, Flags
  349. Syntax: GetVideoMode
  350.  
  351. SetPaletteRegs
  352. --------------
  353. Function: Sets the EGA palette colors. Note that the macro may only be called
  354.           when running on an EGA.
  355. BIOS Interrupt: 10h     Service: 10h
  356. Input
  357.     SubService - Select service as defigned below
  358.     SERVICE     FUNCTION
  359.     -------     -----------------------------------------------------
  360.         0       If setting palette register
  361.         1       If setting border color register
  362.         2       If setting all palette registers and border register
  363.         3       If toggling blink/intensity bit(EGA only)
  364.     -----------------------------------------------------------------
  365.     IndexIntensity - palette register or blink/intensity bit as
  366.                      defigned below.
  367.     SERVICE         FUNCTION
  368.     -------         -------------------------------------------------
  369.     SubService = 0  Palette register to set
  370.     SubService = 3  IndexIntensity = 0 - Enable intensity
  371.                     IndexIntensity = 1 - Enable blinking
  372.     -----------------------------------------------------------------
  373.     Color - color to store in register
  374.     ListSeg:ListOfs - address of new palette list
  375. Output
  376.     none
  377. Registers modified: ax, bx, dx, es, Flags
  378. Syntax: SetPaletteRegs    SubService, IndexIntensity, Color, ListSeg, ListOfs
  379.  
  380. ScreenRows
  381. ----------
  382. Function: Returns the number of rows available on the screen.
  383. BIOS Interrupt: 10h     Service: 11h
  384. Input
  385.     none
  386. Output
  387.     dl - # of rows on the screen(25/43/50)
  388. Registers modified: ax, dl, Flags
  389. Syntax: ScreenRows
  390.  
  391. PutString
  392. ---------
  393. Function: Displays a string to the indicated video page at the indicated
  394.           position. Note that the Page and Attribute parameters are optional.
  395.           If Page is not supplied the macro will use page 0 by default. If
  396.           Mode = 0 or 1 Attribute must be supplied. If Mode = 2 or 3
  397.           Attribute should not be supplied. Note that if you provide the
  398.           Attribute parameter you must provide the Page parameter also. This
  399.           macro may only be used on IBM-AT, PS/2 and compatible machines.
  400. BIOS Interrupt: 10h     Service: 13h
  401. Input
  402.     Mode - mode to write string in as defined below
  403.     MODE        FUNCTION
  404.     ----        --------
  405.      0          Attribute in bl, string contains character codes only,
  406.                 cursor position isn't updated after write.
  407.      1          Attribute in bl, string contains character codes only,
  408.                 cursor position is updated after write.
  409.      2          String contains alternating character codes and
  410.                 attribute bytes, cursor position isn't updated after
  411.                 write.
  412.      3          String contains alternating character codes and
  413.                 attribute bytes, cursor position is updated after write.
  414.     --------------------------------------------------------------------
  415.     X - Vertical position to begin display of the string
  416.     Y - Horizontal position to begin display of the string.
  417.     StringSeg - Segment address of the string
  418.     StringOfs - Offset address of string in StringSeg
  419.     Length - Length of the string to be displayed
  420.     Page - Video page to display string to
  421.     Attribute - Optional parameter that indicates the attribute to
  422.                 display the string in. This parameter should only be
  423.                 provided if Mode = 0 or 1.
  424. Output
  425.     none
  426. Registers modified: ax, bx, cx, dx, bp, es, Flags
  427. Syntax: PutString   Mode, X, Y, StringSeg, StringOfs, Length, Page, Attribute
  428.  
  429. GetChar
  430. -------
  431. Function: Returns the next character in the BIOS keyboard buffer.
  432. BIOS Interrupt: 16h     Service: 00h
  433. Input
  434.     none
  435. Output
  436.     ah - keyboard scan code
  437.     al - ASCII character
  438. Registers modified: ax, Flags
  439. Syntax: GetChar
  440.  
  441. GetKbdStatus
  442. ------------
  443. Function: Returns the BIOS keyboard status.
  444. BIOS Interrupt: 16h     Service: 01h
  445. Input
  446.     none
  447. Output
  448.     If key wating to be input:
  449.         Zero flag - clear
  450.         ah - keyboard scan code
  451.         al - ASCII character
  452.     If no key waiting to be input:
  453.         Zero flag - set
  454. Registers modified: ax, Flags
  455. Syntax: GetKbdStatus
  456.  
  457. GetKbdFlags
  458. -----------
  459. Function: Returns the BIOS keyboard flags.
  460. BIOS Interrupt: 16h     Service: 02h
  461. Input
  462.     none
  463. Output
  464.     al - BIOS keyboard flags byte:
  465.     BIT     FUNCTION
  466.     ---     --------
  467.      7      Insert ON
  468.      6      Caps Lock ON
  469.      5      Num Lock ON
  470.      4      Scroll Lock ON
  471.      3      Alt key DOWN
  472.      2      Ctrl key DOWN
  473.      1      Left-Shift key DOWN
  474.      0      Right-Shift key DOWN
  475. Registers modified: al, Flags
  476. Syntax: GetKbdFlags
  477.