Rozmiar: 8938 bajtów


Assembly Language



#redirect Assembly language

Assembly language



Assembly language or simply assembly is a human-readable notation for the machine language that a specific computer architecture uses. Machine language, a pattern of bits encoding machine operations, is made readable by replacing the raw values with symbols called ''mnemonics''. For example, a computer with the appropriate processor will understand this x86/IA-32 machine instruction: 10110000 01100001 For programmers, however, it is easier to remember the equivalent assembly language representation: mov al, 0x61 which means to move the hexadecimal value 61 (97 decimal) into the processor register with the name "al". The mnemonic "mov" is short for "move", and a comma-separated list of arguments or parameters follows it; this is a typical assembly language statement. Unlike in high-level languages, there is usually a 1-to-1 correspondence between simple assembly statements and machine language instructions. Transforming assembly into machine language is accomplished by an assembler, and the reverse by a disassembler. Every computer architecture has its own machine language, and therefore its own assembly language. Computers differ by the number and type of operations that they support. They may also have different sizes and numbers of registers, and different representations of data types in storage. While all general-purpose computers are able to carry out essentially the same functionality, the way they do it differs, and the corresponding assembly language must reflect these differences. In addition, multiple sets of mnemonics or assembly-language syntax may exist for a single instruction set. In these cases, the most popular one is usually that used by the manufacturer in their documentation. ==Machine instructions== Instructions in assembly language are generally very simple, unlike in a high-level language. Any instruction that references memory (for data or as a jump target) will also have an addressing mode to determine how to calculate the required memory address. More complex operations must be built up out of these simple operations. Some operations available in most instruction sets include: * movings ** set a processor register (a temporary "scratchpad" location in the CPU itself) to a fixed constant value ** move data from a memory location to a register, or vice versa. This is done to obtain the data to perform a computation on it later, or to store the result of a computation. ** read and write data from hardware devices * computing ** add, subtract, multiply, or divide the values of two registers, placing the result in a register ** perform bitwise operations, taking the conjunction/disjunction (and/or) of corresponding bits in a pair of registers, or the negation (not) of each bit in a register ** compare two values in registers (for example, to see if one is less, or if they are equal) * affecting program flow ** jump to another location in the program and execute instructions there ** jump to another location if a certain condition holds ** jump to another location, but save the location of the next instruction as a point to return to (a ''call'') Specific instruction sets will often have single, or a few instructions for common operations which would otherwise take many instructions. Examples: * saving many registers on the stack at once * moving large blocks of memory * complex and/or floating-point arithmetic (sine, cosine, square root, etc.) * applying a simple operation (for example, addition) to a vector of values ==Assembly language directives== In addition to codes for machine instructions, assembly languages have extra directives for assembling blocks of data, and assigning address locations for instructions or code. They usually have a simple symbolic capability for defining values as symbolic expressions which are evaluated at assembly time, making it possible to write code that is easier to read and understand. Like most computer languages, comments can be added to the source code; these often provide useful additional information to human readers of the code but are ignored by the assembler and so may be used freely. They also usually have an embedded macro language to make it easier to generate complex pieces of code or data. In practice, the absence of comments and the replacement of symbols with actual numbers makes the human interpretation of disassembled code considerably more difficult than the original source would be. ==Usage of assembly language== There is some debate over the usefulness of assembly language. It is often said that modern compilers can render higher-level languages into codes that run as fast as hand-written assembly, but counter-examples can be made, and there is no clear consensus on this topic. It is reasonably certain that, given the increase in complexity of modern processors, effective hand-optimization is increasingly difficult and requires a great deal of knowledge. However, some discrete calculations can still be rendered into faster running code with assembly, and some low-level programming is simply easier to do with assembly. Some system-dependent tasks performed by operating systems simply cannot be expressed in high-level languages. In particular, assembly is often used in writing the low level interaction between the operating system and the hardware, for instance in device drivers. Many compilers also render high-level languages into assembly first before fully compiling, allowing the assembly code to be viewed for debugging and optimization purposes. It's also common, especially in relatively low-level languages such as C programming language, to be able to embed assembly language into the source code with special syntax. Programs using such facilities, such as the Linux kernel, often construct abstractions where different assembly language is used on each platform the program supports, but it is called by portable code through a uniform interface. Many embedded systems are also programmed in assembly to obtain the absolute maximum functionality out of what is often very limited computational resources, though this is gradually changing in some areas as more powerful chips become available for the same minimal cost. Another common area of assembly language use is in the system BIOS of a computer. This low-level code is used to initialize and test the system hardware prior to booting the OS and is stored in Read-only memory. Once a certain level of hardware initialization has taken place, code written in higher level languages can be used, but almost always the code running immediately after power is applied is written in assembly language. This is usually due to the fact system RAM may not yet be initialized at power-up and assembly language can execute without explicit use of memory, especially in the form of a stack (computing). Assembly language is also valuable in reverse engineering, since many programs are distributed only in machine code form, and machine code is usually easy to translate into assembly language and carefully examine in this form, but very difficult to translate into a higher-level language. Tools such as the Interactive Disassembler make extensive use of disassembly for such a purpose. ==See also== * List of assemblers * X86 assembly language ==Books== *[http://cs.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html The Art of Assembly Language Programming], by Randall Hyde *[http://www.computer-books.us/assembler.php Computer-Books.us], Online Assembly Language Books ==External links== * [http://home.comcast.net/~dtgm/asm_links.html List of resources; books, websites, newsgroups, and IRC channels] *[http://linuxassembly.org Linux Assembly] *[http://www.int80h.org/ Unix Assembly Language Programming] Assembly languages Programming languages Computing th:ภาษาแอสเซมบลี

