Microsoft KB Archive/40897
Article ID: 40897
Article Last Modified on 8/16/2005
- Microsoft QuickBasic Compiler for Macintosh 1.0
- Microsoft BASIC Interpreter 3.0 for Macintosh
- Microsoft BASIC Compiler 6.0b
This article was previously published under Q40897
If the communications buffer overflows, overprints, or fails when outputting to the "COM1:" device, such as to a plotter, Apple ImageWriter printer, or other hardware, it is probably due to the fact that the Macintosh hardware handshaking has not been turned on.
The machine language program below invokes the _CONTROL ROM call to turn on the hardware handshaking for "COM1:". This program can be used with the following products:
- Microsoft QuickBASIC Version 1.00 for the Apple Macintosh
- Microsoft BASIC Compiler Version 1.00 for the Apple Macintosh
- Microsoft BASIC Interpreter Version 3.00 for the Apple Macintosh
This program is not necessary for earlier (1.x, 2.x) versions of the Microsoft BASIC Interpreter for Macintosh, where hardware handshaking is ON by default.
To support the Apple Personal Modem, QuickBASIC Version 1.00 and the BASIC interpreter Version 3.00 set "COM1:" hardware handshaking OFF. Unfortunately, this can cause buffer overrun problems to occur with devices that rely on hardware handshaking.
Please note that Macintosh QuickBASIC and earlier versions of Macintosh BASIC support only one communications port, "COM1:", which is marked with a phone icon on the back of the Macintosh. QuickBASIC does not offer a feature to change the communications parameters for the "LPT1:" printer port, which is marked with a printer icon on the back of the Macintosh.
The following code example turns ON hardware handshaking to prevent buffer overflow problems on hardware that requires handshaking ON:
OPEN "COM1:9600,n,8,1" AS #1 ' Substitute your OPEN "COM1:..." here. DIM Code%(100) n=0 : hdhs=0 FOR j=0 TO 15 ' This loop READs machine language code into an array. READ n Code%(j)=n NEXT hdhs=VARPTR(Code%(0)) ' Get address of array. CALL hdhs ' Call the machine language instructions (stored in array) ' It is now possible to output with PRINT#n to the "COM1:" device. END ' Below are machine language instructions (represented as ' hexadecimal constants) that invoke the _CONTROL ROM routine. DATA &H41FA,&H001E DATA &H317C,&HFFF9,&H18 DATA &H317C,&H000A,&H001A DATA &H217C,&H001,&H1113,&H1C DATA &H42A8,&H0020 DATA &HA004 DATA &H4E75
Additional query words: BasicCom MQuickB