But high quality assembly language programs can run much faster and use much less memory and other resources than a similar program written in a high level language.
Speed increases of 2 to 20 times faster are fairly common, and increases of hundreds of times faster are occasionally possible.
Assembly language programming also gives direct access to key machine features essential for implementing certain kinds of low level routines, such as an operating system kernel or microkernel, device drivers, and machine control.
High level programming languages are much easier for less skilled programmers to work in and for semi-technical managers to supervise.
High level languages allow faster development times than work in assembly language, even with highly skilled programmers.
Development time increases of 10 to 100 times faster are fairly common.
Programs written in high level languages (especially object oriented programming languages) are much easier and less expensive to maintain than similar programs written in assembly language (and for a successful software project, the vast majority of the work and expense is in maintenance, not initial development).
Performance : An expert Assembly language programmer can often produce code that is much smaller and much faster than a high level language programmer can. For some applications speed and size are critical. Eg:- code on a smart card, code in a cellular telephone, device drivers, BIOS routines etc.
2. Access to the Machine : Procedures can have complete access to the Hardware (Not possible in High level language)
1 . Labels :Begins from column1. Should start with a letter. After the letter a combination of letters and numbers may be used. Restricted by most assemblers from 6 to 8 characters. Use is to identify opcodes and operands. Are needed on executable statements, so that the statement can be branched to.
Format of Assembly program LABEL OPCODE OPERAND COMMENTS
2. Opcode : Symbolic abbreviations for operation codes or comment to the Assembler. Specifies how data are to be manipulated, which is residing within a microprocessor register or in the main memory. Eg: MOV, LD, ADD
3. Operand : use to specify the addresses or registers used by the operands by the Machine instructions. Operands may be Registers, memory location, constants etc.
IP Instruction Pointer – is a 16 bit register and points to the next instruction to be executed within the current code segment.
It is automatically updated by the 8086 as program execution proceeds.
Flag register in the EU holds the status flags typically after an ALU operation.
Flag Register Carry Flay- set carry out of MSB Parity Flag-set if res. has even Auxiliary carry for BCD Zero flag-set if res. is 0 Sign Flag=MSB of res TrapFlag Interrupt Enable Flag String Direction Flag Overflow Flag
Highly pipelined, can perform instruction fetching, decoding, execution, and memory management functions in parallel
On-chip memory management and protection hardware translates logical addresses to physical addresses
Supports virtual memory, paging
Control Unit Data Unit Protection Test Unit Segment Register Segment translators TLB Page translator decoder Instruction queue Prefetch queue prefetcher biu Decode unit Prefetch unit Page unit Execution unit Segment unit Internal architecture of 80386
Based Indexed Mode with Displacement : In this mode the offset of the operand is calculated by adding an 8-bit or 16-bit or 32-bit immediate displacement with the contents of a base register and an index register
E.g.: MOV [EBX] [EBP+0F247822AH], ECX
Scaled Indexed Mode : Contents of an Index register are multiplied by a scale factor that may be added to a displacement to obtain the operand’s effective address. Valid scale factors are 1,2,4 and 8
ORG-ORIGIN: This is used, when it is necessary to place the program in a particular location in memory. As the assembler is translating the source code, it keeps an internal counter that keeps track of the address for the machine code.
Eg: ORG 2000H-tells the assembler to set the location counter to 2000H
ASSUME : is used to tell the assembler the name of the logical segment it should use for a specified segment.
Eg: ASSUME CS:CODE –tells the assembler that the instructions for a program are in a logical segment named CODE.
in instruction MOV AX,[BX], after it reads ASSUME DS: DATA, it will know that the memory location referred to by [BX] is in the logical segment DATA.
The Microsoft Macro Assembler (abbreviated MASM ) is an assembler for the X86 family of microprocessors.
It was originally produced by Microsoft for development work on their MS-DOS, and was for some time the most popular assembler available for that operating system.
It supported a wide variety of macro facilities and structured programming idioms, including high-level constructions for looping, procedure calls and alternation (therefore, MASM is an example of a high-level Assembler).