Finding addresses – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 112

II. SOFTWARE GUIDES - 8. Driver488/DRV
8K. Other Languages
Personal488 User’s Manual, Rev. 3.0
II-97
•
Check the Driver488/DRV disk. Support for languages not described in this manual may be
included in the Driver488/DRV program disk.
•
Try the examples given for a language that is similar to the one you wish to use. Different varieties
of BASIC, Pascal, or other languages may be similar enough in their implementation that they can
be used identically to control Driver488/DRV. The
DDAEMON.EXE
(driver daemon) program that
is provided on the Driver488/DRV disk can help in determining just how a language
communicates with Driver488/DRV.
•
Call your service representative for technical support. New language support examples will be
available to you as they are developed.
If no support is available or appropriate for your language, it is still practical to control
Driver488/DRV so long as your language supports system interrupt calls. A system interrupt is a
special type of subroutine call that is used to gain access to the MS-DOS and BIOS internal procedures.
They are used by the I/O library of every language to control the disk, keyboard, screen, printer, and
other hardware in the system. The same system interrupts are used to control Driver488/DRV.
Most programming languages have subroutines that allow interrupts to be invoked. The often have
names such as
Int86
,
SysInt
, or
DOSInt
. If you are not sure that your language has such a
subroutine, then check with the language manufacturer.
To control Driver488/DRV you need to be able to do the following:
•
Find the segment and offset addresses of variables (or arrays) in your program
•
Open and close the
IEEE
file that is used to communicate with Driver488/DRV
•
Configure the
IEEE
file for binary communication
•
Send and receive commands and data to and from the
IEEE
file, and
•
Perform
IOCTL“BREAK”
and
IOCTL$
functions as described in “Section III: Command
References.”
The examples throughout this Sub-Chapter are in assembly language to demonstrate the low-level
commands that communicate with DOS and Driver488/DRV. However, it is likely that your
programming language has the ability to perform all these functions without directly using assembly
language.
Finding Addresses
The system interrupts that transfer command and data to and from Driver488/DRV need to be told
where in memory the data is to be transferred. Addresses in an MS-DOS computer are composed of
two 16-bit numbers: a
segment
and an
offset
. The actual memory address of an object is computed
during memory access by multiplying the segment value by 16 and adding the offset to the result. This
forms a 20-bit address that covers the address range available in MS-DOS. All MS-DOS addresses are
specified in this
segment:offset
form.
A segment of memory is a region of memory in which all data elements have the same segment value.
Each
segment
is 64K bytes long, with locations within the segment determined by the
offset
address. Segments can and often do overlap. For example, all of the following
segment:offset
pairs refer to the same address (
2CF89 hex
):
2CF8:0009
,
2CF0:0089
,
2C00:0F89
,
2000:CF90
,
1E32:EC69
(
1E320 + EC69 = 2CF89
).
There is no universal way of determining the
segment
and
offset
address of a data object in a
programming language. Some languages, such as interpreted GW-BASIC or BASICA, keep all their
variables in a single segment known as the data segment. However, they do not provide a convenient
method of determining the segment address of that data segment. A special assembly-language
subroutine, must be used to find the data segment address. Once the data segment address is found, it
is fixed. All variables reside in this single, fixed data segment. These BASICs do provide a function,
VARPTR
, that returns a variable’s offset address within the data segment.