Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
- Timestamp:
- Apr 29, 2011, 7:04:13 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r148 r150 12 12 ; DL: Translated Drive number 13 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to I NTPACK15 ; Returns with INTPACK in SS:BP:14 ; SS:BP: Ptr to IDEPACK 15 ; Returns with INTPACK: 16 16 ; AH: Int 13h return status 17 17 ; CF: 0 if succesfull, 1 if error … … 34 34 ; Parameters: 35 35 ; DS:DI: Ptr to DPT (in RAMVARS segment) 36 ; SS:BP: Ptr to IDEPACK 36 37 ; Returns: 37 38 ; AH: Int 13h return status … … 45 46 46 47 ; Try to select drive and wait until ready 47 or BYTE [di+DPT.bReset], MASK_RESET_ALL ; Everything uninitialized 48 call HDrvSel_SelectDriveAndDisableIRQ 48 or WORD [di+DPT.wFlags], MASK_DPT_RESET ; Everything uninitialized 49 call AccessDPT_GetDriveSelectByteToAL 50 mov [bp+IDEPACK.bDrvAndHead], al 51 call Device_SelectDrive 49 52 jc SHORT .ReturnNotSuccessfull 50 and BYTE [di+DPT.bReset], ~FLG_RESET_nDRDY; Clear since success53 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nDRDY ; Clear since success 51 54 52 55 ; Initialize CHS parameters if LBA is not used 53 call AH9h_InitializeDeviceParameters56 call InitializeDeviceParameters 54 57 jc SHORT .RecalibrateDrive 55 and BYTE [di+DPT.bReset], ~FLG_RESET_nINITPRMS58 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nINITPRMS 56 59 57 60 ; Recalibrate drive by seeking to cylinder 0 58 ALIGN JUMP_ALIGN59 61 .RecalibrateDrive: 60 62 call AH11h_RecalibrateDrive 61 63 jc SHORT .InitializeBlockMode 62 and BYTE [di+DPT.bReset], ~FLG_RESET_nRECALIBRATE64 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nRECALIBRATE 63 65 64 66 ; Initialize block mode transfers 65 67 .InitializeBlockMode: 66 call AH9h_InitializeBlockMode68 call InitializeBlockMode 67 69 jc SHORT .ReturnNotSuccessfull 68 and BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK ; Keeps CF clear70 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nSETBLOCK ; Keeps CF clear 69 71 70 72 .ReturnNotSuccessfull: … … 74 76 75 77 ;-------------------------------------------------------------------- 76 ; Sends Initialize Device Parameters command to IDE Hard Disk. 77 ; Initialization is used to initialize logical CHS parameters. Drives 78 ; may not support all CHS values. 79 ; This command is only supported by drives that supports CHS addressing. 80 ; 81 ; AH9h_InitializeDeviceParameters 78 ; InitializeDeviceParameters 82 79 ; Parameters: 83 ; DS:DI: Ptr to DPT 84 ; Returns: 85 ; AH: BIOS Error code 86 ; CF: Cleared if succesfull 87 ; Set if any error 88 ; Corrupts registers: 89 ; AL, BX, CX 90 ;-------------------------------------------------------------------- 91 ALIGN JUMP_ALIGN 92 AH9h_InitializeDeviceParameters: 93 ; No need to initialize CHS parameters if LBA mode enabled 94 test BYTE [di+DPT.bDrvSel], FLG_IDE_DRVHD_LBA ; Clears CF 95 jnz SHORT .Return 96 97 push dx 98 mov bh, [di+DPT.bPHeads] 99 dec bh ; Max head number 100 mov dx, [RAMVARS.wIdeBase] 101 call HCommand_OutputTranslatedLCHSaddress 102 mov ah, HCMD_INIT_DEV 103 mov al, [di+DPT.bPSect] ; Sectors per track 104 call HCommand_OutputSectorCountAndCommand 105 call HStatus_WaitBsyDefTime ; Wait until drive ready (DRDY won't be set!) 106 pop dx 107 .Return: 108 ret 109 110 111 ;-------------------------------------------------------------------- 112 ; Initializes block mode transfers. 113 ; 114 ; AH9h_InitializeBlockMode 115 ; Parameters: 116 ; DS:DI: Ptr to DPT 80 ; DS:DI: Ptr to DPT (in RAMVARS segment) 81 ; SS:BP: Ptr to IDEPACK 117 82 ; Returns: 118 83 ; AH: BIOS Error code … … 123 88 ;-------------------------------------------------------------------- 124 89 ALIGN JUMP_ALIGN 125 AH9h_InitializeBlockMode: 126 mov ax, FLG_DRVPARAMS_BLOCKMODE 127 call AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive 128 jz SHORT .Return ; Block mode disabled (CF cleared) 129 eMOVZX ax, BYTE [di+DPT.bMaxBlock] ; Load max block size, zero AH 130 test al, al ; Block mode supported? (clears CF) 131 jz SHORT .Return ; If not, return 90 InitializeDeviceParameters: 91 ; No need to initialize CHS parameters if LBA mode enabled 92 test BYTE [di+DPT.wFlags], FLG_DRVNHEAD_LBA ; Clear CF 93 jnz SHORT ReturnSuccessSinceInitializationNotNeeded 94 95 ; Initialize Locigal Sectors per Track and Max Head number 96 mov ah, [di+DPT.bPchsHeads] 97 dec ah ; Max Head number 98 mov dl, [di+DPT.bPchsSectors] ; Sectors per Track 99 mov al, COMMAND_INITIALIZE_DEVICE_PARAMETERS 100 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 101 jmp Idepack_StoreNonExtParametersAndIssueCommandFromAL 102 103 104 ;-------------------------------------------------------------------- 105 ; InitializeBlockMode 106 ; Parameters: 107 ; DS:DI: Ptr to DPT (in RAMVARS segment) 108 ; Returns: 109 ; AH: BIOS Error code 110 ; CF: Cleared if succesfull 111 ; Set if any error 112 ; Corrupts registers: 113 ; AL, BX, CX, DX 114 ;-------------------------------------------------------------------- 115 ALIGN JUMP_ALIGN 116 InitializeBlockMode: 117 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED ; Clear CF 118 jz SHORT ReturnSuccessSinceInitializationNotNeeded 119 120 mov al, [di+DPT_ATA.bMaxBlock] ; Load max block size, zero AH 132 121 jmp AH24h_SetBlockSize 133 .Return:122 ReturnSuccessSinceInitializationNotNeeded: 134 123 ret
Note:
See TracChangeset
for help on using the changeset viewer.