Commodore PET User Manual page 230

Table of Contents

Advertisement

The routine above divides A$ into AH and AL (4 digits) and B$ into BH and
BL (4 digits):
A$19191919191919191
1
\
AHI91919191
ALI91919191
Step 3: Multiply
AH. Al. BH.
and
Bl
into four product strings: P1$,
P2$, P3$. and P4$. The rules of algebraic multiplication multiply each variable as
if it were a single number. A$ and B$ are multiplied as follows:
381~
x@jJ
lêII
Think of A$ and B$ as two sets of 4-digit numbers (H and
U
joined in the middle.
and not as eight individual digits: A$ is not eight 9s. but two sets of four 9s each.
Thus AL and BL are multiplied as:
AL 199991
xBL
~
Multiplying A$ and B$ is a four-step process. To begin. multiply BL
x
AL:
~
ffihY
and then BL
x
AH:
Next. move over to BH and multiply BH by AL:
~
BH
and finally BH
x
AH:
~
'-00
When the PET multiplies BL
x
AL. etc., it internally multiplies the values of
BL and AL. Consequently. the 4-digit values of BL and AL are multiplied together.
producing the 8-digit product P1. Below is the four-step process:
l68J
:?~[g)
~
ŒbJçrm
Œ1J
x@D
BL
x
1§8]
'1ii
x~ŒJ
ffi8J
00
Pl$
Pl$
Pl$
Pl$
P2$
P2$
P2$
P3$
P3$
P4$
2
3
4
217

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents