[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on ProDOS SmartPort drive remapping
Michael J. Mahon wrote:
(snip, I wrote)
I do remember that IBM preferred the end test DO loop, such
that many believe that Fortran 66 requires it. It doesn't,
but it does allow it. (Technically, a loop with the end
value less than the start value is not legal.)
I don't know about FORTRAN 66, but the standard for FORTRAN
always used to be that a DO loop body executed at least one
time--meaning test at the end.
Well, 66 was the first ANSI standard. Before that, it was
whatever IBM said it was, which changed along the way.
At least for the 704 index registers, it was a test at the
end, so at least once.
Of course, the original code the Digitek compiler generated
also tested at the end--it just didn't require jockying the
registers around to make BXLE happy, and didn't require getting
the increment into a register.
BXLE was a misguided attempt to close the "semantic gap" between
high level languages (which FORTRAN actually isn't) and machine
language. If if was natural to use BXLE (Branch on indeX Less
than or Equal), fine, but to require that a third-part compiler
use it for every DO loop was evidence of comical misunderstanding.
This reminds me of some tests someone did not so long ago on current
machine, using both BXH and BXLE, and both at the beginning and end
of loops. It seems that there is a big speed difference, due to
branch prediction assuming branch taken for BXLE and branch not taken
for BXH.
Digitek compilers were very portable, requiring only three
interfaces to the OS: read a line, print a line, and write
a buffer of code.
Both G and H use the same runtime library. The G compiler
has an interesting debug feature that H doesn't have, that allows
putting debug statements at the end, in a debug packet, but
to have the effect of inserting them into other parts of the
program.
I'd forgotten about the debug packet. ;-) That was handled
entirely by the compiler and runtime, IIRC.
The FORTRAN runtime consists of two main parts: the math library,
much of which is often written in FORTRAN, and the FORTRAN I/O
library (co-routines, actually) which are a major chunk of code
that cannot be written in FORTRAN, and so is usually in assembler.
I believe all the math library is in assembly. The source is
available. Actually, it was some of the sample code I used when
learning S/360 assembler 30 years ago. (Second year high school.)
There is even self modifying code in the math library!
The FORMAT statement was a real timesaver for programmers, but a
real bear to interpret at runtime, with its implied DO loops, etc.
One of the later changes to G and H (maybe only H) was to do implied
DO loops inside the library routine. Previously they were generated
as real loops in the compiled code. One had to be careful not to
use an older library with newer code after that change.
-- glen