Thursday, November 29, 2007

3 Card Poker Diversion

Looks like my MAME adventure has changed course slightly for the time being. After learning so much about the PE+ hardware and emulating it, I decided to try my hand at creating a new romset for this platform from scratch!

The results so far are the many pictures posted here. I decided to create a game that is not currently found on this platform, and chose to go with a 3-card poker game.

The rules of the game are fairly straight-forward. You and the dealer are dealt 3 cards each and you must obtain a higher hand than the dealer. It is classic stud poker, where you don't discard and draw.

Besides the normal "ante" wager. You can place a bonus wager on the final value of your hand dealt. This "Pair Plus" wager pays even if you end up losing the hand. The bonus wager only pays if your hand is a pair or better. A paytable determines the payout for each of the bonus hands.

Once you receive your hand you can decide to either play or fold. If you play, you must place a second wager that matches your original ante. If you fold, you lose your ante wager, but can still receive your bonus payoff if you have a pair or better.

If you decide to play, the dealers cards are revealed and you are paid even money for your ante wager if you have a higher hand than the dealer. If the dealer hand qualifies (Queen high or better), your play wager also pays even money, otherwise its a push. If a tie occurs, you push both bets.

I'm developing the application using SDCC and compiling for the i8052 platform. Once compiled I convert the .HEX file to a .BIN file and test it under MAME. So far I have the video, inputs and sound mostly working. Its interesting to code from the other side of the platform. Things as simple as random number generators (which is done), etc. can be a pain to figure out, but once I am done, I will have a solid SDK for building other games.

I have been trying to create a game in the same style as IGT and therefore I have been adding support for the multiple operator screens that are used to setup the machine.

I will eventually burn the game onto a chip and test it in my real machine. But I want to make sure I have most of the bugs worked out first in MAME. Burning chips and disassembling the machine to pop in the chip takes too much time, but will need to be done sometime in the future to make sure I didn't miss something in the code (like the watchdog timer which the MAME driver ignores).

There is still plenty of code required to finish the game, but I am learning a lot about this machine as I go. And I currently have a lot of useful code for my PE+ SDK.

Thursday, November 8, 2007

Superboard, Keno and Slots

The PE+ machine has at least two varieties of motherboards. The basic board I have been emulating and the superboard version. The superboard has an additional socket on it for "game data". The superboard is backwards compatable with most or all of the non-superboard games (those that begin with PP or PS etc). The superboard specific games generally are in the format of XPnnnnnn or XSnnnnnn with game data roms in a format of XnnnnnnP or XnnnnnnS. (P for poker and S for Slots)

Internally, the super board maps the game data rom in all the external addresses the non-superboard had not used. After tracing the schematics, I determined the addresses are $1000, $3000, $5000, $7000, $9000, $B000, $D000 and $F000. So even though the game rom is stored on a 64k chip, only every other page actually can contain data. This essentually adds 32K of information to the superboard romsets.

With these changes added to the driver, I can now support the rather large list of superboard roms too. The slot pictured above is the Triple Triple Diamond Video Slot (XS000006) romset for the superboard. The slot driver uncovered some additional issues with video processing that I had not encountered before. Once I figured out the issue, the slot reels lined up nicely and the gameplay was correct.

Another romset now supported is the Deuces Wild Video Poker (XP000019). It is similar to many of the video poker romsets but has a few different graphics and gameplay with 2's being wild.

Lastly, I added support for a non-superboard version of Keno (KE1012). The romset I have has a bad dump of the CG files so there is some residue on the screen on some of the larger letters. The game uses a lightpen for input, so I had to add lightpen support, but it seems to be working just fine now.

At this point I am finding some small issues with the coin hopper timing when the machine tries to payout coins. I sometimes get a hopper empty or coin-out timeout message. It appears I will need to do something similar as the ABC optics for the coin-in mechanism, but not as complex. Some initial code appears to work on the non-superboard romsets.

Monday, November 5, 2007

EEPROM Support and Blackjack

Since the last time I posted, I worked on adding I2C EEPROM support to the driver. Initially I spent a bunch of time creating the code I needed from a couple different sources I found in the MAME code base. Once I got the code working, I began to test the driver and things looked pretty good. A couple of days later, another MAME developer (smf) produced a much better library then the one I had cobbled together and helped me hook it into my driver and replace the I2C code I had already in place. The newer I2C driver worked great too and is now part of the MAME core.

Now that the I2C code is in the driver, a lot of hacks have been removed. The following is the sequence of events that take place when you load a game for the first time.

  1. The first time in, the CMOS (battery-backed RAM) and the EEPROM will both be empty. You will get a "Call Attendant - CMOS Data" screen, and when you open the door and press the Self-Test button, it will attempt to load values from the EEPROM to the CMOS.
  2. The next time you start the game, you will get a "Call Attendant - EEPROM Data" screen. When you open the door and press the Self-Test button, it will attempt to load the EEPROM with default data found in the game code.
  3. At this point, both the CMOS and EEPROM contain some default values and you must enter operator mode to fill in any missing values such as denomination.
  4. From that point on, all restarts of the game will react properly and the game will display.

I have found a few games that are having issues when using the 8052 specific Timer 2. These games do not let you proceed past step 1 as of yet. I'm thinking the I8051 driver in MAME may not be working for this scenario, or I am missing some other piece in my driver.

Finally, as you can see from the picture above, I have included in the driver support for a new fully working clone (PEBE0014) which is the IGT Blackjack program that also runs on the PE+ platform.