Changeset 26 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS
- Timestamp:
- Jul 26, 2010, 6:30:33 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r23 r26 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 27.9.2007 4 ; Last update : 1.7.20104 ; Last update : 26.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Int 13h function AH=0h, Disk Controller Reset. … … 37 37 38 38 eMOVZX bx, dl ; Copy requested drive to BL, zero BH to assume no errors 39 call AH0h_ResetFloppyDrivesWithInt40h40 test bl, 80h ; Reset hard disks too?41 jz SHORT . Return42 call AH0h_ResetForeignHardDisks43 call AH0h_ResetAllOurControllers39 call ResetFloppyDrivesWithInt40h 40 test bl, 80h 41 jz SHORT .SkipHardDiskReset 42 call ResetForeignHardDisks 43 call ResetHardDisksHandledByOurBIOS 44 44 ALIGN JUMP_ALIGN 45 . Return:45 .SkipHardDiskReset: 46 46 mov ah, bh ; Copy error code to AH 47 47 xor al, al ; Zero AL... … … 51 51 52 52 ;-------------------------------------------------------------------- 53 ; AH0h_ResetFloppyDrivesWithInt40h53 ; ResetFloppyDrivesWithInt40h 54 54 ; Parameters: 55 55 ; BL: Requested drive (DL when entering AH=00h) … … 61 61 ;-------------------------------------------------------------------- 62 62 ALIGN JUMP_ALIGN 63 AH0h_ResetFloppyDrivesWithInt40h:64 xor a x, ax; Disk Controller Reset63 ResetFloppyDrivesWithInt40h: 64 xor ah, ah ; Disk Controller Reset 65 65 and dl, 7Fh ; Clear bit 7 66 66 int INTV_FLOPPY_FUNC 67 jmp SHORT AH0h_BackupErrorCodeFromTheRequestedDriveToBH67 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 68 68 69 69 70 70 ;-------------------------------------------------------------------- 71 ; AH0h_ResetForeignHardDisks71 ; ResetForeignHardDisks 72 72 ; Parameters: 73 73 ; BL: Requested drive (DL when entering AH=00h) … … 79 79 ;-------------------------------------------------------------------- 80 80 ALIGN JUMP_ALIGN 81 AH0h_ResetForeignHardDisks: 82 mov cl, [RAMVARS.bFirstDrv] ; Load number of first our drive 83 and cx, BYTE 7Fh ; CX = number of drives to reset 84 jz SHORT .Return 85 mov dl, 80h ; Start resetting from drive 80h 86 ALIGN JUMP_ALIGN 87 .DriveResetLoop: 81 ResetForeignHardDisks: 82 mov dl, bl ; Drive to reset 88 83 mov ah, 0Dh ; Reset Hard Disk (Alternate reset) 84 89 85 pushf ; Push flags to simulate INT 90 86 cli ; Disable interrupts since INT does that 91 87 call FAR [RAMVARS.fpOldI13h] 92 88 sti ; Make sure interrupts are enabled again (some BIOSes fails to enable it) 93 call AH0h_BackupErrorCodeFromTheRequestedDriveToBH 94 inc dx ; Next drive to reset 95 loop .DriveResetLoop 96 ALIGN JUMP_ALIGN 97 .Return: 98 ret 89 90 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 99 91 100 92 101 93 ;-------------------------------------------------------------------- 102 ; AH0h_ResetAllOurControllers94 ; ResetHardDisksHandledByOurBIOS 103 95 ; Parameters: 104 96 ; BL: Requested drive (DL when entering AH=00h) … … 107 99 ; BH: Error code from requested drive (if available) 108 100 ; Corrupts registers: 109 ; AX, CX, DX , DI101 ; AX, CX, DX 110 102 ;-------------------------------------------------------------------- 111 103 ALIGN JUMP_ALIGN 112 AH0h_ResetAllOurControllers: 113 push si 114 mov si, ROMVARS.ideVars0 ; Load offset to first IDEVARS 115 call Initialize_GetIdeControllerCountToCX 104 ResetHardDisksHandledByOurBIOS: 105 mov dh, [RAMVARS.bDrvCnt] ; Load drive count to DH 106 test dh, dh 107 jz SHORT .AllDrivesReset ; Return if no drives 108 mov dl, [RAMVARS.bFirstDrv] ; Load number of first our drive 109 add dh, dl ; DH = one past last drive to reset 116 110 ALIGN JUMP_ALIGN 117 .ResetLoop: 118 call AH0h_ResetIdevarsControllerMasterAndSlaveDrives 119 add si, BYTE IDEVARS_size 120 loop .ResetLoop 121 .Return: 122 pop si 111 .DriveResetLoop: 112 call AHDh_ResetDrive 113 call BackupErrorCodeFromTheRequestedDriveToBH 114 call .SkipNextDriveIfItIsSlaveForThisController 115 inc dx 116 cmp dl, dh ; All done? 117 jb SHORT .DriveResetLoop ; If not, reset next drive 118 .AllDrivesReset: 119 ret 120 121 ;-------------------------------------------------------------------- 122 ; .SkipNextDriveIfItIsSlaveForThisController 123 ; Parameters: 124 ; DL: Drive just resetted 125 ; DS: RAMVARS segment 126 ; Returns: 127 ; DL: Incremented if next drive is slave drive 128 ; (=already resetted) 129 ; Corrupts registers: 130 ; AX, CX 131 ;-------------------------------------------------------------------- 132 ALIGN JUMP_ALIGN 133 .SkipNextDriveIfItIsSlaveForThisController: 134 push di 135 136 call .GetBasePortToAXfromDriveInDL 137 xchg cx, ax 138 139 inc dx 140 call .GetBasePortToAXfromDriveInDL 141 jnc SHORT .SkipNextDrive 142 143 cmp ax, cx 144 je SHORT .SkipNextDrive ; Same controller so slave already reset 145 146 dec dx ; Restore DX 147 .SkipNextDrive: 148 pop di 149 ret 150 151 ;-------------------------------------------------------------------- 152 ; .GetBasePortToAXfromDriveInDL 153 ; Parameters: 154 ; DL: Drive whose base port to find 155 ; DS: RAMVARS segment 156 ; Returns: 157 ; AX: Base port (if drive found) 158 ; CF: Set if drive found 159 ; Cleared if drive not found 160 ; Corrupts registers: 161 ; DI 162 ;-------------------------------------------------------------------- 163 ALIGN JUMP_ALIGN 164 .GetBasePortToAXfromDriveInDL: 165 call FindDPT_ForDriveNumber ; Get DPT to DS:DI 166 jnc SHORT .DriveNotFound 167 eMOVZX di, BYTE [di+DPT.bIdeOff] ; CS:DI now points to IDEVARS 168 mov ax, [cs:di+IDEVARS.wPort] 169 .DriveNotFound: 123 170 ret 124 171 125 172 126 173 ;-------------------------------------------------------------------- 127 ; AH0h_ResetIdevarsControllerMasterAndSlaveDrives 128 ; Parameters: 129 ; BL: Requested drive (DL when entering AH=00h) 130 ; CS:SI: Ptr to IDEVARS 131 ; DS: RAMVARS segment 132 ; Returns: 133 ; BH: Error code from requested drive (if available) 134 ; Corrupts registers: 135 ; AX, DX, DI 136 ;-------------------------------------------------------------------- 137 ALIGN JUMP_ALIGN 138 AH0h_ResetIdevarsControllerMasterAndSlaveDrives: 139 mov dx, [cs:si+IDEVARS.wPort] 140 call FindDPT_ForIdeMasterAtPort ; Find master drive to DL 141 jc SHORT AH0h_ResetMasterAndSlaveDriveWithRetries 142 call FindDPT_ForIdeSlaveAtPort ; Find slave if master not present 143 jc SHORT AH0h_ResetMasterAndSlaveDriveWithRetries 144 ret 145 146 ;-------------------------------------------------------------------- 147 ; AH0h_ResetMasterAndSlaveDriveWithRetries 148 ; Parameters: 149 ; BL: Requested drive (DL when entering AH=00h) 150 ; DL: Drive number for master or slave drive 151 ; DS: RAMVARS segment 152 ; Returns: 153 ; BH: Error code from requested drive (if available) 154 ; Corrupts registers: 155 ; AX, DI 156 ;-------------------------------------------------------------------- 157 ALIGN JUMP_ALIGN 158 AH0h_ResetMasterAndSlaveDriveWithRetries: 159 push dx 160 push cx 161 push bx 162 mov di, RETRIES_IF_RESET_FAILS 163 ALIGN JUMP_ALIGN 164 .RetryLoop: 165 call AHDh_ResetDrive 166 jnc SHORT .Return ; Jump if successful 167 mov cx, TIMEOUT_BEFORE_RESET_RETRY 168 call SoftDelay_TimerTicks 169 dec di 170 jnz SHORT .RetryLoop 171 ALIGN JUMP_ALIGN 172 .Return: 173 pop bx 174 pop cx 175 pop dx 176 ; Fall to AH0h_BackupErrorCodeFromTheRequestedDriveToBH 177 178 ;-------------------------------------------------------------------- 179 ; AH0h_BackupErrorCodeFromTheRequestedDriveToBH 174 ; BackupErrorCodeFromTheRequestedDriveToBH 180 175 ; Parameters: 181 176 ; AH: Error code from the last resetted drive … … 188 183 ;-------------------------------------------------------------------- 189 184 ALIGN JUMP_ALIGN 190 AH0h_BackupErrorCodeFromTheRequestedDriveToBH:191 cmp dl, bl 185 BackupErrorCodeFromTheRequestedDriveToBH: 186 cmp dl, bl ; Requested drive? 192 187 jne SHORT .Return 193 188 mov bh, ah -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r3 r26 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 9.12.2007 4 ; Last update : 12.4.20104 ; Last update : 26.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Int 13h function AH=Dh, Reset Hard Disk (Alternate reset). … … 25 25 ALIGN JUMP_ALIGN 26 26 AHDh_HandlerForResetHardDisk: 27 push dx28 push cx29 push bx30 push ax31 27 call AHDh_ResetDrive 32 jmp Int13h_Pop XRegsAndReturn28 jmp Int13h_PopDiDsAndReturn 33 29 34 30 … … 44 40 ; CF: 0 if succesfull, 1 if error 45 41 ; Corrupts registers: 46 ; AL, BX, CX, DX42 ; Nothing 47 43 ;-------------------------------------------------------------------- 48 44 ALIGN JUMP_ALIGN 49 45 AHDh_ResetDrive: 50 46 push di 47 push dx 48 push cx 49 push bx 50 push ax 51 51 52 call FindDPT_ForDriveNumber ; DS:DI now points to DPT 52 53 call AHDh_ResetMasterAndSlave … … 57 58 mov dx, [RAMVARS.wIdeBase] ; Load base port address 58 59 call AHDh_InitializeMasterAndSlave 59 jc SHORT .ReturnError 60 xor ax, ax ; Clear AH since success61 pop di62 ret63 .ReturnError: 64 mov ah, RET_HD_RESETFAIL ; Load Reset Failed error code60 61 pop bx ; Pop old AX 62 mov al, bl ; Restore AL 63 pop bx 64 pop cx 65 pop dx 65 66 pop di 66 67 ret … … 110 111 ; DX: IDE Base Port address 111 112 ; Returns: 113 ; AH: Error code 112 114 ; CF: 0 if initialization succesfull 113 115 ; 1 if any error 114 116 ; Corrupts registers: 115 ; A X, BX, CX, DX, DI117 ; AL, BX, CX, DX, DI 116 118 ;-------------------------------------------------------------------- 117 119 ALIGN JUMP_ALIGN … … 136 138 ret 137 139 .ReturnError: 140 mov ah, RET_HD_RESETFAIL ; Load Reset Failed error code 138 141 stc 139 142 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm
r3 r26 232 232 HPIO_WriteToDrive: 233 233 cld ; OUTS to increment SI 234 call HStatus_WaitDrqDefTime ; Always poll DRQ for first block 234 call HStatus_WaitDrqDefTime ; Always poll DRQ for first block, get data port to DX 235 235 jc SHORT .RetError ; Return if error (code in AH) 236 236 sub dx, BYTE REGR_IDE_ST ; DX to Data Port address … … 251 251 jmp HStatus_WaitIrqOrRdy ; Check for errors 252 252 253 253 254 254 ;-------------------------------------------------------------------- 255 255 ; Bus specific transfer functions and lookup table. -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r10 r26 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 15.12.2009 4 ; Last update : 2 5.5.20104 ; Last update : 26.6.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : IDE Status Register polling functions. … … 25 25 ALIGN JUMP_ALIGN 26 26 HStatus_WaitIrqOrRdy: 27 test BYTE [ di+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN27 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN 28 28 jnz SHORT .PollRdySinceIrqsAreDisabled 29 29 jmp HIRQ_WaitIRQ -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r23 r26 2 2 ; Project name : XTIDE Universal BIOS 3 3 ; Created date : 28.7.2007 4 ; Last update : 1.7.20104 ; Last update : 26.7.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Main file for BIOS. This is the only file that needs … … 38 38 at ROMVARS.bRomSize, db CNT_ROM_BLOCKS ; ROM size in 512B blocks 39 39 at ROMVARS.rgbJump, jmp Initialize_FromMainBiosRomSearch 40 at ROMVARS.rgbDate, db "07/ 01/10" ; Build data (mm/dd/yy)40 at ROMVARS.rgbDate, db "07/26/10" ; Build data (mm/dd/yy) 41 41 at ROMVARS.rgbSign, db "XTIDE110" ; Signature for flash program 42 42 at ROMVARS.szTitle … … 49 49 db " (XT)=-",STOP 50 50 %endif 51 at ROMVARS.szVersion, db "v1.1. 1 (07/01/10)",STOP51 at ROMVARS.szVersion, db "v1.1.2 (07/26/10)",STOP 52 52 53 53 ;---------------------------;
Note:
See TracChangeset
for help on using the changeset viewer.