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

Last change on this file since 149 was 148, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • INT 13h optimizations to save almost 100 bytes.
File size: 2.3 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Int 13h function AH=24h, Set Multiple Blocks.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Int 13h function AH=24h, Set Multiple Blocks.
9;
10; AH24h_HandlerForSetMultipleBlocks
11; Parameters:
12; AL: Same as in INTPACK
13; DL: Translated Drive number
14; DS:DI: Ptr to DPT (in RAMVARS segment)
15; SS:BP: Ptr to INTPACK
16; Parameters on INTPACK in SS:BP:
17; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
18; Returns with INTPACK in SS:BP:
19; AH: Int 13h return status
20; CF: 0 if succesfull, 1 if error
21;--------------------------------------------------------------------
22ALIGN JUMP_ALIGN
23AH24h_HandlerForSetMultipleBlocks:
24%ifndef USE_186
25 call AH24h_SetBlockSize
26 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
27%else
28 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
29 ; Fall through to AH24h_SetBlockSize
30%endif
31
32
33;--------------------------------------------------------------------
34; Sets block size for block mode transfers.
35;
36; AH24h_SetBlockSize
37; Parameters:
38; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
39; DS:DI: Ptr to DPT (in RAMVARS segment)
40; Returns:
41; AH: Int 13h return status
42; CF: 0 if succesfull, 1 if error
43; Corrupts registers:
44; AL, BX, CX, DX
45;--------------------------------------------------------------------
46ALIGN JUMP_ALIGN
47AH24h_SetBlockSize:
48 ; Select Master or Slave and wait until ready
49 mov bl, al ; Backup block size
50 call HDrvSel_SelectDriveAndDisableIRQ ; Select drive and wait until ready
51 jc SHORT .ReturnWithErrorCodeInAH ; Return if error
52
53 ; Output block size and command
54 mov al, bl ; Restore block size to AL
55 mov ah, HCMD_SET_MUL ; Load command to AH
56 mov dx, [RAMVARS.wIdeBase] ; Load base port address
57 add dx, BYTE REG_IDE_CNT
58 call HCommand_OutputSectorCountAndCommand
59 call HStatus_WaitBsyDefTime ; Wait until drive not busy
60 jc SHORT .DisableBlockMode
61
62 ; Store new block size to DPT and return
63 mov [di+DPT.bSetBlock], bl ; Store new block size
64 xor ah, ah ; Zero AH and CF since success
65 ret
66.DisableBlockMode:
67 mov BYTE [di+DPT.bSetBlock], 1 ; Disable block mode
68.ReturnWithErrorCodeInAH:
69 ret
Note: See TracBrowser for help on using the repository browser.