User's Manual

iAPX2Sb
MACRO
ASSEMBLER
LOC
aSJ
OOOOC]
0002t:]
0004[1
0006[]
OOOSt]
CODAr]
oOOetl
OOOEt]
OOOA
0012
0002
OOOA
0001
0004
0006
0003
0008
-0002
-0004
-0006
-oooa
0000
0002
-OOOiii![]
-0004C]
-COObC]
-OOIOC]
-OOIOC]
-OOIOC]
0010
0000
DADO
0002
FB
0003
04
0004
F9
uuv;;;
u;;;
0006
00
0007
06
0008
01
'
0009
07
OOOA
Fe
0009
FE
Dooe
FD
0000
FE
DOOE
FA
DOOF
FE
0010
FB
0011
FE
NUMERIC PROGRAMMING EXAMPLES
80287
Floating-Point
to
IS-Digit
ASCII
Conv~1"6ion
10: 12:
38
09/25/83
PAGE
LINE
51
52
53
54
55
56
57
'8
59
60
61
62
63
64
65
66
67
68
69
70
71
72
+1
73
74
75
76
77
78
79
80
81
82
83
84
8.
86
87
88
89
90
91
92
93
94
95
.6
97
98
9.
100
101
102
103
104
105
106
107
108
109
110
III
112
113
114
It.
116
lt7
118
+1
119
120
121
12.
123
124
12.
126
127
128
129
130
131
132
133
SOURCE
If
the
given
number
Ula!>
zero,
the
ASCII
string
will
contain
a
sign
and
a
single
zero
chacter.
The
value
string_size
indicates.
the
total
length
of
the
ASCII
string
including
the
sign
character.
StringeD)
will
alwal,ls
hold
the
sign.
It
is
possible
for
string_sile
to
be
less
than
field_sileo
This
occurs
for
zeroes
or
integer
values.
A
pauedo
zero
will
return
a
special
return
code.
The
denormal
count
will
indicate
the
power
of
two
original
III
associated
with
the
vlillue.
The
power
of
ten
and
ASCII
string
will
be
as
if
the
value
was
an
o'f'dinar~
lero.
This
subroutine
is
accurate
up
to
a maximum
of
18
decimal
diilits
for
integers.
Integer
values
will
have
a
decimal
power
of
zero
associated
with
them.
For
non
integers.
the
result
will
be
accurate
to
within
2
dIJcimal
digits
of
the
16th
decimal
place
(double
precision>.
The
exponentiate
instruction
is
also
used
for
scaling
thIJ
value
into
the
range
acceptable
for
the
BCD
data
t~pe.
The
rounding
mode
in
effect
on
entrv
to
the
subroutine
is
used
for
thIJ
conversion.
The
following
regist.~rs
are
not
transpart'nt:
Dt'fine
the
stack
lallout.
,
bp_save
'0·
word
ptr
[bpJ
es_save
'0·
returnJtr
'0·
power
-ptr
'0·
field_size
'0·
SileJltr
'0·
string-ptr
'0·
denormal_ptr
'0·
bp_save
+
size
bp_save
es_save
+
size
es_save
return_ptr
+
size
returnJltr
powerJltr
+
sile
power_ptr
field_size
+
size
field_sil,e
size_ptr
+
size
sizeJltr
string_ptr
+
size
stringJtr
parms_sl
ze
,
BCD_DIGITS
WORD_SIZE
BCD_SIZE
MINUS
NAN
'0·
size
power_ptr
+
!;ize
field_size
+
size
size-ptr
+
size
stringJltr
+
size
denormalJtT·
Define
constants
used
'0·
18
,
Number
of
iigits
in
bcd_value
eo·
2
'0·
10
eo·
I
,
Define
return
values
'0·
4
,
The
exact
values
chosen
here
are
INFINITY
'0.
6
important.
The\!
must
correspond
to
INDEFINITE
'0·
3
,
the
possible
return
v ..
lu
••
and
b.
in
PSUEDO_ZERO
'0·
8
the
same
numeric
order
as
tested
b~
INVALID
ZERO
DENORMAL
UNNORMAL
NORMAL
EXACT
,
status
power
_two
power
_ten
bcd_value
bcd_byte
fr.c
t i
on
con.tlD
'0·
-2
the
program.
'0·
-.
'0·
-6
'0·
-8
'0·
0
'0·
2
Define
la~out
of
temporOlr\!
storage
area.
.,.
'0·
'0·
'0·
eo·
'0·
word
ptr
tbp-WORD_SIZEl
status
- WORD_SIZE
power_two
- WORD_SIZE
tbyte
ptr
power
_ten
- BCD_SIZE
bl,lte
ptr
bcd_value
bcd_value
size
status
+
size
power_two
+
6ize
power_ten
+
size
bcd_v.lue
segment
e1"
pub
I
ic
ext1"n
power_tab
I.:
q,ward
Constant.
used
blJ
this
function.
even
d.
10
j
Optimize
for
16
bits
J
AdJustment
value
floT"
too
big
BCD
Convert
the
C3.C2.Cl.CO
encoding
fir
om
tos_stOltus
into
meaningful
bit
fllags
OInd
values.
db
UNNORMAL.
NAN.
VNNORMAl.
+ MINUS.
NAN
+ MINUS.
NORMAL.
INFINITY.
NORMAL
+ MINUS.
INFINITY
+ MINUS.
ZERO, INVAl.lD.
ZERO
+ MINUS, INVALID,
DENORMAL,
INVALID,
OENORMAL
+ MINUS. INVALID
Figure 4-6. Floating-Point
to
ASCII Conversion Routine (Cont'd.)
4-8