Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pep8 only USING PEP 8- PEP8 can be downloaded from : http://computersystemsbook.

ID: 3865800 • Letter: P

Question

Pep8 only

USING PEP 8- PEP8 can be downloaded from : http://computersystemsbook.com/4th-edition/pep8/

Create a program named switch.pep and write an assembly language program to simulate execution of a C++ switch statement. On startup the program will ask for a input value from 0 to 4 ( 1 variable ).

The switch will select a case from 0 to 4 and have a default case. Assume each case has a break at the end.Inside each switch case print the message "-input value- inside the switch matches -case value-". In the default case print the input value and a message that is not 0 to 4.After the switch completes print the message "switch done".

You will, of course, insert the proper values for -input value- and -switch value- and not print those exact words.

Be sure to lay out the logic (or flow) of the assembly program to match a switch statement and use comments through out the code. In other words, clearly label in the code where each portion of the switch starts and ends (this is an example, you should comment more):

Explanation / Answer

movl $5, -4(%ebp) cmpl $10, -4(%ebp) ja L13 movl -4(%ebp), %eax sall $2, %eax movl L14(%eax), %eax jmp *%eax .section .rdata,"dr" .align 4 L14: .long L13 .long L3 .long L4 .long L5 .long L6 .long L7 .long L8 .long L9 .long L10 .long L11 .long L12 .text L3: movl $LC0, (%esp) call _printf jmp L2 L4: movl $LC1, (%esp) call _printf jmp L2 L5: movl $LC2, (%esp) call _printf jmp L2 L6: movl $LC3, (%esp) call _printf jmp L2 L7: movl $LC4, (%esp) call _printf jmp L2 L8: movl $LC5, (%esp) call _printf jmp L2 L9: movl $LC6, (%esp) call _printf jmp L2 L10: movl $LC7, (%esp) call _printf jmp L2 L11: movl $LC8, (%esp) call _printf jmp L2 L12: movl $LC9, (%esp) call _printf jmp L2 L13: movl $LC10, (%esp) call _printf L2:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote