| Index | Manual | Download | Source | Macros | Embedded word Case ins.
Sitemap | Links | Forum | Tests | Projects

# bioss.htm
Structures
BPB_FAT16
BPB_FAT32
BPB_NTFS
DIR_ENTRY
DPT
HDPT
LBA

This file declares OS-independent structures and symbol names used in function of Basic Input Output System BIOS.

    bioss HEAD  ; Start of interface block includable to other programs.

↑ BPB_FAT16
  Structure BIOS Parameter Block is used in boot sector to describe physical parameters of disk device/volume formated to filesystem FAT16.
  BPB is placed at the fixed position (0x0B) in the boot sector. Boot sector itself is loaded at the fixed virtual address 0x07C00 during the boot process, so BPB object can be referred without relocation at the address 0:0x7C0B.
Documented
  [BootSec]

                     ; Predefined static values are typical for 1.44MB floppy disk.
    |[BPB_FAT16]| BPB_FAT16           STRUC   ; Base BPB_FAT16. Size=0x19=25.
    |7C0B:0002  | .BytesPerSector      D WORD  0x0200 ; Size of HW sector, usualy 512.
    |7C0D:01    | .SectorsPerCluster   D BYTE  0x01   ; Valid values 1,2,4,8,16,32,64,128.
    |7C0E:0100  | .ReservedSectors     D WORD  0x0001 ; NrOfSectors preceding FAT.
    |7C10:02    | .NumberOfFats        D BYTE  0x02   ;
    |7C11:E000  | .RootEntries         D WORD  0x00E0 ; Max number of YWORD entries in the root dir.
    |7C13:400B  | .SmallSectors        D WORD  0x0B40 ; See also .LargeSectors.
    |7C15:F0    | .MediaDescriptor     D BYTE  0xF0   ; 0xF0 floppy disk, 0xF8 hard disk.
    |7C16:0900  | .SectorsPerFat       D WORD  0x0009 ;
    |7C18:1200  | .SectorsPerTrack     D WORD  0x0012 ;
    |7C1A:0200  | .NumberOfHeads       D WORD  0x0002 ;
    |7C1C:0000~~| .HiddenSectors       D DWORD 0x00000000
    |7C20:0000~~| .LargeSectors        D DWORD 0x00000000
    |7C24:      |                      ;       Extended BPB_FAT16. Size=0x1A=26.
    |7C24:00    | .PhysicalDriveNumber D BYTE  0x00   ; 0x00 floppy disk, 0x80 hard disk.
    |7C25:00    | .Reserved            D BYTE  0x00   ;
    |7C26:29    | .ExtBootSignature    D BYTE  0x29   ; Or 0x28.
    |7C27:1122~~| .VolumeSerialNumber  D DWORD %^TIME ; Randomly generated number.
    |7C2B:4E4F~~| .VolumeLabel         D B "NO NAME    " ; Space-padded to size=11.
    |7C36:4641~~| .FileSystemType      D B "FAT12   "    ; Space-padded to size=8.
    |7C3E:      | ENDSTRUC BPB_FAT16   ;   Total BPB_FAT16. Size=0x33=51.

↑ BPB_FAT32
  Structure BIOS Parameter Block is used in boot sector to describe physical parameters of disk device/volume formated to filesystem FAT32.
  BPB is placed at the fixed position (0x0B) in the boot sector. Boot sector itself is loaded at the fixed virtual address 0x07C00 during the boot process, so BPB object can be referred without relocation at the address 0:0x7C0B.
Documented
  [BootSec]
