home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY1 / EQUIP.ZIP / EQUIP.BAS < prev    next >
BASIC Source File  |  1990-04-11  |  3KB  |  81 lines

  1. ' An example of $LINK and OBJ code working with PowerBASIC
  2. ' by Barry Erick 75300,214
  3.  
  4.                 'First a debugger note:
  5.  
  6.                 ' DO NOT F7 (step) OR F8 into the
  7.                 ' $LINK or any Procs or functions in it.
  8.                 'Place the cursor on the line following
  9.                 ' it and F4 to that spot.
  10.                 ' Also... if you use the debugger, the
  11.                 ' $LINK MUST be at the end of the code
  12.  $COMPILE EXE            'Make a EXE file from this
  13.  $LIB ALL OFF            'We are not going to use anything in
  14.                 ' the LIB options we can turn off,
  15.                 ' so turn them off. Also, I already
  16.                 ' have this bug free, so turn off the
  17.                 ' error checking code.
  18.  $ERROR ALL OFF            'Also, we can trim it futher by not
  19.                 ' allowing breaking out
  20.  $OPTION CNTLBREAK OFF        ' and we don;t need an Dimming, so
  21.  $OPTION AUTODIM OFF        'This is not a Com program, so
  22.  $COM 0                ' nor will it play music so
  23.  $SOUND 0                       'Since we don't use much string
  24.                 ' space, we can make it rather small
  25.  $STRING 1            ' a 1060 byte string segment
  26.  $FLOAT EMULATE            'And the smallest math package since
  27.                 'we don't need the best math
  28.                 'All of these Metastatements will
  29.                 ' greatly reduce the size of the
  30.                 ' .EXE file
  31.  
  32.  DEFINT a-z             'Make Integers default
  33.                 'Since PB does not know the contents
  34.                 ' of Equip.OBJ, we must tell it by:
  35.  DECLARE SUB EQUIPMENT(INTEGER,INTEGER,INTEGER,INTEGER)
  36.                 'A Debugger Note: DO NOT F7 into this
  37.                 ' call. Either F8 or place the cursor
  38.                 ' on the PRINT line and use F4
  39.                 'Now we can call the Procedure
  40.  CALL Equipment(a,b,c,d)    ' with 4 integers.
  41.                 'Since we are only returning values
  42.                 ' in a,b,c, and d, we don;t care what
  43.                 ' they are on entry. On exit they will
  44.                 'hold ConvMem%,Printers%,ComPorts%,
  45.                 ' and GameAdapters%
  46.                 'Now, print out the findings
  47.  PRINT "I have detected that this computer has ";
  48.  PRINT USING "###k ";a;
  49.  PRINT "conventional memory."
  50.  PRINT "You have";b;"printer";
  51.  IF b <> 1 THEN PRINT "s";
  52.  PRINT " attached and";c;"com port";
  53.  IF c <> 1 THEN PRINT "s";
  54.  PRINT
  55.  PRINT "You have ";
  56.  j$ = "game port"
  57.  SELECT CASE d
  58.         CASE 0
  59.              PRINT "no ";
  60.              PRINT j$;"s";
  61.         CASE 1
  62.              PRINT "one ";
  63.              PRINT j$;
  64.         CASE 2
  65.              PRINT "two ";
  66.              PRINT j$;"s";
  67.         CASE 3
  68.              PRINT "three ";
  69.              PRINT j$;"s";
  70.         CASE 4
  71.              PRINT "four ";
  72.              PRINT j$;"s";
  73.         CASE ELSE
  74.              PRINT d;
  75.              PRINT j$;"s";
  76.  END SELECT
  77.  PRINT "."
  78.  END                'Be sure to END so the debugger
  79.                 ' won't touch the $LINK metastatement
  80.  $LINK "equip.obj"        'be sure this is in the same
  81.