source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.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.4 KB
Line 
1; File name     :   AH24h_HSetBlocks.asm
2; Project name  :   IDE BIOS
3; Created date  :   28.12.2009
4; Last update   :   14.1.2011
5; Author        :   Tomi Tilli,
6;               :   Krister Nordvall (optimizations)
7; Description   :   Int 13h function AH=24h, Set Multiple Blocks.
8
9; Section containing code
10SECTION .text
11
12;--------------------------------------------------------------------
13; Int 13h function AH=24h, Set Multiple Blocks.
14;
15; AH24h_HandlerForSetMultipleBlocks
16;   Parameters:
17;       AH:     Bios function 24h
18;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
19;       DL:     Drive number
20;   Parameters loaded by Int13h_Jump:
21;       DS:     RAMVARS segment
22;   Returns:
23;       AH:     Int 13h return status
24;       CF:     0 if succesfull, 1 if error
25;       IF:     1
26;   Corrupts registers:
27;       Flags
28;--------------------------------------------------------------------
29ALIGN JUMP_ALIGN
30AH24h_HandlerForSetMultipleBlocks:
31    push    dx
32    push    cx
33    push    bx
34    push    ax
35%ifndef USE_186
36    call    AH24h_SetBlockSize
37    jmp     Int13h_PopXRegsAndReturn
38%else
39    push    Int13h_PopXRegsAndReturn
40    ; Fall through to AH24h_SetBlockSize
41%endif
42
43
44;--------------------------------------------------------------------
45; Sets block size for block mode transfers.
46;
47; AH24h_SetBlockSize
48;   Parameters:
49;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
50;       DL:     Drive number
51;       DS:     RAMVARS segment
52;   Returns:
53;       DS:DI:  Ptr to DPT
54;       AH:     Int 13h return status
55;       CF:     0 if succesfull, 1 if error
56;   Corrupts registers:
57;       AL, BX, CX, DX, DI
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60AH24h_SetBlockSize:
61    ; Select Master or Slave and wait until ready
62    mov     bl, al                              ; Backup block size
63    call    FindDPT_ForDriveNumber              ; DS:DI now points to DPT
64    call    HDrvSel_SelectDriveAndDisableIRQ    ; Select drive and wait until ready
65    jc      SHORT .Return                       ; Return if error
66
67    ; Output block size and command
68    mov     al, bl                              ; Restore block size to AL
69    mov     ah, HCMD_SET_MUL                    ; Load command to AH
70    mov     dx, [RAMVARS.wIdeBase]              ; Load base port address
71    add     dx, BYTE REG_IDE_CNT
72    call    HCommand_OutputSectorCountAndCommand
73    call    HStatus_WaitBsyDefTime              ; Wait until drive not busy
74    jc      SHORT .DisableBlockMode
75
76    ; Store new block size to DPT and return
77    mov     [di+DPT.bSetBlock], bl              ; Store new block size
78    xor     ah, ah                              ; Zero AH and CF since success
79    ret
80.DisableBlockMode:
81    mov     BYTE [di+DPT.bSetBlock], 1          ; Disable block mode
82.Return:
83    ret
Note: See TracBrowser for help on using the repository browser.