Chapter III Basic Understanding
First application tool
First, the proposal understanding
The writing program is not difficult, but it is not easy to write a good program. This is like painting, everyone can paint, and the picture drawn can have a bird. I want to make a good painter, you must first have the ability to observe and analyze, facing messy things, first sorting out the head, find the theme. Outline in the canvas, this is called "layout". After the layout is completed, according to the actual environment, the order "order" decided. The order is a hierarchical concept, and the scenery and colors have a certain level, and they must not be casual. Where is it, where is it? After the observation is finished, it is ready to prepare, first put the tools such as brush, palette, and adjust the main color to be expressed. Finally, the appropriate brush is selected, and the color is placed, and it is applied to the canvas according to the results observed. Drawing is quite heavy, some personalistic artists, skills are not proficient, only because of the trend or historical conditions, they have created a unique style. The general painter is not, whether it is "the pen" or "Freehand" painting, relying on its skills and literacy, and begins to survive. As for the art masters, the first weight style, plus literacy, skills, and can be famous, always immortal. The worst manifestines have neither observed ability, more talks, and plagiarism, in addition to the work of others, imitating, creating valuable works. If this is the same, you can only follow the meaning of others, fill the instructions, but it is a ruler. Under the observation analysis, the contents of the desired content becomes a specific step, with computer terms, is "program analysis", equivalent to the "layout" in the picture. Going back, it is "process" production, or the order of painting. Cooperating the hierarchical arrangements of various programs can first start writing, equivalent to starting painting. These concepts are involved, not three words can be finished. This book is only available in the training of combined language writing. If the reader can make good use of the various techniques of the combined language, they can fully understand the work to be completed, at least the "pen painting" condition can be satisfied. For a computer program, the current painting of "Paintings" is higher than "writing". Below, we have to understand the application of the combined language with the standings of the stroke. For oil painting or watercolor, the color material is equivalent to the "information", the color palette is the "provisional", the brush is equal to "instructions", everything is ready, the so-called "painting" is "a writer" . The program is a series of executable procedures that defines and instructs organizers, and the original file transition into the destination file (.obj) by the form of a file (.ASM). Then, then one or several destination files will be connected (.exe), or re-use EXE2BIN. EXE makes a memory limit (.com). The program teacher should be familiar with each of the above processes, and can successfully complete program writing. The writing method of the program is unclear, completely seeing demand and application. However, as a picture, in the layout, the program should have all the concepts first, then gradually implement. In order to improve efficiency, these steps are necessary to classify. The result is the so-called module. The goodness of the module determines the performance of program writing, modification, and reuse. Requires the concept in writing, continuous. The modification should be convenient and flexible, and it is not incorrect. And the application is complete, you can call independently.
According to the above conditions, the structure of the program can be roughly divided into: 1, the main process: the process of coherence, should be clearly considered, the details are temporarily placed, and the big architecture is written, so as not to take care of the end. In the case of sufficient space, the large architecture should be a complete module, and under the overall concept, uniformly. This approach, has a great help of program detection and modification. Because of the most modified and adjusted, the maximum impact is the most, it is inevitable. If the main process is in the same module, it is easier to get an ideal effect. 2, Subscriber: Subscriber is handled by some details, can be performed in 'Call'. In principle, the processing of details is often repeated in different situations, as the subscriber is quite favorable. Just pay attention to the handle of the call. For efficiency, parameters or data to be processed will typically be loaded with a buffer via a scratcher or if necessary. Since it is a subscriber that can be shared, and this type of range is an independent process, so it should be tested in advance, guaranteed. In addition, the inlet of each subscriber should be understood by the way of intending to use the system, and it is possible to come.
3, Sonit: Sudomiors are different from the subscriber, which is a complete function. The so-called complete function refers to this segmentation can be performed independently, with a fixed function. At the time of application, both are no respectively, however, when writing, the submodes should be cautious.
4, data file: The data file can also be considered a static program, although not executed, but is an indispensable material. The design of the data file should pay attention to the utilization of space, the most efficient data structure of the same length, it is best to ensure that the starting point is double numbers to save the execution speed of the 16-bit bus bar. When applying a buffer, avoid arbitrary settings, often set a buffer, etc. Later, it is not necessary, and then want to delete it. Therefore, it should be arranged in advance to find and adjust at any time. The way arrangement is used, and some are classified by modules; it can also be sorted by alphabets; or the detailed annotation will be added to the document label.
5. Application Table: Section 6 of this book will introduce the function and application of the application table. After the design is complete, it is rarely modified, for work efficiency, independent becomes a file, own necessity.
In addition, the namings of various programs can be representative for application; the program cannot be too large, otherwise the editor time-consuming time is time-consuming; when the sub-file, pay attention to the issues of the label declaration and various paragraphs. In the magnet, you should specialize in a subdirectory, do not mix all kinds of non-coercive programs. Chapter Chapter IIII has stipulated that the format standard has been specified, and only one is added here. That is, the definition of each buffer should be equal to the length of the use, otherwise it is prone to errors when compiled or coupled. When linking, there is no sufficient error message, and the supply division knows the wrong origin of the wrong. The most difficult mistakes are often related to the definition of the buffer, that is, the defined type is inconsistent with the type used. Another situation is the change of the value, and its remedial method is in the application, temporarily adds a "pre-definition". The "pre-definition" means that when the specification is a word element, it should be edited by the BYTE PTR, otherwise, use Word PTR to determine its value, to ensure security. Such as: MOV BYTE PTR BBSDOT1, Also, each time the value changes, all: Assume Cs: XXX, DS: YYY, ES: ZZZ This kind of use is completely to the assembly program "see", The program itself does not add any instructions. For other regulations, please refer to the relevant manuals. Second, the understanding of information
On the canvas, all colors are made from red, blue, yellow three or white, and understand the changes in color are the basic row of painters. In the computer, all the information is composed of binary data. To write programs, you must have a deep understanding of the binary characteristics. Most of the programs don't know the wonderful use of the binary data, and the amount can be quickly converted to the value of the binary and ten. Otherwise, it is aligned by the binary value to the drawing of the graphics, so. The binary is the concept of the switch, associated with a series of openings, which can occur, completely in each switch, and the function of each switch combination. It is clear that it is necessary to analyze the functional analysis of various needs to be designed, find out the factors they can use, if these factors can use the "Open" and "Off" representatives, you can use binary system. control. In theory, only two effects on one level, and two sets of switches have 222 functions, the most ideal design is to use the number of combinations of switches to the limit. For example, the color applied to the computer is one of the ideal designs. In the computer, the most basic application unit is "Byte", with 8 "bit" (BIT) per word, equivalent to 8 "switches". In order to make the most simple to apply a variety of colors, only three primary colors and luminance are combined, and eight switches can produce 256 different colors.兹 分 一 (一 (的 下:: Switch 1 (bit 1): Positive Blue Switch 2 (Bit 2): Green Switch 3 (Bit 3): Positive Red Switch 4 (Bit 4): Gray (High) Hugh) Switch 5 (Bit 5): Black (Low 低) Switch Six (Bit 6): Light Blue Switch Seven (Bit 7): Light Red Switch Eight (Bit 8): Shallow Clean ★ The above (bit n) It is calculated from n = 1.
It should be noted that the basic unit of the computer is eight switches, and it is a waste of not enough. If 8 is not enough, there are 16 additions. Therefore, due to the matter, it is only cost-effective to use 8 multiple times when designing. However, things in the universe are not necessarily a multiple of eight. If the designed person does not understand this, you cannot divide the information to be partitioned, and this favorable condition cannot be taken with 8 as the restriction condition. Of course, it will not be the most ideal result. Therefore, it is necessary to have the highest efficiency, first to organize the data into eight multiplier structures. The data is organized as the most effective structure, called "data structure", about this, will have more detailed examples thereafter. Each font has 256 arrangements, ie, equivalent to 256 inclusive numbers. In order to facilitate the understanding of people, the character is usually written into a hex in form, and a 'h' is added after its number, and it is not true for the decimal number.兹 将 进行 十 进 进 进 下: 二 进 位 八 进 位 值 十 进 位 位 进 位 位 位 位 位 位 位 位 位 位 位 位 位 进 进 位 位 位 位 位 位 0 0 位 0 0 5 5 5H 110 6 6 6HH 111 7 7 7H * 1000 * 10 8 8H 1001 11 9 9H 1010 12 * 10 0AH 1011 13 11 0BH 1100 14 12 0CH 1101 15 13 0DH 1110 16 14 0EH 1111 17 15 0FH * 10000 * 20 16 * 10h ★ Waze, there is a * person to expose. ★★ After the binary number should be added to 'b', then add 'o'. It is known that the hexadecimal is still used in the 10th entry, just 10, there is no need to use the number, so you have to borrow English letters. In the program, the assembly program is in order to distinguish the ASCII characters and the hexadecimal value, and usually, the hexadecimal value begins with English letters, adds an '0' before its letters. Third, the understanding of the temporary depositor
The register is equivalent to the panel, the data is equivalent to the color. Put the colorant into the panel, for the predetermined effect, the scratcher is also available. The palette has a large smaller, and the depth is deep, and its purpose is for different situations for effective processing. The terminus is also the same, the application is good, the program will be very streamlined, easy to modify, read. Otherwise, which one is to use, there is no principle, there is no chapter, this program is agreed to compliment. The importance of the scratch device is that the handling is convenient and flexible, the speed is fast, and the space is small. Unfortunate 8088 CPU's temporary system is very small, which is always stretched, hard work. Because of this, the use of the scratch is used to become key technologies with high programs. Some programming teachers are reluctant to settle down, often set some "buffers", using buffers to be named, easy to remember, actually put the precious terminus, as the transportation of each buffer, handling materials, only See the information keep moving into the move. Although the program is a little event, the running speed is wasting, and the space is also ruined. Write such a combination program, which is far better than to use high-order languages. Of course, the buffer is necessary, but it is limited to "necessary", and in the program plan, the conditions of various applications should be considered, and after the value in the buffer is taken, the processing is completed. If you cannot solve or often use the information you want to use, try it in the schematic. In fact, any program is impossible in one process while needing a lot of special information. Good programming teachers can handle complex work to be inserted, and the skills are not enough, and simple things are often difficult to understand. The 8088's tentator is indeed not enough, but it is less than the point to replace by the buffer. The quality of work, success or failure, with human organizational skills have absolute relationship, limited to space, we can't talk more. However, with the characteristics of the scratch, it is also one of the methods of training that training organization. First, we should regard the temporary depository as a tool, understand the functionality and nature of the tool, and then be able to remember to the heart, use it.
According to personal understanding, the scratch segmentation segment segment: 1 Stack Pointer: SP 3, Memory Conversion: Source Source INDEX: Si List Destination Index: DI 4, General Use: Cumulator Accumulator: AX Base: BX Counter: CX Data: DX 5, Sign: Flag value status: flag 6, instructions: execution value instruction Pointer: IP For easy memory, we give the provision for the Chinese name, which is defined as: all segmers "Segment", as the starting position indicator of each segment, the value of the value is: the absolute address = (this value × 16) each segment address is 1600h, multiplying 16000h. If the source render is 1234h, the address called by 0 in the system is: 17234h. Attention, various tuners named "instrument", all of which are limited, do not mix. All those who are named "value" are unable to use the provision of the provision of the routine. Such as the stack value (SP) system indicates the location of the stack; the flag value (FLAG) represents the case of the flag flag; the execution value (IP) represents the address currently executed by the program. These temporary registers do not change, but it is not enough for skills, it is best to keep the original value, do not act rash. There are two kinds of "instruments" that are often used, one at 16-bit dollars, such as stack utensils, source depositors, and terminals; the other has two respective "high" and "low", each has 8-bit dollars, can be used alone, and can be combined into a 16-bit tension AX, BX, CX, DX. The scratch is usually used as a container, but some are used as the address of the memory area to remove the data stored in it. The former is called the container function, which can be calculated, logic processing, etc. The latter is called the address function, which is used to deal with the information of the locations located in each "." Due to the addressing method of the 8088 CPU, it is limited to the immature design concept, and the IBM is unique. It is selected, the so-called city gate is fire, and the pool fish, readers have to spend more effort, be careful.
The stack utensil (BP) belongs to the memory location of the stack segment, which is provided to the high-order language structure. For the combined language, the function is not large, but if it is good to use, it is not worthless. The source depositor (Si) is fixed to the data segment, and the data in the source depositor is removed, and the information refers to the information segment. If DS = 2000H Si = 1234h, the 1234H system independent system in Si is 2000H × 16 plus the address value 1234h. However, users do not have to calculate, as long as they are determined by the data segment, the location is 1234 h. The terminal (DI) is more complicated, usually it is pointing to the data segment, but several instructions involve a large amount of data transfer, which requires movement to the terminal by the source depositor. Since the segment is limited, in order to facilitate the application, specifically, in this case the terminal is pointed to the special section (ES). That is, it can only be moved from the data segment to the special section. The programmer can set the segment interrogator and transfer it. To make data transfer in the same paragraph, the data segment = special segment should be made. The generally used temporarity can be divided into two 8-bit elements, each named high, low scratcher, such as: accumulator: AX high AH, low AL, BH, low BL counter: CX high CH, low CL data: DX high DH, low DL in which the accumulator is the strongest, can be multiplied, except calculation, AH still has special instructions for storage banners. In particular, when the value is taken from the memory area or put the value into the memory area, the efficiency is the highest, such as LODS, STOSW, etc. Because of its high function, it is flexible, so it is advisable to make a mission, do not pay a fixed mission. There is an important feature that is generally used in the regissors, unique to read the data from the memory area (except XLAT instructions), so as "data and address conversion" (later, this will be introduced Function) Convenient and abnormal. The counter is often used as a record of "loop" or number of times, and there is also a dedicated instruction unless it is not available, or the count is used, it is best to keep backup. The data appliance has the least function, it is best to fix it, and the information that often needs to be applied, placed in order to play the highest efficiency of time space. Fourth, awareness of the directive
The command is "Command", "Command" to control the computer, and implement the program step by step. The format of the combined language is: (Downlink Morton "[]" That is, it is the usage of the front. 11 Sean Name: The operating elements behind the table should belong to this temporary pre-segment. Such as: MOV AX, CS: BUF1 12 Definition: Indicates the temporary definition of the buffer. Byte PTR represents information defined in a character; Word PTR table double-character data. Regardless of the original definition of the buffer, all of them are defined as programs, such as: add byte PTR BUF1, CL pre-predetermodation, in addition to the definition buffer length, JMP Short ABCD
2, instructions: 11 Use method: 1-1 Terminal to the speculation, but the same length is the same. MOV AH, BL; for the character XCHG AX, BX; is a two-character 1-2 Terminal to the buffer, or a buffer to the scratcher. OR BUF1, AX; BUF1 is buffer, Word Add Cl, Byte PTR BUF1 1-3 between the value and the scratch or buffer. TEST DI, 8000H and Si, 0FFH SUB BYTE PTR BUF1, 3 ★ Numeria is absolutely unable to use the "purpose" operating element 1-4 to put the address of the memory area in the schematic, or transmit the variables for the address Indirect call information. This method is limited to the Source Manager (Si), a Fault (DI), a Stack Uweer (BP), and A Solder (BX). Such as: Mov Al, Byte PTR [Di] XOR [BP], DL MOV AX, [DI] [Si] MOV AX, BUF1 [DI] JMP LAB1 [BX] 1-5 Executive Instructions, no source or purpose Operating element. PUSH CS POP DS CALL ABCD JMP ABCD CLI STD LAHF RET 1-6 Executes the count. LOOP ABCD Rep Movsb Sal DL, Cl Ror AX, 1 DEC BX 1-7 Speakers Special Instructions. OUT DX, Al Mul BUF1 DIV CX Stosb Lodsw 1-8 Conditions Author. JNZ ABCD JA ABCD JCXZ ABCD INT 10H IRET 12 Application feature can be divided into the following eight: 2-1 data transfer: 1-1, 1-2, 1-3, 1-4 is possible. 2-2 Flag Control: 1-5 Received the flag. 2-3 Address processing: 1-1, 1-2 items. 2-4 Mathematical calculation: The above items can be determined by the instruction. 2-5 String Process: 1-6, 1-7 features. 2-6 Control conversion: 1-5. 2-7 Conditions Perform: 1-8. 2-8 Interrupt Process: 1-8.3, Operation Yuan: It can be divided into telecontrol, buffer, and value (IMMEDIATE DATA). Its writing method is just the opposite of the habit of the habit. Please be careful when using it. Please refer to the Composite Language Manual.
Section 2 Working Environment
First, system space
The memory area address of the IBM PC is a BIG Endian, that is, the order value is large to small, and is different from the address commonly used by the little Endian. Regardless of the purpose of this design, this concept of the habit of people has brought great troubles to writing a combination language. Not only doctors often have a wonderful, but even my personal has been treated with graphics for many years, I feel sweaty. Each time you process the graphics, you must draw the original picture on the paper, you can see what is going on. For example, there is a graphical value in AX. To write into the memory area where Di refers to, after writing, AX is to move one bit to the right and continue writing until cx = 0. This is a very simple, and often used, but when using "flip address", trouble is coming. It is assumed that the AX value is 4567h, DI points to memory area 2000H, flipped, is to put the value of Al in the memory unit of 2000H, and then put AH in the memory unit of 2001H. If it is seen from a small to a large address point, this is equal to the value of 6745h in 2000h. This is not tightening, because the AX is placed back from the memory order 2000h, still becomes 4567h. The problem is when the map is made, once 4567h becomes 6745h, the graph is reversed. The method of remedial is to exchange AH and Al before putting into the memory area. After finishing, re-exchange. It's not a matter of fact, but white is wasted to have two instructions time and space. For the speed of the paint, it is necessary to draw tens of thousand points, and the accumulated time is not small. In addition, in the case of the writer, the effect of the graph can be capable of mastering, there will be good results, like this to turn around, the head is fainted, naturally lost to resistance. Now, the 80386 CPU has come out, and does not talk about the effect. Readers can try to convert 32 yuan 12345678h how many procedures? This painful procedure is also one of the reasons for Americans who are unwilling to use combined languages. In the high-order language, there is a compiler, and the problem is not big. However, the requirements for efficiency are not paid. Graphics functions are one of the mainstreams of today's and future computers. Since the designer does not have a vision, it leads to infinity. The problem is still more than this, the system space of IBM PC / AT, in theoretically, can have 1MB (temporarily do not have to consider problems such as memory expansion and EMS), but truly provide space as a program execution, less than 600KB.
We also look at the arrangement of its system space: 0000H 000H-007FH meter 128 characters, 32 basic interruptions. 0008H 000H-0380H 896-by-element, for system management interruption. 0040H section 0000H-00ffH gauge 256 characters, for basic program. The 0054H section 0000H-9C00H is about 34K characters, and the DOS program is occupied. Only the first half of the 00 -09000H segment is the space that the user can control, and thereafter, it is used by the system: 09000H segment from 0A000H until 0FFFH, for DOS. 0A000H segment, for the VGA graphic display area. 0A800H segment, for the EGA graphic display area. 0B000H segment, for the textual buffer, the screen processor 6845 automatically manages. 0B800H segment, for the figure form display area, the screen processor 6845 automatically manages. 0C000H segment, to 0D000H segment, various models are uncertain, for EMS expansion memory. The 0C800H segment, for reading the memory, which is a hard disk control. 0e000H segment, 1MB host is RAM here, otherwise this paragraph cannot be used. In the 0F000H segment, in order to read the memory area, it is the basic output / input. It is known that the planning of the entire system is not satisfactory, especially limited to 8088 CPU original erroneous design concept (segment temporary depository is now 16 times, that is, each into one, equivalent to address increase 16. In the initial, If it is not considered to be compatible with 8080, it can be easily set to 256 or higher.) So, when the memory capacity is to be expanded, it produces this unhaneable high-tech deformed.
Second, peripheral equipment
The so-called peripheral equipment, refers to the external settings that must be performed through the output / incubation flow 埠 (I / O Port), and the external settings controlled by their management program. Under this definition, the keyboard is a peripheral device, in addition to this, the screen display, a printer, a disk machine, and the like are a peripheral device. Obviously, the program must understand the nature of each peripheral device, otherwise it will not be able to start. Due to the wide variety of surrounding equipment, it can be said that this book is not intended to be introduced without techniques. To put the specifications defined by various devices, in the Notepad in the Notepad, keep it at any time. In addition, for the programming, it can be effectively applied to the peripheral equipment of different specifications, and must not be handled in the application. It is best to set up a variety of interfaces, as an accessory program, by the user. The first reason for this plan is that there are no one in the future, and there are many different devices that need to be needed. It is not easy to increase in the future. It may cause insufficient function, or the consequences of the program. The second reason is that the device that the user often uses is fixed, and some of the programs that have never been used will never have a waste space. The third reason is that the technique is in progress, and the program application concept is difficult to change. The interface program of the leading program and the peripheral equipment should not be tangled. There is no dregs and carefully carved programs have eternal value. One day, when computer technology matures, the original application does not need to be changed, and only the accessibility of the peripheral device is replaced with new. This is life, it is a metabolism, with these understanding, it can understand the essence of the combined language.
Third, system program
In the IBM PC / AT system, there are only two system programs, one is the magnetic disc operating system (MS-DOS or PC-DOS), responsible for system start, memory area management, and partial output / processes. This system is originally stored in a system disk. When it is turned on, it is easy to modify. From the initial version 1.0, it is now 4.01, and its function is still constantly improving. The other is a basic interrupt service program (BIOS), and stores in the memory of the memory, unless the model is easy to move, otherwise it will never change. The main function of the basic interrupt program is a convenient staff, and the parameters needed by all peripherals are transmitted by the scratcher. The programming division can put the correct value and put the correct value, and the basic interrupt will be prioritized. These two system programs, programming teachers must be familiar, at least, what kind of function should be used to use. These two systems have been due to their ambient, and the speed is not ideal. Because some of the staff, do not have these interrupts at all, and control the output / enter. This practice does improve speed and free control. Further, the versatility of the program is also reduced. Whether it is worth it, it should be considered first before the design. In addition, these two interrupts are somewhat repeating, such as keyboard inputs and screen output, etc., often unknown how to choose. Some people suggest that the discharge of the disk is interrupted, I think it will use the basic interruption. Because the system allows program to change the entry value of the basic interrupt, all programs that use basic interrupts can modify the entry to increase their application. The disk operation system is not, although the program is on the magnetic disc, and in constant improvement, it must also take into account the past customers. After a long time, the problem happened. And the greater the improvement, the more likely the way the way, compatible is the synonym of the past dross. The higher the compatibility, the higher the baggage, the greater the space waste. In this basis, the construction must be risky: Whether to one day, the magnetic disc operation system will face a difficulty of running or disintegrate. O / S2 has been shown that the largest limit of this system has arrived. Basic interrupts can be changed, meaning that in addition to a waste of BIOS space is inevitable, in the PC series, the concept of system interruption will not change again. As long as the programming teachers can grasp the skills of basic interrupt, the future system changes to any point, a program with practical value, theoretical, theoretical life period should be very long. Fourth, equipped
The equipped model refers to some unnecessary basic prices, only because of special needs. Usually, it is provided by some systems and is equipped with some programs. The equipped program includes various computational functions and drawing formulas, special processing LIBs. Wait, in some cases, it can also be regarded as an environment, such as Windows Management MS-DOS WINDOW, memory expansion device EMS, etc. The production of the program has proved the roundabout history of computer software, and also means the flexibility of the software. In my personal concept, if there is a certain design method, there is a unified design, it is likely to become a "common module" in a large number of, continuous development, and can provide modules to provide modules. User applications make the software make it easy. Writing or applying these programs, there is no other way, only familiar to the chest, can you have a hand.
V. Common modules
The module should be the mainstream of future computer software development, each type of module function, representing the experience and trick of all walks of life. Users do not need to understand the production skills of the module, as long as you know how to call, you can do your job. There are currently no manufacturers to provide "public modules", but with the view of the concept, once there is the theory, some people go first, this trend is about to be formed. We are about to launch the "Jiezhen Integration Module", the first stage is still limited to the use of the program, and then the next step, when the interface is completed directly, the development direction of the program will change the string. Section 3 Treatment Object 1, Data Information
Data data rate refers to the binary data that can be entered, handled, and calculated. During the operation, security is the first consideration, and it is necessary to take care of accuracy and integrity. Such information generally said that the quantity is quite large, to properly plan the length of the data, otherwise the storage space will become the main topic of the execution program. When writing this type, the conversion of the various carry systems, the positioning of the display area, and the processing of the calculation formula, etc. should be used as a procedure for arbitrary calls. The real key problem is that the limit of the data can be clearly known that in a limited range, it is absolutely designed to design a "structured" specification, in line with efficiency. Otherwise, according to its rule, the characteristics of the mating program are effectively treated.
Second, text materials
The text data is mostly characteristic, and the pinyin text should be noted that the spatial adjustment, hierarchy, hi-tail, unparalleled change in the word, the rules of the line, the shape, the font size, etc. There is also an input code, internal code, etc. In principle, if you want to consider, English is compatible, you should pay attention to the location of the word on the screen to display the word memory area, which should account for the same proportion. At present, due to English characters, the code is not divided, all of the words, the standard format on the screen is 25 lines, that is, the so-called "text state". There are at least 16 点 阵 阵 阵, and the Chinese characters are required to use graphical ways (also using text states, plus special hardware, but the cost is high, hindering Chinese computer future development). Therefore, when 640x 400 or approximate specification is used, the ratio of Chinese characters and English is about 2: 1. On this basis, the length of the interpretation of the two-character Chinese is the most common structure. However, with the advancement of technology and concept, some English systems have been using the two-character or secondary ornous, and Chinese has the necessary four-character. On the other hand, the "national code" used in the mainland has been copied from Jis Code - Japanese industrial standards from the 1950s, with a maximum of 8836 symbols, of which "Chinese characters" is less than 8,000. And the national code is more streamlined, and the 收 字 6763. Chinese is from China, but now, it is now the "industrial standard" of the Mirror East Yangyang, and it is turned into a "national standard" of more than 10 billion people. It is reasonable to mean everything. Coincidentally, Taiwan also has a so-called standard, and 13,053 words of BIG-5, although it is twice the national code, the two is the difference between fifty and billion. Why set this type of text of "insulting the ancestors"? Who is qualified to set Chinese standards? Engaged in computer workers just "technical experts", and all the technologies in this line of the computer have not yet been proficient, let alone alterations such as hierarchy, actually fishing over the world, getting this world, this area is from 100,000 miles. . The text is human thought, cultural carrier, and the first sages are trying to create the text created, which is used to convey their awareness of the universe, life. Our descendants are deprecated, and they can't comprehend their diamonds. Insufficient computer technology, there is no ability to make computer applications in Chinese, which can also be understood. But self-righteousness, the relief, delusions, only use a few aware words, "text standards" in the whole country, and forced the Chinese to accept, this kind of 颟顸 is difficult to agree. When using Chinese, due to the different system concepts, some even violating foreign software, in order to compatibility, it must be "cut". In principle, the Chinese internal code sets the eighth bit in the first word to one, which can be different from the "American Industrial Standard Code" ASCII (American Standard Code for Infor-Mation Interchange). The most important work in text data is the technical problem of sorting. The national standard code is only more than 6,000 words, but it is divided into two episodes, puts common words in the front set, and common words in the rear. However, this order is unrelated to the user's concept. In addition to the scholars who use frequencies of this frequency, it is impossible to understand what words are common words, why do you not? So, when we need to use the high-speed efficiency of the computer, the national standard code is completely united. That is, the encoding is originally increasing efficiency, and our code is only for coding, and the efficiency is not coherent.
The only remedy is to build a rank table and use the national code one by one. Because of the high profits, high-level, high-level, high-level, high-level, just moving hands, it is inevitable "high-quality", and then "high argument, low efficiency". I believe everyone has a dictionary or phone book experience. It is easy to use in English, and there are more troubles. The Chinese only knows that the disadvantages are deficient, and they are inferior, but they don't seek to understand their causes. The average person will be so far, if the high-tech field is, it is a bit unreasonable, and even doubts nothing. English so convenient without him, because its letters have direct indexing features! Chinese has a set of "ministry, strokes" index concept. This is indeed found in the past, and it is also an foundation, but it is also suitable, but the direct index of the letter is compared to the alphabetic direct index. Some people think that we have to maintain Chinese culture, we should die in the ancients. This kind of saying is only a little short, that is, forgetting the big man's clothing, but also replaces the modern affairs tool with the four treasures of the literary. The trouble is, "Department, stroke" is two different index concepts. When there is no time factor involved, the relationship is not large. However, on the computer, it must be set in the order, otherwise it is difficult to execute. People who have fewer surnames, of course, the "stroke" is priority, the surname is obvious, then the first row "department". This is not difficult to understand, attend an important celebration, or debut in the newspaper, a lot of people, the interests involved in the rankings, are of great importance, can't fight! The problem is that in addition to the private index concept, what is the practical value? If you must save, as a special case, of course. However, the computer is pursuing the efficiency. Each Chinese parties and strokes need to build a comparison table, and they can be applied, the greater the sequence, the greater the space demand, the longer time consumption. This is not said that the index is not only available to the computer, but people need more. Take the phone only as an example, "Zhang Wei Xiong" this name, what do we know about the "positioning" relationship before and after? On the surface, as long as the three ministers and their strokes, and three strokes of these three words. In fact, in the process of finding, every time you encounter a name, you can repeate the foregoing procedures to compare. Some people have a word saying that some words look at the past and know that they are a few paintings! At least I personally there is no such thing. And according to statistics, the Chinese averages in 14 paintings, from nine to 18 paintings, it is difficult to distinguish by visual distinguish! If a person is more than a person, the visual is easy to fatigue. Some people talk, now they are sorted by the computer, and people are not coheed! I don't know if the letters can be performed immediately, and the department is first, the strokes are more than three to six times.
1. Check the first order value of this word. 2, check the first order value of the subject. 3, compare the size of both, decide whether it needs to be more than. 4, then check the number of strokes. 5, check the number of strokes of the word word. 6, compare the size of both to determine the sequence. Write these steps into a program, in the internal size of the Chinese two characters, (meaning Chinese collapse is below 20,000) If you use a comparison table, the space is more than 64KB or more, the speed is about 50 times more slow. . If the formula is calculated, space or can save, the speed will be slower and a hundred times more. This also refers to the case of 20,000 words. If the Chinese characters are all set, the consequences will be unimaginable. Therefore, "experts" agreed that for efficiency, the less the word is received, the better! How can I be a real "Chinese computer"? "The" enemy "faced more than a year ago, it is advocating the Chinese characters. This kind of person is not difficult to deal with, because they are still Chinese, under the banner of national righteousness, there are also many people in the hearts of the Chinese computer success. Different, just they don't believe there is this possibility. Today's "enemy" is more tenacious. They also call the slogan of national righteousness, but also recognized Chinese computer "experts". More terrible, people who currently use Chinese computers do not have any clear understanding of Chinese culture, there is a tool to print some files, it is quite perfect. Therefore, these customers are also in their subjective position, which determine the half toner of this "high market share" is the standard of "Chinese Computer"! is it? If the Chinese word has six or seven thousand words, and now only thousands, even 10,000 words, then other words? Is it not a Chinese, if calculated, why is there? " Can this computer say "Chinese computer"? Some people say, there is no relationship, and then said later. how to say? There is a way to divide the text "Diversity", divided into: common words, secondary words, secondary common words, rare characters, hankets, etc. And no matter which scholars have such a big learning to "diversity", I know just use this method, people have no memory, Chinese sorting difficulty and doubled. It is also no wonder that some people think that Chinese is not scientific, is this not a certification? In fact, Chinese sorting does not have problems, we use the hazard letter as an index, efficiency is equal to English, and the collection can be up to 10 million. As for the memory space, one of the characters is not required. More favorable is that the index used as a dictionary, a phone book, etc. The internal code is a system, according to its different needs, a form of information booked, there is no reason to force the provisions. Of course, if there is more inner codes, the auger will naturally form difficult to communicate in neintment, no matter how code is good or bad. Therefore, it is necessary to establish a "exchange code" for the internal code of different systems, unified exchange applications. This exchange code is standardized, and when it is set, it should be cautious, and it is necessary to accommodate all the words received by all systems, otherwise there is no exchange. No matter which code, there will be its special provisions. Before writing, the program must try to find the "code table" used by the system, otherwise it will not be processed. Third, graphics information
In terms of processing of computer graphics, there is currently only two forms, and the former is the Digital Data, the latter is the formula value for the drawing. In fact, there is a so-called "conceptual information" form, and after analysis, the visual effect is analyzed, and the concept "" "concept" organized by people. This conceptual information is very streamlined, easy to store, after removal, and revert to the process of "conceptual illustration". A excellent painter must have this concept of conceptual figure, as long as the painter's experience is written, the characteristics of the memory are designated as information, and the computer will be faithfully executed, and each time it is exactly the same. If it is handling two-in-in-line data, there are several simple functions such as compression, restore, interception, and synthesis. Drawing vector values are more complicated, involving various techniques such as calculation, adjustment, variables, and hierarchies. Simply put, the drawing information is considered, which is difficult than the textual data. To achieve ideal efficiency, the most important thing should be the definition of the data structure, followed by the arrangement of the hierarchy, and a description of the characteristic properties. In addition, input variable processing involves people's application, in addition to professionals, most people have not adapted to this new drawing concept, the insufficient experience, has not yet produced ideal programs. Concept drawing will be the mainstream of the future, it is not only in line with human cognitive habits, but also easy to apply. As long as the concept information is constructed, it can be obtained by changing some concept elements. Four, conceptual information
The human system thinks in concept and understands the outside world through the concept. Therefore, for people, the most effective application is the concept that people are already familiar. The concept is not a language, but the most basic factor in forming the language. Everyone is unique to the world, because human survival is in the group space, it is necessary to exchange experiences from each other, so use the auditory effect expression concept, and uses the visual symbol, it produces text. The aforementioned image concept is a "socket" information. In addition to the elephant, there is an abstract, including subjective feeling, cognition, desire, etc., because of the subject, it is not discussed here. In short, the structure of these concept information is inevitable in the computer, but because each designer's point of view, the performance is different. Until now, there has not been seen in the actual application concept, but it will become the basic structure of the computer, but it is the day to wait. As a programmaster, every day with the computer is Wu, you can't know the future trend of your computer, you can't do much effort, master the technology development. It is because the concept information has not been fixed, everyone has the same opportunity to make a first generation of the first generation. Otherwise, wait until the big chart, only in the back, it is not allowed.
V. Comprehensive information
Strong functional program, very few only single materials. In particular, "integration software" is getting more and more attention, and various information will eventually be integrated. The integrated information has two senses, one is the input information known to the person, one is the processing information stored in the computer. Input data can be subsequently instructions and characters. In the traditional concept, the instructions do not treat the instruction as information, because once the instruction is executed, it will no longer occur. However, after the desktop type typography software is widely popular, in order to control the layout, the relevant instructions must be stored simultaneously. The typography has become one of the important functions of the computer, so in the future development, the input information must be taken into account. In the integration concept, the input information should have a unified provisions, that is, whether it is the nature of the software, its keyboard application, character definition, etc., there should be comprehensive considerations. Regarding the content, there is also the dispute between ASCII characters and "World Character". For early English systems, other texts are irrelevant, so there is no appropriate "World Word Code" for applications. However, the information era is not in English using the country's patents, and it is important to see the word code during the awakening of countries. Regardless of how ISO international organization faces the problem, I personally don't believe in the world text on its reserved, extremely limited "encoding plane", can play a lot of benefits. At its quantity, some business applications are available for a while. I think the real information criteria will be a natural language that is fundamentally used by Chinese characters, and the most ideal way is the most ideal way. The pinyin text system is preferably two-character, in addition to the development of the world's text, in accordance with the development trend of the current microcomputer. On the Chinese system, we use the "natural code" of the four-fi-fi, which is about to enter the code compressed scheme. In this way, we can use thousands of Chinese characters, some people will say no one needs so many words, but who can expect anyone in fact? When the warehouse was originally confined, I believe it will not exceed one thousand. If he rules "standard" restrictions, it is hard to imagine what culture will be in our nation? Taiwan has an expert to this kind of opinion, saying that "do not agree with the trend, destined to fail", however, who is not in the same trend? The four-character microcomputer has arrived, and it is recognized as the future mainstream. On the hardware structure of the four-character, it is the most effective in the secondary font. So these ideas have been outdated, or they still have some banknotes, put the work of research and development, and give it to the qualified person to do it! Section 4 instruction application
The combined language can be said to be unbeaten, the original computer language, the readers can find the rules of their application to play the highest efficiency. Below, I only provide some shallow experience on personal experience and to reach discussions. To write a good process, first, you should read the clock pulse (Clock) and instruction length of 8088 instructions. In general, the information related to each directive is detailed. "Workers want to do things, you must first sharpen our equipment", this is also. The details discussed in this section are the details of the general program, and all examples are extracted from some of what I have seen. It seems that there is nothing big, but it is the efficiency of the program, which is greatly affected by these small places. More importantly, anyone, as long as there is a habit of "small things do not do, small and good,", I dare to assert, this person will not have a great achievement! I have recently checked the clock value of Effective Address (EA), I don't think there is no need to die. In principle, it is 5 clocks when the scratcher is variable, and the direct address is 6; if the two sets of variables are used, it is 7 to 9, and the three groups are 11 or 12. For the sake of convenience, the following is "T" table "clock pulse"; "B" table font. Where clock pulse T = 1 / vibrating soup frequency is avoided, avoiding waste and space
The efficiency of the combined language is built on the application of the instruction. If you do not have the effective use of the following instructions, the advantages of the combined language are difficult to play. 1, Call abcd Ret This method is no intention of the result of 4B, 23T 20T, exactly the same function, such as JMP ABCD or JMP Short ABCD as long as 2-3b, 15T. In addition, the above-described Call XXXX is a format called sub-program, and in intuition, it is completely different from JMP XXXX. For overall design, it is an incorrect mistake. When it is detected, it is difficult to master the concept of the whole. Especially when streamlined, it is likely that ABCD is completely independent, and it is necessary to move this section directly to ABCD, but also save space, but also make programs, easy to read.
2, MOV AX, 0, this instruction is 3B, 4T, if used: Sub AX, AX or XOR AX, AX as long as 2B, 3T, the only thing to note is that the latter will affect the flag, so don't use it The command is judged before the command. In program writing, it is often necessary to clear the temporary depositor or buffer to 0, and the method is to keep a temporary depositor to be 0 for any time. Because of the MOV [Terrorist], [Terminal] As long as 2B, 2T, even a clear buffer, it is better than direct filler. Just, how to keep the temporary depositor to keep 0, then go to the next effort. There is also a situation, that is, in the road, every time you need to clear 0, at this time, it is very strict, there is a command CBW to convert a character to double-character, only 1B, 2T is the most Efficient. However, it should be noted that the AL must be less than 80h, otherwise AH will become a negative number. 3, add ax, AX requires 2B, 3T is not as good as: SHL AX, 1 as long as 2b, 2T. 4, MOV AX, 4 unless AH must be 0, otherwise, use: MOV Al, 4 will be less than one character.
5, MOV Al, 46h MOV AH, 0FFH Why is not written: MOV AX, 0FF46h not only saves a word, four clocks, and ranging a few letters!
6, CMP CX, 0 requires 4B, 4T, but if used: OR CX, CX is exactly the same function, but as long as 2b, 3T. If you use: JCXZ XXXX, an instruction can replace two, time and space. Unfortunately this instruction is limited to CX, which is invalid for other transmals.
7, SUB BX, 1 This is even more forgive, 4b, 4T has no waste. Dec BX ready-made instructions, 1B, 2T why? If it is SUB BL, 1 should also consider the case of BH at this time. If you can replace it with DEC BX, it does not affect the consequences, or it is also possible to use it.
8, MOV AX, [Si] INC SI Inc Si This is the case, it must be not matured, all 4B, 21T. Lodsw is designed for this purpose, but as long as 1B, 16T.
9, MOV CX, 8 MUL CX Write this program, should first develop habits, each time the multiplication, division, will make an abacus. Because they are too wasteful. 8-bit yuan should have more than 70 clocks, and 16 yuan will take more than 100 yuan. So if possible, try to replace with simple instructions. SHL AX, 1 shl AX, 1 shl AX, 1 original to 5B, 137T, now as long as 6b, 6t. If the CX can be used, it is better to write: MOV CL, 3 SHL AX, CL is better, and the greater the value of CL. Use CL as a specific speculator, not only saving space, but also is executed in the CPU due to the command system. But how much is it? We did some tests, as an example, on the 10MHz frequency machine, made 3072 × 14270 times, the measurement time is: instruction: SHL AX, CL SHL AX, N cl = 0, 23 second n = 0, invalid CL = 1, 27 second n = 1, 14 seconds CL = 2, 32 second n = 2, 28 seconds CL = 3, 36 second n = 3, 42 seconds cl = 4, 40 Second n = 4, 56 seconds CL = 5, 44 seconds n = 5, 71 seconds cl = 6, 49 second n = 6, 85 seconds CL = 7, 54 seconds n = 7, 99 seconds, it is known, with CL It is more effective than 2 hours. In addition, it is also possible to use a loop to make a decrease, but it is not worth it, and it should be noted that there is a need to adjust the remainder. 10, MOV Word PTR BUF1, 0 MOV WORD PTR BUF2, 0 MOV Word PTR BUF3, 0 MOV BYTE PTR BUF4, 0 .. I have seen too many this program, I will be free, I will have a fire! In the program, it is best It is often retained for 0 to cope with this situation. Even if there is no, try to make a temporary depositor is 0 to save time, empty. Sub Ax, Ax Mov BUF1, AX MOV BUF2, AX MOV BUF3, AX MOV BUF4, Al
14B, 59T replaced 24B, 76T, of course worth it. Just, it is not as good as organized in advance, considering the application relationship between each buffer. With the previous example, it is assumed that the numbers in each buffer are related to their actual positional relationships, and they can be written: MOV CX, 3, if they are known, use: MOV CL, 3 SUB AX, AX MOV DI The longer the Offset BUF1 Rep Stosw Stosb, the longer it, and now use 10B, 37T, as well as it is. 11. Submit continuous call: Call abcd call EFGH If the abcd, EFGH is a substructure, and the number of times the call is called, the way the above call is discrete. Because two consecutive calls, not only time is not cost-effective, and space is also wasted. If ABCD must be used with EFGH, ABCD should be placed before EFGH: Abcd: .. Efgh: .. like this, as long as the ABCD is enough, however, most of this situation is caused by the negligence of the program, such as two slats It is necessary to use independently, while the above continuous calls will exceed more than twice, should be changed to: Call abcdef and abcdef should be: abcdef: Call abcd efgh: .. This is not slower, and space savings The number of times is proportional to the number of calls.
12. Some programs often, when taking information from the buffer, the temporary position must be 0. Such as: Sub Ah, AH MOV Al, Buffer should be set to: Buffer DB?, 0 and then use: MOV AX, Word Ptr buffer, not only fast, space is saved.
13, sometimes it seems to have an instruction, but because of the characteristics of the instruction, it is more streamlined. Such as: or es: [di 1], BL This requires 8B, 32T, if you switch the following instructions: XCHG BL, BH OR ES: [DI], BX XCHG BH, BL Requires 7B, 28T.
14, PUSH and POP are instructions for saving the original value of the scratch, but only one character, but it takes time. Push takes 15T, POP accounts for 12T, unless it is not available, it is not casual. Sometimes due to the submoxic explanation, the programmer is in order to be safe, too lazy to check, and the temporary depositor is piled up on the stack. Especially in the system program or submont, there is often a pile of stacks and taken. In fact, spend a little effort to find a lot of efficiency. It is necessary to know that system programs and certain processes are often used, and the efficiency of the speed is very efficient. If it is low, it is not responsible! There are many ways to save the original value, where more efficient is to put them in some non-needed regions. With my experience, the stacker is used to use, just as a temporary warehouse. But the best way, or put the application of the temporary depositor in the program is reasonable, do not waste, so as not to pile too much. There is also a method in which the procedure does not have to be stacked, but there is another entry, first pile up the scratch, and then call the slanting of the stack. These two different portions can be provided to the hope of rapid processing, or need to retain the original value of the teleconmier. Of course, a simpler and effective method is to explain that some scratches in this section will be destroyed, and the caller is saved by the caller. Second, the program should be stripped
1. During the comparison judgment, the neighboring value does not have to be connected. CMP AL, 0 JE ABCD0 CMP AL, 1 JE ABCD1 CMP AL, 2 JE Abcd2 .. should be: CMP Al, 1 JNE ABCD0 ABCD1: .. in the title of ABCD0, then: JA Abcd2 This practice end Time Being effective, like this ABCD1 is the fastest.
2, unusual processes: Add Ax, 4 ABCD: Stosw Add Ax, 4 Add di, 2 loop abcd .. Take a little bit of brain, just more: ABCD: Add Ax, 4 Stosw Inc Di Inc Di Loop Abcd ..
3, wrong processing method: MOV BX, SI ABCD: MOV BX, [BX] OR BX, BX JZ ABCD1 MOV SI, BX JMP Abcd Abcd1: Lodsw .. Abcd: MOV BX, Si Abcd: Lodsw OR AX AX JZ ABCD1 MOV SI, BX JMP ABCD ABCD1: ..
4, wrong process: Test Al, 20H jnz abcd call cdef [bx] jmp short abcd1 abcd: Call CDEF [BX 2] abcd1: .. should be written: Test Al, 20H jz Abcd Inc BX Inc BX ABCD: Call CDEF [Bx] abcd1: ..5, below is the loss of time: Push di Mov CX, BX Rep Stosb Pop Di Push, POP Tet time, should be: MOV CX, BX Rep Stosb Sub Di, BX Similarity, many times Take a little slightly, you can save some instructions: Push CX REP MOVSB POP CX SUB DX, why is CX not simply? SUB DX, CX Rep Movsb
6, there is a section, very regular, but it is extremely efficient: x1: test ah, 1 jz x2 MOV BUF1, BL X2: Test Ah, 2 JZ X3 MOV BUF2, DX; Double Dixes DX, single number BL X3: Test AH, 4 JZ X4 MOV BUF3, BL X4: ..; The following sections are similar to those of the above-mentioned format x8: .. This kind of golden jade table, the most practical value, the change method should be started by the buffer, First arrange a sequence, as small as: buf1 db? Buf2 dw? Buf3 db? Buf4 dw? .. then, the program is changed to: MOV Di, Offset BUF1; First Buffer MOV Al, BL MoV CX, 4 X1: SHR AH, 1 JZ X2 Stosb x2: SHR AH, 1 JZ X3 MOV [DI], DX Inc Di Inc Di x3: loop X1
7, the loop is most afraid of thousands of turn, not smooth, such as: Sub Ah, AH Abcd: CMP AL, BL JB ABCD1 SUB AL, BL INC AH JMP ABCD ABCD1: .. The entrance of Abcd1 is redundant, below Many: MOV AH, -1 ABCD: Inc Ah Sub Al, BL JA Abcd Add Al, BL; Restore ..8, when processing a word, there is such a way of writing: CMP Al, 60h Ja Abcd1 Sub Al, 40H; uppercase letters abcd: .. abcd1: sub al, 60h; lowercase letter JMP Abcd To know the character code is between 40 hours and 4ah, lower-write is 60H to 6ah, above, only one instruction Yes: And Al, 1FH is simple!
9. Most prices rarely have errors under the program they test, and once they are exchanged, they will find mistakes. The reason is that the writer has assumed the correct case, of course, will not operate in a known manner. But there is no one, there is no predecessor, which is likely to enter "incorrect" information, and the result is the problem. To know the real user, no more designer himself, in the operation, button errors are inevitable. This error should be checked in advance in the program. Anyone who is "correct, wrong" is "correct, wrong". The error information must be excluded in advance. In this way, it seems that the program is not streamlined, but the correct importance is far from the streamline. Once an error occurs, the regenerative program has no value. In addition, in the program, there is often an additional, subtraction operation, and should also be checked, otherwise the same problems will occur.
Third, the instruction application is flexible
There is a very simple program, which has many methods, but the good intention of the instruction application will make the program's efficiency to the sky, it is difficult to estimate. The purpose of this program is to convert a piece of information, English characters, and lowercase. Of course, the selection of the conversion is determined by the user, and the interface is used below and slightly, assuming that the conversion has been known. With information in DS: Si, the data length = CX, the uppercase transfer lowercase when BL = 0, but the BL = 1. I have seen a way of writing, I can't forgive: 1: loop1: 2: Call change 3: JC loop11 4: Add Al, 20h 5: JMP Short Loop12 6: LOOP11: 7: Sub Al, 20h 8: loop12: 9: MOV [Si-1], Al 10: Loop Loop1 11: RET 12: Change: 13: Lodsb 14: OR BL, BL 15: JZ Changs 16: CMP Al, 61H 17: JB Charet 18: CMP Al, 7ah 19: Ja Charet 20: CHARET: 22: RET 23: Changs: 24: CMP Al, 41H 25: JB Charet 26: CMP Al, 5ah 27: Ja Charet 28: CLC 29: Ret This program is wrong by 12 The program of 29 is too long, a total of 25b, has a shared value, so as a sub-program. Imagine that every information is called once, waste four characters small, but 23 20 clock pulses each time, the information is more than an astronomical figure. What's more, this section is very poor, in the loop, it is a waste of dozens of clocks. About this, the following will continue to discuss. Slightly improved on this section, slightly improved, Writing is as follows: 1: Change: 2: Lodsb 3: OR BL, BL 4: JZ Changs 5: CMP Al, 61H 6: JB Charet 7: CMP Al, 7ah 8: Ja Chare 9: Sub Al, 20h 10: Chang0: 11: MOV [Si-1], Al 12: Chang1: 13: Loop Change 14: Ret 15: Changs: 16: CMP Al, 41H 17: JB CHANG1 18: CMP AL, 5AH 19: JA Chang1 20: Add Al, 20h 21: JMP chang1 This is still poor, because in the loop, the speed is slower than the telecommunication with the scratch.
The value of the comparison should be required, put in the temporary deployment DH, DL, improved asses: 1: MOV AH, 20H 2: MOV DX, 7A61H 3: OR BL, BL 4: JZ Change 5: Mov DX, 5A41H 6: CHANGE: 7: LODSB 8: CMP Al, DL 9: JB Chang1 10: CMP Al, DH 11: Ja Chang1 12: xor Al, AH 13: MOV [Si-1], Al 14: Chang1: 15: loop Change 16: RET or above, small space, fast speed, per material, with an average of 40 clock values, with 10 MHz, 100,000 materials, about a half-second! Please pay attention to the skills used in the program, from 2 to 6 branch method, better than the following: 1: OR BL, BL 2: JZ CHAN1 3: MOV DX, 5A41H 4: JMP Short Change 5: Chan1: 6: MOV DX, 7A61H 7: Change: This branch can also be replaced by another technique, that is, the predetermined method. Put the required parameters in advance in a fixed buffer, at this time, you can use: MOV DX, BWcom; compare preset value This is simple: 1: MOV AH, 20H 2: MOV DX, BWcom 3: Change: 4: Lodsb 5: CMP Al, DL 6: JB Chang1 7: CMP Al, DH 8: JA Chang1 9: XOR Al, AH 10: MOV [Si-1], Al 11: CHANG1: 12: LOOP CHANGE 13: RET is described as variable method, and the value to be compared is placed in the schematic. Due to the fast, space saving, the program is high. More importantly, it is the elasticity of the program itself. As long as the application is unified, the parameters are set properly and can be shared.
Fourth, the command in the loop
The most important circuit is the speed, because this parameter will be continuously executed within the range of the counter. If you accidentally wast a few clock values, under the accumulation of the loop, it is likely to make the program become a bull. To write the loop, you must remember the execution clock of each instruction to select the highest efficiency. At the same time, you have to know which instructions can get the same processing effect, in order to have more choices. Second, in the loop, the most taboo buffer, not only the space is large, but the processing speed is slow, but it cannot be flexible, and the function is limited. In addition, it should also be avoided to avoid constants, try to perform it through the tip, and use it to increase the efficiency of the entire program. It is also an instruction to waste clocks such as Push, POP, DIV, MUL and CALL. In addition, be careful, cautious, deep, and well, it is a non-fancy door written to the loop. In the precedent, the instructions of the comparative constant are changed to a comparison register, which is a good proof. If you use a constant, two programs can no longer be shared, when the air is unfair. The following will be mentioned, and this seems to have some blowing, but carefully calculate the waste of the waste, it may not laugh.假 假 假 路 路 回 回 资 资 资 处理 资 资 10 率,,,, 00 00 2 本 本 本 本 本 本 本 本 本 本 本 本 本 本 本 本,, 本,,,,,,,,,,, The secondary 12T 14T 11T 17T = 55T clock pulse is 50,000 hours, and 47 * 50,000/10,000,000 seconds, that is, about a quarter of seconds. As long as the command is adjusted slightly,: 1: loop1: 2: Lodsw 3: xor ax, [di] 4: Stosw 5: loop loop1 This counter is 25,000 times, each 16T 18T 15T 17T = 66T 25,000 At the time, 66 * 25,000/10,000 seconds, about six-second, more than one-half than the previous program. Similarly, add a loop in the loop, and each loop requires 17T, it is also a lot of waste. If the CALL instruction is added, 23T 20T = 43t is required, and more waste is more, the reader is not inadvertent. When a certain stage is used very frequently, it is reasonable to appear as a program, such as the following LODAX: 1: LOOP1: 2: Call Lodax 3: loop loop1 4: Ret 5: LODAX: 6: Lodsw 7: xor AX, [Di ] 8: Stosw 9: RET is actually greedy, only four characters of the number, actually use three character call instructions to exchange, is absolutely uncomidized. Then there is a matter of discussion as the following programs.
1: LOOP1: 2: MOV DX, Number1 3: MOV CX, Number2 4: LOOP2: 5: Push CX 6: MOV CX, DX 7: LOOP3: 8: Lodsw 9: XOR AX, [Di] 10: Stosw 11: LOOP LOOP3 12: INC DI 13: Inc DI 14: POP CX 15: loop loop2 16: Ret second circuit is redundant, this is a common concept of high-order language, which is not applicable to the combination language. Slightly changed, not damaged the original conditions, get: 1: loop1: 2: MOV DX, Number1 3: loop2: 4: MOV CX, Number2 5: loop3: 6: Lodsw 7: XOR AX, [Di] 8: Stosw 9: loop loop3 10: Inc DI 11: Inc di 12: DEC DX 13: JNZ loop2 14: Ret This loop is less, the program will be 15T 2T The time of 12T 17T = 46T, the province is 12, 13, 14 of 2T 16T 17T = 35t. Section 5 branch processing
After the comparison information, the conditional branch is the inevitable procedures in the program. The program is long, with a branch distance of more than 128 words, and the conditional branch cannot arrive. Of course, a streamlined program can sometimes avoid this situation, but it is not exhausted. There are many technologies for processing conditions, and the efficiency is determined. The most important thing is to plan in advance, what is more than? What is the case? Where is the branch? What work is done. Not only written, people's ability, can be judged by work. People with high wisdom, soon grabbing key points, re-division, and unfair to the complete system. After a good training expert, it can be summarized according to a set of regulations, and the results of reasonable collation can be launched. Honestly, the computer program has not yet arrived in a mature stage. All of today's practitioners can only be "pioneers", and there is no real "experts". Make it on, like me, better than others, it is better than the computer every day, more experience. Therefore, the current approach can almost say that there is no sufficient compliance, the sea has a wide sky, how to write, how to write, as long as you can use it, you can sell it, make a big money, will be regarded as a master. It's just how long this situation has been maintained, and the murals of the people have only historical significance. Today's programmaster, if you don't recognize reality, immediately wake up, more dedicated to the formulation of regulations, the computer will always be an immature child. Once these regulations have been dedicated to the test, the foundation for future experts, that can really be regarded as masters. I don't say we are working hard in this direction, but I don't think it is. Because the hardware design of the computer will inevitably have a major breakthrough in the next ten years, no one is to predict what results will have. Although the concept of software is impossible, it is inevitable that it will be affected. Only have younger friends, you grow in the computer era, willing to work more, you must have gains! Below, and introduce some of my processing skills for conditional branches: First, the information classification
1. Classification: In the fourth section of this book, Section 5, the input code is used as an example of the processing of the output glyph, is an illustration of the bit element classification. However, all types of data is used as a common classification message, and all kinds of unique processing methods should be used in the order of their bit, and use indirect addressing or branch skills as the means of process.
2, the character classification: Each of the characters has 256 arrangements, and if there are 128 classification items, the double number classification should be taken, otherwise the continuous classification must be used. The value of the classification can be performed using indirect addressing. However, it is important to note that the entrance title of each class should be defined first. Since the definition must be used to double-fi, it is used to use a continuous classifier.
3, interval classification: In some cases, the original information is not allowed to rearrange, and some of them have already accommodated the characteristics of classification, this situation, we call the interval classification. When dealing with such information, you should first extract the data that can be handled, and treated as a string, defined within a buffer. When you need to be classified, the "bitter string" (scaS) command can be used to obtain its defined position, and then make indirect addressing. It is provided with keyboard input data such as 4700H, 4900H, 4F00H, 5100H, 4A2DH, 4EABH. When the above value is in AX, special processing needs to be processed, and the COD1 to COD6 is entered. 11 Define the data in the buffer ABC, the program is defined in DEF: ABC DW 4700H, 4900H, 4F00H, 5100H, 4A2DH, 4E2BH DEF DW COD1, COD2, COD3, COD4, COD5, COD6 12 make Di = ABC, CX = 6: MOV DI, OFFSET ABC MOV CX, 6 13 After the alignment string, it is judged whether or not AX has the above value, if any, use indirect addressing. RepNZ scASW; aligned with six group strings; there is no better string Sub Di, Offset ABC 2; get a comparison position value CALL CS: DEF [Di]; or as the above DEF if the DG section is placed In, you can also save a word, and speed up speed: Call DEF [Di] Second, the structure
If you are ready to work, you will use the aforementioned method to temporarily use the foregoing method. However, there is a point in the east, and the west will not only lead to the trouble of testing, but also affect future maintenance and adjustment. Therefore, whenever the task is understood, it is necessary to make a part of indirect addressing, it is best to focus in one module. In case the nature of the nature must be segmented, and the main order of the interior should also be placed at the beginning of the module. There are many benefits of doing this. On the one hand, it is easy to expand the function. Each time you increase the address factor, you don't have to find it in the program, you can arrange it right. Secondly, this address is required, and it is inevitably related to the overall function, and the definition table is equivalent to a directory, put the program in front, according to the map, at a glance. More important, it can show the level of the program structure, hierarchical processing is the most difficult to master in the mesh process, and cannot be careful. Also, it is the title arrangement of each sub-form, and its position should be based on functional concentration. The advantage of this is that if there is a scheduled segment that can be shared, it is easy to merge into one, save space.
Third, order and conditions "true" "fake"
There are two possibilities of the "clock number" of the conditional branch. When the conditions are met, the execution branch is 16T, which does not match, 4T, and continue the next instruction. There are four times the difference between the two. We are using this feature, and the speed is important, it should be set to the primary proxidation, otherwise it is a sub-process. Especially in the high-speed circuit, the branch is dealt with good, and the efficiency is far from. This branch needs to be more careful, cultivating a good habit. CDEF: CMP Al, '?' JZ Abcd; Each comparison symbol, '?'
When the ruler concentrates on writing or detection, it will not be able to seek a good time. However, when the detection is complete, it is best to completely check all JMP instructions, often will be great! Due to JMP requires three-character, and JMP Short is as long as two, the condition is that the location of the jump cannot exceed 128 characters. When compiled, if the distance from JMP is within 128 characters, the compiler is automatically translated into two-character. Otherwise, if you add a NOP instruction, you will add a NOP instruction, not only two clocks. Therefore, check it out, and if you jump down, within 128 characters, you should change to JMP Short.