You need an Action Replay and the corresponding game ID. Install the cartridge or load the software, add a Master Ball modifier code for your specific Pokémon version from a code database, and activate it in-game.
Codes are version-specific — a Diamond code will not work on Platinum — so match the game ID exactly.