Changeset 158 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- May 2, 2011, 9:41:51 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
r150 r158 69 69 PushBlockMode: 70 70 mov ax, 1 71 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED71 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 72 72 jz SHORT .PushBlockSizeFromAX 73 73 mov al, [di+DPT_ATA.bSetBlock] … … 137 137 ;-------------------------------------------------------------------- 138 138 PushResetStatus: 139 mov a x, [di+DPT.wFlags]140 and ax, MASK _DPT_RESET139 mov al, [di+DPT.bFlagsHigh] 140 and ax, MASKH_DPT_RESET 141 141 push ax 142 142 -
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r152 r158 16 16 ;-------------------------------------------------------------------- 17 17 Device_FinalizeDPT: 18 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE18 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 19 19 jnz SHORT ReturnSuccessForSerialPort 20 20 jmp IdeDPT_Finalize … … 34 34 ;-------------------------------------------------------------------- 35 35 Device_ResetMasterAndSlaveController: 36 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE36 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 37 37 jnz SHORT ReturnSuccessForSerialPort 38 38 jmp IdeCommand_ResetMasterAndSlaveController … … 76 76 ALIGN JUMP_ALIGN 77 77 Device_OutputCommandWithParameters: 78 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE78 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 79 79 jnz SHORT .OutputCommandToSerialPort 80 80 jmp IdeCommand_OutputWithParameters … … 97 97 ALIGN JUMP_ALIGN 98 98 Device_SelectDrive: 99 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE99 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 100 100 jnz SHORT ReturnSuccessForSerialPort 101 101 jmp IdeCommand_SelectDrive … … 168 168 ;-------------------------------------------------------------------- 169 169 TranslateRegisterAddressInDLifNecessaryThenJumpToBX: 170 test WORD [di+DPT.wFlags], FLG_DPT_REVERSED_A0_AND_A3170 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 171 171 jz SHORT .JumpToIoFunctionInSI 172 172 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r157 r158 54 54 ; Create fake DPT to be able to use Device.asm functions 55 55 call FindDPT_ForNewDriveToDSDI 56 xor ax, ax56 eMOVZX ax, bh 57 57 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 58 eCMOVE ax, FLG_DPT_REVERSED_A0_AND_A3 59 or al, bh 58 eCMOVE ah, FLGH_DPT_REVERSED_A0_AND_A3 60 59 mov [di+DPT.wFlags], ax 61 60 mov [di+DPT.bIdevarsOffset], bp … … 65 64 cmp bp, BYTE ROMVARS.ideVars0 66 65 jne SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 67 test bh, FLG_DRVNHEAD_DRV66 test al, FLG_DRVNHEAD_DRV 68 67 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 69 68 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) … … 82 81 83 82 ; Clean stack and return 84 lea sp, [bp+ SIZE_OF_FAKE_IDEPACK] ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here83 lea sp, [bp+EXTRA_BYTES_FOR_INTPACK] ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here 85 84 pop bp 86 85 ret … … 103 102 ALIGN JUMP_ALIGN 104 103 IdeCommand_OutputWithParameters: 105 push bx 104 push bx ; Store status register bits to poll 106 105 107 106 ; Select Master or Slave drive and output head number or LBA28 top bits … … 110 109 111 110 ; Output Device Control Byte to enable or disable interrupts 112 mov dl, DEVICE_CONTROL_REGISTER_out113 111 mov al, [bp+IDEPACK.bDeviceControl] 114 test al, FLG_DEVCONTROL_nIEN 112 test al, FLG_DEVCONTROL_nIEN ; Interrupts disabled? 115 113 jnz SHORT .DoNotSetInterruptInServiceFlag 116 or WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE 114 115 ; Clear Task Flag and set Interrupt In-Service Flag 116 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE 117 117 push ds 118 LOAD_BDA_SEGMENT_TO ds, cx, ! ; Also zero CX119 mov [BDA.bHDTaskFlg], al118 LOAD_BDA_SEGMENT_TO ds, dx, ! ; Also zero DX 119 mov [BDA.bHDTaskFlg], dl 120 120 pop ds 121 121 .DoNotSetInterruptInServiceFlag: 122 mov dl, DEVICE_CONTROL_REGISTER_out 122 123 call Device_OutputALtoIdeControlBlockRegisterInDL 123 124 … … 143 144 144 145 ; Wait until command completed 145 pop bx 146 cmp bl, FLG_STATUS_DRQ 147 je SHORT .StartDataTransfer146 pop bx ; Pop status and timeout for polling 147 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 148 je SHORT IdeTransfer_StartWithCommandInAL 148 149 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 149 150 jz SHORT .WaitForIrqOrRdy … … 153 154 .WaitForIrqOrRdy: 154 155 jmp IdeWait_IRQorStatusFlagInBLwithTimeoutInBH 155 ALIGN JUMP_ALIGN156 .StartDataTransfer:157 jmp IdeTransfer_StartWithCommandInAL158 156 159 157 .DriveNotReady: … … 179 177 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 180 178 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 181 eCMOVE b x, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_BSY)179 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 182 180 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 183 181 jc SHORT ReturnSinceTimeoutWhenPollingBusy … … 189 187 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 190 188 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 191 eCMOVE b x, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_DRDY)189 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 192 190 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 193 191 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r152 r158 114 114 115 115 ; Clear Interrupt In-Service Flag from DPT 116 and WORD [di+DPT.wFlags], ~FLG_DPT_INTERRUPT_IN_SERVICE116 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE 117 117 118 118 ; Set Task Flag -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r157 r158 166 166 ; InitializePiovarsInSSBPwithSectorCountInAX 167 167 ; Parameters: 168 ; AX: Number of sectors to transfer ( 0=65536)168 ; AX: Number of sectors to transfer (1...65535) 169 169 ; BX: Offset to transfer function lookup table 170 170 ; DS:DI: Ptr to DPT (in RAMVARS segment) … … 179 179 ; Store number of blocks to transfer 180 180 eMOVZX cx, BYTE [di+DPT_ATA.bSetBlock] ; Block size in sectors 181 xor dx, dx 182 test ax, ax 183 eCMOVZ dl, 1 ; DX:AX = Sectors to transfer (1...65536) 181 xor dx, dx ; DX:AX = Sectors to transfer (1...65535) 184 182 div cx ; AX = Full blocks to transfer 185 183 test dx, dx … … 197 195 198 196 ; Get transfer function based on bus type 199 xchg ax, bx 197 xchg ax, bx ; Lookup table offset to AX 200 198 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS 201 199 mov dx, [cs:bx+IDEVARS.wPort] ; Load IDE Data port address -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r155 r158 1 1 ; Project name : XTIDE Universal BIOS 2 2 ; Description : Functions for managing IDEPACK struct. 3 4 SIZE_OF_FAKE_IDEPACK EQU (IDEPACK_size - INTPACK_size)5 3 6 4 ; Section containing code … … 18 16 Idepack_FakeToSSBP: 19 17 pop ax 20 sub sp, BYTE SIZE_OF_FAKE_IDEPACK18 sub sp, BYTE EXTRA_BYTES_FOR_INTPACK 21 19 mov bp, sp 22 20 jmp ax -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r150 r158 22 22 ALIGN JUMP_ALIGN 23 23 AH24h_HandlerForSetMultipleBlocks: 24 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED24 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 25 25 jnz SHORT .TryToSetBlockMode 26 26 stc -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r155 r158 28 28 ALIGN JUMP_ALIGN 29 29 AH2h_HandlerForReadDiskSectors: 30 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 30 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 31 je SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero 32 31 33 mov ah, COMMAND_READ_SECTORS ; Load sector mode command 32 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED34 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 33 35 eCMOVNZ ah, COMMAND_READ_MULTIPLE ; Load block mode command 34 36 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) … … 44 46 45 47 ;-------------------------------------------------------------------- 46 ; AH2h_ExitInt13h IfSectorCountInIntpackIsZero48 ; AH2h_ExitInt13hSinceSectorCountInIntpackIsZero 47 49 ; Parameters: 48 ; SS:BP: Ptr to IDEPACK 49 ; Parameters on INTPACK: 50 ; AL: Number of sectors to transfer (1...255) 50 ; Nothing 51 51 ; Returns: 52 ; Nothing (does not return if error) 53 ; Corrupts registers: 54 ; Nothing 52 ; Jumps to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 55 53 ;-------------------------------------------------------------------- 56 ALIGN JUMP_ALIGN 57 AH2h_ExitInt13hIfSectorCountInIntpackIsZero: 58 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 59 je SHORT .InvalidSectorCount 60 ret 61 .InvalidSectorCount: 54 AH2h_ExitInt13hSinceSectorCountInIntpackIsZero: 62 55 mov ah, RET_HD_INVALID 63 56 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r155 r158 27 27 ALIGN JUMP_ALIGN 28 28 AH3h_HandlerForWriteDiskSectors: 29 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 29 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 30 je SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero 31 30 32 mov ah, COMMAND_WRITE_SECTORS ; Load sector mode command 31 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED33 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 32 34 eCMOVNZ ah, COMMAND_WRITE_MULTIPLE ; Load block mode command 33 35 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
r155 r158 26 26 ALIGN JUMP_ALIGN 27 27 AH4h_HandlerForVerifyDiskSectors: 28 call AH2h_ExitInt13hIfSectorCountInIntpackIsZero 28 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 0 29 je SHORT AH2h_ExitInt13hSinceSectorCountInIntpackIsZero 30 29 31 mov ah, COMMAND_VERIFY_SECTORS 30 32 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r157 r158 46 46 47 47 ; Try to select drive and wait until ready 48 or WORD [di+DPT.wFlags], MASK_DPT_RESET ; Everything uninitialized48 or BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET ; Everything uninitialized 49 49 call AccessDPT_GetDriveSelectByteToAL 50 50 mov [bp+IDEPACK.bDrvAndHead], al 51 51 call Device_SelectDrive 52 52 jc SHORT .ReturnNotSuccessfull 53 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nDRDY ; Clear since success53 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nDRDY ; Clear since success 54 54 55 55 ; Initialize CHS parameters if LBA is not used 56 56 call InitializeDeviceParameters 57 57 jc SHORT .RecalibrateDrive 58 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nINITPRMS58 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nINITPRMS 59 59 60 60 ; Recalibrate drive by seeking to cylinder 0 … … 62 62 call AH11h_RecalibrateDrive 63 63 jc SHORT .InitializeBlockMode 64 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nRECALIBRATE64 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nRECALIBRATE 65 65 66 66 ; Initialize block mode transfers … … 68 68 call InitializeBlockMode 69 69 jc SHORT .ReturnNotSuccessfull 70 and WORD [di+DPT.wFlags], ~FLG_DPT_RESET_nSETBLOCK ; Keeps CF clear70 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nSETBLOCK ; Keeps CF clear 71 71 72 72 .ReturnNotSuccessfull: … … 90 90 InitializeDeviceParameters: 91 91 ; No need to initialize CHS parameters if LBA mode enabled 92 test BYTE [di+DPT. wFlags], FLG_DRVNHEAD_LBA ; Clear CF92 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA ; Clear CF 93 93 jnz SHORT ReturnSuccessSinceInitializationNotNeeded 94 94 … … 115 115 ALIGN JUMP_ALIGN 116 116 InitializeBlockMode: 117 test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED ; Clear CF117 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Clear CF 118 118 jz SHORT ReturnSuccessSinceInitializationNotNeeded 119 119 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Address.asm
r155 r158 89 89 ; (LCylinder << n) + (LHead / PHeadCount) 90 90 mov dx, cx ; Copy L-CHS Cylinder number to DX 91 mov cl, [di+DPT. wFlags]; Load shift count92 and cl, MASK _DPT_CHS_SHIFT_COUNT91 mov cl, [di+DPT.bFlagsLow] ; Load shift count 92 and cl, MASKL_DPT_CHS_SHIFT_COUNT 93 93 shl dx, cl ; DX = LCylinder << n 94 94 add ax, dx ; AX = P-CHS Cylinder number -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r152 r158 115 115 call Idepack_FakeToSSBP 116 116 call AH0h_ResetHardDisksHandledByOurBIOS 117 add sp, BYTE SIZE_OF_FAKE_IDEPACK117 add sp, BYTE EXTRA_BYTES_FOR_INTPACK 118 118 ret -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r155 r158 157 157 ; IDE Device support 158 158 %include "IdeCommand.asm" 159 %include "IdeTransfer.asm" ; Must be included after IdeCommand.asm 159 160 %include "IdeDPT.asm" 160 161 %include "IdeIO.asm" 161 162 %include "IdeIrq.asm" 162 %include "IdeTransfer.asm"163 163 %include "IdeWait.asm" 164 164 %include "IdeError.asm" ; Must be included after IdeWait.asm -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r150 r158 34 34 AccessDPT_GetDeviceControlByteToAL: 35 35 xor al, al 36 test BYTE [di+DPT. wFlags], FLG_DPT_ENABLE_IRQ36 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_ENABLE_IRQ 37 37 jnz SHORT .EnableDeviceIrq 38 38 or al, FLG_DEVCONTROL_nIEN ; Disable IRQ … … 52 52 ALIGN JUMP_ALIGN 53 53 AccessDPT_GetAddressingModeForWordLookToBX: 54 mov bl, [di+DPT. wFlags]55 and bx, BYTE MASK _DPT_ADDRESSING_MODE54 mov bl, [di+DPT.bFlagsLow] 55 and bx, BYTE MASKL_DPT_ADDRESSING_MODE 56 56 eSHR_IM bx, ADDRESSING_MODE_FIELD_POSITION-1 57 57 ret … … 72 72 AccessDPT_GetLCHSfromPCHS: 73 73 xchg ax, cx 74 mov cl, [di+DPT. wFlags]75 and cl, MASK _DPT_CHS_SHIFT_COUNT ; Load shift count74 mov cl, [di+DPT.bFlagsLow] 75 and cl, MASKL_DPT_CHS_SHIFT_COUNT ; Load shift count 76 76 mov bx, [di+DPT.wPchsCylinders] ; Load P-CHS cylinders 77 77 shr bx, cl ; Shift to L-CHS cylinders … … 115 115 eMOVZX bx, [di+DPT.bIdevarsOffset] ; CS:BX points to IDEVARS 116 116 add bx, BYTE IDEVARS.drvParamsMaster ; CS:BX points to Master Drive DRVPARAMS 117 test BYTE [di+DPT. wFlags], FLG_DPT_SLAVE117 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 118 118 jz SHORT .ReturnPointerToDRVPARAMS 119 119 add bx, BYTE DRVPARAMS_size ; CS:BX points to Slave Drive DRVPARAMS -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r150 r158 60 60 cmp [cs:bp+IDEVARS.bIRQ], ah ; Interrupts enabled? 61 61 jz SHORT .StoreFlags ; If not, do not set interrupt flag 62 or al, FLG _DPT_ENABLE_IRQ62 or al, FLGL_DPT_ENABLE_IRQ 63 63 .StoreFlags: 64 64 mov [di+DPT.wFlags], ax … … 172 172 cmp BYTE [es:si+ATA1.bBlckSize], 1 ; Max block size in sectors 173 173 jbe SHORT .BlockModeTransfersNotSupported 174 or WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED174 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 175 175 .BlockModeTransfersNotSupported: 176 176 ; Fall to .StoreDeviceSpecificParameters -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r152 r158 98 98 ALIGN JUMP_ALIGN 99 99 IterateToSlaveAtPortCallback: 100 test BYTE [di+DPT. wFlags], FLG_DPT_SLAVE ; Clears CF100 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE ; Clears CF 101 101 jnz SHORT CompareBasePortAddress 102 102 ret ; Wrong DPT … … 104 104 ALIGN JUMP_ALIGN 105 105 IterateToMasterAtPortCallback: 106 test BYTE [di+DPT. wFlags], FLG_DPT_SLAVE106 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 107 107 jnz SHORT ReturnWrongDPT ; Return if slave drive 108 108 … … 146 146 ALIGN JUMP_ALIGN 147 147 IterateToDptWithInterruptInServiceFlagSet: 148 test WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE148 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE 149 149 jz SHORT ReturnWrongDPT 150 150 stc ; Set CF since wanted DPT
Note:
See TracChangeset
for help on using the changeset viewer.