Super-brain hacker

Chapter 105 OPCODE

An ancient Greek philosopher had such a famous saying--

Human knowledge is like a circle. The inside of the circle is known, and the outside of the circle is unknown. The more you know, the bigger the circle, and the more you don't know.

Lin Hong read this sentence in a literary magazine.

He was deeply touched by this sentence, so his impression was also very clear.

He often involuntarily thinks of this sentence, for example, at this moment.

In the monitor, a small white ball keeps hitting and bouncing back and forth on the monitor, surrounded by white walls.

When the ball hits the wall, a mirror ejection will occur, and there will be a "dong" sound in the speaker at the same time.

Lin Hong sat in front of the iPhone and stared at the monitor, but he didn't know where the focus of his eyes had spread.

After he came back from school, the question Xu Wenjing asked him kept coming to his mind.

What kind of person do you want to be when you grow up?

This is something he has never thought of. Before that, his biggest dream was to reunite a family of three and live a normal life like other families.

But he has never had any prospects for his future.

Like other classmates, do you dream of becoming a scientist? Painter? A musician?

Or a radio expert like Grandpa Xu who even the country attaches importance to?

The professions he has come into contact with are also factory director, martial arts master, soldier, teacher...

He doesn't have much feeling about these professions. Although some of them are his favorites, he is not sure whether he can make it his goal for one of his own life.

What he knows is like a small circle, and the outside world he can touch is too small to give enough information to make the right decision and get a satisfactory answer.

Lin Hong did not know that his current state, in psychology, is actually a process of high-level "self-awareness" understanding and introspection.

He began to realize his own shortcomings, his own shortcomings, and then consciously took measures to make up for them.

In general, if no one is deliberately guided or uniquely stimulated, this process needs to occur in the twenties to the thirties. At that age, people's knowledge structure and life experience have accumulated enough, which will naturally produce this kind of "self-awareness" understanding and Reflection.

Lin Hong thought for a long time and couldn't get the answer he wanted, so he had to give up temporarily.

"Let nature take its course."

Lin Hong gave himself a comfort, which was a sentence that his master often said to people.

Some things that are barely beautiful may have the opposite effect.

Putting this thought down, he began to continue reading the Red Book.

In addition to the content of the display firmware, he has also read the firmware codes and principles of other common external devices.

Now what he wants to see is the core part of the computer - the central microprocession chip, that is, the CPU.

The chip used by APPLE_II is the 6502 chip produced by MOS Technology, which is an eight-bit microprocessor. When it came out, it was the most powerful CPU at that time. Of course, when the Apple machine came out, it was no longer the strongest. In fact, when the prototype was first made, the chip used by the designer Wozniak was not 6502. Later, it was changed to this model mainly to consider cost savings.

The price of 6502 is only one-sixth or even lower than that of other similar products, but its performance is almost the same, even faster than other companies' eight-bit microprocessors. It is precisely because of this inaderable way that many computer or game console manufacturers finally chose it as the CPU.

APPLE_II Apple is one of the great products that use this chip. Another well-known product is Nintendo's home game console, commonly known as the Famicom.

The CPU, known as the "brain" and "heart" of the computer, is not a casual call. Because all execution and calculation in the computer must be done through the CPU.

The so-called programmability of the computer mainly refers to the programming of the CPU, but usually for its operation, it is encapsulated and isolated layer by layer. Programmers who use high-level languages do not even need to know the existence of the CPU and its specific operation principle, as long as to write a computational equation such as "1+1" and The translation will produce results. In fact, at that imperceptible moment, it went through a very complicated process.

First, the compiler compiles the program into a machine language that the computer can understand, and then begins to hand over the program to the CPU to control. After a series of actions such as extraction, decoding, execution, writing back..., etc., the results are finally calculated, and then displayed in the display.

Although this process is complicated, it is very fast. When the computer was just born, the speed may be about the same as calculating with an abacus, but now, it is only a momentary thing.

In a small chip, there are a lot of things in it.

