Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
My problem is at bold instruction, i try to read first FAT on disk and i want to read whole one FAT in memory, that is point to ES:BX. But when i check at ES:BX there a invalid value, not a FAT Table. But when I change the value :
;-- proc LBACHS must be call to calculation C-H-S
;-- then C-H-S will auto input in register before call int 13h
;-- IN : AL (Number of Sector to read)
;-- OUT : Buffer (ES:BX)
READSECTOR:
pusha ;-- push all register
mov ah,2h
mov ch,[absTrack]
mov cl,[absSector]
mov dh,[absHead]
mov dl,[bootdev]
stc
int 13h
popa ;-- pop all register
ret
;-- IN : AX (LBA)
; OUT : Absolute Track (Cylinder), Head, Sector
LBACHS:
pusha ;-- push all register
xor dx,dx
;-- Calculation Absolute Sector
div word[SectorPerTrack]
inc dl
mov byte[absSector],dl
;-- Calculation Absolute Head and Track
xor dx,dx
div word[Heads]
mov byte[absHead],dl
mov byte[absTrack],al
popa ;-- pop all register
ret
absTrack db 0
absHead db 0
absSector db 0
I have problem when read sector if al = 250, the data is not a valid data, i have check to dump buffer at memory.. But if i read sector set al=1 then buffer have a valid data. How it can be? I need to read FAT table buffered at memory, but it seems gonna wrong when i set al=250. Why 250? because SectorPerFAT=250. Anyone have idea about this?
Raddel wrote:My problem is at bold instruction, i try to read first FAT on disk and i want to read whole one FAT in memory, that is point to ES:BX. But when i check at ES:BX there a invalid value, not a FAT Table. But when I change the value :
ES:BX have a valid value. I need help who have experience of this thing... Is there limitation at INT 13h to read disk?
Sorry if my english bad.
Function 2 is able to read the sectors on "one track". You can try to use function 42h before using function 2. I think to cache only actual fragments of FAT is better way. I'm loading whole FAT for floppies only.
If you have seen bad English in my words, tell me what's wrong, please.
Raddel wrote:Here is my code READSECTOR and LBA2CHS
I have problem when read sector if al = 250, the data is not a valid data, i have check to dump buffer at memory.. But if i read sector set al=1 then buffer have a valid data. How it can be? I need to read FAT table buffered at memory, but it seems gonna wrong when i set al=250. Why 250? because SectorPerFAT=250. Anyone have idea about this?
250 Sectors per FAT does not mean the FAT starts at sector 250; if I remember correctly it starts after the reserved sectors.
@azblues : I have calculate start of LBA before call READSECTOR. al=250 is a number of sector, that's not mean the start of sector, the start of sector read from sector 4.
@Egos: May be you right, i need to extended read. Could you have some example code for that?
If just a disk 1.44Mb it has a little size of FAT, And how i can read FAT Table that have size of partition above 1GB?
Does anyone now the trick about read FAT table in memory?
Raddel wrote:Could you have some example code for that?
Function 42h is easy to use, but don't forget to check support for it by calling function 41h.
If just a disk 1.44Mb it has a little size of FAT, And how i can read FAT Table that have size of partition above 1GB?
Does anyone now the trick about read FAT table in memory?
As I said above you can cache only actual fragments of FAT е.g. only one sector of FAT and use it until you need to load other one.
If you have seen bad English in my words, tell me what's wrong, please.