On to the next mystery "eureka" reads. A reminder.
Number | R/W | Program Counter | Address | Value | Notes |
---|---|---|---|---|---|
4 | R | F305 | 8xxx | FF | Occurs when move made. |
5 | R | F309 | 8xxx | FF | Occurs when move made. |
When I dumped the information from each of these I started to see a pattern.
The FFs are what I return no matter what.
When CHESSmate moves first.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
R F305 8C00 FF
R F309 8C01 FF
When CHESSmate moves second.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R F305 8C00 FF
R F309 8C01 FF
R F305 8C20 FF
R F309 8C21 FF
R F305 8C40 FF
R F309 8C41 FF
R F305 8C60 FF
R F309 8C61 FF
R F305 8C80 FF
R F309 8C81 FF
R F305 8CA0 FF
R F309 8CA1 FF
R F305 8CC0 FF
R F309 8CC1 FF
R F305 8CE0 FF
R F309 8CE1 FF
R F305 8D00 FF
R F309 8D01 FF
...
R F305 8FE0 FF
R F309 8FE1 FF
Now the 8xxx address space implies that this has something to do with the 6530-024 RRIOT chip, but I had been led to believe that the 1K RRIOT ROM was not being used by CHESSmate. Here is the only place in the code again that makes these reads.
F303 B1 76 LF303 LDA ($76),Y F305 48 PHA F306 C8 INY F307 B1 76 LDA ($76),Y F309 85 2A STA $2A F30B 68 PLA F30C A2 11 LDX #$11
You will notice that the two reads are made (indirectly) through a memory address. This would make it difficult to determine what memory was actually being accessed by just looking at the code, hence the misleading no RRIOT ROM assumption.
The pattern of the reads suggest a search, skipping 32 bytes after each step. The CHESSmate manual suggests that the game has a cache of 32 classic chess openings for up to 16 moves each. So the RRIOT ROM most likely contains these opening moves since (32 bytes per opening) x (32 openings) = 1024 the size of the ROM. I had always assumed that the opening moves was part of the main ROM.
Another little eureka moment for me. Of the four sites that had CHESSmate ROMs only one of them had a second 1K "additional" ROM. I assumed this must be the opening book so I included it in the emulator and mapped it to the 8C00 to 8FFF memory space, and it worked.
When I make my first move of the game now, by dumping the read info I can see CHESSmate searching through the book until it finds my move. You can tell it's "in book" because it will counter move immediately without the blinking the display while "thinking". Different opening moves show a different search "depth".
Another mystery solved.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.