How is the equipment assembled?

Having taken a course on compilers and made a rudimentary one, I still have this lingering doubt about the first compiler.

From high to low, I see that the code works in let say C or C ++, which is converted to the corresponding assembler equivalent by the compiler (say gcc). This code is platform dependent (let's say I'm on Intel x86 architecture).

Now the question is, how is the assembly of the equipment performed?

I remember from my computer organization class that each assembly statement is converted to a specific format (depending on the processor), for example, an operator like mov ax, bx is converted to it, opcode let say 0110 101010 101000. Assuming the assembler analyzes every statement in my assembler program and convert it to machine code, and then how was the first assembler written?

+7
source share
3 answers

In fact, I think you understand. First of all, with a header question, how does the hardware work. The hardware runs on machine code or machine instructions or any other term. Since you correctly described the assembly, this is a representative of this machine code, and not always, but close to one to one relation, one asm instruction to one machine command. These bits, ones and zeros, hardware can now perform actions that describe the bits.

Now how is the first assembler written? With pencil and paper. Usually you write the instruction into some kind of pseudo-assembly, since you may not have fully defined the language, and then write the bits based on the encoding, the same as the assembler. Then, using some mechanism, you download these bits to the computer and tell it to start.

In the end, naturally, it becomes tedious for larger programs, so you decide to write a larger program that analyzes a language that is easier to write, and then repeat this with more complex languages โ€‹โ€‹and programs.

Even today, depending on the team and how they do it, and the individual engineer testing the command decoder, etc. Handwritten code still happens. In the end, the assembler is created, and you switch to it, and sometimes there is a higher level compiler, and you switch to it for most of the coding, but in the chip development world you are still knowledgeable and will change the instruction bit from time to time to machine code level.

+9
source

He was โ€œswitchedโ€ on the front panel or read from paper tape . You can work out a binary file and either set the switches or make holes manually by converting the operation codes into your head. Legend has it that Seymour Cray entered the first Cray OS in this way.

+5
source

The hardware, mainly the processor and memory, is largely a state machine. Its states / outputs and inputs are the contents of registers and memory.

Your program is compiled to machine codes that FSM "understands", brings FSM from state to state. This is how "hardware starts assembly."

If the first collector / compiler is not compiled (developed and compiled on another platform), the first is written and translated to machine codes manually, and then typed.

+2
source

All Articles