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

Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formatsMazin Alwaaly
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle pptsheetal singh
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
Instruction cycle with interrupts
Instruction cycle with interruptsInstruction cycle with interrupts
Instruction cycle with interruptsShubham Jain
 
Unit II Arm7 Thumb Instruction
Unit II Arm7 Thumb InstructionUnit II Arm7 Thumb Instruction
Unit II Arm7 Thumb InstructionDr. Pankaj Zope
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureVinit Raut
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COARuchi Maurya
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programmingKartik Sharma
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction FormatDhrumil Panchal
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructionsihsanjamil
 
Unit 4 ca-input-output
Unit 4 ca-input-outputUnit 4 ca-input-output
Unit 4 ca-input-outputBBDITM LUCKNOW
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086COMSATS Abbottabad
 

What's hot (20)

Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
8086 alp
8086 alp8086 alp
8086 alp
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Stack organization
Stack organizationStack organization
Stack organization
 
Instruction cycle with interrupts
Instruction cycle with interruptsInstruction cycle with interrupts
Instruction cycle with interrupts
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Unit II Arm7 Thumb Instruction
Unit II Arm7 Thumb InstructionUnit II Arm7 Thumb Instruction
Unit II Arm7 Thumb Instruction
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Unit 1
Unit 1Unit 1
Unit 1
 
Unit 4 ca-input-output
Unit 4 ca-input-outputUnit 4 ca-input-output
Unit 4 ca-input-output
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
 
Memory mapping
Memory mappingMemory mapping
Memory mapping
 

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

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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

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