Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints
out their sum in the form: Total = Submit: Pep/8 formatted program in a text file
Solution
Answer:
Assembly Language Program :
.zero 1
.LC0:
.string "Enter two integers: "
.LC1:
.string "Total"
.LC2:
.string " = "
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov esi, OFFSET FLAT:.LC0
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rax, [rbp-8]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
mov rdx, rax
lea rax, [rbp-12]
mov rsi, rax
mov rdi, rdx
call std::basic_istream >::operator>>(int&)
mov edx, DWORD PTR [rbp-8]
mov eax, DWORD PTR [rbp-12]
add eax, edx
mov DWORD PTR [rbp-4], eax
mov esi, OFFSET FLAT:.LC1
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, OFFSET FLAT:.LC2
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov rdx, rax
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov rdi, rdx
call std::basic_ostream >::operator<<(int)
mov eax, 0
leave
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 .L5
cmp DWORD PTR [rbp-8], 65535
jne .L5
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
.L5:
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

PDF
computer architecture Lecture 8 for computer science
PDF
Microprocessor 8086-lab-mannual
PDF
N_Asm Assembly numbers (sol)
PPT
PPT
8051assembly language
PPTX
[ASM]Lab6
PPTX
Uc 2(vii)
computer architecture Lecture 8 for computer science
Microprocessor 8086-lab-mannual
N_Asm Assembly numbers (sol)
8051assembly language
[ASM]Lab6
Uc 2(vii)

Similar to Write a Pep8 Assembly program that reads in and stores two integers .pdf (20)

PDF
DEF CON 23 - CHRIS DOMAS - REpsych
DOCX
HW2.pdfCSEEEE 230 Computer Organization and Assembly La.docx
DOCX
Instruction set of 8086 Microprocessor
PDF
N_Asm Assembly arithmetic instructions (sol)
PPT
Chapter Eight(3)
PPTX
PPTX
It322 intro 3
PDF
Topic 6 - Programming in Assembly Language_230517_115118.pdf
PDF
Mp lab manual
PPT
Assem -lect-6
PPTX
Coal (1)
PPTX
Arrays, Strings & Loops in assembly Language.pptx
PPSX
Assembly language programming
PPTX
How the stack works(1)
PPT
8085 instruction set and Programming
PDF
Lenguaje ensamblador EMU8086
PPTX
Programming basic computer
PDF
PDF
Lecture5(1)
DEF CON 23 - CHRIS DOMAS - REpsych
HW2.pdfCSEEEE 230 Computer Organization and Assembly La.docx
Instruction set of 8086 Microprocessor
N_Asm Assembly arithmetic instructions (sol)
Chapter Eight(3)
It322 intro 3
Topic 6 - Programming in Assembly Language_230517_115118.pdf
Mp lab manual
Assem -lect-6
Coal (1)
Arrays, Strings & Loops in assembly Language.pptx
Assembly language programming
How the stack works(1)
8085 instruction set and Programming
Lenguaje ensamblador EMU8086
Programming basic computer
Lecture5(1)
Ad

More from rushabhshah600 (20)

