[148] | 1 | ; Project name : XTIDE Universal BIOS |
---|
[3] | 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: |
---|
[148] | 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 INTPACK |
---|
| 16 | ; Parameters on INTPACK in SS:BP: |
---|
[3] | 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 |
---|
[148] | 23 | ; Returns with INTPACK in SS:BP: |
---|
[3] | 24 | ; AH: Int 13h/40h floppy return status |
---|
[148] | 25 | ; AL: Burst error length if AH returns 11h, undefined otherwise |
---|
[3] | 26 | ; CF: 0 if successfull, 1 if error |
---|
| 27 | ;-------------------------------------------------------------------- |
---|
| 28 | ALIGN JUMP_ALIGN |
---|
| 29 | AH2h_HandlerForReadDiskSectors: |
---|
| 30 | test al, al ; Invalid sector count? |
---|
| 31 | jz SHORT AH2h_ZeroCntErr ; If so, return with error |
---|
| 32 | |
---|
| 33 | ; Select sector or block mode command |
---|
| 34 | mov ah, HCMD_READ_SECT ; Load sector mode command |
---|
| 35 | cmp BYTE [di+DPT.bSetBlock], 1 ; Block mode enabled? |
---|
[148] | 36 | eCMOVA ah, HCMD_READ_MUL ; Load block mode command |
---|
[3] | 37 | |
---|
| 38 | ; Transfer data |
---|
| 39 | call HCommand_OutputCountAndLCHSandCommand |
---|
[148] | 40 | jc SHORT .ReturnWithErrorCodeInAH |
---|
| 41 | mov bx, [bp+INTPACK.bx] |
---|
[3] | 42 | call HPIO_ReadBlock ; Read data from IDE-controller |
---|
[148] | 43 | .ReturnWithErrorCodeInAH: |
---|
| 44 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
[3] | 45 | |
---|
| 46 | ; Invalid sector count (also for AH=3h and AH=4h) |
---|
| 47 | AH2h_ZeroCntErr: |
---|
| 48 | mov ah, RET_HD_INVALID ; Invalid value passed |
---|
[148] | 49 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|