SlideShare a Scribd company logo
1 of 22
CHAPTER 3
INSTRUCTION SET AND ASSEMBLY
LANGUAGE PROGRAMMING
CLO 3: construct a simple program in assembly language
to perform a given task
Summary : This topic introduces the instruction set, data format,
addressing modes, status flag and assembly language programming.
RTA: (06 : 06)
3.1 UNDERSTANDING
INSTRUCTION SET AND
ASSEMBLY LANGUAGE
3.1.1 Define instruction set,machine
and assembly language
INSTRUCTION SET
• An instruction set is a list of commands ready to be executed directly by CPU.
• We can simply say that the functions of instruction set is to instruct all CPU's with
a set of instruction that can
– tells the CPU where to find data
– when to read the data
– what to do with the data
Now we will see some of the type of instruction set.
• Data transfer instruction
• Arithmetic instruction
• Logical instruction and bit manipulation
• Program control instruction
• Processing control instruction
• Shift and rotate instruction
Machine Language
• A machine language sometimes referred to
as machine code or object code.
• Machine language is a collection
of binary digits or bits that the computer
reads and interprets.
• Machine language is the only language a
computer is capable of understanding.
• Machine language consists of 0s and 1s.
Assembly Language
• Is a low-level programming
language for computers,microprocessors,
microcontrollers and other programmable devices.
• Assembly language is just one level higher than
machine language.
– Assembly language consists of simple codes.
– Each statement in an assembly language corresponds
directly to a machine code understood by the
microprocessor.
• The software used to convert an assembly program
into machines codes is called an assembler.
high Level
Programming
Low
Level
Programming
3.1.2 Describe features and architectures
of various type of microprocessor
MOTOROLA 6800
• The Motorola 68000 is a 32-bit CISC microprocessor.
• 24 bit address bus
• 16 bit data bus.
INTEL 8086
• 8086 has 16-bit ALU; this means 16-bit
numbers are directly processed by 8086.
• It has 16-bit data bus, so it can read data or
write data to memory or I/O ports either 16
bits or 8 bits at a time.
• It has 20 address lines, so it can address up to
220
i.e. 1048576 = 1Mbytes of memory (words
i.e. 16 bit numbers are stored in consecutive
memory locations).
3.1.3 Describe the Addressing
Modes
• Many instructions, such as MOV, operates on
two operands.
– MOV dest, source
• Addressing mode indicates where the operands
are located.
• There are various addressing modes in x86.
– Register, immediate, direct, register indirect, base-
plus-index, register relative, base relative-plus-
index,
 Register is a storage element inside a
