Tuesday, October 16, 2007

Timers, Dip Switches and I/O

Well, it looks like I figured out why I could play credits, see the card backs but then the deal-draw button would cause the game to hang. The game code was in an endless loop waiting for an interrupt to set a variable to allow it to continue.

I proceeded to trace why the interrupt wasn't firing and found out the code was using "split timer" mode for Timer 0. I start looking at the 8051 core code and find out that it was never implemented! So, the only thing to do is wait for someone else to do it, or add it myself. I went for the later. After adding the code to support split timers, I discovered the 8051 core had some more bugs in the way it determined what timer mode was to be used. This bug (mistake) was repeated in the serial transmit part of the code, so I fixed it there too.

After these changes my driver started to work a lot better. The timing still seemed a bit wrong so I went back to the 8051 core looking for other bugs. Upon searching I also found that there were several opcodes with the wrong cycle counts. I update the code for that too.

I'm thinking the 8051 core may still have other issues to be found, but I have progressed enough to play credits to the end game. In other words, I can bet credits, hold cards, draw cards and obtain a payout. In between I am able to double up when the option is enabled.

I found out my game supports an "Autohold" feature which is really nice. The only way to enable it is to set one byte in the program code and adjust the checksum, but I may end up doing that for my real machine.

A couple of other misc thing I did was to add support for I/O addresses and the dip switches are now working.

At this point, some open issues are:

  • Door Closure
  • Sensing Coin-In
  • EEPROM support
  • Timing

I expect there will be more 8051 core to look at to determine the timing issues. The other open issues are just a matter of time.

1 comment:

Stefano Priore said...

When the driver is complete why don't you support the autohold feature via a clone romset?