Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.space.policy > #57046

Re: Apollo 11 source code released

From Niklas Holsti <niklas.holsti@tidorum.invalid>
Newsgroups sci.space.policy
Subject Re: Apollo 11 source code released
Date 2016-07-18 09:20 +0300
Organization Tidorum Ltd
Message-ID <dv3ap3F1pniU1@mid.individual.net> (permalink)
References (9 earlier) <dune04F6p46U1@mid.individual.net> <200eob9fi8bb0fcuct3hg17vepcr910olv@4ax.com> <MPG.31f1371b1ceb9c7f9897a0@news.eternal-september.org> <dut0rcFhnnhU1@mid.individual.net> <578ba8f6$0$55814$c3e8da3$33881b6a@news.astraweb.com>

Show all headers | View raw


On 16-07-17 18:49 , JF Mezei wrote:
> On 2016-07-15 16:54, Niklas Holsti wrote:
>
>> No you don't. Compilers are used routinely to create code for machines
>> with tiny or small amounts of RAM. As long as you avoid using the heap
>> (and, if necessary, tell the compiler not to use the heap implicitly),
>
> Whether heap is used or not depends on compiler. Older compilers likely
> had statically allocated data structures. C did not exist when Apollo
> first flew.

The classical languages -- Fortran, Algol, Pascal, Modula, C -- are 
designed so that the compiler does not need to use implicit heap 
allocation in the generated code. Heap allocation is used only if the 
source code says so pretty explicitly.

But you are right that some languages are such that the compiled code is 
likely to use, or even required to use heap allocation -- Java comes to 
mind. I did not mean to say that no compilers use implicit heap 
allocation, so my wording could have been better. But even in Java there 
are ways to reduce or avoid heap allocations -- the "real-time" Java 
extensions.

>> code fits. But these cases are very rare today -- compilers for embedded
>> systems can do astonishing optimizations to save on RAM, things an
>> assembly-language programmer would almost never dare do because they
>> would be too difficult to maintain as the SW evolves.
>
> Apart from optimizing variables away (such as a variable used as a loop
> counter which ends up being used in a register only), what sort of other
> memory saving techniques exist ?

The Keil compiler for the Intel-8051 architecture has the following 
feature (which may also exist in other compilers for all I know).

Like the AGC, the basic 8051 is weak at indirect addressing -- general 
register-based indirect addressing and the HW stack are available only 
in the 128 or 256 byte (yes, byte!) "internal" memory, and the larger 
"external" memory can be addressed indirectly only by one dedicated 
register. Therefore, compilers for the 8051 typically allocate memory 
locations statically for most subroutine parameters and local variables 
(assuming that subroutines are not recursive).

The Keil compiler inspects the whole call-tree, finds out which 
subroutines cannot be active at the same time, and makes those 
subroutines share the same memory locations for their data. For example, 
if subroutine A never calls subroutine B, directly or indirectly, and B 
never calls A, directly or indirectly, then the parameters and variables 
of A and B can be placed in the same memory locations -- when A needs 
them, B does not, and vice versa.

But this global knowledge of the call-tree is something that few 
programmers could keep in their heads, for largish programs. And the 
manual work of either overlaying or separating the data for two 
subroutines, as the call-tree changes during program evolution, would be 
costly and error-prone.

> Also, when you write embedded code with avrous hardware attachements,
> you may not want the compiler to optimize away your variables as the
> storage may have to be reserved at specific addresses for communications
> with devices. (DMA etc).

Languages have features like "volatile" for that. Not a problem.

>> I don't know whether a useful compiler could have been created for the
>> AGC SW. At that time, assembly-language programming was the default
>> choice for embedded systems,
>
> Did programmed embeded devices exist at that time ? or was the moon shot
> the catalyst to develop such computers Considering the memory and
> performance constraints, Assembler may have been the only solution.

The 1960's was the decade that invented the minicomputer, although the 
early ones were only "mini" in comparison with the mainframes. Looking 
only at some examples that were available for the public, we have the 
Elliot 803 in 1960 (https://en.wikipedia.org/wiki/Elliott_803), the LINC 
in 1962 (https://en.wikipedia.org/wiki/LINC), the Bull Gamma M-40 in 
1964 (http://www.feb-patrimoine.com/histoire/english/gamma_m40.htm), and 
of course the PDP series with the PDP-8 in 1965 
(https://en.wikipedia.org/wiki/PDP-8).

The AGC was remarkable in being small, rugged, and dedicated to a single 
application with most of the code in ROM. I would assume that similar 
computers were used in military applications, before and after Apollo.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

Back to sci.space.policy | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-10 12:43 -0400
  Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-10 20:33 +0300
    Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-10 18:28 -0400
      Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-10 21:27 -0400
      Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-11 00:36 -0700
        Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-11 06:44 -0400
          Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-11 16:20 +0300
            Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-11 20:53 -0400
              Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-12 14:36 -0400
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-12 18:11 -0700
              Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-12 23:37 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-12 18:14 -0700
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-13 21:01 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-13 20:06 -0700
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-14 06:44 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-15 23:54 +0300
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-17 11:49 -0400
                Re: Apollo 11 source code released William Mook <mokmedical@gmail.com> - 2016-07-17 18:41 -0700
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-18 09:20 +0300
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-14 11:38 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-16 00:10 +0300
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-15 22:26 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-20 10:49 -0700
              Re: Apollo 11 source code released Snidely <snidely.too@gmail.com> - 2016-07-14 09:12 -0700
          Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-11 11:51 -0400
            Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-12 02:19 +0300
              Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-11 20:58 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-12 09:24 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-12 10:10 -0700
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-13 21:07 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-13 20:08 -0700
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-14 11:25 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-15 22:39 +0300
                Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-20 10:40 -0700
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-12 14:41 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-12 23:26 +0300
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-12 21:41 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-13 08:54 +0300
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-13 06:43 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-13 21:08 +0300
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-14 11:34 -0400
                Re: Apollo 11 source code released Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-07-15 23:06 +0300
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-15 19:48 -0400
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-15 19:59 -0400
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-17 12:00 -0400
                Re: Apollo 11 source code released Jeff Findley <jfindley@cinci.nospam.rr.com> - 2016-07-17 12:14 -0400
                Re: Apollo 11 source code released JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-07-17 12:56 -0400
              Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-12 10:04 -0700
            Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-12 09:43 -0700
          Re: Apollo 11 source code released Alain Fournier <alain245@videotron.ca> - 2016-07-11 19:43 -0400
  Re: Apollo 11 source code released Fred J. McCall <fjmccall@gmail.com> - 2016-07-10 11:39 -0700
  Re: Apollo 11 source code released William Mook <mokmedical@gmail.com> - 2016-07-11 18:28 -0700

csiph-web