How was the first computer program created?

Possible duplicate:
How was the first compiler written?

This question has always bothered me. To compile a program, you need a compiler, which is also a type of program, why does the compiler compile? Someone told me that the first compilers were written in assembly or machine code. But thinking about it, this is not a complete story. After all, how does a machine code go from a hard drive to RAM to a CPU without an operating system and drivers? The drivers had to be programmed in some way.

I know that the earliest computers have switches, and you can flip the switch to indicate a bit. I am wondering how the transition from switches to a way was made to get the processor to read machine code without requiring a computer program to tell him to do this.

+8
cpu
source share
4 answers

Short answer: the first programs were carefully written in the source machine code, and everything was created from there.

This idea is called bootstrapping . Suppose you have a bare computer with a processor, flash memory and hard drive. Typically, the processor is configured at power-up to boot a simple operating system, called the bootloader, from a fixed location in non-volatile memory (such as CMOS or flash). This OS is unusually simple and has enough functionality to point the computer to the place on the disk where the real OS lives. This OS can then turn on more and more devices and load more and more complex programs until the entire OS is ultimately launched and launched.

But what is this bootloader? They were originally written in raw machine codes and hardcoded into a machine. The programs that he ran were also written in machine code, which would be incredibly slow and tedious to work with. In the end, someone wrote the first simple assembler into machine code. When you have this assembler, you can start writing programs in the assembly, including the assembler itself. In fact, once you have a simple assembler, you no longer need to write machine code. You can just write the assembler in the assembly!

From now on, you can create more complex programming languages ​​by first writing to the compiler using existing tools (such as assembler) to get enough functionality available so that the compiler can do basic programming. Then you use this compiler to write a compiler for the programming language itself and use the same trick to build your previous work to get something bigger and cooler. This method is still used today - most compilers are written in the language they compile.

So, everything had to be done manually at some terrible moment in the past, but thanks to the hard work of the people who did this, we can build on what is already there.

+9
source share

In the early days of working on a microcomputer, we had difficulty entering machine code using the toggle switches. It was very similar to how the first non-hard-coded computers were made.

Read more about early Altair machines here . Basically, you set binary keys for address and data, and then used a command switch to write to memory. Yes, one byte at a time. Then we were "real men" :-)

From the same site is a detailed process used to enter the sample program.

It should also be borne in mind that you do not need to compile programs for machine X actually on machine X. Once the machines have reached a certain level of complexity (where, for example, machine Y could work without switching in programs), you can use cross-collectors and cross- compilers for actually creating a machine language for an X machine.

Then you just need a way to get the binary image of this program in X machine. It was not always easy, but it was black vision easier than switching.

+4
source share

Once upon a time to use a computer, you entered machine code in binary format. People are tired of this, so they created a program (with machine code) that will read the assembly. After some time, they realized that the record in the assembly was absorbed, so they used the assembly to create high-level languages ​​such as FORTRAN.

For full details, enroll in college and take a few CS or COMPE classes.

0
source share

Here is a wikibook that seems to be on this topic. I did not consider this further than the description

http://en.wikibooks.org/wiki/Microprocessor_Design

It was a book that I used in my course. That was pretty good

http: //www.amazon.com

0
source share

Source: https://habr.com/ru/post/651396/


All Articles