I used to know this pattern, but I lost it and never bothered to figure it back out again. It works like this. Each Robot Master has ten possible dots in the password grid: five for if you have defeated him (and therefore have his weapon) and five for if you haven’t. The reason there are five is because the numbers change depending on how many Energy Tanks you have.
To create a password, all you need to do is pick a column for how many E-Tanks you want, then fill in the appropriate dots. For Robot Masters, the first digit defeats him and gives you his weapon, the second leaves his stage available. Obviously, you only want to use one of the two numbers separated by slashes.
| E-Tanks: || None || One || Two || Three || Four|
|E-Tanks || A1 || A2 || A3 || A4 || A5|
|Air Man || E3/D2 || E4/D3 || E5/D4 || B1/D5 || B2/E1|
|Bubble Man|| D1/C3 || D2/C4 || D3/C5 || D4/D1 || D5/D2|
|Crash Man || C5/E2 || D1/E3 || D2/E4 || D3/E5 || D4/B1|
|Flash Man || C1/E4 || C2/E5 || C3/B1 || C4/B2 || C5/B3|
|Heat Man || B2/D5 || B3/E1 || B4/E2 || B5/E3 || C1/E4|
|Metal Man || E5/E1 || B1/E2 || B2/E3 || B3/E4 || B4/E5|
|Quick Man || B4/C4 || B5/C5 || C1/D1 || C2/D2 || C3/D3|
|Wood Man || D3/B5 || D4/C1 || D5/C2 || E1/C3 || E2/C4|
This data was originally from John Snow and later supplemented by (*gasp*) Nintendo Power.