The art of assembly language-preparatory work (III.)

Source: Internet
Author: User
Tags definition join joins

Second, target file debugging and tools

When you use Debug, because the name is short, the usage is simple. If you use the title to debug "symdeb.exe, you will not be, because you first want to generate a. map file, and you can enter more text when testing. For people who are constantly using, it is inevitable to wearies. The simplified approach is to make the execution file first: S.bat and Sm.bat

S.bat is intended specifically for program debugging purposes:
1:symdeb%1.sym%1.exe
This means that when the. Map is already in the original file, if the program has just finished joining and there are no statements in the join file that generate the. Map, the sm.bat should be made as follows:
1:mapsym%1.map
There are many advantages to using the Title Debugging tool, which is much more powerful than debug. But the user must be aware that the title that needs to be tested should be declared public in the program, otherwise it will not be possible to jump directly to that place.
Programs that have special effects should also have the tools to test them, and even use the "monitor" method to control them with another computer. Some communication software, such as Xtalk plus symdeb.exe, can be debugged online via serial port (serial port), and its procedures as follows:

1, first enter the communication command on the host of the program to be tuned:
C:\>mode com1:9600,n,8,1
C:\>symdeb MyFile.exe

2, and then to the host by the serial port connected to the secondary machine input:
C:\>xtalk
Enter the command input state, and then enter:
C:\>sp
To set the transmission speed, generally use 9600 more, but depending on the host.
c:\>9600
Finally, enter the operation instruction:
C:\>go LO
Represents the use of a regional network, or serial port.
Then wait for the signal to be successful online and see "-" on the screen to start debugging the error.

3, on the host side, still have to enter:
C:\>=com1 (or COM2, depending on the communication port of both)

4, as for debugging, and the use of a computer is the same, only at this time on the host is the result of the implementation, and the control of the debugging step by the auxiliary machine.
Section III Classification definition

First, paragraph name (Segment name) definition

For a program with more than one paragraph name, it is best to have a program that defines the segment, taking draw as an example, assuming that the program is two paragraphs, one for the control program, and one for the drawing program segment. The data are divided into three paragraphs, one for application data, one for reference materials, and for production materials. In addition, there is a data index section, totaling six paragraphs.
It is recommended that, on a generic basis, the paragraph be simplified and categorized as follows:
The program segment (code SEGMENT) is named CG
Data segment (data SEGMENT) named DG
Index segment (SEGMENT) named IG
Memory segment (MEMORY SEGMENT) is named MG
Ad hoc paragraph (EXTRA SEGMENT) named EG
Stack segment (stacks SEGMENT) named SG

When each paragraph is more than one group, the number is added to differentiate it.
as in  dr-seg.asm , can be set to:
1: title segment definition of program  ' DRAW '
2: cg1 segment public
3: cg1 ends
4: cg2 segment public
5: cg2 ends
6: dg1 segment public
7: dg1 ends
8: DG2  segment public
9: dg2 ends
10: dg3 segment public
11: DG3  ends
12: ig segment public
13: ig ends
14: end
in  segment After  PUBLIC , there are a variety of representations:
Segment public xxxx
xxxx=code  is represented as a program segment, and when joins, the segments and segments of the program are connected. Between the two sections, the  000H  is filled to the top of the section (  every 16 characters per " ). The
xxxx=data  represents the data segment, which is the same as the join.
If the programmer has to strictly control the location and length of the program for some reason, it is not appropriate to use both of these methods.
The simplest way of stating that, after  segment public, is to remain blank.
xxxx=byte  indicates that the program joins each other tightly, leaving no vacancy. This approach is useful for streamlining the program.
xxxx=word  indicates that the program joins each other tightly, but the program behind it is bound to be double digits.

And as in the XXXX before and after the quotation marks such as:
SEGMENT Public ' XXXX '
This declaration is used to inform the order and definition of each paragraph of the assembler. Therefore, when writing a program, as long as the use of the paragraph name and definition of this document, no matter whether the paragraphs in the program in any location, there will be no error.
' XXXX ' is related to the order in which the program is arranged, in which the strings in quotation marks are sorted properly, and the programs are arranged in this order.
That is, if you use quotes, the order in which the program joins, that is, the string in quotation marks, occurs sequentially in the join.
Single-file error is not difficult to know, but if there is an error between the paragraphs, the inexperienced programmer, will have the risk of not being able to start, not careless!
Generally speaking, the most vexing error message in connection is:
' Fixup overflow at nnnn. '
Regardless of the content of the error, this error occurs mostly because of confusion between the use of headers, buffers, or registers between paragraphs and segments, and the connection program is not getting the correct information.
The solution is to stop the assembly immediately with ' Ctrl_c ' when the first error message appears, write down the first message, and in the original program, find the location, (mostly a header position), before this title, you will find the error related to paragraph.

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.