source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm @ 148

Last change on this file since 148 was 148, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
File size: 3.0 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Int 13h function AH=23h,
3;                   Set Controller Features Register.
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Int 13h function AH=23h, Set Controller Features Register.
10;
11; AH23h_HandlerForSetControllerFeatures
12;   Parameters:
13;       AL, CX: Same as in INTPACK
14;       DL:     Translated Drive number
15;       DS:DI:  Ptr to DPT (in RAMVARS segment)
16;       SS:BP:  Ptr to INTPACK
17;   Parameters on INTPACK in SS:BP:
18;       AL:     Feature Number (parameter to Features Register = subcommand)
19;   (Parameter registers are undocumented, there are specific for this BIOS):
20;       BH:     Parameter to Sector Count Register (subcommand specific)
21;       BL:     Parameter to Sector Number Register (subcommand specific)
22;       CL:     Parameter to Low Cylinder Register (subcommand specific)
23;       CH:     Parameter to High Cylinder Register (subcommand specific)
24;   Returns with INTPACK in SS:BP:
25;       AH:     Int 13h return status
26;       CF:     0 if succesfull, 1 if error
27;--------------------------------------------------------------------
28ALIGN JUMP_ALIGN
29AH23h_HandlerForSetControllerFeatures:
30%ifndef USE_186
31    call    AH23h_SetControllerFeatures
32    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
33%else
34    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
35    ; Fall through to AH23h_SetControllerFeatures
36%endif
37
38
39;--------------------------------------------------------------------
40; AH23h_SetControllerFeatures
41;   Parameters:
42;       AL:     Feature Number (parameter to Features Register = subcommand)
43;       BH:     Parameter to Sector Count Register (subcommand specific)
44;       BL:     Parameter to Sector Number Register (subcommand specific)
45;       CL:     Parameter to Low Cylinder Register (subcommand specific)
46;       CH:     Parameter to High Cylinder Register (subcommand specific)
47;       DS:DI:  Ptr to DPT (in RAMVARS segment)
48;   Returns:
49;       AH:     Int 13h return status
50;       CF:     0 if succesfull, 1 if error
51;   Corrupts registers:
52;       AX, BX, CX, DX, SI
53;--------------------------------------------------------------------
54ALIGN JUMP_ALIGN
55AH23h_SetControllerFeatures:
56    ; Backup AL and BH to SI
57    mov     ah, bh
58    xchg    si, ax
59
60    ; Select Master or Slave and wait until ready
61    call    HDrvSel_SelectDriveAndDisableIRQ
62    jc      SHORT .ReturnWithErrorCodeInAH
63
64    ; Output Feature Number
65    mov     ax, si                      ; Feature number to AL
66    mov     dx, [RAMVARS.wIdeBase]      ; Load base port address
67    inc     dx                          ; REGW_IDE_FEAT
68    out     dx, al
69
70    ; Output parameters to Sector Number Register and Cylinder Registers
71    xor     bh, bh                      ; Zero head number
72    dec     dx                          ; Back to base port address
73    call    HCommand_OutputTranslatedLCHSaddress
74
75    ; Output parameter to Sector Count Register and command
76    xchg    ax, si                      ; Sector Count Reg param to AH
77    mov     al, ah                      ; Sector Count Reg param to AL
78    mov     ah, HCMD_SET_FEAT           ; Load Set Features command to AH
79    call    HCommand_OutputSectorCountAndCommand
80
81    jmp     HStatus_WaitBsyDefTime      ; Wait until drive ready
82.ReturnWithErrorCodeInAH:
83    ret
Note: See TracBrowser for help on using the repository browser.