microprocessor.
ADDRESSING MODES
1. Register Addressing
• Instruction gets its source data from a register.
• Data resulting from the operation is stored in
another register.
• Data length depends on register being used.
– 8-bit registers: AH, AL, BH, BL, CH, CL, DH, DL.
– 16-bit registers: AX, BX, CX, DX, SP, BP, SI, DI.
– 32-bit registers: EAX, EBX, ECX, EDX, ESP, EBP, EDI,
ESI.
– 64-bit registers: RAX, RBX, RCX, RDX, RSP, RBP, RDI,
RSI, and R8 through R15.
1.Register Addressing
• Examples:
– MOV AX, BX ;Copy the 16-bit content of BX to
AX
– MOV AL, BL ;Copy the 8-bit content of BL to AL
– MOV SI, DI ;Copy DI into SI
– MOV DS, AX ;Copy AX into DS
• Note that the instruction must use registers of
the same size.
– Cannot mix between 8-bit and 16-bit registers.
– Will result in an error when assembled.
2. Immediate Addressing
• The source data is coded directly into the
instruction.
– The term immediate means that the data
immediately follows the hexadecimal opcode in the
memory.
• Immediate data are constant data such as
a number, a character, or an arithmetic
expression.
• Examples:
– MOV AX, 100
– MOV BX, 189CH
– MOV AH, 10110110B
– MOV AL, (2 + 3)/5
3. Direct Addressing
• The operand is stored in a memory location, usually in
data segment.
• The instruction takes the offset address.
– This offset address must be put in a bracket [ ].
• Example:
– MOV [1234H], AL
– The actual memory location is obtained by combining
the offset address with the segment address in the
segment register DS (unless specified otherwise)
– If we want to use another segment register such as ES,
you can use the syntax ES:[1234H]
– Assuming DS = 1000H, then this instruction will move
the content of AL into the memory location 1234H.
4. Register Indirect Addressing
• Similar to direct data addressing, except
that the offset address is specified using
an index or base register.
– Base registers = BP, BX. Index registers = DI, SI.
– In 80386 and above, any register (EAX, EBX, ECX, EDX, EBP,
EDI, ESI) can store the offset address.
– The registers must be specified using a bracket [ ].
– DS is used as the default segment register for BX, DI and SI.
• Example:
– MOV AX, [BX]
– Assuming DS = 1000H and BX = 1234H, this instruction will
move the content memory location 11234H and 11235H into
AX.
5. Base-plus-index Addressing
• Similar to register indirect addressing, except
that the offset address is obtained by adding a
base register (BP, BX) and an index register (DI,
SI).
• Example:
– MOV [BX+SI], BP
– Assuming DS = 1000H, BX = 0300H and SI = 0200H,
this instruction will move the content of register BP
to memory location 10500H.
6. Register Relative Addressing
• Similar to register indirect addressing,
except that the offset address is obtained
by adding an index or base register with a
displacement.
• Example 1:
– MOV AX, [DI+100H]
– Assuming DS = 1000H and DI = 0300H, this instruction will
move the content from memory location 10400H into AX.
• Example 2:
– MOV ARRAY[SI], BL
– Assuming DS = 1000H, ARRAY = 5000H and SI = 500H, this
instruction will move the content in register BL to memory
location 15500H.
7. Base Relative-plus-index
Addressing
• Combines the base-plus-index addressing
and relative addressing.
• Examples:
– MOV AH, [BX+DI+20H]
– MOV FILE[BX+DI], AX
– MOV LIST[BP+SI+4], AL
3.2 APPLY ASSEMBLY LANGUAGE
3.2.1 Write simple program in
assembly language
Example of assembly languange:
MOV CL, 55H ; move 55H into register CL
MOV DL, CL ; copy the contents of CL into DL (now DL=CL=55H)
MOV AH, DL ; copy the contents of DL into AH (now AH=CL=55H)
MOV AL, AH ; copy the contents of AH into AL (now AL=AH=55H)
MOV BH, CL ; copy the contents of CL into BH (now BH=CL=55H)
MOV CH, BH ; copy the contents of BH into CH (now CH=BH=55H)
HLT
3.2.2 Tool in analyzing and debugging
assembly language program
• Emulator 8086k –analyze for INTEL 8086
• Easy68k- analyze for MOTOROLA 6800

More Related Content

What's hot

Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorvishalgohel12195
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureVinit Raut
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Urvashi Singh
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086Dr. AISHWARYA N
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructionsihsanjamil
 
Synchronous and Asynchronous Transmission
Synchronous and Asynchronous TransmissionSynchronous and Asynchronous Transmission
Synchronous and Asynchronous TransmissionAdeel Rasheed
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language Usman Bin Saad
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)Siddhi Viradiya
 
8086 modes
8086 modes8086 modes
8086 modesPDFSHARE
 
Arithmetic logic shift unit
Arithmetic logic shift unitArithmetic logic shift unit
Arithmetic logic shift unitrishi ram khanal
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionswarda aziz
 
DATA TRANSMISSION, Synchronous & Asynchronous Data Transfer
DATA TRANSMISSION, Synchronous & Asynchronous Data TransferDATA TRANSMISSION, Synchronous & Asynchronous Data Transfer
DATA TRANSMISSION, Synchronous & Asynchronous Data TransferJabbar Tunyo
 
Logic microoperations
Logic microoperationsLogic microoperations
Logic microoperationsNitesh Singh
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipeliningMazin Alwaaly
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4Motaz Saad
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086techbed
 
Instruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingInstruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingBrenda Debra
 

What's hot (20)

Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processor
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
DMA operation
DMA operationDMA operation
DMA operation
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Synchronous and Asynchronous Transmission
Synchronous and Asynchronous TransmissionSynchronous and Asynchronous Transmission
Synchronous and Asynchronous Transmission
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
 
8086 modes
8086 modes8086 modes
8086 modes
 
