Changeset 155 in xtideuniversalbios
- Timestamp:
- May 1, 2011, 6:44:29 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 14 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
r152 r155 21 21 struc RAMVARS 22 22 .fpOldI13h resb 4 ; Far pointer to old INT 13h handler 23 .wTimeoutCounter resb 224 23 .wSignature resb 2 ; Sign for finding stolen 1 kiB 24 .bTimeoutTicksLeft resb 1 25 .bLastTimeoutUpdate resb 1 25 26 26 27 .wDrvCntAndFirst: … … 64 65 endstruc 65 66 66 EXTRA_ WORDS_TO_RESERVE_FOR_INTPACK EQU ((IDEPACK_size - INTPACK_size) / 2)67 EXTRA_BYTES_FOR_INTPACK EQU (IDEPACK_size - INTPACK_size) 67 68 68 69 -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r150 r155 304 304 305 305 ; Get and push L-CHS size 306 mov [RAMVARS. wTimeoutCounter], dl ; Store drive number306 mov [RAMVARS.bTimeoutTicksLeft], dl ; Store drive number 307 307 call AH15h_GetSectorCountToDXAX 308 308 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 309 309 310 310 ; Get and push total LBA size 311 mov dl, [RAMVARS. wTimeoutCounter] ; Restore drive number311 mov dl, [RAMVARS.bTimeoutTicksLeft] ; Restore drive number 312 312 call BootInfo_GetTotalSectorCount 313 313 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r152 r155 22 22 call Device_OutputALtoIdeControlBlockRegisterInDL 23 23 mov ax, HSR0_RESET_WAIT_US 24 call HTimer_DelayMicrosecondsFromAX24 call Timer_DelayMicrosecondsFromAX 25 25 26 26 ; HSR1: Clear_wait … … 31 31 call Device_OutputALtoIdeControlBlockRegisterInDL 32 32 mov ax, HSR1_RESET_WAIT_US 33 call HTimer_DelayMicrosecondsFromAX33 call Timer_DelayMicrosecondsFromAX 34 34 35 35 ; HSR2: Check_status -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r152 r155 381 381 eSEG es ; Source is ES segment 382 382 rep 383 db 6Fh ; OUTSW 383 db 6Fh ; OUTSW (we want this in XT build) 384 384 ret 385 385 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
r150 r155 53 53 ;-------------------------------------------------------------------- 54 54 IdeWait_PollStatusFlagInBLwithTimeoutInBH: 55 eMOVZX cx, bh ; Timeout ticks now in CX56 55 mov ah, bl 57 call HTimer_InitializeTimeoutWithTicksInCX 56 mov cl, bh 57 call Timer_InitializeTimeoutWithTicksInCL 58 58 and ah, ~FLG_STATUS_BSY 59 59 jz SHORT PollBsyOnly … … 82 82 jnz SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 83 83 .UpdateTimeout: 84 call HTimer_SetCFifTimeout84 call Timer_SetCFifTimeout 85 85 jnc SHORT .PollLoop ; Loop if time left 86 86 call IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL … … 110 110 test al, FLG_STATUS_BSY ; Controller busy? 111 111 jz SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 112 call HTimer_SetCFifTimeout ; Update timeout counter112 call Timer_SetCFifTimeout ; Update timeout counter 113 113 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 114 114 jmp SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r150 r155 50 50 51 51 push bx 52 call HAddress_OldInt13hAddressToIdeAddress52 call Address_OldInt13hAddressToIdeAddress 53 53 call AccessDPT_GetDriveSelectByteToAL 54 54 or al, bh ; AL now has Drive and Head Select Byte -
trunk/XTIDE_Universal_BIOS/Src/Device/Timer.asm
r150 r155 6 6 7 7 ;-------------------------------------------------------------------- 8 ; HTimer_InitializeTimeoutWithTicksInCX8 ; Timer_InitializeTimeoutWithTicksInCL 9 9 ; Parameters: 10 ; C X: Timeout value in system timer ticks10 ; CL: Timeout value in system timer ticks 11 11 ; DS: Segment to RAMVARS 12 12 ; Returns: … … 16 16 ;-------------------------------------------------------------------- 17 17 ALIGN JUMP_ALIGN 18 HTimer_InitializeTimeoutWithTicksInCX:19 mov [RAMVARS. wTimeoutCounter], cx ; Store timeout ticks18 Timer_InitializeTimeoutWithTicksInCL: 19 mov [RAMVARS.bTimeoutTicksLeft], cl ; Ticks until timeout 20 20 call ReadTimeFromBdaToCX 21 add [RAMVARS.wTimeoutCounter], cx ; End time for timeout21 mov [RAMVARS.bLastTimeoutUpdate], cl ; Start time 22 22 ret 23 23 24 24 25 25 ;-------------------------------------------------------------------- 26 ; HTimer_SetCFifTimeout26 ; Timer_SetCFifTimeout 27 27 ; Parameters: 28 28 ; DS: Segment to RAMVARS … … 34 34 ;-------------------------------------------------------------------- 35 35 ALIGN JUMP_ALIGN 36 HTimer_SetCFifTimeout:36 Timer_SetCFifTimeout: 37 37 call ReadTimeFromBdaToCX 38 cmp [RAMVARS.wTimeoutCounter], cx 38 cmp cl, [RAMVARS.bLastTimeoutUpdate] 39 je SHORT .StillPollingTheSameTick 40 mov [RAMVARS.bLastTimeoutUpdate], cl 41 sub BYTE [RAMVARS.bTimeoutTicksLeft], 1 ; DEC does not update CF 42 .StillPollingTheSameTick: 39 43 ret 40 44 … … 44 48 ; RTC resolution is 977 microsecs. 45 49 ; 46 ; HTimer_DelayMicrosecondsFromAX50 ; Timer_DelayMicrosecondsFromAX 47 51 ; Parameters: 48 52 ; AX: Number of microsecs to wait … … 52 56 ; AX 53 57 ;-------------------------------------------------------------------- 54 HTimer_DelayMicrosecondsFromAX:58 Timer_DelayMicrosecondsFromAX: 55 59 %ifndef USE_AT 56 60 mov ax, 2 … … 69 73 pop dx 70 74 mov ax, 1 ; Prepare to wait 1 timer tick 71 jc SHORT HTimer_DelayTimerTicksFromAX ; Event Wait was unsupported or busy75 jc SHORT Timer_DelayTimerTicksFromAX ; Event Wait was unsupported or busy 72 76 ret 73 77 %endif … … 78 82 ; will occur at 54.9 ms intervals. 79 83 ; 80 ; HTimer_DelayTimerTicksFromAX84 ; Timer_DelayTimerTicksFromAX 81 85 ; Parameters: 82 86 ; AX: Number of timer ticks to wait … … 86 90 ; AX 87 91 ;-------------------------------------------------------------------- 88 HTimer_DelayTimerTicksFromAX:92 Timer_DelayTimerTicksFromAX: 89 93 sti ; Make sure that interrupts are enabled 90 94 call ReadTimeFromBdaToCX … … 93 97 call ReadTimeFromBdaToCX 94 98 cmp cx, ax 95 j bSHORT .WaitLoop ; Loop until end time is reached99 jne SHORT .WaitLoop ; Loop until end time is reached 96 100 ret 97 101 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r150 r155 23 23 sti ; Enable interrupts 24 24 cld ; String instructions to increment pointers 25 SAVE_AND_GET_INTPACK_WITH_EXTRA_WORDS_TO_SSBP EXTRA_WORDS_TO_RESERVE_FOR_INTPACK25 CREATE_FRAME_INTPACK_TO_SSBP EXTRA_BYTES_FOR_INTPACK 26 26 27 27 call RamVars_GetSegmentToDS … … 33 33 34 34 ; Jump to correct BIOS function 35 JumpToBiosFunctionInAH:36 35 cmp ah, 25h ; Valid BIOS function? 37 36 ja SHORT Int13h_UnsupportedFunction … … 109 108 or WORD [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_IF ; Return with interrupts enabled 110 109 mov sp, bp ; Now we can exit anytime 111 RESTORE_ INTPACK_WITH_EXTRA_WORDS_FROM_SSBP EXTRA_WORDS_TO_RESERVE_FOR_INTPACK110 RESTORE_FRAME_INTPACK_FROM_SSBP EXTRA_BYTES_FOR_INTPACK 112 111 113 112 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
r150 r155 59 59 60 60 ConvertAH08hReturnValuesToSectorCount: 61 call HAddress_ExtractLCHSparametersFromOldInt13hAddress61 call Address_ExtractLCHSparametersFromOldInt13hAddress 62 62 xor ax, ax ; Zero AX 63 63 inc cx ; Max cylinder number to cylinder count -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r150 r155 15 15 ; SS:BP: Ptr to IDEPACK 16 16 ; Parameters on INTPACK: 17 ; AL: Number of sectors to read (1...255 , 0=256)17 ; AL: Number of sectors to read (1...255) 18 18 ; CH: Cylinder number, bits 7...0 19 19 ; CL: Bits 7...6: Cylinder number bits 9 and 8 … … 28 28 ALIGN JUMP_ALIGN 29 29 AH2h_HandlerForReadDiskSectors: 30 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 30 31 mov ah, COMMAND_READ_SECTORS ; Load sector mode command 31 32 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED … … 40 41 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 41 42 %endif 43 44 45 ;-------------------------------------------------------------------- 46 ; AH2h_ExitInt13hIfSectorCountInIntpackIsZero 47 ; Parameters: 48 ; SS:BP: Ptr to IDEPACK 49 ; Parameters on INTPACK: 50 ; AL: Number of sectors to transfer (1...255) 51 ; Returns: 52 ; Nothing (does not return if error) 53 ; Corrupts registers: 54 ; Nothing 55 ;-------------------------------------------------------------------- 56 ALIGN JUMP_ALIGN 57 AH2h_ExitInt13hIfSectorCountInIntpackIsZero: 58 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 59 je SHORT .InvalidSectorCount 60 ret 61 .InvalidSectorCount: 62 mov ah, RET_HD_INVALID 63 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r150 r155 27 27 ALIGN JUMP_ALIGN 28 28 AH3h_HandlerForWriteDiskSectors: 29 ; Prepare parameters29 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 30 30 mov ah, COMMAND_WRITE_SECTORS ; Load sector mode command 31 31 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
r150 r155 26 26 ALIGN JUMP_ALIGN 27 27 AH4h_HandlerForVerifyDiskSectors: 28 mov ah, COMMAND_WRITE_SECTORS 28 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 29 mov ah, COMMAND_VERIFY_SECTORS 29 30 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) 30 31 %ifdef USE_186 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Address.asm
r150 r155 15 15 16 16 ;-------------------------------------------------------------------- 17 ; HAddress_OldInt13hAddressToIdeAddress17 ; Address_OldInt13hAddressToIdeAddress 18 18 ; Parameters: 19 19 ; CH: Cylinder number, bits 7...0 … … 31 31 ;-------------------------------------------------------------------- 32 32 ALIGN JUMP_ALIGN 33 HAddress_OldInt13hAddressToIdeAddress:33 Address_OldInt13hAddressToIdeAddress: 34 34 call AccessDPT_GetAddressingModeForWordLookToBX 35 35 push WORD [cs:bx+g_rgfnAddressTranslation] ; Push return address 36 ; Fall to HAddress_ExtractLCHSparametersFromOldInt13hAddress36 ; Fall to Address_ExtractLCHSparametersFromOldInt13hAddress 37 37 38 38 ;--------------------------------------------------------------------- 39 ; HAddress_ExtractLCHSparametersFromOldInt13hAddress39 ; Address_ExtractLCHSparametersFromOldInt13hAddress 40 40 ; Parameters: 41 41 ; CH: Cylinder number, bits 7...0 … … 50 50 ; Nothing 51 51 ;-------------------------------------------------------------------- 52 HAddress_ExtractLCHSparametersFromOldInt13hAddress:52 Address_ExtractLCHSparametersFromOldInt13hAddress: 53 53 mov bl, cl ; Copy sector number... 54 54 and bl, 3Fh ; ...and limit to 1...63 … … 66 66 ; PSector = LSector 67 67 ; 68 ; HAddress_ConvertLCHStoPCHS:68 ; Address_ConvertLCHStoPCHS: 69 69 ; Parameters: 70 70 ; BL: Sector number (1...63) … … 104 104 ; 105 105 ; Returned address is in same registers that 106 ; HAddress_DoNotConvertLCHS and HAddress_ConvertLCHStoPCHS returns.106 ; Address_DoNotConvertLCHS and Address_ConvertLCHStoPCHS returns. 107 107 ; 108 108 ; ConvertLCHStoLBARegisterValues: -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r152 r155 119 119 120 120 121 ; Include .asm files (static data and libraries)121 ; Libraries and data 122 122 %include "AssemblyLibrary.asm" 123 123 %include "Strings.asm" ; For BIOS message strings 124 124 125 ; In clude .asm files (Initialization and drive detection)125 ; Initialization and drive detection 126 126 %include "Initialize.asm" ; For BIOS initialization 127 127 %include "Interrupts.asm" ; For Interrupt initialization … … 135 135 %include "DetectPrint.asm" ; For printing drive detection strings 136 136 137 ; Include .asm files (boot menu)137 ; Boot menu 138 138 %include "BootMenu.asm" ; For Boot Menu operations 139 139 %include "BootMenuEvent.asm" ; For menu library event handling … … 144 144 %include "BootMenuPrintCfg.asm" ; For printing hard disk configuration 145 145 146 ; Include .asm files (general drive accessing) 147 %include "DriveXlate.asm" ; For swapping drive numbers 148 %include "HAddress.asm" ; For sector address translations 149 %include "HTimer.asm" ; For timeout and delay 150 151 ; Include .asm files (Interrupt handlers) 152 %include "Int13h.asm" ; For Int 13h, Disk functions 146 ; Boot loader 153 147 %ifndef USE_AT 154 148 %include "Int19hLate.asm" ; For late initialization … … 156 150 %include "Int19hMenu.asm" ; For Int 19h, Boot Loader for Boot Menu 157 151 158 ; Include .asm files (Hard Disk BIOS functions) 152 ; For all device types 153 %include "Device.asm" 154 %include "Idepack.asm" 155 %include "Timer.asm" ; For timeout and delay 156 157 ; IDE Device support 158 %include "IdeCommand.asm" 159 %include "IdeDPT.asm" 160 %include "IdeIO.asm" 161 %include "IdeIrq.asm" 162 %include "IdeTransfer.asm" 163 %include "IdeWait.asm" 164 %include "IdeError.asm" ; Must be included after IdeWait.asm 165 166 ; Serial Port Device support 167 %include "SerialCommand.asm" 168 %include "SerialDPT.asm" 169 170 ; INT 13h Hard Disk BIOS functions 171 %include "DriveXlate.asm" ; For swapping drive numbers 172 %include "Address.asm" ; For sector address translations 173 %include "Int13h.asm" ; For Int 13h, Disk functions 159 174 %include "AH0h_HReset.asm" ; Required by Int13h_Jump.asm 160 175 %include "AH1h_HStatus.asm" ; Required by Int13h_Jump.asm … … 172 187 %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm 173 188 %include "AH25h_HDrvID.asm" ; Required by Int13h_Jump.asm 174 %include "Device.asm"175 %include "Idepack.asm"176 177 ; IDE Device support178 %include "IdeCommand.asm"179 %include "IdeDPT.asm"180 %include "IdeIO.asm"181 %include "IdeIrq.asm"182 %include "IdeTransfer.asm"183 %include "IdeWait.asm"184 %include "IdeError.asm" ; Must be included after IdeWait.asm185 186 ; Serial Port Device support187 %include "SerialCommand.asm"188 %include "SerialDPT.asm"189 189 190 190 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r150 r155 123 123 ; Cleared if function belongs to some other BIOS 124 124 ; Corrupts registers: 125 ; DI125 ; Nothing 126 126 ;-------------------------------------------------------------------- 127 127 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/makefile
r150 r155 38 38 HEADERS += Src/Handlers/ 39 39 HEADERS += Src/Handlers/Int13h/ 40 HEADERS += Src/Handlers/Int13h/Common/41 40 HEADERS += Src/Device/ 42 41 HEADERS += Src/Device/IDE/
Note:
See TracChangeset
for help on using the changeset viewer.