The 40pin and 80pin cables have the same connectors at each end, but there are twice as many wires between each connector.
This image on Wikipedia shows a 40-pin cable next to an 80-pin cable. Click the image to zoom-in.
Another way to check if the IDE cable is 40pin or 80pin is to check what Ultra DMA mode your main hard disk is operating in. If it's in Ultra DMA mode 2, then it's likely connected with a 40-pin cable. Otherwise if it's Ultra DMA mode 5 or 6, then it's connected with an 80-pin cable. Most CD/DVD drives operate in Ultra DMA mode 2. From my experience, generally CD/DVD drives and Hard disks work fine on the same cable. However, even with a 40-pin cable attached to a hard disk, it will generally operate in at least Ultra DMA mode 2 rather than the legacy PIO mode.
As your CD/DVD drive on that cable is running in Master, one thing to try is disconnecting both the CD/DVD drive and hard disk from that cable, set the hard disk jumper to "Master" and connect it using the cableâ€™s IDE connector that was connected to the CD/DVD drive. Leave the CD/DVD drive disconnected for the moment, boot the PC and check what the IDE mode shows up for the secondary master. If this shows up as "Ultra DMA Mode" now, try shutting down the PC and switching to the other IDE cable connector (leaving the CD/DVD drive still disconnected and HDD as master) and boot up again. Finally, if it still remains in Ultra DMA mode, change the jumper on the CD/DVD drive to set it as 'Slave', connect it back on the connector and check the IDE modes once again.
If the HDD only operates in Ultra DMA mode while on one connector, but not the other, then the IDE cable is likely damaged. However, if the hard disk only operates in PIO mode with the CD/DVD drive also on the cable, then there's likely a problem with operating both drives together the same IDE cable. If the HDD still remains in PIO mode even on its own on the IDE cable, the last thing I can suggest is swapping the IDE cables.
You can try an updated Ultra DMA driver (if available), but from my experience, generally Microsoftâ€™s own old ATA driver works fine even with recent hard disks. However, just in case itâ€™s the driver, you can try looking up the website for your motherboard and seeing if thereâ€™s an updated Ultra ATA driver available for it.