;-------------------------------------------------------------------------------
; FATware - firmware and file system driver for ZX Spectrum divIDE interface
; Copyright (c) 2005-2009 Milos Bazelides (baze)
;-------------------------------------------------------------------------------
; This software is provided "as is" without warranties or conditions of any
; kind, either express or implied. In no event shall the author(s) be held
; liable for any damages arising from the use of this software.
; See accompanying "licence.txt" file for copyright and terms of use.
;-------------------------------------------------------------------------------
; This file contains generic FAT file system related constants and macros.
; Please DO NOT include any ATA or platform specific stuff here.
;-------------------------------------------------------------------------------

; Boot Sector / Bios Parameter Block entries we care about

bsOEMName	equ	3

bpbBytsPerSec	equ	11
bpbSecPerClus	equ	13
bpbRsvdSecCnt	equ	14
bpbNumFATs	equ	16
bpbRootEntCnt	equ	17
bpbTotSec16	equ	19
bpbMedia	equ	21
bpbFATSz16	equ	22
bpbSecPerTrk	equ	24
bpbNumHeads	equ	26
bpbHiddSec	equ	28
bpbTotSec32	equ	32

bsDrvNum	equ	36
bsReserved1	equ	37
bsBootSig	equ	38
bsVolID		equ	39
bsVolLab	equ	43
bsFilSysType	equ	54

; FAT file attributes

ATR_READ_ONLY	equ	01h
ATR_HIDDEN	equ	02h
ATR_SYSTEM	equ	04h
ATR_VOLUME_ID	equ	08h
ATR_DIRECTORY	equ	10h
ATR_ARCHIVE	equ	20h
ATR_LONG_NAME	equ	0Fh
ATR_MASK	equ	3Fh

; FAT Directory Entry structure

dirName		equ	0
dirExt		equ	8
dirAttr		equ	11
dirNTRes	equ	12
dirCrtTimeTenth	equ	13
dirCrtTime	equ	14
dirCrtDate	equ	16
dirLstAccDate	equ	18
dirFstClusHi	equ	20	; always 0 for FAT16
dirWrtTime	equ	22
dirWrtDate	equ	24
dirFstClusLo	equ	26
dirFileSize	equ	28

dirSizeOf	equ	32

; FAT Long Name Directory Entry structure

lfnOrd		equ	0	; order of entry (and flags)
lfnName1	equ	1	; long name string 1 (5 characters)
lfnAttr		equ	11	; file attributes (ATR_LONG_NAME)
lfnType		equ	12	; set to 0 (reserved for future use)
lfnChksum	equ	13	; checksum of 8.3 name
lfnName2	equ	14	; long name string 2 (6 characters)
lfnFstClusLO	equ	26	; first cluster number (must be 0)
lfnName3	equ	28	; long name string 3 (2 characters)

lfnSizeOf	equ	32

