SlideShare a Scribd company logo
1 of 2
Download to read offline
Describe the three main addressing modes of the PIC16 architecture discussed in class. For each
of the modes include two examples. Write a PIC16 assembly program which will accomplish the
following instruction. I just want the section of assembly code which accomplishes this. Make
VAR1 =0x22. VAR1 = 0x42 + (0xF0 AND 0xAA) - (0x12 OR 0x34) Perform the above
calculation by hand, showing all your work in binary.
Solution
2 ans
)
The term addressing modes refers to the way in which the operand of an instruction is specified.
Information contained in the instruction code is the value of the operand or the address of the
result/operand. Following are the main addressing modes that are used on various platforms and
architectures.
1) Immediate Mode
The operand is an immediate value is stored explicitly in the instruction:
Example: SPIM ( opcode dest, source)
li $11, 3 // loads the immediate value of 3 into register $11
li $9, 8 // loads the immediate value of 8 into register $9
Example : (textbook uses instructions type like, opcode source, dest)
move #200, R0; // move immediate value 200 in register R0
2) Index Mode
The address of the operand is obtained by adding to the contents of the general register (called
index register) a constant value. The number of the index register and the constant value are
included in the instruction code. Index Mode is used to access an array whose elements are in
successive memory locations. The content of the instruction code, represents the starting address
of the array and the value of the index register, and the index value of the current element. By
incrementing or decrementing index register different element of the array can be accessed.
Example: SPIM/SAL - Accessing Arrays
3) Indirect Mode
The effective address of the operand is the contents of a register or main memory location,
location whose address appears in the instruction. Indirection is noted by placing the name of the
register or the memory address given in the instruction in parentheses. The register or memory
location that contains the address of the operand is a pointer. When an execution takes place in
such mode, instruction may be told to go to a specific address. Once it's there, instead of finding
an operand, it finds an address where the operand is located.
NOTE:
Two memory accesses are required in order to obtain the value of the operand (fetch operand
address and fetch operand value).
Example: (textbook) ADD (A), R0
(address A is embedded in the instruction code and (A) is the operand address = pointer variable)
Example: SPIM - simulating pointers and indirect register addressing
The following "C" code:
could be translated into the following assembly code:
Example: SPIM/SAL - - array pointers and indirect register addressing
4) Absolute (Direct) Mode
The address of the operand is embedded in the instruction code.
Example: (SPIM)
5) Register Mode
The name (the number) of the CPU register is embedded in the instruction. The register contains
the value of the operand. The number of bits used to specify the register depends on the total
number of registers from the processor set.
Example (SPIM)
No memory access is required for the operand specified in register mode.
6) Displacement Mode
Similar to index mode, except instead of a index register a base register will be used. Base
register contains a pointer to a memory location. An integer (constant) is also referred to as a
displacement. The address of the operand is obtained by adding the contents of the base register
plus the constant. The difference between index mode and displacement mode is in the number
of bits used to represent the constant. When the constant is represented a number of bits to access
the memory, then we have index mode. Index mode is more appropriate for array accessing;
displacement mode is more appropriate for structure (records) accessing.
Example: SPIM/SAL - Accessing fields in structures

More Related Content

Similar to Describe the three main addressing modes of the PIC16 architecture di.pdf

Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386PDFSHARE
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxTushar Singhal
 
Memory Access Instructions
Memory Access InstructionsMemory Access Instructions
Memory Access InstructionsSharif Ullah
 
Compreport
CompreportCompreport
Compreportxdarlord
 
Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Ismail Mukiibi
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction setStefan Oprea
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formatsMazin Alwaaly
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts IIISHREEHARI WADAWADAGI
 
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjmicro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjTadeseBeyene
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)Alveena Saleem
 
Module 1-ppt System programming
Module 1-ppt System programmingModule 1-ppt System programming
Module 1-ppt System programmingvishnu sankar
 
address5ng modes.pptx IS A GOOD MATERIAL
address5ng  modes.pptx IS A GOOD MATERIALaddress5ng  modes.pptx IS A GOOD MATERIAL
address5ng modes.pptx IS A GOOD MATERIALDrkoteswararaoseelam
 
8051 Programming (1).pptx
8051 Programming (1).pptx8051 Programming (1).pptx
8051 Programming (1).pptxDhyeayaParmar
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxSabaNaeem26
 

Similar to Describe the three main addressing modes of the PIC16 architecture di.pdf (20)

Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptx
 
Memory Access Instructions
Memory Access InstructionsMemory Access Instructions
Memory Access Instructions
 
Compreport
CompreportCompreport
Compreport
 
Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Address
AddressAddress
Address
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts III
 
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjjmicro chapter 3jjgffffyeyhhuyerfftfgggffgjj
micro chapter 3jjgffffyeyhhuyerfftfgggffgjj
 
