Page 2 of 3
Re:Extended read
Posted: Tue Feb 22, 2005 9:02 am
by bubach
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
It exists other methods of making a bootable cd-rom (hdd emulation etc.), check out this page for more info:
http://utopia.knoware.nl/users/sanny/bootcd.html
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:
- invisible
- displayed as BOOTCAT.BIN
- displayed as BOOTCAT.BIN and BOOTIMG.BIN
/ Christoffer
Re:Extended read
Posted: Tue Feb 22, 2005 10:11 am
by ribas
i was looking to BOS kernel and i don't understand this
The BOS 32-bit kernel, expects to be loaded at ;
; 1mb, a20 enabled.
use32
org 0x10000 ->??? why not 0x100000
Re:Extended read
Posted: Tue Feb 22, 2005 10:47 am
by ribas
here's what i?ve been trying to do ....
it needs mkisofs. Theorically it should work but i'm really a rookie is this ....
Re:Extended read
Posted: Tue Feb 22, 2005 1:22 pm
by FlashBurn
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!
Edit::
I forgot to upload the source code
Re:Extended read
Posted: Wed Feb 23, 2005 5:37 am
by bubach
Oh, I forgot to change that.. It should be: expects to be loaded at 64kb.
Re:Extended read
Posted: Wed Feb 23, 2005 6:12 am
by ribas
thanks FlashBurn great code !!
but now i'm stuck again ....
mov dl,byte[bootdrv] ;move bootdrive into dl for the loader
cli ; no interrupt
push ds
lgdt [gdtr] ; load gdt register
mov eax, cr0 ; switch to pmode by
inc ax ; toggling last bit
mov cr0, eax
mov bx, 0x08 ; select descriptor 1
mov ds, bx ; 8h = 1000b
dec ax ; switch back to real mode
mov cr0, eax ; by toggling bit again
pop ds ; get back old segment
sti
mov esi, 0x1000 ;
mov edi, 0x8000 ;
mov ecx, 0x4 ;
rep movsd
jmp 1000h:0000h ;where is loaded first (works fine!)
;how ho i jump to the other location ???? (the kernel is 16 bit code) just for testing
; jmp 8000h:0000h -> RIP > CS.limit
Re:Extended read
Posted: Wed Feb 23, 2005 6:26 am
by ribas
just forget it ...
a mov edx,edi
.....
call edx solved my problem ... i'm really new to this...
Re:Extended read
Posted: Wed Feb 23, 2005 7:57 am
by FlashBurn
You have to use this code:
Code: Select all
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
Re:Extended read
Posted: Wed Feb 23, 2005 8:47 am
by ribas
It was just for testing ....
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
Re:Extended read
Posted: Wed Feb 23, 2005 1:04 pm
by FlashBurn
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!
Re:Extended read
Posted: Wed Feb 23, 2005 3:42 pm
by ribas
if someone can post some code that moves 127 kb from 0x1000:0000 in unreal mode to 0x100000 and jumps to it in protected mode ..
jmp 0x08:?????? i can't get it to work ....
Re:Extended read
Posted: Wed Feb 23, 2005 4:24 pm
by ribas
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
Re:Extended read
Posted: Wed Feb 23, 2005 7:24 pm
by mystran
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.
Re:Extended read
Posted: Wed Feb 23, 2005 11:09 pm
by Brendan
Hi,
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).
The general idea is:
Code: Select all
main() {
int bytes_left;
load_second_boot_sector();
enable_unreal_mode();
load_first_sector_into_buffer();
bytes_left = get_size_of_file_from_buffer();
bytes_left -= size_of_sector;
copy_buffer_to_final_address();
while(bytes_left > 0) {
load_next_sector_into_buffer();
copy_buffer_to_final_address();
bytes_left -= size_of_sector;
}
// Start the next stage here
}
See
http://bcos.hopto.org/src/boot/boot144/index.html for my floppy boot code.
Cheers,
Brendan
Re:Extended read
Posted: Thu Feb 24, 2005 9:14 am
by ribas
FlashBurn can you send me the code that loads a file from any dir on a cd?