what's the best way to read from cd in unreal mode?
what's the best way to read from cd in unreal mode?
Hi all!
I want to load the entire CD-ROM image (not more than 200 MB) in RAM when in (un)real mode. What's the best way of doing this?
First of all, I thought about BIOS int 13h functions. i.e. read 64k of data under 1MB, then move 64k above 1MB where they should be, then read another 64k and so on. But! 40x CD-ROM drive gives approx 6Mb/sec. It's a bit slow, I think. Maybe it's better to use DMA (if possible)? I want the code to stay as compact and as universal as possible. Without vendor-specific drivers for various types of optical drives and etc... If it's possible to use DMA, then could you provide me with some source code or links on using DMA with CD-ROM drives, please? I'm complete noob in DMA controllers programming and don't even know where to start from. Thanks a lot!
I want to load the entire CD-ROM image (not more than 200 MB) in RAM when in (un)real mode. What's the best way of doing this?
First of all, I thought about BIOS int 13h functions. i.e. read 64k of data under 1MB, then move 64k above 1MB where they should be, then read another 64k and so on. But! 40x CD-ROM drive gives approx 6Mb/sec. It's a bit slow, I think. Maybe it's better to use DMA (if possible)? I want the code to stay as compact and as universal as possible. Without vendor-specific drivers for various types of optical drives and etc... If it's possible to use DMA, then could you provide me with some source code or links on using DMA with CD-ROM drives, please? I'm complete noob in DMA controllers programming and don't even know where to start from. Thanks a lot!
Re: what's the best way to read from cd in unreal mode?
There is the easy way, and the very hard way.
The easy way is what you already said -- use INT13h.
To use the hard way, you would have to enter protected mode, and create a generic DMA ATAPI driver. That would include creating an interrupt handler for the disk controller, and enumerating the PCI bus to find the PCI address of the controller and its "Bus Master Register". We do not have a good tutorial yet for ATAPI.
You would want to start with this article: ATA PIO Mode.
Then see this (mostly stubbed and unhelpful) article ATAPI.
Then, finally: http://wiki.osdev.org/ATA/ATAPI_using_DMA.
The easy way is what you already said -- use INT13h.
To use the hard way, you would have to enter protected mode, and create a generic DMA ATAPI driver. That would include creating an interrupt handler for the disk controller, and enumerating the PCI bus to find the PCI address of the controller and its "Bus Master Register". We do not have a good tutorial yet for ATAPI.
You would want to start with this article: ATA PIO Mode.
Then see this (mostly stubbed and unhelpful) article ATAPI.
Then, finally: http://wiki.osdev.org/ATA/ATAPI_using_DMA.
Re: what's the best way to read from cd in unreal mode?
Thanks a lot, bewing.
I've thought a bit about what I've read... i.e. the first article says
I've thought a bit about what I've read... i.e. the first article says
Maybe using DMA transfers in a bootloader is cool, but it's tooo complex for a boot loader that runs just one time per session. I decided to use INT 13h functions. UDMA will be later... in protected mode....PIO mode is an excellent and simple interface to utilize during bootup, until the system goes into multitasking mode.
Re: what's the best way to read from cd in unreal mode?
There is a way to activate udma for every drive (if possible) in the bios when you are using int13h. I´m using it for my bootloader, but don´t know if it really works.
Re: what's the best way to read from cd in unreal mode?
so what's the method? we'll give it a try 
Re: what's the best way to read from cd in unreal mode?
Take a look here http://www.ctyme.com/intr/rb-0722.htm. It would be nice if you would tell me/us what you get, it would also be interessting to know what prefetch does.
Re: what's the best way to read from cd in unreal mode?
hmm, never paid any attention to this function
i've already got tons of questions, but some hardware tests should be performed first... arrrggghh it's so bad that i don't have neither floppy disk drive nor cd-rws to play with this func right now
it seems that the nearest shop is waiting for me...
Re: what's the best way to read from cd in unreal mode?
If you can send me images for floppy and/or cd-rw I could make these tests if you tell me what I have to do!
Re: what's the best way to read from cd in unreal mode?
first of all I want to try to set each of available modes and read large portions of data. to check how it affects the speed. as I understand, BIOS won't give control back to user software until read/write operation is complete. the only possible advantage that comes to mind is the decreased time of execution of int 13h read/write functions. but again, if this function is supported by BIOS
Re: what's the best way to read from cd in unreal mode?
Hi,

Cheers,
Brendan
Not sure if you've thought of this yet, but the first step would be to compress the data and decompress it after it's loaded - it could take half as long to get the data into RAM that way...zhak wrote:I want to load the entire CD-ROM image (not more than 200 MB) in RAM when in (un)real mode. What's the best way of doing this?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: what's the best way to read from cd in unreal mode?
compress/decompress? what for?
Re: what's the best way to read from cd in unreal mode?
size I'm assuming.
200MB is quite a bit to load directly into memory.
200MB is quite a bit to load directly into memory.
Website: https://joscor.com
Re: what's the best way to read from cd in unreal mode?
At 52X, 200M of data will probably take about 30 seconds to load -- with or without DMA.
If you can compress it to 100M, then it will only take 15 seconds to load, and 2 seconds to decompress (or something like that).
If you can compress it to 100M, then it will only take 15 seconds to load, and 2 seconds to decompress (or something like that).
Re: what's the best way to read from cd in unreal mode?
two seconds? I doubt it... it took me 33 seconds to compress 200MB and 15 seconds to decompress with the zip -fastest method (but it was done under win32). 15 seconds to read 100MB and 15 to decompress - the same 30 seconds... no, it's not an option, I think.
Re: what's the best way to read from cd in unreal mode?
Heh. You don't want to use something like zip. Just a simple RLE encoding. 


