[3] | 1 | ; File name : AH23h_HFeatures.asm |
---|
| 2 | ; Project name : IDE BIOS |
---|
| 3 | ; Created date : 28.12.2009 |
---|
| 4 | ; Last update : 12.4.2010 |
---|
| 5 | ; Author : Tomi Tilli |
---|
| 6 | ; Description : Int 13h function AH=23h, |
---|
| 7 | ; Set Controller Features Register. |
---|
| 8 | |
---|
| 9 | ; Section containing code |
---|
| 10 | SECTION .text |
---|
| 11 | |
---|
| 12 | ;-------------------------------------------------------------------- |
---|
| 13 | ; Int 13h function AH=23h, Set Controller Features Register. |
---|
| 14 | ; |
---|
| 15 | ; AH23h_HandlerForSetControllerFeatures |
---|
| 16 | ; Parameters: |
---|
| 17 | ; AH: Bios function 23h |
---|
| 18 | ; AL: Feature Number (parameter to Features Register = subcommand) |
---|
| 19 | ; DL: Drive number (8xh) |
---|
| 20 | ; Parameters loaded by Int13h_Jump: |
---|
| 21 | ; DS: RAMVARS segment |
---|
| 22 | ; Parameter registers are undocumented, specific for this BIOS: |
---|
| 23 | ; BH: Parameter to Sector Count Register (subcommand specific) |
---|
| 24 | ; BL: Parameter to Sector Number Register (subcommand specific) |
---|
| 25 | ; CL: Parameter to Low Cylinder Register (subcommand specific) |
---|
| 26 | ; CH: Parameter to High Cylinder Register (subcommand specific) |
---|
| 27 | ; Returns: |
---|
| 28 | ; AH: Int 13h return status |
---|
| 29 | ; CF: 0 if succesfull, 1 if error |
---|
| 30 | ; IF: 1 |
---|
| 31 | ; Corrupts registers: |
---|
| 32 | ; Flags |
---|
| 33 | ;-------------------------------------------------------------------- |
---|
| 34 | ALIGN JUMP_ALIGN |
---|
| 35 | AH23h_HandlerForSetControllerFeatures: |
---|
| 36 | push dx |
---|
| 37 | push cx |
---|
| 38 | push bx |
---|
| 39 | push ax |
---|
| 40 | push si |
---|
| 41 | |
---|
| 42 | ; Backup AL and BH to SI |
---|
| 43 | mov ah, bh |
---|
| 44 | xchg si, ax |
---|
| 45 | |
---|
| 46 | ; Select Master or Slave and wait until ready |
---|
| 47 | call FindDPT_ForDriveNumber ; DS:DI now points to DPT |
---|
| 48 | call HDrvSel_SelectDriveAndDisableIRQ |
---|
| 49 | jc SHORT .Return ; Return if error |
---|
| 50 | |
---|
| 51 | ; Output Feature Number |
---|
| 52 | mov ax, si ; Feature number to AL |
---|
| 53 | mov dx, [RAMVARS.wIdeBase] ; Load base port address |
---|
| 54 | inc dx ; REGW_IDE_FEAT |
---|
| 55 | out dx, al |
---|
| 56 | |
---|
| 57 | ; Output parameters to Sector Number Register and Cylinder Registers |
---|
| 58 | xor bh, bh ; Zero head number |
---|
| 59 | dec dx ; Back to base port address |
---|
| 60 | call HCommand_OutputTranslatedLCHSaddress |
---|
| 61 | |
---|
| 62 | ; Output parameter to Sector Count Register and command |
---|
| 63 | xchg ax, si ; Sector Count Reg param to AH |
---|
| 64 | mov al, ah ; Sector Count Reg param to AL |
---|
| 65 | mov ah, HCMD_SET_FEAT ; Load Set Features command to AH |
---|
| 66 | call HCommand_OutputSectorCountAndCommand |
---|
| 67 | |
---|
| 68 | call HStatus_WaitBsyDefTime ; Wait until drive ready |
---|
| 69 | .Return: |
---|
| 70 | pop si |
---|
| 71 | jmp Int13h_PopXRegsAndReturn |
---|