Virtual Pong.

The game Pong was the world's first video game in the early 70's, it is a tennis lookalike game where a ball is played with two rackets, which are moved up and down by each player. The ball can bounce at the floor and the ceiling. This version is implemented with the virtual game system It was the first game I made for the system.

Some special features of the game is that it is possible to change ball direction and speed, and that it can be played Human vs. Human, Human vs. Computer and Computer vs. Computer. The computer is not very intelligent though, it just checks if the ball is below or above the racket, making it quite easy to beat.


Most of the code is written in C and compiled with Hi-tech PIC-C. It is the best c-compiler available for the PIC, but it comes with really shitty DOS IDE. However, it is possible to integrate the compiler with MPLAB and then you'll have an extremely powerful easy-to-use development environment. It is this combination that I've used developing the virtual pong game, and it is what I recommend you to use when developing stuff for PIC. It is amazing to see how tight code it produces.

It is quite easy to write the game pong in C, it is just a lot "if-statements" that check if the ball should bounce, and also keep track of the players. The communication is not very frequent, each frame there is one screen clear, two horizontal lines (ceiling and floor), two vertical lines (the players), and one pixel set (the ball). Each only causing a few bytes to be sent.

The software is built as a state machine with different states for different screens.

The game also has some simple sound effects. These are generated by an interrupt about 8000 times per second. By sending out a triangle wave in different speeds, different frequencies can be generated.

How to play

When turning on the game, a greeting message says "Virtual Pong © Rickard Gunee" until fire button on joystick 1 is pressed. (Joystick 1 is used in all menus) Then the selection screen appears. This shows "H-H", meaning "Human vs. Human", this can be selected by moving the joystick downwards. If the joystick is moved to the left, then it shows "H-C", meaning "Human vs. Computer" and finally you can select Computer vs. Computer, "C-C" by moving the joystick to the right. The game starts when the fire button is pressed.

In the game view a player serves by pressing fire. Moving the joystick up and down moves the racket. When the ball bounces at the racket, moving the joystick while pressing fire can change speed and direction. When a player misses, a screen showing the score comes up for a couple of seconds before the game continues. The line under one of the numbers shows whose got the serve. If one of the players got 9 points, then a message says "Player 1 won" for example if player 1 won, then the greeting screen appears again.


Source-code and hex-files are available in

More mechanically scanned stuff

If you want to know more about mechanically scanned stuff, check out some of these links:

  • Bob blick's propeller clock

  • Daryl Bender's propeller clock

  • Questions ?

    If you have questions about the games, make sure to check out the FAQ (Frequently Asked Questions) before you ask me.

    Copyright note

    Virtual Game System (C) Rickard Gunee. This is open source, use this at your own risk ! You may use the information on this page for your own projects as long as you refer to the original author (by name and link to authors homepage), don't do it for profit and don't hurt or harm anyone or anything with it. The author can not be held responsible for any damage caused by the information on this and related pages.