source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/PrepareBuffer.asm@ 219

Last change on this file since 219 was 218, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Number of sectors to transfer is now limited to 1-128 for old INT 13h functions.
File size: 1.5 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for preparing data buffer for transfer.
3
4; Section containing code
5SECTION .text
6
7;---------------------------------------------------------------------
8; PrepareBuffer_ToESSIforOldInt13hTransfer
9; Parameters:
10; AL: Number of sectors to transfer
11; SS:BP: Ptr to IDEPACK
12; Parameters on INTPACK:
13; ES:BX: Ptr to data buffer
14; Returns:
15; ES:SI: Ptr to normalized data buffer
16; Exits INT 13h if error
17; Corrupts registers:
18; BX
19;--------------------------------------------------------------------
20ALIGN JUMP_ALIGN
21PrepareBuffer_ToESSIforOldInt13hTransfer:
22 ; Normalize buffer pointer
23 mov bx, [bp+IDEPACK.intpack+INTPACK.bx] ; Load offset
24 mov si, bx
25 eSHR_IM bx, 4 ; Divide offset by 16
26 add bx, [bp+IDEPACK.intpack+INTPACK.es]
27 mov es, bx ; Segment normalized
28 and si, BYTE 0Fh ; Offset normalized
29
30 ; Check if valid number of sectors
31 test al, al
32 js SHORT .CheckZeroOffsetFor128Sectors
33 jz SHORT .InvalidNumberOfSectorsRequested
34 ret ; Continue with transfer
35
36ALIGN JUMP_ALIGN
37.CheckZeroOffsetFor128Sectors:
38 cmp al, 128
39 ja SHORT .InvalidNumberOfSectorsRequested
40 mov ah, RET_HD_BOUNDARY
41 test si, si ; Offset must be zero to xfer 128 sectors
42 jnz SHORT .CannotAlignPointerProperly
43 ret ; Continue with transfer
44
45.InvalidNumberOfSectorsRequested:
46 mov ah, RET_HD_INVALID
47.CannotAlignPointerProperly:
48 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
49
Note: See TracBrowser for help on using the repository browser.