[Simh] Assembler programming under Unix - was VAX/VMS

Paul Koning paulkoning at comcast.net
Mon Feb 15 16:37:42 EST 2016


> On Feb 15, 2016, at 4:30 PM, Kevin Handy <khandy21yo at gmail.com> wrote:
> 
> Any more, with the optimizing compilers we have today, it doesn't make much sense to use machine language for most program development.
> 1. The compilers often produce better code that the average programmer would produce, and often better than a good one would produce. The optimizer doesn't care about making readable code, so it can do aggressive things to the code that a human wouldn't wnt to. LLVM is even working with optimizations across compilation units.
> 2. Portability issues. If you write in machine language on a VAX/VMS, that is all it will run on. Porting it to VAX/Unix
>  might be possible, put with the differing system interfaces, not easy.
> 3. Ease of development. Developing in a higher level language is usually faster than in a machine language environment. It is also often easier for others to quickly comprehend. One line in high level code, "a=b*c+d*e", verses numerous lines of assembly code.
> 4. What do you do if your platform suddenly gets new opcodes. This happened with the Alpha, Intel x86, and many others. Update your code, or leave it the same so it can still run on older hardware?
> 
> There are some places where hand-coded machine code is useful, but its use isn't as necessary as it used to be. It can be interesting to know some of the details.

All those are good points.  You could even state #1 more strongly as "average programmers should not do assembly programming at all".  And a lot of these things have been true for a long time.

That said, assembly programming is interesting.  For a hobbyist it makes perfectly good sense to do it even if by all the reasons you stated it would be the wrong answer for a "real program".  For one thing, you will learn things about the machine that were only theoretical facts so long as all you did was read documentation.

Or to put it differently: if you're going to do assembly programming (for fun or for serious work) your first job is to understand the machine internals, in detail.  For serious work, you're not qualified until you've completed that study.  For example, if you're writing MIPS or Alpha code (at least if it's for performance) and you cannot explain, in chapter and verse, how the CPU pipeline, functional units, and result bypasses (if any) work, you're not ready for the job.

	paul



More information about the Simh mailing list