Encoding
  Encoding of the member `BPB_FAT32.ExtendedFlags`: ┌┬┬┬─┬┬┬┬──┬┬┬──────── reserved ││││ ││││ │││ 0000_0000_0000_0000b .ExtendedFlags layout │ ││││ │ └┴┴┴─── 0..15 zero-based ordinal number of active FAT when mirroring is disabled. └─────────── 1= FAT mirroring is disabled, use the active one.

             ; Predefined static values are typical for 8GB flash disk.
    |[BPB_FAT32]| BPB_FAT32           STRUC    ; Base BPB_FAT32. Size=0x35=53.
    |7C0B:0002  | .BytesPerSector      D WORD  0x0200 ; Size of HW sector, usualy 512.
    |7C0D:08    | .SectorsPerCluster   D BYTE  0x08   ; Valid values 1,2,4,8,16,32,64,128.
    |7C0E:2000  | .ReservedSectors     D WORD  0x0020 ; NrOfSectors preceding FAT.
    |7C10:02    | .NumberOfFats        D BYTE  0x02   ;
    |7C11:0000  | .RootEntries         D WORD  0x0000 ; Max number of YWORD entries in the root dir.
    |7C13:0000  | .SmallSectors        D WORD  0x0000 ; See .LargeSectors.
    |7C15:F0    | .MediaDescriptor     D BYTE  0xF8   ; 0xF8 hard disk of flash disk, 0xF0 floppy disk.
    |7C16:0000  | .SectorsPerFat       D WORD  0x0000 ;
    |7C18:3F00  | .SectorsPerTrack     D WORD  0x003F ;
    |7C1A:FF00  | .NumberOfHeads       D WORD  0x00FF ;
    |7C1C:2000~~| .HiddenSectors       D DWORD 0x00000020
    |7C20:E0FF~~| .LargeSectors        D DWORD 0x00EFFFE0 ; 7.5 GB.
    |7C24:E33B~~| .SectorsPerFat32     D DWORD 0x00003BE3
    |7C28:0000  | .ExtendedFlags       D WORD  0x0000 ; Encoding see above.
    |7C2A:0000  | .FileSystemVersion   D WORD  0x0000 ;
    |7C2C:0200~~| .RootClusterNumber   D DWORD 0x00000002
    |7C30:0100  | .FsinfoSectorNumber  D WORD  0x0001 ;
    |7C32:0600  | .BackupBootSector    D WORD  0x0006 ;
    |7C34:0000~~| .Reserved            D 12*B  0      ;
    |7C40:      |                      ;       Extended BPB_FAT32. Size=0x1A=26.
    |7C40:00    | .PhysicalDriveNumber D BYTE  0x00   ; 0x00 floppy disk, 0x80 hard disk.
    |7C41:00    | .ExtReserved         D BYTE  0x00   ;
    |7C42:29    | .ExtBootSignature    D BYTE  0x29   ; or 0x28.
    |7C43:1122  | .VolumeSerialNumber  D DWORD %^TIME ; Randomly generated number.
    |7C47:4E4F~~| .VolumeLabel         D B "NO NAME    " ; Space-padded to size=11.
    |7C52:4641~~| .FileSystemType      D B "FAT32   "    ; Space-padded to size=8.
    |7C5A:      | ENDSTRUC BPB_FAT32   ; Total BPB_FAT32. Size=0x4F=79.

↑ BPB_NTFS
  Structure BIOS Parameter Block is used in boot sector to describe physical parameters of disk device/volume formated to filesystem NTFS.
  BPB is placed at the fixed position (0x0B) in the boot sector. Boot sector itself is loaded at the fixed virtual address 0x07C00 during the boot process, so BPB object can be referred without relocation at the address 0:0x7C0B.
Documented
  [BootSec]

              ; Predefined static values are typical for 4GB hard disk.
    |[BPB_NTFS]| BPB_NTFS            STRUC    ; Base BPB_NTFS. Size=0x19=25.
    |7C0B:0200 | .BytesPerSector      D WORD  0x0200 ; Size of HW sector, usualy 512.
    |7C0D:08   | .SectorsPerCluster   D BYTE  0x08   ; Valid values 1,2,4,8,16,32,64,128.
    |7C0E:0000 | .ReservedSectors     D WORD  0x0000 ;
    |7C10:00   | .NumberOfFats        D BYTE  0x00   ;
    |7C11:0000 | .RootEntries         D WORD  0x0000 ;
    |7C13:0000 | .SmallSectors        D WORD  0x0000 ;
    |7C15:F8   | .MediaDescriptor     D BYTE  0xF8   ; Hard disk.
    |7C16:0000 | .SectorsPerFat       D WORD  0x0000 ;
    |7C18:3F00 | .SectorsPerTrack     D WORD  0x003F ;
    |7C1A:FF00 | .NumberOfHeads       D WORD  0x00FF ;
    |7C1C:3F00~| .HiddenSectors       D DWORD 0x0000003F
    |7C20:0000~| .LargeSectors        D DWORD 0x00000000
    |7C24:     |                      ;       Extended BPB_NTFS. Size=0x30=48.
    |7C24:80   | .PhysicalDriveNumber D BYTE  0x80   ; Hard disk.
    |7C25:00   | .Reserved            D BYTE  0x00
    |7C26:80   | .ExtBootSignature    D BYTE  0x80
    |7C27:00   | .NotUsed             D BYTE  0x00
    |7C28:4AF5~| .TotalSectors        D QWORD 0x00000000_007FF54A ; 4 GB.
    |7C30:0400~| .ClusterNumber       D QWORD 0x00000000_00000004 ; Logical cluster number for the file $MFT.
    |7C38:54FF~| .ClusterNumberMirror D QWORD 0x00000000_0007FF54 ; Logical cluster number for the file $MFTMirr.
    |7C40:F600~| .ClustersPerFRS      D DWORD 0x000000F6 ; Number of clusters per File Record Segment.
    |7C44:0100~| .ClustersPerIB       D DWORD 0x00000001 ; Number of clusters per Index Block.
    |7C48:1122~| .VolumeSerialNumberr D QWORD %^DATE<<32+%^TIME   ; Pseudorandomly generated number.       >>
    |7C50:0000~| .Checksum            D DWORD 0x00000000 ;
    |7C54:     | ENDSTRUC BPB_NTFS    ; Total BPB_NTFS. Size=0x49=73.

