Microsoft KB Archive/37477
Article ID: 37477
Article Last Modified on 11/21/2006
- Microsoft QuickBasic 4.5 for MS-DOS
This article was previously published under Q37477
The README.DOC file for QuickBasic 4.50 from the Utilities 2 disk is printed below.
"README.DOC" File Release Notes for MICROSOFT(R) QuickBasic Version 4.5 for IBM(R) Personal Computers and Compatibles (C) Copyright Microsoft Corporation, 1988 THIS FILE CONTAINS IMPORTANT INFORMATION CONCERNING VERSION 4.5 OF MICROSOFT(R) QuickBasic. PLEASE READ THE ENTIRE FILE BEFORE USING QuickBasic. This file has seven parts: PART CONTENTS 1 Information about additions and changes to the Learning to Use Microsoft QuickBasic 2 Information about additions and changes to the manual Programming in Basic 3 Using your Mouse with QuickBasic 4 Supplementary information on mixed-language programming 5 Using Btrieve with QuickBasic 6 Using the MS-DOS 3.2 patch for math accuracy 7 Miscellaneous information about using QuickBasic ===< Part 1: Learning to Use Microsoft QuickBasic > No entries yet for this part ===< Part 2: Programming in Basic > No entries yet for this part ===< Part 3: Using Your Mouse with QuickBasic > ---<New Mouse Driver for Use with QuickBasic >-- QuickBasic Version 4.5 can be used with any mouse that is 100% compatible with the Microsoft Mouse. However, you must use a Microsoft Mouse driver Version 6.00 or later. Earlier versions may cause unpredictable behavior when used with QuickBasic. MOUSE.COM, version 6.24 is supplied with QuickBasic Version 4.5. Especially if you are writing programs that use the mouse, you should use the supplied version of the mouse driver when working in QuickBasic. Previous versions have included MOUSE.SYS, which is installed by including the line DEVICE=MOUSE.SYS in your CONFIG.SYS file. This version of QuickBasic includes MOUSE.COM, which is not installed via CONFIG.SYS. To install MOUSE.COM, just type MOUSE at the MS-DOS prompt. To include MOUSE.COM automatically when your machine boots, make sure MOUSE.COM is in your search path, then put the line MOUSE in your AUTOEXEC.BAT file. To free up memory, you can remove the mouse driver at any time by typing MOUSE OFF at the MS-DOS prompt. This will restore between 9K and 10.5K of memory with Version 6.11. --< Using Mouse Function Calls from QuickBasic Programs >-- If you are programming for the Microsoft Mouse, you should obtain the Microsoft Mouse Programmer's Reference Guide and the library MOUSE.LIB that comes with it. (These are not included in QuickBasic or Mouse package and must be ordered separately). Most of the information in the Mouse Programmer's Reference Guide applies directly to QuickBasic Version 4.5. However, the following additional restrictions must be observed: Certain Mouse function calls (Functions 9 & 16) require you to set up an integer array and pass the address of the array to the mouse driver. For previous versions, the only restriction on this array was that it had to be $STATIC (the default array type). In QuickBasic Version 4.5, however, the array also must be in a COMMON block if you will be making the Mouse function call from within the QuickBasic environment. In addition, it is recommended that the support code for the Mouse call be in a Quick library or linked into the executable file when making Mouse function calls from QuickBasic. To produce a Quick library for using Mouse function calls from within the QuickBasic environment, use the following command line (produces MOUSE.QLB): LINK MOUSE.LIB/QU,MOUSE.QLB,,BQLB40.LIB/NOE; An example from PIANO.BAS (included with the Microsoft Mouse Programmer's Reference) for using Mouse function call 9: DEFINT A-Z DECLARE SUB MOUSE (M1, M2, M3, M4) DIM Cursor(15, 1) COMMON Cursor() 'Ensures array data is in DGROUP (set up Cursor() for mouse cursor shape desired) M1 = 9: M2 = 6: M3 = 0 CALL MOUSE(M1, M2, M3, VARPTR(Cursor(0,0))) In addition to the above, note that Mouse function calls 21-23 require dynamically allocated storage out of the home data segment. The recommended way to do this is to allocate space in a dynamic string variable based on the return value from function call 21, using the STRING$ or SPACE$ function. Then use VARPTR on this string variable just prior to calling Mouse function call 22 or 23. Part 4: Supplementary Information on Mixed-Language Programming -------< Linking from within QuickC or with QCL >------- Microsoft QuickC and the QCL command both set the /NOI linker by default. Therefore, you should not link from within QuickC, or with QCL, when your program contains modules written in a case-insensitive language such as Basic. Use LINK to link your program from the command line. ---< Pascal and Fortran Modules in QuickBasic Programs >--- Modules compiled with Microsoft Pascal or Fortran can be linked with Basic programs, as described in the Microsoft Mixed-Language Programming Guide. They can also be incorporated in Quick libraries. However, QuickBasic programs containing code compiled with Microsoft Pascal must allocate at least 2K near-heap space for Pascal. This can be done by using the DIM statement to allocate a static array of 2K or greater in the NMALLOC named common block, for example, as follows: DIM name%(2048) COMMON SHARED /NMALLOC/ name%() The Pascal run-time assumes it always has at least 2K of near-heap space available. If the Pascal code cannot allocate the required space, QuickBasic may crash. This applies to Pascal code in Quick libraries as well as Pascal code linked into executable files. The situation is similar for Fortran I/O, which also requires near buffer space, and which can be provided by the same means as the Pascal near malloc space. ----------------< STATIC Array Allocation >---------------- If you are writing assembly-language modules for use in QuickBasic programs, see Section 2.3.3, "Variable Storage Allocation," in the Basic Language Reference. Assembly language code should not assume data is in a particular segment. To avoid problems, pass data using the SEG or CALLS keywords, or use FAR pointers. Alternatively, you can declare all arrays dynamic (still using far pointers) since dynamic arrays are handled identically by BC and within QuickBasic. Quick Libraries with Leading Zeros in the First Code Segment A Quick library containing leading zeros in the first CODE segment is invalid, causing the message "Error in loading file <name> - Invalid format" when you try to load it in QuickBasic. For example, this can occur if an assembly-language routine puts data that is initialized to zero in the first CODE segment, and it is subsequently listed first on the LINK command line when you make a Quick library. If you have this problem, do either of the following: 1. link with a Basic module first on the LINK command line, or 2. make sure that, in whatever module comes first on the LINK command line, the first code segment starts with a non-zero byte. ---< References to DGROUP in Extended Run-time Modules >--- For mixed-language programs that use the CHAIN command, you should make sure that any code built into an extended run-time module does not contain any references to DGROUP. (The CHAIN command causes DGROUP to move, but does not update references to DGROUP.) This rule applies only to mixed-language programs; because Basic routines never refer to DGROUP, you can ignore this caution for programs written entirely in Basic. To avoid this problem, you can use the value of SS, since Basic always assumes that SS coincides with DGROUP. ===< Part 5: Using Btrieve >=== ----------< Using Btrieve in OS/2 Protected Mode >--------- In OS/2 protected mode, a Basic program that uses Btrieve must do a Btrieve reset call (function 28) before executing the CHAIN statement. The program must also reopen all Btrieve files when the destination of the CHAIN starts to run. ------------< Using Btrieve with QuickBasic >-------------- If you use Btrieve with QuickBasic, you must make a small change to your programs for QuickBasic Version 4.5. Currently your programs contain a statement that obtains the address of the field buffer for an open file. For example: OPEN "NUL" AS #1 FIELD #1, 20 AS CITY$, 10 AS STATE$ FCB.ADDR% = VARPTR(#1) 'This statement obtains 'the address In QuickBasic Version 4.5, you should change the indicated statement to return the address of the first variable in your field buffer minus a constant, as follows: OPEN "NUL" AS #1 FIELD #1, 20 AS CITY$, 10 AS STATE$ FCB.ADDR% = SADD(CITY$) - 188 ' CITY$ is the ' first field ' buffer variable The following example shows how to obtain the same address for a user-defined type: TYPE ADDRESS CITY AS STRING * 20 STATE AS STRING * 10 END TYPE DIM ADD1 AS ADDRESS FCB.ADDR% = VARPTR(ADD1) - 188 ' or, you can use FCB.ADDR% = VARPTR(ADD1.CITY) - 188 Your programs should function correctly with Btrieve with this change. ===< Part 6: MS-DOS 3.20 Patch > This information is important only if your system has ALL of the following characteristics: 1. Uses MS-DOS version 3.20 2. Boots from a hard disk drive 3. Has a math coprocessor (for example, an 8087 chip) 4. Runs programs that use floating-point math For systems that satisfy all of the preceding conditions, you may be able to eliminate floating-point math problems by installing a small patch in MS-DOS. If you are not sure whether you need the patch, perform the following steps: 1. Copy the program PATCH87.EXE (included in this release) to the root directory of your hard-disk drive. 2. Reboot your system from the hard disk, and DO NOT PERFORM ANY FLOPPY-DISK OPERATIONS after rebooting. It is very important that you avoid floppy-disk I/O after rebooting, since that will affect the reliability of the diagnostic test that you are about to perform. 3. If necessary, use the CD command to move to the root directory of your hard-disk drive. 4. Run the PATCH87.EXE program by entering this command at the MS-DOS prompt: PATCH87 5. The program performs a diagnostic test on your system to determine whether it needs the MS-DOS patch, and if the patch is needed, whether the patch can be installed successfully. If the program tells you that you need to install the MS-DOS patch, and that it can be done, follow the procedure described in the next section. NOTE: The floating-point problem has been eliminated in versions of MS-DOS higher than 3.20. This includes MS-DOS versions 3.21 and 3.30. If you performed the preceding test and determined that you should install the MS-DOS patch on your system, perform the following steps: 1. Format a blank floppy disk. (Do NOT use the /s formatting option to transfer system files to the disk.) 2. Use the SYS command to copy IO.SYS and MSDOS.SYS from the root directory of your hard disk to the new floppy disk. For example, if you boot from drive C:, you would enter the following commands: C: SYS A: 3. Use the COPY command to copy COMMAND.COM and SYS.COM to the same floppy disk. 4. Use the COPY command to copy the program PATCH87.EXE (included in this release) to the same floppy disk. 5. Change the current drive and directory to the floppy disk, by entering the following command: A: 6. Install the MS-DOS patch by entering the following command: PATCH87 /F WARNING: If you experience any disk errors during steps 2 through 7, do NOT proceed with step 8. Reboot from your hard disk and repeat the entire process. 7. If you have not experienced any errors, use the SYS command to transfer the files IO.SYS and MSDOS.SYS from the floppy disk back to your hard disk. For example, if the boot directory of your system is the root directory of drive C:, you would enter the following command at the MS-DOS prompt: A: SYS C: 8. The MS-DOS patch has been installed. Reboot the system. < Part 7: Miscellaneous Information About Using QuickBasic > ---------------<Using FIXSHIFT.COM Utility >--------------- Some keyboards have an extra set of DIRECTION (i.e. arrow) keys, in addition to those on the numeric keypad. A bug in the ROM BIOS of some machines with these keyboards can interfere with the QuickBasic editor. The Utilities 2 disk includes a program, FIXSHIFT.COM, that fixes this bug. If you have such a keyboard, run this program by typing FIXSHIFT. If your machine does not have the bug, FIXSHIFT displays a message telling you so. Otherwise FIXSHIFT prompts you for the proper actions. FIXSHIFT takes about 450 bytes of memory. Except for the BIOS bug, it has no effect on other programs you run. -------------<Note on VGA Display Adapter >---------------- If you install an IBM (R) Personal System/2 (TM) Video Graphics Array display adapter (VGA) in a non-PS/2 machine, the VGA adapter should be the only adapter in the system, and you should not use monochrome modes (SCREEN 10) if you have a color monitor. Similarly, you should not use color modes (SCREEN 1, 2, 7, 8, 9, 11, 12, 13) if you have a monochrome monitor. ---------< Note on Using QuickBasic with MS-DOS version 2.1 >--------- To use QuickBasic with a two-floppy system under MS-DOS version 2.1, you must put a copy of COMMAND.COM on each disk containing an executable file ( a file with the .EXE extension). ----< PTR86, LOF, Naming SUB procedures and variables >---- PTR86 is no longer supported. Use VARSEG and VARPTR instead. Also, when used with a communications device, LOF now returns the amount of space remaining (in bytes) in the output buffer. In previous versions this was returned in the input buffer. Also, note that a variable and SUB procedure could have the same name in previous versions. In Version 4.5, this causes a "Duplicate definition" error message.
Additional query words: QuickBas readme