Jissen Mahjong controller
This is a 21-button controller used by the following Capcom games:
- Ide Yousuke Meijin no Jissen Mahjong
- Ide Yousuke Meijin no Jissen Mahjong 2
Input ($4016 write)
7 bit 0 ---- ---- xxxx xRRS ||| ||+- Strobe |+-- Row selection (bit 0) +--- Row selection (bit 1)
Output ($4017 read)
7 bit 0 ---- ---- xxxx xxDx | +- Serial data
Reading the buttons is very similar to the standard controller, but one of three rows is selected for loading values into the shift register depending on the contents of the two Row selection pins while the Strobe bit is high.
After toggling the strobe bit from 1 to 0, the controller will return 8 bits worth of data (1 bit per read) based on the "row selection" bits.
Row 3 returns: <empty>, ロン, リーチ, チー, ポン, カン, Start, Select Row 2 returns: H, G, F, E, D, C, B, A Row 1 returns: <empty>, <empty>, N, M, L, K, J, I Row 0 returns the bitwise OR of rows 1 and 2.
Like the standard controller, buttons return 1 when extant and held down, 0 otherwise.
The buttons are arranged as a 3x8 keyboard matrix similar to the Famicom keyboard. A variety of diodes, resistors, and an NPN BJT pull one of the rows low; the eight columns are then loaded into the same 4021 shift register as used on the standard controller.  The Serial Input to the 4021 is tied to ground; all subsequent reads beyond the first eight should return 0V (logic 1 due to the 74368 inside the Famicom).
There are (at least) two hardware revisions of the PCB inside,  but no behavioral differences between the two are known nor any believed to exist.