Extended read

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Ribas_pt

Extended read

Post by Ribas_pt »

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)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Extended read

Post by Brendan »

Hi,
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
If you haven't already done it, try adding "jc .error" after the "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.
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)
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).


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.
ribas

Re:Extended read

Post by ribas »

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!
ribas

Re:Extended read

Post by ribas »

if anyone can help ....
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Extended read

Post by bubach »

Just wondering what you are doing here:

Code: Select all

org   0x7c00
use16

   ; Entry point for initial bootstap code
boot:
   jmp   start
   nop
Trying to make a bootsector or a second stage loader?
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
ribas

Re:Extended read

Post by ribas »

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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Extended read

Post by Pype.Clicker »

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)
ribas

Re:Extended read

Post by ribas »

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 ?????
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Extended read

Post by Pype.Clicker »

http://www.osdev.org/osfaq2/index.php/UnrealMode

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               
ribas

Re:Extended read

Post by ribas »

thanks! i'll try it
ribas

Re:Extended read

Post by ribas »

;; 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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Extended read

Post by Pype.Clicker »

ribas wrote: mov ecx, 0x8000 ; 0x8000 * 4 = 128KB
??? size??
Yup, in a rep xxxsx thing, ecx contains the number of item to be moved/stored/loaded/scanned ...

Here, I was using "movsd" so the count should be given in number of dwords (0x80 for a 512-bytes sector).
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Extended read

Post by bubach »

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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
ribas

Re:Extended read

Post by ribas »

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..
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Extended read

Post by Pype.Clicker »

it is theorically possible to setup a video mode like 800x600 after pm switch, but it is *way* easier to set it up *before* ;)
Post Reply