source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm @ 257

Last change on this file since 257 was 257, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • AH=15h now properly stores error code to BDA.
File size: 2.2 KB
RevLine 
[117]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Int 13h function AH=15h, Read Disk Drive Size.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Int 13h function AH=15h, Read Disk Drive Size.
9;
10; AH15h_HandlerForReadDiskDriveSize
11;   Parameters:
[148]12;       DL:     Translated Drive number
13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
[150]14;       SS:BP:  Ptr to IDEPACK
15;   Returns with INTPACK:
[3]16;       If succesfull:
17;           AH:     3 (Hard disk accessible)
18;           CX:DX:  Total number of sectors
19;           CF:     0
20;       If failed:
21;           AH:     0 (Drive not present)
22;           CX:DX:  0
23;           CF:     1
24;--------------------------------------------------------------------
25ALIGN JUMP_ALIGN
26AH15h_HandlerForReadDiskDriveSize:
[252]27    call    AH15h_GetSectorCountToBXDXAX
[257]28    mov     [bp+IDEPACK.intpack+INTPACK.cx], dx ; HIWORD to CX
29    mov     [bp+IDEPACK.intpack+INTPACK.dx], ax ; LOWORD to DX
[3]30
[148]31    xor     ah, ah
[257]32    call    Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH    ; Store success to BDA and CF
33    mov     BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3             ; Type code = Hard disk
[148]34    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
[150]35
36
37;--------------------------------------------------------------------
38; AH15h_GetSectorCountFromForeignDriveToDXAX:
[252]39; AH15h_GetSectorCountToBXDXAX:
[150]40;   Parameters:
[252]41;       DL:     Drive number (AH15h_GetSectorCountFromForeignDriveToDXAX only)
[150]42;       DS:     RAMVARS segment
[252]43;       DS:DI:  Ptr to DPT (AH15h_GetSectorCountToDXAX only)
[150]44;   Returns:
45;       DX:AX:  Total sector count
46;       BX:     Zero
47;   Corrupts registers:
48;       CX
49;--------------------------------------------------------------------
50AH15h_GetSectorCountFromForeignDriveToDXAX:
51    mov     ah, GET_DRIVE_PARAMETERS
52    call    Int13h_CallPreviousInt13hHandler
53    jmp     SHORT ConvertAH08hReturnValuesToSectorCount
54
[252]55AH15h_GetSectorCountToBXDXAX:
[150]56    call    AH8h_GetDriveParameters
57    ; Fall to ConvertAH08hReturnValuesToSectorCount
58
59ConvertAH08hReturnValuesToSectorCount:
[155]60    call    Address_ExtractLCHSparametersFromOldInt13hAddress
[227]61    xchg    ax, cx
62    inc     ax              ; Max cylinder number to cylinder count
63.MultiplyChsInAXBLBHtoBXDXAX:
64    xchg    bx, ax
65    mul     ah          ; Multiply heads and sectors
66    mul     bx          ; Multiply with cylinders
67    xor     bx, bx
[150]68    ret
Note: See TracBrowser for help on using the repository browser.