ADDRESSING MODES.pptx
ADDRESSING MODES.pptxADDRESSING MODES.pptx
ADDRESSING MODES.pptx
 
Co&al lecture-05
Co&al lecture-05Co&al lecture-05
Co&al lecture-05
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Module 1-ppt System programming
Module 1-ppt System programmingModule 1-ppt System programming
Module 1-ppt System programming
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
address5ng modes.pptx IS A GOOD MATERIAL
address5ng  modes.pptx IS A GOOD MATERIALaddress5ng  modes.pptx IS A GOOD MATERIAL
address5ng modes.pptx IS A GOOD MATERIAL
 
8051 Programming (1).pptx
8051 Programming (1).pptx8051 Programming (1).pptx
8051 Programming (1).pptx
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptx
 
Instruction-Sets-2.pptx
Instruction-Sets-2.pptxInstruction-Sets-2.pptx
Instruction-Sets-2.pptx
 

More from SALES97

Blossom Corporation had 120,000 common shares outstanding on Decembe.pdf
Blossom Corporation had 120,000 common shares outstanding on Decembe.pdfBlossom Corporation had 120,000 common shares outstanding on Decembe.pdf
Blossom Corporation had 120,000 common shares outstanding on Decembe.pdfSALES97
 
A system experiences a phase change from liquid to solid. Is this exo.pdf
A system experiences a phase change from liquid to solid. Is this exo.pdfA system experiences a phase change from liquid to solid. Is this exo.pdf
A system experiences a phase change from liquid to solid. Is this exo.pdfSALES97
 
Write an equation of a tangent function with the following characters.pdf
Write an equation of a tangent function with the following characters.pdfWrite an equation of a tangent function with the following characters.pdf
Write an equation of a tangent function with the following characters.pdfSALES97
 
Why is a mixture of alcohol and water used, rather than simply water.pdf
Why is a mixture of alcohol and water used, rather than simply water.pdfWhy is a mixture of alcohol and water used, rather than simply water.pdf
Why is a mixture of alcohol and water used, rather than simply water.pdfSALES97
 
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdf
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdfWhy are the 1960s relatively turbulentSolutionAnswer1960s .pdf
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdfSALES97
 
When acting as a neurotransmitter NO binds to the iron atom in vario.pdf
When acting as a neurotransmitter NO binds to the iron atom in vario.pdfWhen acting as a neurotransmitter NO binds to the iron atom in vario.pdf
When acting as a neurotransmitter NO binds to the iron atom in vario.pdfSALES97
 
Which of the following are reasons that Drosophila are an ideal exper.pdf
Which of the following are reasons that Drosophila are an ideal exper.pdfWhich of the following are reasons that Drosophila are an ideal exper.pdf
Which of the following are reasons that Drosophila are an ideal exper.pdfSALES97
 
What Michael acceptor is needed for the conjugate addition Beta - .pdf
What Michael acceptor is needed for the conjugate addition  Beta - .pdfWhat Michael acceptor is needed for the conjugate addition  Beta - .pdf
What Michael acceptor is needed for the conjugate addition Beta - .pdfSALES97
 
What is the role of intuition in decision-makingSolutionIntui.pdf
What is the role of intuition in decision-makingSolutionIntui.pdfWhat is the role of intuition in decision-makingSolutionIntui.pdf
What is the role of intuition in decision-makingSolutionIntui.pdfSALES97
 
What is the difference between a HTML element’s id attribute and nam.pdf
What is the difference between a HTML element’s id attribute and nam.pdfWhat is the difference between a HTML element’s id attribute and nam.pdf
What is the difference between a HTML element’s id attribute and nam.pdfSALES97
 
What happens when youre Running Scripts without a console in Linux.pdf
What happens when youre Running Scripts without a console in Linux.pdfWhat happens when youre Running Scripts without a console in Linux.pdf
What happens when youre Running Scripts without a console in Linux.pdfSALES97
 
TrueFalse A virtual private network is a way to use the Internet to.pdf
TrueFalse  A virtual private network is a way to use the Internet to.pdfTrueFalse  A virtual private network is a way to use the Internet to.pdf
TrueFalse A virtual private network is a way to use the Internet to.pdfSALES97
 
The total physical units accounted for is the sum of the units co.pdf
The total physical units accounted for is the sum of the units co.pdfThe total physical units accounted for is the sum of the units co.pdf
The total physical units accounted for is the sum of the units co.pdfSALES97
 
The problem can be found below. I would like someone to run this. I .pdf
The problem can be found below. I would like someone to run this. I .pdfThe problem can be found below. I would like someone to run this. I .pdf
The problem can be found below. I would like someone to run this. I .pdfSALES97
 
