Pong code for Chapter 11 Project

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pong code for Chapter 11 Project

owend
When I compile and run the Pong code supplied for the Chapter 11 project, the ball immediately goes to the bottom of the screen and the game ends.  Is this the same version of the game for which assembly code is include for the Chapter 6 project?
Reply | Threaded
Open this post in threaded view
|

Re: Pong code for Chapter 11 Project

cadet1620
Administrator
If you load the compiled Pong into the VM Emulator without having copied to OS .vm files from nand2tetris/tools/OS into the Pong directory, the VM Emulator uses its built in versions of the OS calls which run much faster than emulating the OS .vm files.

This causes Pong to run impossibly fast, even on my slow old home PC (2.9 GHz Celeron).  On a recent computer it can run so fast that it appears that the paddle starts at the right side and the ball on the bottom with "Game Over".

Pong should be playable if you copy the OS .vm files. You may also need to select medium to slow speed.

I don't have access to the VM Translator that was used to generate the Pong.asm in project 6 so I can't say if the source is identical.  My VM produces an .asm file that is about the same size.
projects/06/pong/Pong.asm
  Lines
  28374
projects/11/Pong/Pong.asm
  Lines
  28291
--Mark