FAT 12 File System
Posted: Sun Jan 11, 2009 5:30 pm
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!
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!