in the sence of EIDE or IDE Blue is for master, Black is for Slave...if you have the drive on CS or cable select it will know what it is by the color thats in it. Typically your primary master is your main hard drive. If you want to switch it to a sata drive you can do that, though windows XP will have some issues with that, linux how ever will not. For your Dvd drive it only needs 40 pins thats based off older standards, I personally use a 80 pin cable to my dvd burner, if its a just a reader or rom drive it doesn't need more then 40 pins.
You can mix and match how ever you'd like, though you may get issues if you step out of the way these things are designed to run.
Make sure the cable end is the correct end if selecting cable select, and that you only have one master on each port. Also if your switching to a Sata HDD make sure to enable the sata ports in your bios and to make sure they function on the non-raid setting, most newer sata chipsets include software raid, and some are by default on the raid setting.
***You can swap cables, I wouldn't suggest using a 40 pin on your HDD, as you'll notice a slow down in performance for read and write. As for using a Sata cable on an EIDE HDD you can with an adapter, you can also use an adapter to make it work on a usb port.