SlideShare a Scribd company logo
1 of 4
Download to read offline
M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n) =
Fib(n-1) + Fib(n-2). The program calculates Fib(7).
I have 4 errors in my code and cannot seem to find the solutions
here is the code so far,
ORG 100
Input
Store x
Input
Store y
FOR_INIT, LOAD one
STORE i
FOR_COND, LOAD i
SUBT seven
SKIPCOND 800
JUMP FOR_BODY
JUMP END_FOR
FOR_BODY, LOAD x
ADD y
STORE z
LOAD x
STORE y
LOAD y
STORE x
LOAD i
ADD one
STORE i
JUMP FOR_COND
END_FOR, LOAD z
OUTPUT
HALT
zero, Dec 0
one, Dec 1
seven, Dec 7
x, Dec 0
y, Dec 1
z, Dec 0
Solution
Answer:
MIPS Assembly Language Code :
.zero 1
L0:
push rbp
mov rbp, rsp
push rbx
sub rsp, 24
mov DWORD PTR [rbp-20], edi
cmp DWORD PTR [rbp-20], 1
je .L2
cmp DWORD PTR [rbp-20], 2
jne .L3
.L2:
mov eax, 1
jmp .L4
.L3:
mov eax, DWORD PTR [rbp-20]
sub eax, 1
mov edi, eax
call L0
mov ebx, eax
mov eax, DWORD PTR [rbp-20]
sub eax, 2
mov edi, eax
call L0
add eax, ebx
.L4:
add rsp, 24
pop rbx
pop rbp
ret
main:
push rbp
mov rbp, rsp
mov edi, 7
call L0
mov esi, eax
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >::operator<<(int)
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov rdi, rax
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov eax, 0
pop rbp
ret
__static_initialization_and_destruction_0(int, int):
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
cmp DWORD PTR [rbp-4], 1
jne .L9
cmp DWORD PTR [rbp-8], 65535
jne .L9
mov edi, OFFSET FLAT:std::__ioinit
call std::ios_base::Init::Init()
mov edx, OFFSET FLAT:__dso_handle
mov esi, OFFSET FLAT:std::__ioinit
mov edi, OFFSET FLAT:std::ios_base::Init::~Init()
call __cxa_atexit
.L9:
nop
leave
ret
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret

More Related Content

Similar to M.A.R.I.E assembly code for 7th value of Fibonacci sequence Fib(1) .pdf

Debugging Python with Pdb!
Debugging Python with Pdb!Debugging Python with Pdb!
Debugging Python with Pdb!Noelle Daley
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEWshyamuopten
 
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]RootedCON
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comagathachristie281
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.comwilliamwordsworth40
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comWindyMiller12
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comkopiko85
 
GSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comGSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comthomashard64
 
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comGSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comRoelofMerwe102
 
GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com KeatonJennings102
 
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdf
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdfConvert the for loop Into MIPS Instructions. Use the sit instruction .pdf
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdfarpitcomputronics
 
Write ASSEMBLY code to implement the following Initialize PORTB for.docx
 Write ASSEMBLY code to implement the following  Initialize PORTB for.docx Write ASSEMBLY code to implement the following  Initialize PORTB for.docx
Write ASSEMBLY code to implement the following Initialize PORTB for.docxajoy21
 

Similar to M.A.R.I.E assembly code for 7th value of Fibonacci sequence Fib(1) .pdf (13)

Debugging Python with Pdb!
Debugging Python with Pdb!Debugging Python with Pdb!
Debugging Python with Pdb!
 
IOS debugging
IOS debuggingIOS debugging
IOS debugging
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
 
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.com
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.com
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.com
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.com
 
GSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comGSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.com
 
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comGSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
 
GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com
 
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdf
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdfConvert the for loop Into MIPS Instructions. Use the sit instruction .pdf
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdf
 
Write ASSEMBLY code to implement the following Initialize PORTB for.docx
 Write ASSEMBLY code to implement the following  Initialize PORTB for.docx Write ASSEMBLY code to implement the following  Initialize PORTB for.docx
Write ASSEMBLY code to implement the following Initialize PORTB for.docx
 

