GARTHWILSON wrote:
Jeff Laughton has made extensive use of these [different NOP opcodes], and has a handy table at
viewtopic.php?p=36187#p36187Yes, some of these can certainly be useful. A one-byte, one-cycle NOP is great when you need to pad execution time to an exact number of cycles. And the 2- and 3-byte NOP's are a good choice for the well-known trick that saves memory by replacing a BRA which skips forward by only 1 or 2 bytes. That's explained in the same post. Traditionally, folks have used BIT or CMP for this, but using these NOP's instead means the flags won't get altered.
The stuff about incrementing or decrementing an op code is admittedly pretty far out, and clearly won't be widely applicable. But Self-Modifying Code is a powerful way to solve some otherwise impossible problems, and it helps to brainstorm lots of different ideas. I would recommend reading Garth's entire article (rather than focusing on this particular tidbit).
BigDumbDinosaur wrote:
WDC says in the data sheet that all memory and I/O accesses should be qualified by VDA and VPA. I'm merely doing what they recommend.
If you say you found the OR-gate route using VDA and VPA to be convenient then I have no quarrel with your choice. As for the WDC recommendation, it strikes me as excessively cautious or just plain carelessly written. What would be the benefit from protecting
memory from invalid addresses??! I've tried at length to identify some justification for this (and hence for the OR gate), but what I came up with is awfully tenuous:
- it means IO is enabled during code accesses. But most of us don't wish to fetch code from IO devices.
- it means memory is disabled during dead cycles. But memory usually doesn't require this protection. Are there any exceptions? Certain specialized memory devices have paging features built in, and it may be that access to those features involves a specific "knock" sequence -- accesses to certain addresses as a means to unlock the feature. But AFAIK the knock sequence involves writes, and dead cycles are always reads. Edit: except the one in the Modify cycle of an '02/'816 R-M-W, but as I said these attempted theories do seem awfully tenuous.
BigDumbDinosaur wrote:
I don't believe the prop time of a single OR gate is an issue at any speed at which the 65C816 will be usable.
8 ns for an 'AC32 OR gate will almost double the access time for a system using commonly available 10 ns RAM. No doubt there are situations in which this penalty can be tolerated. But I've explained alternatives to the OR, including a VDA-only solution with zero gates. Engineering is based on identifying, weighing, and choosing between alternatives, in light of prevailing circumstances and priorities (which of course can vary widely). In a new design I'd begin by evaluating VDA-only solutions, and deviate from those only if other factors outweigh the loss of simplicity and timing margin.
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html