Arithmetic logic shift unit
Arithmetic logic shift unitArithmetic logic shift unit
Arithmetic logic shift unit
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
DATA TRANSMISSION, Synchronous & Asynchronous Data Transfer
DATA TRANSMISSION, Synchronous & Asynchronous Data TransferDATA TRANSMISSION, Synchronous & Asynchronous Data Transfer
DATA TRANSMISSION, Synchronous & Asynchronous Data Transfer
 
Logic microoperations
Logic microoperationsLogic microoperations
Logic microoperations
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086
 
Instruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingInstruction Set and Assembly Language Programming
Instruction Set and Assembly Language Programming
 

Similar to Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING

Addressing mode of 80286 microprocessor
Addressing mode of 80286 microprocessorAddressing mode of 80286 microprocessor
Addressing mode of 80286 microprocessorpal bhumit
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)Aswini Dharmaraj
 
lect 03- MIT Addressing Modes.pdf
lect 03- MIT Addressing Modes.pdflect 03- MIT Addressing Modes.pdf
lect 03- MIT Addressing Modes.pdfAdeelAsghar36
 
8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd yearBharghavteja1
 
All-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxAll-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxVidyaAshokNemade
 
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjmicro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjTadeseBeyene
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086Mahalakshmiv11
 
Assembly language.pptx
Assembly language.pptxAssembly language.pptx
Assembly language.pptxShaistaRiaz4
 
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptxLecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptxVikasMahor3
 
Introduction to 8086 microprocessor
Introduction to 8086 microprocessorIntroduction to 8086 microprocessor
Introduction to 8086 microprocessorShreyans Pathak
 
02 Addressing Modes.pptx
02 Addressing Modes.pptx02 Addressing Modes.pptx
02 Addressing Modes.pptxssuser586772
 
8085_Microprocessor(simar).ppt
8085_Microprocessor(simar).ppt8085_Microprocessor(simar).ppt
8085_Microprocessor(simar).pptKanikaJindal9
 
Pai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadPai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadYogesh Deshpande
 
Notes 8086 instruction format
Notes 8086 instruction formatNotes 8086 instruction format
Notes 8086 instruction formatHarshitParkar6677
 

Similar to Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING (20)

Addressing mode of 80286 microprocessor
Addressing mode of 80286 microprocessorAddressing mode of 80286 microprocessor
Addressing mode of 80286 microprocessor
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
 
lect 03- MIT Addressing Modes.pdf
lect 03- MIT Addressing Modes.pdflect 03- MIT Addressing Modes.pdf
lect 03- MIT Addressing Modes.pdf
 
8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year8086 microprocessor pptx JNTUH ece 3rd year
8086 microprocessor pptx JNTUH ece 3rd year
 
