source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCapacity.asm @ 148

Last change on this file since 148 was 148, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
File size: 1.4 KB
RevLine 
[88]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Functions for hard disk capacity calculations.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Calculates sector count from L-CHS values returned by INT 13h, AH=08h.
9;
10; HCapacity_GetSectorCountFromForeignAH08h:
11; HCapacity_GetSectorCountFromOurAH08h:
12;   Parameters:
13;       DL:     Drive number
14;       DS:     RAMVARS segment
[148]15;       DS:DI:  Ptr to DPT (HCapacity_GetSectorCountFromOurAH08h)
[3]16;   Returns:
17;       DX:AX:  Total sector count
18;       BX:     Zero
19;   Corrupts registers:
20;       CX
21;--------------------------------------------------------------------
22ALIGN JUMP_ALIGN
23HCapacity_GetSectorCountFromForeignAH08h:
[148]24    mov     ah, GET_DRIVE_PARAMETERS
[32]25    call    Int13h_CallPreviousInt13hHandler
[148]26    jmp     SHORT ConvertAH08hReturnValuesToSectorCount
[3]27
28ALIGN JUMP_ALIGN
29HCapacity_GetSectorCountFromOurAH08h:
30    call    AH8h_GetDriveParameters
[148]31    ; Fall to ConvertAH08hReturnValuesToSectorCount
[3]32
[148]33ConvertAH08hReturnValuesToSectorCount:
[3]34    call    HAddress_ExtractLCHSFromBiosParams
35    xor     ax, ax          ; Zero AX
36    inc     cx              ; Max cylinder number to cylinder count
37    xchg    al, bh          ; AX=Max head number, BX=Sectors per track
38    inc     ax              ; AX=Head count
39    mul     bx              ; AX=Head count * Sectors per track
40    mul     cx              ; DX:AX = Total sector count
[117]41    xor     bx, bx          ; Zero BX for 48-bit sector count (and clear CF)
[3]42    ret
Note: See TracBrowser for help on using the repository browser.