[3] | 1 | ; File name : AH4h_HVerify.asm |
---|
| 2 | ; Project name : IDE BIOS |
---|
| 3 | ; Created date : 13.10.2007 |
---|
[84] | 4 | ; Last update : 14.1.2011 |
---|
| 5 | ; Author : Tomi Tilli, |
---|
| 6 | ; : Krister Nordvall (optimizations) |
---|
[3] | 7 | ; Description : Int 13h function AH=4h, Verify Disk Sectors. |
---|
| 8 | |
---|
| 9 | ; Section containing code |
---|
| 10 | SECTION .text |
---|
| 11 | |
---|
| 12 | ;-------------------------------------------------------------------- |
---|
| 13 | ; Int 13h function AH=4h, Verify Disk Sectors. |
---|
| 14 | ; |
---|
| 15 | ; AH4h_HandlerForVerifyDiskSectors |
---|
| 16 | ; Parameters: |
---|
| 17 | ; AH: Bios function 4h |
---|
| 18 | ; AL: Number of sectors to verify |
---|
| 19 | ; CH: Cylinder number, bits 7...0 |
---|
| 20 | ; CL: Bits 7...6: Cylinder number bits 9 and 8 |
---|
| 21 | ; Bits 5...0: Starting sector number (1...63) |
---|
| 22 | ; DH: Starting head number (0...255) |
---|
| 23 | ; DL: Drive number |
---|
| 24 | ; ES:BX: Pointer to source data (not used) |
---|
| 25 | ; Parameters loaded by Int13h_Jump: |
---|
| 26 | ; DS: RAMVARS segment |
---|
| 27 | ; Returns: |
---|
| 28 | ; AH: Int 13h/40h floppy return status |
---|
| 29 | ; CF: 0 if successfull, 1 if error |
---|
| 30 | ; IF: 1 |
---|
| 31 | ; Corrupts registers: |
---|
| 32 | ; Flags |
---|
| 33 | ;-------------------------------------------------------------------- |
---|
| 34 | ALIGN JUMP_ALIGN |
---|
| 35 | AH4h_HandlerForVerifyDiskSectors: |
---|
| 36 | test al, al ; Invalid sector count? |
---|
| 37 | jz SHORT AH2h_ZeroCntErr ; If so, return with error |
---|
| 38 | push dx |
---|
| 39 | push cx |
---|
| 40 | push bx |
---|
| 41 | push ax |
---|
[84] | 42 | %ifndef USE_186 |
---|
[3] | 43 | call AH4h_VerifySectors |
---|
| 44 | jmp Int13h_PopXRegsAndReturn |
---|
[84] | 45 | %else |
---|
| 46 | push Int13h_PopXRegsAndReturn |
---|
| 47 | ; Fall through to AH4h_VerifySectors |
---|
| 48 | %endif |
---|
[3] | 49 | |
---|
| 50 | |
---|
| 51 | ;-------------------------------------------------------------------- |
---|
| 52 | ; Verifies hard disk sectors. |
---|
| 53 | ; |
---|
| 54 | ; AH4h_VerifySectors |
---|
| 55 | ; Parameters: |
---|
| 56 | ; AL: Number of sectors to verify |
---|
| 57 | ; CH: Cylinder number, bits 7...0 |
---|
| 58 | ; CL: Bits 7...6: Cylinder number bits 9 and 8 |
---|
| 59 | ; Bits 5...0: Starting sector number (1...63) |
---|
| 60 | ; DH: Starting head number (0...255) |
---|
| 61 | ; DL: Drive number |
---|
| 62 | ; DS: RAMVARS segment |
---|
| 63 | ; Returns: |
---|
| 64 | ; DS:DI: Ptr to DPT |
---|
| 65 | ; AH: Int 13h/40h floppy return status |
---|
| 66 | ; CF: 0 if successfull, 1 if error |
---|
| 67 | ; Corrupts registers: |
---|
| 68 | ; AL, BX, CX, DX |
---|
| 69 | ;-------------------------------------------------------------------- |
---|
| 70 | ALIGN JUMP_ALIGN |
---|
| 71 | AH4h_VerifySectors: |
---|
| 72 | call FindDPT_ForDriveNumber ; DS:DI now points to DPT |
---|
| 73 | mov ah, HCMD_VERIFY_SECT ; Load command to AH |
---|
| 74 | call HCommand_OutputCountAndLCHSandCommand |
---|
| 75 | jc SHORT .Return ; Return if error |
---|
| 76 | mov bx, di ; DS:BX now points to DPT |
---|
| 77 | jmp HStatus_WaitIrqOrRdy ; Wait for IRQ or RDY |
---|
| 78 | .Return: |
---|
| 79 | ret |
---|