0% found this document useful (0 votes)
13 views

Digital Electronics Addressing Mode

Assembly programming language is a low-level language that communicates directly with computer hardware, using human-readable mnemonics, labels, operands, and directives. Addressing modes define how operands are specified in instructions, with various types such as implied, immediate, direct, indirect, relative, and indexed addressing modes. The instruction cycle consists of fetching, decoding, executing instructions, and writing results back to memory.

Uploaded by

remamrema5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Digital Electronics Addressing Mode

Assembly programming language is a low-level language that communicates directly with computer hardware, using human-readable mnemonics, labels, operands, and directives. Addressing modes define how operands are specified in instructions, with various types such as implied, immediate, direct, indirect, relative, and indexed addressing modes. The instruction cycle consists of fetching, decoding, executing instructions, and writing results back to memory.

Uploaded by

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

Introduction

Assembly Programming
Language and Addressing Modes
Assembly Programming Language
What is assembly programming language
• An assembly language is a type of low-level programming language that is
intended to communicate directly with a computer’s hardware. Unlike
machine language, which consists of binary and hexadecimal characters,
assembly languages are designed to be readable by humans.

• Low-level programming languages such as assembly language are a


necessary bridge between the underlying hardware of a computer

• Assembly language relies on language syntax, labels, operators, and


directives to convert code into usable machine instruction

• Assembly language must be translated into machine language using an


assembler
Components of Assembly language
• Mnemonics: Assembly language uses mnemonics, which are short and easy-to-remember
abbreviations that represent machine instructions(For example: ADD, SUB, MOV, INC, LOAD,
STORE). For example, ‘MOV’ might represent a command to move data from one location to
another,ADD B Here ADD is operation and (B) is operand.

• Labels: Labels are used to mark speci c locations in the code, allowing for easier referencing of
memory addresses or de ning points for branching instructions (like jumps or loops). They are
often used in conjunction with control ow instructions.Operators

• Operands: These are the inputs or targets for instructions. Operands can be immediate values
(constants directly used in the instruction), memory addresses, or registers. MOV AX,5 "AX" is a
register, and "5" is an immediate value or constant

• Directives: Directives are commands for the assembler rather than the CPU. They provide
instructions and information to the assembler about how to assemble the code. For example,
directives might include de ning constants, allocating memory, or specifying the start point of the
program
fi
fi
fl
fi
Components of Assembly language
• Comments: Comments are used to annotate the code and provide explanations
for programmers reading the code. They are not executed by the computer and
are for human understanding only.

• Control Structures: These are constructs like loops and conditional statements
that control the ow of execution in the program. They are written using
assembly language instructions and are used to direct the program's execution
path

• Syntax: When writing any code in any program language, there is an


observable, speci c order of rules that must be followed to allow a compiler to
execute the code without error. These rules are de ned as the syntax, and they
contain criteria such as the maximum number of allowable characters, what
characters code lines must start with, or what certain symbols
fl
fi
fi
Advantage and Disadvantage of Assembly language
Example of Assembly Language Code
Read the following questions
• What is assembly programming language
• Give the di erence between assembly programming language and higher
level programming language

• How does assembly programming language works


• How is assembly programming language used today?
• Brie y explain the components of assembly programming language
• What is an assembler
• State and explain atleast 3 mnemonics used in assembly programming
language
fl
ff
Addressing Modes
What is addressing modes
• The term addressing modes refers to how the operand of an instruction is
speci ed, addressing mode speci es a rule for interpreting or modifying the
address eld of the instruction before the operand is executed. The di erent
ways in which the location of an operand is speci ed in instruction are
referred to as addressing modes.

• The addressing modes are used to specify the e ective address in an


instruction ,The e ective address contains the object. The object can be a
data element or an address that must be evaluated in the instruction
fi
fi
ff
fi
ff
fi
ff
Why are Addressing Modes Used?
• Addressing modes shows the location of a required object in the computer.
The object may be an instruction or data. The output of the addressing mode
is an e ective address [EA]. The e ective address is the actual address of an
object. Therefore we can say the object is equal to the content of the e ective
address. The addressing mode is implemented in the instruction in two ways

• Implicit: The opcode itself speci es the addressing mode used.


• Explicit: The mode eld is used in the instruction format to specify the type of
addressing mode used.
ff
fi
fi
ff
ff
Types Addressing Modes
• The addressing modes are categorized into two types: memory-based
addressing mode and transfer control addressing mode. The memory-based
addressing mode is further classi ed into di erent types that are as follows:

• Implied Addressing Mode: In this mode, the operands are implicitly speci ed
in the instruction de nition.
fi
fi
ff
fi
Cont.
• Immediate Addressing Mode: In this mode, the operand is speci ed in the
instruction itself, or we can say that an immediate mode instruction has an
operand rather than an address.

fi
Cont
• Direct Addressing Mode: In this mode, the address of the memory location
that holds the operand is included in the instruction. The e ective address is
the address part of the instruction.

ff
Cont
• Indirect Addressing Mode: In this mode, the address eld of the
instruction gives the address where the e ective address is stored in
memory.

ff
fi
Cont
• Relative Addressing Mode: In this mode, the content of the program
counter is added to the address part of the instruction to calculate the
e ective address.
ff
Cont.
• Indexed Addressing Mode: In this mode, the e ective address will be
calculated as the addition of the content of the index register and the
address part of the instruction

ff
Summary.
Machine Instructions
• A binary code is used for specifying micro-operations for the computer.
Machine Instructions are commands or programs written in the machine code
of a machine (computer) that it can recognize and execute. In computer
programming, machine Instructions are low-level program instructions in
binary. Without further processing, these instructions are directly decoded
and executed by the computer microprocessor.

• Instruction Code: A group of bits is used to instruct the CPU to perform a


speci c operation. Instructions are encoded as binary instruction codes.

• Instruction Set: An instruction set is a group of commands for a CPU in


machine language. The term can refer to all possible instructions for a CPU or
a subset of instructions to enhance its performance in certain situations.
fi
Instruction Cycles:
• Instruction Cycles: The instruction cycle (also known as the fetch–decode–execute
cycle, or simply the fetch-execute cycle) is the cycle that the central processing unit
(CPU) follows from boot-up until the computer has shut down to process instructions.
The instruction cycle consists of the following phases that are as follows.

• Fetching an instruction from memory.


• Decoding the instruction.
• Reading the e ective address from memory in case of the instruction has an
indirect address.

• Execution of the instruction.


• Writing the results back to the memory.
ff
Read the following questions
• What is addressing
• With aid of diagram, explain the types of addressing modes
• De ne CPU instruction cycle
• Give the di erence between implicit/implied addressing mode and
immediate addressing mode

• De ne the following term operand, opcode


• De ne program counter, memory address register, memory data
register
fi
fi
fi
ff

You might also like