The PC Engine uses the same chip as the Genesis 3-button pad: the 74157. Basically, the console sends a high/low signal on a select line, triggering four different signals. The buttons (I, II, RN, SL) are returned when the select line is LOW, the d-pad is returned when select is HIGH.
All the TG and most of the PCE pads also had auto-fire, which required the use of another chip: the 74163. This simple binary counter is advanced by the select line, and every fourth or eighth 'pulse' it activates the I and II buttons, effectively creating two rapid-fire speeds.