The art of assembly language-preparation work (V)

Source: Internet
Author: User

Section Fourth uniform format

First, the advantages of a unified format

No matter what programming language is used, there should be a unified way of writing a program to work together, to discuss each other, or to share the responsibility of success or failure in the same department. This will not only facilitate communication and improve the quality of the program, but also avoid the sequelae caused by the separation or vacancy of a programmer.
A good program should be like a wonderful literary work, which has the skill and the artistic conception. Its function is not only in the efficiency of execution, but also as a medium of learning and appreciation among peers, which must be achieved through a unified format.
In particular, the composition of writing as a kind of artistic creation, we must often observe each other, if there is no common format, then such programs and "Heavenly book" can be said that there is no much difference. No matter how well the annotations are written, the general programmer himself is afraid to look at his own program, not to mention others? But if there is a unified format, nurturance habit, not only easy to see and understand, and find, modify convenient, writing is easy.

Second, specifications

1, unified with capital letters, to facilitate reading.
2, the space should use TAB, abreast equidistant, a head understand.
3, immediately after the title of the row input to read.
4, each line must not exceed 70 letters, so as to avoid the length of the screen disorder.
5, note is located in the instruction, the Fifth tab in the starting point, the space is insufficient, can be changed line, but the position is one.
6, all buffers are uniformly defined before the program, not in the middle of the program.
7, in addition to the need to do more than FAR call use ' PROC FAR ', do not use the ' PROC NEAR ' form, because this kind of writing meaningless.
8, at the beginning of the program, should note the use of key points.

The following examples illustrate the uniform format:
1: page 60,132
2: title [program name],[code],[number],[feature description]
3: 
4:  DG SEGMENT PUBLIC&NBSP
5: extrn bwsca1:word,..
6: dg ends
7:
8: 
9: 
10: 
One:
12: cg segment public 
13: extrn mmmm:near,..
14: 
15: public xxxx,yyyy,..
16: ASSUME CS:CG,DS:DG,ES:DG
17: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18: ; rem ............ ;
19: ; ...................... ;
20: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21: start:
22: cld
23: MOV AX,DG
24: mov ds,ax
25: .
26: 
27: 
:
29:cg ends
30: end start

The first page is a "reserved instruction" for printing, representing the number of rows and columns printed on each page. Then 60,132 is 60 lines, 132 characters.
The TITLE of the second article is the "Reservation instruction" for inspection.
In the REM note column, the function and application conditions of the program should be explained so that other programmers can use it together.

Iii. notes

The purpose of note is to be able to modify and maintain the program easily by yourself or others in the future. Therefore, the description should be exhaustive. Unfortunately, no matter how wonderful the sentence, there are always deficiencies. Therefore, note when the focus should be grasped, generally speaking, the program needs to be explained, but:

1, function: What work to do, what prerequisites are required.
2, Parameters: What data to set up for this section program processing.
3, buffer: With what buffer, its working characteristics.
4, Result: The result of the execution.
5, subroutine invocation: In this program, the calling subroutine name is required.
6, important statement: such as whether the register is damaged, or other matters of concern.
Such as:
"function": Read keyboard buffer input code, return ascii+ sweep by nature
Aim code or Chinese inner code
"Parameters": AH = 00H
"Back": 11al< 80h,ah = scan code, AL = ASCII
12al≧80h,al = Four characters in one of the Chinese code
"Damage Registers": AX
"Remarks": To use this feature to take the Chinese code, you must take 4 times, in order to
To a Chinese 4 character inner code.
Of course, if the time is sufficient, it is best to have the full description of the program, as well as the production and modification of detailed records.
The problem is that at the beginning of any program development, it must be a little. Coupled with constant changes and additions, the change is complex and incomparable. Programmers are also preoccupied, solve problems, but also consider how to note, dual-use, will not talk about efficiency.
So what's the right thing to do? I suggest that the programmer be free to play, and that there is no note at the beginning of the matter. When the program is finished, there is generally no error, at this point, you should stop, from beginning to end, the program thoroughly tidy up.
This is not only easy to raise, but also the programmer has the opportunity to "appreciate" their own efforts to crystallization, the change of the merger of the merged, the deletion of the deleted. Finally, the programmer, after reflection, studies, technology will be greatly improved, the program is more streamlined, the note is correct, and work to achieve maximum efficiency.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.