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

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

Changes to XTIDE Universal BIOS:

  • Now uses new libraries (untested)
  • Non-working since code size is too large
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; Returns:
16; DX:AX: Total sector count
17; BX: Zero
18; Corrupts registers:
19; CX
20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22HCapacity_GetSectorCountFromForeignAH08h:
23 mov ah, 08h ; Get Drive Parameters
24 call Int13h_CallPreviousInt13hHandler
25 jmp SHORT HCapacity_ConvertAH08hReturnValuesToSectorCount
26
27ALIGN JUMP_ALIGN
28HCapacity_GetSectorCountFromOurAH08h:
29 push di
30 call AH8h_GetDriveParameters
31 pop di
32 ; Fall to HCapacity_ConvertAH08hReturnValuesToSectorCount
33
34ALIGN JUMP_ALIGN
35HCapacity_ConvertAH08hReturnValuesToSectorCount:
36 call HAddress_ExtractLCHSFromBiosParams
37 xor ax, ax ; Zero AX
38 inc cx ; Max cylinder number to cylinder count
39 xchg al, bh ; AX=Max head number, BX=Sectors per track
40 inc ax ; AX=Head count
41 mul bx ; AX=Head count * Sectors per track
42 mul cx ; DX:AX = Total sector count
43 xor bx, bx ; Zero BX for 48-bit sector count
44 ret
Note: See TracBrowser for help on using the repository browser.