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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
a. Write the calling code and procedure entry instructions related to the stack. b. Show the full contents of the stack.
Background image of page 2
Background image of page 3
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

This note was uploaded on 09/08/2010 for the course CMPE 46 at San Jose State University .

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 Right Arrow Icon
Ask a homework question - tutors are online