fat12 set cluster
fat12 set cluster
Hi,
I'm trying to write a fat12 driver,but this time I'm writing it using assembly,
right now I don't know how to set an entry in the fat table to a specific value,
would you please give me a code snippt (asm code) about that...
Thanx.
I'm trying to write a fat12 driver,but this time I'm writing it using assembly,
right now I don't know how to set an entry in the fat table to a specific value,
would you please give me a code snippt (asm code) about that...
Thanx.
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
Re:
FAT12 definitely exist, trust me, I'm an OSdeverDT170x wrote:I thought there is FAT, FAT16, and FAT32
FAT 12
It that odd
Jules
Re: fat12 set cluster
I think the number is the number of clusters per file it can handle for example FAT12- 12 Clusters? That i at least what i think it is. Please point out to me if I am wrong
Re: fat12 set cluster
Look at my reset macro to generate sequential cluster chain for a file. Maybe this helps you.DT170x wrote:Sorry I didn't Know that.
Code: Select all
if id#_size>0
count=(id#_size+511)/512
cur=id#_base/512-(33-2)
repeat count
if %=count
val=0FFFh
else
val=cur+1
end if
if cur and 1
val=val shl 4
end if
disp=(cur*3)/2
load var word from 512+disp
var=var or val
store word var at 512+disp
store word var at 10*512+disp
cur=cur+1
end repeat
end if
If you have seen bad English in my words, tell me what's wrong, please.
Re: fat12 set cluster
The number is the amount of bits that are used to store each cluster number in the allocation table. So FAT12 theoretically supports 2^12 clusters (actually, it's around 4086, due to the last ten or so numbers being reserved), FAT16 theoretically supports 2^16 clusters (again, somewhat less), and FAT32 supports 2^28 clusters (although the name says 32, only 28 bits are used for the cluster number, the highest four bits are reserved; and again there are some reserved cluster numbers).PatrickV wrote:I think the number is the number of clusters per file it can handle for example FAT12- 12 Clusters? That i at least what i think it is. Please point out to me if I am wrong
It would be a pretty serious limitation, if FAT12 could only handle files that are 12 clusters long. Even with the maximum cluster size 64KiB (if I remember correctly, FAT12 can't do clusters larger than this), that is only 768KiB - that would be pretty lame.
Re:
Hi,
Cheers,
Adam
As a word of warning, FAT (without a suffix) normally relates to FAT16 - at least on MS fdisk.DT170x wrote:I thought there is FAT, FAT16, and FAT32
Cheers,
Adam
Re: fat12 set cluster
Okay guys lets get back to the main point
some asm code snippt...
some asm code snippt...
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
Re: fat12 set cluster
It's so pitiful for me to give you my codeabuashraf wrote:Okay guys lets get back to the main point
some asm code snippt...
If you have seen bad English in my words, tell me what's wrong, please.
Re: fat12 set cluster
My OS has fat12, fat16, fat32 implemented (in fasm) you are free to use it, but you MUST include the licence, if you use any part of the code.
You can get it here: http://dex4u.com/download.htm
You can get it here: http://dex4u.com/download.htm
- salil_bhagurkar
- Member
- Posts: 261
- Joined: Mon Feb 19, 2007 10:40 am
- Location: India
Re: fat12 set cluster
Why don't you go for the actual math instead, and write a driver yourself using this specification from MS... Reading it at the most 10 times, you should be able to understand the FAT in general (and hence FAT12).
Re: fat12 set cluster
I already wrote complete fat12 driver in C,but now I'm writing it in asm
but I'm really having problem with this specific function,I wrote "getFat" function by
myself ,but till now I couldn't get this function done.
anyway here's what I have...
Please note that I loaded the fat table into memory at [es:0x500]
Also "value" holds the value I want to set the entry to it
but I'm really having problem with this specific function,I wrote "getFat" function by
myself ,but till now I couldn't get this function done.
anyway here's what I have...
Code: Select all
mov ax,word [cluster]
mov cx,ax
mov dx,ax
shr dx,0x0001
add cx,dx ;sum of (3/2)
mov bx,[es:0x500] ;location of fat table in memory
add bx,cx ;index into fat
test ax,0x0001
jnz .odd
.eve:
push bx
inc bx
and bx,0x0F
mov cx,[value]
and cx,0xF00
shr cx,0x0008
or bx,cx
mov cx,[value]
and cx,0x0FF
pop bx
mov [bx],cx
.odd:
and [bx],0x0F
mov cx,[value]
and cx,0x00F
shl cx,4
or [bx],cx
mov cx,value
and cx,0xFF0
shr cx,4
inc bx
mov bx,cx
Also "value" holds the value I want to set the entry to it
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: fat12 set cluster
FAT12 uses a twelve-bit File Allocation Table, allowing 2^12-19 clusters. At 8KB per cluster (16 sectors) that makes a volume max size of 32 MB.PatrickV wrote:I think the number is the number of clusters per file it can handle for example FAT12- 12 Clusters? That i at least what i think it is. Please point out to me if I am wrong
Re: fat12 set cluster
here's what I got till now...
would any one please check this function and till me what bugs does it have?
Thanx.
Code: Select all
setcluster:
mov ax,word [cluster] ;current cluster
mov cx,ax
mov dx,ax
shr dx,0x0001
add cx,dx ;sum of (3/2)
mov bx,[es:0x500] ;location of fat table in memory
add bx,cx ;index into fat
mov dx, WORD [bx] ;read two bytes from FAT
test ax,0x0001
jnz .odd
.eve:
and [value],0xFFF
and bx,0xF000
jmp done
.odd:
shl [value],4
and bx,0x000F
done:
or bx,[value]
ret
Thanx.
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.