# Is there (was there ever?) serious programming being done in machine code?

**URL:** <https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343>\
**Category:** Factual Questions\
**Created:** [March 6, 2021, 6:19pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343 "2021-03-06T18:19:50Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [March 6, 2021, 9:34pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/21 "2021-03-06T21:34:45Z")

</div>

> [@Morgyn](#):
>
> Well, there’s always Mel Kaye, [who wrote machine code programs in hexadecimal](https://jamesseibel.com/the-story-of-mel/) back in the 50s/60s. It sounds to me like all the programmers at Royal McBee Computer Company did, he was just especially good at it.

I learned to program in high school on an LGP-21, which was the transistorized version of the LGP-30 in that story. My first programs were in machine code - then I wrote a simple assembler to be able to use labels, not hex addresses, for jumps.  
It turns out that my first PhD adviser probably wrote the world’s first assembler. He was a student of von Neumann’s at both Princeton and IAS, and wrote it for the IAS machine. He told me that von Neumann thought it was a waste of time.  
Now, to me machine language is a high level language, because I did my PhD research in microprogramming.

> **[Microprogramming | Definition & Facts](https://www.britannica.com/technology/microprogramming)**
>
> Microprogramming, process of writing microcode for a microprocessor. Microcode is low-level code that defines how a microprocessor should function when it executes machine-language instructions. Typically, one machine-language instruction translates...

Machine instructions were implemented by microcode routines. We had a microprogrammable Lockheed SUE minicomputer (used as the first IMP for the early Internet) and I wrote an emulator for the LGP21 which I ran on the SUE microcode simulator which was originally in PDP-11 assembler language. I rewrote it in Pascal for my research.  
And one company, called Nanodata, invented nanocode which you used to emulate microinstructions. Never took off. One of my oral questions was about picocode. I said it was a bad idea which is what they were looking for.  
It was all a lot more fun than coding in C or Python.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [March 6, 2021, 9:39pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/22 "2021-03-06T21:39:33Z")

</div>

> [@Francis\_Vaughan](#):
>
> Back in the day, I know people who were so familiar with the Cyber 6600 series machines that they could and did directly write short snippets of machine code directly into memory without any reference material.

If you didn’t have a linking loader - like our PDP-11, then symbolic addresses got assigned absolute ones.  
One of our PDP-11s had the bootstrap routine in ROM. The other didn’t and we all memorized it and entered it through the front panel switches. Good times!

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [March 6, 2021, 9:42pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/23 "2021-03-06T21:42:35Z")

</div>

> [@Mijin](#):
>
> I think it’s one of those distinction without a difference things.
> 
> I mean, let’s say I wanted to copy a value from register 1 to 2 and the machine instruction to do this is value 01001110, or, say, CPW in assembler.  
> I’m going to probably need to have the reference manual or a crib sheet next to me that tells me CPW = 01001110. So what’s the important qualitative difference between me typing in that binary value versus typing “CPW”, apart from the former including more busywork?
> 
> Or, sans sheet, is it a memorization game?

On our LGP21, the opcode for a Bring instruction was the last four bits of a “B” (non-ASCII). So typing instructions was not that hard. What killed you was when you wanted to insert a new instruction in the code. Since jump addresses were absolute, that meant you had to go and revise all of them. Or, what I did, insert a jump to the new code after the end of the existing code, execute it. and then jump back.  
Having an assembler with symbolic destination addresses fixed all that.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [March 6, 2021, 9:45pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/24 "2021-03-06T21:45:48Z")

</div>

> [@Mijin](#):
>
> I think it’s one of those distinction without a difference things.

The difference is in what ‘programming’ may mean. If code is designed at the assembly level and then manually assembled to produce the machine code that’s not programming, it’s just manual assembling and entry of the object code. If you do consider that to be programming then people do program in machine code.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [March 6, 2021, 9:47pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/25 "2021-03-06T21:47:32Z")

</div>

> [@Francis\_Vaughan](#):
>
> There is a critical difference between assembly code and machine code. An assembler will present addresses as abstract entities and as part of its operation will back patch target addresses. So you don’t code the targets of jump instructions as hard values but as a simple symbolic offset.

Ah, right - I agree that is an important distinction.

If a person writes assembly language on paper, without the aid of an assembler program, and translates it manually into machine code, would you call all of that ‘programming in machine code’ or ‘programming in assembly language’? Is there a difference in this context?

---

<div class="post-metadata">

**Author:** ![msmith537](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@msmith537](https://boards.straightdope.com/u/msmith537)\
**Post date:** [March 6, 2021, 9:49pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/26 "2021-03-06T21:49:50Z")

</div>

> [@Joey\_P](#):
>
> I don’t know if any one regularly uses it these days (I assume C is the most common), but I learned it back in high school. In a world of BASIC, Assembly gave you a whole lot more power and a better working knowledge of what the computer’s doing internally WRT to registers and Interrupt/ESC codes. It also forced us to learn hex and binary.  
> IIRC, by final project for my AP Comp Sci class was doing a screen dump to a color printer in assembly (essentially, writing a print driver), watta a fucking pain in the ass that was.

How do they create BASIC? Or FORTRAN, COBOL, C++, Python, Spark, or any other computer language for that matter? I assume they don’t write BASIC using BASIC.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [March 6, 2021, 9:56pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/27 "2021-03-06T21:56:16Z")

</div>

> [@msmith537](#):
>
> How do they create BASIC? Or FORTRAN, COBOL, C++, Python, Spark, or any other computer language for that matter? I assume they don’t write BASIC using BASIC.

You can write BASIC in BASIC. It’s a good measure of the completeness of a language that it can compile itself. Many modern languages have been written in themselves, or other high level languages. Compilers create object code through a series of steps, which at the bottom level is machine code. The steps may include producing assembler code which is assembled externally. It’s a lot more complex than that in a variety of ways, but any complete language can produce the same results as produced by any other language.

The process of bootstrapping languages can be quite easy because you only need the minimal functionality required to keep improving your compiler in the new language.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 6, 2021, 10:47pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/28 "2021-03-06T22:47:37Z")

</div>

The punchline of @Morgyn’s linked story about Mel, the Real Programmer, was that he was doing arithmetic on the opcodes themselves, while the program was running, to change them into other opcodes and thus change what the program was doing. That’s something that’s inherent to the machine code level, but not present even at the assembly level.

---

<div class="post-metadata">

**Author:** ![dropzone](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dropzone/32/7515_2.png) [@dropzone](https://boards.straightdope.com/u/dropzone)\
**Post date:** [March 6, 2021, 10:49pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/29 "2021-03-06T22:49:56Z")

</div>

1. If your assignment is to print HELLO WORLD on the screen and you only half remember how to do it, THAT’S serious programming.

2. The Motorola 6809 is a lovely processor for this sort of thing, especially in a Tandy Color Computer .

3. Of course TI"s Ti-8X and -9X calculators are slow–they are still running Z80 processors, I think in some familes Junior is using Granny’s graphing calculator .

---

<div class="post-metadata">

**Author:** ![wolfpup](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/wolfpup/32/10618_2.png) [@wolfpup](https://boards.straightdope.com/u/wolfpup)\
**Post date:** [March 6, 2021, 11:51pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/30 "2021-03-06T23:51:07Z")

</div>

> [@Francis\_Vaughan](#):
>
> There is a critical difference between assembly code and machine code. An assembler will present addresses as abstract entities and as part of its operation will back patch target addresses. So you don’t code the targets of jump instructions as hard values but as a simple symbolic offset. Even then you are not down to final, as executed, machine code. One has left out the linker/loader step. A program is usually not a monolithic piece of standalone code. It uses other libraries, and makes operating system calls. Your code must be linked with other code it uses, and loaded into memory. Loading into memory with other code means even the assembler can’t know the values of absolute addresses needed, and these are filled in at load time.

The linking loader, and the idea of the assembler producing relocatable object code as well as linking to system libraries and user libraries is an aspect I was going to mention as well. All very true, but I would note that it all depends on the capabilities of the particular computer. Simpler computers, like the DEC PDP-8, did not have the kind of memory management needed to provide relative addressing, and assembler programs generated machine code with absolute addressing, albeit with the programmer at least being able to use symbolic addresses. Larger computers implemented the features you describe, along with protected and privileged addressing modes, such that user-mode addressing was always relative. And so did later minicomputers. In the minicomputer space, the PDP-11 was the transition point.

You’re quite right in a sense that in more sophisticated computers, with things like macros, library calls that were resolved by a linking loader, and system calls, assembly language began in some ways to resemble a higher level programming language. In _ **some** _ ways! But the vast majority of the code retained that fundamental attribute of all assembly languages: a one-to-one correspondence between the symbolic instructions and the corresponding machine code.

---

<div class="post-metadata">

**Author:** ![wolfpup](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/wolfpup/32/10618_2.png) [@wolfpup](https://boards.straightdope.com/u/wolfpup)\
**Post date:** [March 6, 2021, 11:55pm UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/31 "2021-03-06T23:55:17Z")

</div>

> [@TriPolar](#):
>
> > [@msmith537](#):
> >
> > How do they create BASIC? Or FORTRAN, COBOL, C++, Python, Spark, or any other computer language for that matter? I assume they don’t write BASIC using BASIC.
> 
> You can write BASIC in BASIC. It’s a good measure of the completeness of a language that it can compile itself. Many modern languages have been written in themselves, or other high level languages.

Not just modern ones. LISP is one of the oldest languages, and at least some implementations were bootstrapped that way.

But I would argue that in the real world you need more than Turing completeness to make it practical to write a language in itself – that’s only a theoretical consideration. In reality you need fairly powerful symbol-processing capabilities, because the essence of what a compiler does is parse the source statements and perform complex transformations that ultimately spit out assembler code. A language like FORTRAN, which is focused on mathematical computations, would be a poor tool for writing a compiler. For many practical reasons, back in the day almost all compilers were written in assembler.

LISP was a notable exception in at least a few implementations, because as a language focused on AI applications, its ability to do complex symbol manipulation was excellent. By the same token, it was also a difficult language to compile, and the natural implementation was as an interpreter, which suffered from being slow. But in an elegant example of bootstrapping, one of the early MIT implementations of LISP was first written as an interpreter, and then a LISP compiler was written in LISP. Its first task, needless to say, was to compile itself, producing a fast native object-code compiler! I’ve long thought that that was just supremely elegant!

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [March 7, 2021, 12:48am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/32 "2021-03-07T00:48:50Z")

</div>

Bootstrapping a compiler used to be one of the basic tricks taught in compiler construction. The goal being to write the compiler in its own language. This was sort of a sincerity test of the new language. The paradigm was represented in T blocks, each representing a compiler. The cross of the T represented input language-\>output language and the stem, the implementing language. You could stack Ts so that you could present a compiler written in one language with a working compiler for that language. Eventually you could stack them up in a manner in which you could compile a compiler using itself. Compilers need not always emit machine code. Cross compilers emit code in a different language.  
You could craft a very basic compiler in another existing language, and bring the stacked Ts artifice up to the point where the “proper” full capable compiler was able to compile itself running compiled code it itself had compiled.  
This is less a thing now. But a neat trick.  
Nowadays systems like LLVM and the gnu compiler collection use intermediate abstract machine representations as the target, and that subsystem is responsible for the heavy lifting into machine code. LLVM managing a pretty clean break between the two.

---

<div class="post-metadata">

**Author:** ![Yosh99](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@Yosh99](https://boards.straightdope.com/u/Yosh99)\
**Post date:** [March 7, 2021, 1:29am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/33 "2021-03-07T01:29:55Z")

</div>

The first major application program I used was dBase running on an Apple II using CP/M as the OS back in 1980. At the time, dBase was advertised as “Written in Assembly Language” to tout its speed.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 7, 2021, 2:35am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/34 "2021-03-07T02:35:22Z")

</div>

Of course, the fact that compilers are themselves compiled in compilers opens up the possibility of them containing code that was never in any of the source code, but inherited directly from the parent compiler. Like, say, a backdoor password that’ll let Kernigan into your system.

---

<div class="post-metadata">

**Author:** ![Carlarm](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@Carlarm](https://boards.straightdope.com/u/Carlarm)\
**Post date:** [March 7, 2021, 4:57am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/35 "2021-03-07T04:57:25Z")

</div>

In the 80’s my job entailed writing programs in Z80 assembly language for embedded systems where the code would be burned into ROMs (read only memory) chips. Of course, when developing the code it is written to RAM and not ROM. When a bug was found in the program, often I would put a jump instruction at that location that went to an area of unused memory where I would enter correct code directly as hex numbers and then jump back and continue with the rest of the program. I knew all of the common machine instructions and had a cheat sheet for ones I didn’t know. One of the fun jobs I had was writing a BASIC interpreter. It was especially interesting to see how useful the push down stack is to recursively evaluate arithmetic expressions.

---

<div class="post-metadata">

**Author:** ![Mijin](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mijin/32/9369_2.png) [@Mijin](https://boards.straightdope.com/u/Mijin)\
**Post date:** [March 7, 2021, 5:23am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/36 "2021-03-07T05:23:40Z")

</div>

> [@TriPolar](#):
>
> If code is designed at the assembly level and then manually assembled to produce the machine code that’s not programming, it’s just manual assembling and entry of the object code. If you do consider that to be programming then people do program in machine code.

Count me among those that would consider writing in Assembler to be “real” programming of machine code. I mean, there’s a one-to-one mapping of assembler instructions to machine code, it’s just the latter is more typing.  
It would be like saying that real writing involves smearing ink on to a page using your fingers, and that the convenience of using a pen makes it not writing any more.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [March 7, 2021, 6:47am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/37 "2021-03-07T06:47:09Z")

</div>

> [@Chronos](#):
>
> The punchline of @Morgyn’s linked story about Mel, the Real Programmer, was that he was doing arithmetic on the opcodes themselves, while the program was running, to change them into other opcodes and thus change what the program was doing. That’s something that’s inherent to the machine code level, but not present even at the assembly level.

I did exactly the same thing as Mel did for a tic-tac-toe program which wouldn’t fit in the 4K of memory I had. I changed a bunch of adds to subtracts and vice versa. This was in 1968, long before I read the story.  
You can’t do it if your linker/assembler is going to move code around, since you don’t have access to the addresses of your instructions. You can do it fine in assembler if you have more or less fixed addresses.  
And of course you can’t do it at all in modern architectures which keep data and program spaces separate.

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [March 7, 2021, 6:50am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/38 "2021-03-07T06:50:49Z")

</div>

They ran Pascal code on a Multics system when I was in grad school by translating the Pascal programs into PL/1. I got the Jensen/Wirth compiler to compile itself for the first time. The biggest problem was decoding their awful one and two letter variable names, and dealing with the fact that portable to them meant 60 bit words.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [March 7, 2021, 7:02am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/39 "2021-03-07T07:02:12Z")

</div>

4900796

Related thread from several years ago: If this thread interests you, then this older one will too:

> [@Explain to Me Like I'm Five What Happens When You Install a New Operating System](https://boards.straightdope.com/t/explain-to-me-like-im-five-what-happens-when-you-install-a-new-operating-system/725464):
>
> I’m a fairly tech savvy person, and I’ve done a fair amount of hardware install in my desktops over the years: RAM, video cards, sound cards, a power supply, I replaced a broken DVD drive and later even added a second DVD drive with the help of a wonderfully informative youtube video. But I’ve never installed a hard drive \*or \*replaced an operating system, and I’d very much like to replace my current hard drive with an SSD drive, keeping the old hard drive as a secondary drive as my computer ca…

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [March 7, 2021, 7:37am UTC](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343/40 "2021-03-07T07:37:43Z")

</div>

> [@Mijin](#):
>
> Count me among those that would consider writing in Assembler to be “real” programming of machine code. I mean, there’s a one-to-one mapping of assembler instructions to machine code, it’s just the latter is more typing.  
> It would be like saying that real writing involves smearing ink on to a page using your fingers, and that the convenience of using a pen makes it not writing any more.

I don’t understand your comparison. If you write some code in any language, and then someone else types it into file to compile and execute are they programming? Were you programming if you didn’t enter the code into the computer some how? Were you both programming? If you both were programming why were you both doing such different things?

[Previous page](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343.md?page=1)

[Next page](https://boards.straightdope.com/t/is-there-was-there-ever-serious-programming-being-done-in-machine-code/937343.md?page=3)
