Question

Assembly Language: Write and run a program to find the values of each destination operand: .data...

Assembly Language: Write and run a program to find the values of each destination operand:

.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=

0 0
Add a comment Improve this question Transcribed image text
Answer #1

VarB :

Address Data
0000 65h varB
0001 31h varB+1
0002 02h varB+2
0003 05h varB+3

VarW :

Offset Address Data
0000 6543h
0002 1202h

VarD :

Offset Address Data
0000 12345678h

a. mov ax, WORD PTR [varB+2] ;

It moves WORD stored at location varB+2 i.e. at address offset 0002.

Value is stored in reverse order in register, therefore ax will contain 0502h.

Hence, ax = 0502h

b. mov bl, BYTE PTR varD ;

Above instruction moves a byte from varD to bl register.

MSB i.e. 12 is stored at highest offset and LSB i.e. 78h is stored at lowest offset considered in byte format.

Byte format Offset
78 0000 varD
56 0001
34 0002
12 0003

Hence, bl will store 78h.

c. mov bl, BYTE PTR [varW+2] ;

Above instruction stores a byte from varW+2 into register bl.

varW+2 points at offset address 0002 which contains 1202h.

Now, LSB of 1202h i.e. 02h is stored at least offset if considered in byte format.

Therefore, bl = 02h

d. mov ax, WORD PTR [varD+2] ;

Byte format of varD :

Byte format Offset
78 0000 varD
56 0001 varD+1
34 0002 varD+2
12 0003 varD+3

Now, above instruction will move word into ax i.e. 1234h.

Hence, ax = 1234h

e. mov eax,DWORD PTR varW   ;

Word format Offset
6543h 0000
1202h 0002

Above instruction moves double word to eax. Register stores data in reverse format as in memory.

Therefore, eax = 12026543h

Add a comment
Know the answer?
Add Answer to:
Assembly Language: Write and run a program to find the values of each destination operand: .data...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write down the value of each destination operand: .data var1 WORD 0A8B4h, 1234h, 0BA23h var2 DWORD...

    Write down the value of each destination operand: .data var1 WORD 0A8B4h, 1234h, 0BA23h var2 DWORD 0E2A478C1h .code mov ax, WORD PTR [var1+3] mov eax, WORD PTR [var2+1] mov ebx, DWORD PTR [var1+2]

  • Write down the value of each destination operand: .data var1 WORD 3056h, 7645h, 0E347h var2 DWORD...

    Write down the value of each destination operand: .data var1 WORD 3056h, 7645h, 0E347h var2 DWORD 3E56F289h .code mov ax, WORD PTR [var2+1] mov eax, DWORD PTR [var1] mov ebx, DWORD PTR [var1+3]

  • Assembly Please answer the following above, compile and single step through the program, writing...

    Assembly Please answer the following above, compile and single step through the program, writing down the value of the destination for each instruction. 1. Using Visual Studio on the system, create a project using the code given below unsigned char short int int gArray 0x09, 0xFA, 0x5A, 0x18, 0x48, 0xAC, 0xD4, 0x71 ; cAr rays 1 [ ] = { 0:09, 0xfa, Ox5A, Ox18, 0x48, OxAC, OxD4, 0x71 }; gArray! [ ] = { Ox09, OxFA, Ox5A, Ox18, 0x48, OxAC,...

  • Complete the following Intel assembly language program which determines whether the byte sized operand stored in...

    Complete the following Intel assembly language program which determines whether the byte sized operand stored in memory location 'number' is prime or not. The program will write the value of 0 into the memory location 'answer' if the number is not prime, otherwise the initial value of '1' will be left unmodified (indicating that the number is prime). The program makes use of the DIV instruction to determine the value of quotient and remainder when dividing the number by 2,3,4,......

  • Use the following data declarations. Assume that the offset of byteVal is 00000000: data byteValsbyte 1,2,3,ffh...

    Use the following data declarations. Assume that the offset of byteVal is 00000000: data byteValsbyte 1,2,3,ffh dwordVal dword 34567890h, 90785634h, 12346745h Show the value of the final destination operand after each of the following code fragments has executed:(If any instruction/s is invalid, indicate "INV" as the answer and briefly explain why) a.mov edi, 2 answer al mov al, (byte Val + edi) b.mov ebx, dwordVal+4 answer ebx - [esi).- (show your answer in liteedim mov esi, offset dwordVal+8 xchg ebx,...

  • Assembly language. You can see the question in blue box. Loop Instruction Problem 4: Write and...

    Assembly language. You can see the question in blue box. Loop Instruction Problem 4: Write and run a program and answer the questions in the box. .data temp dword? First, build and run the program .code - Trace ECX value mov eax,0 ECX=? mov ecx, 10 ; outer loop counter - EAX =? L1: Second: If we removed mov ecx, temp mov eax, 3 What will happen? mov temp.ecx mov ecx,5 ; inner loop counter - build and run the...

  • ) Identify the hexadecimal value moved to the destination by each of the following instruction below...

    ) Identify the hexadecimal value moved to the destination by each of the following instruction below based on the given data declaration. Assume that the offset of byteVal is 00000000H data byteVal wordVal dwordVal aString BYTE 1,2,3,4 WORD 1000H,2000H,3000H,4000H DWORD 12345678H,34567890H BYTE "ABCDEFG",0 ax,offset byteVal i. mov dx,wordVal i. mov al,aString+2 i11. mov dx,wordVal+4 iv. mov mov eax,offset byteVal+2 V. CO2 (10 marks) d) The incomplete program below used to find the multiplication product of the given numbers by 4...

  • 1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that...

    1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that does the following: eax = (ecx + edx ) - (eax + ebx) 2. Write a piece of code that copies the number inside al to ch. Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900. Your code must be as efficient as possible. 3. You are given eax = 0x5. Write one line of code in...

  • IF statement is translated into assembly language with a o CMP instruction followed by Conditiona...

    IF statement is translated into assembly language with a o CMP instruction followed by Conditional jumps. If op1 or op2 is a memory operand o IF Statemert (a variable): o one of them must be moved Problem 3: Implement the following pseudocode in assembly language. to a register before executing CMP. All values are unsigned: стр ьї, ci ja next mov al,5 mov dl,6 al-50 dl-23 next: Add to the above code the mov instructions and assign values to bl,...

  • Q 2. Assuming a 32-bit operating environment, identify the mode of each operand in the following...

    Q 2. Assuming a 32-bit operating environment, identify the mode of each operand in the following instructions. (Note: There are two operands in each instruction; identify both modes.) For a memory operand, specify whether it is direct memory mode or register indirect memory mode. Assume that the instructions are in a program also containing the code. .DATA value DWORD ? char BYTE *1. mov value, 100 2. movecx, value 3. mov ah, Oah *4. moveax, (esi] 5. mov [ebx], ecx...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT