While in-game, the master code sequence is entered using the directional pad for the directional inputs. Press the following in order: up, down, triangle, X, X, left, O, square, O, R1, down, R2, right, L1, R1, square, L2, triangle, X, triangle, X, O, square, O, square, triangle and X together, square and O together, then L1, R1, L2, and R2 simultaneously, and finally start and select together.
The trick is speed. You have to input the whole sequence very quickly, so it helps to practice the button presses beforehand. Getting the timing right is usually the hardest part.