[116] | 1 | ; Project name : XTIDE Universal BIOS |
---|
[3] | 2 | ; Description : Int 13h function AH=Ch, Seek. |
---|
| 3 | |
---|
| 4 | ; Section containing code |
---|
| 5 | SECTION .text |
---|
| 6 | |
---|
| 7 | ;-------------------------------------------------------------------- |
---|
| 8 | ; Int 13h function AH=Ch, Seek. |
---|
| 9 | ; |
---|
| 10 | ; AHCh_HandlerForSeek |
---|
| 11 | ; Parameters: |
---|
| 12 | ; AH: Bios function Ch |
---|
| 13 | ; CH: Cylinder number, bits 7...0 |
---|
| 14 | ; CL: Bits 7...6: Cylinder number bits 9 and 8 |
---|
| 15 | ; Bits 5...0: Starting sector number (1...63) |
---|
| 16 | ; DH: Starting head number (0...255) |
---|
| 17 | ; DL: Drive number |
---|
| 18 | ; Parameters loaded by Int13h_Jump: |
---|
| 19 | ; DS: RAMVARS segment |
---|
| 20 | ; Returns: |
---|
| 21 | ; AH: BIOS Error code |
---|
| 22 | ; CF: 0 if succesfull, 1 if error |
---|
| 23 | ; IF: 1 |
---|
| 24 | ; Corrupts registers: |
---|
| 25 | ; Flags |
---|
| 26 | ;-------------------------------------------------------------------- |
---|
| 27 | ALIGN JUMP_ALIGN |
---|
| 28 | AHCh_HandlerForSeek: |
---|
| 29 | push dx |
---|
| 30 | push cx |
---|
| 31 | push bx |
---|
| 32 | push ax |
---|
[84] | 33 | %ifndef USE_186 |
---|
[3] | 34 | call AHCh_SeekToCylinder |
---|
| 35 | jmp Int13h_PopXRegsAndReturn |
---|
[84] | 36 | %else |
---|
| 37 | push Int13h_PopXRegsAndReturn |
---|
| 38 | ; Fall through to AHCh_SeekToCylinder |
---|
| 39 | %endif |
---|
[3] | 40 | |
---|
| 41 | |
---|
| 42 | ;-------------------------------------------------------------------- |
---|
| 43 | ; Seeks to a cylinder. |
---|
| 44 | ; |
---|
| 45 | ; AHCh_SeekToCylinder |
---|
| 46 | ; Parameters: |
---|
| 47 | ; CH: Cylinder number, bits 7...0 |
---|
| 48 | ; CL: Bits 7...6: Cylinder number bits 9 and 8 |
---|
| 49 | ; Bits 5...0: Starting sector number (1...63) |
---|
| 50 | ; DH: Starting head number (0...255) |
---|
| 51 | ; DL: Drive Number |
---|
| 52 | ; DS: RAMVARS segment |
---|
| 53 | ; Returns: |
---|
| 54 | ; DS:DI: Ptr to DPT |
---|
| 55 | ; AH: BIOS Error code |
---|
| 56 | ; CF: 0 if succesfull, 1 if error |
---|
| 57 | ; Corrupts registers: |
---|
| 58 | ; AL, BX, CX, DX |
---|
| 59 | ;-------------------------------------------------------------------- |
---|
| 60 | ALIGN JUMP_ALIGN |
---|
| 61 | AHCh_SeekToCylinder: |
---|
| 62 | call FindDPT_ForDriveNumber ; DS:DI now points to DPT |
---|
| 63 | mov ax, HCMD_SEEK<<8 ; Load cmd to AH, AL=zero sector cnt |
---|
| 64 | call HCommand_OutputCountAndLCHSandCommand |
---|
| 65 | jc SHORT .Return ; Return if error |
---|
| 66 | mov bx, di ; DS:BX now points to DPT |
---|
| 67 | jmp HStatus_WaitIrqOrRdy ; Wait for IRQ or RDY |
---|
| 68 | .Return: |
---|
| 69 | ret |
---|