Close

Chess Clocking

A project log for Commodore CHESSmate Reproduction

The plan is to make a reproduction of the dedicated chess computer CHESSmate released by Commodore in 1978.

michael-gardiMichael Gardi 02/14/2024 at 21:582 Comments

The chess clock mode on my CHESSmate Reproduction is now working. It was relatively easy to simulate the 6530-024 Timer by triggering 240 interrupts each minute, which is what the CHESSmate firmware is expecting.

This accounts for the read to 8B0E (the READ TIMER INTERRUPT register) which clears the current interrupt, and the write to 8B0F (the DIV BY 1024 ENABLE INTERRUPTS register) discovered in my Eureka moment. 

Number                                     R/W            Program Counter                                       Address                                      Value                    Notes
   1           R           F3908B0EIs Timer Interrupt?    Occurs when a move is made
  2         WF0B28B0FF5 Set Interrupt     Occurs when move is made

Writing F5 to the 8B0F register starts a 250 millisecond timer that will trigger an interrupt when it expires. Once the interrupt has been processed a read to 8B0E will clear the interrupt. When the interrupt service routine processes 240 such interrupts, the minute timer for the current player is incremented by 1. The fractional part, 1/240th of a minute is retained between moves.

Chess clock mode is "stand alone" in that you cannot play chess against CHESSmate when you are chess clocking and vice-versa.  You get into chess clock mode by pressing C then ENTER. Pressing H starts WHITE's clock running, then pressing A stops WHITE's clock and start's BLACK's clock.  H then switches back to WHITE, then A BLACK and so on. You can press the E key to stop the current clock then E again to restart it.

Here we see that BLACK is moving and has used up 2 (+)minutes of their clock. When BLACK is done moving they will press H to switch the clock to WHITE. CHESSmate remembers and applies the fractional part of the time used between moves. 

Discussions

Ken Yap wrote 02/15/2024 at 21:19 point

I wonder if ths slowness you experienced with the AVR simulation was due to the lack of a timer?

  Are you sure? yes | no

Michael Gardi wrote 02/15/2024 at 21:23 point

Good thought Ken, but so far as I can tell the timer is only used when the game is in chess timer mode. I think that your original suggestion of too much GPIO activity is probably still the best theory.

  Are you sure? yes | no