Assembly Languages-1
Assembly Languages-1
Introduction:-
Programming languages may be either high-level and oriented to the solution of a particular
class of problems, or low-level and oriented towards the architecture of a particular
machine.
Assembly languages contain mnemonic codes that specify what the processor should
do. The mnemonic code that was written by the programmer was converted into
machine language (binary language) for execution. An assembler is used to convert
assembly code into machine language. That machine code is stored in an executable
file for the sake of execution.
Registers: Registers are the fast memory locations situated inside the processor.
Which helps ALU to perform arithmetic operations and temporary storing of data.
Example: Ax (Accumulator), Bx, Cx.
Instructions: Instructions are the mnemonic codes that we give to the processor to
perform specific tasks like LOAD, ADDITION, MOVE. Example: ADD
It provides precise control over hardware and hence increased code optimization.
Efficient resource utilization because of low level control, optimized code, resource
awareness, customization etc.
It is very essential for the making the operating systems, kernel and device
controllers that requires hardware interaction for its functionality.
DISADVANTAGES OF ASSEMBLY LANGUAGE
Complex and very hard to learn the language especially for beginners.
It is really hard to maintain the code, especially for large scale projects
It is very time consuming since it is really hard to understand and very length of code.
EXAMPLE :-
.MODEL SMALL
.DATA
NUM1 DB 80H ; FIRST VARIABLE
NUM2 DB 08H ; SECOND VARIABLE
RES DB ? RESULT STORED IN RES
.CODE
MOV AX @ DATA; INITIalization of d8
MOV DS AX
MOV AL,NUM1
MOV BL NUM2
ADD AL, BL
MOV RES ,AL
ENDS
.MODEL SMALL
.DATA
NUM1 DW 8960H
NUM2 DW 7C60H
RES DW ?
CODE:
MOV AX , @ DATA ; INITIALIZATION OF DS
MOV DS , AX
MOV AX, NUM1
ADD AX, NUM2
MOV RES ,AX
ENDS
END
2] 16 BIT
NUM1 =7C60H
NUM2 =8960H
RES ?
.MODEL SMALL
.DATA
NUM1 DB 7C60H
NUM2 DB 8960H
RES DB ?
.CODE:
MOV AX , @ DATA
MOV DS , AY
MOV AX , NUM 1;
SUB AX , NUM2
MOV RES , AX
ENDS
END
EXPLANTION:-
CONCLUSION:-