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

Make sure to write INTEL x86 assembly language code program. Not pseudocode or a

ID: 3732606 • Letter: M

Question

Make sure to write INTEL x86 assembly language code program.

Not pseudocode or a list of steps on how to do this. Actual code only!

Assignment #7 The area of a rectangle is the rectangle's length times its width. Using the windows32 or windows64 framework, write an assembly program that asks for the length and width of two rectangles. The program should then tell the user which rectangle has the greater area or if the areas are the same Note: you need to include the source code and the output of the assignment.

Explanation / Answer

CODE:

.LC0:

.string " Enter the Length1 of Rectangle : "

.LC1:

.string "%d"

.LC2:

.string " Enter the Breadth1 of Rectangle : "

.LC3:

.string " Area of Rectangle : %d"

.LC4:

.string " Enter the Length2 of Rectangle : "

.LC5:

.string "both are equal:"

.LC6:

.string "greater area of the two number is %d"

main:

push rbp

mov rbp, rsp

sub rsp, 32

mov edi, OFFSET FLAT:.LC0

mov eax, 0

call printf

lea rax, [rbp-16]

mov rsi, rax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call __isoc99_scanf

mov edi, OFFSET FLAT:.LC2

mov eax, 0

call printf

lea rax, [rbp-20]

mov rsi, rax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call __isoc99_scanf

mov edx, DWORD PTR [rbp-16]

mov eax, DWORD PTR [rbp-20]

imul eax, edx

mov DWORD PTR [rbp-4], eax

mov eax, DWORD PTR [rbp-4]

mov esi, eax

mov edi, OFFSET FLAT:.LC3

mov eax, 0

call printf

mov edi, OFFSET FLAT:.LC4

mov eax, 0

call printf

lea rax, [rbp-24]

mov rsi, rax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call __isoc99_scanf

mov edi, OFFSET FLAT:.LC2

mov eax, 0

call printf

lea rax, [rbp-28]

mov rsi, rax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call __isoc99_scanf

mov edx, DWORD PTR [rbp-24]

mov eax, DWORD PTR [rbp-28]

imul eax, edx

mov DWORD PTR [rbp-8], eax

mov eax, DWORD PTR [rbp-8]

mov esi, eax

mov edi, OFFSET FLAT:.LC3

mov eax, 0

call printf

mov eax, DWORD PTR [rbp-4]

cmp eax, DWORD PTR [rbp-8]

jne .L2

mov edi, OFFSET FLAT:.LC5

mov eax, 0

call printf

jmp .L3

.L2:

mov eax, DWORD PTR [rbp-4]

cmp eax, DWORD PTR [rbp-8]

jle .L4

mov eax, DWORD PTR [rbp-4]

mov DWORD PTR [rbp-12], eax

mov eax, DWORD PTR [rbp-12]

mov esi, eax

mov edi, OFFSET FLAT:.LC6

mov eax, 0

call printf

jmp .L3

.L4:

mov eax, DWORD PTR [rbp-8]

mov DWORD PTR [rbp-12], eax

mov eax, DWORD PTR [rbp-12]

mov esi, eax

mov edi, OFFSET FLAT:.LC6

mov eax, 0

call printf

.L3:

mov eax, 0

leave

ret

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