As the title. Can I use the int command to read some sectors in the compact disc (CD)?
By the way, the CD can also store the boot code in the first sector, right?
Can I read discs with interrupts?
-
- Member
- Posts: 106
- Joined: Sat Feb 08, 2020 11:11 am
- Libera.chat IRC: sunnysideup
Re: Can I read discs with interrupts?
Architecture?
If x86, are you in real mode/pmode?
I'm guessing you're in real mode and you want to read the disc using BIOS interrupts.. Is that right?
If x86, are you in real mode/pmode?
I'm guessing you're in real mode and you want to read the disc using BIOS interrupts.. Is that right?
Re: Can I read discs with interrupts?
You can read with BIOS int 13h from CDROM:
Please make sure that BIOS interrupts work only in real mode or VM8086 mode. And yes, you are right, first sector on CDROM is bootable sector, but it is probably format by filesystem ISO9660 https://wiki.osdev.org/ISO_9660 .
Code: Select all
;read CDROM
mov ax, 0x1000 ;segment for your data - edit it for you
mov es, ax ;set segment register
mov bx, 0 ;offset for your data - edit it for you
mov ah, 0x02 ;read function
mov al, 1 ;number of read sectors - max 72 sectors(two cylinders)
mov ch, 0 ;cylinder
mov dh, 0 ;head
mov cl, 1 ;sector
mov dl, 0xE0 ;CDROM / 0x00 if you want read from boot CDROM, 0x00 works on boot USB too
int 13h ;read with BIOS interrupt
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Can I read discs with interrupts?
Only if there is a BIOS to run that interrupt for you. New UEFI PCs may not provide a BIOS CSM anymore, or it may not be enabled by default.xtex wrote:Can I use the int command to read some sectors in the compact disc (CD)?
No. The location of the boot code on a CD is determined by the boot catalog. For more information about that, refer to El Torito on the wiki or find a copy of the El Torito specification.xtex wrote:By the way, the CD can also store the boot code in the first sector, right?
The El Torito specification allows the BIOS to emulate a floppy disk or hard disk through INT 0x13, so if you access the emulated disk through INT 0x13, you will see your boot code in the first sector of the emulated disk. In reality, there is no boot code in the first sector of the CD.
This is a bad example. The ID of the CD drive is not guaranteed to be the same on every computer.Klakap wrote:Code: Select all
mov dl, 0xE0