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

Last change on this file since 149 was 148, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
File size: 1.4 KB
Line 
1; Project name : XTIDE Universal BIOS
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
15; DS:DI: Ptr to DPT (HCapacity_GetSectorCountFromOurAH08h)
16; Returns:
17; DX:AX: Total sector count
18; BX: Zero
19; Corrupts registers:
20; CX
21;--------------------------------------------------------------------
22ALIGN JUMP_ALIGN
23HCapacity_GetSectorCountFromForeignAH08h:
24 mov ah, GET_DRIVE_PARAMETERS
25 call Int13h_CallPreviousInt13hHandler
26 jmp SHORT ConvertAH08hReturnValuesToSectorCount
27
28ALIGN JUMP_ALIGN
29HCapacity_GetSectorCountFromOurAH08h:
30 call AH8h_GetDriveParameters
31 ; Fall to ConvertAH08hReturnValuesToSectorCount
32
33ConvertAH08hReturnValuesToSectorCount:
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
41 xor bx, bx ; Zero BX for 48-bit sector count (and clear CF)
42 ret
Note: See TracBrowser for help on using the repository browser.