\begin{section}{Introduction}
\label{sec:intro}

\begin{subsection}{Pong}

Pong was one of the first electronic games to achieve great
popularity, largely because it is simple enough to implement cheaply,
yet fast-paced enough to entertain.  In the simplest form of the game,
a ball moves on a monitor, bouncing off of the ceiling and floor and
off of ``paddles'' --- rectangles near the left and right edges of the
screen --- whose vertical positions are controlled by the players'
joysticks.  If a player allows the ball past his paddle, he loses a
point.

This project implements a more entertaining version of this game:
instead of using joysticks to control paddles, the players stand in
front of a video camera and bounce the ball by moving their arms,
legs, and body.  The digital system detects the movement and reflects
the ball when it touches a region of motion.  The effect is one of
``immersion'' of the player into the game; instead of interacting with
a computer's keyboard or joystick, the player interacts as directly as
possible with the game.

\end{subsection}

\begin{subsection}{Modules Overview}

\begin{subsubsection}{Overall Organization}

The Full Immersion Pong game consists of four main modules.  The
analog I/O module converts a video stream to a sequence of digital
samples for processing, and converts the processed digital signal into
an analog signal suitable for display on a monitor.  The frame
differencer detects motion in the video stream, and passes this
information on to the rules module, which keeps track of the state of
the game.  Finally, the bitmap overlay module superimposes an image on
the difference stream to provide visual feedback on the current ball
position to the user, and outputs this stream to the I/O module for
display.

\begin{figure}
\epsfbox{jastr/diagrams/system.eps}
\caption{System Block Diagram}
\label{fig:sysblock}
\end{figure}


\end{subsubsection}

\begin{subsubsection}{Analog I/O Module}

The input to the system is an analog NTSC video stream from a
greyscale camera.  This camera is synchronized with regular horizontal
sync and vertical sync pulses from an LM1882 video sync generator,
which also provides synchronization control signals to the digital
logic.  The video data arrives at a rate of 30 frames per second, with
two interlaced fields per frame.  There are 525 lines per frame,
giving a line rate of 15.73 kHz.  Lines are separated by low-voltage
``blanking'' pulses and even lower-voltage ``sync'' pulses; fields are
separated by similar pulses of longer duration.  Between blanking
pulses, the AD775 flash A2D samples the input stream at a rate of 4.77
MHz (210 ns per pixel), giving 180 pixels per line.  The eight-bit
pixel samples are sent to the digital logic, which processes this data
and produces an output stream of pixels at the same rate.  This data
is fed to the inputs of a DAC0800 D2A, whose current output is
processed by an op amp and combined with sync signals to produce an
NTSC video signal appropriate for a greyscale display screen.

\end{subsubsection}

\begin{subsubsection}{Frame Differencer Module}

To locate regions of motion, the device performs a time-domain first
difference on each pixel of the frame.  In order to do this, it stores
an entire frame in a 256 kilobyte DRAM by cycling through all the
pixel row and column coordinates in the fast page mode of the DRAM.
The previous value and the current value of the pixel brightness are
given to a combinatorial circuit which calculates the absolute value
of the difference.  A block diagram of the Differencer and the input
portion of the Analog I/O module is shown in Figure~\ref{fig:diffblock}.

\begin{figure}
\epsfbox{jastr/diagrams/differencer.eps}
\caption{Differencer Block Diagram} All of the components of the
differencer are shown.  The input portions of the Analog I/O module,
the ADC and the Video Sync generator, are also shown.
\label{fig:diffblock}
\end{figure}

\end{subsubsection}

\begin{subsubsection}{Pong Rules Module}

This module, built from programmable logic, keeps track of the current
position and velocity of the ball and of the current score.  After
every frame, the x and y coordinates of the ball are incremented by
the velocity values, causing the ball to move across the screen.  When
the ball position and current pixel coordinates are equal, a bit of
the difference stream is tested, to determine if there is motion in
the video-in stream at the location of the ball.  If so, the ball then
bounces back and randomizes its velocity.  If the ball falls off
either horizontal edge of the screen, the appropriate player loses a
point.

\end{subsubsection}

\begin{subsubsection}{Bitmap Overlay Module}

Finally, the ball's coordinates, the current pixel coordinates, and
the eight-bit difference stream are sent to the bitmap overlay module.
The pixel's coordinates are subtracted from the ball's by discrete
logic, and the result is fed into the address lines of a PROM lookup
table and to the selector lines of a multiplexor, to produce a single
bit of the bitmap image programmed into the PROM.  This bit is XORed
with every bit of the difference stream, and the result goes to the
D2A and, finally, to the display.  The two high bits of the PROM
address lines are attached to a '393 which cycles roughly twice a
second; they select one of four images in an animation.  The effect
is that the display shows regions of brightness where the camera input
is changing, and that there is an image of a rotating cube
superimposed on the screen at the position of the ball.

\end{subsubsection}


\end{subsection}


\end{section}
