As one of old fogey
refers to, I can tell a little about the environment you had approximately 25 years ago.Mainframe
computers had something like four megs of memory - everything else had memory measured in kilobytes. They were still doing time-sharing
, batch processing
and sometimes even real time processing
at the same time. There were also things you would now call embedded systems - Nuclear Dynamics
offered data sampling devices driven by a DEC PDP-11
. Due to the lack of resources and the time constraints, those were often programmed in assembler for (mostly) sheer lack of space.
Still - anything bigger was mostly programmed in the high-level languages of that time. FORTRAN
were very much in use, so was PL/I
When would you use Assembler
? (Mind you - well-documented at that time...)
Answer: When you had to. When you did something that could not be done i.e. in FORTRAN. Operating system calls are one example, device access another one. Maybe - but rarely - the most time-consuming computing loop inside a program, but it needed a skillful assembler programmer to really be faster than a good compiler.
The difference to today was that almost everybody capable of programming would know a couple of assemblers, but would use assembler as a last resort only.
What - you may ask - did they use to write operating systems ?
Three kinds of languages were used. Assembler for the kernel (same with Linux). High-level stuff in high-level languages (the IBM FORTRAN IV compiler was written in FORTRAN IV with some Assembler subroutines). Plus - the layers next to the kernel were written in something called a medium-level language. Such beasts existed for almost every platform - there was PL/M for 8080 and Z-80 systems, NPL was the language of choice if you worked on Norsk Data machines. IBM had their medium level language (the name escapes me) and Siemens would use SPL.
Those languages would hide assembler in something a little more complex than just macros - you would have varible declarations, control structures and other stuff to make life more comfortable and your code more readable. Still - the output would be Assembler. Those beasts made the use of "pure" Assembler more or less useless, which means that you would have one routine in Assembler versus about 20 in NPL - if they weren't put in inline code.
IBM wrote their OS for a machine with 8 kilobytes of memory at first. Using Assembler, as there was nothing else. This OS turned into a nightmare to maintain. Program changes (patches) were sent to customers as lists of binary address/new value lists. Imagine getting a patch for your fave operating system containing of 20 pages of "In file foo, change location 2837FE23 from 2E to 7A".
(Okay - this stuff was common well into the 80s...)
Every serious programmer should still know Assembler, but be wise enough to know when and when not to use it.