All drive letter assignments whether in BIOS or Windows follow a drive type hiarchy.
Hard drives are assigned first, then removeable media drives.
The hiarchy is:
Primary Master,
Primary Slave,
Secondary Master,
Secondary Slave
However,if a HDD is on Secondary slave, it will be drive D: and not a CD drive on Primary slave.
I also know that from a DOS boot, logical drives in any extended partitions are assigned letters before any removeable media drives.
Logical drives are assigned 'default' letters in the same order as the primary drives based on where they are connected with the exception that all logical drives on a single physical drive are assigned letters in sequence.
Check this link for some more detail.
http://www.aumha.org/a/parts.htm
Then, there is software that allows letter assignments to be over-ridden.
http://www.v72735.f2s.com/LetAssig/index.html
Chas