Extended read
Extended read
I'm sorry if this is already in the forum, i did no found it.
I've googled and searched about extended read, but i've found very diferent disk address packet format, and i'm confused...
i have this code ......
.....
mov ah,0x42 ; function to read from CDROM
mov dl,[btdrv] ; cdrom drive number
mov si,read_dap ; point to parameter block
int 0x13
......
read_dap:
db 0x10 ; 00: size of parameter block
db 0
db 0x1 ; 02: number of blocks to read (max 0xFF)
db 0
dw 0x0010,0x8000 ; 04: where to read it (offset,segment)
dd 0,0 ; 08: starting block number (quadword)
i want to load something at 1 megabyte and jump to it in protected mode .... help please! thanks (sorry for my english)
I've googled and searched about extended read, but i've found very diferent disk address packet format, and i'm confused...
i have this code ......
.....
mov ah,0x42 ; function to read from CDROM
mov dl,[btdrv] ; cdrom drive number
mov si,read_dap ; point to parameter block
int 0x13
......
read_dap:
db 0x10 ; 00: size of parameter block
db 0
db 0x1 ; 02: number of blocks to read (max 0xFF)
db 0
dw 0x0010,0x8000 ; 04: where to read it (offset,segment)
dd 0,0 ; 08: starting block number (quadword)
i want to load something at 1 megabyte and jump to it in protected mode .... help please! thanks (sorry for my english)
Re:Extended read
Hi,
Ralph Brown's Interrupt List (http://www.ctyme.com/intr/rb-0708.htm) lists this function as "Disk I/O Enhancements". This may mean that it's something added to the BIOS's disk IO functions by DOS and/or Windows, and the function itself may not be supported by the BIOS/ROM itself. Even if it is supported on some computers I doubt it's supported by all.
Further, I'm assuming that "mov dl,[btdrv]" refers to an emulated floppy disk on a CD-ROM, rather than the CD-ROM itself - not sure if that matters (you didn't say what you where trying to load, and where exactly you want to load it from.
Cheers,
Brendan
If you haven't already done it, try adding "jc .error" after the "int 0x13".Ribas_pt wrote:I've googled and searched about extended read, but i've found very diferent disk address packet format, and i'm confused...
i have this code ......
.....
mov ah,0x42 ; function to read from CDROM
mov dl,[btdrv] ; cdrom drive number
mov si,read_dap ; point to parameter block
int 0x13
Ralph Brown's Interrupt List (http://www.ctyme.com/intr/rb-0708.htm) lists this function as "Disk I/O Enhancements". This may mean that it's something added to the BIOS's disk IO functions by DOS and/or Windows, and the function itself may not be supported by the BIOS/ROM itself. Even if it is supported on some computers I doubt it's supported by all.
Further, I'm assuming that "mov dl,[btdrv]" refers to an emulated floppy disk on a CD-ROM, rather than the CD-ROM itself - not sure if that matters (you didn't say what you where trying to load, and where exactly you want to load it from.
IMHO you'd be better to use "normal" BIOS disk IO functions. For example, my own floppy disk boot sector code sets up "unreal mode" (and enables the A20 gate) to get access to memory above 1 MB, uses the normal floppy "read sectors" BIOS function to load data below 1 MB, and then transfers the data to memory above 1 MB after (ie. without the BIOS). If you're loading data from an emulated floppy on a boot CD (or a real floppy) this works fine (works on every computer I've been able to test it on).Ribas_pt wrote:i want to load something at 1 megabyte and jump to it in protected mode .... help please! thanks (sorry for my english)
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:Extended read
thanks Bredan i'll try your advice, i was trying to load a kernel that i manualy put in the imediate sector (2048 bytes) after my boot code using no emulation i'm able too boot and dectect int 13 extensions ... a20 etc... and load the kernel (all this works fine) under 1 mb... i'll try unreal mode to load'it and move it above 1 mb. I really want to do this without emulation ... if i faill i'll try de floppy emulation thing.. if you have some code ...it would be helpfull. Thanks for your reply!
Re:Extended read
Just wondering what you are doing here:
Trying to make a bootsector or a second stage loader?
Code: Select all
org 0x7c00
use16
; Entry point for initial bootstap code
boot:
jmp start
nop
Re:Extended read
trying to make a bootsector that jumps to the kernel at 1 mb ...
i thing i'll try de floppy emulation thing.. i'm new to this .... i've looked a lot of code (including your own ... ) ... i figured that cd-roms don?t have the 512 byte limit and so i tried to make a bootsector that does everything (check cpu,a20,memory) and load a kernel at 1 mb. I'm able to load it below .... i just want to load it at 1 mb. the kernel must reside in the imediate sector after the bootloader. i get the lba of the kernel through the bootsector lba + bootsector size ... bootsector is aligned in 2048 bytes sectors. thanks for the reply
i thing i'll try de floppy emulation thing.. i'm new to this .... i've looked a lot of code (including your own ... ) ... i figured that cd-roms don?t have the 512 byte limit and so i tried to make a bootsector that does everything (check cpu,a20,memory) and load a kernel at 1 mb. I'm able to load it below .... i just want to load it at 1 mb. the kernel must reside in the imediate sector after the bootloader. i get the lba of the kernel through the bootsector lba + bootsector size ... bootsector is aligned in 2048 bytes sectors. thanks for the reply
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Extended read
afaik, the "extended read" is not able to go beyond 1MB, not more than legacy "read" is. So you're back to the two good-old options:
- load everything below 1MB, switch to pmode then move data to their final location
- switch to unreal mode, and repeat "read chunk, move chunk above 1MB" for each "chunk" of data you need to read (esp. useful when you have more than 640KB of kernel to load)
- load everything below 1MB, switch to pmode then move data to their final location
- switch to unreal mode, and repeat "read chunk, move chunk above 1MB" for each "chunk" of data you need to read (esp. useful when you have more than 640KB of kernel to load)
Re:Extended read
can you give some links ... where i can see how to move the code ....
assuming i've loaded at 0x80000 linear how can i move it to 0x100000 ?????
assuming i've loaded at 0x80000 linear how can i move it to 0x100000 ?????
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Extended read
http://www.osdev.org/osfaq2/index.php/UnrealMode
then simply
then simply
Code: Select all
;; assume ds == es == flat, unreal segment
mov esi, 0x 80000 ; this is, 128Kb before A000 vga area
mov edi, 0x100000 ; and this is 1MB
mov ecx, 0x8000 ; 0x8000 * 4 = 128KB
rep movsd
Re:Extended read
;; assume ds == es == flat, unreal segment
mov esi, 0x 80000 ; this is, 128Kb before A000 vga area
i think this is my real mode buffer ...
mov edi, 0x100000 ; and this is 1MB
destination ....
mov ecx, 0x8000 ; 0x8000 * 4 = 128KB
??? size??
rep movsd
thanks
mov esi, 0x 80000 ; this is, 128Kb before A000 vga area
i think this is my real mode buffer ...
mov edi, 0x100000 ; and this is 1MB
destination ....
mov ecx, 0x8000 ; 0x8000 * 4 = 128KB
??? size??
rep movsd
thanks
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Extended read
Yup, in a rep xxxsx thing, ecx contains the number of item to be moved/stored/loaded/scanned ...ribas wrote: mov ecx, 0x8000 ; 0x8000 * 4 = 128KB
??? size??
Here, I was using "movsd" so the count should be given in number of dwords (0x80 for a 512-bytes sector).
Re:Extended read
Hmm.. All that code wont fit in the bootsector and you don't have any bootsignature.
I saw that you used my old code, which imho sucks..
I can't remember how much of that I actually wrote, and how much is "borrowed", plus that I didn't know much Assembly when I did that. If you want to look at my newest bootsector which loads a file (up to ~576kb big) into mem at 64kb, enables pmode and a20, download BOS 0.03 from my website: http://bos.asmhackers.net/
You should be able to modify it by changing the drivenumber (and some other stuff) to fit a cdrom-drive.
I saw that you used my old code, which imho sucks..
I can't remember how much of that I actually wrote, and how much is "borrowed", plus that I didn't know much Assembly when I did that. If you want to look at my newest bootsector which loads a file (up to ~576kb big) into mem at 64kb, enables pmode and a20, download BOS 0.03 from my website: http://bos.asmhackers.net/
You should be able to modify it by changing the drivenumber (and some other stuff) to fit a cdrom-drive.
Re:Extended read
thank you all .. i'll try the floppy emulation, seems more compatible, i think that it is possible to end that emulation after loading the kernel. Is it possible to set a resolution 800x600 32bpp im pm mode or it's best to do'it iin the loader? fasm or nasm ? ... i reallly like fasm..
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Extended read
it is theorically possible to setup a video mode like 800x600 after pm switch, but it is *way* easier to set it up *before*