Quiz4_s10_Solutions

# Quiz4_s10_Solutions - a.code o o push val1 push val2 call...

This preview shows pages 1–3. Sign up to view the full content.

CmpE 102 Quiz #4 - SOLUTIONS 1. Suppose you received the following new requirement to some IA-32 code you are currently developing: “Provide in-line code to fill data memory locations 20000h to 21FFFh with all zeros.” Develop the in-line code that meets this requirement. cld mov ax, 2000h mov es, ax xor edi, edi mov ecx, 2000h xor al, al rep stosb - or - ; Assume ES = 2000h cld mov edi, 0 mov ecx, 500h xor eax, eax rep stosd 2. A delay procedure (named Delay) is called and its two timing arguments (shown below) are passed on the stack. .data val1 DWORD 18FE4h val2 DWORD 4h

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
a. Write the calling code and procedure entry instructions related to the stack. b. Show the full contents of the stack.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a. .code o o push val1 push val2 call Delay Delay PROC push ebp mov ebp, esp mov ecx, [ebp + 12] mov edx, [ebp + 8] o o b. Stack Contents ebp + 12 val1 ebp + 8 val2 ebp + 4 Return Address ebp , esp EBP 3. The following array was previously filled with data from an external source: .data bArray BYTE 200 DUP(?) Write the code to search for the number of 00h data in the filled array and return the count in the eax register. .code cld mov edi, OFFSET bArray mov ecx, LENGTHOF bArray xor bl, bl xor al, al L1: scasb jne L2 inc bl L2: loop L1 movzx eax, bl ; eax = 00h count...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

Quiz4_s10_Solutions - a.code o o push val1 push val2 call...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online