EasyManua.ls Logo

Commodore PET - Page 235

Commodore PET
447 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
[68][Ej
x
ŒBJ
l]g
IP1$1}
+em:J
+1
P3$1}
+1
P4$!
To add P3$
and
P4$ together. the values of P3$ and P4$
are
passed to the
parameters A$ and
B$
before calling the addition subroutine 2000:
1132
A$=P3$:B$=P4$:GOSUB
2000
A$
1919191810101010)01010101
B$
191919181010101110101010101010101
The addition subroutine adds the corresponding digits of
P3$
and
P4$.
truncates
any leading
zeros.
and returns sum
C$
to the main program. where
C$
is
con-
verted to M2$:
1135
M2$=C$
At
this point. M1$
is
the sum of P1$ and
P2$.
and M2$
is
the sum of P3$
and
P4$.
To get the sum of ail four products. M1$ and
M2$
must
be
added
together:
+~
1
c$1
The addition subroutine
is
called a third time to add M 1$ and
M2$
together
to get the final answer.
C$.
1140
A$=Ml$:B$=M2$
A$
1919191819191919)01010/11
B$
191919181919191910101011101010101
1150
OOSUB
2000
222

Table of Contents

Related product manuals