How does hardware run assembly? How was the first assembler written?

"Hardware", mostly the CPU and memory, is pretty much a finite state machine. Its states/outputs and inputs are roughly the contents of the registers and memory.

Your program compiled down to the machine codes that the FSM "understands" drives the FSM from state to state. That's how "hardware runs assembly".

Unless the first assembler/compiler is cross-compiled (developed and compiled on a different platform), the first one is written and translated to machine codes manually and then those are typed in.


It was "toggled in" on the front panel or read in from paper tape. You could work out the binary and either set the switches or make the holes by hand, converting opcodes in your head. Legend has it that Seymour Cray entered the entire first Cray OS this way.


Actually I think you understand. First off the title question, how does hardware run assembly. Hardware runs on machine code or machine instructions or whatever term. As you have correctly described assembly is a representative of that machine code, and not always but is close to a one to one relationship one asm instruction to one machine instruction. These being bits, ones and zeros, the hardware can now perform the actions that the bits describe.

Now how is the first assembler written? With pencil and paper. You typically write down the instruction in some sort of pseudo assembly as you may not have completely defined the language, and then you write down the bits based on the encoding, the same thing an assembler would do. Then using some mechanism you feed those bits into the computer and tell it to run.

Eventually, naturally, this becomes tedious for larger programs so you decide to write a larger program that parses a language that is easier to write, then repeat that with more complicated languages and programs.

Even today depending on the team and how they do things and the individual engineer testing the instruction decoder, etc. Writing machine code by hand still happens. Eventually the assembler is created and you switch to that and sometimes there is a higher level compiler and you switch to that for the bulk of the coding, but in the chip development world you still are very aware of and from time to time will modify the bits of an instruction at the machine code level.

Tags:

Assembly