The probability that a teacher will give an unannounced test duri.pdf
The probability that a teacher will give an unannounced test duri.pdfThe probability that a teacher will give an unannounced test duri.pdf
The probability that a teacher will give an unannounced test duri.pdfSALES97
 
The Orlando MedicalOrlando Medical Corporation financial statements.pdf
The Orlando MedicalOrlando Medical Corporation financial statements.pdfThe Orlando MedicalOrlando Medical Corporation financial statements.pdf
The Orlando MedicalOrlando Medical Corporation financial statements.pdfSALES97
 
The IP network is a virtual network and must rely on a link layer ne.pdf
The IP network is a virtual network and must rely on a link layer ne.pdfThe IP network is a virtual network and must rely on a link layer ne.pdf
The IP network is a virtual network and must rely on a link layer ne.pdfSALES97
 
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdf
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdfTable 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdf
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdfSALES97
 
State if you agree or disagree with the statement made and whyLes.pdf
State if you agree or disagree with the statement made and whyLes.pdfState if you agree or disagree with the statement made and whyLes.pdf
State if you agree or disagree with the statement made and whyLes.pdfSALES97
 
subject.....project management.Tools and Processes Based on the pr.pdf
subject.....project management.Tools and Processes Based on the pr.pdfsubject.....project management.Tools and Processes Based on the pr.pdf
subject.....project management.Tools and Processes Based on the pr.pdfSALES97
 

More from SALES97 (20)

Blossom Corporation had 120,000 common shares outstanding on Decembe.pdf
Blossom Corporation had 120,000 common shares outstanding on Decembe.pdfBlossom Corporation had 120,000 common shares outstanding on Decembe.pdf
Blossom Corporation had 120,000 common shares outstanding on Decembe.pdf
 
A system experiences a phase change from liquid to solid. Is this exo.pdf
A system experiences a phase change from liquid to solid. Is this exo.pdfA system experiences a phase change from liquid to solid. Is this exo.pdf
A system experiences a phase change from liquid to solid. Is this exo.pdf
 
Write an equation of a tangent function with the following characters.pdf
Write an equation of a tangent function with the following characters.pdfWrite an equation of a tangent function with the following characters.pdf
Write an equation of a tangent function with the following characters.pdf
 
Why is a mixture of alcohol and water used, rather than simply water.pdf
Why is a mixture of alcohol and water used, rather than simply water.pdfWhy is a mixture of alcohol and water used, rather than simply water.pdf
Why is a mixture of alcohol and water used, rather than simply water.pdf
 
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdf
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdfWhy are the 1960s relatively turbulentSolutionAnswer1960s .pdf
Why are the 1960s relatively turbulentSolutionAnswer1960s .pdf
 
When acting as a neurotransmitter NO binds to the iron atom in vario.pdf
When acting as a neurotransmitter NO binds to the iron atom in vario.pdfWhen acting as a neurotransmitter NO binds to the iron atom in vario.pdf
When acting as a neurotransmitter NO binds to the iron atom in vario.pdf
 
Which of the following are reasons that Drosophila are an ideal exper.pdf
Which of the following are reasons that Drosophila are an ideal exper.pdfWhich of the following are reasons that Drosophila are an ideal exper.pdf
Which of the following are reasons that Drosophila are an ideal exper.pdf
 
What Michael acceptor is needed for the conjugate addition Beta - .pdf
What Michael acceptor is needed for the conjugate addition  Beta - .pdfWhat Michael acceptor is needed for the conjugate addition  Beta - .pdf
What Michael acceptor is needed for the conjugate addition Beta - .pdf
 
What is the role of intuition in decision-makingSolutionIntui.pdf
What is the role of intuition in decision-makingSolutionIntui.pdfWhat is the role of intuition in decision-makingSolutionIntui.pdf
What is the role of intuition in decision-makingSolutionIntui.pdf
 
What is the difference between a HTML element’s id attribute and nam.pdf
What is the difference between a HTML element’s id attribute and nam.pdfWhat is the difference between a HTML element’s id attribute and nam.pdf
What is the difference between a HTML element’s id attribute and nam.pdf
 
What happens when youre Running Scripts without a console in Linux.pdf
What happens when youre Running Scripts without a console in Linux.pdfWhat happens when youre Running Scripts without a console in Linux.pdf
What happens when youre Running Scripts without a console in Linux.pdf
 
TrueFalse A virtual private network is a way to use the Internet to.pdf
TrueFalse  A virtual private network is a way to use the Internet to.pdfTrueFalse  A virtual private network is a way to use the Internet to.pdf
TrueFalse A virtual private network is a way to use the Internet to.pdf
 
The total physical units accounted for is the sum of the units co.pdf
The total physical units accounted for is the sum of the units co.pdfThe total physical units accounted for is the sum of the units co.pdf
The total physical units accounted for is the sum of the units co.pdf
 
