324_Book

# This line also contained grid01 so when we begin

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s 0x10C Address 0x108 Address 0x100 Address 0x10C movl movl movl movl movl movl movl movl movl 8(%ebp),%edi 12(%ebp),%ebx 16(%ebp),%esi (%edi),%eax (%ebx),%edx (%esi),%ecx %eax,(%ebx) %edx,(%esi) %ecx,(%edi) xp yp zp x y z *yp = x *zp = y *xp = z From this we can generate the following C code: code/asm/decode1-ans.c 1 2 3 4 5 6 7 8 9 10 void decode1(int *xp, int *yp, int *zp) { int tx = *xp; int ty = *yp; int tz = *zp; *yp = tx; *zp = ty; *xp = tz; } B.3. MACHINE LEVEL REPRESENTATION OF C PROGRAMS 701 code/asm/decode1-ans.c Problem 3.3 Solution: [Pg. 106] This exercise demonstrates the versatility of the leal instruction and gives you more practice in deciphering the different operand forms. Note that although the operand forms are classiﬁed as type “Memory” in Figure 3.3, no memory access occurs. Expression leal 6(%eax), %edx leal (%eax,%ecx), %edx leal (%eax,%ecx,4), %edx leal 7(%eax,%eax,8), %edx leal 0xA(,\$ecx,4), %edx leal 9(%eax,%ecx,2), %edx Problem 3.4 Solution: [Pg. 106] This problem gi...
View Full Document

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online