source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm@ 3

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