Hi, On the Plus4 this method would not work as the memory refresh cycles also do a fetch from $FFxx addresses. The circuit would identify a memory refresh as reset... On the C64 probably it is not an issue with 3fxx refresh cycle addresses (if I remember well). Regards Istvan -----Original Message----- From: Michał Pleban Sent: Tuesday, December 27, 2016 11:56 AM To: cbm-hackers@musoftware.de Subject: Re: Switchless ROMs Hello! Jim Brain wrote: > I still think you can trigger on the reset vector pull to get back to > the original ROM. I think you can indeed. Here's an idea how this might work: 1. Have the CPLD check for reset vector access, that is, for a fetch from $FFFC immediately followed by a fetch from $FFFD. This will catch the reset sequence as well as JMP ($FFFC) which is also a kind of reset, but it will not catch other accesses to the vector like LDA $FFFC. How to detect if the second fetch occurs "immediately"? There is no clock on the CPLD (though you could supply one through an external crystal), so the easiest thing is to create a simple RC delay circuit that is charged upon first access, and discharges quickly (in a matter of ~2 microseconds). If the second access occurs when the circuit is still charged, you know that it happened "immediately" so this is a reset sequence. 2. Upon the fetch from $FFFD, switch to bank 0 (or whatever holds your switching KERNAL). This will have the following effect: - low byte of the reset vector was fetched from the old (unknown) KERNAL, but: - high byte of the reset vector will be fetched from your KERNAL. So you control the upper byte of the reset vector now. Have this upper byte point to a page full of NOPs (i.e., if the byte at $FFFD is $E1, fill the locations $E100-$E1FF with NOP and have your code start at $E200), so whatever the low byte was, you will always land in a known location. 3. The switching KERNAL allows the user to choose the KERNAL to run. Select the KERNAL by reading from some magic page (for example from $E0xx), read its reset vector (don't jump directly to ($FFFD) since it would trigger you back to the switching KERNAL :-P) store it somewhere and jump. 4. Upon reading from $E0xx, the latch will deactivate itself so that further reads will not mess things up. The latch will be activated again when the CPLD detects the reset sequence. I think this should cover all possibilities. Regards, Michau. Message was sent through the cbm-hackers mailing list Message was sent through the cbm-hackers mailing listReceived on 2017-01-01 23:00:01
Archive generated by hypermail 2.2.0.