Some drives will have a label/sticker showing the various jumper positions.
On some drives, the pins themselves are marked
CS MA SL
(either silk screened on the board or stamped into the plastic or metal above or below the pins.)
Presuming your new drive is a retail purchase, the manual should have a pin diagram. Failing that, hit the manufacturers web site - you'll find them there.
Master or slave is determined by the drives position on the cable.
Most IDE cables have 3 connectors, one at either end, one in the middle. If the connectors are colored, one is blue, one is grey, one is black.
The device at the end of the cable is master. (black)
The device in the middle is slave. (grey)
The other end is the motherboard. (blue)
If you only have one device on the cable, it must be at the end, and it must be master.
Because it us usually the farthest away from the motherboard, the optical drive is usually always master.
As already stated, the optical drive is usually on a different bus (and cable) than the HD. You can have more than one device as master *as long as they are on different cables* You cannot have 2 masters (or two slaves) on the
same cable.
If you have an MDD system the upper drive is master.
If you have a Quicksilver with a zip drive, the optical drive is master, the Zip is slave.