Question

Please write in assembly language 8086 windows32 Question 3: Write an assembly program that has a...

Please write in assembly language 8086 windows32

Question 3:

Write an assembly program that has a macro maximum that finds the larger of two numbers inputted by the user

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

Answer:


Assembly program that has a macro maximum that finds the larger of two numbers inputted by the user.

%include "io.mac"
.STACK 100H

.DATA
Numbers DW 3,4,5,2,6,0
msg0 db "Printing values in array",0
msg1 db "Max",0
msg2 db "Min",0

.CODE
.STARTUP
PutStr msg0
mov dx, Numbers
mov si, dx ;point to array
printValues:
cmp word [si], 0
je procedure
nwln
PutInt [si]
add si, 2
jmp printValues

procedure:
push Numbers ;push Number to stack to pass parameter by stack
call maxMeth
nwln
PutStr msg1
nwln

PutInt ax
nwln

complete:
.EXIT

maxMeth:
enter 0,0 ;save old bp and set bp to sp
mov si, [bp+4] ;point to array
mov ax, [si] ; ax holds max
add si,2 ; Increment si to next number

;Now entering loop
max:
cmp word [si],0 ; checks to see if the number is 0 and if it is, then we are done.
je finish
cmp ax, [si] ; ax holds the max . So if ax is greater than si, then dont assign si to ax.
jge increment
jmp newMax
newMax:
mov ax, [si] ; Otherwise we have a new a max

increment:
add si, 2 ;now increment si to check the next value and jump back to the main loop.
jmp max

finish: ;clean up.
leave ;pop bp
ret ;return

#please consider my effort and give me a like...thank u....

Add a comment
Know the answer?
Add Answer to:
Please write in assembly language 8086 windows32 Question 3: Write an assembly program that has a...
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