User's Manual

iAPX286
MACRO
ASSEMBLER
LOC
ODJ
0153
B9040F
0156
BBOI00
0159
BD7EOC
DISC
BCDS
015E
eEeD
0160
Fe
0161
B02B
0163
F6(:201
0166
7402
0168
802D
016A
016A
AA
0168
BOE2FE
016E
98
016F
016F
BA62FO
0172
BAC4
0174
D2EB
0176
22C5
0178
7516
017A
BAC4
al7e
22C5
017E
7518
0180
4E
0181
79EC
0183 0030
0185
AA
01B6
43
0187
EU6
0189
0189
BA62FO
alBC
8AC4
018E
02E8
0190
0190 0430
0192
AA
0193
BAC4
0195
22C5
0197
43
0198
0198
0430
Ol9A
AA
0198
43
019C
4E
019D
79EA
019F
019F
BB7EaA
01A2
891D
VIA
..
aa\..,:
01A6
E9BOFE
NUMERIC PROGRAMMING EXAMPLES
80287
Floatlnll-Paint
to
IS-Digit
ASCII
Conve,.si!)"
10: 12:
38
09/25/83
PAQE
LINE
416
417
418
419
4.0
421
4.2
423
424
4
••
426
4.7
4.B
429
430
431
43.
433
434
4,.
430
437
438
439
440
441
44.
443
444
44.
440
447
448
449
••
0
451
4.2
4""
4'4
...
..
0
457
458
459
400
401
40.
40'
40.
'05
400
407
46B
469
70
.71
.7.
47'
474
'75
.70
'77
.7B
.79
'BO
481
4B.
4B,
4B4
4B5
.80
4B7
4BB
489
490
491
49.
49'
494
495
496
497
49B
..
;r;;
500
001
50.
50'
504
SOURCE
mov
cld
cx.Of04h
bll,l
di.
~trinIlJt,.
ax.
ds
mov
..
I,
'+'
tnt
dl.I1INUS
JI
positive_result
al.
'-'
posi
tive_resul
t:
stosb
.and
dl.
not
MINUS
flilait
Remove
leading
,
sk
ip_l
e
..
di
ng_1
erolt.:
mo.
.hr
and
JU
mo.
and
JU
ah.
bed_buteCsil
a!.
ah
0111.
cl
0111.
eh
enter
_odd
0111.
ah
al,
eh
ente1'
_even
5i
ah:
al:
I
Set
shift
count
.nd
mlillsk
S.t
initial
sin
of
ASCII
.hld
for
aign
Get
..
ddre
..
of
start
of
ASCII
string
I CoPu
ds
to
es
Set
..
utoinere.ent
mode
I C
....
r
sign
fhld
Look
'or
ne.ative
v
..
lue
I Bump
string
pointer
past
sign
I
Turn
off
sign
bit
I
W,.it
for
fbstp
to
finish
BCD
byte
value
in
use
ASCII
character
v.alue
dx:
Return
value
eh:
BCD
mask.
Ofh
c1:
BCD
shift
count.
4
bx:
ASCII
string
field
width
si:
BCD
field
index
di:
ASCII
strihg
field
pointer
ds
••
s:
ASCII
string
segment
ba.e
from
the
number.
I
get
BCD
byte
Cop"
value
I
Get
high
ordar
digit
I
Set
lero
flag
Exit
loop
if
leading
non
ze1'O
found
Get
BCD
bute
again
Get
low
order
digit
Exit
loop
if
non
IBro
digit
found
I
Decrlment
BCD
indu
dec
Jno
skip_lead
ing_IB1'oes
The
significand
lIIas
all
mov
al.
'0'
I
Set
initial
stosb
inc
bx
Bump
st1'ing
length
Jmp
short
exit_1II1th_value
NOIII
elpand
the
BCD
stTing
into
digit
per
byte
values
0-9
.
mo.
ah.
bcd_byte[siJ
Get
BCD
tU,Ite
mov
0111.
ah
'hr
0111.
cl
get
high
order
digit
enter
_odd:
add
al.
'0'
,
Convert
to
ASCII
stosb
Put
digit
into
ASCII
string
mo.
0111.
ah
Get
10.
order
digit
and
al,
ch
inc
b,
Dump
field
size
counte"
enter
_even:
add
011.
'0'
Convert
to
ASCII
stosb
Put
digit
into
ASCI I
area
inc
b,
Dump
field
size
counter
dec
.,
00
to
next
DCD
byte
In.
digit_loop
Conversion
complete.
Set
the
string
size
IillJld
remainder.
,
ex
it_lilith_value:
6i.slzeJtr
lIIoT'd
ptr
[dil,
bx
..
"'.;,,
Jmp
ex
i
tJroc
floating_to_
...
cii
endp
code
ends
end
ASSEMIILY··COMPLETE.
NO
·WARNINGS.
NO
ERRORS
Figure 4-6. Floating-Point
to
ASCII Conversion Routine (Cont'd.)
4-12