Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show all work and explain each step. Thank you. 2. For the following code, variables are stored starting at location 0x 1000. Draw memory

image text in transcribed

image text in transcribed

image text in transcribed

Please show all work and explain each step. Thank you.

2. For the following code, variables are stored starting at location 0x 1000. Draw memory as being 16 bits wide and show the memory locations that are assigned to each array element and variable as is done in Figures 6.1 and 6.8. Give the contents of these memory locations after all of the code is executed. Assume that any uninitialized variables are initialized to 0 before this code fragment is executed. int32_t* pi32x; int16_t* pi16-y; int16 t i16_b; int32t 132 a; uint8 t au8_c[4]; uint8 t* pu8w; // Note: value given in decimal 1; 132-a # i16-b >> p132-x-&132-a ; pi32x pi32-x 2; Mode Effective Address and Operation Notes Syntax Word EA = ( Wn) Byte RI [Wn EA [+5B'n] (Wn) Wn unmodified Wn used as EA Wn used as EA used as EA | (Wn += I); EA-: (JYn) | ( Wn +-2): EA:: (;Yn) | Increment before increment RI with pre--Wn](Wn ); EA-(Wn) (Wn 2); EA -(Wn) Decrement before RI with post-Wn+ RI with post- decrement EA Wn); (Wnt EAWn); (Wn2): Increment after Wn | EA increment [Bn-I EA = (Wn); (Wn-i): (Wr); ( Wn-2); | Decrement after decrement RI with register offset Wn used as EA Wn, Wb unmodified Figure 6.1 Register indirect (RI) addressing modes W15 is the stack pointer (SP), (a) push Operation: dataA (SP), SP SP+ 2 dataA is specified by the source addressing modc. Stack grows towards increasing memory locations Before push of data.M Location Contents 0x1200|???? |--SP 0x1202 ???? 0x1204???? W15 0x 1200 After push of data Location Contents 0x1200 dataA modified 0x1202 ??2? 0x1204 ???? W15 0x1202 modified (b) pop Operation: SP SP 2, ((SP)) destination as specified by destination addressing mode Before pop operation Location Contents 0x1200dataA 0x 1202 2222SP 0x1204 ??? W15 0x1202 After pop operation Location Contents 0x1200dataA SP 0x1202 |-???? 0x1204 2??? W150x1200 modified Figure 6.8 Memory stack push, pop operations 2. For the following code, variables are stored starting at location 0x 1000. Draw memory as being 16 bits wide and show the memory locations that are assigned to each array element and variable as is done in Figures 6.1 and 6.8. Give the contents of these memory locations after all of the code is executed. Assume that any uninitialized variables are initialized to 0 before this code fragment is executed. int32_t* pi32x; int16_t* pi16-y; int16 t i16_b; int32t 132 a; uint8 t au8_c[4]; uint8 t* pu8w; // Note: value given in decimal 1; 132-a # i16-b >> p132-x-&132-a ; pi32x pi32-x 2; Mode Effective Address and Operation Notes Syntax Word EA = ( Wn) Byte RI [Wn EA [+5B'n] (Wn) Wn unmodified Wn used as EA Wn used as EA used as EA | (Wn += I); EA-: (JYn) | ( Wn +-2): EA:: (;Yn) | Increment before increment RI with pre--Wn](Wn ); EA-(Wn) (Wn 2); EA -(Wn) Decrement before RI with post-Wn+ RI with post- decrement EA Wn); (Wnt EAWn); (Wn2): Increment after Wn | EA increment [Bn-I EA = (Wn); (Wn-i): (Wr); ( Wn-2); | Decrement after decrement RI with register offset Wn used as EA Wn, Wb unmodified Figure 6.1 Register indirect (RI) addressing modes W15 is the stack pointer (SP), (a) push Operation: dataA (SP), SP SP+ 2 dataA is specified by the source addressing modc. Stack grows towards increasing memory locations Before push of data.M Location Contents 0x1200|???? |--SP 0x1202 ???? 0x1204???? W15 0x 1200 After push of data Location Contents 0x1200 dataA modified 0x1202 ??2? 0x1204 ???? W15 0x1202 modified (b) pop Operation: SP SP 2, ((SP)) destination as specified by destination addressing mode Before pop operation Location Contents 0x1200dataA 0x 1202 2222SP 0x1204 ??? W15 0x1202 After pop operation Location Contents 0x1200dataA SP 0x1202 |-???? 0x1204 2??? W150x1200 modified Figure 6.8 Memory stack push, pop operations

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

What feelings does this blockade trigger?

Answered: 1 week ago