More from archanacomputers1

how do mutations in the DNA sequence affect this type of restric.pdf
how do mutations in the DNA sequence affect this type of restric.pdfhow do mutations in the DNA sequence affect this type of restric.pdf
how do mutations in the DNA sequence affect this type of restric.pdfarchanacomputers1
 
Fill out the following table, using examples were appropriate. S.pdf
Fill out the following table, using examples were appropriate.  S.pdfFill out the following table, using examples were appropriate.  S.pdf
Fill out the following table, using examples were appropriate. S.pdfarchanacomputers1
 
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdf
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdfExercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdf
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdfarchanacomputers1
 
Does human DNA possess operonsSolutionAnswerOperons (clust.pdf
Does human DNA possess operonsSolutionAnswerOperons (clust.pdfDoes human DNA possess operonsSolutionAnswerOperons (clust.pdf
Does human DNA possess operonsSolutionAnswerOperons (clust.pdfarchanacomputers1
 
Explain the relationship between population growth and social differ.pdf
Explain the relationship between population growth and social differ.pdfExplain the relationship between population growth and social differ.pdf
Explain the relationship between population growth and social differ.pdfarchanacomputers1
 
differentiate between Bergeyso Manual of systematic bacteriology a.pdf
differentiate between Bergeyso Manual of systematic bacteriology a.pdfdifferentiate between Bergeyso Manual of systematic bacteriology a.pdf
differentiate between Bergeyso Manual of systematic bacteriology a.pdfarchanacomputers1
 
Describe examples of variant histones and the chromosomal structures.pdf
Describe examples of variant histones and the chromosomal structures.pdfDescribe examples of variant histones and the chromosomal structures.pdf
Describe examples of variant histones and the chromosomal structures.pdfarchanacomputers1
 
Create a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfCreate a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfarchanacomputers1
 
Darwin believed that women were less evolved than men, and because o.pdf
Darwin believed that women were less evolved than men, and because o.pdfDarwin believed that women were less evolved than men, and because o.pdf
Darwin believed that women were less evolved than men, and because o.pdfarchanacomputers1
 
a) become more similar to one another. b) become more different th.pdf
a) become more similar to one another. b) become more different th.pdfa) become more similar to one another. b) become more different th.pdf
a) become more similar to one another. b) become more different th.pdfarchanacomputers1
 
Why are the shape and slope of a dose-response curve importantS.pdf
Why are the shape and slope of a dose-response curve importantS.pdfWhy are the shape and slope of a dose-response curve importantS.pdf
Why are the shape and slope of a dose-response curve importantS.pdfarchanacomputers1
 
When streaking a plate, the idea is to dilute the bacteria sufficie.pdf
When streaking a plate, the idea is to dilute the bacteria sufficie.pdfWhen streaking a plate, the idea is to dilute the bacteria sufficie.pdf
When streaking a plate, the idea is to dilute the bacteria sufficie.pdfarchanacomputers1
 
Why is it bad for a group to be polyphyleticWhat type of traits c.pdf
Why is it bad for a group to be polyphyleticWhat type of traits c.pdfWhy is it bad for a group to be polyphyleticWhat type of traits c.pdf
Why is it bad for a group to be polyphyleticWhat type of traits c.pdfarchanacomputers1
 
When recruiting a sample of individuals to participate in a study on.pdf
When recruiting a sample of individuals to participate in a study on.pdfWhen recruiting a sample of individuals to participate in a study on.pdf
When recruiting a sample of individuals to participate in a study on.pdfarchanacomputers1
 
Where does the Calvin cycle take place stroma of the chloroplast t.pdf
Where does the Calvin cycle take place  stroma of the chloroplast  t.pdfWhere does the Calvin cycle take place  stroma of the chloroplast  t.pdf
Where does the Calvin cycle take place stroma of the chloroplast t.pdfarchanacomputers1
 
What are the pros and cons of using the mode as your measure of cent.pdf
What are the pros and cons of using the mode as your measure of cent.pdfWhat are the pros and cons of using the mode as your measure of cent.pdf
What are the pros and cons of using the mode as your measure of cent.pdfarchanacomputers1
 
