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

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

Changes to XTIDE Universal BIOS:

  • EBIOS functions now work in lite mode.
File size: 2.1 KB
Line 
1; Project name  :   XTIDE Universal BIOS
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:
12;       DL:     Translated Drive number
13;       DS:DI:  Ptr to DPT (in RAMVARS segment)
14;       SS:BP:  Ptr to IDEPACK
15;   Returns with INTPACK:
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:
27    call    AH15h_GetSectorCountToDXAX
28    mov     [bp+IDEPACK.intpack+INTPACK.cx], dx         ; HIWORD to CX
29    mov     [bp+IDEPACK.intpack+INTPACK.dx], ax         ; LOWORD to DX
30
31    xor     ah, ah
32    call    Int13h_SetErrorCodeToIntpackInSSBPfromAH    ; Store success to BDA and CF
33    mov     BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3     ; Type code = Hard disk
34    jmp     Int13h_ReturnFromHandlerWithoutStoringErrorCode
35
36
37;--------------------------------------------------------------------
38; AH15h_GetSectorCountFromForeignDriveToDXAX:
39; AH15h_GetSectorCountToDXAX:
40;   Parameters:
41;       DL:     Drive number
42;       DS:     RAMVARS segment
43;       DS:DI:  Ptr to DPT (AH15h_GetSectorCount only)
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
55AH15h_GetSectorCountToDXAX:
56    call    AH8h_GetDriveParameters
57    ; Fall to ConvertAH08hReturnValuesToSectorCount
58
59ConvertAH08hReturnValuesToSectorCount:
60    call    Address_ExtractLCHSparametersFromOldInt13hAddress
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
68    ret
Note: See TracBrowser for help on using the repository browser.