home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
utility
/
sdf105.arj
/
FAT.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-08-26
|
1KB
|
90 lines
;; ╔════════════════════════╗
;; ║ 23/08/1993 - mjova ║
;; ╚════════════════════════╝
locals
.model large
extrn _FAT:DWORD;
.code
; ------------------------------------------------------------
; finds next sector
public c fat12
fat12 proc c returns nextclu:word
arg cluster:word
mov dx, 0
mov ax, cluster
and ax, 0fffh
cmp ax, 0ff0h
jae @@EndCluster
mov cx, ax
and cx, 1
shr ax, 1 ; /2
mov bx, ax
add ax, ax
add ax, bx ; *3
rcr dx, 4 ; rcl 1
add ax, cx
mov bx, WORD ptr [_FAT+2]
add bx, dx
mov es, bx
mov bx, ax
mov ax, WORD ptr es:[bx]
mov bx, cluster
and bx, 1
jz @@even
shr ax, 4
jmp @@ChkEnd
@@even: and ax, 0fffh
@@ChkEnd: cmp ax, 0ff0h
jae @@EndCluster
ret
@@EndCluster: mov ax, 0ffffh
ret
fat12 endp
; ------------------------------------------------------------
public c fat16
fat16 proc c returns nextclu:word
arg cluster:word
mov ax, cluster
cmp ax, 0fff0h
jae @@EndCluster
add ax, ax
mov dx, 0
rcr dx, 4 ; rcl 1
mov bx, WORD ptr [_FAT+2]
add bx, dx
mov es, bx
mov bx, ax
mov ax, WORD ptr es:[bx]
cmp ax, 0fff0h
jae @@EndCluster
ret
@@EndCluster: mov ax, 0ffffh
ret
fat16 endp
end