Modulo
Posted: Tue Aug 22, 2006 8:45 am
ive been reading this artice for fat
http://scottie.20m.com/fat.htm
It says :
Best Regards
http://scottie.20m.com/fat.htm
It says :
My question is how can i implement modulo, i mean assembly doesn't have a modulo instruction. And mathematicaly modulo has many meanings. Please tell me is there a way to do modulo in assembly and if not can i do the above calculations without modulo?
Now that we know the logical sector, you might be wondering
how to get it to absolute sector so we can read it. Well
we use a few formulas to figure it out.
They are:
sector = ( logical sector MOD sector per track) + 1
head = (logical sector \ sector per track ) MOD number of heads
track = logical sector \ (sector per track * number of heads)
Note that this is integer division instead of floating point
division. And also Modulo math. If you can't figure this out
just turn on QBasic and enter a quick formula.
So. Using the formulas above we get:
sector= (34 MOD 512)+1= 17
head= (34 \ 512) MOD 2= 1
track= 34 \ (512 *2)= 0
Our file starts at Head 1 Track 0 Sector 17
The next sector Head 1 Track 0 Sector 18
The next sector Head 0 Track 1 Sector 1
and so on till the end.
Best Regards