Things I couldn’t find elsewhere

Atari ST wakestate nudger

Atari English Retro Uncategorized

3 minutes

Back in the day, those of us who did advanced video tricks on the Atari (opening borders, hardware scrolling on hw without hardware scroll) knew that there were differences between systems, and sometimes on the same system. After some trial and error you built in some compensation which made things work “always” on all systems.

Today we know that a lot of this comes from the fact that the GLUE and the CPU, while both running at 8MHz, can be offset from one another 0-3 cycles (since the master clock everything’s divided from is 32MHz). This is “randomly” (but not random, it depends on specific silicon manufacture timings, phase of the moon etc) selected at cold boot and stays the same throughout resets etc.

Modern code can detect which of these 4 offsets the machine is currently in, compensate for and exploit to do even more advanced tricks than was possible back then. However, testing your code on hardware (or, which I’m currently doing, lots of logic analyzer tracing to document all timings between ICs) means you have to power cycle, check wakestate, power cycle, check wakestate, etc - lots and lots of times. Additionally, most machines only really like two of the wakestates (when cold and warm) and the other two might only rarely be stumbled upon.

Recently Ijor at Atari-Forum, whose work on decapping Atari ICs and painstakingly recreating their inner workings has been absolutely invaluable, mentioned that GLUE had a TEST pin that should, if held HI during RESET, clear its internal clock divisor counter. Since that counter gives rise to the wakestates, this was intriguing. I got to work.

Now, the GLUE TEST pin (pin 52 on the PLCC version, pin 53 on SMD) is tied to GND on all Atari motherboards. After having tried for a while to sever all traces to it only to find out that there's one underneath the socket as well, I gave up and just desoldered the pin and pulled it out from the socket. Now I could add a new easy to solder to pin onto the GLUE itself.
After that, I wired up a one-shot 74121 to send a 170ns pulse (close enough to 125ns, and it's what I had laying around in resistors and capacitors) to GLUE whenever RESET was pushed. Additionally, I made this selectable through a switch that either selects original behaviour where wakestate is assigned at cold boot, or the new behaviour where it's advanced more or less predictably at every reset of the computer.

It works, perfectly. An activity that before could take sometimes hours of power cycling can now be done in just a few soft resets. Additionally, a pin that has been tied to ground in all Atari STs ever built finally has some end user purpose, after 30 years. Awesome.

(I expect the number of persons in the world who will build this circuit up to be around 1 - me. If for some reason I’m wrong, please feel free to ask me if there’s anything unclear in this writeup!)