FORTRAN 77 on PDP-11

der Mouse mouse at Rodents.Montreal.QC.CA
Fri Jul 29 11:47:36 CDT 2005


>> 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???

You're right and you're wrong. :-)

If you're doing a 16*16->16 multiply, it doesn't matter whether it's
signed or not, except for detecting overflow.

If you're doing a 16*16->32 multiply, the difference between signed and
unsigned is the high half of the result.  To figure details, consider,
for example, A*B where A is in the "problematic" range (32768..65535).
You want A*B; the instruction will give you (A-65536)*B = A*B - 65536*B.

Come to think of it, I think the code I posted earlier using EMUL to do
extended-precision multiplication is wrong for this reason; as I read
the VARM, EMUL does a signed multiply-and-add....

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


More information about the cctalk mailing list