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.
The cd-rom floppy emulation works like a partition on the cd-rom, which means that when you access it normally you would get 700-1.44 mb free space.
In DOS, this means:
A: would be the floppy "partition" at the cd-rom
D: would be the rest of the cd-rom
If you read the PC Bootable CD-ROM from an already booted OS, such as DOS, Windows 95, Windows NT or OS/2 you'll only see the 'Data' that's on the Disc.
The Boot image (= floppy) is either:
I have a bootsector for cd-rom without emulating! It is not well documented, if you have any questions, ask! There should be enough place if you want to load your kernel at 1MiB! Also you need the newest FASM (beta) for assembling it!
mov ex,bx
dec ax ; switch back to real mode
mov cr0, eax ; by toggling bit again
pop ds ; get back old segment
sti
mov esi,0x10000h
mov edi,0x80000h
mov ecx,4 ;are you sure this is enough (16bytes)?
rep movsd
jmp 8000h:0000h
i'm still unable to load the kernel at 1 mb a jump to it from protected mode. I've used your code that load my kernel to 1000h:0000 and i'm limited to the 576kb of free space (i took these from bubach code) ... everything else is working fine as long as the kernel is in the imediate lba after the loader. I?m trying to build a generic program to work whith mkisofs in order to make bootable cd's in a really easy and configurable way (my aim is to be able to load any kernel that expects to be loaded at 1 mb) .. for now it just loads at 64kb ... the bootloader is responsable to check memory, video modes, a20, etc ... the kernel should load a new gdt. I started this because my laptop has no floppy drive .. and i was unable to test in the machine ... now i'm trying to make a more generic tool. thank you all
If you want you also can have my code for a bootloader. This bootloader can load a kernel from a cd, from any directory - although I didn?t test it much - and it will load also kernels from fat12/16/32 disks like hdd, floppy, usb and zip!
i just can make it work loading the kernel in real mode and moving it in pm mode to 1 mb ... so it stays size limited. i can't get the unreal mode move to work
Why not write a second-stage bootloader, which functions totally in protected mode, talking directly to whatever device your loading from? I mean, if you are going to write a protected-mode OS, you are going to need to know how to talk to hardware directly anyway, so you could just as well forget about BIOS in your bootloader too, and if you forget about BIOS, then there's no reason to use realmode at all.
ribas wrote:
i just can make it work loading the kernel in real mode and moving it in pm mode to 1 mb ... so it stays size limited. i can't get the unreal mode move to work
My floppy boot code is 1024 bytes (it loads it's second half before using it). The boot CD uses floppy emulation, so the code is the same. I use unreal mode to load a variable sized file (currently 480 Kb) to 0x00150000 - it should handle much larger files (depending on how much memory is installed).
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.