Instruction and example of assembly language on-machine process

Source: Internet
Author: User
Tags connect reserved

From how to establish the source file to the debugging for a brief introduction, and with examples. Because of my limited level, please point out in the following areas where there are errors and can be further modified

assembly language on the machine process:
First, the pre-machine software preparation:
MS-DOS operating system (e.g. MSDOS6.22, MSDOS7.0, etc.)
Text editors such as: Edit.com, TURBO. EXE, TC. EXE, C.EXE, etc.)
Assembler (such as: MASM.EXE, ASM. EXE, etc.)
connecting programs (e.g. LINK.EXE, etc.)
Debugger (such as: DEBUG.EXE, etc.)

II. procedures for the establishment of the assembler process:

A. Establishment of a compilation source procedure-through ───→b. Compile as target file ─↓┬─→d. Connect as Executable

│c. Do not pass, re-modify (statement error) ↓
├──────────────────────┘↓
↑f. Incorrect, debug with debugging tools, re-modify (logical error) ↓
└────────────────────────────←e Run
↓ Correct
G. Completion

Three, now each of the (ii) marked by the process of the alphabet (PROCEDURE) detailed description

PROCEDURE A: Create an assembler source program (i.e., create a filename. asm)
This process is the same as we write the source code on paper, just the paper into the computer, this process is also called source code entry. There are many ways to enter the source code into the computer, and the following will introduce the specific methods.
1. Through the md-dos of the EDIT.EXE text editor input, at the DOS prompt, type: Edit carriage return, then if you can call the system, edit Operation screen will appear on the screen, you can be prompted to enter, when the input is completed, Choose to save and give you the file you entered a filename, in the form of: filename.asm (where filename is your name, composed of 1-8 characters), ASM is for assembler recognition and must be added to, not change. After saving in DOS, you can use the DOS command dir to view, and if you see the file exists, process B.
2. If you do not have edit in your system, you can also use your familiar text editor to input, edit, such as the use of C and Pascal text editor to edit, and finally save the file as a filename.asm form.

PROCEDURE B: Compile the target file (that is, compile to. obj. lst. crf files)
The process computer compiles the correct source code into the machine language, the program list, and the target file for the cross-reference table. If at this point your program has a statement error, the system will report an error, and point out in the first few lines, what type of errors, you can be prompted to modify each. The specific process is described:
Type MASM filename return at a DOS prompt
(Note: The assembler in your system is MASM.EXE, and if your system assembler is ASM.EXE, turn the command into ASM filename return.) where filename is the filename you just created in procedure a.
The assembler's output file can have three (respectively:. obj. lst. CRF), and there will be three questions, where you can return all the way. The information shown below is the number of errors in the source program, and if 0 is successful, process C can be performed. However, if the error is not 0, and indicate that the error appears in the line, can be modified according to this hint. However, if too many errors have not yet been shown, the following command form can be used to save the error message in a file you specify, and then use a text editor to view it. MASM filename >filen (filen an unused file name for you to hold an error message) can then view the Filen to get an error message.

PROCEDURE C: Compilation does not pass, re-modify (Error type: Source program statement illegal)
After procedure B has been executed, if there is an error message, we need to do it ourselves by pressing procedure C instead of jumping to procedure D, if the enforcement of procedure D will have no valid result.
It's a mistake to open now! First of all, it is clear that the error detected in procedure B is the syntax or usage error of each statement, it does not detect the program's logical design (statement by row position) error, so it is necessary to remember the line number of errors. After the line number is logged, the procedure a should be executed again, and the operation should be to open the compiled source program (in edit example: At a DOS prompt, type:
Edit Filename.asm carriage return), modify the parallel disk according to the line number, and assemble again until procedure B is passed. You can continue to execute procedure D.

Here are some common error messages to check:

1, Register already defined assembly internal logic error
2. Unknown symbol type in the type of a symbolic statement, something that is not recognized
3, symbol is multi-defined repeatedly defines a sign
4, symbol not defined sign not defined
5, the syntax of the SYNTAX Error statement does not match any recognizable syntax
6, Symbol is reserved word
An attempt to illegally use a reserved word for an assembler (example: Define add as a variable)
7, not proper Align/combine type segment parameter incorrect
8, one operand must be const this is the illegal use of the addition instruction
9, operands must be same or 1 abs this is illegal use of subtraction instructions
10. Already have base register tries to repeat the site
11. The length of the item referenced by illegal size for item is illegal, (for example: Double word shift)
12, illegal register value specified register values cannot be placed in the "Reg" field
13. Must be ax or al some instructions can only be used with Ax or AL
14, improper use of Segment Reg section register using the method (such as: mov ds,0)
15, division by 0 or overflow gives an expression with 0 divisor
16, value is out of range value greater than the need to use
17, CS Register Illeal usage attempted to use the CS register illegally
18, DUP is too large for linker
DUP nesting is too long to get the records you want from the connector

PROCEDURE d: Connect to executable (that is, connect to an. exe or. com file)
In this process there is generally no accident, if there is the name of the wrong call.
Form: At DOS prompt: LINK filename carriage return

PROCEDURE e: Run the compiled executable file
When procedure D is passed, an executable file is generated, just run the program to see if it results as you think. During the trial run, try to test some critical state to see if the program is running stably and the result is correct. If all is normal, then can enter procedure G.
But the most fear is not OK, the program produces some inexplicable results (you do not think that your computer does not listen to your command, in fact, it is in a meticulous manner according to the program you are programmed to execute. I used to think that my computer is out of the problem, if it is in the examination room at this time do not panic, to stabilize their emotions, first do not look at the computer, a few minutes of quiet (anyway, more time is). At this point will use the most critical, most commonly used step, to carry out procedure F.

PROCEDURE f: Debug with Debugging tools, re-modify (logic error)

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.