MODEM INP & OUT PORTS

 BBS: Inland Empire Archive
Date: 02-05-93 (14:24)             Number: 391
From: JOHN GALLAS                  Refer#: NONE
  To: CALVIN FRENCH                 Recvd: NO  
Subj: MODEM INP & OUT PORTS          Conf: (2) Quik_Bas
CF>Hi! I'm new to this echo, but what I'm wondering is how I can access the
CF>_other_ com ports (3 & 4). OPEN "COM4 etc.." or OPEN "COM3 etc.." shant
CF>work (is SHANT the right word? probably not). I imagine you have to use
CF>the INP and OUT commands, but I"m not sure! Thanks,

'Here's some com3/com4 startup code
'Dick Dennison 10/92  1:272/34

'Save vectors at bios Addresses for Com1-Com2
DEF SEG = 0
  OldPort1H = PEEK(&H400)
  OldPort1L = PEEK(&H401)
  OldPort2H = PEEK(&H402)
  OldPort2L = PEEK(&H403)

'Initialize the com1/com2 address space
 POKE &H400, &HF8
 POKE &H401, 3
 POKE &H402, &HF8
 POKE &H403, 2

'Obviously, change the baud rate to whatever
'you want up to 19200.

SELECT CASE port%
     CASE 1
        Start$ = "COM1:2400,N,8,1,DS0"
     CASE 2
        Start$ = "COM2:2400,N,8,1,DS0"
     CASE 3
        POKE &H400, &HE8   'For com1 to com3
        Start$ = "COM1:2400,N,8,1,DS0"
     CASE 4
        POKE &H402, &HE8   'For com2 to com4
        Start$ = "COM2:2400,N,8,1,DS0"
END SELECT
DEF SEG
OPEN Start$ FOR RANDOM AS 1

'Do your terminal program here

CLOSE 1

'Restore the comm address vectors
DEF SEG = 0
   POKE &H400, OldPort1H
   POKE &H401, OldPort1L
   POKE &H402, OldPort2H
   POKE &H403, OldPort2L
DEF SEG
END

 * OLX 2.1 TD * "Pure concentrated un-diluted same old thing"

--- TMail v1.30.4
 * Origin: TC-AMS MLTBBS 2.2 - Minnetonka, MN (612)-938-4799 (1:282/7)
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