Question

write an 8086 assembly program that 1) adds two operand. 2) that adds operands until the...

write an 8086 assembly program that 1) adds two operand. 2) that adds operands until the new value to be added is 0. 3) Write a program that increments by 2 the content of a register 10 times.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

8086 assembly program that

1) adds two operand.

main:

push rbp

mov rbp, rsp

mov DWORD PTR [rbp-4], 0

mov DWORD PTR [rbp-8], 6

mov DWORD PTR [rbp-12], 5

mov edx, DWORD PTR [rbp-8]

mov eax, DWORD PTR [rbp-12]

add eax, edx

mov DWORD PTR [rbp-4], eax

mov eax, 0

pop rbp

ret

2) that adds operands until the new value to be added is 0.

.LC0:

.string "%d"

main:

push rbp

mov rbp, rsp

sub rsp, 16

mov DWORD PTR [rbp-4], 0

mov DWORD PTR [rbp-8], 0

.L3:

lea rax, [rbp-8]

mov rsi, rax

mov edi, OFFSET FLAT:.LC0

mov eax, 0

call scanf

mov eax, DWORD PTR [rbp-8]

add DWORD PTR [rbp-4], eax

mov eax, DWORD PTR [rbp-8]

test eax, eax

je .L2

jmp .L3

.L2:

mov eax, 0

leave

ret

3) Write a program that increments by 2 the content of a register 10 times.

.LC0:

.string "Increment by 2 "

main:

push rbp

mov rbp, rsp

sub rsp, 16

mov DWORD PTR [rbp-8], 20

.L3:

cmp DWORD PTR [rbp-8], 0

je .L2

add DWORD PTR [rbp-4], 2

jmp .L3

.L2:

mov edi, OFFSET FLAT:.LC0

mov eax, 0

call printf

mov eax, 0

leave

ret

Add a comment
Know the answer?
Add Answer to:
write an 8086 assembly program that 1) adds two operand. 2) that adds operands until the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT