home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / PBBACK10.ZIP / PBBACK.DOC < prev    next >
Text File  |  1992-11-08  |  24KB  |  527 lines

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