We presented a list of capabilities that should be provided by the DB.pdf
We presented a list of capabilities that should be provided by the DB.pdfWe presented a list of capabilities that should be provided by the DB.pdf
We presented a list of capabilities that should be provided by the DB.pdfarchanacomputers1
 
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdf
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdfTwo loudspeakers on elevated platforms are at opposite ends of a fie.pdf
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdfarchanacomputers1
 
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdf
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdfTube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdf
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdfarchanacomputers1
 
At 50°C, PCR primers are able to access target DNA before template s.pdf
At 50°C, PCR primers are able to access target DNA before template s.pdfAt 50°C, PCR primers are able to access target DNA before template s.pdf
At 50°C, PCR primers are able to access target DNA before template s.pdfarchanacomputers1
 

More from archanacomputers1 (20)

how do mutations in the DNA sequence affect this type of restric.pdf
how do mutations in the DNA sequence affect this type of restric.pdfhow do mutations in the DNA sequence affect this type of restric.pdf
how do mutations in the DNA sequence affect this type of restric.pdf
 
Fill out the following table, using examples were appropriate. S.pdf
Fill out the following table, using examples were appropriate.  S.pdfFill out the following table, using examples were appropriate.  S.pdf
Fill out the following table, using examples were appropriate. S.pdf
 
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdf
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdfExercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdf
Exercise 4-10Larkspur, Inc., opened an incorporated dental practic.pdf
 
Does human DNA possess operonsSolutionAnswerOperons (clust.pdf
Does human DNA possess operonsSolutionAnswerOperons (clust.pdfDoes human DNA possess operonsSolutionAnswerOperons (clust.pdf
Does human DNA possess operonsSolutionAnswerOperons (clust.pdf
 
Explain the relationship between population growth and social differ.pdf
Explain the relationship between population growth and social differ.pdfExplain the relationship between population growth and social differ.pdf
Explain the relationship between population growth and social differ.pdf
 
differentiate between Bergeyso Manual of systematic bacteriology a.pdf
differentiate between Bergeyso Manual of systematic bacteriology a.pdfdifferentiate between Bergeyso Manual of systematic bacteriology a.pdf
differentiate between Bergeyso Manual of systematic bacteriology a.pdf
 
Describe examples of variant histones and the chromosomal structures.pdf
Describe examples of variant histones and the chromosomal structures.pdfDescribe examples of variant histones and the chromosomal structures.pdf
Describe examples of variant histones and the chromosomal structures.pdf
 
Create a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdfCreate a system to simulate vehicles at an intersection. Assume th.pdf
Create a system to simulate vehicles at an intersection. Assume th.pdf
 
Darwin believed that women were less evolved than men, and because o.pdf
Darwin believed that women were less evolved than men, and because o.pdfDarwin believed that women were less evolved than men, and because o.pdf
Darwin believed that women were less evolved than men, and because o.pdf
 
a) become more similar to one another. b) become more different th.pdf
a) become more similar to one another. b) become more different th.pdfa) become more similar to one another. b) become more different th.pdf
a) become more similar to one another. b) become more different th.pdf
 
Why are the shape and slope of a dose-response curve importantS.pdf
Why are the shape and slope of a dose-response curve importantS.pdfWhy are the shape and slope of a dose-response curve importantS.pdf
Why are the shape and slope of a dose-response curve importantS.pdf
 
When streaking a plate, the idea is to dilute the bacteria sufficie.pdf
When streaking a plate, the idea is to dilute the bacteria sufficie.pdfWhen streaking a plate, the idea is to dilute the bacteria sufficie.pdf
When streaking a plate, the idea is to dilute the bacteria sufficie.pdf
 
Why is it bad for a group to be polyphyleticWhat type of traits c.pdf
Why is it bad for a group to be polyphyleticWhat type of traits c.pdfWhy is it bad for a group to be polyphyleticWhat type of traits c.pdf
Why is it bad for a group to be polyphyleticWhat type of traits c.pdf
 
