November 25, 2024, 12:05:12 AM

heartbeat

Started by Hugh Aguilar, September 26, 2024, 01:05:32 AM

Previous topic - Next topic

Hugh Aguilar

Is there any way for the NEO6502 to get a heartbeat without an expansion card?

It would be great if the RP2040 could trigger the 65c02 IRQ regularly, like every millisecond. A heartbeat timer would help a lot in making video-games run at a constant speed. I would expect every video-game would need this, but I can't find any mention of how to do this in the documentation. The Commodore-64 had a "jiffy clock" that provided a heartbeat 60 times per second (this was derived from the AC power supply). As far as I know, all of the Commodore-64 video-games relied on this heartbeat to run at a constant speed.

It is not clear to me how to write a video-game without a heartbeat timer. I have read that Apple-II programmers would time how long their code took for each cycle, then add a delay loop to fill out the time needed to make the cycle take a constant amount of time (typically 10 milliseconds). Ugh! That is a crude technique! I don't want to do that.

If the RP2040 can't do this, then another possibility would be an expansion card with a 65c22 and use one of the timers to provide a heartbeat on the IRQ line. This adds an extra cost to the NEO6502. I would like my software to be usable by anybody who owns the basic NEO6502.

thanks --- Hugh

Hugh Aguilar

Quote from: Hugh Aguilar on September 26, 2024, 01:05:32 AM...another possibility would be an expansion card with a 65c22 and use one of the timers to provide a heartbeat on the IRQ line.

I do have in mind an application that could be done with an expansion card containing a 65c22 and an 8-bit ADC. This would be an oscilloscope. It would display the amperage draw of a machine in real-time on the HDMI display for the purpose of diagnosing problems in the machine. It is somewhat complicated by the fact that the machine goes through stages, so an off-the-shelf oscilloscope doesn't really provide the data the way that I want to see it.

Anyway, right now I just want to learn how the NEO6502 works by writing a video game, but I'm stymied by the lack of a heartbeat timer. Considering that the RP2040 is in control of all of the 65c02 pins, it seems easy and obvious that it should stroke the IRQ on a regular basis. It also seems obvious that games need to run at a constant speed irregardless of how much activity there is on the screen or how fast the processor is running.

Without a heartbeat timer, the NEO6502 fails at real-time video-games. It could still support board games or turtle-graphics in which you just want the code to run as fast as possible.

OS9 on the MC6809 had a heartbeat of 10ms. That should be adequate for video-games. The NEO6502 is faster though, so it could be 1ms. That should be adequate for data-collection on an ADC.