All-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptxAll-addressing-modes of the 80386 /microprocessor.pptx
All-addressing-modes of the 80386 /microprocessor.pptx
 
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjmicro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Assembly language.pptx
Assembly language.pptxAssembly language.pptx
Assembly language.pptx
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
CO_Chapter2.ppt
CO_Chapter2.pptCO_Chapter2.ppt
CO_Chapter2.ppt
 
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptxLecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
Lecture 28 , 29 & 30(instruction set & addressing mode of 8086.pptx
 
Introduction to 8086 microprocessor
Introduction to 8086 microprocessorIntroduction to 8086 microprocessor
Introduction to 8086 microprocessor
 
02 Addressing Modes.pptx
02 Addressing Modes.pptx02 Addressing Modes.pptx
02 Addressing Modes.pptx
 
Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086
 
8085_Microprocessor(simar).ppt
8085_Microprocessor(simar).ppt8085_Microprocessor(simar).ppt
8085_Microprocessor(simar).ppt
 
Pai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadPai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_upload
 
Notes 8086 instruction format
Notes 8086 instruction formatNotes 8086 instruction format
Notes 8086 instruction format
 

More from Frankie Jones

Dbm2013 engineering mathematics 3 june 2017
Dbm2013  engineering mathematics 3 june 2017Dbm2013  engineering mathematics 3 june 2017
Dbm2013 engineering mathematics 3 june 2017Frankie Jones
 
Basic concepts of information technology and the internet
Basic concepts of information technology and the internetBasic concepts of information technology and the internet
Basic concepts of information technology and the internetFrankie Jones
 
2.1 Understand problem solving concept
2.1 Understand problem solving concept2.1 Understand problem solving concept
2.1 Understand problem solving conceptFrankie Jones
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problemFrankie Jones
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languagesFrankie Jones
 
Chapter 3 Computer Organization
Chapter 3 Computer OrganizationChapter 3 Computer Organization
Chapter 3 Computer OrganizationFrankie Jones
 
Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Frankie Jones
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Frankie Jones
 
Chapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationChapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationFrankie Jones
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its functionFrankie Jones
 
Multimedia storyboard template
Multimedia storyboard templateMultimedia storyboard template
Multimedia storyboard templateFrankie Jones
 
Occupancy calculation form
Occupancy calculation formOccupancy calculation form
Occupancy calculation formFrankie Jones
 

More from Frankie Jones (14)

Dbm2013 engineering mathematics 3 june 2017
Dbm2013  engineering mathematics 3 june 2017Dbm2013  engineering mathematics 3 june 2017
Dbm2013 engineering mathematics 3 june 2017
 
Basic concepts of information technology and the internet
Basic concepts of information technology and the internetBasic concepts of information technology and the internet
Basic concepts of information technology and the internet
 
2.1 Understand problem solving concept
2.1 Understand problem solving concept2.1 Understand problem solving concept
2.1 Understand problem solving concept
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
 
Chapter 3 Computer Organization
Chapter 3 Computer OrganizationChapter 3 Computer Organization
Chapter 3 Computer Organization
 
Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)
 
Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)Chapter 2 Data Representation on CPU (part 1)
Chapter 2 Data Representation on CPU (part 1)
 
Chapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationChapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of information
 
Operator precedence
Operator precedenceOperator precedence
Operator precedence
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
 
Multimedia storyboard template
Multimedia storyboard templateMultimedia storyboard template
Multimedia storyboard template
 
