FORTRAN 77 on PDP-11

Johnny Billquist bqt at Update.UU.SE
Fri Jul 29 11:16:22 CDT 2005


On Fri, 29 Jul 2005 "Jerome H. Fine" <jhfinexgs2 at compsys.to> wrote:

>  >Sean 'Captain Napalm' Conner wrote:
>
> >>It was thus said that the Great Jerome H. Fine once stated:
> >
> >>For the PDP-11, I tend to understand that MUL is only for signed
> >>16 bit numbers, so I don't think MUL can be useful with unsigned
> >>values which are required for a 64 bit multiple as per the above
> >>example.
> >>
> >>CAN  SOMEONE  PLEASE  CORRECT  ME  IF  I  AM WRONG???
> >>
> >Easy enough method---just multiply the absolute values and record the
> >signs prior to multiplication, then reset the sign afterwards to the correct
> >value.
> >
> That is too easy a solution - anything a bit more difficult?
>
> More seriously, if I am using all 16 bits as unsigned integers, then
> the high order bit can't be easily eliminated.

True. And if you don't use all 16 bits, then the MUL instruction deals
with the sign itself anyway, so there is no need to take absolute values
and so on either... In short, a good suggestion in theory, but one that
don't work in real life.

But of course you still haven't reflected on the fact that in FORTRAN-77
you can do 32-bit integer multiplication already...

>  Of course another
> method is to keep all the values below 10,000 decimal which
> can then allow me to use FORTRAN much more easily.  But
> I really prefer to use the full 64 bits.

What 64 bits??? Native integers are 16 bits. You also happen to have
32-bit integers in FORTRAN, but there aren't any 64-bit integers. You have
64-bit entities for REAL*8, but they don't hold 64 bits of mantissa, apart
from the rounding errors always expose yourself to when using FP.

>  On the other hand, if I
> use the sieve method to find the primes, I don't need either
> multiplication or division, just 64 bit adding and 64 bit compares,
> probably increments by 2 and 4 and of course conversion of
> 64 bit values to decimal output.  The last can also be done by
> repeated subtraction of powers of 10, so again no division.

Why use the sieve? Unless you have lots of memory, and are trying to list
every prime you can find, it's pretty inefficient. And you don't have lots
of memory in a PDP-11. Assuming you represent every odd number with one
bit (no need for the even ones), and assuming that you can stuff an array
of 50Kbytes, that will still only give you primes less than 400.000.
Absolutely no problem representing that in a 32-bit integer.

I'd go for a simple factorization instead, if you want to search for
larger primes. And then you need division and remainder.

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt at update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the cctalk mailing list