'137 is a latching decoder - like a '138 but with a latching input.
Ah, I'm looking at the wrong datasheet again. I now vaguely recall looking for one of those for something or other, but giving it over because I was looking for a faster propagation time.
But the output is LED's, so 17ns-24ns propagation delays are not an issue.
The question is whether valid data from the address bus is latched after LE rises, as opposed to address lines on the move.
Is the critical value there the An to /LE Hold time of 5ns?
[Edit: looking at a datasheet from a different maker seems to confirm that's the critical value.]
In any event, the active low selection signal to the '137 has to be qualified by PHI2, similar to the octal latch for the segment data.
... As I read the sheet, if I feed it with the address low bits, it gives a valid decoded output as long as RnW/~latch is low; when it goes high, it latches. It doesn't care whether it's a read or a write; it's not using the databus at all. But it will select the desired digit and key column depending on the address read. At the same time it can return the keycode value.
Yes, that would be the idea.
Just like the segment data latch, it also seems like it must be qualified by PHI2.
The reason is the address decode is going to be rising because of the changing address lines, while the "data" being latched are also address lines, which will be arbitrarily changing due to the address of the next instruction to read.
So the desire is to have the /LE line rise
during the 65C02 address hold time following the drop of Phi2.
And the select is propagating through several decoders, while the addresses being decode are effectively lag-free, so the likelihood of latching in the wrong address bus state without PHI2 qualification seems quite high.
In any event:
- Both the segment code latch and the latch side of the encoder are latches being integrated into a 65xx bus;
- so it would be prudent to qualify them with PHI2 with a single propagation delay to CLK or /LE.
- There is no functional advantage to separating them.
And two gates of a quad 2-input NAND gate would suffice, the first to invert the address select, the second to form !( !/led & PHI2).
So the first write sets the LED pattern, then the key value is read at the same time as setting the column. Assuming I use the same decoded address for column and keycode, of course.
However, having the two different latches on two different addresses (segment and column), means that two different active low selects must be qualified by PHI2=1.
I'm not seeing an advantage for having the circuit do A first and then B&C concurrently, just a need to duplicate effort on the need to qualify latches by PHI2.
Having the two latches share the select because of "sta led_addr,Y" style operation only uses two gates of a quad nand, or one dual input nand and some other inverter for the /led select.
And there is no conflict in having them on the same select.
Then the keys octal driver can be put on a second select.
When you originally wrote:
... I think you nailed it then. I don't see why you keep shying away from that, when it is the most hardware efficient approach.