home *** CD-ROM | disk | FTP | other *** search
- ' An example of $LINK and OBJ code working with PowerBASIC
- ' by Barry Erick 75300,214
-
- 'First a debugger note:
-
- ' DO NOT F7 (step) OR F8 into the
- ' $LINK or any Procs or functions in it.
- 'Place the cursor on the line following
- ' it and F4 to that spot.
- ' Also... if you use the debugger, the
- ' $LINK MUST be at the end of the code
- $COMPILE EXE 'Make a EXE file from this
- $LIB ALL OFF 'We are not going to use anything in
- ' the LIB options we can turn off,
- ' so turn them off. Also, I already
- ' have this bug free, so turn off the
- ' error checking code.
- $ERROR ALL OFF 'Also, we can trim it futher by not
- ' allowing breaking out
- $OPTION CNTLBREAK OFF ' and we don;t need an Dimming, so
- $OPTION AUTODIM OFF 'This is not a Com program, so
- $COM 0 ' nor will it play music so
- $SOUND 0 'Since we don't use much string
- ' space, we can make it rather small
- $STRING 1 ' a 1060 byte string segment
- $FLOAT EMULATE 'And the smallest math package since
- 'we don't need the best math
- 'All of these Metastatements will
- ' greatly reduce the size of the
- ' .EXE file
-
- DEFINT a-z 'Make Integers default
- 'Since PB does not know the contents
- ' of Equip.OBJ, we must tell it by:
- DECLARE SUB EQUIPMENT(INTEGER,INTEGER,INTEGER,INTEGER)
- 'A Debugger Note: DO NOT F7 into this
- ' call. Either F8 or place the cursor
- ' on the PRINT line and use F4
- 'Now we can call the Procedure
- CALL Equipment(a,b,c,d) ' with 4 integers.
- 'Since we are only returning values
- ' in a,b,c, and d, we don;t care what
- ' they are on entry. On exit they will
- 'hold ConvMem%,Printers%,ComPorts%,
- ' and GameAdapters%
- 'Now, print out the findings
- PRINT "I have detected that this computer has ";
- PRINT USING "###k ";a;
- PRINT "conventional memory."
- PRINT "You have";b;"printer";
- IF b <> 1 THEN PRINT "s";
- PRINT " attached and";c;"com port";
- IF c <> 1 THEN PRINT "s";
- PRINT
- PRINT "You have ";
- j$ = "game port"
- SELECT CASE d
- CASE 0
- PRINT "no ";
- PRINT j$;"s";
- CASE 1
- PRINT "one ";
- PRINT j$;
- CASE 2
- PRINT "two ";
- PRINT j$;"s";
- CASE 3
- PRINT "three ";
- PRINT j$;"s";
- CASE 4
- PRINT "four ";
- PRINT j$;"s";
- CASE ELSE
- PRINT d;
- PRINT j$;"s";
- END SELECT
- PRINT "."
- END 'Be sure to END so the debugger
- ' won't touch the $LINK metastatement
- $LINK "equip.obj" 'be sure this is in the same