Assembly language



''Unlike in high-level languages, there is a 1-to-1 mapping from simple assembly to machine language, so that computers can translate in both directions without losing information.'' : this is not entirely correct. Much information is lost if the assembled executable does not contain debugging information (most executables don't). Such debugging information includes the names of variables, procedures, labels, et al. Without this information, a disassembler cannot show meaningful symbol names and as a result, disassembly listings use addresses or numbered labels which are not human readable (rendering the program almost useless except by experts with a ton of time on thier hands to figure out what each peice of data is used for). Comments and whitespace are also not stored in the executable, meaning that a disassembler cannot recover this information. It would be more correct to state that there is a ''logical'' 1-to-1 relationship. User:24.198.144.163 ''There is some debate over the usefulness of assembly language.'' :Debate? over the ''usefulness''? I think this is a bit far fetched, maybe debate over suitability for some fields of application, I think nobody with sufficient experience would debate the ''usefulness'' of asm. Maybe people who don't use asm would ''debate'' the usefulness, but that's with any tool. ''In many cases, modern compilers can render higher-level languages into code as that runs as fast as hand-written assembler. '' :Really?? can anyone give a reference for one of these ''modern compilers'' please? I've never heard such claims by compiler authors, nor did I encounter such a compiler, I'm very doubtful about the existance of such a compiler, for which programming language? the so called 'high-level' langs of today, don't allow the programmer to express the ''meaning'' of the code enough for the compiler to have enough data to make optimisations which the programmer could see. (Nov,2003) ::I think the above quote is an overstatement. A compiler like the GCC with optimisation as high as it will go can probably out-optimise a new ASM programmer. It has been programmed with weird and wonderful shortcuts that the human just wouldn't know about. However, if you pitch a modern compiler against an experienced ASM programmer, the issue would not be optimisation, it would be time. User:Giddie 30/03/2004 0241 UTC ''some low-level programming is simply easier to do in assembler.'' :Sometimes some ''high-level' programming is simply easier to do in assembler, depends what the high-level language you would compare it to at the time would 'hide' from you. for example, writing many numerical abstactions is more direct in ASM, including some work in represantations of groups. Anyway, the point being that ''ease'' is not really dependant on the ''abstraction level'' of the code, but rather, on the abstract-idioms or details that the high-level language chose to ignore. (simplest example, C programming language, in-ability to access to carry-flag) ==Generations of Programming Languages== So what is a First Generation programming language? and is there a Third Generation? User:Phil Boswell 15:40, Dec 8, 2003 (UTC) : See First-generation programming language, Third generation language and even Fourth-generation programming language. This naming is probably more a naming gimmick than anything else. Especially the 4th. generation languages. User:Rasmus Faber 15:45, 8 Dec 2003 (UTC) :: My problem was that Second-generation programming language is a REDIRECT to Assembly language, so there's no cross-reference to the other generations there. Maybe a covering article showing all four generations in overview? User:Phil Boswell 16:43, Dec 8, 2003 (UTC) ::: Ah, sorry about that! Good idea. I don't think the generations warrant a page each. User:Rasmus Faber 16:47, 8 Dec 2003 (UTC) ---- I frankly don't know whose idea it was to name this article ''assembly programming language'', but although it is in use and parallels the names of other articles like C programming language, I believe the term assembly language is considerably more common and entirely unambiguous. I will move this page and talk page. User:Dcoetzee 22:42, 17 Sep 2004 (UTC) :Assembly language is used specifically in dissembly, so its useless to underestimate its need in present as well as future scenario. shareplatform.com disclose its importance.


See other meanings of words starting from letter:

A

AB | AC | AD | AE | AF | AG | AH | AI | AJ | AK | AL | AM | AN | AO | AP | AR | AS | AT | AU | AW | AX | AY | AZ |

Words begining with Assembly_language:

Assembly_Language
Assembly_language
Assembly_language
Assembly_languages
Assembly_languages


These materials are based on Wikipedia and licensed under the GNU FDL



YouTube.com videos better site than Turbo Tax 2007
encyklopedia online