home

search

Chapter 91: The Moving Small Ball

  ♂?,,

  "Xiao Hong, is this the filter Cook was talking about?" Feng Wen asked in surprise, looking at the small object the size of a matchbox in her hand.

  Lin Hong nodded: "Yes, this is an adaptive signal filter. Although it's only so big, the function is still quite practical and can effectively filter out background noise."

  This little thing was designed after he spent more than a month constantly testing and adjusting, just to cope with the increasingly numerous wireless signal noises in the air.

  Although he had never seen anything like it before, he could hardly believe that Cook was so enthusiastic about this thing. In his opinion, as long as the principle behind it was understood, it shouldn't be difficult at all.

  Although this is his willing idea, if he didn't understand these circuits extremely deeply, he wouldn't have the ability to combine these basic circuits. Those who can understand it are bound by some habitual thinking and creativity. According to conventional theory, several basic circuits in it cannot be connected in this way, otherwise the circuit will definitely burn out.

  However, cleverly, these basic circuits are combined to form a large circuit, and this overall circuit will produce unique functions, perfectly integrating the theoretically destructive circuits together.

  One plus one is not always equal to two.

  Feng Wan didn't understand these things. She had already been moved by Cook's words, but when she saw the final "product" in her hand, her confidence wavered a bit.

  So, to be on the safe side, she started calling her friends who were professionals and inquired about patent-related matters.

  Lin Hong didn't pay much attention to this matter, and this little thing was just something he made for his own use. Later, he also made a signal amplifier that matched it, which wasn't big either, and brought them both here together. He'll let Cook take a look at this thing later too.

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

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

  The display device at that time was actually a TV picture tube, and the basic principle was to accelerate electrons to hit the fluorescent screen to produce bright spots, thereby achieving the effect of displaying text or images.

  The imaging tube is equivalent to a black box, with magnetic fields in all six directions. Electrons will accelerate or deflect under the action of the magnetic field. For example, if you want to display a horizontal line on the screen, you can send continuous electron beams from the cathode, initially pointing to the far left of the phosphor screen, and then add a left-right direction magnetic field, "pulling" the electron beam to move from left to right. This process is like someone holding a machine gun, sweeping from left to right, finally hitting a bullet hole on the target (phosphorescent display screen).

  To control the electrons to form specific words and patterns, it is a very precise operation, which cannot be done manually. Even a skilled shooter cannot use a machine gun to write simple Chinese characters neatly on a wall, let alone draw complex graphics.

  So the engineers packaged these operations into simple instructions, treating the entire display as a black box. All they had to do was tell the black box "draw horizontal line", and it would automatically display a horizontal line on the screen. As for how this is actually implemented, users don't need to worry about those details.

  This black box is the firmware. When it leaves the factory, the manufacturer will provide a thick firmware technical manual. The manual details the instructions that can be supported by the display, including basic drawing methods for points and lines, as well as some basic geometric shapes. Of course, some hardware engineers may even secretly bury an Easter egg inside, such as a specific instruction that can display their name on the screen.

  "Before, Lin Hong knew how to repair TVs but didn't understand why they could display such complex patterns. After reading this chapter, he finally gained a deeper understanding." Instructions can print characters on the screen, but as for why this command can print characters, he was still in the dark.

  Now he knows that it's because there is a place in the display hardware called "display storage area" (abbreviated as video memory), which is a very special region. Any content in this region will be mapped to the screen. This principle is very similar to a shadow game he played when he was young.

  At night, he shines a flashlight on his hand, and a large shadow appears on the wall. As he moves his fingers, the pattern on the wall changes accordingly.

  Video memory is like 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 contents in the video memory and on the display.

  The display storage area of this Apple II is pitifully small, only 1KB in size, corresponding to a display area of 24 lines and 40 columns on the monitor.

  Put a letter "a" into the video memory, and specify which row and column it is in, then the monitor will display the letter "a" at the corresponding coordinates. This is the basic display principle of the monitor displaying characters.

  Lin Hong stopped reading at this point and instead started up his Apple computer, intending to try writing a program by hand.

  What should I write?

  He is somewhat indecisive.

  Beginners are often like this, and they are often confused about the content they have learned, and don't know how to apply these knowledge to their own programs. They want to write a program in their heart, but don't know what kind of program to write.

  Actually, Lin Hong's biggest goal right now is to write his own game, but it seems like the difficulty level is not small, and with his current abilities, it's a bit too ambitious.

  He finally decided to start with the simplest thing and drew a small ball on the monitor first.

  There are ready-made drawing functions, using the function to draw a circle quickly painted a small circle on the display, and then filled it with white. This is simple, directly calling the function achieves this.

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

  There is no move function in Basic, so you have to implement this effect yourself.

  How can I move?

  Lin Hong recalled the scene of watching movies in the countryside. The film tape was composed of static film strips, and by moving the written film strips, the characters would come to life. Sun Wu had once obtained a segment of film from the projectionist's hand, Lin Hong observed it carefully, adjacent film strips seemed identical, but actually were different, with subtle movements between actions.

  He thought he could also use this method to make the little ball move.

  Then he drew another small ball next to the first one, which was equivalent to a second frame. However, in order to achieve dynamic effects, the previous small ball had to be erased.

  How to erase it? There is no instruction function for erasing images in Basic.

  Lin Hong thought for half a day and finally used a relatively stupid method. He drew another black small ball in the place of the previous one, which just covered up the original one, and the background color was also black, so it was equivalent to erasing the small ball.

  The specific process is as follows: Lin Hong first draws a white ball, one second later, he draws another white ball five pixels to the left, and at the same time, covers the original white ball with a black ball. This process repeats until the far right end of the screen. By controlling the duration of each stop and the length of displacement, he can also adjust the speed of the moving balls.

  Watching the small white ball moving quickly on the screen, Lin Hong's face showed a pleased smile. Although the completed function is relatively simple now, it's a good start.

  Update the fastest Wu Dong Qian Kun

  Complete works txt download, full text free, e-book, remember 77 reading books

Recommended Popular Novels