PDF
Give an expression for the pattern inventory of 2-colorings of the ed.pdf
PDF
For the 4 arguments below, proceed as followsBREAK DOWN THE ARGU.pdf
PDF
External respiration includes all of these processes EXCEPT _____. r.pdf
PDF
art F You decide to cross the reciprocal translocation strain to a pu.pdf
PDF
Ecosystem ecologyWhy are rain forests wet and deserts dry Compare.pdf
PDF
b) Analyze your network IP packets headers and contents.Solu.pdf
PDF
A type A man is the son of a type O father and type A mother. If he .pdf
PDF
A One-Way Analysis of Variance is a way to test the equality of thre.pdf
PDF
5 000-0 SolutionEquity multiplier = Total Assets Equityor, .pdf
PDF
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
PDF
4 (4 points). How would you describe the difference in cell structur.pdf
PDF
Distinguish between cell fate and cell commitment. How can one assay.pdf
PDF
Differentiate the processes of oogenesis and spermatogenesis. Are th.pdf
PDF
Define induction and give an example of deductive reasoningSolu.pdf
PDF
A report says that the between-subjects factor of participants sal.pdf
PDF
City GUIWrite a Java GUI program which reads data about US cities..pdf
PDF
What is the role of sulfur chemoautotrophs in the sulfur cycle Deco.pdf
PDF
What is the PDU at Layer 4 calledA. DataB. SegmentC. Packet.pdf
PDF
Briefly describe the contributions to the quality movement made by e.pdf
PDF
Background Angiosperms (flowering plants) are the largest Phylum in .pdf
Give an expression for the pattern inventory of 2-colorings of the ed.pdf
For the 4 arguments below, proceed as followsBREAK DOWN THE ARGU.pdf
External respiration includes all of these processes EXCEPT _____. r.pdf
art F You decide to cross the reciprocal translocation strain to a pu.pdf
Ecosystem ecologyWhy are rain forests wet and deserts dry Compare.pdf
b) Analyze your network IP packets headers and contents.Solu.pdf
A type A man is the son of a type O father and type A mother. If he .pdf
A One-Way Analysis of Variance is a way to test the equality of thre.pdf
5 000-0 SolutionEquity multiplier = Total Assets Equityor, .pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
4 (4 points). How would you describe the difference in cell structur.pdf
Distinguish between cell fate and cell commitment. How can one assay.pdf
Differentiate the processes of oogenesis and spermatogenesis. Are th.pdf
Define induction and give an example of deductive reasoningSolu.pdf
A report says that the between-subjects factor of participants sal.pdf
City GUIWrite a Java GUI program which reads data about US cities..pdf
What is the role of sulfur chemoautotrophs in the sulfur cycle Deco.pdf
What is the PDU at Layer 4 calledA. DataB. SegmentC. Packet.pdf
Briefly describe the contributions to the quality movement made by e.pdf
Background Angiosperms (flowering plants) are the largest Phylum in .pdf
Ad

Recently uploaded (20)

PDF
semiconductor packaging in vlsi design fab
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
Empowerment Technology for Senior High School Guide
PDF
advance database management system book.pdf
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Education and Perspectives of Education.pptx
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PDF
Complications of Minimal Access-Surgery.pdf
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PPTX
Computer Architecture Input Output Memory.pptx
semiconductor packaging in vlsi design fab
Unit 4 Computer Architecture Multicore Processor.pptx
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Journal of Dental Science - UDMY (2021).pdf
Environmental Education MCQ BD2EE - Share Source.pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
Empowerment Technology for Senior High School Guide
advance database management system book.pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
Cambridge-Practice-Tests-for-IELTS-12.docx
Education and Perspectives of Education.pptx
B.Sc. DS Unit 2 Software Engineering.pptx
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Share_Module_2_Power_conflict_and_negotiation.pptx
Complications of Minimal Access-Surgery.pdf
Race Reva University – Shaping Future Leaders in Artificial Intelligence
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
Computer Architecture Input Output Memory.pptx

Write a Pep8 Assembly program that reads in and stores two integers .pdf

  • 1. Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints out their sum in the form: Total = Submit: Pep/8 formatted program in a text file Solution Answer: Assembly Language Program : .zero 1 .LC0: .string "Enter two integers: " .LC1: .string "Total" .LC2: .string " = " main: push rbp mov rbp, rsp sub rsp, 16 mov esi, OFFSET FLAT:.LC0 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rax, [rbp-8] mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) mov rdx, rax lea rax, [rbp-12] mov rsi, rax mov rdi, rdx call std::basic_istream >::operator>>(int&) mov edx, DWORD PTR [rbp-8] mov eax, DWORD PTR [rbp-12] add eax, edx mov DWORD PTR [rbp-4], eax mov esi, OFFSET FLAT:.LC1 mov edi, OFFSET FLAT:std::cout
  • 2. call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, OFFSET FLAT:.LC2 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov rdx, rax mov eax, DWORD PTR [rbp-4] mov esi, eax mov rdi, rdx call std::basic_ostream >::operator<<(int) mov eax, 0 leave 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 .L5 cmp DWORD PTR [rbp-8], 65535 jne .L5 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 .L5: nop leave ret push rbp mov rbp, rsp mov esi, 65535 mov edi, 1