Define an array of 16 32-bit words in your assembly program then initialize them
ID: 3690304 • Letter: D
Question
Define an array of 16 32-bit words in your assembly program then initialize them with any value. Next write a main program that passes the address if this array in any variable register and it's length in any argument register before it calls the routine. Then Write a subroutine that searches for the smallest and highest number in the list and passes them back using correct argument registers (left to the student to decide). The in the main, it should take those passed 2 values and store them appropriately (needs to decide on the data storage in advance in the main).. The subroutine should not change any other general purpose registers it uses inside?Explanation / Answer
DATA SEGMENT
# passing static values to array's find the largest and smallest numbers
A DB 5,2,5,6,4,3
B DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV CX,0000
MOV CL,06
LEA BX,A
MOV AL,00
MOV AH,BYTE PTR[BX]
L1:CMP AL,BYTE PTR[BX]
JNC L2
MOV AL,BYTE PTR[BX]
L2:CMP AH,BYTE PTR[BX]
JC L3
MOV AH,BYTE PTR[BX]
L3:INC BX
DEC CL
CMP CL,00
JNZ L1
MOV AH,4CH
INT 21H
CODE ENDS
END START
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.