Therefore.
we
must borrow from AH to increase the value of AL
so
that the
difference will be positive.
Lines 1070 to 1090 borrow from AH and increase AL
before
BL
is
subtracted from AL:
1070
IF
AL~=BL
THEN
1100
1080
AL=AL+10t"F
1090
AH=AH-1
If AL
is
larger than
BL
we
bypass 10S0 and 1090 and
jump
directly to the
subtraction. But
if
BL
is
larger than AL
we
must borrow a one million value from
AH to increase the value of AL:
-1
AHlxxxxxlxl
-BH~
CHlxxxxxx\
----,
+1000000
ALI
1
xxxxxxj
-BL~
CL
jxxxxxxl
A ten
is
added to the leftmost
digit
of AL. The easiest way to add the ten in
the correct position
is
to raise 10 to the Fth power.
AL=AL+10fF
ln our sample program. AL
is
smaller than
BL.
as
tested in line 1070.
AL/~7B90
121
< BLlii9435
721
Therefore we must borrow 1000000 (101F=101 6 = 1000000) from AH to
increase the value of AL:
1080
AL=AL+10"tF
AL=AL+1üf6
AL
=AL
+ 1000000
AL=~+
1000000
AL=117890121
After
AL
is
increased. AH must
be
decremented by
1.
since
we
borrowed
from
it.
1090
AH=AH-1
AH-I~1234561
~ffi]
AH-I~1234551
Once AH. AL.
BH.
and
BL
have been set up properly. the subtraction of the
segments takes place. CL$
is
the difference between AL and
BL.
and CH$
is
the
difference between AH and
BH.
Lines 1100 through 1102 determine
CL$.
Line 1000 changes the integer
value of AL
-BL
into string form.
1100
CL$=STR$(INT(AL-BL))
C
L$
=STR$
(~1
78901 2-
~9435
72)
CL$=STR$(~845340)
CL$=~345540
210