↑ DIR_ENTRY
  Directory Entry identifies files in DOS FAT16 filesystem.
Documented
  [TechHelp]

    DIR_ENTRY STRUC
    .abName   D 8*B  ; File name, left-justified, blank-padded (e.g. 'FILE    ').
    .abExt    D 3*B  ; File extension, left-justified, blank-padded (e.g. 'EXT').
    .bAttr    D B    ; File attribute.
    .res      D 10*B ; Reserved.
    .rTime    D W    ; Time created/last modified in FileTimeRec format.
    .rDate    D W    ; Date created/last modified in FileDateRec format.
    .wClstrNo D W    ; Cluster number of start of file (link into FAT).
    .lSize    D D    ; File size in bytes.
      ENDSTRUC DIR_ENTRY ; Size=32.

↑ DPT
  Object Diskette Parameter Table alias Disk Base Table can be found in BIOS memory at the address of vector `INT 1Eh` (00078h).
  It specifies a variety of critical variables for diskette drives only.
  The table is set to default values by the ROM-BIOS.
Documented
  [TechHelp]

    DPT STRUC
    .rSrtHdUnld D B ; Bits 0-3: SRT step rate time, bits 4-7: head unload time.
    .rDmaHdLd   D B ; Bit  0: 1=use DMA, bits 2-7: head load time.
    .bMotorOff  D B ; 55-ms increments before turning disk motor off.
    .bSectSize  D B ; Sector size (0=128, 1=256, 2=512, 3=1024).
    .bLastTrack D B ; EOT (last sector on a track).
    .bGapLen    D B ; Gap length for read/write operations.
    .bDTL       D B ; DTL (Data Transfer Length) max transfer when length not set.
    .bGapFmt    D B ; Gap length for format operation.
    .bFillChar  D B ; Fill character for format (normally 0f6H).
    .bHdSettle  D B ; Head-settle time (in milliseconds).
    .bMotorOn   D B ; Motor-startup time (in 1/8th-second intervals)
               ENDSTRUC DPT ; Size=11.

↑ LBA
  Structure Logical Block Addressing is used in the boot sector for conversion between linear block numberring (LBA) and Cylinder-Head-Sector addressing (CHS).
  It is located at fixed linear address 0x7C49 in boot sector of floppy disk formated by MS-DOS.
Documented
  LBA on WIkipedia
See also
  boot16.htm

    LBA      STRUC            ; Address
    .data     D DWORD         ; 0x7C49  Number of 1st sector with data, immediately following the root-directory.
    .cylinder D WORD          ; 0c7C4D  Translated for INT 0x13.
    .track    D BYTE          ; 0c7C4F  Translated for INT 0x13..
    .root     D DWORD         ; 0c7C50  Number of 1st sector in root-directory entry.
             ENDSTRUC LBA     ; Size=11.

↑ HDPT
  Structure Hard Disk Parameter Table for the first hard disk can be found in BIOS memory at the address of vector `INT 41h` (00104h).
  Address for the second hard disk (if exists) can be found at address of vector `INT 46h` (00118h).
  It specifies a variety of critical variables for hard drives.
  The table is set to default values by the ROM-BIOS.
Documented
  [TechHelp]

    HDPT STRUC
    .wMaxCyls    D W ; Maximum number of cylinders.
    .bMaxHds     D B ; Maximum number of heads.
    .wRWCyl      D W ; Starting reduced-write current cylinder.
    .wWPCyl      D W ; Starting write precompensation cylinder.
    .bECCLen     D B ; Maximum ECC data burst length.
    .rOptFlags   D B ; Drive step options: bits 2-0: drive option, bit 6: disable ECC, bit 7: disable retries.
    .bTimeOutStd D B ; Standard timeout value.
    .bTimeOutFmt D B ; Timeout value for format drive.
    .bTimeOutChk D B ; Timeout value for check drive.
    .res         D D ; Reserved.
               ENDSTRUC HDPT ; Size=16.

     ENDHEAD bioss ; End of interface block.

▲Back to the top▲