iAPX286
MACRO
ASSEMBLER
LOC
DB..}
0012
0012
EBOODO
0015
81308
0017
2EBAB70200
ODIC
3CFE
ODIE
7528
0020
C20AOO
0023
0023
ODDS
0025
EB02
0027
0027
BOFE
0029
0029
C9
002A
07
00213 C20AOO
002E
002E
DI37EFO
0031
A801
0033
98
0034
74F3
0086
DBDoeo
0039
285EF6
003C
OBSEF4
003F
OB5EF2
0042
OB5EFO
0045
75E2
0047
B003
0049
EBDE
0048
0048
06
004C
eS100aoo
0050
884EOB
0053
B3F902
0056
7CCF
0058
49
0059
83F912
Dose
7603
DOSE
B91200
OD61
0061
3C06
0063
?DBE
0065
3C04
0067
7DCS
0069
D9El
006B
8800
0060
33CO
006F
8B7EOE
0072
8905
0074
BB5E06
0077
8907
0079
eOFAFC
007C
7828
D07E
SOFAFA
0081
732C
NUMERIC PROGRAMMING EXAMPLES
80287
Floating-Point
to
18-Dig.it
ASCII
Conversion
10:
12:
38
09/25/83
PAGE
LINE
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
17.
177
178
179
180
181
182
183
184
185
18.
187
188
189
190
191
192
193
19'
195
19.
197
198
199
200
201
202
203
204
205
20.
207
208
209
210
211
212
213
21.
215
21.
217
218
219
220
221
222
223
22.
225
226
227
SOURCE
call
tos_status
b
1,
ax
a1,status_table[bx]
OIL
INVALID
Look
at
status
of
ST(O)
Get
descriptor
frOm
table
Look
for
empty
STeO)
ST(O)
is
empty!
Return
the
status
value.
RE'move
infinity
from
stack
and
exit.
fstp
Jm,
st
(0)
short
exit_proc
;
OK
to
leave
fstp
running
String
space
is
too
small!
Return
invalld
code
OIL
INVALID
leave
i
RestorE.'
stack
pop
es
ret
parms_size
ST(O)
is
NAN
or
indefinite.
Store
the
value
in
memory
and
look
at
the
fraction
field
to
separate
indefinite
from
an
ordinary
NAN.
fstp
fraction
test
ai,
MINUS
fwait
JZ
exit.JIroc
mov
bx.OCOOOH
sub
bx.word
ptr
fraction+6
bx.
word
ptr
fraction+4
bx.
word
ptr
fraction+2
or
bx.
word
ptr
fraction
Jnz
9xit..JH·OC
al,
INDEFINITE
Jmp
exit.JIroc
Remove
value
from
stack
for
examination
Look
at
sign
bit
Insure
stoT'e
is
done
Can't
be
indefinite
if
positive
Match
against
upper
16
bits·
of
fraction
CompaT'e
bits
63-48
Bits
32-47
must
be
zero
Bits,l'31-16
must
be
zero
Bits
15-0
must
be
zero
Set
return
value
for
indefinite
value
Allocate
stack
space
for
local
variables
and
establish
parameter
addressibility.
not_empty:
size_ok:
push
"
enter
10cal_size.O
mov
cx.
field_size
<m,
cx.2
Jl
small_string
do<
"
<m,
c x.
BCD_DIGITS
J"
size_ok
c
x.
BCD_DIGITS
<m,
aI.
INFINITY
".
found_i
nfi
n i
ty
<m,
al.
NAN
JO'
NAN_or
_indefinite
Save
working
register
FOT'mat
stOiC
II
Check
for
enough
string
space
AdJust
for
sign
character
See
if
string
is
too
large
for
BCD
Else
set
maximum
string
size
Look
for
infinity
Return
status
value
for
+
or
-
inf,
Look
for
NAN
or
INDEFINITE
Set
default
return
values
and
check
that
the
number
is
normalized.
mov
mov
<m,
J.'
<m,
J
••
dx.
ax
ax.
ax
di.
denormal.JItr
word
ptr
[di.:J,
ax
bx.
power
.JItr
word
ptr
[bx].
ax
dl.
ZERO
real_zero
dl.
DENORMAL
found_denormal
Use
positive
value
onll,l
sign
bit
in
011
has
true
sign
of
value
Save
retuT'n
value
for
later
Form
a
constant
Zero
denormal
count
Zero
power
of
ten
value
Test
for
zero
Skip
power
code
if
value
is
Look
for
a
denormal
value
Handle
it
specially
Figure
4-6.
Floating-Point
to
ASCII
Conversion
Routine
(Cont'd.)
4-9