PIC-Pong

PIC-Pong is an implementation of the classic "Pong" video game using a PIC16C71 microprocessor. The only other chip in the project is the voltage regulator. The video is generated entirely in software.

PIC-Pong was inspired by a video test pattern generator developed by Richard Ottosen using a PIC16C54. After he built that we both considered the idea of trying to write a video game using the PIC16C54, but we decided that it was too limited. When the PIC16C71 was introduced I revisited the idea and came up with PIC-Pong.

Later we saw the winning entry in one of Circuit Cellar's design contests, which was a video wind gauge. It was quite well done, and the author came up with a clever timing trick which I later incorporated into PIC-Pong. To a casual inspection it would appear that code to resynchronize execution with the timer (using no prescaler, i.e., one count per instruction cycle) would be to within four cycles. However, using an add to the program counter enables exact synchronization.


I'm not ready to release the code for PIC-Pong yet, but if you'd like to see some PIC video code you could look at my PIC-Tock project. The video and character generation code is derived from the code I wrote for PIC-Pong.

Screen Shots

These were taken using my psim simulator. The red represents sync, and is shown by the simulator for debugging. It doesn't show on screen with the real hardware.

Attract mode:

attract mode

Game play:

game play


Notes on character generation:

In order to obtain sufficient horizontal resolution for character generation, I use port B as a shift register. PB0 is the TTL-level video output, and with five pixels of one scan line of a character in W, I execute the following code:
	movwf	portb
	rrf	portb
	rrf	portb
	rrf	portb
	rrf	portb
Of course, that means that I can't use the other pins of Port B. Or does it?

Actually, by making bit PB7 an input that is tied high, I can use PB6 and PB5 for other outputs that are always high during active video. In particular, I use them to control video sync and blanking. The W register value should have ones in the high three bits.


Articles about Pong:


Back to my PIC Projects page
Back to my home page

Last updated October 12, 2000

Copyright 1995, 1999, 2000 Eric Smith

eric@brouhaha.com

Valid HTML 3.2! check now