Given an array of words aw, an array of double words adw and a byte variable called vb, write the code that does the following: adw[5]=aw[3]+8-vb. "Assembly Language"(x86).
Answer:
DATA SEGMENT
vb DB 5 ; declare a byte variable 'vb'
aw DW 6, 7, 8, 5, 22, 12, 11. ;. declare a word array
adw DD. 12, 45, 56, 12, 5, 34, 65. ; declare a double word array
DATA ENDS
CODE SEGMENT
ASSUME. CS: CODE, DS: DATA
BEGIN:
MOV AX, DATA
MOV DS , AX
MOV AX, aw[3]
MOV BX, 8
MOV BH, 0. ; Fill the upper byte of BX with zeros
ADD AX, BX . ; AX contains aw[3] + 8
MOV BX, vb
MOV BH, 0. ; Fill the upper byte of BX with zeros
SUB AX, BX . ; AX now contains aw[3] + 8 - vb
MOV adw[5], AX . ; adw[5] now contains aw[3] + 8 - vb
CODE ENDS
END BEGIN
-----------------------------------------------------------------------------------------------------------------
Get Answers For Free
Most questions answered within 1 hours.