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

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

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
File size: 1.9 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 13h function AH=Ch, Seek.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Int 13h function AH=Ch, Seek.
9;
10; AHCh_HandlerForSeek
11;   Parameters:
12;       AH:     Bios function Ch
13;       CH:     Cylinder number, bits 7...0
14;       CL:     Bits 7...6: Cylinder number bits 9 and 8
15;               Bits 5...0: Starting sector number (1...63)
16;       DH:     Starting head number (0...255)
17;       DL:     Drive number
18;   Parameters loaded by Int13h_Jump:
19;       DS:     RAMVARS segment
20;   Returns:
21;       AH:     BIOS Error code
22;       CF:     0 if succesfull, 1 if error
23;       IF:     1
24;   Corrupts registers:
25;       Flags
26;--------------------------------------------------------------------
27ALIGN JUMP_ALIGN
28AHCh_HandlerForSeek:
29    push    dx
30    push    cx
31    push    bx
32    push    ax
33%ifndef USE_186
34    call    AHCh_SeekToCylinder
35    jmp     Int13h_PopXRegsAndReturn
36%else
37    push    Int13h_PopXRegsAndReturn
38    ; Fall through to AHCh_SeekToCylinder
39%endif
40
41
42;--------------------------------------------------------------------
43; Seeks to a cylinder.
44;
45; AHCh_SeekToCylinder
46;   Parameters:
47;       CH:     Cylinder number, bits 7...0
48;       CL:     Bits 7...6: Cylinder number bits 9 and 8
49;               Bits 5...0: Starting sector number (1...63)
50;       DH:     Starting head number (0...255)
51;       DL:     Drive Number
52;       DS:     RAMVARS segment
53;   Returns:
54;       DS:DI:  Ptr to DPT
55;       AH:     BIOS Error code
56;       CF:     0 if succesfull, 1 if error
57;   Corrupts registers:
58;       AL, BX, CX, DX
59;--------------------------------------------------------------------
60ALIGN JUMP_ALIGN
61AHCh_SeekToCylinder:
62    call    FindDPT_ForDriveNumber      ; DS:DI now points to DPT
63    mov     ax, HCMD_SEEK<<8            ; Load cmd to AH, AL=zero sector cnt
64    call    HCommand_OutputCountAndLCHSandCommand
65    jc      SHORT .Return               ; Return if error
66    mov     bx, di                      ; DS:BX now points to DPT
67    jmp     HStatus_WaitIrqOrRdy        ; Wait for IRQ or RDY
68.Return:
69    ret
Note: See TracBrowser for help on using the repository browser.