The introduction of assembly language
assembly language （Assembly Language） Machine oriented programming language .
In assembly language , Using mnemonics （Memoni） Replace opcode , Using address symbols （Symbol） Or label （Label
） Substitute address code . In this way, symbols are used instead of machine language binary codes , It turns machine voice into assembly language . So assembly language is also called symbolic language .
Programs written in assembly language , The machine is not directly identifiable , To translate assembly language into machine language by a program , This kind of translation program is called assembler , Assembler is the software of language processing system in system software . The process of translating an assembly program into a machine language is called assembly .
Assembly language is easier to read and write than machine language , Easy to debug and modify , At the same time, it has the advantages of fast machine language execution , Less memory and other advantages , But there are obvious limitations in writing complex programs , Assembly language depends on specific models , Not universal , It can't be transplanted between different models .
For different models of computers , Assembly language with different structure .
Assembly language uses mnemonics to write programs , It's more convenient than binary programming in machine language , To some extent, it simplifies the programming process . The feature of assembly language is that it replaces machine instruction code with symbols , And mnemonics correspond to instruction code one by one , Basically preserving the flexibility of machine language . Using assembly language can be machine-oriented and give full play to the characteristics of machine , Get a high quality program .
Assembly language is machine specific , It is inseparable from the instruction system of a specific computer , therefore , For different models of computers , Assembly language with different structure , and , Assembly language programs for the same problem are different from each other in different kinds of computers .
Because of the mnemonics used in assembly language , Program input computer in assembly language , A computer cannot recognize and execute directly as a program written in machine language , Must be pre loaded into the computer through the “ assembler ” Processing and translation of , To become a binary code program that can be recognized and processed by a computer . The symbolic program written in assembly language and other non machine languages is called source program , The runtime assembler translates the source program into the target program . The target program is a machine language program , Once it is placed in a predetermined location in memory , Can be used by computer
CPU Handling and execution .
Assembly language is like machine instruction , Control information of hardware operation , So it's still machine oriented , It's still tedious and time-consuming to use , Poor versatility . however , Assembly language is used to program system software and process control software , Its target program occupies less memory space , Fast operation , There are irreplaceable uses of high-level language .
The advantages of assembly language
Understanding and using assembly language has the following advantages ：
* Explain how the program works with the operating system , Processor and BIOS Interface ;
* Describes how data is represented and stored on memory and external devices ;
* Explain how the processor accesses and executes instructions , And how instructions access and process data ;
* Explain how programs access external devices . in addition , The reason for using assembly language is ：
* Direct access to hardware related memory or I/O port ;
* Ability to be free from compiler constraints , Complete control of generated binary code ;
* More accurate control of key code , Avoid deadlock caused by thread common access or hardware device sharing ;
* Be able to optimize the code according to the specific application , Speed up ;
* Can maximize the function of hardware ;
* The memory space and execution time required for programs written in assembly language are significantly reduced compared with those written in high-level language ;
* Assembly language enables programmers to accomplish very technical tasks ; Using advanced language , Even if possible , I'm afraid it will be very difficult ;
* Although most software experts develop new applications in high-level languages （ Do that , The maintenance that the program will be easier to write ）, But for the parts with more stringent execution time requirements , It's often rewritten in assembly language ;
* Resident procedure （ When other programs are running , Program resident in memory ） And interrupt service routines （ Procedures for handling input and output ） Almost all developed in assembly language . Disadvantages of assembly language
Although assembly language has many advantages , At the same time, we should realize that , Assembly language is a very low level language , It's only higher than writing binary machine instructions directly by hand , So inevitably there are some shortcomings ：
* The code is very difficult to understand , Poor maintenance ;
* Easy to produce Bug, Difficult to debug ;
* Can only be optimized for specific architectures and processors ;
* Low development efficiency , Long and monotonous time .