Constants, Variables, and Data Types
Beta Draft - Do not distribute
© 2001, By Randall Hyde
and Data Types
olume One discussed the basic format for data in memory
w a computer sys
anizes that data.
This chapter fi
nishes this discussion by connecting the concept of
to its actual ph
As the title implies, this chapter concerns itself with
three main topics: constants, v
ariables and data structures.
This chapter does not assume that you’
e had a
formal course in data structures, though such e
ould be useful.
This chapter discusses ho
w to declare and use constants, scalar v
gers, reals, data types,
pointers, arrays, and structures.
ou must master these subjects before going on to the ne
ing and accessing arrays, in particular
, seems to present a multitude of problems to be
ginning assembly lan
guage programmers. Ho
, the rest of this te
xt depends on your understanding of these data structures
and their memory representation. Do not try to skim o
er this material with the e
xpectation that you will
pick it up as you need it later
ou will need it right a
ay and trying to learn this material along with later
material will only confuse you more.
Some Additional Instructions: INTMUL, BOUND, INTO
This chapter introduces arrays and other concepts that will require the e
xpansion of your 80x86 instruc
tion set kno
, you will need to learn ho
w to multiply tw
alues; hence the fi
tion we will look at is the
Another common task when accessing
arrays is to check to see if an array inde
x is within bounds.
vides a con
ay to check a re
alue to see if it is within some range.
(interrupt on o
vides a quick check for signed arithmetic o
t really necessary for
array (or other data type access), its function is v
ery similar to
, hence the presentation at this point.
es one of the follo
// The following compute destreg = destreg * constant
// The following compute dest = src * constant
// The following compute dest = dest * src
Note that the syntax of the
instruction is different than the
note that the destination operand must be a register (
both allow a memory operand as a destina-
Also note that
allows three operands when the first operand is a constant.