User's Manual

iAPX2B6
MACRO
ASSEMBLER
Loe
OBJ
0083
09F4
0085
80FAFB
0088
7240
OOBA
eOEAFB
0080
09E8
DoeF
DoeF
DCC1
0091
DEE9
0093
D9F4
0095
D9C9
0097
OF15
0099
DEC;!
Q09Il
F71D
009D
7529
009F
D9C9
aOA1
OFID
aOA3
80EAF8
OOA6
E9A400
OOA9
OOA9
BOEAFC
()OAC E99EOO
aOAF
DOAF
09E8
OOBl
DC'1C9
00133
D9FB
00135
D9F4
aaB7
09£5
0099
9BDFEO
COBe
09C9
DaDE D9CA
aOCD
BOEAFA
aOC::3
1090044
aOC6
74C7
Dace
ODDS
aOCA
aOCA
OOCA
CB7EFO
OOCD
OF56FC
0000
D9Ee
0002
DEe9
0004
DF5EFA
NUMERIC PROGRAMMING EXAMPLES
80287
Floating-Point
to
IS-Digit
ASCII
Conversion
10: 12:
89
09/25/83
PAGE
LINE
228
22.
230
231
232
233
234
235
236
237
238
239
240
241
242
243
24.
245
246
247
248
24'
250
251
:?52
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
~71
27.
273
27.
275
276
277
278
27.
280
281
28.
283
28.
28.
286
287
288
28.
2'0
291
2'2
:293
2
••
29'
2'6
2'7
2.8
2.,
300
301
302
303
30.
30'
306
307
308
30,
310
311
312
313
31.
31.
316
317
318
31.
320
321
SOURCE
fxtratt
cmp
dl,UNNDRMAL
Jb
normal_value
sub
d
1,
UNNORMAL-NORMAL
Normalize
the
fraction.
the
denormal
count
value.
Assert:
0
<'"
ST(O)
(
1.0
-Fld 1
J
Separate
exponent
f'T'om
significand
,
Test
for
unnormal
value
Return
normal
status
with
correct
Sign
adJust
the
power
of
two
in
ST(1)
and
1t.et
,
Load
constant
to
normalize
fraction
norma
1 i z
e_frac
t
ion:
fadd
st(1).1t.t
hub
f
xc
h
fi1t.t
word
ptr
CdiJ
faddp
st
(2).
st
ne-g
word
ph
CdiJ
Jnz
not_psuedo_zero
Set
integer
bit
in
fraction
j
Form
normalized
fraction
in
ST(O)
J
Power
of
two
Held
will
be
negative
of
denormal
count
j
Put
denormal
count
in
ST(O)
J
Put
negative
of
dl!'normal
count
in
memorl,l
Form
correct
power
of
two
in
stt!)
OK
to
use
word
ptr
CdiJ
now
Form
positive
denormt!ll
count
A
psuedo
zero
will
appear
an
unnormal
numbeor. When
attemptinll
to
normalia
it.
the
resultant
fraction
field
will
be
zero.
Perfo~minll
an
f'xtrBct
on
zero
will
yield
a
zero
exponent
value.
.
f~ch
)
Put
power
of
tllJO
value
in
!OttO)
Fistp
word
ptr
CdiJ
Set
denorm<ll
count
to
power
of'
two
value
Word
ph
(diJ
is
not
u!;ed by
convert
integer.
OK
to
letJve
running
!:tub
dl,
NDRMAL-P5UEDO_ZERD
,Set
return
value
saving
thf!
sign
bit
Jmp
convert_i.nteger
)
Put
zero
value
into
memory
The
number
is
a
real
zero.
'iet
the
return
value
and
setup
for
conversion
to
BCD
d
1,
ZERO-NORMAL
convert_integer
,
Convert
<;t.3tlIS
to
normal
v<'Jlu!'
i
Treat
the:
l~ro
as
an
i.ntE!geT'
Th.
nUmbllr
is
a
dllnoTmal.
FXTRACT
will
not
wOTk
correctly
in
tht.
elutt.
To
corrttetlu
slIparate
the
eKponllnt
and
fraction,
add
a
fixed
J
constant
to
tht'
exponent
to
guarantee
thll
rellult
il
not
a
denormal.
,
found_d
enorma
1:
,
fld
1
heh
fpram
htract
j
PTeparl!
to. bump
axponent
ForeD
denormal
to
smallelit
represllntable
utendlld
raal
-Format
exponent
)
This
will
work
corrllctly
now
The
power
of
the
original
dllnoT'mal
valu.
n.n
baen
safely
isohtad.
Check
if
the
fraction
value
is
an
unnormal.
ham
htsw
hch
heh
"b
t!!!!t
J'
fstp
atC:!)
dl.
DENORMAL-NORMAI..
8K,4400H
norma
1 i
:re_fTac
t i
on
stCO)
SII'
if
the
fraction
is
an
unnormal
Save
80287
statu.
In
CPU
AX
rIg
for
later
I
Put
uponent
in
9T(O)
,
Put
1.
~
into
SHO),
uponant
in
9T(2)
j
Return
normal
status
with
correct
lign
j
See
if!
C:3-C:!"O imp
ling
unnormal
aT'
NAN
j Jump
if
-Fraction
is
an
unnormal
j
Remov.
unnecessary
1. 0
from
lIteO)
Calculatt
the
d.eimal
magnitude
a"oelated
with
this
numb
Ill'
to
lIIithin
one
order.
Tnt.
error
lIIi1l
allllays
bll
inevihbh
due
to
rounding
and
lost
pr.ttlion.
A.
a
rlSult,
we
will
delibarfttwly
fail
to
considar
the
LOOIO
of
the
fraction
valua
in
calculating
thll
oT'dn.
Since
th
hattion
will
alwaYI
be
1
<-
F
<:!,
its
L.DOIO
will
not
change
thll
baSic
accurilcl/
oft
the
function.
To
get
thll
decimal
order
of
magnitude.
limply
multipl1J
tha
power
of
two
bl,l L.OQ10(2)
and
truncate
thll
ruult
to
.an
integar.
normal_valu.:
notJlIu.do_:rero:
fltp
fTacUon
fiat
POWtT'_two
Udlg2
fmul
fhtp
power_tan
tlsve
,;;nll
Tr.1;;~I.I;U'
ii.."";
;
...
,
~
........
Save
power
of
two
Qet
L.OQ10(2)
Pow.r_two
is
noUl
saf.
to
us.
I
Form
LOG10(of
exponent
of
number)
j
AnI,!
rounding
moda
will
work
harll
Check
if
the
magnitude
of
thll
number
rule.
out
treating
it
al
integllr.
CX
ha.
the
maximum
number
of
decimal
digits
allowed.
Figure 4-6. Floating-Point
to
ASCII Conversion Routine (Cont'd.)
4-10