FORTRAN 77 on PDP-11
Jerome H. Fine
jhfinexgs2 at compsys.to
Sat Jul 30 20:53:04 CDT 2005
Johnny Billquist wrote:
>>Jerome H. Fine wrote:
>>As for endian issues, I can define the most significant word to be
>>at either end, but I tend to think that I will place the most significant
>>at the high end of the word since this allows FORTRAN 77 to use
>>octal to output the value correctly with 64 bit floating point values.
>??? Not sure what you actually say here. Floating point values hardly have
>anything to do with this. Pick whatever byte order you want, and stick
>with it. Output is something you'll have to figure out anyway, and you
>deal with any byte order you decided on then. Either way is not that
>difficult. However, I'd recommend using little-endian, since that is the
>"natural" order of the PDP-11, and F77 on the machine. That means you can
>let it deal with 16-bit quantities natively without having to to byte
Jerome Fine replies:
Please define little-endian and big endian.
Also, I should have explained what I meant! Specifically,
it should be possible to use floating point variables
as arguments to subroutines and let FORTRAN 77 take
care of allocating the actual storage by doing so:
1000 FORMAT ( O25, O25 )
REAL * 8 Value1, Value2
CALL I64ADD ( Value1, Value2 )
TYPE 1000, Value1, Value2
This could be the code to add two 64 bit unsigned integers
with the names of Value1 and Value2 which each occupy
64 bits. Of course, I could also use:
INTEGER * 2 I2Val1 ( 4 ), I2Val2 ( 4 )
EQUIVALENCE ( Value1, I2Val1 ), ( Value2, I2Val2 )
but "REAL * 8" also allows the output in octal as a
single 64 bit value which is quite convenient and allows
me to use a single index when I need a vector of values.
If I am correct, the above code assumes that the low order
words/bytes are the least significant and the high order
words/bytes are the most significant. Is this little-endian
NOTE that if the most significant bit is in the most
significant word and byte (as per the above MACRO-11
subroutine), then the most significant of everything
is in the highest address of everything. HOWEVER, from
looking at the order of bytes, words and bits in the
PDP-11 manual (Chapter 10 of Microcomputer Processor
Handbook), when the most significant bit is in the
word with the lowest address, the most significant
bit (actually the sign bit and the exponent of real
floating point numbers) is in byte 1 rather than byte 0.
This is not a problem per say within FORTRAN 77 as it
clearly knows about these endian issues, but I found it
a bit confusing at first until I realized that the
bytes seemed to be interchanged within each word when
the most significant bit is defined to be in word 0.
On the other hand, if the most significant bit is in
the byte and word with the highest address, then in
FORTRAN 77 under RT-11, outputting Value1 in octal
with this order of significance shows a 64 bit octal
value with the most significant bit on the left and
the least significant on the right.
Can you please comment on the endian question?
Also, am I correct about octal output of Value1?
Thank you for your comments and any answers!
If you attempted to send a reply and the original e-mail
address has been discontinued due a high volume of junk
e-mail, then the semi-permanent e-mail address can be
obtained by replacing the four characters preceding the
'at' with the four digits of the current year.
More information about the cctalk