The game will be controlled by the following keys:

1.      Z –speed up. Hitting Z decreases the delay between consecutive scrolls of the background.

2.      X – slow down. Hitting X increases the delay between scrolls of the background.

3.      < - move left. Hitting <  moves the X position of the car left.

4.      > - move right. Hitting > moves the X position of the car right.

5.      ESC – exit the game. Play the exit tune.

 

 

In this assignment you have to perform 3 tasks:

 

  1. Create a control loop that takes user input and adjusts the speed and position of the car (50 pts).
    1. Note that the highest speed corresponds to the minimal delay between scrolls.
    2. The lowest speed is 0, which cannot be implemented using delays. Instead you should stop scrolling of the SCROLLBUFFER.
    3. Moving car left or right, make sure that it does not go outside the road and always stays on the blue area.
    4. While the computer is being delayed by the DELAY function, the user can hit more than one button.
      Reading from keyboard, make sure that have emptied the keyboard buffer completely, and perform action (change speed,
      position, exit) only on the very last keypress stored in the buffer.
  2. Create a procedure to play a simple tune stored in the TUNE buffer (25 pts). The buffer is terminated with 0FFFFh indicating the end of the tune.
    Function TUNE calls function BEEP to generate a tone.
  3. Create a procedure (BEEP) to generate a tone in the speaker. (25pts)

 

Email you executable (with your last name included in the file name) and turn in the .asm file of the compiled program printed in Courier New 9pts font.

 

!!!! Late submissions for this assignment will not be accepted !!!!

 

The details of the assignment and hints are given in the source code.

 

 

After completion of these two tasks you should be able to increase and decrease car speed on the screen and steer the car left or right.

Additionally, you should be able to quit the game by hitting ESC. The game should terminate by playing a tune.

 

The program terminate with a state like shown (the car can have any X position)