1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Int 13h function AH=2h, Read Disk Sectors.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | ;--------------------------------------------------------------------
|
---|
8 | ; Int 13h function AH=2h, Read Disk Sectors.
|
---|
9 | ;
|
---|
10 | ; AH2h_HandlerForReadDiskSectors
|
---|
11 | ; Parameters:
|
---|
12 | ; AL, CX, DH, ES: Same as in INTPACK
|
---|
13 | ; DL: Translated Drive number
|
---|
14 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
15 | ; SS:BP: Ptr to IDEPACK
|
---|
16 | ; Parameters on INTPACK:
|
---|
17 | ; AL: Number of sectors to read (1...255)
|
---|
18 | ; CH: Cylinder number, bits 7...0
|
---|
19 | ; CL: Bits 7...6: Cylinder number bits 9 and 8
|
---|
20 | ; Bits 5...0: Starting sector number (1...63)
|
---|
21 | ; DH: Starting head number (0...255)
|
---|
22 | ; ES:BX: Pointer to buffer recieving data
|
---|
23 | ; Returns with INTPACK:
|
---|
24 | ; AH: Int 13h/40h floppy return status
|
---|
25 | ; AL: Burst error length if AH returns 11h, undefined otherwise
|
---|
26 | ; CF: 0 if successfull, 1 if error
|
---|
27 | ;--------------------------------------------------------------------
|
---|
28 | ALIGN JUMP_ALIGN
|
---|
29 | AH2h_HandlerForReadDiskSectors:
|
---|
30 | call AH2h_ExitInt13hIfSectorCountInIntpackIsZero
|
---|
31 | mov ah, COMMAND_READ_SECTORS ; Load sector mode command
|
---|
32 | test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
|
---|
33 | eCMOVNZ ah, COMMAND_READ_MULTIPLE ; Load block mode command
|
---|
34 | mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
|
---|
35 | mov si, [bp+IDEPACK.intpack+INTPACK.bx]
|
---|
36 | %ifdef USE_186
|
---|
37 | push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
38 | jmp Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
|
---|
39 | %else
|
---|
40 | call Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
|
---|
41 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
42 | %endif
|
---|
43 |
|
---|
44 |
|
---|
45 | ;--------------------------------------------------------------------
|
---|
46 | ; AH2h_ExitInt13hIfSectorCountInIntpackIsZero
|
---|
47 | ; Parameters:
|
---|
48 | ; SS:BP: Ptr to IDEPACK
|
---|
49 | ; Parameters on INTPACK:
|
---|
50 | ; AL: Number of sectors to transfer (1...255)
|
---|
51 | ; Returns:
|
---|
52 | ; Nothing (does not return if error)
|
---|
53 | ; Corrupts registers:
|
---|
54 | ; Nothing
|
---|
55 | ;--------------------------------------------------------------------
|
---|
56 | ALIGN JUMP_ALIGN
|
---|
57 | AH2h_ExitInt13hIfSectorCountInIntpackIsZero:
|
---|
58 | cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0
|
---|
59 | je SHORT .InvalidSectorCount
|
---|
60 | ret
|
---|
61 | .InvalidSectorCount:
|
---|
62 | mov ah, RET_HD_INVALID
|
---|
63 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|