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

Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructionsRavi Anand
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorAshita Agrawal
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modesRamaPrabha24
 
30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecturesandip das
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formatsMazin Alwaaly
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
programming techniques
programming techniquesprogramming techniques
programming techniquesRamaPrabha24
 
Computer registers
Computer registersComputer registers
Computer registersDeepikaT13
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086John Cutajar
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Shehrevar Davierwala
 
8259 Operating Modes.pptx
8259 Operating Modes.pptx8259 Operating Modes.pptx
8259 Operating Modes.pptxMeenaAnusha1
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer ArchitectureHaris456
 
Chapter 1 microprocessor introduction
Chapter 1 microprocessor introductionChapter 1 microprocessor introduction
Chapter 1 microprocessor introductionShubham Singh
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureDilum Bandara
 

What's hot (20)

Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructions
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
 
30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
8086 memory segmentation
8086 memory segmentation8086 memory segmentation
8086 memory segmentation
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
programming techniques
programming techniquesprogramming techniques
programming techniques
 
Computer registers
Computer registersComputer registers
Computer registers
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
8259 Operating Modes.pptx
8259 Operating Modes.pptx8259 Operating Modes.pptx
8259 Operating Modes.pptx
 
Programming with 8085
Programming with 8085Programming with 8085
Programming with 8085
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
 
Chapter 1 microprocessor introduction
Chapter 1 microprocessor introductionChapter 1 microprocessor introduction
Chapter 1 microprocessor introduction
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 

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

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
[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
 
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
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.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
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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