The problem can be found below. I would like someone to run this. I .pdf
The problem can be found below. I would like someone to run this. I .pdfThe problem can be found below. I would like someone to run this. I .pdf
The problem can be found below. I would like someone to run this. I .pdf
 
The probability that a teacher will give an unannounced test duri.pdf
The probability that a teacher will give an unannounced test duri.pdfThe probability that a teacher will give an unannounced test duri.pdf
The probability that a teacher will give an unannounced test duri.pdf
 
The Orlando MedicalOrlando Medical Corporation financial statements.pdf
The Orlando MedicalOrlando Medical Corporation financial statements.pdfThe Orlando MedicalOrlando Medical Corporation financial statements.pdf
The Orlando MedicalOrlando Medical Corporation financial statements.pdf
 
The IP network is a virtual network and must rely on a link layer ne.pdf
The IP network is a virtual network and must rely on a link layer ne.pdfThe IP network is a virtual network and must rely on a link layer ne.pdf
The IP network is a virtual network and must rely on a link layer ne.pdf
 
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdf
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdfTable 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdf
Table 1 Endowment of Labor and Capital US 100 20 Canada 10 Workers Ma.pdf
 
State if you agree or disagree with the statement made and whyLes.pdf
State if you agree or disagree with the statement made and whyLes.pdfState if you agree or disagree with the statement made and whyLes.pdf
State if you agree or disagree with the statement made and whyLes.pdf
 
subject.....project management.Tools and Processes Based on the pr.pdf
subject.....project management.Tools and Processes Based on the pr.pdfsubject.....project management.Tools and Processes Based on the pr.pdf
subject.....project management.Tools and Processes Based on the pr.pdf
 

Recently uploaded

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

Describe the three main addressing modes of the PIC16 architecture di.pdf

  • 1. Describe the three main addressing modes of the PIC16 architecture discussed in class. For each of the modes include two examples. Write a PIC16 assembly program which will accomplish the following instruction. I just want the section of assembly code which accomplishes this. Make VAR1 =0x22. VAR1 = 0x42 + (0xF0 AND 0xAA) - (0x12 OR 0x34) Perform the above calculation by hand, showing all your work in binary. Solution 2 ans ) The term addressing modes refers to the way in which the operand of an instruction is specified. Information contained in the instruction code is the value of the operand or the address of the result/operand. Following are the main addressing modes that are used on various platforms and architectures. 1) Immediate Mode The operand is an immediate value is stored explicitly in the instruction: Example: SPIM ( opcode dest, source) li $11, 3 // loads the immediate value of 3 into register $11 li $9, 8 // loads the immediate value of 8 into register $9 Example : (textbook uses instructions type like, opcode source, dest) move #200, R0; // move immediate value 200 in register R0 2) Index Mode The address of the operand is obtained by adding to the contents of the general register (called index register) a constant value. The number of the index register and the constant value are included in the instruction code. Index Mode is used to access an array whose elements are in successive memory locations. The content of the instruction code, represents the starting address of the array and the value of the index register, and the index value of the current element. By incrementing or decrementing index register different element of the array can be accessed. Example: SPIM/SAL - Accessing Arrays 3) Indirect Mode The effective address of the operand is the contents of a register or main memory location, location whose address appears in the instruction. Indirection is noted by placing the name of the register or the memory address given in the instruction in parentheses. The register or memory location that contains the address of the operand is a pointer. When an execution takes place in such mode, instruction may be told to go to a specific address. Once it's there, instead of finding
  • 2. an operand, it finds an address where the operand is located. NOTE: Two memory accesses are required in order to obtain the value of the operand (fetch operand address and fetch operand value). Example: (textbook) ADD (A), R0 (address A is embedded in the instruction code and (A) is the operand address = pointer variable) Example: SPIM - simulating pointers and indirect register addressing The following "C" code: could be translated into the following assembly code: Example: SPIM/SAL - - array pointers and indirect register addressing 4) Absolute (Direct) Mode The address of the operand is embedded in the instruction code. Example: (SPIM) 5) Register Mode The name (the number) of the CPU register is embedded in the instruction. The register contains the value of the operand. The number of bits used to specify the register depends on the total number of registers from the processor set. Example (SPIM) No memory access is required for the operand specified in register mode. 6) Displacement Mode Similar to index mode, except instead of a index register a base register will be used. Base register contains a pointer to a memory location. An integer (constant) is also referred to as a displacement. The address of the operand is obtained by adding the contents of the base register plus the constant. The difference between index mode and displacement mode is in the number of bits used to represent the constant. When the constant is represented a number of bits to access the memory, then we have index mode. Index mode is more appropriate for array accessing; displacement mode is more appropriate for structure (records) accessing. Example: SPIM/SAL - Accessing fields in structures