64 KB FILE limit in RM?
64 KB FILE limit in RM?
Hi,
i am using (un)real mode for my OS and the bootloader can't load a file bigger than 64KB, due to real mode limits. But how can (MS-),(Free-),(DR-) DOS load a executable bigger than 64KB? DOS is real mode, no? Thanks for advice.
inflater
i am using (un)real mode for my OS and the bootloader can't load a file bigger than 64KB, due to real mode limits. But how can (MS-),(Free-),(DR-) DOS load a executable bigger than 64KB? DOS is real mode, no? Thanks for advice.
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
"at a time"? I don't understand what you mean...
inflater
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
MiniDos is limted because the segment is hard coded, but if you look at the code for Bootprog http://alexfru.chat.ru/epm.html#bootprog
Still realmode but it can load bigger files.
Still realmode but it can load bigger files.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
The basic idea behind it all is this: (hope this pseudocode reads easier than source code)
or alternatively:
Code: Select all
while (there_is_more_data)
{
LoadNext64K();
Segment += (64 * 1024 / 16); //next location to write = 64k further = 64k/16 segment units further
}
Code: Select all
while (there_is_more_data)
{
LoadNextSector();
Segment += (512 / 16); // 512 bytes for a sector, segments go in 16 bytes
}
The OS can access 4GB of ram, but after kernel boot... I use the executing functions in interrupts. Interrupts are set in kernel BOOTloader. So my OS can't access more of 4 GB RAM in bootloader...
inflater
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Well I really don't understand why you would want to load an executable file in your boot loader. I mean how many bytes of space do you have for handling such thing?
However, if you like to load executable files bigger than the limit of a segment in RM, you should use either contiguous or scattered segment addresses that you know are not being used. Skip the BDA and other well-known used segments. Keep track of the segment locations and change the CS:(E)IP accordingly.
However, if you like to load executable files bigger than the limit of a segment in RM, you should use either contiguous or scattered segment addresses that you know are not being used. Skip the BDA and other well-known used segments. Keep track of the segment locations and change the CS:(E)IP accordingly.
ok...though you can use the 64k segmenting, in unreal mode you actually don't have to..
for example:
for example:
Code: Select all
void LoadNextSector(void *512b_buffer_realmode);
unsigned char buffer[512];
//main loop
while(more_data){
LoadNextSector(buffer);
__asm(".intel_syntax noprefix\n"
"mov ax,0\n"
"mov gs,ax\n" //we use an extra segment to keep from screwing up C
"mov cx,512\n"
"mov si,buffer\n"
"mov ebx,my_32bit_place\n" //my_32bit_place should be the EFFECTIVE ADDRESS of where you want to place the data
//to figure out effective address for inside of 1MB you just do address=offset+(segment<<4)
"my_loop:\n"
mov ax,[ds:si]\n"
"mov [gs:ebx], ax\n"
"add si,2\n"
"loop my_loop\n"
".att_syntax\n");
}