Uncle Sean's Electronix Fun Page
Home
Contact
Links
Legal

One Chip Video Poker

This is a simple video poker game for the PIC 16F628 and a 20x4 character LCD. It's written in PIC assembly for MPASM.

I started the project in 2002. I originally intended it as a birthday present for my brother, who is an enthusiastic if occasional player of casino video poker. This Mark I version foundered, though, as the PIC 16F84 didn't have quite enough program ROM to handle it; I shelved the project until just recently when I got a programmer that could handle the 16F628.

As of this writing (Aug. 10, 2004) I still haven't gotten around to making a “production model” suitable as a gift, but the brother may yet receive one.

If you build this project, please email me and let me know what you think of it!

For Those Who Just Want To Build It

The Hardware Section is for you it shows the schematic and parts list and has the .hex file ready to burn!

Overview

Why Video Poker, you ask?

  1. It's fun!

  2. It's a simple game requiring no real strategy on the computer's part - all it has to do is deal and score. An ideal candidate for a tiny computer.

  3. And yet, implementing it touches on a wide range of game programming, general assembly language, and PIC-specific techniques.

  4. It can be built with a minimum of parts and no need for a printed circuit board. The LCD is by far the biggest expense in this project, assuming you already have the computer and programmer board needed for PIC development. With a bit of luck, though, 4x20 displays can be found for under $20 U.S. at surplus shops - and sometimes they're not too much more than that brand new. Some possible suppliers are listed on the links page.

The following sections discuss the innards of One Chip Video Poker in great, even exaggerated, detail. I'm hoping this will be useful to novice assembly programmers in finding out ways to handle various types of tasks, while not being too tedious for the more advanced programmer to read.

I developed One Chip Poker in stages, testing each stage separately to make sure they worked. This approach, called unit testing, is a good way to organize complex projects. By PIC terms, One Chip Poker is fairly complex. The sections about software show unit tests for the particular part of the program they're describing.

The sections

Section

Comments

Video Poker: The Basics

an introduction for those unfamiliar with the game.

The Hardware

the schematic for the project, plus the parts list and .hex file. The same circuit is used for all the unit tests too.

The Random Number Generator

The heart of a game of chance is the Random Number Generator (RNG). This section presents the one used in One Chip Poker

Dealing

How the game represents cards and deals hands.

Drawing

Once the player has chosen cards to hold, this is what the game does.

Scoring

How to spot a winning hand.

Bets and Payoffs

Credit where credit is due - and debt too!

Gallery

Pictures of readers' One Chip Video Poker versions!


visitors since 6/1/2005.