Question
Write an 8086 assembly program using the windows32 or windows64 framework, write a program that will find the sum of even numbers from 20 to
Write an 8086 assembly program using the windows32 or windows64 framework, write a program that will find the sum of even numbers from 20 to 0 then display the result with appropriate message to the user.
***(Add comments and keep the code very well organized)*** Have nothing, need help with whole thing. Please help!
Would like you to write the code out organized similar to the code added to the bottom of the question.
Also need to have an image of the ouput to show that it actually worked and isnt just random code written out.
.586
.MODEL FLAT
INCLUDE io.h
.STACK 4096
.DATA
prompt BYTE "Enter a number:", 0
string BYTE 40 DUP (?)
resultLbl BYTE "Your number is:", 0
positiveLbl BYTE "Positive", 0
negativeLbl BYTE "Negative", 0
.CODE
_MainProc PROC
mov ecx, 10 ; the for loop will run 10 times (change to a lower # for testing purposes)
forCount: input prompt, string, 40 ; prompt user for a number
atod string ; convert to integer
cdq ; extend the sign of EAX to EDX (getting ready to divide EDX:EAX)
mov ebx, 2
idiv ebx ; divide by 2 and check the remainder (stored in EDX) to see if the number is odd or even
cmp edx, 0 ; compare the remainder with 0
jne negative ; if the remainder is not 0, the number is odd
; else the number has to be even
positive: output resultLbl, positiveLbl ; output the even message
jmp exit
negative: output resultLbl, negativeLbl ; output the odd message
jmp exit
exit:
loop forCount ; go to the next iteration of the for loop
_MainProc ENDP
END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started