Chapter 3 Software Analysis
The most convenient way to study a computer is, of course, to start with random software and data, and Zhang Lexing first set the goal on random software. Pull out the random software one by one from the floppy disk box and look carefully,At this time, the floppy disk is still a 5-inch large disk,According to the label on the floppy disk,This pile of floppy disks includes two AppleDOS disks、A VisiCalc spreadsheet software、A disk that looks like word processing software,What he didn't expect was that there were still a few game disks,I really don't know how to buy this computer。
According to the habit, Zhang Lexing tried the game disk first,After all, it's only 80 years,The game screen is very simple,He's used to seeing the gorgeous game screen of later generations,At first glanceApple-IIThe game screen composed of simple green grids is really not used to it,Fortunately, there is a game that seems to be somewhat familiar "HEADON", although the picture is very simple,But there is a feeling of eating pacmen when playing。
After a brief study of the game disk, Zhang Lexing took out AppleDOS to study it. This system is quite ancient,Relying on a random manual,Zhang Lexing figured out that the command of the column directory at this time is not DIR,It's CATALOG,And the AppleDOS operating system is still relatively simple,There are not many functions that can be realized,Even the directory is not supported,The file management function is basically equal to nothing,In essence, it can only be regarded as a disk operation interface。 Zhang Lexing remembers that it seemed that it would be a few years before a more powerful ProDOS appeared, and at that time, the Apple II was considered to have a real disk operating system.
The simple AppleDOS,Unfamiliar command line,Zhang Lexing finally can't stand it,He remembered the operating system he had designed,Relying on the lessons of predecessors and the enthusiastic support of many netizens,This set of operating systems that have been optimized many times can be said to be the most powerful and powerful on Apple II。 Although it has been so long, but as long as 36 times of optimization so that Zhang Lexing remembers the source code of the operating system vividly, since there is time at the moment, and the AppleDOS at hand is not easy to use, Zhang Lexing decided to write it immediately.
The complete source code is relatively long, and the core code after final optimization is about 1500 lines, Zhang Lexing thought about it carefully, and the familiar code quickly emerged from his mind, he exhaled and began to enter the code according to memory. More than two hours passed, the input of the code was completed, Zhang Lexing carefully checked and modified a few mistakes, I felt that there should be no problem, so I immediately saved the disk, and then modified the boot area of the floppy disk, so that the floppy disk can be booted smoothly after the new system can be booted.
Restarting the computer, Zhang Lexing took advantage of the gap in the system start-up, rubbed his somewhat sore arm, and moved his somewhat stiff wrist. The physical activity was turned on, and the new system began to start after reading the disk, and soon a prompt of "LOGIN:" appeared on the screen, and after Zhang Lexing entered the default username and password, a new command line appeared.
This new operating system is designed based on some common disk operating systems in later generations, which can support disks, support hierarchical directories, provide file management functions, have memory scheduling functions, and can also achieve multi-tasking (for example, when running word processing software, you need certain data, you can call up other software needed through the resident management program, and you can switch back to word processing software after finding out). However, now the system function is not complete, only the code of the kernel part has been completed for the time being, and some auxiliary programs need to be added, and some small bugs have been found during the trial operation, it seems that there may be a gap between the simulator and the actual machine, and the system needs to be further debugged and optimized. However, Zhang Lexing has already thought of the name of this operating system, and plans to use the name Kylin given by the good deeds.
The Kylin system, which embodies everyone's hard work, has traveled through thick time and space, appearing in this era when Apple II is still in full swing, and Zhang Lexing's life has begun to change slightly.
In the following days, the daily itinerary was very tightly arranged, Zhang Lexing soaked in the computer room every day, and the morning time was spent optimizing and debugging the operating system and adding some auxiliary programs to the operating system, and the afternoon time was spent instructing Uncle Zhao to use Apple II and translating the "BASIC User Guide". A week has passed, Zhang Lexing's operating system Kylin is basically completed, and Uncle Zhao has also learned the preliminary operation of Apple II, and can also use the ROM-BASIC on Apple II to program simple programs, of course, when writing code, you often need to look at the hand-copied simplified version of the BASIC user manual written by Zhang Lexing.
"Lexing, that's good, it's only been a week to get a manual, Uncle Zhao will use this new machine, but it's all up to you." Uncle Zhao thanked me while flipping through the BASIC manual.
Zhang Lexing waved his hand to Uncle Zhao and said modestly: "It's nothing, I actually wrote it after reading random information, it is actually quite detailed, I just picked up important places and translated them." ”。
"I think you're pretty good, at least you're more capable than the two college students in the factory, and they can't figure anything out. Uncle Zhao smiled and said, "I see that you like computers a lot, are you interested in coming over to help Uncle Zhao?" ”
"Uncle Zhao, can this work? How old am I, can I enter the factory?" Zhang Lexing was very happy in his heart, but deliberately showed some suspicion on his lips.
"It's okay, you are originally a family member in the factory, the factory director is my former comrade-in-arms, Uncle Zhao will help you talk about it, it's no problem, it's wrapped up in Uncle Zhao." Uncle Zhao patted his chest, and he took this matter down.
"Uncle Zhao, then this matter is really troublesome for you. Zhang Lexing thanked.
……
After two days, Zhang Lexing felt that the portability of the program written in assembly was not very good, and the program written in BASIC was too slow, and he couldn't help but start to miss the C language he was good at, but unfortunately there was no Apple II, but fortunately, Zhang Lexing was very familiar with the standard C, and he decided to solve this problem by himself, so Zhang Lexing had a new development task - to add a C language compiler to the operating system. Because the C language has good portability, so that a lot of the code written by Zhang Lexing can be easily used on the new computer, and the amount of modification is generally not too large, after all, IBM-PC will be released next year, although it seems that the country will not begin to introduce until about 85 years, you must know that this is the platform of the next few decades, but it is not comparable to Apple's function.
When it was almost noon, Zhang Lexing, who was immersed in the world of C language, was still working hard to pile up the code, Uncle Zhao suddenly rushed into the computer room with excitement on his face, took Zhang Lexing's hand and walked out, and said happily while walking: "Lexing, go, Uncle Zhao will take you to lunch." ”。
When I arrived at the canteen in the factory, Uncle Zhao, who was in a very good mood, made two more dishes than usual, and the oily braised pork stewed with dried beans made people greedy to watch, and Zhang Lexing's appetite was much better than usual. After finishing the meal, Uncle Zhao pulled Zhang Lexing to a dining table against the wall, put the rice bowl and vegetable basin, and Uncle Zhao began to chat while eating.
"In the past two days, I went to the factory leader and took out this BASIC manual you wrote, and I stopped people at that time. In addition, I will tell you about some of the situation during this period of time, mushrooms for two days, and finally get this thing done. Lexing, in the future, you will be regarded as an employee in the factory, with a salary of eight yuan and five yuan per month, and in addition, considering your situation, the factory will subsidize another four yuan per month. From now on, you will go to work in the same place as Uncle Zhao, and I will take you to go through the formalities in the afternoon. Uncle Zhao explained.
Hearing this, Zhang Lexing was very happy that his most urgent problem had finally been solved, and of course he did not forget to thank Uncle Zhao for his efforts in the past few days.
After lunch, Uncle Zhao took Zhang Lexing to the factory to go through the formalities, and turned down in the afternoon, the personnel department, the archives room, and the finance room...... Almost all the offices have been transferred, and the procedures have been basically completed, and you can officially go to work only after the factory reports to the Personnel Bureau for approval. In the future, Zhang Lexing can finally go to the computer room to use the computer openly, and he no longer has to worry about other people's gossip.
The next day, Zhang Lexing officially started the design of the C language compiler. The C language compiler is mainly composed of six parts, lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and object code generation. Within a few days, the C compiler was officially completed. In order to check the compiler, Zhang Lexing wrote some test programs, all of which were compiled normally, and it seems that the compiler has been working normally. In order to further test the performance of the compiler,Zhang Lexing to the memory of the "digging for gold" as a blueprint,Wrote a C language version,After compilation,It was found that the operation is quite normal,Compared with the assembly language written,I feel that the running speed is not much different,It seems that the performance of this compiler is good,The only thing that is a little flawed is that the performance of the Apple II processor is very average,The compilation speed of the program is relatively slow,But fortunately, it does not affect the final running effect。
Uncle Zhao, who was addicted to the BASIC world on paper, accidentally looked up and found that Zhang Lexing was playing "Digging for Gold" (in fact, Zhang Lexing was just comparing the operating efficiency of programs written in different languages), and immediately ran over to watch it.
"Lexing, what kind of thing is this, it looks like it's funny. Uncle Zhao asked curiously.
"Well, it's the game, I just wrote it. Zhang Lexing, who was thinking about the problem, replied casually.
"Come, give Uncle Zhao a copy. A floppy disk stretched out in front of Zhang Lexing.
Zhang Lexing came back to his senses, smiled bitterly, and used the disk test tool he wrote to copy the game disk to Uncle Zhao, and Uncle Zhao happily took the floppy disk and received it in his floppy disk box, probably planning to play in the afternoon.
Seeing that the C compiler worked well, Zhang Lexing began to further optimize the operating system. First, some tweaks have been made to memory management to reduce the usage of operating system memory, and secondly, a simple disk compression function has been added, which has increased the floppy disk capacity from 160K to 220K in disguise, so that a floppy disk can be stuffed with more things.
After the completion of the operating system and the C compiler, Zhang Lexing took advantage of the rest of the Sunday to start a new goal, and aimed at the VisiCalc spreadsheet software in the random software.
Welcome to the majority of book friends to come and read, the latest, fastest, and hottest serialized works are all here!