Write a Marie Assembly language program that takes integers at inputs and return
ID: 3682513 • Letter: W
Question
Write a Marie Assembly language program that takes integers at inputs and returns the sum of the negative numbers and the sum of the positive numbers. For example: the user should be prompted to enter numbers one at a time followed by hitting enter and then when they are done they should type '0' indicating that they are done entering values. The program should add up all the numbers that are > 0 and all the numbers that are < 0. for example, if the user inputs: 5,6,-1 the program should return positive sum = 11 negative sum = -1
Explanation / Answer
MOV AX, @DATA
MOV DS, AX
MOV CL, 05
XOR BL, BL
XOR DL, DL
LEA SI, SERIES
AGAIN: MOV AL, [SI]
SHR AL, O1
JNC NEGAT
INC BL
JMP POSTIV
NEGAT: INC DL
POSTIV: INC SI
DEC CL
JNZ AGAIN
MOV POS, DL
MOV NEG, BL
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.