I'm trying to implement a FAT 12 file system. The disk is formatted as follows:
Boot Sector (1 sector) | Reserved (1 sector) | FAT 1 (9 sectors) | FAT 2 (9 sectors) | Root ....
My Root directory starts at sector 21. Each cylinder has 18 sectors on the disk. So the starting root sector is at the second cylander at sector 3. I used the following code to try to load that sector into memory:
MOV ax, 0x1000
MOV es, ax ;es - extra segment. Pointer to extra data. es = 0x1000
MOV bx, 0 ;bx - Base register. Used as a pointer to data. bx = 0
MOV al, 1 ;Load just 1 disk sector
MOV ch, 1 ;Cylander = 1
MOV cl, 3 ;Sector = 3
MOV dh, 0 ;Head = 0
MOV dl, 0 ;Drive = 0 (A drive)
MOV ah, 2
INT 0x13
The above code causes bochs to enter an endless loop that keeps on printing out the following message:
prefetch: EIP [00010000] > CS.limit [0000ffff]
Any ideas as to what is wrong?
Also, I haven't had any luck reading any sector that was not in the first cylinder.
Thanks!
FAT 12 File System
Re: FAT 12 File System
are you jumping to the loaded sector to run it? i dont really know about files systems but i know bootprog does this. i looked at it, and somewhere there is a jmp 0x1000? i think thats it
Re: FAT 12 File System
Yes. After the sector is loaded to memory I jump to the code in memory. The jump code is:
Code: Select all
JMP 0x1000:0000
Re: FAT 12 File System
I think sector twenty-one is at sector three, head one, cylinder zero actually... Floppies have two sides.Stavros wrote:My Root directory starts at sector 21. Each cylinder has 18 sectors on the disk. So the starting root sector is at the second cylander at sector 3.
The Bochs error usually indicates that you are running at a bogus memory address (like above 1M in real mode).
This may be related to the head issue.Stavros wrote:Also, I haven't had any luck reading any sector that was not in the first cylinder.
Re: FAT 12 File System
Yes. That worked. Thanks! So I guess floppies only have 1 cylinder per head?
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: FAT 12 File System
Lol. No, there's 80 of them per head, 2 heads.Stavros wrote:Yes. That worked. Thanks! So I guess floppies only have 1 cylinder per head?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: FAT 12 File System
check wikipedia on different floppy disks and then you can set your bootlaoder to use, say you want to make one for a different size, i would check for future references