home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / bas / asilib11 / system.doc < prev    next >
Text File  |  1994-10-22  |  19KB  |  594 lines

  1.  ************************ ASILIB SYSTEM SUBROUTINES *************************
  2.  
  3.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  4.  
  5. ALLOCDOS:     Allocate DOS memory block.  This permits dynamic memory
  6.               allocation for your ASIC programs.
  7.  
  8. Parameters:   bytes&, block segment
  9.  
  10.               Bytes& is the number of bytes you want to allocate.  Bytes&
  11.               may be greater than 64k.
  12.  
  13.               Block Segment is the segment address of the allocated memory
  14.               block.  The starting offset of the memory block is always 0.
  15.               If the segment address returned by AllocDOS = 0, then
  16.               insufficient memory is available for the requested memory
  17.               block.
  18.  
  19. Restrictions: Requires ASIC's extended math option and DOS version 3.0 or
  20.               greater; if you are linking your ASIC object modules with
  21.               another library besides ASILIB, ASILIB must be specified
  22.               LAST in your list of libraries or on the command line.
  23.  
  24. Example:
  25.  
  26. REM  allocate 128k bytes of DOS memory
  27.  
  28.         bytes& = &hex20000&
  29.         call sub "allocdos", bytes&, memseg
  30.  
  31. REM  check memory segment for errors
  32.  
  33.         if memseg = 0 then
  34.            REM  uh oh, not enough memory
  35.         endif
  36.  
  37.  
  38.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  39.  
  40. ASICDS:       Get ASIC's default data segment.
  41.  
  42. Parameters:   defaultseg
  43.  
  44.               ASICDS returns the data segment in use as ASIC's default.
  45.               This segment is nessesary for several ASILIB subroutines
  46.               which require both segment and offset portions of data
  47.               addresses.
  48.  
  49. Example:
  50.  
  51. REM  I want to swap the first 150 elements of arrays a() and b()
  52.         dim a(1000)
  53.         dim b(2000)
  54.  
  55. REM  program fills in the arrays
  56.         .
  57.         .
  58.         .
  59. REM  get ASIC's default data segment
  60.         call sub "ASICDS", defaultseg
  61.         aptr=VARPTR(a(1))
  62.         bptr=VARPTR(b(1))
  63.  
  64. REM  remember that each integer is 2 bytes
  65.         bytes=300
  66.         call sub "swapb", defaultseg, aptr, defaultseg, bptr, bytes
  67.  
  68.  
  69.  
  70.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  71.  
  72. DAYNAME:      Returns the name of a specified day
  73.  
  74. Parameters:   DayNumber, day$
  75.  
  76.               DayNumber is a number from 1 through 7, inclusive,
  77.               representing the days Sunday through Saturday.
  78.               The name of the day is returned to the calling program in
  79.               day$.  Since ASIC uses 80 bytes for each string, an ASIC
  80.               string array would consume 80*7 = 560 bytes of data space.
  81.               Since ASILIB can store the day names more compactly, only
  82.               138 bytes are required for the entire DayName subroutine,
  83.               including the names of the days!
  84.  
  85. Restrictions: Assumes that DayNumber is an integer from 1 to 7.
  86.  
  87. Example:
  88.  
  89. REM  I want to print "Monday" on the screen
  90.  
  91.         call sub "dayname",(2,day$)
  92.         print day$
  93.  
  94.  
  95.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  96.  
  97. EXENAME:      Get the name of the program.
  98.  
  99. Parameters:   ProgramName$
  100.  
  101.               The full program name including drive and path is returned
  102.               in ProgramName$.  This is handy for finding data files
  103.               in the program's directory, among other things.
  104.  
  105. Restrictions: Requires DOS 3.0 or greater.
  106.  
  107. Example:
  108.  
  109. REM  I need to get the drive and directory where this program is stored
  110.  
  111.         call sub "exename", ProgramName$
  112.  
  113.  
  114.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  115.  
  116. EXESIZE:      determine size of any .EXE program
  117.  
  118. Parameters:   ProgramName$, ProgramSize&
  119.  
  120.               ProgramName$ is a valid name of a .EXE-format disk file,
  121.               such as the ProgramName$ returned by ASILIB's EXENAME
  122.               subroutine.
  123.  
  124.               ProgramSize& returned to your program is the number of bytes
  125.               in the file loaded by the DOS program loader.  Additional data
  126.               may be copied to the end of a DOS .EXE file with the DOS
  127.               COPY /B command.  This is handy for help screens or other such
  128.               data that you want to keep with the .EXE file, but that you
  129.               don't want to be loaded in memory with the program.  If you do
  130.               copy additional data to the .EXE file, EXESize will report only
  131.               the portion of the file loaded in RAM by the DOS program loader,
  132.               while ASILIB's FSize reports the entire file size.
  133.  
  134. Restrictions: Requires ASIC's extended math option.  If EXESize is called
  135.               with an invalid ProgramName$ or if other errors occur,
  136.               ProgramSize& is returned = -1.  More specific information
  137.               about the nature of the error can be determined with FExist.
  138.               Errors may include file not found, access denied or
  139.               not .EXE format.
  140.  
  141. Example:
  142.  
  143. REM  I've stored some data at the end of the .EXE file and now I
  144. REM  want to retrieve it.
  145.  
  146.         call sub "exename", ProgramName$
  147.         call sub "exesize", ProgramName$, ProgramSize&
  148.  
  149. REM  Now I can open the file & use FSEEK to position the file pointer.
  150.         .
  151.         .
  152.         .
  153.  
  154.  
  155.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  156.  
  157. FLOPPIES:     determine the number of floppy disk drives intalled
  158.  
  159. Parameters:   No input parameters; returns n=number of floppy drives
  160.  
  161. Example:
  162.  
  163. REM  determine how many floppy drives are installed
  164.         call sub "floppies", n
  165.  
  166.  
  167.  
  168. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  169.  
  170. FLOPPYTYPE:   determine the type of floppy disk drives intalled
  171.  
  172. Paramerters:  drive$, drivetype
  173.  
  174.               FLOPPYTYPE determines what kind of floppy disk drive is
  175.               installed as drive A: or drive B:.  Drivetype codes returned
  176.               are:
  177.  
  178.                0 = invalid drive number
  179.                1 = 360k
  180.                2 = 1.2M
  181.                3 = 720k
  182.                4 = 1.44M
  183.  
  184. Restrictions: Supports physical drives A: and B: only
  185.  
  186. Example:
  187.  
  188.         call sub "floppytype", "A:", drivetype
  189.  
  190.  
  191.  
  192.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  193.  
  194. FREEDOS:      Release DOS memory allocated by AllocDOS and other ASILIB
  195.               subroutines.
  196.  
  197. Parameters:   segment address, errcode
  198.  
  199.               The segment address passed to FREEDOS must have been
  200.               allocated by ASILIB's AllocDOS subroutine or other ASILIB
  201.               subroutines which recommend using FREEDOS.  Errcode = 0
  202.               normally; if an invalid segment address is used with
  203.               FREEDOS, errcode = &hex09.
  204.  
  205. Example:
  206.  
  207. REM  Allocate a block of 1000 bytes, then release the block later.
  208.  
  209.         call sub "allocdos", 1000&, memseg
  210.         .
  211.         .
  212.         .
  213.         call sub "freedos", memseg, errcode
  214.  
  215.  
  216.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  217.  
  218. GETDOSVER:    get DOS version
  219.  
  220. Parameters:   no input parameters; returns major and minor DOS versions
  221.  
  222.               The Major DOS version number is 3 for version 3.x, 4 for
  223.               version 4.0, etc.; the minor version, for example, is
  224.               21 for DOS version 3.21.  Some ASILIB subroutines require
  225.               DOS version 3.0 or better; if the major version is 3 or
  226.               greater, these subroutines will work OK.
  227.  
  228. Example:
  229.  
  230.         call sub "getdosver", maj, min
  231.  
  232.  
  233.  
  234.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  235.  
  236. INSERT:       Control Insert keyboard toggle.
  237.  
  238. Parameters:   Insertmode
  239.  
  240.               If insertmode = 0, the Insert keyboard toggle is turned off.
  241.               If insertmode = 1, the Insert keyboard toggle is turned on.
  242.  
  243. Example:
  244.  
  245. REM  turn insert toggle on
  246.  
  247.         insertmode=1
  248.         call sub "insert", insertmode
  249.  
  250.  
  251. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  252.  
  253. ISATT:        determines if an ATT 6300-type display card is installed
  254.               this equipment is like a CGA except that it has an additional
  255.               640 x 400 2-color graphics mode (mode &hex40)
  256.  
  257. Parameters:   No input parameters; returns &hexFFFF if installed, 0 if not.
  258.  
  259.               ISATT determines if an ATT 6300-type display card is installed.
  260.               This equipment is like a CGA except that it has an additional
  261.               640 x 400 2-color graphics mode (mode &hex40).
  262.  
  263. Example:
  264.  
  265.         call sub "isatt", attflag
  266.  
  267.  
  268.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  269.  
  270. ISEVGA:       Determines if an EGA or VGA is installed.
  271.  
  272. Parameters:   No input parameters; returns monitor type, EGAVGAflag
  273.               and minimum memory.
  274.  
  275.               Memory is the amount of memory as determined by standard
  276.               BIOS functions; does not attempt to detect SVGA memory
  277.               greater than 256k.  EGA equipment may have memory < 256k.
  278.               If memory = 0, no EGA or VGA is installed.
  279.               EGAVGAflag = 1 if EGA, 3 if VGA.
  280.               EGA boards may be connected to either a Monochrome, CGA or
  281.               EGA monitor.  If monitor = -1, CGA is used.  If monitor = 0,
  282.               the EGA is driving a monochrome monitor.  If monitor = 1, the
  283.               EGA is connected to an EGA or better monitor.
  284.  
  285. Example:
  286.  
  287.         call sub "isevga", mon,egavga,mem
  288.  
  289.  
  290.  
  291.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  292.  
  293. ISHERC:       Determines if a Hercules or compatible display card
  294.               is installed and whether it is the active video system.
  295.  
  296. Parameters:   Returns HercCode.
  297.  
  298.               HercCode = 0 if no hercules is installed.  If a Hercules
  299.               is detected, HercCode is:
  300.  
  301.               128 = Hercules Graphics Card or compatible, active
  302.               144 = Hercules Graphics Card Plus, active
  303.               208 = Hercules InColor Card, active
  304.              -128 = Hercules Graphics Card or compatible, inactive
  305.              -144 = Hercules Graphics Card Plus, inactive
  306.              -208 = Hercules InColor Card, inactive
  307.  
  308. Example:
  309.  
  310. REM  I want to use Hercules graphics, but first I need to determine
  311. REM  if a Hercules card is installed
  312.  
  313.         call sub "IsHerc", herccode
  314.         if herccode = 0 then
  315.            REM  no Hercules
  316.         else
  317.            REM  use Hercules graphics
  318.            .
  319.            .
  320.            .
  321.         endif
  322.  
  323. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  324.  
  325. ISMOUSE:      determines if a mouse is installed
  326.  
  327. Parameters:   No input parameters; returns mousebuttons
  328.  
  329.               ISMOUSE determines if a mouse and its software driver are
  330.               installed.  Mousebuttons = 0 if no mouse or no mouse driver
  331.               is installed; otherwise mousebuttons = number of buttons the
  332.               mouse has.
  333.  
  334. Example:
  335.  
  336. REM  turn mouse cursor on if the mouse is installed
  337.  
  338.         call sub "ismouse", mousebuttons
  339.         if mousebuttons > 0 then
  340.             call sub "showmouse"
  341.         endif
  342.  
  343.  
  344.  
  345. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  346.  
  347. ISSEVGA:      determines if a Super EGA or Super VGA is installed
  348.  
  349. Parameters:   No input parameters; returns SVGA ID code
  350.  
  351.               SVGA ID code returned by ISSEVGA is in two parts:
  352.                1) the high byte of the code tells you whether it's an EGA
  353.                or VGA
  354.                2) the low byte tells you the manufacturer
  355.  
  356.              If high byte = 01, it's an EGA
  357.              If high byte = 03, it's a VGA
  358.  
  359.              Low byte codes are:
  360.  
  361.               1 = Paradise
  362.               2 = Everex
  363.               3 = Tseng VGA chipset
  364.               4 = Oak Technologies
  365.               5 = Western Digital (Paradise) OEM
  366.               6 = ATI
  367.               7 = Compaq
  368.               8 = NCR
  369.               9 = Trident
  370.              10 = Video7
  371.              11 = Genoa
  372.              12 = Cirrus
  373.              13 = Chips & Technologies
  374.              14 = Tseng 4000
  375.              15 = Ahead A
  376.              16 = Ahead B
  377.              17 = Trident 8900
  378.  
  379.              If svgacode = 0, no SuperEGA or SuperVGA is installed.
  380.              See also IsEVGA
  381.  
  382. Example:
  383.  
  384.         call sub "issevga", svgacode
  385.  
  386.         if svgacode < &hex0300 then
  387.         REM  either SuperEGA or no SVGA
  388.             .
  389.             .
  390.         else
  391.         REM  time to decode low byte..
  392.             .
  393.             .
  394.         endif
  395.  
  396.  
  397. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  398.  
  399. GETCMD:       isolates command line parameters
  400.               GetCMD assumes that parameters are separated by one or more
  401.               spaces
  402.  
  403. Parameters:   commandnumber, commandtext$
  404.  
  405.               GETCMD isolates one or more command-line parameters,
  406.               returning each one as commandtext$.  commandnumber
  407.               determines which parameter is returned; the first command
  408.               line parameter in number 0.  If the length of commandtext$
  409.               = 0, the commandnumber is greater than the actual number of
  410.               command line parameters.
  411.  
  412. Restrictions: Requires DOS version 3.0 or later.
  413.  
  414. Example:
  415.  
  416. REM  I want to see if an input filename was specified when the program
  417. REM  was started
  418.  
  419.         commandnumber = 0
  420.         call sub "getcmd", commandnumber, inputfile$
  421.         cmdlen=LEN(inputfile$)
  422.         if cmdlen > 0 then
  423.         REM got an input filename
  424.           .
  425.           .
  426.           .
  427.  
  428. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  429.  
  430. GETCPU:       detects cpu type
  431.  
  432. Parameters:   no input parameters; returns cputype code
  433.  
  434.               GETCPU determines the kind of CPU in the computer.  CPUType
  435.               codes are:
  436.  
  437.                0 if 8086/8088
  438.                1 if 80186/80188
  439.                2 if 80286
  440.                3 if 386 (SX or DX)
  441.                4 if 486 (SX or DX)
  442.  
  443. Example:
  444.  
  445.         call sub "getcpu",cputype
  446.  
  447.  
  448. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  449.  
  450. GETCRT:       determines active monitor type
  451.  
  452. Parameters:   No input parameters; reyurns crttype code
  453.  
  454.               CPUType codes returned are:
  455.  
  456.               -1       = CGA
  457.                0       = MDA
  458.               &hex0100 = EGA mono
  459.               &hex0300 = VGA mono
  460.                1       = EGA color
  461.                2       = MCGA
  462.                3       = VGA color
  463.              128       = Hercules Graphics Card
  464.              144       = Hercules Graphics Card Plus
  465.              208       = Hercules InColor
  466.              Note: GetCRT may be re-assembled with the /DNOHERC switch
  467.              to eliminate code which detects Hercules equipment
  468.  
  469. Example:
  470.  
  471.         call sub "getcrt", crttype
  472.  
  473.  
  474.  
  475. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  476.  
  477. MATHCHIP:     determines if 80x87 math coprocessor is installed
  478.  
  479. Parameters:   No input parameters; returns mathchipcode
  480.  
  481.               Mathchipcodes returned by MATHCHIP are:
  482.  
  483.                0 = not installed
  484.                1 = 8087
  485.                2 = 287
  486.                3 = 387 (DX or SX)
  487.                4 = 487 (486DX or 487SX)
  488.  
  489.               If the coprocessor is present, it is initilaized by MathChip.
  490.  
  491. Example:
  492.  
  493.         call sub "mathchip", mathchipcode
  494.  
  495.  
  496.  
  497. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  498.  
  499. MONTHNAME:    Returns the name of a specified month
  500.  
  501. Parameters:   MonthNumber, month$
  502.  
  503.               MonthNumber is a number from 1 through 12, inclusive,
  504.               representing the months January through December.
  505.               The name of the month is returned to the calling program in
  506.               month$.  Since ASIC uses 80 bytes for each string, an ASIC
  507.               string array would consume 80*12 = 960 bytes of data space.
  508.               Since ASILIB can store the month names more compactly, only
  509.               170 bytes are required for the entire MonthName subroutine,
  510.               including the names of the months!
  511.  
  512. Restrictions: Assumes that MonthNumber is an integer from 1 to 12.
  513.  
  514. Example:
  515.  
  516. REM  I want to print "February" on the screen
  517.  
  518.         call sub "monthname",(2,month$)
  519.         print month$
  520.  
  521.  
  522. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  523.  
  524. PATH:         Isolates PATHs in program enviornment
  525.  
  526. Parameters:   path number, pathstring
  527.  
  528.               Much like GETCMD and MONTHNAME, PATH is a pseudo string array
  529.               which returns a path from the program's enviornment block.
  530.               If the length of the string returned by PATH is zero, there
  531.               are no more paths in the enviornment block.
  532.  
  533. Restrictions: DOS 3.xx or greater
  534.  
  535. Example:
  536.  
  537. REM  the PATH statement in my AUTOEXEC.BAT file looks like this:
  538. REM  PATH=C:\;C:\MASM;C:\DOS;..\
  539.  
  540.         for n=0 to 100
  541.           call sub "path", n, a$
  542.           i=LEN(a$)
  543.           if i=0 then nomorepaths:
  544.           print a$
  545.         next n
  546.  
  547. REM  this prints:
  548.  
  549. REM  C:\
  550. REM  C:\MASM
  551. REM  C:\DOS
  552. REM  ..\
  553.  
  554.  
  555.  
  556. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  557.  
  558. RAMSIZE:      determine total base RAM intalled
  559.  
  560. Parameters:   No input parameters; returns bytes& installed.
  561.               Note that bytes& is a long integer; requires ASIC's
  562.               extended math option.
  563.  
  564. Example:
  565.         call sub "ramsize", bytes&
  566.  
  567.  
  568. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  569.  
  570. SYSTEM:      execute a second copy of COMMAND.COM;  optionally runs another
  571.              program.
  572.  
  573. Parameters:  command$
  574.  
  575.              If command$ = "" control is transfered to another copy
  576.              of COMAMND.COM and you get the DOS prompt.  Control is passed
  577.              back to the calling program when EXIT is entered at the
  578.              DOS prompt.
  579.              If command$ is the name of a program either in the current
  580.              directory or in a PATH directory, the program will be executed,
  581.              and control will pass back to the calling program at the
  582.              termination of the second program.  Command$ may include
  583.              command line parameters.
  584.  
  585. Restrictions:Requires DOS 3.0 or greater
  586.  
  587. Example:
  588.  
  589. REM  I want to go to DOS temporarily to format a 720k disk
  590.  
  591.         command$="format a: /u /f:720"
  592.         call sub "system",command$
  593.  
  594.