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

Assembly programming language. Need help with 4, 5 ,6 and 7. Please explain your

ID: 3840817 • Letter: A

Question

Assembly programming language.

Need help with 4, 5 ,6 and 7. Please explain your answer. Thank you

The___ operator returns the offset of a data label. The offset represents the distance, inbytes, of the label from the beginning of the data segment. PTR OFFSET LENGTHOF SIZEOF The ___operator counts the number of elements in an array. COUNT OFFSET LENGTHOF SIZEOF The ___ returns the number of bytes in an array. COUNT BYTES SIZEOF LENGTHOF ___ is when you use a register as a pointer where the register contains the address of some data. Direct addressing Dereference addressing Indirect addressing Offset addressing

Explanation / Answer

Q4--The OFFSET operator returns the offset of a data label in assembly language programming and that represents the distance in bytes of the label from the beginning of the data segment.
some variables are defined as follows
.data
bVal BYTE ?
wVal WORD ?
dVal DWORD ?
dVal2 DWORD ?
If bVal were located at offset 00404000 (hexadecimal), the OFFSET operator would return the following values:
mov esi, OFFSET bVal ;ESI = 00404000h
mov esi, OFFSET wVal ;ESI = 00404001h
mov esi, OFFSET dVal ;ESI = 00404003h
mov esi, OFFSET dVal2 ;ESI = 00404007h

Q5-
The LENGTHOF operator counts the number of elements in the array when the array is defined locally.
example : mov ecx,LENGTHOF str
Q6-The SIZEOF returns the number of bytes in an array if it is defined locally.
example-
mov ecx,sizeof str

Q7-INDIRECT ADDRESSING
the effective address for resgister indirect address is specified in the register which means the register act as a pointer as it contains address to another register where value is stored.
example- MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)