Modem INP & OUT ports

 BBS: Inland Empire Archive
Date: 02-04-93 (07:00)             Number: 371
From: JERRY HUNTER                 Refer#: NONE
  To: CALVIN FRENCH                 Recvd: NO  
Subj: Modem INP & OUT ports          Conf: (2) Quik_Bas
 > Hi! I'm new to this echo, but what I'm wondering is how I
 > can access the _other_ com ports (3 & 4). OPEN "COM4 etc.."
 > or OPEN "COM3 etc.."

Calvin :

INP and OUT are not required.

The following example moves the Base Port Address of COM3 (as provided in the
BIOS Data Area @ Offset &H40) into the slot reserved for
COM1:. Following the execution of this code snippet, you
may OPEN COM1:, and what you actually have is COM3. The
technique is referred to as "Device Aliasing", and can be
used to substitute COMx: ports, LPTx: ports, etc...

DEFINT A-Z
DEF SEG = &H40
OLDCOM1%= PEEK(1)*256 OR PEEK(0)
OLDCOM3%= PEEK(5)*256 OR PEEK(4)
POKE 0,OLDCOM3% MOD 256
POKE 1,OLDCOM3% \ 256

Do NOT forget to switch the values BACK before your program
terminates, lest you FUBAR the user's COMx: port (PCPlus,
Telix, etc. will be unable to find COM1:, and will
subsequently access COM3 whenever COM1 is referenced (G).

This technique is acceptable when attempting to access COM3
and COM4, provided you are NOT trying to access ALL 4 COMx:
ports concurrently. If THIS is the case, you will need to
A) Use a Fossil, or B) write your own driver in C or MASM.

Hope it helps...

Regards,
J.Hunter

--- GEcho 1.00/beta
 * Origin: DarkStar - QB45 Comes ALIVE! - (501) 631-5976 (1:391/2090)
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