source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm @ 84

Last change on this file since 84 was 84, checked in by krille_n_@…, 13 years ago

Minor size optimizations in various files.

File size: 2.0 KB
Line 
1; File name     :   AHCh_HSeek.asm
2; Project name  :   IDE BIOS
3; Created date  :   13.12.2007
4; Last update   :   14.1.2011
5; Author        :   Tomi Tilli,
6;               :   Krister Nordvall (optimizations)
7; Description   :   Int 13h function AH=Ch, Seek.
8
9; Section containing code
10SECTION .text
11
12;--------------------------------------------------------------------
13; Int 13h function AH=Ch, Seek.
14;
15; AHCh_HandlerForSeek
16;   Parameters:
17;       AH:     Bios function Ch
18;       CH:     Cylinder number, bits 7...0
19;       CL:     Bits 7...6: Cylinder number bits 9 and 8
20;               Bits 5...0: Starting sector number (1...63)
21;       DH:     Starting head number (0...255)
22;       DL:     Drive number
23;   Parameters loaded by Int13h_Jump:
24;       DS:     RAMVARS segment
25;   Returns:
26;       AH:     BIOS Error code
27;       CF:     0 if succesfull, 1 if error
28;       IF:     1
29;   Corrupts registers:
30;       Flags
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33AHCh_HandlerForSeek:
34    push    dx
35    push    cx
36    push    bx
37    push    ax
38%ifndef USE_186
39    call    AHCh_SeekToCylinder
40    jmp     Int13h_PopXRegsAndReturn
41%else
42    push    Int13h_PopXRegsAndReturn
43    ; Fall through to AHCh_SeekToCylinder
44%endif
45
46
47;--------------------------------------------------------------------
48; Seeks to a cylinder.
49;
50; AHCh_SeekToCylinder
51;   Parameters:
52;       CH:     Cylinder number, bits 7...0
53;       CL:     Bits 7...6: Cylinder number bits 9 and 8
54;               Bits 5...0: Starting sector number (1...63)
55;       DH:     Starting head number (0...255)
56;       DL:     Drive Number
57;       DS:     RAMVARS segment
58;   Returns:
59;       DS:DI:  Ptr to DPT
60;       AH:     BIOS Error code
61;       CF:     0 if succesfull, 1 if error
62;   Corrupts registers:
63;       AL, BX, CX, DX
64;--------------------------------------------------------------------
65ALIGN JUMP_ALIGN
66AHCh_SeekToCylinder:
67    call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
68    mov     ax, HCMD_SEEK<<8            ; Load cmd to AH, AL=zero sector cnt
69    call    HCommand_OutputCountAndLCHSandCommand
70    jc      SHORT .Return               ; Return if error
71    mov     bx, di                      ; DS:BX now points to DPT
72    jmp     HStatus_WaitIrqOrRdy        ; Wait for IRQ or RDY
73.Return:
74    ret
Note: See TracBrowser for help on using the repository browser.