Occupancy calculation form
Occupancy calculation formOccupancy calculation form
Occupancy calculation form
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING

  • 1. CHAPTER 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING CLO 3: construct a simple program in assembly language to perform a given task Summary : This topic introduces the instruction set, data format, addressing modes, status flag and assembly language programming. RTA: (06 : 06)
  • 2. 3.1 UNDERSTANDING INSTRUCTION SET AND ASSEMBLY LANGUAGE
  • 3. 3.1.1 Define instruction set,machine and assembly language INSTRUCTION SET • An instruction set is a list of commands ready to be executed directly by CPU. • We can simply say that the functions of instruction set is to instruct all CPU's with a set of instruction that can – tells the CPU where to find data – when to read the data – what to do with the data Now we will see some of the type of instruction set. • Data transfer instruction • Arithmetic instruction • Logical instruction and bit manipulation • Program control instruction • Processing control instruction • Shift and rotate instruction
  • 4. Machine Language • A machine language sometimes referred to as machine code or object code. • Machine language is a collection of binary digits or bits that the computer reads and interprets. • Machine language is the only language a computer is capable of understanding. • Machine language consists of 0s and 1s.
  • 5. Assembly Language • Is a low-level programming language for computers,microprocessors, microcontrollers and other programmable devices. • Assembly language is just one level higher than machine language. – Assembly language consists of simple codes. – Each statement in an assembly language corresponds directly to a machine code understood by the microprocessor. • The software used to convert an assembly program into machines codes is called an assembler.
  • 7. 3.1.2 Describe features and architectures of various type of microprocessor MOTOROLA 6800 • The Motorola 68000 is a 32-bit CISC microprocessor. • 24 bit address bus • 16 bit data bus.
  • 8. INTEL 8086 • 8086 has 16-bit ALU; this means 16-bit numbers are directly processed by 8086. • It has 16-bit data bus, so it can read data or write data to memory or I/O ports either 16 bits or 8 bits at a time. • It has 20 address lines, so it can address up to 220 i.e. 1048576 = 1Mbytes of memory (words i.e. 16 bit numbers are stored in consecutive memory locations).
  • 9.
  • 10. 3.1.3 Describe the Addressing Modes • Many instructions, such as MOV, operates on two operands. – MOV dest, source • Addressing mode indicates where the operands are located. • There are various addressing modes in x86. – Register, immediate, direct, register indirect, base- plus-index, register relative, base relative-plus- index,  Register is a storage element inside a microprocessor.
  • 12. 1. Register Addressing • Instruction gets its source data from a register. • Data resulting from the operation is stored in another register. • Data length depends on register being used. – 8-bit registers: AH, AL, BH, BL, CH, CL, DH, DL. – 16-bit registers: AX, BX, CX, DX, SP, BP, SI, DI. – 32-bit registers: EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI. – 64-bit registers: RAX, RBX, RCX, RDX, RSP, RBP, RDI, RSI, and R8 through R15.
  • 13. 1.Register Addressing • Examples: – MOV AX, BX ;Copy the 16-bit content of BX to AX – MOV AL, BL ;Copy the 8-bit content of BL to AL – MOV SI, DI ;Copy DI into SI – MOV DS, AX ;Copy AX into DS • Note that the instruction must use registers of the same size. – Cannot mix between 8-bit and 16-bit registers. – Will result in an error when assembled.
  • 14. 2. Immediate Addressing • The source data is coded directly into the instruction. – The term immediate means that the data immediately follows the hexadecimal opcode in the memory. • Immediate data are constant data such as a number, a character, or an arithmetic expression. • Examples: – MOV AX, 100 – MOV BX, 189CH – MOV AH, 10110110B – MOV AL, (2 + 3)/5
  • 15. 3. Direct Addressing • The operand is stored in a memory location, usually in data segment. • The instruction takes the offset address. – This offset address must be put in a bracket [ ]. • Example: – MOV [1234H], AL – The actual memory location is obtained by combining the offset address with the segment address in the segment register DS (unless specified otherwise) – If we want to use another segment register such as ES, you can use the syntax ES:[1234H] – Assuming DS = 1000H, then this instruction will move the content of AL into the memory location 1234H.
  • 16. 4. Register Indirect Addressing • Similar to direct data addressing, except that the offset address is specified using an index or base register. – Base registers = BP, BX. Index registers = DI, SI. – In 80386 and above, any register (EAX, EBX, ECX, EDX, EBP, EDI, ESI) can store the offset address. – The registers must be specified using a bracket [ ]. – DS is used as the default segment register for BX, DI and SI. • Example: – MOV AX, [BX] – Assuming DS = 1000H and BX = 1234H, this instruction will move the content memory location 11234H and 11235H into AX.
  • 17. 5. Base-plus-index Addressing • Similar to register indirect addressing, except that the offset address is obtained by adding a base register (BP, BX) and an index register (DI, SI). • Example: – MOV [BX+SI], BP – Assuming DS = 1000H, BX = 0300H and SI = 0200H, this instruction will move the content of register BP to memory location 10500H.
  • 18. 6. Register Relative Addressing • Similar to register indirect addressing, except that the offset address is obtained by adding an index or base register with a displacement. • Example 1: – MOV AX, [DI+100H] – Assuming DS = 1000H and DI = 0300H, this instruction will move the content from memory location 10400H into AX. • Example 2: – MOV ARRAY[SI], BL – Assuming DS = 1000H, ARRAY = 5000H and SI = 500H, this instruction will move the content in register BL to memory location 15500H.
  • 19. 7. Base Relative-plus-index Addressing • Combines the base-plus-index addressing and relative addressing. • Examples: – MOV AH, [BX+DI+20H] – MOV FILE[BX+DI], AX – MOV LIST[BP+SI+4], AL
  • 20. 3.2 APPLY ASSEMBLY LANGUAGE
  • 21. 3.2.1 Write simple program in assembly language Example of assembly languange: MOV CL, 55H ; move 55H into register CL MOV DL, CL ; copy the contents of CL into DL (now DL=CL=55H) MOV AH, DL ; copy the contents of DL into AH (now AH=CL=55H) MOV AL, AH ; copy the contents of AH into AL (now AL=AH=55H) MOV BH, CL ; copy the contents of CL into BH (now BH=CL=55H) MOV CH, BH ; copy the contents of BH into CH (now CH=BH=55H) HLT
  • 22. 3.2.2 Tool in analyzing and debugging assembly language program • Emulator 8086k –analyze for INTEL 8086 • Easy68k- analyze for MOTOROLA 6800