When recruiting a sample of individuals to participate in a study on.pdf
When recruiting a sample of individuals to participate in a study on.pdfWhen recruiting a sample of individuals to participate in a study on.pdf
When recruiting a sample of individuals to participate in a study on.pdf
 
Where does the Calvin cycle take place stroma of the chloroplast t.pdf
Where does the Calvin cycle take place  stroma of the chloroplast  t.pdfWhere does the Calvin cycle take place  stroma of the chloroplast  t.pdf
Where does the Calvin cycle take place stroma of the chloroplast t.pdf
 
What are the pros and cons of using the mode as your measure of cent.pdf
What are the pros and cons of using the mode as your measure of cent.pdfWhat are the pros and cons of using the mode as your measure of cent.pdf
What are the pros and cons of using the mode as your measure of cent.pdf
 
We presented a list of capabilities that should be provided by the DB.pdf
We presented a list of capabilities that should be provided by the DB.pdfWe presented a list of capabilities that should be provided by the DB.pdf
We presented a list of capabilities that should be provided by the DB.pdf
 
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdf
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdfTwo loudspeakers on elevated platforms are at opposite ends of a fie.pdf
Two loudspeakers on elevated platforms are at opposite ends of a fie.pdf
 
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdf
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdfTube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdf
Tube and Contents Molality 1 10 g dl NaCl 2 36 gal Na B 0.8 gdl. Na .pdf
 
At 50°C, PCR primers are able to access target DNA before template s.pdf
At 50°C, PCR primers are able to access target DNA before template s.pdfAt 50°C, PCR primers are able to access target DNA before template s.pdf
At 50°C, PCR primers are able to access target DNA before template s.pdf
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 

Recently uploaded (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 

M.A.R.I.E assembly code for 7th value of Fibonacci sequence Fib(1) .pdf

  • 1. M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n-1) + Fib(n-2). The program calculates Fib(7). I have 4 errors in my code and cannot seem to find the solutions here is the code so far, ORG 100 Input Store x Input Store y FOR_INIT, LOAD one STORE i FOR_COND, LOAD i SUBT seven SKIPCOND 800 JUMP FOR_BODY JUMP END_FOR FOR_BODY, LOAD x ADD y STORE z LOAD x STORE y LOAD y STORE x LOAD i ADD one STORE i JUMP FOR_COND END_FOR, LOAD z OUTPUT HALT zero, Dec 0 one, Dec 1 seven, Dec 7 x, Dec 0 y, Dec 1
  • 2. z, Dec 0 Solution Answer: MIPS Assembly Language Code : .zero 1 L0: push rbp mov rbp, rsp push rbx sub rsp, 24 mov DWORD PTR [rbp-20], edi cmp DWORD PTR [rbp-20], 1 je .L2 cmp DWORD PTR [rbp-20], 2 jne .L3 .L2: mov eax, 1 jmp .L4 .L3: mov eax, DWORD PTR [rbp-20] sub eax, 1 mov edi, eax call L0 mov ebx, eax mov eax, DWORD PTR [rbp-20] sub eax, 2 mov edi, eax call L0 add eax, ebx .L4: add rsp, 24 pop rbx pop rbp ret
  • 3. main: push rbp mov rbp, rsp mov edi, 7 call L0 mov esi, eax mov edi, OFFSET FLAT:std::cout call std::basic_ostream >::operator<<(int) mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov rdi, rax call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov eax, 0 pop rbp ret __static_initialization_and_destruction_0(int, int): push rbp mov rbp, rsp sub rsp, 16 mov DWORD PTR [rbp-4], edi mov DWORD PTR [rbp-8], esi cmp DWORD PTR [rbp-4], 1 jne .L9 cmp DWORD PTR [rbp-8], 65535 jne .L9 mov edi, OFFSET FLAT:std::__ioinit call std::ios_base::Init::Init() mov edx, OFFSET FLAT:__dso_handle mov esi, OFFSET FLAT:std::__ioinit mov edi, OFFSET FLAT:std::ios_base::Init::~Init() call __cxa_atexit .L9: nop leave ret push rbp mov rbp, rsp
  • 4. mov esi, 65535 mov edi, 1 call __static_initialization_and_destruction_0(int, int) pop rbp ret