In the past, the CPU was implemented using basic switching components such as relays, which were not only large in size, but also unreliable and easy to break. The emergence of vacuum tubes gradually replaced relays, and it was not until the emergence of transistors that it was the first leap in CPU technology.

The integrated circuit concentrates a large number of transistors on a small chip, which greatly reduces the volume of the CPU, is not easy to damage, and the stability is also greatly improved. During this period, computers really had the possibility to go to thousands of households, and microcomputers came into being.

In the red book, the introduction of 6502 is very detailed, from the functions and functions of each pin of the CPU chip to the detailed structure of the accumulator, instruction decoder and various registers with detailed illustrations.

These illustrations are all hand-painted, and the original author is Wozniak, a talented computer engineer at Apple.

Even hand-drawn graphics with curved lines appear in computer manuals, which will give people a very unprofessional feeling today, but when the Red Book was published, it was these hand-drawn illustrations that fascinated all computer enthusiasts and researchers around the world.

It can be said that APPLE_II is completely designed for computer enthusiasts, including the Red Book, and it is also written for these professionals, because its designer is Woodsniak, a pure technician.

However, Apple CEO Jobs has a lot of opinions on this. He is not a technician, and he does not want users of Apple computers to be limited to professionals and computer enthusiasts.

This is not the product Jobs wanted, so since then, Apple has successively launched many versions of other types of computers, but it has been unable to surpass APPLE_II, and because it is too conservative, it eventually plunged the company into a crisis of bankruptcy. The edge didn't rise again until a long time later - this is the last word.

Lin Hong looked at this part very carefully. Compared with the circuit diagram of each component in the CPU, he simulated the computing process of the whole CPU in his mind. Originally, he thought it would be difficult for him to understand, but later he found that he understood the operation principle of the whole CPU smoothly.

Arithmetic logic unit, accumulator, counter, clock generator, register group...

On the one hand, Lin Hong was surprised that there were so many complex components integrated into this small chip, and on the other hand, he was addicted to these exquisitely designed circuits.

The components, circuits and principles of the radio station are visible and tangible, but these things in the CPU are encapsulated in such a small chip and can only be operated through external pins, which has to shock Lin Hong.

This is a black box. All input and output signals are realized by those few pins. By applying various high and low level voltages to the pins, the processing and calculation of data are realized. This ingenious design has to be amazing!

Through ingenious circuit processing, computer scientists have invented a machine language called "OPCODE" to control instructions on the CPU to realize computing.

Machine language refers to binary code language, which is the lowest and most primitive language and can be directly understood by computer microprocessors. For example, "0000" means to let the CPU load the program, while "0001" tells it to store things.

Four digits, each of which has two possibilities, then it can represent a total of 16 different operations of 2x2x2x2.

16 kinds of operations can still meet the requirements at the beginning, but later, the CPU of the computer is becoming more and more complex, and there are more and more operating instructions, which can no longer meet the requirements, so it began to expand and mark it with 8-bit or 12-bit binary.

It's really painful to write programs directly with binary. The screen is full of dense 0 and 1, and the eyes can be seen as chicken eyes.

Later, some people came up with a way to convert binary to hexadecimal for processing, and every four-digit binary corresponds to a hexadecimal, which greatly simplifies the requirements for memory and input.

Later, people felt that it was difficult to remember hexadecimal code, so they began to use the abbreviations of alphabetic words to correspond to the computer's operation instructions, and the machine code mnemonic and assembly language were born.

For example, the "MOV" instruction is the abbreviation of "MOVE" in English, which means to move, and the function is to move data from one place to another.

This instruction is very useful. For example, if you want to display the letter "A" on the display, as long as you put the machine language "MOV" corresponding to A to the corresponding video memory position, the "A" will be displayed on the display.

In this chapter, the Red Book details the OPCODE machine code of 6502. The circuit on the motherboard is an implementation of these machine codes.

It was not until now that Lin Hong really understood why the computer world is a world composed of 0 and 1.

====

Recommend friends' modern cultivation works

[bookid=2330003,bookname=The Strongest Immortal King]

C