Hi,
Not sure this is the right place to ask this question but I have been looking around the internet and can't find the answer to my problem. I'm experimenting with writing a bootloader and it all kinda works so far. It loads a bootsector which loads a second file. The second file Prints some messages, enables the a20 line and switches to protected mode. All fine.
However when my second file exceeds a certain size( 290bytes or something like that) all of a sudden the file does not get read from disk anymore. The error code I get from the floppy is 01 in AH which appereantly means int 13 invalid function in AH or invalid parameter. If I decrease the size of the file to be loaded by a few bytes (e.g. by leaving a variable out) all works file again. In both situations all registers have the exact same values so I'm quite lost here.
If someone can tell me why the size infuences this or could redirect me to some documentation that explains it I would be greatfull. I'm using the fat12 filesystem btw.
Cyriel
reading from floppy fails
Re:reading from floppy fails
The size of file may be a factor when your reading the file into a location that is almost end of the 64k segment boundry. However in those cases, int 13h would have return with status 09 (DMA access across 64k boundary).
Theres not very much to go by for me to examine the problem, just ensure to have AH=02 and DL=0, as well as high 2 bits of CL (sector number) is zero'ed which is high 2 bits of cyclinder number and wont be used for the standard floppy disk. Ensure that your translation CHS -> LBA and LBA -> CHS are correct.
Theres not very much to go by for me to examine the problem, just ensure to have AH=02 and DL=0, as well as high 2 bits of CL (sector number) is zero'ed which is high 2 bits of cyclinder number and wont be used for the standard floppy disk. Ensure that your translation CHS -> LBA and LBA -> CHS are correct.
Re:reading from floppy fails
also many (most?) BIOS cannot switch heads/cyl during a read
so make sure your not attempting to read a series of sectors spanning a head change (though you would prob get a different error for that -- cannot remember which and my RBIL is on my other computer )
so make sure your not attempting to read a series of sectors spanning a head change (though you would prob get a different error for that -- cannot remember which and my RBIL is on my other computer )
Re:reading from floppy fails
Looks like I solved the problem. I tried to load the sector at 0000:0320. When I changed this to 0000:1000 it works. I asume in the 0000:320 area there are some reserved spaces? I know there are but appearently they are write protected as well. Anybody can explain how this works? As as I don't want to wast this forums resources with my beginner experiments just point me to some sites that hold the info. I already know the wiki here and bonafide os development has a lot of info.
Grt,
Cyriel
Grt,
Cyriel
Re:reading from floppy fails
Theres always the ole google if you don't want to waste the forums resources. You need a copy of the IA-32 Intel Manuals, read on interrupts. After the IVT area also is reserved for BIOS data area which I dont know exactly how much is reserved, but I've found it safe to to start at 800h.
Re:reading from floppy fails
from
0000 -- 0400 -- Default RM IDT
0400 -- 0600 -- BIOS and DOS temp storage
0600 -- 0800 -- where the MS MBR relocates itself (and MS OSs load the partition table here -- just in case they are using an incompatable MBR)
00800 -- 07C00 -- availible for use
07C00 -- 07E00 -- boot sector is loaded here
07E00 -- 9???? -- availible for use
9???? -- A0000 -- start depends on BIOS -- extended BIOS area
A0000 -- C0000 -- part of video memory mapped here
C0000 -- E0000 -- ROM chips located here (including video, HDD controller, scsi, etc)
E0000 -- F0000 -- reserved for BIOS -- but afaik, its never been used
F0000 -- 1MB ---- a portion of the BIOS code is coppied into RAM at this location
above 1MB is machine specific (use e820 to find it for each computer)
0000 -- 0400 -- Default RM IDT
0400 -- 0600 -- BIOS and DOS temp storage
0600 -- 0800 -- where the MS MBR relocates itself (and MS OSs load the partition table here -- just in case they are using an incompatable MBR)
00800 -- 07C00 -- availible for use
07C00 -- 07E00 -- boot sector is loaded here
07E00 -- 9???? -- availible for use
9???? -- A0000 -- start depends on BIOS -- extended BIOS area
A0000 -- C0000 -- part of video memory mapped here
C0000 -- E0000 -- ROM chips located here (including video, HDD controller, scsi, etc)
E0000 -- F0000 -- reserved for BIOS -- but afaik, its never been used
F0000 -- 1MB ---- a portion of the BIOS code is coppied into RAM at this location
above 1MB is machine specific (use e820 to find it for each computer)