[go: up one dir, main page]

100% found this document useful (1 vote)
33 views12 pages

Assembly Languages-1

Assembly language is a low-level programming language that allows programmers to write instructions in a symbolic notation corresponding to machine code, facilitating direct communication with hardware. Its evolution spans five generations, from basic mnemonic codes in the 1940s to advanced debugging tools in modern computing. While it offers precise control and efficiency for hardware-related tasks, assembly language is complex, machine-dependent, and challenging to maintain.

Uploaded by

kishorgaikar826
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
33 views12 pages

Assembly Languages-1

Assembly language is a low-level programming language that allows programmers to write instructions in a symbolic notation corresponding to machine code, facilitating direct communication with hardware. Its evolution spans five generations, from basic mnemonic codes in the 1940s to advanced debugging tools in modern computing. While it offers precise control and efficiency for hardware-related tasks, assembly language is complex, machine-dependent, and challenging to maintain.

Uploaded by

kishorgaikar826
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

ASSEMBLY LANGUAGE

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-language allows the designer to program in terms of the machine instructions


that a specific processor can perform. Since binary machine-code instructions are difficult to
understand directly, assembly-language programs are expressed in a symbolic notation.
There is a one-to-one correspondence between each assembly-language instruction and a
machine-code instruction.

Assembly-language programs have to be written in terms of the specific processor's


instruction set and architecture, such as its CPU registers, memory locations, and
input/output device registers. Also, memory storage has to be allocated explicitly for data
objects using primitive data types. Assembly-language uses mnemonics for each machine
level instruction. The mnemonics are usually specific to one processor or a family of
processors and are chosen such that the function of the instruction is fairly obvious (e.g.
ADD, SUB, MOV, etc.). In addition, the user has to define symbolic names for data objects
such as variables (memory addresses), data constants, and labels (code locations).
EVOLUTION OF ASSEMBLY LANGUAGE

First Generation (1940-1950):-


 Computers relied on vacuum tubes, and programming was directly in machine
language, using binary instructions.
 Assembly language emerged as a readable abstraction, employing mnemonic codes
to represent machine instructions.

Second Generation (1950-1960):-


 Transistor-based computers replaced vacuum tubes, offering enhanced Consistency
and prowess.
 Assembly languages became more intricate to handle the complex instruction sets of
these new machines. Simultaneously, high-level programming languages
like FORTRAN and COBOL provided Advanced abstraction

Third Generation (1960-1970):-


 Integrated circuits became Standard place, resulting in Diminished but potent
computers.
 Assembly languages evolved further, introducing features like macros and symbolic
labels, which boosted programmer productivity and code readability

Fourth Generation (1970-1980):-


 The beginning of microprocessors transformed computing, paving the way for
microcomputer systems such as the IBM PC and Apple II.
 Assembly languages for microcomputers were redesigned to enhance user
accessibility, featuring syntax highlighting and automatic indentation, thus increasing
inclusivity for a larger group of programmers.

Fifth Generation (1980-present):-


 This era is characterized by executing multiple computational tasks simultaneously
this method is known as parallel processing system and the growth of sophisticated
software systems
 Assembly language continued to evolve to meet the demands of programmers, with
the deployment of cutting-edge debugging methods andtools focused on improving
code performance and productivity.for intricate systems.
HOW ASSEMBLY LANGUAGE WORKS

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.

It enables the programmer to communicate directly with the hardware such as


registers, memory locations, input/output devices or any
other hardware components. Which could help the programmer to directly control
hardware components and to manage the resources in an efficient manner.
COMPONENTS OF ASSEMBLY LANGUAGE

 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.

 Command: An instruction in assembly code known as a command informs the


assembler what to do. Assembly language instructions typically employ self-
descriptive abbreviations to make the vocabulary simple, as "ADD" for addition and
"MOV" for data movement.

 Instructions: Instructions are the mnemonic codes that we give to the processor to
perform specific tasks like LOAD, ADDITION, MOVE. Example: ADD

 Labels: It is a symbolic name/identifier given to indicate a particular location or


address in the assembly code. Example: FIRST to indicate starting of execution part of
code.

 Mnemonic: A mnemonic is an acronym for an assembly language instruction or a


name given to a machine function. Each mnemonic in assembly corresponds to a
specific machine instruction. Add is an illustration of one of these machine
commands. CMP, Mul, and Lea are among further instances.
ADVANTAGES OF ASSEMBLY LANGUAGE

 It provides precise control over hardware and hence increased code optimization.

 It allows direct access to hardware components like registers, so it enables tailored


solutions for hardware issues

 Efficient resource utilization because of low level control, optimized code, resource
awareness, customization etc.

 It is ideal for programming microcontrollers, sensors and other hardware


components.

 It is used in security researches for finding security vulnerabilities, reverse


engineering software for system security.

 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 highly machine dependent. So, it limits portability.

 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.

 Debugging is very challenging to programmers.

EXAMPLE :-

ADDITION OF TWO NUMBERS:


1.Assume 8 bit no al&bl
Al= 80h bl=70h
.MODEL SMALL
.CODE:
MOV AL 80H
MOV BL 70H
ADD AL,BL
ENDS
2] ASSUME TWO 8 BIT NO ARE STORED IN MEMORY
USING VARIABLR NAME NUM1 & NUM2 STOED REPUT IN RES.
NUM1=80H & NUM2= 08H

.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

3]ADDITION OF 16 BIT NUMBER:


.MODEL SMALL
CODE:
MOV AX , 0080H
MOV BX , 7C60H
ADD AX,BX
ENDS
END

.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:-

data section: This section defines the data used by


the program, such as the messages to be displayed
and the memory locations for the numbers.
.text section: This section contains the executable
code.
_start label: This is where the program execution
begins.
mov instruction: This instruction is used to move data
from one location to another, like registers or
memory.
int 80h: This is an interrupt call to the DOS kernel (for
older systems), used for system calls like printing to
the screen or reading input.
add instruction: This instruction adds the values in
the registers.
[ ]: This notation accesses memory locations.
db: Defines a byte (8 bits).
dd: Defines a double word (32 bits).
0: Null terminator for strings.
newline: Creates a newline character.

CONCLUSION:-

provided valuable insights into low-level programming, hardware


interaction, and the fundamental principles of computer architecture,
demonstrating the power and precision of assembly language
for specific tasks.

You might also like