home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / bas / hanlin3 / pbback20 / pbback.doc < prev    next >
Text File  |  1994-11-04  |  23KB  |  522 lines

  1.                      The PBBack Library
  2.                    =--------------------=
  3.                          Version 2.0
  4.  
  5.     PBBACK  Copyright (c) 1990-1994  Thomas G. Hanlin III
  6.  
  7.  
  8.  
  9. This is PBBack, a library of more than 300 assembly language
  10. routines for use with all versions of QuickBasic, particularly
  11. QuickBasic 1.0-3.0. The PBBack library is copyrighted and may be
  12. distributed only under the following conditions:
  13.  
  14.    All PBBack files must be distributed together as a unit.
  15.    No files may be altered, added, or deleted from this unit.
  16.  
  17. YOU USE THIS LIBRARY AT YOUR OWN RISK. It has been tested by me
  18. on my own computer, but I will not assume any responsibility for
  19. any problems which PBBack may cause you.
  20.  
  21. It is expected that if you find PBBack useful, you will register
  22. your copy. You may not use PBBack routines in programs intended
  23. for sale unless you have registered. See the ORDER.FRM file for
  24. complete information.
  25.  
  26. If you are using QuickBasic 4.0-4.5 or another fairly recent
  27. Microsoft BASIC compiler, you will find that my PBClone library
  28. provides better support.  The PBBack library is designed for
  29. compatibility across the entire range of QuickBasic compilers,
  30. from QB 1.0 to the final QB 4.5 release.
  31.  
  32. Note that only static arrays may be used with PBBack routines
  33. at the moment.  You may use dynamic arrays in your program, but
  34. they must not be passed to PBBack routines.  If you are using
  35. QuickBasic 4.x, use its VARSEG and VARPTR functions to get the
  36. address of the array.  For earlier versions of QuickBasic, use
  37. the ArrayPtr routine provided with PBBack.  Note that you can't
  38. pass arrays to PBBack routines in the QB 4.x editor/compiler,
  39. since that always uses dynamic arrays.
  40.  
  41. PBBack is compatible with BASCOM/PDS as well as QuickBasic, but
  42. does not support far strings.  The QBX editor/compiler always
  43. uses dynamic arrays, like QB 4.x, so the same caveat applies.
  44.  
  45. PBBack is easier to use than PBClone since it does not need
  46. declarations, among other things.  By the same token, however,
  47. the compiler is not able to detect type mismatch errors or
  48. other common problems when calling PBBack routines.  If a
  49. routine doesn't seem to work, make sure you're calling it
  50. correctly.  In particular, most routines do expect integer
  51. values, and won't work if you pass floating point instead.
  52.  
  53.                       Routine Reference
  54.  
  55.  
  56.  
  57. Array Management:
  58.    AddMatI       add to each element of an integer array
  59.    ArrayPtr      return the segment and offset of an array
  60.    DRecDel       delete a record or element from an array
  61.    DRecIns       insert a record or element into an array
  62.    InitPtr       initialize an array of pointers
  63.    MulMatI       multiply each element of an integer array
  64.    SetMatI       set each element of an integer array
  65.    SortI         sort an array of integers
  66.  
  67. Disk:
  68.    CDROM         see if a CD-ROM is installed and get info
  69.    DelSub        delete a subdirectory
  70.    DrvType       see if a drive is removeable and/or networked
  71.    FindFirstF    find the first file to match specs
  72.    FindNextF     find any other files which match specs
  73.    FloppyType    see what types of floppy drives are installed
  74.    GetAttrF      get attribute of a file matched by FindFirstF
  75.    GetDateF      get date of a file matched by FindFirstF
  76.    GetExecPath   get drive, subdir, name of current program
  77.    GetLabel      get a disk volume label
  78.    GetNameF      get the name of a file matched by FindFirstF
  79.    GetSub        get the default subdirectory
  80.    GetSub1       get the default subdirectory on a given drive
  81.    GetTimeF      get the time of a file matched by FindFirstF
  82.    GetVerify     determine status of the DOS "verify" setting
  83.    LoadDir       load names of matching files into an array
  84.    MakeSub       create a subdirectory
  85.    RenSub        rename a subdirectory
  86.    Retries       set the retries used for file networking
  87.    SetDrv        set the default drive
  88.    SetSub        set the default subdirectory
  89.    SetVerify     set the state of the DOS "verify" switch
  90.  
  91.                       Routine Reference
  92.  
  93.  
  94.  
  95. Display:
  96.    BigPrint      display text in huge letters
  97.    BkSpace       backspace destructively with wrap
  98.    BkScroll      scroll an area of the screen down
  99.    Blink         switch blinking vs. intense background colors
  100.    CalcSize      calc array size needed to save a screen area
  101.    Clock         display a clock on the screen constantly
  102.    ClockSet      set various parameters for the clock
  103.    ClrCols       clear between specified columns on a row
  104.    ClrEOL        clear to the end of the row
  105.    ClrEOP        clear to the end of the screen
  106.    ClrSOL        clear to the start of the row
  107.    ClrSOP        clear to the start of the screen
  108.    CPrintScreen1 send a SCREEN 1 display to the printer
  109.    CPrintScreen2 send a SCREEN 2 display to the printer
  110.    CursorInfo    return cursor visibility, current & max sizes
  111.    DClear        clear a display being kept in an array
  112.    DClearSS      clear a display of unusual size in an array
  113.    DelChr        delete a character from the screen
  114.    DelLine       delete a row from the screen
  115.    DGClear       clear a CGA virtual screen
  116.    DGetScreen    get an area of the screen into an array
  117.    DGQPrint      write to a CGA virtual screen (SCREEN 1 type)
  118.    DGXQPrint     write to a CGA virtual screen (SCREEN 2 type)
  119.    DGXQPrint1    write to a CGA virtual screen (SCREEN 2 type)
  120.    Dissolve      clear the screen with special effects
  121.    DMPrint       display text directly through DOS services
  122.    DOSClrEol     clear from the cursor to end of line via DOS
  123.    DOSCls        clears the screen using DOS output
  124.    DOSColor      sets the screen color using DOS output
  125.    DOSLocate     sets the cursor position using DOS output
  126.    DPutScreen    put an array onto an area of the screen
  127.    DRecolor      recolor text of a specified color in an array
  128.    DRecolorArea  recolor a block of text in an array
  129.    DScrRest      restore a saved screen from an array
  130.    DScrSave      save a screen to an array or other memory
  131.    DXQPrint      write text into an array
  132.    EGARest7      restore a saved screen to EGA SCREEN 7 display
  133.    EGARest8      restore a saved screen to EGA SCREEN 8 display
  134.    EGARest9      restore a saved screen to EGA SCREEN 9 display
  135.    EGASave7      save an EGA SCREEN 7 display to an array
  136.    EGASave8      save an EGA SCREEN 8 display to an array
  137.    EGASave9      save an EGA SCREEN 9 display to an array
  138.  
  139.                       Routine Reference
  140.  
  141.  
  142.  
  143. Display:
  144.    EXQPrintC     display text at high speed on EGA/VGA graphics
  145.    FadeOut       clear the screen with special effects
  146.    GetEGA        see if an EGA is in use and get info about it
  147.    GetLine       get a row of text from virtual or saved screen
  148.    GetScreen     get an area of the screen into an array
  149.    GetVGAColor   get the specified VGA palette setting
  150.    GetVidMode    get display mode and other screen info
  151.    GQPrint       display text quickly in CGA SCREEN 2 mode
  152.    GrafRest      restore a saved CGA graphics screen
  153.    GrafSave      save a CGA graphics screen to an array
  154.    GXQPrint      display text quickly in CGA SCREEN 1
  155.    GXQPrint1     display text quickly in CGA SCREEN 1
  156.    HCls          clear screen in Hercules graphics mode
  157.    HiLite        highlight text on the screen
  158.    HLine         draw a line in Hercules graphics mode
  159.    HMode         switch between text and Herc graphics modes
  160.    HPrint        display text in Hercules graphics mode
  161.    HSetPixel     plot a point in Hercules graphics mode
  162.    InsChr        insert a space onto the screen
  163.    InsLine       insert a blank row onto the screen
  164.    LScroll       scroll an area of the screen left
  165.    MPrint        display text through DOS, obeying MWindow
  166.    MWindow       sets a display region for MPrint
  167.    PrintScreen   print the screen on a printer
  168.    PutScreen     put an array onto an area of the screen
  169.    QPrint        display text very quickly
  170.    ReColor       change text of a selected color to a new color
  171.    ReColorArea   change text in a selected area to a new color
  172.    RScroll       scroll an area of the screen right
  173.    Scroll        scroll an area of the screen up
  174.    ScrRest       restore a saved screen from an array
  175.    ScrSave       save a screen to an array
  176.    SCrunch       compress a screen in an array
  177.    SetCGAColor   set various aspects of CGA colors
  178.    SetVGAColor   set the specified VGA palette info
  179.    Split         clear the screen by scrolling different ways
  180.    TypePrint     display text as if it is being typed
  181.    UnCalcAttr    convert color/attribute to fore & background
  182.    UnScrunch     uncompress a "scrunched" screen
  183.    VGARest13     restore a saved screen in VGA SCREEN 13 mode
  184.    VGASave13     save a VGA SCREEN 13 display to an array
  185.    XMPrint       display text through DOS after translation
  186.    XQPrint       display text very quickly
  187.    XQPrintOver   quick text display, overlaying existing text
  188.  
  189.                       Routine Reference
  190.  
  191.  
  192.  
  193. Equipment:
  194.    CDROM         see if a CD-ROM is installed and get info
  195.    Equipment     find out about basic equipment (ports, memory)
  196.    ExtMem        see how much extended memory is available
  197.    FloppyType    see what types of floppy drives are installed
  198.    Get4DOSv      get installed version of 4DOS, if any
  199.    GetDOSv       get the DOS version
  200.    GetEGA        see if an EGA is in use and get info about it
  201.    GetExtM       see how much extended memory is available
  202.    GetLIMm       see how much expanded memory is available
  203.    GetLIMv       get the EMS driver version
  204.    GetMouseVer   get mouse driver version and hardware info
  205.    MMCheck       see if a mouse is available and # of buttons
  206.    WinCheck      see what version of Windows is running, if any
  207.  
  208. File:
  209.    BRead         read a byte from a file into an integer
  210.    BWrite        write a byte to a file from an integer
  211.    CopyFile      copy a file
  212.    DelFile       delete a file
  213.    DFRead        read from a file into an array
  214.    DFWrite       write to a file from an array
  215.    FClose1       close a file
  216.    FCreate       create a file and open it for access
  217.    FileCount     count the number of matching files
  218.    FlushToDisk   flush a file to disk (force it to be updated)
  219.    FOpen1        open a file
  220.    FSetEnd       move to the end of a file
  221.    FSetRec       move to a specific record location in a file
  222.    GetFAttr      get attribute of a file
  223.    GetFDate      get the date of a file
  224.    GetFTime      get the time of a file
  225.    GLoad         load a binary image from a file (like BLOAD)
  226.    IRead         read an integer from a file
  227.    IWrite        write an integer to a file
  228.    MatchFile     see if a filename matches a wildcard filespec
  229.    Rename        rename a file
  230.    SetFAttr      set the attribute of a file
  231.    SetFTD        set the time and date of a file
  232.    SFRead        read from a file into a string
  233.    SFWrite       write from a string into a file
  234.  
  235.                       Routine Reference
  236.  
  237.  
  238.  
  239. Input:
  240.    BIOSInkey     get a key from BIOS if any is waiting
  241.    CheckKey      get a key if any is waiting, or a mouse button
  242.    CheckKey3     get a key if any is waiting, or a mouse button
  243.    ClrKbd        clear the keyboard buffer
  244.    DOSInkey      get a key from DOS if any is waiting
  245.    EnhKbd        enable/disable enhanced keyboard handling
  246.    GetKbd        get state of keyboard toggles (CapsLock, etc)
  247.    GetKbd1       get state of shift keys (Control, Alt, etc)
  248.    GetKbd2       get state of shift keys (Left/Right Alt, etc)
  249.    GetKey        get a key or mouse click (wait; 2-button)
  250.    GetKey3       get a key or mouse click (wait; 3-button)
  251.    GetValidKey   get one of a list of valid keys
  252.    KeyPress      see if a key is waiting to be retrieved
  253.    PrtSc         disable the PrtSc/PrintScreen key
  254.    ScanKey       get a key, if any, w/o taking it from buffer
  255.    SetKbd        set state of keyboard toggles (CapsLock, etc)
  256.    SetMouseLoc   set the mouse cursor position (text mode)
  257.    SpeedKey      change the keyboard repeat rate
  258.    TypeIn        stuff keys into buffer as if they were typed
  259.  
  260. Memory:
  261.    BlockMove     copy data from one area of memory to another
  262.    DataSeg       determine the default data segment (dgroup)
  263.    EMSBuffer     get the bytes needed to save EMS array state
  264.    EMSClose      close an EMS array
  265.    EMSGet        get an element from an EMS array
  266.    EMSOpen       create an EMS array
  267.    EMSPut        put an element into an EMS array
  268.    EMSRest       restore the EMS array state
  269.    EMSSave       save the EMS array state
  270.    ExtMem        see how much extended memory is available
  271.    FarPoke       put byte into memory (like POKE w/o DEF SEG)
  272.    FarPokeI      put word into memory (like two POKEs w/o DEF SEG)
  273.    GetExtM       see how much extended memory is available
  274.    GetLIMHandles get the number of EMS handles being used
  275.    GetLIMm       see how much expanded memory is available
  276.    GetLIMv       get the EMS driver version
  277.    LClose        close a block of expanded memory
  278.    LGet          get a block of data from expanded memory
  279.    LOpen         open a block of expanded memory
  280.    LPut          put a block of data into expanded memory
  281.    MemSwap       swap contents of one area of memory w/ another
  282.  
  283. Miscellaneous:
  284.    HandleInfo    see if a handle refers to a file or a device
  285.    IntVector     get the address of an interrupt handler
  286.    Reboot        boot the computer (like Control-Alt-Del)
  287.    SetError      set exit code to return when program ends
  288.  
  289.                       Routine Reference
  290.  
  291.  
  292.  
  293. Mouse:
  294.    CheckKey      get a key if any is waiting, or a mouse button
  295.    CheckKey3     get a key if any is waiting, or a mouse button
  296.    GetKey        get key or mouse click (wait for it; 2-button)
  297.    GetKey3       get key or mouse click (wait for it; 3-button)
  298.    GetMouseLoc   get the mouse cursor position (text mode)
  299.    GetMouseVer   get mouse driver version and hardware info
  300.    MMButton      see which mouse buttons are pressed (2-button)
  301.    MMButton3     see which mouse buttons are pressed (3-button)
  302.    MMCheck       see if a mouse is installed & no. of buttons
  303.    MMClick       see which buttons have been pressed (2-button)
  304.    MMClick3      see which buttons have been pressed (3-button)
  305.    MMCursorOff   make the mouse cursor invisible
  306.    MMCursorOn    make the mouse cursor visible
  307.    MMGetLoc      get the mouse cursor position
  308.    MMSetLoc      set the mouse cursor position
  309.    MMSetRange    set the allowable range of the mouse cursor
  310.    MouseBuffer   get no. of bytes needed to save mouse state
  311.    MouseCursor   set the mouse graphics cursor type
  312.    MousePen      turn light pen emulation by the mouse on/off
  313.    MouseRest     restore a saved mouse state
  314.    MouseSave     save the current state of the mouse
  315.    SetMouseLoc   set the mouse cursor position (text mode)
  316.  
  317. Numeric:
  318.    Dec2Any       convert an integer to any base
  319.    ReadBitF      read value of given bit length from an array
  320.    RotateL       rotate the bits in an integer left
  321.    RotateR       rotate the bits in an integer right
  322.    SetBit        set a specified bit in an integer
  323.    ShiftL        shift the bits in an integer left
  324.    ShiftR        shift the bits in an integer right
  325.    WriteBitF     write value of given bit length into an array
  326.  
  327. Printer:
  328.    CPrintScreen1 send a SCREEN 1 display to the printer
  329.    CPrintScreen2 send a SCREEN 2 display to the printer
  330.    GetPrtAddr    get the address of a printer port
  331.    PrinterInit   initialize a printer
  332.    PrintFile     send a file to the printer
  333.    PrintScreen   print the screen on the printer
  334.    PrtSc         disable the PrtSc/PrintScreen key
  335.    PrtSwap       swap any two printer ports
  336.    SetPrtAddr    set the address of a printer port
  337.    Spooler       see if DOS print spooler (PRINT.COM) is loaded
  338.  
  339.                       Routine Reference
  340.  
  341.  
  342.  
  343. Serial:
  344.    Carrier       determine if a carrier is present
  345.    CRC           calculate a CRC for a string (obsolete)
  346.    CRC1          calculate a CRC for a string
  347.    DTR           set the state of the DTR line
  348.    GetCommAddr   get the address of a comm port
  349.    SetComm       set communications parameters
  350.    SetCommAddr   set the address of a comm port
  351.  
  352.  
  353.  
  354. String:
  355.    AndSt         AND the bytes in two strings together
  356.    Bickel        compare two strings using Bickel's algorithm
  357.    BSq           compress the blanks out of a text string
  358.    BUsq          restore a string that was compressed by BSq
  359.    BUsqLen       determine expanded length of a BSq'ed string
  360.    Cipher        perform simple string encryption/decryption
  361.    CipherP       like Cipher, only the results are printable
  362.    CRC           calculate a 16-bit CRC
  363.    Crunch        remove repeated values from a string
  364.    DGetRec       get a string from memory in a record format
  365.    DPutRec       put a string into memory in a record format
  366.    Locase        convert a string to lowercase (U.S. only)
  367.    Locase1       convert a string to lowercase (international)
  368.    LRotate       rotate the characters in a string left once
  369.    MatchFile     see if filename matches a wildcard filespec
  370.    Month0        return the name of the month, given month no.
  371.    MultiAND      perform an arithmetic AND operation on string
  372.    MultiOR       perform an arithmetic OR operation on a string
  373.    MultiXOR      perform an arithmetic XOR operation on string
  374.    OrSt          OR bytes in one string with those in another
  375.    Replace       replace one character with another
  376.    Reverse       reverse a string
  377.    RRotate       rotate the characters in a string right once
  378.    SFRead        read a string from a file
  379.    SFWrite       write a string to a file
  380.    ShlSt         shift the bits in a string left
  381.    ShrSt         shift the bits in a string right
  382.    Soundex       determine what a string "sounds" like
  383.    StrDel        delete a character from a string
  384.    StrIns        insert a space into a string
  385.    StripBlanks   strip the blanks from side(s) of a string
  386.    StripChar     strip a specified list of chars from a string
  387.    StripRange    strip a specified range of chars from a string
  388.    StripSpaces   strip the spaces from side(s) of a string
  389.    TInstr        search for a specific kind of char in a string
  390.    Upcase        convert a string to uppercase (U.S. only)
  391.    Upcase1       convert a string to uppercase (international)
  392.    Xlate         run each char of a string through translation
  393.    XorSt         XOR bytes in one string with those in another
  394.  
  395.                       Routine Reference
  396.  
  397.  
  398.  
  399. Time:
  400.    Clock         display a clock on the screen, constantly
  401.    ClockSet      set the parameters for the clock
  402.    Date2Int      squash a date into a single integer
  403.    DateN2S       convert a date from numbers into a string
  404.    DateS2N       convert a date from string form into numbers
  405.    Delay         delay for a given number of seconds
  406.    Delay18th     delay for a given number of 18ths of seconds
  407.    DelayV        delay for a very small amount of time
  408.    GetDateAT     get the date from the AT hardware clock
  409.    GetDateF      get date of a file matched with FindFirstF
  410.    GetFDate      get the date of a file
  411.    GetFTime      get the time of a file
  412.    GetTime       get time from DOS, including 100th seconds
  413.    GetTimeAT     get the time from the AT hardware clock
  414.    GetTimeF      get time of a file matched with FindFirstF
  415.    Int2Date      unsquash date from single integer to numbers
  416.    Int2Time      unsquash time from single integer to numbers
  417.    Month0        return name of month, given the month number
  418.    SetDateAT     set the date of the AT hardware clock
  419.    SetTimeAT     set the time of the AT hardware clock
  420.    Time2Int      squash a time into a single integer
  421.    TimeN2S       convert a time from numbers into a string
  422.    TimeS2N       convert a time from a string into numbers
  423.    WeekDay0       get the day of the week
  424.  
  425.                       Enhanced Key Codes
  426.  
  427.  
  428.  
  429. This is a list of the new key codes available when you use
  430. EnhKbd to enable enhanced keyboard support.  Note that the
  431. codes are direct from the BIOS, and may not always match what
  432. INKEY$ returns.  QuickBasic 4.5 provides only minimal support
  433. for the enhanced keys; QBX does much better; earlier compilers
  434. don't know from enhanced keys.  As long as you use PBBack for
  435. input, of course, you don't have to worry about it.
  436.  
  437. The format used is ScanCode, ASCIIcode.
  438.  
  439.  
  440. Middle keypad key (num lock off):   0,76
  441. Middle key, with Control:           0,143
  442.  
  443.              plain     shift     control     alt
  444.              -----     -----     -------    -----
  445.    F11       0,133     0,135      0,137     0,139
  446.    F12       0,134     0,136      0,138     0,140
  447.  
  448. The middle cursor pad returns the same scan codes as the
  449. cursor/numeric pad when NumLock is off, but with an ASCII code
  450. of 224 instead of 0.  If you want the middle cursor pad and
  451. cursor/numeric pad to return the same values, you should have
  452. your code do this:
  453.  
  454.    ' ...get key code...
  455.    IF ASCIIcode = 224 AND ScanCode <> 0 THEN ASCIIcode = 0
  456.  
  457. Why test both ASCII and scan codes?  Because it is possible for
  458. the user to enter a plain 224 by holding ALT and using the
  459. numeric keypad, which could cause confusion.
  460.  
  461. The arrows in the middle cursor pad will return special codes
  462. if pressed in combination with an ALT key:
  463.  
  464.    up    arrow     0,152
  465.    down  arrow     0,160
  466.    left  arrow     0,155
  467.    right arrow     0,157
  468.  
  469. Finally, the arrow keys on either cursor pad will return
  470. special codes if pressed in combination with a CONTROL key:
  471.  
  472.                    middle pad     cursor/num pad
  473.                    ----------     --------------
  474.    up    arrow       224,141          0,141
  475.    down  arrow       224,145          0,145
  476.    left  arrow       224,115          0,115
  477.    right arrow       224,116          0,116
  478.  
  479.                         DOS Error Codes
  480.  
  481.  
  482.  
  483. Note that the number of error codes available depends on the
  484. version of DOS in use.  Older versions return fewer error
  485. codes, meaning that the nature of the error may not be
  486. specified as precisely as you might like.  This is not a
  487. complete list of all possible codes, but it covers the most
  488. common ones.
  489.  
  490.  
  491.   -1    Unable to read or write all of the data requested
  492.    0    No error
  493.    1    Invalid function number
  494.    2    File not found
  495.    3    Path not found
  496.    4    No handle available (too many files open)
  497.    5    Access denied (file already in use or "read only")
  498.    6    Invalid handle
  499.   15    Invalid disk drive
  500.   16    Attempt to remove current directory
  501.   18    No more matching files
  502.   19    Disk is write-protected
  503.   20    Unknown unit
  504.   21    Drive not ready
  505.   22    Invalid command
  506.   23    Data CRC error
  507.   25    Seek error
  508.   26    Disk is not in DOS format
  509.   27    Sector not found
  510.   28    Printer is out of paper
  511.   29    Write fault
  512.   30    Read fault
  513.   31    General failure
  514.   32    Sharing violation
  515.   33    Lock violation
  516.   34    Invalid disk change
  517.   35    No FCB available
  518.   36    No room in file sharing buffer
  519.   80    File already exists
  520.   82    Unable to create subdirectory
  521.  
  522.