home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / PMODE24.ZIP / LIBS.ZIP / LIBS.DOC < prev    next >
Text File  |  1994-02-05  |  9KB  |  307 lines

  1.  
  2.   This doc briefly describes four small libraries for PMODE. These libraries
  3. are as follows:
  4.  
  5. KB - A low level keyboard interface.
  6. FILE - A modest file library.
  7. ARGC - Handles command line arguments and switches
  8. VGA50 - Some routines for VGA 80x50 and 90x50 text modes.
  9.  
  10.   I wrote them all for myself, just like PMODE, but I think they may be useful
  11. to you. All the library functions expect the following (I hope you read the
  12. PMODE dox first), CS=_selcode, DS=ES=_seldata, GS=_selzero, and the direction
  13. flag clear. The descriptions provided here are not too full. Check out the
  14. example files to see just how they work.
  15.  
  16. ------------------------------------------------------------------------------
  17. KB:
  18. ---
  19.  
  20.   This is a low level keyboard interface. This means that it uses the keyboard
  21. hardware directly, and does not go through the INT 16h keyboard functions. In
  22. fact, it takes the keyboard IRQ 1 for itself, disabling BIOS keyboard
  23. processing. KB can keep track of which keys are depressed, and when they are
  24. released. KB installs a protected mode keyboard IRQ handler and a real mode
  25. callback to for it.
  26.  
  27. Functions:
  28. ----------
  29.  
  30. _initkb - Initialize keyboard handler
  31.   Out:
  32.     BX,EDX,EDI - ?
  33.   Notes:
  34.     This initializes the keyboard handles. You must call this before you can
  35.       use the keyboard handler.
  36.  
  37. _resetkb - Reset keyboard handler
  38.   Out:
  39.     BX,EDX - ?
  40.   Notes:
  41.     Restores the keyboard to BIOS control. You must call this before exiting
  42.       to DOS.
  43.  
  44. _getch - Get the last character pressed
  45.   Out:
  46.     AL - case adjusted character
  47.     AH - shift state bits: 0=SHIFT, 1=ALT, 2=CTRL
  48.   Notes:
  49.     Gets the last character pressed or waits for one if none. The interrupt
  50.       flag must be enabled. Check out KB.INC for more information about
  51.       special character values.
  52.  
  53. _clearkb - Clear all kb stuff
  54.   Out:
  55.     EAX,ECX,EDI - ?
  56.   Notes:
  57.     Clears the last key hit and the low level sticky and non-sticky buffers.
  58.  
  59. Data:
  60. -----
  61.  
  62. _kbchar - Last key that was hit.
  63. _kbshift - Shift states for lask key, bits: 0=SHIFT, 1=ALT, 2=CTRL.
  64. _kbhit - Keyboard status: 0=no key hit, 1=key hit available.
  65. _kbtbl0 - Non-sticky keyboard table. This is an 80h byte table for the status
  66.   of any key on the keyboard. Whenever a key is pressed, the byte in this
  67.   table at the offset of the keys scan code will be set to a non-zero value.
  68.   When that key is released, the byte will be set back to zero.
  69. _kbtbl1 - Sticky keyboard table. The same as the non-sticky table, except that
  70.   when a key is released, its byte will not be set to zero in this table.
  71.  
  72. ------------------------------------------------------------------------------
  73. FILE:
  74. -----
  75.  
  76.   This is just a bunch of file routines. It simplifies reading and writing by
  77. allowing you to read or write the full length of a file, not just < 64k. Also,
  78. you can read or write to high memory. FILE will do any necessary buffering.
  79. You should assume these functions destroy v86r_ax, v86r_cx, v86r_dx, and
  80. v86r_ds. Also, v86r_bx may be set to a file handle if opening or creating
  81. files. You must allocate a buffer in low memory of length _filebuflen and
  82. store its address in _filebufloc if you are going to be reading or writing to
  83. high memory, or if you are going to be using the _filecopy function at all.
  84. The way _readfile and _writefile check to see if you are writing to high
  85. memory is they check the sum of EDX and ECX to see if that address falls above
  86. 1M. Which means if you try to read in a whole file by reading with
  87. ECX - 0ffffffffh, you must have the low memory buffer allocated for FILE.
  88.  
  89. Functions:
  90. ----------
  91.  
  92. _createfile - Create file
  93.   In:
  94.     EDX -> ASCIIZ filename
  95.   Out:
  96.     CF=1 - Error creating file
  97.     CF=0 - File created succesfully
  98.       V86R_BX - file handle
  99.  
  100. _openfile - Open file
  101.   In:
  102.     EDX -> ASCIIZ filename
  103.   Out:
  104.     CF=1 - Error opening file
  105.     CF=0 - File opened succesfully
  106.       V86R_BX - file handle
  107.  
  108. _closefile - Close a file
  109.   In:
  110.     V86R_BX - file handle
  111.     CF=1 - Error closing file
  112.     CF=0 - File closed succesfully
  113.  
  114. _deletefile - Delete a file
  115.   In:
  116.     EDX -> ASCIIZ filename
  117.   Out:
  118.     CF=1 - Error deleting file
  119.     CF=0 - File deleted succesfully
  120.  
  121. _lseekfile - Seek position in file
  122.   In:
  123.     V86R_BX - file handle
  124.     EAX - signed offset to move to
  125.     BL - from: 0-beginning of file, 1-current location, 2-end of file
  126.   Out:
  127.     CF=1  - Error seeking in file
  128.       EAX - ?
  129.     CF=0  - Seek fine
  130.       EAX - new offset from beginning of file
  131.  
  132. _filesize - Get size of file
  133.   In:
  134.     V86R_BX - file handle
  135.   Out:
  136.     CF=1  - Error checking file
  137.       EAX - ?
  138.     CF=0  - check fine
  139.       EAX - size of file
  140.  
  141. _readfile - Read from file
  142.   In:
  143.     V86R_BX - file handle
  144.     EDX -> buffer to read to
  145.     ECX - number of bytes to read
  146.   Out:
  147.     CF=1 - Error reading file
  148.       EAX - ?
  149.     CF=0 - Read went fine
  150.       EAX - number of bytes read
  151.   Notes:
  152.     Remember, if EDX+ECX > 1M, FILE will attempt to use its buffer that you
  153.       hopefully allocated and stored in _filebufloc.
  154.  
  155. _writefile - Write to file
  156.   In:
  157.     V86R_BX - file handle
  158.     EDX -> buffer to write from
  159.     ECX - number of bytes to write
  160.   Out:
  161.     CF=1 - Error writing file
  162.       EAX - ?
  163.     CF=0 - Write went fine
  164.       EAX - number of bytes written
  165.   Notes:
  166.     Remember, if EDX+ECX > 1M, FILE will attempt to use its buffer that you
  167.       hopefully allocated and stored in _filebufloc.
  168.  
  169. _filecopy - Copy some bytes from one file to another
  170.   In:
  171.     V86R_SI - source file handle
  172.     V86R_DI - destination file handle
  173.     ECX - number of bytes to copy
  174.   Out:
  175.     CF=1  - Error copying file
  176.       EAX - ?
  177.     CF=0  - copied fine
  178.       EAX - number of bytes copied
  179.   Notes:
  180.     You must have the FILE buffer allocated if you are going to be using this
  181.       function at all.
  182.  
  183. _findfile - Do an AH=4E file find
  184.   In:
  185.     AL - type of search: 4E-first, 4F-next
  186.     CX - search attributes
  187.     EDX -> 13 byte buffer for filename found
  188.     EDI -> search mask
  189.   Out:
  190.     CF=1 - file not found
  191.       EDX -> ?
  192.     CF=0 - file found
  193.       EDX -> filename
  194.  
  195. Data:
  196. -----
  197.  
  198. _filebufloc:dword - The pointer to the FILE buffer for use in high memory
  199.   reads and writes and in _filecopy.
  200. _filebuflen:word - The length of the FILE buffer. Can be changed at any time,
  201.   as long as there is the memory for it.
  202.  
  203. ------------------------------------------------------------------------------
  204. ARGC:
  205. -----
  206.  
  207.   This is some code to get command line switches and strings. A switch is any
  208. character preceded by a - or a /. A string is anything else. A string
  209. directly following a switch (no space) is not considered a string.
  210.  
  211. Functions:
  212. ----------
  213.  
  214. _cchekswitchnc - Chek if switch AL entered on command line
  215.   In:
  216.     AL - switch (if it is a letter, both upper and lower case are checked)
  217.   Out:
  218.     CF=1 - switch does not exist
  219.     CF=0 - switch exists on command line
  220.  
  221. _cchekswitch - Chek if switch AL entered on command line
  222.   In:
  223.     AL - switch (case sensitive
  224.   Out:
  225.     CF=1 - switch does not exist
  226.     CF=0 - switch exists on command line
  227.  
  228. _cchekstr - Get string number AL
  229.   In:
  230.     AL - string number (0 is first, 1 is second, etc...)
  231.     EDX -> buffer for string
  232.   Out:
  233.     CF=1 - string not found
  234.     CF=0 - string found
  235.       EDX - ASCIIZ string
  236.  
  237. _ccheksstr - Get string directly following switch AL
  238.   In:
  239.     AL - switch
  240.     EDX -> buffer for string
  241.   Out:
  242.     CF=1 - string not found
  243.     CF=0 - string found or switch does not have string
  244.       EDX -> ASCIIZ string (if present, otherwise unmodified)
  245.  
  246. ------------------------------------------------------------------------------
  247. VGA50:
  248. ------
  249.  
  250.   This is just a bunch of VGA text mode routines. Basically just sets up VGA
  251. 80x50 or 90x50 text mode, shuts off blinking and enables the BG high color
  252. bit. Also maps the 16 text mode color indexes to the first 16 DAC registers.
  253.  
  254. Functions:
  255. ----------
  256.  
  257. _initvga50 - Init VGA 50 line text mode and set color numbers
  258.  
  259. _putstr - Put ASCIIZ string to screen
  260.   In:
  261.     AH - attribute
  262.     BL - X
  263.     BH - Y
  264.     EDX -> ASCIIZ string
  265.  
  266. _pushtext - Save an area of the screen to video stack
  267.   In:
  268.     BL - X
  269.     BH - Y
  270.     CL - delta X
  271.     CH - delta Y
  272.   Notes:
  273.     Uses video memory beyond the displayed first page for the stack. You are
  274.       responsible for not overflowing it.
  275.  
  276. _poptext - Restore last pushed area of the screen from video stack
  277.  
  278. _textbox0 - Put box filled with character to screen
  279.   In:
  280.     AL - character to fill with
  281.     AH - attribute
  282.     BL - X
  283.     BH - Y
  284.     CL - delta X
  285.     CH - delta Y
  286.  
  287. _textbox1 - Put outlined box to screen
  288.   In:
  289.     AH - attribute
  290.     BL - X
  291.     BH - Y
  292.     CL - delta X
  293.     CH - delta Y
  294.     EDX -> outlining characters in the following order '─│┌┐└┘f'
  295.  
  296. _setchars - Set a group of character bitmaps
  297.   In:
  298.     AL - first ASCII character to set
  299.     BL - number of bytes (lines) per character
  300.     CL - number of characters to set minus 1
  301.     EDX -> bitmap data for characters
  302.   Notes:
  303.     Remember that in 80 column mode, character column 9 will be the same as
  304.      column 8 only for characters 0c0h-0dfh, in all other characters column 9
  305.      will be empty.
  306.  
  307.