Changeset 294 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Mar 4, 2012, 1:35:10 AM (13 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
r258 r294 43 43 call RamVars_GetSegmentToDS 44 44 ;;; fall-through 45 45 46 46 ALIGN JUMP_ALIGN 47 47 BootMenu_GetDriveToDXforMenuitemInCX: … … 136 136 BootMenu_GetMenuitemToAXforAsciiHotkeyInAL: 137 137 call Char_ALtoUpperCaseLetter 138 xor ah, ah138 cbw 139 139 xchg ax, cx 140 140 call BootMenu_GetLetterForFirstHardDiskToAL -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r262 r294 7 7 ;-------------------------------------------------------------------- 8 8 ; BootMenuPrint_RefreshItem 9 ; 9 ; 10 10 ; Parameters: 11 11 ; DL: Untranslated Floppy Drive number … … 19 19 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS 20 20 jnc BootMenuEvent_EventCompleted ; if no menu item selected, out we go 21 21 22 22 push bp 23 23 mov bp, sp … … 29 29 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA 30 30 jmp .go 31 31 32 32 .notOurs: 33 mov si,g_szDriveNum 33 mov si,g_szDriveNum 34 34 mov bx,g_szForeignHD ; assume a hard disk for the moment 35 36 test dl, 80h35 36 test dl, dl 37 37 js .go 38 38 mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption... 39 39 40 40 .go: 41 41 mov ax, dx ; preserve DL for the floppy drive letter addition … … 45 45 add al, 'A' ; floppy drive letter (we always push this although 46 46 push ax ; the hard disks don't ever use it, but it does no harm) 47 47 48 48 jmp short BootMenuPrint_RefreshInformation.FormatRelay 49 49 … … 88 88 jmp short BootMenuPrint_RefreshInformation.FormatRelay 89 89 90 90 91 91 ;-------------------------------------------------------------------- 92 92 ; BootMenuPrint_FloppyMenuitemInformation … … 101 101 ALIGN JUMP_ALIGN 102 102 BootMenuPrint_RefreshInformation: 103 CALL_MENU_LIBRARY ClearInformationArea 104 103 CALL_MENU_LIBRARY ClearInformationArea 104 105 105 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS 106 106 jnc BootMenuEvent_EventCompleted ; if no menu selection, abort … … 115 115 inc dl ; are we a hard disk? 116 116 dec dl ; inc/dec will set SF, without modifying CF or DL 117 js .HardDiskRefreshInformation 117 js .HardDiskRefreshInformation 118 118 119 119 jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above … … 122 122 .ours: 123 123 call AH8h_GetDriveParameters 124 .around: 124 .around: 125 125 126 126 mov ax, g_szFddSizeOr ; .PrintXTFloppyType 127 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 127 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 128 128 jz SHORT .PushAXAndOutput 129 129 … … 131 131 cmp bl, FLOPPY_TYPE_35_ED 132 132 ja SHORT .PushAXAndOutput 133 133 134 134 ; Fall to .PrintKnownFloppyType 135 135 … … 142 142 ; Corrupts registers: 143 143 ; AX, BX, SI, DI 144 ; 144 ; 145 145 ; Floppy Drive Types: 146 146 ; 147 ; 0 Handled above 147 ; 0 Handled above 148 148 ; 1 FLOPPY_TYPE_525_DD 5 1/4 360K 149 149 ; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M … … 153 153 ; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M 154 154 ; >6 Unknwon, handled above 155 ; 155 ; 156 156 ;-------------------------------------------------------------------- 157 157 .PrintKnownFloppyType: 158 158 mov al, (g_szFddSize - $$) & 0xff 159 159 push ax 160 160 161 161 mov al, (g_szFddThreeHalf - $$) & 0xff 162 162 cmp bl, FLOPPY_TYPE_525_HD 163 163 ja .ThreeHalf 164 164 mov al, (g_szFddFiveQuarter - $$) & 0xff 165 .ThreeHalf: 165 .ThreeHalf: 166 166 push ax ; "5 1/4" or "3 1/2" 167 167 … … 170 170 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table 171 171 172 .PushAXAndOutput: 172 .PushAXAndOutput: 173 173 push ax 174 174 … … 189 189 ;-------------------------------------------------------------------- 190 190 ALIGN JUMP_ALIGN 191 .HardDiskRefreshInformation: 191 .HardDiskRefreshInformation: 192 192 jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above 193 193 … … 196 196 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size 197 197 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 198 198 199 199 .HardDiskMenuitemInfoForForeignDrive: 200 200 call DriveXlate_ToOrBack … … 208 208 push ax ; Size in magnitude 209 209 push cx ; Tenths 210 push dx ; Magnitude character 211 210 push dx ; Magnitude character 211 212 212 test di,di 213 213 jz short BootMenuPrint_FormatCSSIfromParamsInSSBP … … 225 225 ; Returns: 226 226 ; BP: Popped from stack 227 ; CF: Set since menu event was handled successfully 227 ; CF: Set since menu event was handled successfully 228 228 ; Corrupts registers: 229 229 ; AX, DI … … 232 232 BootMenuPrint_FormatCSSIfromParamsInSSBP: 233 233 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI 234 stc ; Successful lreturn from menu event234 stc ; Successful return from menu event 235 235 pop bp 236 236 ret 237 238 237 238 239 239 ;-------------------------------------------------------------------- 240 240 ; BootMenuPrint_ClearScreen … … 364 364 push cx ; Key attribute for last space 365 365 mov si, g_szHotkey 366 367 BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay: 366 367 BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay: 368 368 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 369 369 -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
r258 r294 24 24 ;-------------------------------------------------------------------- 25 25 .BootMenuPrintCfg_ForOurDrive: 26 eMOVZX ax, BYTE[di+DPT.bIdevarsOffset]26 eMOVZX ax, [di+DPT.bIdevarsOffset] 27 27 xchg bx, ax ; CS:BX now points to IDEVARS 28 28 ; Fall to .PushAndFormatCfgString … … 40 40 .PushAddressingMode: 41 41 AccessDPT_GetUnshiftedAddressModeToALZF 42 ;; 43 ;; This multiply both shifts the addressing mode bits down to low order bits, and 42 ;; 43 ;; This multiply both shifts the addressing mode bits down to low order bits, and 44 44 ;; at the same time multiplies by the size of the string displacement. The result is in AH, 45 45 ;; with AL clear, and so we exchange AL and AH after the multiply for the final result. 46 ;; 46 ;; 47 47 mov cl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement 48 48 mul cl … … 50 50 add ax,g_szAddressingModes 51 51 push ax 52 52 53 53 ;-------------------------------------------------------------------- 54 54 ; PushBlockMode … … 82 82 mov al,g_szBusTypeValues_Displacement 83 83 mul BYTE [cs:bx+IDEVARS.bDevice] 84 84 85 85 shr ax,1 ; divide by 2 since IDEVARS.bDevice is multiplied by 2 86 86 87 87 add ax,g_szBusTypeValues 88 push ax 89 88 push ax 89 90 90 ;-------------------------------------------------------------------- 91 91 ; PushIRQ … … 99 99 ;-------------------------------------------------------------------- 100 100 .PushIRQ: 101 mov al, BYTE[cs:bx+IDEVARS.bIRQ]101 mov al, [cs:bx+IDEVARS.bIRQ] 102 102 cbw 103 103 push ax -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootSector.asm
r148 r294 11 11 ; DS: RAMVARS segment 12 12 ; Returns: 13 ; ES:BX: Ptr to boot sector (if successful l)14 ; CF: Set if boot sector loaded succes fully13 ; ES:BX: Ptr to boot sector (if successful) 14 ; CF: Set if boot sector loaded successfully 15 15 ; Cleared if failed to load boot sector 16 16 ; Corrupts registers: … … 46 46 ; Returns: 47 47 ; AH: INT 13h error code 48 ; ES:BX: Ptr to boot sector (if successful l)49 ; CF: Cleared if read successful l48 ; ES:BX: Ptr to boot sector (if successful) 49 ; CF: Cleared if read successful 50 50 ; Set if any error 51 51 ; Corrupts registers: … … 73 73 ; Returns: 74 74 ; AH: INT 13h error code 75 ; CF: Cleared if read successful l75 ; CF: Cleared if read successful 76 76 ; Set if any error 77 77 ; Corrupts registers: … … 96 96 ; AH: INT 13h error code 97 97 ; ES:BX: Ptr to boot sector 98 ; CF: Cleared if read successful l98 ; CF: Cleared if read successful 99 99 ; Set if any error 100 100 ; Corrupts registers: -
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r268 r294 6 6 7 7 8 %macro TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE 18 %macro TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE 1 9 9 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 10 10 jnz SHORT %1 … … 42 42 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice 43 43 jmp IdeDPT_Finalize 44 .FinalizeDptForSerialPortDevice: 44 .FinalizeDptForSerialPortDevice: 45 45 jmp SerialDPT_Finalize 46 46 … … 63 63 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 64 64 Device_ResetMasterAndSlaveController: 65 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort65 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 66 66 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE 67 67 jmp IdeCommand_ResetMasterAndSlaveController … … 75 75 %elifdef MODULE_SERIAL ; IDE + Serial 76 76 Device_ResetMasterAndSlaveController: 77 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort77 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 78 78 jmp IdeCommand_ResetMasterAndSlaveController 79 79 … … 152 152 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 153 153 Device_OutputCommandWithParameters: 154 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort154 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 155 155 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE 156 156 jmp IdeCommand_OutputWithParameters … … 164 164 %elifdef MODULE_SERIAL ; IDE + Serial 165 165 Device_OutputCommandWithParameters: 166 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort166 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 167 167 jmp IdeCommand_OutputWithParameters 168 168 … … 198 198 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 199 199 Device_SelectDrive: 200 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort200 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 201 201 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive 202 202 jmp IdeCommand_SelectDrive … … 210 210 %elifdef MODULE_SERIAL ; IDE + Serial 211 211 Device_SelectDrive: 212 TEST_USI GN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort212 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 213 213 jmp IdeCommand_SelectDrive 214 214 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r285 r294 130 130 ; Output Sector Address High (only used by LBA48) 131 131 %ifdef MODULE_EBIOS 132 eMOVZX ax, BYTE [bp+IDEPACK.bLbaLowExt]; Zero sector count132 eMOVZX ax, [bp+IDEPACK.bLbaLowExt] ; Zero sector count 133 133 mov cx, [bp+IDEPACK.wLbaMiddleAndHighExt] 134 134 call IDEDEVICE%+OutputSectorCountAndAddress -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
r267 r294 23 23 24 24 %ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA 25 jmp ContinueFromMemIdeError 25 jmp ContinueFromMemIdeError ; What's this supposed to do? *FIXME* 26 26 %else 27 27 ContinueFromMemIdeError: -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r251 r294 54 54 ; AH: BIOS Error code 55 55 ; CX: Number of successfully transferred sectors 56 ; CF: 0 if transfer succes full56 ; CF: 0 if transfer successful 57 57 ; 1 if any error 58 58 ; Corrupts registers: … … 121 121 ; AH: BIOS Error code 122 122 ; CX: Number of successfully transferred sectors 123 ; CF: 0 if transfer succes full123 ; CF: 0 if transfer successful 124 124 ; 1 if any error 125 125 ; Corrupts registers: -
trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm
r267 r294 64 64 ; AH: BIOS Error code 65 65 ; CX: Number of successfully transferred sectors 66 ; CF: 0 if transfer succes full66 ; CF: 0 if transfer successful 67 67 ; 1 if any error 68 68 ; Corrupts registers: … … 125 125 ; AH: BIOS Error code 126 126 ; CX: Number of successfully transferred sectors 127 ; CF: 0 if transfer succes full127 ; CF: 0 if transfer successful 128 128 ; 1 if any error 129 129 ; Corrupts registers: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r277 r294 26 26 27 27 call RamVars_GetSegmentToDS 28 28 29 29 call DriveXlate_ToOrBack 30 30 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 31 31 32 32 call FindDPT_ForDriveNumberInDL ; DS:DI points to our DPT, or NULL if not our drive 33 33 jnc SHORT .OurFunction ; DPT found, this is one of our drives, and thus our function 34 34 35 cmp ah, 036 jz short.OurFunction ; we handle all function 0h requests (resets)35 test ah, ah 36 jz SHORT .OurFunction ; we handle all function 0h requests (resets) 37 37 cmp ah, 8 38 jn zSHORT Int13h_DirectCallToAnotherBios ; non-8h function, handled by foreign bios38 jne SHORT Int13h_DirectCallToAnotherBios ; non-8h function, handled by foreign bios 39 39 40 40 %ifndef MODULE_SERIAL_FLOPPY 41 ; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and 42 ; floppy drive counts. Without floppy support, we handle only hard disk traffic for function 08h, 41 ; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and 42 ; floppy drive counts. Without floppy support, we handle only hard disk traffic for function 08h, 43 43 ; and thus need the check below. 44 44 ; 45 test dl, dl 45 test dl, dl 46 46 jns SHORT Int13h_DirectCallToAnotherBios 47 %endif 48 49 .OurFunction: 47 %endif 48 49 .OurFunction: 50 50 ; Jump to correct BIOS function 51 51 eMOVZX bx, ah … … 141 141 test dl, dl 142 142 js short Int13h_UnsupportedFunction 143 mov ah, 0143 xor ah, ah 144 144 jmp short Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 145 145 %endif … … 172 172 %ifdef MODULE_SERIAL_FLOPPY 173 173 mov al, [bp+IDEPACK.intpack+INTPACK.dl] 174 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber: 174 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber: 175 175 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber 176 176 %else … … 191 191 ; Returns: 192 192 ; Depends on function 193 ; NOTE: ES:DI needs to be returned from the previous interrupt 193 ; NOTE: ES:DI needs to be returned from the previous interrupt 194 194 ; handler, for floppy DPT in function 08h 195 195 ; Corrupts registers: … … 251 251 .HardDisk: 252 252 LOAD_BDA_SEGMENT_TO ds, di 253 mov [bx], ah 253 mov [bx], ah 254 254 %else 255 255 Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH: 256 256 ; Store error code to BDA 257 LOAD_BDA_SEGMENT_TO ds, di 257 LOAD_BDA_SEGMENT_TO ds, di 258 258 mov [BDA.bHDLastSt], ah 259 259 %endif -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r282 r294 19 19 ; Returns with INTPACK: 20 20 ; AH: Int 13h return status (from drive requested in DL) 21 ; CF: 0 if succes full, 1 if error21 ; CF: 0 if successful, 1 if error 22 22 ;-------------------------------------------------------------------- 23 23 ALIGN JUMP_ALIGN … … 28 28 %ifdef MODULE_SERIAL_FLOPPY 29 29 ; 30 ; "Reset" emulat d serial floppy drives, if any. There is nothing to actually do for this reset,30 ; "Reset" emulated serial floppy drives, if any. There is nothing to actually do for this reset, 31 31 ; but record the proper error return code if one of these floppy drives is the drive requested. 32 32 ; … … 39 39 40 40 adc dl, al ; second drive (CF set) if present 41 ; If no drive is present, this will result in ffh which 41 ; If no drive is present, this will result in ffh which 42 42 ; won't match a drive 43 43 call BackupErrorCodeFromTheRequestedDriveToBH … … 48 48 test bl, bl ; If we were called with a floppy disk, then we are done, 49 49 jns SHORT .SkipHardDiskReset ; don't do hard disks. 50 50 51 51 call ResetForeignHardDisks 52 52 53 ; Resetting our hard disks will modify dl and bl to be idevars offset based instead of drive number based, 53 ; Resetting our hard disks will modify dl and bl to be idevars offset based instead of drive number based, 54 54 ; such that this call must be the last in the list of reset routines called. 55 55 ; … … 57 57 ; and we need to override that value if we are xlate'd into 80h with one of our drives. 58 58 ; 59 call ResetHardDisksHandledByOurBIOS 59 call ResetHardDisksHandledByOurBIOS 60 60 61 61 .SkipHardDiskReset: … … 139 139 ; Parameters: 140 140 ; DS:DI: Ptr to DPT for requested drive 141 ; If DPT pointer is not available, or error result in BH won't be used anyway, 141 ; If DPT pointer is not available, or error result in BH won't be used anyway, 142 142 ; enter through .ErrorCodeNotUsed. 143 143 ; SS:BP: Ptr to IDEPACK … … 148 148 ;-------------------------------------------------------------------- 149 149 ResetHardDisksHandledByOurBIOS: 150 mov bl, 0; Assume Null IdevarsOffset for now, assuming foreign drive150 xor bl, bl ; Assume Null IdevarsOffset for now, assuming foreign drive 151 151 test di, di 152 152 jz .ErrorCodeNotUsed 153 153 mov bl, [di+DPT.bIdevarsOffset] ; replace drive number with Idevars pointer for cmp with dl 154 155 .ErrorCodeNotUsed: ; BH will be garbage on exit if thi e entry point is used,154 155 .ErrorCodeNotUsed: ; BH will be garbage on exit if this entry point is used, 156 156 ; but reset of all drives will still happen 157 157 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH10h_HReady.asm
r150 r294 15 15 ; Returns with INTPACK: 16 16 ; AH: Int 13h return status 17 ; CF: 0 if succes full, 1 if error17 ; CF: 0 if successful, 1 if error 18 18 ;-------------------------------------------------------------------- 19 19 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH11h_HRecal.asm
r162 r294 15 15 ; Returns with INTPACK: 16 16 ; AH: BIOS Error code 17 ; CF: 0 if succes full, 1 if error17 ; CF: 0 if successful, 1 if error 18 18 ;-------------------------------------------------------------------- 19 19 ALIGN JUMP_ALIGN … … 35 35 ; Returns: 36 36 ; AH: BIOS Error code 37 ; CF: 0 if succes full, 1 if error37 ; CF: 0 if successful, 1 if error 38 38 ; Corrupts registers: 39 39 ; AL, BX, CX, DX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
r285 r294 14 14 ; SS:BP: Ptr to IDEPACK 15 15 ; Returns with INTPACK: 16 ; If succes full:16 ; If successful: 17 17 ; AH: Hard Disk: 3 (Hard disk accessible) 18 18 ; Floppy: 1 (Floppy disk, without change detection) … … 28 28 %ifdef MODULE_SERIAL_FLOPPY 29 29 mov cl, 1 ; 1 = floppy disk, no change detection 30 31 test dl,dl ; DO NOT store the sector count if this is a 32 jns .FloppyDrive ; floppy disk, some OS's depend on this not 30 31 test dl,dl ; DO NOT store the sector count if this is a 32 jns .FloppyDrive ; floppy disk, some OS's depend on this not 33 33 ; happening for floppies in order to boot. 34 34 %endif 35 35 36 36 call AH15h_GetSectorCountToBXDXAX 37 37 mov [bp+IDEPACK.intpack+INTPACK.cx], dx ; HIWORD to CX 38 38 xchg [bp+IDEPACK.intpack+INTPACK.dx], ax ; LOWORD to DX, AL gets drive number 39 39 40 xor ah, ah 41 %ifdef MODULE_SERIAL_FLOPPY 40 xor ah, ah 41 %ifdef MODULE_SERIAL_FLOPPY 42 42 mov cl, 3 ; 3 = Hard Disk Accessible 43 43 .FloppyDrive: 44 45 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber ; Store success to BDA and CF 46 mov BYTE[bp+IDEPACK.intpack+INTPACK.ah], cl44 45 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber ; Store success to BDA and CF 46 mov [bp+IDEPACK.intpack+INTPACK.ah], cl 47 47 %else 48 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH ; Store success to BDA and CF 48 call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH ; Store success to BDA and CF 49 49 mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], 3 50 %endif 51 50 %endif 51 52 52 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode 53 53 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm
r258 r294 23 23 %ifdef MODULE_SERIAL_FLOPPY 24 24 test dl, dl 25 j ns .HardDisk26 mov ah, [BDA.bFDRetST] 25 js .HardDisk 26 mov ah, [BDA.bFDRetST] ; Unlike for hard disks below, floppy version does not clear the status 27 27 jmp .done 28 .HardDisk: 28 .HardDisk: 29 29 %endif 30 31 xchg ah, [BDA.bHDLastSt] ; Load and clear last error 32 ; Note that AH is cleared with the LOAD_BDA_SEGMENT above 33 30 31 xchg ah, [BDA.bHDLastSt] ; Load and clear last error (AH is cleared with the LOAD_BDA_SEGMENT_TO above) 32 34 33 .done: 34 %ifndef USE_186 35 35 call Int13h_SetErrorCodeToIntpackInSSBPfromAH 36 36 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode 37 %else 38 push Int13h_ReturnFromHandlerWithoutStoringErrorCode 39 jmp Int13h_SetErrorCodeToIntpackInSSBPfromAH 40 %endif -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm
r170 r294 24 24 ; Returns with INTPACK: 25 25 ; AH: Int 13h return status 26 ; CF: 0 if succes full, 1 if error26 ; CF: 0 if successful, 1 if error 27 27 ;-------------------------------------------------------------------- 28 28 ALIGN JUMP_ALIGN … … 51 51 ; Returns: 52 52 ; AH: Int 13h return status 53 ; CF: 0 if succes full, 1 if error53 ; CF: 0 if successful, 1 if error 54 54 ; Corrupts registers: 55 55 ; AL, BX, CX, DX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r232 r294 18 18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 ; CF: 0 if succes full, 1 if error20 ; CF: 0 if successful, 1 if error 21 21 ;-------------------------------------------------------------------- 22 22 AH24h_HandlerForSetMultipleBlocks: … … 38 38 ; Returns: 39 39 ; AH: Int 13h return status 40 ; CF: 0 if succes full, 1 if error40 ; CF: 0 if successful, 1 if error 41 41 ; Corrupts registers: 42 42 ; AL, BX, CX, DX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
r221 r294 18 18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 ; CF: 0 if succes full, 1 if error20 ; CF: 0 if successful, 1 if error 21 21 ;-------------------------------------------------------------------- 22 22 ALIGN JUMP_ALIGN … … 40 40 ; Returns with INTPACK: 41 41 ; AH: Int 13h return status 42 ; CF: 0 if succes full, 1 if error42 ; CF: 0 if successful, 1 if error 43 43 ; Corrupts registers: 44 44 ; AL, BX, CX, DX … … 53 53 call AccessDPT_GetDriveSelectByteToAL 54 54 mov bh, al 55 eMOVZX ax, BYTE[di+DPT.bIdevarsOffset]55 eMOVZX ax, [di+DPT.bIdevarsOffset] 56 56 xchg bp, ax 57 57 call Device_IdentifyToBufferInESSIwithDriveSelectByteInBH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r258 r294 20 20 ; Bits 5...0: Starting sector number (1...63) 21 21 ; DH: Starting head number (0...255) 22 ; ES:BX: Pointer to buffer rec ieving data22 ; ES:BX: Pointer to buffer receiving data 23 23 ; Returns with INTPACK: 24 24 ; AH: Int 13h/40h floppy return status 25 25 ; AL: Burst error length if AH returns 11h (we never return error code 11h) 26 26 ; Number of sectors actually read (only valid if CF set for someBIOSes) 27 ; CF: 0 if successful l, 1 if error27 ; CF: 0 if successful, 1 if error 28 28 ;-------------------------------------------------------------------- 29 29 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r249 r294 24 24 ; AH: Int 13h/40h floppy return status 25 25 ; AL: Number of sectors actually written (only valid if CF set for someBIOSes) 26 ; CF: 0 if successful l, 1 if error26 ; CF: 0 if successful, 1 if error 27 27 ;-------------------------------------------------------------------- 28 28 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
r249 r294 23 23 ; AH: Int 13h/40h floppy return status 24 24 ; AL: Number of sectors actually verified (only valid if CF set for someBIOSes) 25 ; CF: 0 if successful l, 1 if error25 ; CF: 0 if successful, 1 if error 26 26 ;-------------------------------------------------------------------- 27 27 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r285 r294 22 22 ; ES:DI: Floppy DPT (for floppies only) 23 23 ; AH: Int 13h/40h floppy return status 24 ; CF: 0 if successful l, 1 if error24 ; CF: 0 if successful, 1 if error 25 25 ;-------------------------------------------------------------------- 26 26 AH8h_HandlerForReadDiskDriveParameters: … … 31 31 jnc SHORT .MidGame 32 32 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 33 34 .OurDrive: 33 34 .OurDrive: 35 35 call AH8h_GetDriveParameters 36 36 … … 41 41 %endif 42 42 ;; fall-through 43 44 .MidGame: 43 44 .MidGame: 45 45 call RamVars_GetCountOfKnownDrivesToAX ; assume hard disk for now, will discard if for floppies 46 46 47 47 test byte [bp+IDEPACK.intpack+INTPACK.dl], 080h 48 48 jnz .Done 49 49 50 50 mov [bp+IDEPACK.intpack+INTPACK.bl], bl 51 51 52 52 mov [bp+IDEPACK.intpack+INTPACK.es], es 53 mov [bp+IDEPACK.intpack+INTPACK.di], di 53 mov [bp+IDEPACK.intpack+INTPACK.di], di 54 54 55 55 call FloppyDrive_GetCountToAX 56 56 57 .Done: 57 .Done: 58 58 mov ah, dh 59 59 60 60 mov [bp+IDEPACK.intpack+INTPACK.cx], cx 61 61 xchg [bp+IDEPACK.intpack+INTPACK.dx], ax ; recover DL for BDA last status byte determination … … 63 63 xor ah, ah 64 64 %ifdef MODULE_SERIAL_FLOPPY 65 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber 65 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber 66 66 %else 67 67 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH … … 118 118 eSHR_IM bl,FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION 119 119 %endif 120 %endif 120 %endif 121 121 ret 122 122 … … 127 127 ; So we return fixed values out of the ROM for callers who might be expecting this information. 128 128 ; 129 ; On AT systems, we return the information for a 1.44 MB disk, 129 ; On AT systems, we return the information for a 1.44 MB disk, 130 130 ; and on XT systems, we return the information for a 360 KB disk. 131 131 ; … … 138 138 139 139 db 1h << 1 | 0 ; Offset 1: Typical values of 1 for head load time 140 ; DMA used (although it actually is not, but is more restr ctive)141 db 25h ; Offset 2: Inactivi y motor turn-off delay,140 ; DMA used (although it actually is not, but is more restrictive) 141 db 25h ; Offset 2: Inactivity motor turn-off delay, 142 142 ; Typical value of 25h for 2 second delay 143 143 db 02h ; Offset 3: Sector size, always 512 … … 161 161 db 0f6h ; Offset 8: Fill byte for format 162 162 db 0fh ; Offset 9: Head setting time 163 db 08h ; Offset A: Wait for motor start putime163 db 08h ; Offset A: Wait for motor startup time 164 164 165 165 %ifdef USE_AT -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r279 r294 15 15 ; Returns with INTPACK: 16 16 ; AH: Int 13h return status 17 ; CF: 0 if succes full, 1 if error17 ; CF: 0 if successful, 1 if error 18 18 ;-------------------------------------------------------------------- 19 19 AH9h_HandlerForInitializeDriveParameters: … … 36 36 ; Returns: 37 37 ; AH: Int 13h return status 38 ; CF: 0 if succes full, 1 if error38 ; CF: 0 if successful, 1 if error 39 39 ; Corrupts registers: 40 40 ; AL, BX, DX … … 45 45 46 46 %ifdef MODULE_SERIAL 47 ; 48 ; no need to do this for serial dev eices, and we use the DPT_RESET flag bits47 ; 48 ; no need to do this for serial devices, and we use the DPT_RESET flag bits 49 49 ; to store the drive type for serial floppy drives (MODULE_SERIAL_FLOPPY) 50 50 ; 51 51 xor ah, ah 52 52 test byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE ; Clears CF 53 jnz .ReturnNotSuccessful l53 jnz .ReturnNotSuccessful 54 54 %endif 55 55 56 56 ; Try to select drive and wait until ready 57 57 or BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET ; Everything uninitialized … … 59 59 mov [bp+IDEPACK.bDrvAndHead], al 60 60 call Device_SelectDrive 61 jc SHORT .ReturnNotSuccessful l61 jc SHORT .ReturnNotSuccessful 62 62 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nDRDY ; Clear since success 63 63 … … 80 80 .InitializeBlockMode: 81 81 call InitializeBlockMode 82 jc SHORT .ReturnNotSuccessful l82 jc SHORT .ReturnNotSuccessful 83 83 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nSETBLOCK ; Keeps CF clear 84 84 85 .ReturnNotSuccessful l:85 .ReturnNotSuccessful: 86 86 pop cx 87 87 pop si … … 96 96 ; Returns: 97 97 ; AH: BIOS Error code 98 ; CF: Cleared if succes full98 ; CF: Cleared if successful 99 99 ; Set if any error 100 100 ; Corrupts registers: … … 121 121 ; Returns: 122 122 ; AH: BIOS Error code 123 ; CF: Cleared if succes full123 ; CF: Cleared if successful 124 124 ; Set if any error 125 125 ; Corrupts registers: … … 146 146 ; Returns: 147 147 ; AH: BIOS Error code 148 ; CF: Cleared if succes full148 ; CF: Cleared if successful 149 149 ; Set if any error 150 150 ; Corrupts registers: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm
r162 r294 21 21 ; Returns with INTPACK: 22 22 ; AH: BIOS Error code 23 ; CF: 0 if succes full, 1 if error23 ; CF: 0 if successful, 1 if error 24 24 ;-------------------------------------------------------------------- 25 25 ALIGN JUMP_ALIGN … … 44 44 ; Returns: 45 45 ; AH: BIOS Error code 46 ; CF: 0 if succes full, 1 if error46 ; CF: 0 if successful, 1 if error 47 47 ; Corrupts registers: 48 48 ; AL, BX, CX, DX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r282 r294 15 15 ; Returns with INTPACK: 16 16 ; AH: Int 13h return status 17 ; CF: 0 if succes full, 1 if error17 ; CF: 0 if successful, 1 if error 18 18 ;-------------------------------------------------------------------- 19 19 ALIGN JUMP_ALIGN … … 37 37 ; Returns: 38 38 ; AH: Int 13h return status 39 ; CF: 0 if succes full, 1 if error39 ; CF: 0 if successful, 1 if error 40 40 ; Corrupts registers: 41 41 ; AL, SI … … 53 53 54 54 ; Initialize Master and Slave drives 55 mov al, [di+DPT.bIdevarsOffset] ;pointer to controller we are looking to reset56 mov ah, 0 ;initialize error code, assume success57 55 eMOVZX ax, [di+DPT.bIdevarsOffset] ; (AL) pointer to controller we are looking to reset 56 ; (AH) initialize error code, assume success 57 58 58 mov si, IterateAndResetDrives 59 59 call FindDPT_IterateAllDPTs … … 70 70 ; IterateAndResetDrives: Iteration routine for use with IterateAllDPTs. 71 71 ; 72 ; When a drive on the controller is found, it is reset, and the error code 72 ; When a drive on the controller is found, it is reset, and the error code 73 73 ; merged into overall error code for this controller. Master will be reset 74 74 ; first. Note that the iteration will go until the end of the DPT list. … … 79 79 push ax 80 80 call AH9h_InitializeDriveForUse ; Reset Master and Slave (Master will come first in DPT list) 81 pop ax 81 pop ax 82 82 jnc .done 83 83 or ah, (RET_HD_RESETFAIL << 1) | 1 ; OR in Reset Failed error code and CF, will SHR into position later -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm
r167 r294 19 19 ; BX: AA55h 20 20 ; CX: Support bits 21 ; CF: 0 if succes full, 1 if error21 ; CF: 0 if successful, 1 if error 22 22 ;-------------------------------------------------------------------- 23 23 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm
r249 r294 18 18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 ; CF: 0 if succes full, 1 if error20 ; CF: 0 if successful, 1 if error 21 21 ; Return with Disk Address Packet in INTPACK: 22 22 ; .wSectorCount Number of sectors read successfully -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm
r249 r294 20 20 ; Returns with INTPACK: 21 21 ; AH: Int 13h return status 22 ; CF: 0 if succes full, 1 if error22 ; CF: 0 if successful, 1 if error 23 23 ; Return with Disk Address Packet in INTPACK: 24 24 ; .wSectorCount Number of sectors written successfully -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm
r249 r294 18 18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 ; CF: 0 if succes full, 1 if error20 ; CF: 0 if successful, 1 if error 21 21 ; Return with Disk Address Packet in INTPACK: 22 22 ; .wSectorCount Number of sectors verified successfully -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm
r249 r294 18 18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 ; CF: 0 if succes full, 1 if error20 ; CF: 0 if successful, 1 if error 21 21 ;-------------------------------------------------------------------- 22 22 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r230 r294 19 19 ; AH: Int 13h return status 20 20 ; DS:SI: Ptr to Extended Drive Information Table 21 ; CF: 0 if succes full, 1 if error21 ; CF: 0 if successful, 1 if error 22 22 ;-------------------------------------------------------------------- 23 23 AH48h_HandlerForGetExtendedDriveParameters: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm
r230 r294 128 128 ConvertLCHStoLBARegisterValues: 129 129 ; cylToSeek*headsPerCyl (18-bit result) 130 mov ax, cx ; Copy Cylinder number to AX 131 ; We could save a byte here by using CWD instead of the XOR DH, DH in eMOVZX 132 ; but I'm not sure how that would affect speed. 130 mov ax, LBA_ASSIST_SPT ; Load Sectors per Track 131 xchg cx, ax ; Cylinder number to AX, Sectors per Track to CX 133 132 134 eMOVZX dx, BYTE [di+DPT.bLbaHeads] 133 %ifdef USE_386 134 movzx dx, [di+DPT.bLbaHeads] 135 %else 136 cwd 137 mov dl, [di+DPT.bLbaHeads] 138 %endif 135 139 mul dx ; DX:AX = cylToSeek*headsPerCyl 136 140 … … 141 145 142 146 ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result) 143 mov cx, LBA_ASSIST_SPT ; Load Sectors per Track144 147 xchg ax, dx ; Hiword to AX, loword to DX 145 148 mul cl ; AX = hiword * Sectors per Track -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
r221 r294 34 34 cmp ax, BYTE 127 35 35 ja SHORT InvalidNumberOfSectorsRequested 36 ; Fall to GetEbiosCommandIndexToBX37 36 38 ;-------------------------------------------------------------------- 39 ; GetEbiosCommandIndexToBX 40 ; Parameters: 41 ; DS:DI: Ptr to DPT 42 ; ES:SI: Ptr to DAP (Disk Address Packet) 43 ; Returns: 44 ; BX: Index to command lookup table 45 ; Corrupts registers: 46 ; AX, DX 47 ;-------------------------------------------------------------------- 48 GetEbiosCommandIndexToBX: 37 ; Get EBIOS command index to BX 49 38 ; LBA28 or LBA48 command 50 xor dx, dx39 cwd 51 40 mov al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31) 52 and a x, 00F0h ; Clear LBA28 bits 24...2741 and al, 0F0h ; Clear LBA28 bits 24...27 53 42 or ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 5 54 43 cmp dx, ax ; Set CF if any of bits 28...47 set -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r269 r294 26 26 mov cx, g_szDetectMaster 27 27 mov bh, MASK_DRVNHEAD_SET ; Select Master drive 28 call StartDetectionWithDriveSelectByteInBHandStringIn AX ; Detect and create DPT + BOOTNFO28 call StartDetectionWithDriveSelectByteInBHandStringInCX ; Detect and create DPT + BOOTNFO 29 29 30 30 mov cx, g_szDetectSlave 31 31 mov bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV 32 call StartDetectionWithDriveSelectByteInBHandStringIn AX32 call StartDetectionWithDriveSelectByteInBHandStringInCX 33 33 34 34 pop cx … … 72 72 mov al, [es:BDA.bHDCount] 73 73 add cl, al ; Add our drives to the system count 74 mov [es:BDA.bHDCount], cl 75 or al, 80h ; Or in hard disk flag 76 mov [RAMVARS.bFirstDrv], al ; Store first drive number 77 78 .AddFloppies: 79 %ifdef MODULE_SERIAL_FLOPPY 74 mov [es:BDA.bHDCount], cl 75 or al, 80h ; Or in hard disk flag 76 mov [RAMVARS.bFirstDrv], al ; Store first drive number 77 78 .AddFloppies: 79 %ifdef MODULE_SERIAL_FLOPPY 80 80 ;---------------------------------------------------------------------- 81 81 ; … … 84 84 dec ch 85 85 mov al, ch 86 js .NoFloppies ; if no drives are present, we store 0ffh 86 js .NoFloppies ; if no drives are present, we store 0ffh 87 87 88 88 call FloppyDrive_GetCountFromBIOS_or_BDA … … 92 92 add al, ch ; Add our drives to existing drive count 93 93 cmp al, 3 ; For BDA, max out at 4 drives (ours is zero based) 94 j l.MaxBDAFloppiesExceeded95 mov al, 3 94 jb .MaxBDAFloppiesExceeded 95 mov al, 3 96 96 .MaxBDAFloppiesExceeded: 97 97 eROR_IM al, 2 ; move to bits 6-7 98 98 inc ax ; low order bit, indicating floppy drive exists 99 99 100 mov ah, [es:BDA.wEquipment] ; Load Equipment WORD low byte 100 mov ah, [es:BDA.wEquipment] ; Load Equipment WORD low byte 101 101 and ah, 03eh ; Mask off drive number and drives present bit 102 102 or al, ah ; Or in new values … … 111 111 shr ch, 1 ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2) 112 112 rcl al, 1 ; starting drive number in upper 7 bits, number of drives in low bit 113 .NoFloppies: 113 .NoFloppies: 114 114 mov [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al 115 115 %endif 116 116 117 117 ret 118 118 119 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 119 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 120 120 %if FLG_ROMVARS_SERIAL_SCANDETECT != 8 121 121 %error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_SCANDETECT is the same bit as the ALT key code in the BDA. Changes in the code will be needed if these values are no longer the same." … … 125 125 126 126 ;-------------------------------------------------------------------- 127 ; StartDetectionWithDriveSelectByteInBHandStringIn AX127 ; StartDetectionWithDriveSelectByteInBHandStringInCX 128 128 ; Parameters: 129 129 ; BH: Drive Select byte for Drive and Head Register … … 137 137 ; AX, BX, CX, DX, SI, DI 138 138 ;-------------------------------------------------------------------- 139 StartDetectionWithDriveSelectByteInBHandStringIn AX:140 call DetectPrint_StartDetectWithMasterOrSlaveStringIn AXandIdeVarsInCSBP139 StartDetectionWithDriveSelectByteInBHandStringInCX: 140 call DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP 141 141 ; Fall to .ReadAtaInfoFromHardDisk 142 142 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r285 r294 28 28 29 29 ;-------------------------------------------------------------------- 30 ; DetectPrint_StartDetectWithMasterOrSlaveStringIn AXandIdeVarsInCSBP30 ; DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP 31 31 ; Parameters: 32 32 ; CS:CX: Ptr to "Master" or "Slave" string … … 38 38 ; AX, SI, DI, CX 39 39 ;-------------------------------------------------------------------- 40 DetectPrint_StartDetectWithMasterOrSlaveStringIn AXandIdeVarsInCSBP:40 DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP: 41 41 mov ax, [cs:bp+IDEVARS.wPort] ; for IDE: AX=port address, DH=.bDevice 42 42 mov dx, [cs:bp+IDEVARS.bDevice-1] ; for Serial: AL=port address>>2, AH=baud rate … … 48 48 49 49 mov si, g_szDetectOuter ; Load SI with default wrapper string "IDE %s at %s: " 50 50 51 51 push bp ; setup stack for call to 52 52 mov bp, sp ; BootMenuPrint_FormatCSSIfromParamsInSSBP … … 98 98 mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00" 99 99 100 .pushAndPrintSerial: 100 .pushAndPrintSerial: 101 101 mov si, g_szDetectOuterSerial ; Finally load SI with wrapper string "Serial %s on %s: " 102 102 103 103 .pushAndPrint: 104 104 %endif 105 105 106 106 push cx ; Push print string 107 107 push ax ; Push high order digits, or port address, or N/A -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm
r248 r294 39 39 SwapFloppyDriveOrHardDisk: 40 40 mov ah, 80h ; Assume hard disk 41 mov al, BYTE[RAMVARS.xlateVars+XLATEVARS.bHDSwap]41 mov al, [RAMVARS.xlateVars+XLATEVARS.bHDSwap] 42 42 test dl, ah ; Hard disk? 43 43 jnz SHORT SwapDrive ; If so, jump to swap 44 mov al, BYTE[RAMVARS.xlateVars+XLATEVARS.bFDSwap]44 mov al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap] 45 45 cbw 46 46 ; Fall to SwapDrive -
trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm
r274 r294 127 127 ;-------------------------------------------------------------------- 128 128 ALIGN JUMP_ALIGN 129 FloppyDrive_GetCountToAX: 129 FloppyDrive_GetCountToAX: 130 130 %ifdef MODULE_SERIAL_FLOPPY 131 131 call RamVars_UnpackFlopCntAndFirstToAL 132 132 js .UseBIOSorBDA ; We didn't add in any drives, counts here are not valid 133 134 adc al,1 ; adds in the drive count bit, and adds 1 for count vs. 0-index, 133 134 adc al,1 ; adds in the drive count bit, and adds 1 for count vs. 0-index, 135 135 jmp .FinishCalc ; need to clear AH on the way out, and add in minimum drive numbers 136 136 137 .UseBIOSorBDA: 137 .UseBIOSorBDA: 138 138 %endif 139 139 call FloppyDrive_GetCountFromBIOS_or_BDA 140 140 141 .FinishCalc: 141 .FinishCalc: 142 142 mov ah, [cs:ROMVARS.bMinFddCnt] 143 143 MAX_U al, ah 144 144 cbw 145 146 ret 147 148 ALIGN JUMP_ALIGN 145 146 ret 147 148 ALIGN JUMP_ALIGN 149 149 FloppyDrive_GetCountFromBIOS_or_BDA: 150 150 push es … … 152 152 ;-------------------------------------------------------------------- 153 153 ; Reads Floppy Drive Count from BIOS. 154 ; Does not work on most XT systems. Call FloppyDrive_GetCountFromBDA154 ; Does not work on most XT systems. Call .GetCountFromBDA 155 155 ; if this function fails. 156 156 ; 157 ; GetCountFromBIOS157 ; .GetCountFromBIOS 158 158 ; Parameters: 159 159 ; Nothing 160 160 ; Returns: 161 161 ; AL: Number of Floppy Drives 162 ; CF: Cleared if successful l162 ; CF: Cleared if successful 163 163 ; Set if BIOS function not supported 164 164 ; Corrupts registers: … … 169 169 .GetCountFromBIOS: 170 170 push di 171 push es172 171 push bx 173 172 push cx … … 182 181 pop cx 183 182 pop bx 184 pop es185 183 pop di 186 184 %endif … … 188 186 ;-------------------------------------------------------------------- 189 187 ; Reads Floppy Drive Count (0...4) from BIOS Data Area. 190 ; This function should be used only if FloppyDrive_GetCountFromBIOS fails.191 ; 192 ; GetCountFromBDA193 ; Parameters: 194 ; Nothing 195 ; Returns: 196 ; CL: Number of Floppy Drives197 ; Corrupts registers: 198 ; CH, ES188 ; This function should be used only if .GetCountFromBIOS fails. 189 ; 190 ; .GetCountFromBDA 191 ; Parameters: 192 ; Nothing 193 ; Returns: 194 ; AL: Number of Floppy Drives 195 ; Corrupts registers: 196 ; AH, ES 199 197 ;-------------------------------------------------------------------- 200 198 %ifndef USE_AT … … 203 201 LOAD_BDA_SEGMENT_TO es, ax 204 202 mov al, [es:BDA.wEquipment] ; Load Equipment WORD low byte 205 mov ah, al ; Copy it to CH203 mov ah, al ; Copy it to AH 206 204 and ax, 0C001h ; Leave bits 15..14 and 0 207 205 eROL_IM ah, 2 ; EW low byte bits 7..6 to 1..0 208 add al, ah ; CL = Floppy Drive count206 add al, ah ; AL = Floppy Drive count 209 207 %endif 210 208 211 209 pop es 212 210 ret 213 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
r258 r294 62 62 mov di, ROMVARS.ideVars0 ; CS:SI points to first IDEVARS 63 63 .IdeControllerLoop: 64 mov al, BYTE[cs:di+IDEVARS.bIRQ]64 mov al, [cs:di+IDEVARS.bIRQ] 65 65 add di, BYTE IDEVARS_size ; Increment to next controller 66 66 call .InstallLowOrHighIrqHandler … … 147 147 ;-------------------------------------------------------------------- 148 148 Interrupts_UnmaskInterruptControllerForDriveInDSDI: 149 eMOVZX bx, BYTE[di+DPT.bIdevarsOffset]149 eMOVZX bx, [di+DPT.bIdevarsOffset] 150 150 mov al, [cs:bx+IDEVARS.bIRQ] 151 151 test al, al -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r292 r294 13 13 ; file (so no linker needed, Nasm does it all). 14 14 15 ORG 000h; Code start offset 0000h15 ORG 0 ; Code start offset 0000h 16 16 17 17 %define MENUEVENT_INLINE_OFFSETS ; Only one menu required, save space and inline offsets … … 201 201 %include "IdeTransfer.asm" ; Must be included after IdeCommand.asm 202 202 %include "IdeWait.asm" 203 %include "IdeError.asm" ; Must be included after IdeWait.asm 203 %include "IdeError.asm" ; Must be included after IdeWait.asm 204 204 %include "IdeDPT.asm" 205 205 %include "IdeIO.asm" … … 215 215 %include "MemIdeTransfer.asm" ; Must be included after IdeCommand.asm 216 216 %include "IdeWait.asm" 217 %include "IdeError.asm" ; Must be included after IdeWait.asm 217 %include "IdeError.asm" ; Must be included after IdeWait.asm 218 218 %undef IDEDEVICE 219 219 %endif -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r292 r294 29 29 %endif 30 30 31 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringIn AXandIdeVarsInCSBP31 ; The following strings are used by DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP 32 32 ; To support an optimization in that code, these strings must start on the same 256 byte page, 33 33 ; which is checked at assembly time below. … … 49 49 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 50 50 %if ((g_szDetectEnd-$$) & 0xff00) <> ((g_szDetectStart-$$) & 0xff00) 51 %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringIn AXandIdeVarsInCSBP. Please move this block up or down within strings.asm"51 %error "g_szDetect* strings must start on the same 256 byte page, required by DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP. Please move this block up or down within strings.asm" 52 52 %endif 53 53 %endif -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r262 r294 18 18 ; Returns: 19 19 ; DL: Drive number for new drive 20 ; DS:DI: Ptr to Disk Parameter Table (if succes full)20 ; DS:DI: Ptr to Disk Parameter Table (if successful) 21 21 ; CF: Cleared if DPT created successfully 22 22 ; Set if any error … … 202 202 ;---------------------------------------------------------------------- 203 203 ; Update drive counts (hard and floppy) 204 ;---------------------------------------------------------------------- 205 204 ;---------------------------------------------------------------------- 205 206 206 %ifdef MODULE_SERIAL_FLOPPY 207 207 ; 208 208 ; These two instructions serve two purposes: 209 209 ; 1. If the drive is a floppy drive (CF set), then we effectively increment the counter. 210 ; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is 210 ; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is 211 211 ; effectively discarded. This is more of a safety check then code that should ever normally be hit (see below). 212 ; Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT, 212 ; Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT, 213 213 ; this was necessary. Now, this situation shouldn't happen in normal operation, for a couple of reasons: 214 ; A. xtidecfg always puts configured serial ports at the end fothe IDEVARS list214 ; A. xtidecfg always puts configured serial ports at the end of the IDEVARS list 215 215 ; B. the auto serial code is always executed last 216 216 ; C. the serial server always returns floppy drives last 217 217 ; 218 218 adc byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0 219 jnz .AllDone 219 jnz .AllDone 220 220 %else 221 221 ; 222 222 ; Even without floppy support enabled, we shouldn't try to mount a floppy image as a hard disk, which 223 ; could lead to unpredictable results since no MBR will be present, etc. The server doesn't know that 223 ; could lead to unpredictable results since no MBR will be present, etc. The server doesn't know that 224 224 ; floppies are supported, so it is important to still fail here if a floppy is seen during the drive scan. 225 225 ; … … 228 228 229 229 inc BYTE [RAMVARS.bDrvCnt] ; Increment drive count to RAMVARS 230 231 .AllDone: 230 231 .AllDone: 232 232 clc 233 233 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r277 r294 8 8 ; Checks if drive is handled by this BIOS, and return DPT pointer. 9 9 ; 10 ; FindDPT_ForDriveNumberInDL 10 ; FindDPT_ForDriveNumberInDL 11 11 ; Parameters: 12 12 ; DL: Drive number … … 21 21 ;-------------------------------------------------------------------- 22 22 ALIGN JUMP_ALIGN 23 FindDPT_ForDriveNumberInDL: 23 FindDPT_ForDriveNumberInDL: 24 24 xchg di, ax ; Save the contents of AX in DI 25 25 26 ; 26 ; 27 27 ; Check Our Hard Disks 28 28 ; … … 33 33 cmp dl, ah ; Above last supported? 34 34 jae SHORT .HardDiskNotHandledByThisBIOS 35 35 36 36 cmp dl, al ; Below first supported? 37 37 jae SHORT .CalcDPTForDriveNumber 38 38 39 ALIGN JUMP_ALIGN 40 .HardDiskNotHandledByThisBIOS: 39 ALIGN JUMP_ALIGN 40 .HardDiskNotHandledByThisBIOS: 41 41 ; 42 42 ; Check Our Floppy Disks 43 ; 43 ; 44 44 call RamVars_UnpackFlopCntAndFirstToAL 45 45 js SHORT .DiskIsNotHandledByThisBIOS 46 46 47 47 cbw ; Always 0h (no floppy drive covered above) 48 48 adc ah, al ; Add in first drive number and number of drives … … 51 51 jz SHORT .CalcDPTForDriveNumber 52 52 cmp al, dl ; Check first drive in all cases, redundant but OK to repeat 53 jnz SHORT .DiskIsNotHandledByThisBIOS 53 jnz SHORT .DiskIsNotHandledByThisBIOS 54 54 %else 55 cmp dl, ah ; Above last supported? 55 cmp dl, ah ; Above last supported? 56 56 jae SHORT .DiskIsNotHandledByThisBIOS 57 57 58 58 cmp dl, al ; Below first supported? 59 jb SHORT .DiskIsNotHandledByThisBIOS 59 jb SHORT .DiskIsNotHandledByThisBIOS 60 60 %endif 61 61 ; fall-through to CalcDPTForDriveNumber … … 63 63 ;-------------------------------------------------------------------- 64 64 ; Finds Disk Parameter Table for drive number. 65 ; Not e intended to be called except by FindDPT_ForDriveNumber65 ; Not intended to be called except by FindDPT_ForDriveNumberInDL 66 66 ; 67 67 ; CalcDPTForDriveNumber … … 69 69 ; DL: Drive number 70 70 ; DS: RAMVARS segment 71 ; DI: Saved copy of AX from entry at FindDPT_ForDriveNumber 71 ; DI: Saved copy of AX from entry at FindDPT_ForDriveNumberInDL 72 72 ; Returns: 73 73 ; DS:DI: Ptr to DPT … … 82 82 %ifdef MODULE_SERIAL_FLOPPY 83 83 mov ax, [RAMVARS.wDrvCntAndFirst] 84 84 85 85 test dl, dl 86 86 js .harddisk … … 88 88 call RamVars_UnpackFlopCntAndFirstToAL 89 89 add dl, ah ; add in end of hard disk DPT list, floppies start immediately after 90 91 ALIGN JUMP_ALIGN 90 91 ALIGN JUMP_ALIGN 92 92 .harddisk: 93 93 sub dl, al ; subtract off beginning of either hard disk or floppy list (as appropriate) … … 96 96 %endif 97 97 98 .CalcDPTForNewDrive: 98 .CalcDPTForNewDrive: 99 99 mov al, LARGEST_DPT_SIZE 100 100 101 101 mul dl 102 add ax, BYTE RAMVARS_size ; Clears CF (will not ove flow)102 add ax, BYTE RAMVARS_size ; Clears CF (will not overflow) 103 103 104 104 pop dx … … 107 107 ret 108 108 109 ALIGN JUMP_ALIGN 110 .DiskIsNotHandledByThisBIOS: 109 ALIGN JUMP_ALIGN 110 .DiskIsNotHandledByThisBIOS: 111 111 ; 112 112 ; Drive not found... 113 113 ; 114 114 xor ax, ax ; Clear DPT pointer 115 stc ; Is not supported by our BIOS 116 115 stc ; Is not supported by our BIOS 116 117 117 xchg di, ax ; Restore AX from save at top 118 118 ret … … 136 136 137 137 ;-------------------------------------------------------------------- 138 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 138 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 139 139 ; for use with IterateAllDPTs 140 ; 140 ; 141 141 ; Returns when DPT is found on the controller with Idevars offset in DL 142 142 ; … … 148 148 ; Set if wrong DPT 149 149 ;-------------------------------------------------------------------- 150 IterateFindFirstDPTforIdevars: 150 IterateFindFirstDPTforIdevars: 151 151 cmp dl, [di+DPT.bIdevarsOffset] ; Clears CF if matched 152 152 je .done 153 153 stc ; Set CF for not found 154 .done: 154 .done: 155 155 ret 156 156 … … 171 171 FindDPT_ForNewDriveToDSDI: 172 172 push dx 173 173 174 174 %ifdef MODULE_SERIAL_FLOPPY 175 175 mov dx, [RAMVARS.wDrvCntAndFlopCnt] … … 178 178 mov dl, [RAMVARS.bDrvCnt] 179 179 %endif 180 180 181 181 jmp short FindDPT_ForDriveNumberInDL.CalcDPTForNewDrive 182 182 … … 185 185 ; Parameters: 186 186 ; DS:DI: Ptr to DPT to examine 187 ; BL: Bit(s) to test in DPT.bFlagsHigh 187 ; BL: Bit(s) to test in DPT.bFlagsHigh 188 188 ; Returns: 189 189 ; CF: Clear if wanted DPT found … … 193 193 ;-------------------------------------------------------------------- 194 194 ALIGN JUMP_ALIGN 195 IterateToDptWithFlagsHighInBL: 196 test BYTE [di+DPT.bFlagsHigh], bl; Clears CF195 IterateToDptWithFlagsHighInBL: 196 test [di+DPT.bFlagsHigh], bl ; Clears CF 197 197 jnz SHORT .ReturnRightDPT 198 198 stc 199 .ReturnRightDPT: 199 .ReturnRightDPT: 200 200 ret 201 201 … … 212 212 ;-------------------------------------------------------------------- 213 213 %ifdef MODULE_SERIAL 214 ALIGN JUMP_ALIGN 215 FindDPT_ToDSDIforSerialDevice: 214 ALIGN JUMP_ALIGN 215 FindDPT_ToDSDIforSerialDevice: 216 216 mov bl, FLGH_DPT_SERIAL_DEVICE 217 217 ; fall-through 218 218 %endif 219 219 220 220 ;-------------------------------------------------------------------- 221 221 ; FindDPT_ToDSDIforFlagsHigh … … 231 231 ;-------------------------------------------------------------------- 232 232 ALIGN JUMP_ALIGN 233 FindDPT_ToDSDIforFlagsHighInBL: 233 FindDPT_ToDSDIforFlagsHighInBL: 234 234 mov si, IterateToDptWithFlagsHighInBL 235 235 ; Fall to IterateAllDPTs … … 257 257 258 258 mov di, RAMVARS_size ; Point DS:DI to first DPT 259 260 mov cl, [RAMVARS.bDrvCnt] 261 xor ch, ch ; Clears CF 262 259 eMOVZX cx, [RAMVARS.bDrvCnt] 263 260 jcxz .NotFound ; Return if no drives 264 261 265 262 ALIGN JUMP_ALIGN 266 263 .LoopWhileDPTsLeft: -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r270 r294 125 125 ALIGN JUMP_ALIGN 126 126 RamVars_GetHardDiskCountFromBDAtoAX: 127 push es128 129 LOAD_BDA_SEGMENT_TO es, ax130 127 call RamVars_GetCountOfKnownDrivesToAX 131 mov cl, [es:BDA.bHDCount] 128 push ds 129 LOAD_BDA_SEGMENT_TO ds, cx 130 mov cl, [BDA.bHDCount] 132 131 MAX_U al, cl 133 134 pop es 132 pop ds 135 133 ret 136 134 … … 151 149 cbw 152 150 ret 153 151 154 152 ;-------------------------------------------------------------------- 155 153 ; RamVars_GetIdeControllerCountToCX … … 163 161 ALIGN JUMP_ALIGN 164 162 RamVars_GetIdeControllerCountToCX: 165 eMOVZX cx, BYTE[cs:ROMVARS.bIdeCnt]163 eMOVZX cx, [cs:ROMVARS.bIdeCnt] 166 164 ret 167 165 … … 177 175 ; Corrupts registers: 178 176 ; Nothing 179 ;-------------------------------------------------------------------- 177 ;-------------------------------------------------------------------- 180 178 ALIGN JUMP_ALIGN 181 179 RamVars_UnpackFlopCntAndFirstToAL: 182 180 mov al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst] 183 sar al, 1 181 sar al, 1 184 182 ret 185 183 %endif
Note:
See TracChangeset
for help on using the changeset viewer.