Question: Microcontroller mc9s12c32 assembly language code warrior freescale the variable TABLE simulates a one-dimensional ping-pong table where cach bit of TABLE represents a possible location of

 Microcontroller mc9s12c32 assembly language code warrior freescale the variable TABLE simulates

Microcontroller mc9s12c32 assembly language code warrior freescale

the variable TABLE simulates a one-dimensional ping-pong table where cach bit of TABLE represents a possible location of the ball. The current location of the bal is indicated by the bit which is 1. Hence, at any time, only one of the 8 bits of TABLE can be 1 and all the others must be 0. The ball ves onebit position in a step. The variable DIRECTION specifies in which direction the ball is to move where the value of 1 mcans"to the right" while the value of 0 "to the left." When the ball gets to the left end of table (the MSB of TABLE), it is bounced back (to the second MSB) in the following step. When the ball gets to the right end of table (the LSB of TABLE), it is bounced back in the following step if the corresponding BOUNCE is 1. Otherwise, the ball exits through the right end, ic, none of the 8 bits of TABLE is 1 in the following step, and then the ball starts from the right end in the next step (moving to the left in the subsequent step) Write a program which simulates playing the one-dimensional ping-pong game through 19 steps In each step, the ball moves one bit position in the direction "currently" indicated in DIRECTION Note that the value of DIRECTION needs to be changed if it is to be bounced back in the next step The ball rcaches the right end of the table 2 times in total. The variable BOUNCE is referred to only when the ball reaches the right end It is required to have a subroutine updatetable which advances the ba in TABLE one-bit position. The main module initializes the variables and calls the subroutine 19 times DS.B TABLE DIRECTIONDC.B BOUNCE DC.B 0, 1 You may define more memory variables if necessary. RAMStart-S0800 and ROMStart-$4000 Initialize TABLE to be $04 the variable TABLE simulates a one-dimensional ping-pong table where cach bit of TABLE represents a possible location of the ball. The current location of the bal is indicated by the bit which is 1. Hence, at any time, only one of the 8 bits of TABLE can be 1 and all the others must be 0. The ball ves onebit position in a step. The variable DIRECTION specifies in which direction the ball is to move where the value of 1 mcans"to the right" while the value of 0 "to the left." When the ball gets to the left end of table (the MSB of TABLE), it is bounced back (to the second MSB) in the following step. When the ball gets to the right end of table (the LSB of TABLE), it is bounced back in the following step if the corresponding BOUNCE is 1. Otherwise, the ball exits through the right end, ic, none of the 8 bits of TABLE is 1 in the following step, and then the ball starts from the right end in the next step (moving to the left in the subsequent step) Write a program which simulates playing the one-dimensional ping-pong game through 19 steps In each step, the ball moves one bit position in the direction "currently" indicated in DIRECTION Note that the value of DIRECTION needs to be changed if it is to be bounced back in the next step The ball rcaches the right end of the table 2 times in total. The variable BOUNCE is referred to only when the ball reaches the right end It is required to have a subroutine updatetable which advances the ba in TABLE one-bit position. The main module initializes the variables and calls the subroutine 19 times DS.B TABLE DIRECTIONDC.B BOUNCE DC.B 0, 1 You may define more memory variables if necessary. RAMStart-S0800 and ROMStart-$4000 Initialize TABLE to be $04

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!