GalagaIoT
Creating a web based IoT Galaga high scores capture seemed like a worthwhile project.
There are some good solutions that already exist that include JROKs fine Galaga Enhancement pack but it is bordering on unobtanium (for me in Aus) and does not meet all my requirements.
Behold GalagaIoT.
Requirements:
Record System Up (powered on times)
Time Stamp High Scores
Record Any Highest Score since last power on
Store virtually an unlimited number of High Scores
No ROM code modifications
Low(ish) Cost $20 AUD ($8 GAL, $2 74ls273, $4 ESP8266, $3 PCB, $1 3.3v reg, $2 caps and resistors etc)
Bonuses:
Learn about GALs
Experiment with Kicad
Learn about Galaga, one of my all time favourites
Could be expanded to log play time statics,, such as individual game play times, total game play times.
Maybe possible (with significant modification) to repopulate the High Score table with the 5 highest scores at power on.
Fails:
Does not repopulate the high score table at reset or power on.
Does not increase the number of digits in the high score from 6 to 7 (as I believe the enhancement pack does.)
Only records High Scores that appear at the very top of the High Score Table. If a player makes it into the high score Top 5 but is not the highest then the score is not recorded. (Future enhancement perhaps)
How it Works: Summary
Basically Galaga address bus is constantly monitored for write accesses that relate to high score updates. Whenever there is an address hit, the data on the data bus is latched and stored in an array.
The array is constantly scanned for tell tale signs that a high score update has occurred (as distinct from random writes that occur during Galaga's startup sequence)
The high score and the players initials are then sent to a web server for further processing, storing and displaying.
How it Works: Details
Whenever there is a new *top* high score (just getting into the high score table does not count unless it is the top score) Galaga will copy it from screen memory at location 83ED - 83F2 to ram location 8A20 - 8A25 (6 digits on reset RAM will contain " 20000" but stored as 00 00 00 00 02 24)
It then initialises the initials stored at 8A3E - 8A41 (3 chars) to "AAA" and waits about 30 secs for the player to enter their initials.
If the player enters their initials, then these are copied to 8A3E - 8A41 if nothing is entered Galaga again writes "AAA" to RAM locations 8A3E - 8A41 .
GalagaIoT constantly monitors the address bus (Buffer Address Bus "A") and records in an array (score[]) any writes to the high score and initials memory locations 8A20 - 8A25 and 8A3E - 8A41 respectively.
GalagaIoT also converts Galaga character code (I call GALASCII) to ASCII. GALASCII codes of interest are 0x00 - 0x09 -> 0 - 9, 0x0A - 0x23 -> A - Z, 0x2A -> "." and 0x24 -> " ".
It also continual scans the array for a match of "AAA" which signifies a new high score has just been achieved and the system is waiting for initials to be input.
GalagaIoT then waits 30 secs (for the initials entry sequence to finish) and then assumes that the last 12 characters in the array will contain the high score. (Yes, its a cludge). These characters (eg "36250AAASAM") are sent to the webserver where they are further processed (see galagaHS.pl). Processing includes replacing AAA with " " , "b" with " " and "c" with "." It then appends the score/initials combination (eg "36250,SAM") to the high score file.
The high score file is then included as part Galaga.htm whenever a browser points to it.
A GAL16V8 (Generic Array Logic) is used to monitor the address bus for any address hits. It monitors the physical bus (Buffer Address Bus "A") at RAM 2114 location 3E on the Galaga Video PCB. There is only 10 address lines (A9 - A0) so the GAL is only matching a address hits in the range of 0x220 -> 0x225 and not 8A20 -> 8A25). For the hit to be valid the write enable (WE) and chip select (CS) pins must be also active. See galaga.pds for the GAL program/config file.
The GAL asserts a negative going clock (output...
Read more »
PALASM 4 Ver 1.5 found at http://www.pldworld.com/_otherplds/palasm/-engr.uky.edu/_melham01/ee481/software.htm