Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

pls help Using the information leamed up to now, write a program to: Read the va

ID: 1813980 • Letter: P

Question

pls help

Using the information leamed up to now, write a program to: Read the values of three arrays containing the following measurements of a pyramid: the length of the base; w - the width of the base; h - height. Pass the values read to a subroutine called VOLUME that will compute the volume of the pyramid defined by the following formula: Use the following registers to pass the values read from the arrays in the main routine to the VOLUME subroutine: Note that due to the fact you are using integer values the result will be truncated to an integer value. Name your program P2GXY.ASM, where X is your section number and Y your desk number. The arrays are defined below: DATA VVOLUME DB 5 DUP(?) LLENGTH DB 2H, 4H, 6H, OAH, 4H WWIDTH DB 3H, 5H, 9H, 15H, 8H HHEIGHT DB 5H, 6H, 4H, 28H, 5H The main procedure of your program should: read into AL, BL, and DL the values from the arrays LLENGTH, WWIDTH and HHEIGHT respectively; call the procedure VVOLUME to perform the volume computation and store the result in AL; the converted value, returned from the subroutine in AL, should be stored into the array VVOLUME upon returning to the main procedure; stop execution of program after the last element of array has been reached otherwise repeat from the beginning. Note that you will be using register, AL, BL and DL to communicate with the VOLUME procedure. Use the LOOP instruction to create the loop in the main routine and make sure to use the appropriate form of the multiply and divide instructions, both in terms of the size of the data but also in term of the data being unsigned integer.

Explanation / Answer

VVOLUME DB 5 DUP(?)


LLENGTH DB 2H, 4H, 6H, 0AH, 4H


WWIDTH DB 3H, 5H, 9H, 15H, 8H


HHEIGHT DB 5H, 6H, 4H, 28H, 5H


ends


stack segment


dw 128 dup(0)


ends   


code segment


main proc far


;set segment registers:


mov ax, data


mov ds, ax


mov es, ax


; add your code here


mov si, 00H   


mov cx, 04H


again:


mov al, LLENGTH[si]


mov bl, WWIDTH[si]


mov dl, HHEIGHT[si]


call VOLUME


mov VVOLUME[SI], al


inc si


mov ah, 1


int 21h


mov ax, 4c00h


loop again


main endp


;subroutines


VOLUME proc near


mul bl


mov bl,3H


div bl


mul dl


ret


VOLUME endp


Ends


End main




Hope this help