How were computers “commanded” before computer languages existed?

617 views

How were computers “commanded” before computer languages existed?

In: Technology

A computer by definition has some kind of command process, or language. Even simple indexers, analytical engines, and other predecessors of actual computers. If there’s not some way for commands to be executed, even just sorting, it’s not a computer at all.

Computers always run on what is called “machine code”, the actual values which make the computer components behave as desired. At this stage it is just like flipping electrical switches at the start of a long chain reaction.

The secret is that computers *never changed from that.* Computers do not “think”, they do not understand anything, they don’t “obey orders” any more than an electric winch obeys an order to pull on something when it is turned on. Computer languages and code are just abstractions to allow people to more easily construct logical processes than putting the machine code together directly.

Imagine a purely mechanical calculator, something that adds and subtracts numbers via gears and levers. The numbers to be calculated together are indicated by the positions of the gears at the start and that is in essence what computers are doing. The difference is that it is much faster, the parts are smaller, and it is done without moving parts using semiconductor switches.

Define computer language and computer.

If you want to be really technical, computer used to be a profession humans did, rather than being a machine.
The first computer language was telling Dave to add these two numbers together and divide them by whatever Larry came up with and so on.

When it first started, an electronic computer did one thing, it had wires attached to the logic gates.
To make it do something different, you had to pull out all the wires and basically rebuild the entire computer.

Later on, rather than rebuilding the computer they just made it really easy to pull out the wires and plug them in differently.

Later on, instead of pulling out the wires, they just made it so you flicked a few switches so the wires would connect differently. This is probably where you could argue where the modern computer language existed.

Later on, they had the machine flip the switches based on holes punched in a card.

Later on, they had a machine read what you wrote and make the holes for you (though by then some of them weren’t even physical holes anymore)

Later on, they had a machine read what you wrote, and re write it so a bunch of specific machines could punch their specific holes.
And that’s a modern programming language.
At the end of the day a CPU op code is just an set of switches for a CPU.
Assembly language is translated in those codes.
And a modern high-level language gets translated into assembly language.

A computer processor, at it’s most basic level, has a bunch of hard-wired commands built into it called an “Instruction Set”. These are basic things like “Load data from here” “Add these values together” “Move data to here”, a big list of operations that, together allow the processor to perform any task you can throw at it.

* Machine code

These functions can be harnessed by directly talking to the processor in a language it understands, and the bottom rung of this communication is something called Machine Code. Literally ones and zeroes. Binary.

The documentation for a particular processor will include a table of information saying what binary input will equal a particular instruction set instruction.

So you can in theory program a processor right down at the bottom rung level, using direct machine code input.

The first home PCs were programmed this way, like the [Altair 8800](https://upload.wikimedia.org/wikipedia/commons/3/35/Altair_8800%2C_Smithsonian_Museum.jpg) or the [IMSAI 8080](https://kyozoufs.blob.core.windows.net/filestoragedb1/Pictures/_17/16780/16779875.jpg) using those switches at the front.

As you can imagine though, programming a computer instruction by processor instruction (which might need several separate instructions to simply add two values together) is a long, long process, very prone to errors. Get a single zero where you should’ve had a one, and that’s it. So they improved things a little.

* Assembly Language

This was the next step up. Rather than having to look up what binary code equals a particular instruction and actually writing the code in binary, an assembler allows you to write those instructions directly, giving a much more human-readable result to your code. Rather than a string of binary code, an assembly instruction might now look like this:

MOV RB, 61h

That means basically “load location ‘RB’ with the value 61H” Still doesn’t make a lot of sense if you don’t know what any of those instructions do, but it’s far more digestible than a list ones and zeroes, which you’d have to go back to a lookup table to work out what they even mean.

A random trivioid here is that Rollercoaster Tycoon was written entirely in assembly language in order to maximize performance. If you’re writing directly in the processor’s instructions, which you are doing in assembly language, you can make every last instruction count, and make the whole thing as efficient as possible. This is why Rollercoaster Tycoon always ran very well even on pretty low end hardware back in the day, while still looking very impressive.

You’d type Assembly Language into a program called an Assembler, which would then output (or assemble) the machine code ones and zeroes for you.

So that’s assembly language. More digestible than direct machine code, but still pretty hardcore, because turning instructions like “move data to here”, “load this area with data”, “add these values together” into something like, I don’t know, a copy of Windows, or The Witcher 3, seems almost impossible. It is how all computers work though at the bottom level, all processors no matter how fancy the programming interface you use is, use machine code at the hardware level.

Next level up.

* High-Level Languages

These are basically modern programming languages like Visual Basic, C, Pascal, Python, and so on.

The whole point behind a high level programming language is to take the rather abstract and alien processor instructions, and lay over it a nice (relatively) easy to understand language that behaves as a human operator might expect.

But the difference is, now the higher level programming language instructions (or ‘commands’) don’t necessarily have to match up with the instruction set the processor uses. That’s not their point. The point of them is to make a more intuitive framework that you can use get the task you want the computer to do down in a way that you understand, and then the language ‘compiles’ that code you’ve written into a big tottering pile of machine code that the processor can understand. The language can consist of any number of commands, and functions that make writing a program more easy, and some languages will have commands that more suit it to particular tasks (which is kind of why multiple higher level programming languages exist in the first place, to cater to different use cases).

* Visual languages

Arguably a level above even higher level languages that would be visual languages. These are things like [Labview](http://forums.ni.com/legacyfs/online/202594_Hololens_LabVIEW_simple_example.png), or the language included with the Lego Mindstorms kits, [Robolab](http://web.ncf.ca/aa333/bumper.gif).

These go a step further by giving you a visual interface, with boxes you can drag around and lines you can drag between stuff to give an even more human-friendly method of telling the computer what you want it to do.

The further these languages go from machine code, the less efficient they might be, but the more intuitive and understandable to the average human they ought to be too, so it’s swings and roundabouts.

All these languages do is output machine code though because even now that’s how the processor does its thinking. The languages just do it, so you don’t have to.

Programming actually existed before computers did. [Ada Lovelace](https://en.wikipedia.org/wiki/Ada_Lovelace) is credited with creating the first algorithm intended to be carried out by a “computing machine”. However at that point this machine was only theoretical and had not yet been built. So when computers were eventually built, there was already a procedure in place for commanding them.