E reflects the status of the hidden e bit in the status register (SR). When e is 1, as it will be following power-on or a hard reset, the 816 is in 65C02 emulation mode, and E is driven high. When the CLC - XCE sequence is executed to switch the 816 to native mode, e becomes 0 and E is driven low. Simple enough.
MX is a little more convoluted, as it is two distinct signals multiplexed onto a single pin. WDC describes it thusly:
Quote:
2.20 Memory/Index Select Status (MX)
The Memory/Index Select Status multiplexed output reflects the state of the Accumulator (M) and Index (X) elect flags (bits 5 and 4 of the Processor Status (P) Register. Flag M is valid during PHI2 negative transition and Flag X is valid during PHI2 positive transition. These bits may be thought of as opcode extensions and may be used for memory and system management.
The Memory/Index Select Status multiplexed output reflects the state of the Accumulator (M) and Index (X) elect flags (bits 5 and 4 of the Processor Status (P) Register. Flag M is valid during PHI2 negative transition and Flag X is valid during PHI2 positive transition. These bits may be thought of as opcode extensions and may be used for memory and system management.
Unlike MX, using E is straightforward, since it is not affected by the clock phase the way MX is. Hook it up to something and if that something sees a logic 1 the 816 is in emulation mode. I'll get back to that in a minute, as I did find a use for E in my (still-under-construction) POC V2.0 unit.
In order to use MX, two latches are needed to produce separate outputs corresponding to the m and x bits in SR. One latch would be open during Ø2 low and thus would capture m's status. The other latch would be open during Ø2 high and would thus capture x's status. Realistically, a clock generator producing Ø1 and Ø2 signals would be needed to capture and latch these signals without getting into potential timing contretemps.
In an 816 system with a latch to capture A16-A23, Ø1 would be present, although the technique of inverting Ø2 to produce Ø1 will result in Ø1 lagging Ø2 by the propagation time of the inverter. With that prop time in the picture, it's conceivable the m latch could briefly see x before closing in response to the transition of the clock, and vice versa, leading to possible wrong outputs.
Hardware matters aside, the real puzzler for me was finding a use for either of these signals. However, a use for E soon presented itself.
In the firmware, power-on/self-test (POST) occurs in stages. During the first stage, several critical areas in bank $00 RAM are destructively tested, as the system will be unstable or not run at all if there are memory defects in those areas. Hence I/O isn't possible during stage one POST, since the serial I/O driver makes extensive use of two of these critical area. This means memory test failure can't be announced on the console. I didn't want to add a piezoelectric buzzer just to make noise due to a memory fault, so I had a dilemma.
The solution was to wire E to an unused gate in a 74AC14 Schmitt inverter that handles several other circuit functions. The output of that gate drives a LED that will illuminate when E is high. I originally planned to wire the LED directly to E, but decided I didn't want to impose the load on the 816.
Normally, the LED would be dark, since the 816 is switched to native mode at the beginning of the reset handler. Should a memory fault occur, the 816 will be switched back to emulation mode and halted with STP (SToP). That will cause the LED to illuminate, signaling to Houston that we have a problem. The LED, which is red, is labelled MCE in the schematic and on the board, MCE meaning “machine check exception.”
That leaves MX. Very recently, I had said I couldn't think of any use for that output. Well, more thinking—always a dangerous activity on my part, revealed a possibility.
Missing from the 816's extensive instruction set is a way to determine what the current register sizes are without clobbering at least one of the registers. There is REP and SEP to clear/set SR bits, but no corresponding instruction to report the status of m and x. I've encountered a number of programming applications where it would be useful to know that status without having to touch any registers. So it does appear MX has a useful purpose in life.
The question is how to make m and x appear as data somewhere in a way that can be tested with the BIT instruction. Anyone want to toss in their two cents on this?