After entering each different room hit Y+A 3 times to become invincible. The cheat disables if you stop firing, so just shoot until the room is clear. You must re-enter the cheat in each room.To know if you entered the code right, try to pick-up cash or weapons. If you can't pick them up, you are invincible.
You can use this to reach the end of the game and beat the last boss.