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