BBS: Inland Empire Archive
Date: 04-09-92 (08:58) Number: 111
From: MATT HART Refer#: NONE
To: JON SPRINGER Recvd: NO
Subj: Comm port 3... Conf: (2) Quik_Bas
JS> Argh! Does anybody know how to access Comm port 3 for use
JS> with the modem from Quickbasic? I get some dumb error telling me
You have to fool QB.
DEF SEG = 0
Com1.1 = PEEK(&H400) : Com1.2 = PEEK(&H401)
Com3.1 = PEEK(&H404) : Com3.2 = PEEK(&H405)
POKE &H400,Com3.1 : POKE &H401,Com3.2
POKE &H404,Com1.1 : POKE &H405,Com1.2
This swaps the address' for COM1 and COM3. Now, open
and access COM1 from QB, and you will actually be accessing
COM3. Swap them back to access COM1 again. When finished,
CLOSE the COM1 buffer once for COM3, swap the address', and
CLOSE again for COM1 (if both were open).
JS> and I was wondering if there is a problem using Global variables
JS> among modules, because I suspect the program will eat up 128k and
You can still CHAIN between programs. Compile using the
BRUN module and you can preserve variables across programs
with COMMON SHARED statements. Otherwise, you can pass
variables as parameters to SUB procedures, or you can share
them with either
or a block common (COMMON SHARED /blockname/). The memory
eaten up by variables depends on their type. I guess I
should first explain memory segmentation in QB.
DGroup : 64K of system memory reserved for variable
length strings, simple variables (non array numerics), TYPE
definitions, GOSUB and procedure stack, pointers to array
numerics, static arrays, COMMON SHARED pointers.
Code Memory : The memory taken up by the EXE code itself.
Far memory : All the rest of system memory. Used for
fixed length string arrays, numeric arrays, TYPE arrays.
So a 128K program will have these 3 distinct memory sections. 64K of
dgroup should be preserved where it is possible, but it can
also be specifically utilized for speed (mainly by using
STATIC arrays and variables). The memory preserved across
a chain will be the dgroup and far memory specified by
COMMON SHARED statements. Block commons are shared between
linked modules. All Code memory will be released, and then
re-used by the EXE code of the next program.
* Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)