Question: Make a copy of this assignment in notepad. Fill the information as we discuss the material. Upload the completed file as submission. Do NOT use

Make a copy of this assignment in notepad. Fill the information as we discuss the material. Upload the completed file as submission.
Do NOT use Visual Studio to put the answers BUT to validate your understanding.
OFFSET Operator -
returns the distance in bytes, of a label from the beginning of its enclosing segment
Protected mode: 32 bits
Let's assume that the data segment begins at 00404000h:
.data
bVal BYTE ?
wVal WORD ?
dVal DWORD ?
dVal2 DWORD ?
.code
mov esi,OFFSET bVal ; ESI =
mov esi,OFFSET wVal ; ESI =
mov esi,OFFSET dVal ; ESI =
mov esi,OFFSET dVal2 ; ESI =
PTR Operator -
Overrides the default type of a label (variable). Provides the flexibility to access part of a variable.
.data
myDouble DWORD 12345678h
.code
mov ax,myDouble ;
mov ax,WORD PTR myDouble ; loads ???
mov WORD PTR myDouble,4321h ; saves ???
mov al,BYTE PTR myDouble ; AL =
mov al,BYTE PTR [myDouble+1] ; AL =
mov al,BYTE PTR [myDouble+2] ; AL =
mov ax,WORD PTR myDouble ; AX =
mov ax,WORD PTR [myDouble+2] ; AX =
.data
myBytes BYTE 12h,34h,56h,78h
.code
mov ax,WORD PTR [myBytes] ; AX =
mov ax,WORD PTR [myBytes+2] ; AX =
mov eax,DWORD PTR myBytes ; EAX =
.data
varB BYTE 65h,31h,02h,05h
varW WORD 6543h,1202h
varD DWORD 12345678h
.code
mov ax, WORD PTR [varB+2] ; a.
mov bl, BYTE PTR varD ; b.
mov bl, BYTE PTR [varW+2] ; c.
mov ax, WORD PTR [varD+2] ; d.
mov eax, DWORD PTR varW ; e.
TYPE Operator -
The TYPE operator returns the size, in bytes, of a single element of a data declaration.
.data
var1 BYTE ?
var2 WORD ?
var3 DWORD ?
var4 QWORD ?
.code
mov eax,TYPE var1 ; EAX =?
mov eax,TYPE var2 ; EAX =?
mov eax,TYPE var3 ; EAX =?
mov eax,TYPE var4 ; EAX =?
LENGTHOF Operator -
The LENGTHOF operator counts the number of elements in a single data declaration.
.data LENGTHOF
byte1 BYTE 10,20,30 ; ??
array1 WORD 30 DUP(?),0,0 ; ??
array2 WORD 5 DUP(3 DUP(?)) ; ??
array3 DWORD 1,2,3,4 ; ??
digitStr BYTE "12345678",0 ; ??
.code
mov ecx, LENGTHOF array1 ; ecx =??
mov ecx, LENGTHOF array2 ; ecx =??
mov ecx, LENGTHOF array3 ; ecx =??
mov ecx, LENGTHOF digitStr ; ecx =??
SIZEOF Operator -
The SIZEOF operator returns a value that is equivalent to multiplying LENGTHOF by TYPE.
.data SIZEOF
byte1 BYTE 10,20,30 ; ??
array1 WORD 30 DUP(?),0,0 ; ??
array2 WORD 5 DUP(3 DUP(?)) ; ??
array3 DWORD 1,2,3,4 ; ??
digitStr BYTE "12345678",0 ; ??
.code
mov ecx, SIZEOF array1 ; ecx =??
mov ecx, SIZEOF array2 ; ecx =??
mov ecx, SIZEOF array3 ; ecx =??
mov ecx, SIZEOF digitStr ; ecx =??
.data
array WORD 10,20,
30,40,
50,60
.code
mov eax,LENGTHOF array ; EAX =??
mov ebx,SIZEOF array ; ebx =??
.data
array WORD 10,20
WORD 30,40
WORD 50,60
.code
mov eax,LENGTHOF array ; EAX =??
mov ebx,SIZEOF array ; ebx =??
Indirect operand -
holds the address of a variable, usually an array or string. It can be dereferenced (just like a pointer).
.data
val1 BYTE 10h,20h,30h
.code
mov esi,OFFSET val1
mov al,[esi] ; dereference ESI, AL =??
inc esi
mov al,[esi] ; AL =??
inc esi
mov al,[esi] ; AL =??
If val1 was WORD, what would change.
If val1 was DWORD, what would change.
Use PTR to clarify the size attribute of a memory operand.
.data
myCount WORD 0
.code
mov esi, OFFSET myCount
inc [esi] ; ??
inc WORD PTR [esi] ; ??
add [esi],20 ; ??
JMP Instruction
JMP is an unconditional jump to a label that is usually within the same procedure.
Syntax: JMP target
Logic: EIP target
The LOOP instruction creates a counting loop
Syntax: LOOP target
Logic:
ECX <--- ECX 1
if ECX !=0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!