Super-brain hacker

Chapter 91 Moving Ball

"Xiao Hong, is this the filter Cook said?" Feng Wan looked at the small thing the size of a matchbox in her hand and asked in surprise.

Lin Hong nodded: "Yes. This is an adaptive signal filter. Although it is only this big, the function is quite practical and can filter out the background noise well.

This little thing was designed by him after more than a month of continuous testing and adjustment, in order to cope with the increasing noise of radio signals in the air.

Although he had never seen anything like before, he never expected that Cook would admire it so much. In his opinion, as long as he figured out the principle of this thing, it should not be difficult.

That being said, this is his wishful thinking. If you don't have a deep understanding of these circuits, you won't be able to combine these basic circuits at all. And those who can understand are bound by creativity because of the influence of some habitual thinking. According to conventional theory, several of these basic circuits cannot be connected like this, otherwise the circuit will definitely be burned.

But cleverly, when these basic circuits are composed, a large circuit will be formed, and this overall circuit will produce a unique function, which will integrate the theoretically burned circuit well and be natural.

One plus one is not necessarily equal to two.

Feng Wan didn't understand these things. She had been moved by Cook, but when she saw the final "product" in her hand, her confidence was a little shaken.

So, to be on the safe side, she began to call her friends and ask professionals about patents.

Lin Hong didn't pay much attention to this matter. This little thing was just made by him for his own use. Later, he also made a signal gain device with it, which was not big. He brought it here together and let Cook see this thing later.

While his mother was on the phone, he returned to his room and continued to read the red book.

He is now looking at the firmware part of the display.

The display in this period is actually a TV picture tube. The basic principle is to accelerate the electrons by bombardment on the fluorescent screen to produce highlights, so as to achieve the effect of displaying text or images.

The picture tube is equivalent to a black box with a magnetic field in six directions, and the electrons will accelerate or shift under the action of the magnetic field. For example, if you want to display a horizontal line on the display, you can send a continuous electron beam from the cathode, pointing to the far left of the fluorescent screen at the beginning, and then adding a left and right magnetic field to "pull" the electron beam from left to right. This process is like a man holding a machine gun, shooting from the far left to the right, and finally bombarded a bullet mark on the target (fluorescent display).

If you want to control the electrons to form specified text and patterns, this is a very precise operation. It can't be done manually. The sharpshooter can't write simple Chinese characters neatly on the wall with a machine gun, let alone draw complex graphics.

So the engineers encapsulated these operations into simple instructions, treating the whole display as a black box. As long as you say "draw a horizontal line" to the black box, the black box will automatically show a horizontal line on the display screen. As for how it is achieved, users don't have to care about these at all. Details.

This black box is the firmware. When leaving the factory, the manufacturer will give a thick firmware technical manual, which details the instructions that can be supported in the display. The drawing of points and lines is the most basic, and some even draw a variety of basic geometric figures. Of course, some hardware engineers will even secretly bury an Easter egg in it. For example, a specific instruction can show his name on the display.

Although Lin Hong knew how to repair the TV before, he didn't know why the TV could display such complex patterns. After reading this chapter, he finally had a more in-depth understanding.

Before reading this chapter, he knew that the BASIC "PRINT" instruction could print characters on the display, but he was blind about why this command could print characters.

And now he already knows that this is because there is a place in the display hardware called "display storage area" (referred to as video memory), which is a very special area where anything in this area will be mapped to the display. This principle is very similar to a shadow game he played when he was a child.

Shine a flashlight on his hand at night, and then a large image will be displayed on the wall. As his fingers make various movements, the pattern on the wall will also change.

The video memory is equivalent to his "hand", and the display screen is the "wall".

The action completed by the

"PRINT" instruction is to send the characters to be displayed to the video memory area, so that the firmware part will automatically complete the corresponding mapping of the content in the video memory and the content on the display.

Lin Hong's APPLE_II display storage area is pitifully small, only 1KB in size, corresponding to the display area of 24 rows and 40 columns on this display.

Put a letter "A" into the video memory and specify which row and which column, then the letter A will be displayed on the corresponding coordinates on the display, which is the basic display principle of the display characters on the display.

Lin Hong looked at this part and did not continue to read it. Instead, he started the Apple computer and planned to make a program to try it.

What should I make up?

He is a little uncertain.

Beginners are usually like this. They are often a little confused about what they have learned and don't know how to apply this knowledge to their own programs. I want to write a program, but I don't know what kind of program to make.

In fact, Lin Hong's biggest goal at present is to write a game by himself, but it seems to be quite difficult, and his current ability is a little far away.

Finally, he decided to start with the simplest and draw a small ball on the monitor.

BASIC has a ready-made drawing function. Using the circle function, it quickly draws a small circle on the display, and then fills it with white. This is very simple, and it is achieved by directly calling the function.

Next, Lin Hong wanted the little ball to move from one place to another.

There is no movement function in BASIC, so you have to achieve this effect by yourself.

How can I move?

Lin Hong remembered the scene of watching movies in the countryside before. The film tape is composed of static films one by one. By moving and writing the film, the characters will move. Sun Wu once got such a piece of film from the projectionist. Lin Hong observed it carefully. The adjacent film seemed to be the same, but in fact it was different, and there was a slight movement between the movements.

He felt that he could also use this way to make the ball move.

So, he drew another small ball next to the small ball, which is equivalent to a second film, but if you want to achieve a dynamic effect, the small ball in front of you must be erased.

How to erase it? There is no instruction function to erase the image in BASIC.

Lin Hong thought for a long time and finally used a more stupid method. He drew a small black ball in the front of the small ball, which just covered the original, and the background color was also black, which was equivalent to erasing the small ball.

The specific process is like this. Lin Hong first drew a white ball. After one second, he drew a white ball at the place where he moved five pixels to the left. At the same time, he covered the original white ball with a black ball, and repeated it so far to the far right end of the screen. By controlling the time of each stay and the length of the displacement, he can also adjust the speed of the ball.

Looking at the fast-moving white ball in the display, Lin Hong showed a heartfelt smile on his face. Although the completed function is relatively simple, it is a good start.

C