I am now writing interrupts in protected mode and they must communicate to hardware with I/O Ports. Anyway floppy is easy but I'm confused at CD-ROM. I found in internet controlling the HDD through the ports 0x01F0-0x01F7 (which are for Primary IDE controller). From here (on my PC there isn't front panel ) I see that CD-ROM is connected with MotherBoard to the IDE1, and HDD is connected to IDE0. All the documentation says IDE controller... So it must means that there is one controller for IDE1 and one for IDE0 and if I decide to change the CD-ROM with second HDD it will be commanded the same way as CD-ROM was, which seems quite inproper to me. The controller must be on the device itself so changing the device change the controller.
So does IDE controllers are motherboard specific or device specific?
CD-ROM confusion
You have two IDE Controllers namely Primary and Secondary IDE Controllers. Each of these allow up to 4 (As stated in newer T13 Documentations) IDE Drives to be connected to them. Therefore, each of the IDE Controllers have Drive#0 and Drive#1. So we have IDE0.Drive0, IDE0.Drive1, IDE1.Drive0 and IDE1.Drive1. You control these IDE drivers through the port addresses assigned to their Controllers. Each controller has a byte-long register called the Device/Head Register. In this register, you specify which one of these drivers on that IDE Controller you are talking to.
For example, if you want to talk to Drive0 in the primary IDE Controller (IDE0), you will set the DEV (Device) bit of the Device/Head Register of that controller to zero. Or if you want to talk to Drive1 on IDE0, you will set the DEV bit to 1.
About CDROM, you will talk to them using a series of bytes or strings known as packets (usually). You can read more about this in T13 documentations. This standard is known as ATAPI (Advanced Technology Attachment Packet Interface).
For example, if you want to talk to Drive0 in the primary IDE Controller (IDE0), you will set the DEV (Device) bit of the Device/Head Register of that controller to zero. Or if you want to talk to Drive1 on IDE0, you will set the DEV bit to 1.
About CDROM, you will talk to them using a series of bytes or strings known as packets (usually). You can read more about this in T13 documentations. This standard is known as ATAPI (Advanced Technology Attachment Packet Interface).
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.