Question: Please use CodeWarrior IDE do this questions! Thank you! In this homework, the variable TABLE simulates a one-dimensional track along which a ball moves. Each

Please use CodeWarrior IDE do this questions! Thank you!Please use CodeWarrior IDE do this questions! Thank you! In this homework,the variable TABLE simulates a one-dimensional track along which a ball moves.

In this homework, the variable TABLE simulates a one-dimensional track along which a ball moves. Each bit of TABLE (b7bebzbjbzb2bibo) represents a possible location of the ball. The current location of the ball is indicated by the bit which is 1. Hence, at any time, only one of the 8 bits of TABLE is 1 and all the others are 0. The ball moves one-bit position in a step. The variable DIRECTION specifies in which direction the ball is to move where the value of 0 means "to the right" while the value of 1 "to the left." The initial location of the ball is bz as TABLE is initialized to $08 below. The ball starts to move to the left as indicated by "1" in DIRECTION. When the ball reaches be from the right, it bounces back and moves to the right in the following step. When the ball reaches b2 from the left, it bounces back and moves to the left in the following step. This operation continues indefinitely. Write a program which implements the above-described operation. 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 It is required to have a subroutine update which moves the ball in TABLE one-bit position and updates DIRECTION when needed. The main module initializes the variables and calls the subroutine. In this homework, the variable TABLE simulates a one-dimensional track along which a ball moves. Each bit of TABLE (b7bebzbjbzb2bibo) represents a possible location of the ball. The current location of the ball is indicated by the bit which is 1. Hence, at any time, only one of the 8 bits of TABLE is 1 and all the others are 0. The ball moves one-bit position in a step. The variable DIRECTION specifies in which direction the ball is to move where the value of 0 means "to the right" while the value of 1 "to the left." The initial location of the ball is bz as TABLE is initialized to $08 below. The ball starts to move to the left as indicated by "1" in DIRECTION. When the ball reaches be from the right, it bounces back and moves to the right in the following step. When the ball reaches b2 from the left, it bounces back and moves to the left in the following step. This operation continues indefinitely. Write a program which implements the above-described operation. 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 It is required to have a subroutine update which moves the ball in TABLE one-bit position and updates DIRECTION when needed. The main module initializes the variables and calls the subroutine

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!