Open blackjetrock opened 4 years ago
Can you think of an actual use case? How often might this be necessary?
Since it'll cost a GPIO line, and since I can't immediately think of a practical reason I might want it, I'm thinking that's maybe too high a cost.
I'm not sure where you've got to on the new board layout, but would it be possible to physically bring the SW0/1 signal out such that it's possible to easily solder a wire to it? That would allow it to be connected to a GPIO line on a temporary-ish basis, then later removed.
I'm still seeing the Mega clocking as a learning/debugging facility, but I haven't used the board in anger yet, so I reserve the right to change my mind. :)
I had a use case this morning when I tried to run the C version of the LCD test. There's a delay loop that has to have very different values for 4.5M and Mega clocked. The easy way out is to just have two versions of code, but that's a bit fiddly. Running the sigfnal to a pin would work, I think. Then you could jumper it if you wanted to. I'll look at that. Y1es the Mega clocking is a debug/learning facility. It runs pretty fast now though.
I just had a thought, We could do this fairly reliably by having the Mega write into some RAM location a signature that says it is clocking. Then it wipes that signature when it kicks off free running. It has to be a complicated value though, as you'd want it to not be present when running as a stand alone PCB with no Mega. Or you could flash stand-alone code for that scenario. It means you could quickly run the same code ans swap between mega clocked and full speed.
When running code that is dependent on the clock rate, for instance delay loops, it would maybe be nice for the Z80 to be able to know what rate it was running at so it could adjust the delay loop value to get the same delay time independent of the clock rate. It's tricky with the current hardware to do this, but we could just have two builds, one for 4.5MHz and one for Mega clocked. Alternatively we could have the SW0 )and/or SW1) signal routed to a PIO pin.
So, curent options:
Any comments on which option,or any other options?