Opening Com Files

 BBS: Inland Empire Archive
Date: 04-02-93 (23:18)             Number: 264
From: BILL SMITH                   Refer#: NONE
  To: ROBERT SCHOENFELD             Recvd: NO  
Subj: Opening Com Files              Conf: (2) Quik_Bas
RS>In a terminal program that I wrote in QBasic I  could open
RS>com ports 1 and 2 but not 3 or 4.

From Basic you can only open COM 1 and 2, not 3 and 4.  There is a way
to fool the system by changing the port numbers.  The following code
will "swap" the COM 1 and COM 3 port address.  You can then open COM 3
with a OPEN "COM1" command...

DEF SEG = 0

byte1% = PEEK(&H400)
byte2% = PEEK(&H401)
byte3% = PEEK(&H404)
byte4% = PEEK(&H405)

POKE(&H400,byte3%)
POKE(&H401,byte4%)
POKE(&H404,byte1%)
POKE(&H405,byte2%)

Dont forget to reset these port number before you exit your program!!

 * SM 1.06 A0189 * On a clear disk you can see forever


--- WM v2.04/92-0423
 * Origin: (1:3639/3)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET