Assembly - Module 7 Summary Exercises

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Given the following declarations, assume that the memory address of balance is 44h. What is the hexadecimal address of the first element ofhistory? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

4AH

For the following segment, what is SIZEOF myChecker2 in decimal? (ignore the .0000 from Canvas) .data myChecker2 BYTE 12h, 34h, 56h, 78h, 90h

5

Given list, an array of WORDs, what element is addressed by list[8]?

5th Element

Suppose that you are given the following partial program.Inside someProcedure, what numerical operand should be used with the RET instruction? (e.g. RET n, what should n be? Ignore any decimal points that Canvas adds) .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC PUSH x PUSH y PUSH z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP

8

Suppose that you are given the following partial program.Inside someProcedure, what numerical operand should be used with the RET instruction? (e.g. RET n, what should n be? Ignore any decimal points that Canvas adds) .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC PUSH x PUSH y PUSH z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP You Answered

8

Given the following partial data segment declarations and using Indexed Operands addressing, what value would I put in the brackets in MOV EAX, list[?] to move the 25th element of list into EAX? (Ignore the .0000 that Canvas may append to your answer). MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

96

Suppose that you are given the following data segment and code snippet. What hexadecimal value does EAX contain at Execution Point A? .data myPtrCheck BYTE 12h, 34h, 56h, 78h,90h, 0ABh, 0CDh, 0EFh .code main PROC ; ... MOV EAX, DWORD PTR [myPtrCheck + 2] ; Execution Point A ; ... exit main ENDP

AB907856

T/F The following two instructions are equivalent. RET RET 4

False

When passing parameters to a procedure on the stack, it is usually okay to change the value of the EBP register within the procedure after building the stack frame. T/F

False

Given the following register states, and using Register Indirect addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address (OFFSET) of the first element of list.ESI register contains the address (OFFSET) of the eleventh element of list.EBX register contains the value 40.

MOV EAX, [ESI]

The _________ operator returns the size, in bytes, of a single element of a data declaration.

TYPE

When passing procedure parameters on the stack, why are the following lines of code often necessary in a procedure? PUSH EBPMOV EBP, ESP

To keep additional usage of the stack within the procedure from invalidating the stack offsets.

If you reference a point beyond the end of an array in MASM (for example, the address of the what would be the 105th element of a 100-element array), what happens?

You attempt to access whatever data bytes are stored there.

To access stack-passed parameters in a procedure, which addressing mode is used?

Base + Offset

Arrays elements are stored in ____________ memory.

Contiguous

Suppose that you are given the following partial data segment and code snippet. What hexadecimal value does EAX contain at Execution Point A? .data myPtrCheck BYTE 12h, 34h, 56h, 78h,90h, 0ABh, 0CDh, 0EFh .code main PROC ; ... MOV EAX, DWORD PTR myPtrCheck ; Execution Point A ; ... exit main ENDP

078563412h

Suppose that you are given the following partial data segment and code snippet. What hexadecimal value does EAX contain at Execution Point A? .data myPtrCheck BYTE 12h, 34h, 56h, 78h,90h, 0ABh, 0CDh, 0EFh .code main PROC ; ... MOV EAX, DWORD PTR myPtrCheck ; Execution Point A ; ... exit main ENDP You Answered

078563412h

For the following segment, what is SIZEOF myChecker1 in decimal? (ignore the .0000 from Canvas) .data myChecker1 BYTE 12h BYTE 34h BYTE 56h BYTE 78h BYTE 90h You Answered

1

Suppose that you are given the following data segment and code snippet. What value does EAX contain at Execution Point A? (Ignore the .0000 that Canvas sticks on the end): .data idArray DWORD 1800, 1719, 1638, 1557, 1476, 1395, 1314, 1233, 1152, 1071, 990 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray .code main PROC ; ... MOV ESI, OFFSET idArray MOV EAX, [ESI+5*TYPE idArray] ; Execution Point A ; ... exit main ENDP You Answered

1,395

Please place the following components of the stack frame in the order in which they should be pushed (or room made for them) on the stack.

1. passed parameters 2. procedure return address 3. old EBP value 4. local variables 5. saved registers

Suppose that you are given the following partial program.Inside someProcedure, what numerical operand should be used with the RET instruction? (e.g. RET n, what should n be? Ignore any decimal points that Canvas adds) .data x DWORD 153461 y WORD 37 z BYTE "Why are you looking at this?",0 .code main PROC PUSH x PUSH y PUSH OFFSET z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP

10

Given the following partial data segment declarations and using Indexed Operands addressing, what value would I put in the brackets in MOV EAX, list[?] to move the 27th element of list into EAX? (Ignore the .0000 that Canvas may append to your answer). MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

104

Suppose that you are given the following partial data segment. What value does idSize contain, in decimal? (Ignore the .0000 from Canvas) .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray You Answered

12

The following instruction will increment the stack pointer (ESP) by how many bytes? (Ignore the .0 after the number. Canvas insists on pushing decimals even when kindly asked not to).

15

Suppose that you are given the following data segment and code snippet. What value does EAX contain at Execution Point A? (Ignore the .0000 that Canvas sticks on the end): .data idArray DWORD 1800, 1719, 1638, 1557, 1476, 1395, 1314, 1233, 1152, 1071, 990 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray .code main PROC ; ... MOV ESI, OFFSET idArray MOV EAX, [ESI+3*TYPE idArray] ; Execution Point A ; ... exit main ENDP You Answered

1557

Register Indirect addressing is defined as follows:

Accessing memory through an address stored in a register.

The _________ operator returns a count of the number of elements in a single data declaration.

LENGTHOF

Given the following register states, and using Base+Offset Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contains the address (OFFSET) of the first element of list.ESI register contains the address (OFFSET) of the eleventh element of list.EBX register contains the value 40.

MOV EAX, [EDX + EBX]

The _________ operator returns the distance in bytes, of a label from the beginning of its enclosing segment, added to the segment register.

OFFSET

The _________ operator overrides the default type of a label (variable), and can also be used to combine elements of a smaller data type and move them into a larger operand.

PTR

The _________ operator returns a value that is equivalent to multiplying the number of elements in a single data declaration by the size, in bytes, of a single element of a data declaration.

SIZEOF


Set pelajaran terkait

Test sample, Regis NU-713 Quiz 5 (Epidemiology Chapters 11 & 12), Exam 1, Micro Exam 4, PHP 405 midterm, Epidemiology, CPH Exam Epidemiology

View Set

Magruder's [US] American gov, chs 1-6 review

View Set

GA4 Certification -- Lesson Questions

View Set

Chapter 2 Quiz: Choice in a World of Scarcity

View Set

CH 43 Disorders of the Biliary Tract, Disorders of the Pancreas, and Disorders of the Liver

View Set