mirror of
https://github.com/reactos/reactos.git
synced 2025-05-15 07:17:23 +00:00
Lot's of fixes for the FAT12/16 boot sector code.
svn path=/trunk/; revision=4737
This commit is contained in:
parent
faa8f94f27
commit
f152732d04
1 changed files with 11 additions and 6 deletions
|
@ -144,6 +144,7 @@ CalcDriveSize:
|
||||||
; DX:AX now has the number of the starting sector of the root directory
|
; DX:AX now has the number of the starting sector of the root directory
|
||||||
|
|
||||||
; Now calculate the size of the root directory
|
; Now calculate the size of the root directory
|
||||||
|
xor dx,dx
|
||||||
mov ax,0020h ; Size of dir entry
|
mov ax,0020h ; Size of dir entry
|
||||||
mul si ; Times the number of entries
|
mul si ; Times the number of entries
|
||||||
mov bx,[BYTE bp+BytesPerSector]
|
mov bx,[BYTE bp+BytesPerSector]
|
||||||
|
@ -257,7 +258,7 @@ ReadCluster:
|
||||||
add ax,[BYTE bp-DataAreaStartLow] ; Add start of data area
|
add ax,[BYTE bp-DataAreaStartLow] ; Add start of data area
|
||||||
adc dx,[BYTE bp-DataAreaStartHigh] ; Now we have DX:AX with the logical start sector of OSLOADER.SYS
|
adc dx,[BYTE bp-DataAreaStartHigh] ; Now we have DX:AX with the logical start sector of OSLOADER.SYS
|
||||||
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
||||||
mov cl,BYTE [BYTE bp+SectsPerCluster]
|
;mov cl,BYTE [BYTE bp+SectsPerCluster]; Sectors per cluster still in CX
|
||||||
;call ReadSectors
|
;call ReadSectors
|
||||||
;ret
|
;ret
|
||||||
|
|
||||||
|
@ -277,12 +278,14 @@ ReadSectors:
|
||||||
adc dx,byte 0
|
adc dx,byte 0
|
||||||
|
|
||||||
cmp dx,WORD [BYTE bp-BiosCHSDriveSizeHigh] ; Check if they are reading a sector within CHS range
|
cmp dx,WORD [BYTE bp-BiosCHSDriveSizeHigh] ; Check if they are reading a sector within CHS range
|
||||||
jb ReadSectorsCHS ; Yes - go to the old CHS routine
|
ja ReadSectorsLBA ; No - go to the LBA routine
|
||||||
|
jb ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||||
cmp ax,WORD [BYTE bp-BiosCHSDriveSizeLow] ; Check if they are reading a sector within CHS range
|
cmp ax,WORD [BYTE bp-BiosCHSDriveSizeLow] ; Check if they are reading a sector within CHS range
|
||||||
jbe ReadSectorsCHS ; Yes - go to the old CHS routine
|
jbe ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||||
|
|
||||||
ReadSectorsLBA:
|
ReadSectorsLBA:
|
||||||
popa
|
popa
|
||||||
|
ReadSectorsLBALoop:
|
||||||
pusha ; Save logical sector number & sector count
|
pusha ; Save logical sector number & sector count
|
||||||
|
|
||||||
o32 push byte 0
|
o32 push byte 0
|
||||||
|
@ -323,11 +326,13 @@ ReadSectorsLBA:
|
||||||
inc ax ; Increment Sector to Read
|
inc ax ; Increment Sector to Read
|
||||||
adc dx,byte 0
|
adc dx,byte 0
|
||||||
|
|
||||||
mov dx,es
|
push bx
|
||||||
add dx,byte 20h ; Increment read buffer for next sector
|
mov bx,es
|
||||||
mov es,dx
|
add bx,byte 20h ; Increment read buffer for next sector
|
||||||
|
mov es,bx
|
||||||
|
pop bx
|
||||||
|
|
||||||
loop ReadSectorsLBA ; Read next sector
|
loop ReadSectorsLBALoop ; Read next sector
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue